\dfdZddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl Z ddl Z ddlZddlZddlZddlmZGddeZgdZdZdZGd d eZGd d eZGd deZdZGddejejZeFgdZ e D].Z!ee"ede!zj#dzz Z/eej$jz Z[ [!d#dZ%d#dZ&dZ'dZ(dddZ)d$dZ*dZ+dZ,dZ-dZ.d Z/d!Z0e1d"krddl2Z2e2j0dSdS)%a The Python Debugger Pdb ======================= To use the debugger in its simplest form: >>> import pdb >>> pdb.run('') The debugger's prompt is '(Pdb) '. This will stop in the first function call in . Alternatively, if a statement terminated with an unhandled exception, you can use pdb's post-mortem facility to inspect the contents of the traceback: >>> >>> import pdb >>> pdb.pm() The commands recognized by the debugger are listed in the next section. Most can be abbreviated as indicated; e.g., h(elp) means that 'help' can be typed as 'h' or 'help' (but not as 'he' or 'hel', nor as 'H' or 'Help' or 'HELP'). Optional arguments are enclosed in square brackets. Alternatives in the command syntax are separated by a vertical bar (|). A blank line repeats the previous command literally, except for 'list', where it lists the next 11 lines. Commands that the debugger doesn't recognize are assumed to be Python statements and are executed in the context of the program being debugged. Python statements can also be prefixed with an exclamation point ('!'). This is a powerful way to inspect the program being debugged; it is even possible to change variables or call functions. When an exception occurs in such a statement, the exception name is printed but the debugger's state is not changed. The debugger supports aliases, which can save typing. And aliases can have parameters (see the alias help entry) which allows one a certain level of adaptability to the context under examination. Multiple commands may be entered on a single line, separated by the pair ';;'. No intelligence is applied to separating the commands; the input is split at the first ';;', even if it is in the middle of a quoted string. If a file ".pdbrc" exists in your home directory or in the current directory, it is read in and executed as if it had been typed at the debugger prompt. This is particularly useful for aliases. If both files exist, the one in the home directory is read first and aliases defined there can be overridden by the local file. This behavior can be disabled by passing the "readrc=False" argument to the Pdb constructor. Aside from aliases, the debugger is not directly programmable; but it is implemented as a class from which you can derive your own debugger class, which you can make as fancy as you like. Debugger commands ================= N)UnionceZdZdZdS)RestartzBCauses a debugger to be restarted for the debugged python program.N)__name__ __module__ __qualname____doc__..\python\lib\pdb.pyrrZsLLDr r) runpmPdbrunevalrunctxruncall set_trace post_mortemhelpcZtjdtj|z} tj|}n#t $rYdSwxYw|5t |dD]-\}}||r|||fccdddS. dddn #1swxYwYdS)Nzdef\s+%s\s*[(])start)recompileescapetokenizeopenOSError enumeratematch)funcnamefilenamecrefplinenolines r find_functionr'as1 *&8)<)<< = =C ]8 $ $ tt 22%b222 2 2LFDyy 2611122222222 2 2222222222222222 4s)A A A2B B  B$'B$cttj|}||D]\}}||kr|cSdSNr)listdisfindlinestartsreverse)codelasti linestartsir%s r lasti2linenor2ns[c(..//J 6 A::MMM  1r ceZdZdZdZdS)_rstrz#String that doesn't quote its repr.c|SNr selfs r __repr__z_rstr.__repr__ys r N)rrrr r9r r r r4r4ws)--r r4cfeZdZfdZdZedZedZedZxZ S) _ScriptTargetct|tj|}||_|Sr6)super__new__ospathrealpathorig)clsvalres __class__s r r>z_ScriptTarget.__new__~s8ggooc27#3#3C#8#899 r ctj|s*td|jdt jdtj|t jd<dS)NzError:zdoes not existrr)r?r@existsprintrBsysexitdirnamer7s r checkz_ScriptTarget.checksYw~~d##  (DI'7 8 8 8 HQKKKgood++ r c|Sr6r r7s r r"z_ScriptTarget.filenames r c0td|tS)N__main__)r__file__ __builtins__)dictrRr7s r namespacez_ScriptTarget.namespaces"%    r ctj|5}d|d|dcdddS#1swxYwYdS)Nz exec(compile(z, z , 'exec')))io open_coderead)r8r$s r r.z_ScriptTarget.codes \$   E2D27799DD$DDD E E E E E E E E E E E E E E E E E Es=AA) rrrr>rMpropertyr"rTr. __classcell__)rFs@r r;r;}s,,,X  X EEXEEEEEr r;ceZdZdZejdZedZedZ edZ edZ dS) _ModuleTargetc |jdS#t$r+tjt jdYdSwxYwNr)_details Exception traceback print_excrJrKr7s r rMz_ModuleTarget.checksO  MMMM      ! ! ! HQKKKKKK s 1AAc4ddl}||Sr))runpy_get_module_details)r8rds r r_z_ModuleTarget._detailss ((...r c|jjSr6)r. co_filenamer7s r r"z_ModuleTarget.filenames y$$r c|j\}}}|Sr6r_r8namespecr.s r r.z_ModuleTarget.code=dD r c|j\}}}|Sr6rirjs r _specz_ModuleTarget._specrmr ctdtjtj|j|jj|jj|jtS)NrP)rrQ __package__ __loader____spec__rR) rSr?r@normcaseabspathr"roparentloaderrRr7s r rTz_ModuleTarget.namespacesWW%%bgoodm&D&DEE )z(Z%     r N) rrrrM functoolscached_propertyr_rYr"r.rorTr r r r\r\s///%%X%XX  X   r r\z -> ceZdZdZ dVdZdZdZdZd Zd Z d Z d Z d Z dZ dZdZdZdZdZdZdZdZdZdZdZdZdZdZdZeZdWdZd ZeZ eZ!eZ"d!Z#eZ$d"Z%d#Z&d$Z'eZ(d%Z)eZ*d&Z+eZ,d'Z-eZ.d(Z/e/Z0eZ1eZ2d)Z3e3Z4e3Z5d*Z6d+Z7e7Z8d,Z9e9Z:d-Z;e;Zd/Z?e?Z@d0ZAeAZBd1ZCeCZDd2ZEeExZFZGd3ZHeHZId4ZJeZKd5ZLeLZMeLZNd6ZOd7ZPePZQd8ZReRZSd9ZTdXd:ZUd;ZVd<ZWd=ZXd>ZYeZZeZ[eZ\d?Z]e]Z^d@Z_e_Z`dAZaeZbdYdCZcdDZdeZedEZfeZgdFZhdGZidHZjdIZkdJZldKZmgdLZndMZoepfdNZqdOZrerZsdPZtdQZudRZvdSewexeyffdTZzdUZ{dS)ZrNtabFTcrtj||tj||||t jd|rd|_d|_i|_ i|_ d|_ d|_ i|_ ddl}|dn#t $rYnwxYwd|_||_g|_|r t)t*jdd 5}|j|dddn #1swxYwYn#t2$rYnwxYw t)d d 5}|j|dddn #1swxYwYn#t2$rYnwxYwi|_i|_i|_d|_d|_dS) N)skipzpdb.Pdbrz(Pdb) Fz `@#$%^&*()=+[{]}\|;:'",<>?z~/.pdbrczutf-8)encodingz.pdbrc)bdbBdb__init__cmdCmdrJaudit use_rawinputpromptaliases displaying mainpyfile_wait_for_mainpyfile tb_linenoreadlineset_completer_delims ImportError allow_kbdintnosigintrcLinesrr?r@ expanduserextendrcommandscommands_dopromptcommands_silentcommands_defining commands_bnum) r8 completekeystdinstdoutr}rreadrcrrcFiles r rz Pdb.__init__sk D))) {E6::: )  " !D   $)!  OOO  ) )*M N N N N    D !     "',,Z887KKK0vL''///000000000000000     (W5550L''///000000000000000     !#!!&!s~ B&& B32B3.D/<D# D/#D''D/*D'+D// D<;D<FE8, F8E<<F?E<F FFc|jrt|d|||dS)Nz- Program interrupted. (Use 'cont' to resume).)rKeyboardInterruptmessageset_stepr)r8signumframes r sigint_handlerzPdb.sigint_handlersK   $# # EFFF  ur cltj||dSr6)rrresetforgetr7s r rz Pdb.reset s'  d r cpd|_g|_d|_d|_|jdSr))r%stackcurindexcurframerclearr7s r rz Pdb.forget s8     r cf||||\|_|_|r7t |jj|j}||j|j<|j }|7|j|jd|_ |j j |_ | Sr))r get_stackrrr2tb_framef_codetb_lastirtb_nextrf_localscurframe_locals execRcLines)r8ftbr%s r setupz Pdb.setups $(NN1b$9$9! DM ""+"4bkBBF*0DN2; 'B   4=1!4  $}5!!!r c8|jsdS|j}|g|_|rl|}|r@|ddkr4||r|xjt |z c_dS|jdSdS)Nr#T)rr-popstriponecmdreversed)r8rr&s r rzPdb.execRcLines&s|  F,  ;;==&&((D Q3;;t$$ LLHW$5$55LL4     r c|jrdS||r-|d||ddSdS)znThis method is called when there is the remote possibility that we ever need to stop in this function.Nz--Call--)r stop_herer interaction)r8r argument_lists r user_callz Pdb.user_call:s`  $  F >>%  * LL $ $ $   UD ) ) ) ) ) * *r c|jr<|j||jjks |jdkrdSd|_||r||ddSdS)z;This function is called when we stop or break at this line.rNF)rrcanonicrrgf_lineno bp_commandsr)r8rs r user_linez Pdb.user_lineCs  $ .4<< 0H#I#III>Q&&(-D %   E " " *   UD ) ) ) ) ) * *r ct|ddr|j|jvr|j}d|_|j}||d|j|D]}||||_|j|s%||j|j |j |r| | dSdS)zCall every command that was set for the current active breakpoint (if there is one). Returns True if the normal interaction function must be called, False otherwise. currentbpFrNr) getattrrrlastcmdrrrprint_stack_entryrrr_cmdloopr)r8rr lastcmd_backr&s r rzPdb.bp_commandsMs 4e , , ~..IDNsingle) rr f_globalsrrJrrrexec _error_exc)r8r&localsglobalsr. save_stdout save_stdinsave_displayhooks r defaultz Pdb.defaults 8s??48D%-) 4$; 8<>$-- -**400 0r c||\}}}|sdS|dkrd|j|j<dS|dkr g|_dS|j|j}|r||dz|zn|| t |d|z}n#t$r |j}YnwxYw|j |j vrd|j |j<g|_dSdS) z8Handles one command line during command list definition.NsilentTendrrdo_F) parselinerrrrrrAttributeErrorrrcommands_resumingr)r8r&rargcmdlistfuncs r rzPdb.handle_command_defs--S$  F (??7;D !3 4 F E\\DM1- 23  NN3s73; ' ' ' ' NN3    4--DD   D "4#5 6DM1s BB21B2c2t||jdS)NfilerIrr8msgs r rz Pdb.message s c $$$$$$r c4td||jdS)Nz***r$r&r's r errorz Pdb.errors eSt{++++++r c8|drgS |||||}n#t$rg}YnwxYwt jt j|dz}|D]}t j|r| |dz:t j |r?| dr| |dz|S)N):,*/).pyz.pywr,) rendswith_complete_expressionr`globrr?r@isdirrisfilelower)r8textr&begidxendidxretglobsfns r _complete_locationzPdb._complete_locations ::<<  , , I ++D$GGCC   CCC  $+d++c122 % %Bw}}R   % 28$$$$## % (;(;O(L(L % 28$$$ sA AAcXfdttjjDS)Nc|g|]8\}}|t|)t|9Sr6)r  startswith).0r1bpr7s r z*Pdb._complete_bpnumber..-sG???51b>c!ff&7&7&=&=>A!>>r )rr Breakpoint bpbynumberr8r7r&r8r9s ` r _complete_bpnumberzPdb._complete_bpnumber)s:????Icn.G$H$H??? ?r c |jsgSi|jj|j}dvrd |d}ddD]}t ||}n#t t f$rgcYSwxYwddddz  fdt|DSfd| DS)N.rrrcPg|]"}|d|z#S)rr@)rAndottedrs r rCz,Pdb._complete_expression..Ds2MMM1ALL4L4LMFQJMMMr c>g|]}||Sr rK)rArLr7s r rCz,Pdb._complete_expression..Gs*???!ALL,>,>?A???r ) rrrrrKeyErrorrr dirkeys) r8r7r&r8r9nsrpartrMrs ` @@r r2zPdb._complete_expression0s} IA ' @4+? @ $;;ZZ__F m"1R4L--D!#t,,CC-n-     XXfSbSk**S0FMMMMMCMMM M@???rwwyy??? ?s+A((A>=A>c^|s"ttjjdz }n. t |}n#|dYdSxYw ||n0#t$r#}|d|zYd}~dSd}~wwxYw||_||j vr'|j ||j ||j |f}nd}g|j |<d|j |<d|j |<|j }d|_ d|_ |np#t$rc|r1|d|j |<|d|j |<|d |j |<n|j |=|j |=|j |=|d YnwxYwd|_ ||_ dS#d|_ ||_ wxYw) a4commands [bpnumber] (com) ... (com) end (Pdb) Specify a list of commands for breakpoint number bpnumber. The commands themselves are entered on the following lines. Type a line containing just 'end' to terminate the commands. The commands are executed when the breakpoint is hit. To remove all commands from a breakpoint, type commands and follow it immediately with end; that is, give no commands. With no bpnumber argument, commands refers to the last breakpoint set. You can use breakpoint commands to start your program up again. Simply use the continue command, or step, or any other command that resumes execution. Specifying any command resuming execution (currently continue, step, next, return, jump, quit and their abbreviations) terminates the command list (as if that command was immediately followed by end). This is because any time you resume execution (even with a simple next or step), you may encounter another breakpoint -- which could have its own command list, leading to ambiguities about which list to execute. If you use the 'silent' command in the command list, the usual message about stopping at a breakpoint is not printed. This may be desirable for breakpoints that are to print a specific message and then continue. If none of the other commands print anything, you will see no sign that the breakpoint was reached. rz.Usage: commands [bnum] ... endNzcannot set commands: %sTFz(com) rrz1command definition aborted, old commands restored)lenrrDrEintr*get_bpbynumberrrrrrrrrr)r8r bnumerrold_command_defs prompt_backs r do_commandszPdb.do_commandsMs J s~011A5DD 3xx  MNNN     % % % %    JJ036 7 7 7 FFFFF " 4= $ d 3 $ 6t < $ 4T : <   $   d'+t$%*T"k  !% & LLNNNN L L L /&6q&9 d#/?/B&t,-=a-@$T**M$'*40(. JJJ K K K K K L&+D "%DKKK&+D "%DK % % % %sL6AA** B4BBDFA*F FF  FF,rc|s[|jrR|dtjjD]+}|r'||,dSd}d}d}|d}|dkr;||dzd}|d|}| d}d} |dkr|d|}| |} | s| d|zdS| }||dzd} t|}n#t$r| d|zYdSwxYw t|}n#t$r t||jj|j} n #|} YnxYw t%| d r| j} | j} | j} | j}| j}nO#||\} }}| s| d |zYYdS| } t|}YnxYwYnwxYw|s|}|||}|rz|||||| }|r| |dS|||d }|d |j|j|jfzdSdS) ab(reak) [ ([filename:]lineno | function) [, condition] ] Without argument, list all breaks. With a line number argument, set a break at this line in the current file. With a function name, set a break at the first executable line of that function. If a second argument is present, it is a string specifying an expression which must evaluate to true before the breakpoint is honored. The line number may be prefixed with a filename and a colon, to specify a breakpoint in another file (probably one that hasn't been loaded yet). The file is searched for on sys.path; the .py suffix may be omitted. z!Num Type Disp Enb WhereNr-rrr,z%r not found from sys.pathzBad lineno: %s__func__zJThe specified object %r is not a function or was not found along sys.path.rzBreakpoint %d at %s:%d) breaksrrrDrEbpformatr r rrfind lookupmoduler*rVrevalrrrhasattrr^__code__co_nameco_firstlinenorglineinfo defaultFile checkline set_break get_breaksnumberr%r&)r8r  temporaryrBr"r%condcommacolonr!rr"r.oklnr&rYs r do_breakz Pdb.do_breaksy { 4 @AAA.344B4 R[[]]333 F  199uQwxx=''))Dfuf+$$&&C # A::6E6{))++H!!(++A  7(BCCCeAghh-&&((C S    +c1222   %S % % % $ 7 $ 466DDDDD%tZ00-#}=D $|H!0F#/HH%)-s););&R2 $FHK$LMMM!H WWFFF1 %2 *''))H~~h//  <..4D(KKC < 3__Xt44R8 5 i"':;<<<<< < )rrrgr)r8r"s r rizPdb.defaultFiles-='3 z ! !do !Hr c2||ddS)ztbreak [ ([filename:]lineno | function) [, condition] ] Same arguments as break, but sets a temporary breakpoint: it is automatically deleted when first hit. rN)rtr8r s r do_tbreakz Pdb.do_tbreak s c1r cDd}|d}t|dkr|d}n0t|dkr|d}n|S|dkr|S|d}|ddkr|d=t|dkr|S|}t|dkr |d}n'||d}|r|}|d}t ||} | p|S) N)NNN'rrr~rIr8)rrUrrirbr') r8 identifierfailedidstringidpartsfnameitemranswers r rhz Pdb.lineinfos)###C(( x==A  !""$$BB ]]a  !""$$BBM 88F]  8v  a5zzQ   "" u::??8DD!!%(++A 8DtU++r cFt|dd}|r|jnd}tj|||}|s|ddS|}|r(|ddks|dddks|dddkr|d dS|S) zCheck whether specified line seems to be executable. Return `lineno` if it is, 0 if not (e.g. a docstring, comment, blank line or EOF). Warning: testing is not comprehensive. rNz End of filerrr{z"""z'''zBlank or comment)rr linecachegetlinerrr*)r8r"r%rr;r&s r rjz Pdb.checkline5sj$//#(2d 6599  LL ' ' '1zz|| aC2A2h%D!H$5$5 JJ) * * *1 r c|}|D]p} ||}||d|zE#t$r}||Yd}~id}~wwxYwdS)zenable bpnumber [bpnumber ...] Enables the breakpoints given as a space separated list of breakpoint numbers. z Enabled %sN)rrWenablerrr*r8r rr1rBrYs r do_enablez Pdb.do_enableKs yy{{ 0 0A 0((++  \B.////     3  0 0A B&BBc|}|D]p} ||}||d|zE#t$r}||Yd}~id}~wwxYwdS)aNdisable bpnumber [bpnumber ...] Disables the breakpoints given as a space separated list of breakpoint numbers. Disabling a breakpoint means it cannot cause the program to stop execution, but unlike clearing a breakpoint, it remains in the list of breakpoints and can be (re-)enabled. z Disabled %sN)rrWdisablerrr*rs r do_disablezPdb.do_disable\syy{{ 1 1A 1((++  ]R/0000     3  1 1rc|dd} |d}n#t$rd}YnwxYw ||d}||_|s|d|jzdS|d|jzdS#t$r|dYdSt$r }||Yd}~dSd}~wwxYw)a#condition bpnumber [condition] Set a new condition for the breakpoint, an expression which must evaluate to true before the breakpoint is honored. If condition is absent, any existing condition is removed; i.e., the breakpoint is made unconditional. rrNrz#Breakpoint %d is now unconditional.z$New condition set for breakpoint %d.Breakpoint number expected) r IndexErrorrWrrorrmr*r)r8r rrorBrYs r do_conditionzPdb.do_conditionps,yya   7DD   DDD  Q$$T!W]]__55B BG Q BRYNOOOOO CbiOPPPPP 5 5 5 JJ3 4 4 4 4 4 4    JJsOOOOOOOOO s)! 00-B((C3 C3C..C3c<|} t|d}n #d}YnxYw ||d}||_|dkr/|dkrd|z}nd}|d||jfzdS|d|jzdS#t$r|dYdSt$r }||Yd}~dSd}~wwxYw) aignore bpnumber [count] Set the ignore count for the given breakpoint number. If count is omitted, the ignore count is set to 0. A breakpoint becomes active when the ignore count is zero. When non-zero, the count is decremented each time the breakpoint is reached and the breakpoint is not disabled and any associated condition evaluates to true. rrz %d crossingsz 1 crossingz%Will ignore next %s of breakpoint %d.z-Will stop next time breakpoint %d is reached.rN) rrVrrWignorerrmrr*r)r8r rcountrBcountstrrYs r do_ignorez Pdb.do_ignores^yy{{ Q ((EE EEE *$$T!W]]__55B BIqyy199-5HH+H D& 2344444 L!y)***** 5 5 5 JJ3 4 4 4 4 4 4    JJsOOOOOOOOO s''>A-CD2 D;DDc|s td}n#t$rd}YnwxYw|}|dvrLdtjjD}||D]}|d|zdSd|vr| d}|d|}||dzd} t|}| ||dd}| ||}n#t$rd |z}YnwxYw|r||n|D]}|d|zdS|} | D]q} ||}|||d|zF#t$r}||Yd}~jd}~wwxYwdS) a=cl(ear) filename:lineno cl(ear) [bpnumber [bpnumber...]] With a space separated list of breakpoint numbers, clear those breakpoints. Without argument, clear all breaks (but first ask confirmation). With a filename:lineno argument, clear all breaks at that line in that file. zClear all breaks? no)yyescg|]}||Sr r )rArBs r rCz Pdb.do_clear..sGGGBG"GGGr z Deleted %sNr,rzInvalid line number (%s))inputEOFErrorrr6rrDrEclear_all_breaksrrarVrl clear_breakrr*rrWclear_bpbynumber) r8r replybplistrBr1r"r%rY numberlists r do_clearz Pdb.do_clearsX  233    KKMM''))E $$GGs~'@GGG%%''' 44BLL!23333 F #:: #A2A2wHacdd)C 9S6::111=&&x88  7 7 7036 7  4 3 44BLL!23333 FYY[[  0 0A 0((++%%a((( \B.////     3  0 0s6 ##DD%$D%8F;; G$GG$c.|dS)zw(here) Print a stack trace, with the most recent frame at the bottom. An arrow indicates the "current frame", which determines the context of most commands. 'bt' is an alias for this command. N)print_stack_tracerws r do_wherez Pdb.do_wheres      r cd|cxkrt|jksnJ||_|j|jd|_|jj|_||j|jd|_dSr))rUrrrrrrr%)r8rms r _select_framezPdb._select_framesF,,,,S__,,,,,,  4=1!4 #}5 tz$-8999 r c.|jdkr|ddS t|pd}n)#t$r|d|zYdSwxYw|dkrd}nt d|j|z }||dS)zu(p) [count] Move the current frame count (default one) levels up in the stack trace (to an older frame). rz Oldest frameNrInvalid frame count (%s))rr*rVrmaxrr8r rnewframes r do_upz Pdb.do_ups =A   JJ~ & & & F qMMEE    JJ1C7 8 8 8 FF  199HH1dme344H 8$$$$$s6"AAc|jdzt|jkr|ddS t |pd}n)#t $r|d|zYdSwxYw|dkrt|jdz }n-t t|jdz |j|z}||dS)zd(own) [count] Move the current frame count (default one) levels down in the stack trace (to a newer frame). rz Newest frameNrr)rrUrr*rVrminrrs r do_downz Pdb.do_downs =1 DJ / / JJ~ & & & F qMMEE    JJ1C7 8 8 8 FF  1994:*HH3tz??Q. 0EFFH 8$$$$$sA "A10A1c|rb t|}n)#t$r|d|zYdSwxYw||jjkr|ddSnd}||j|dS)aNunt(il) [lineno] Without argument, continue execution until the line with a number greater than the current one is reached. With a line number, continue execution until a line with a number greater or equal to that is reached. In both cases, also stop when the current frame returns. Error in argument: %rNz7"until" line number is smaller than current line numberr)rVrr*rr set_until)r8r r%s r do_untilz Pdb.do_untils   S    2S8999 /// )***0 F t}f---qs "::c.|dS)zs(tep) Execute the current line, stop at the first possible occasion (either in a function that is called or in the current function). r)rrws r do_stepz Pdb.do_step3s qr c:||jdS)zxn(ext) Continue execution until the next line in the current function is reached or it returns. r)set_nextrrws r do_nextz Pdb.do_next=s dm$$$qr c|r}ddl}tjdd} ||t_n3#t$r&}|d|d|Yd}~dSd}~wwxYw|tjdd<t )arun [args...] Restart the debugged python program. If a string is supplied it is split with "shlex", and the result is used as the new sys.argv. History, breakpoints, actions and debugger options are preserved. "restart" is an alias for "run". rNrz Cannot run r)shlexrJargvrrr*r)r8r rargv0es r do_runz Pdb.do_runFs  ! LLLHQqSME  ;;s++    ###qq9::: !CHRaRL s< A,A''A,c:||jdS)zPr(eturn) Continue execution until the current function returns. r) set_returnrrws r do_returnz Pdb.do_return[s  &&&qr c|js@ tjtj|jt_n#t $rYnwxYw|dS)z]c(ont(inue)) Continue execution, only stop when a breakpoint is encountered. r)rrrrrrr set_continuerws r do_continuezPdb.do_continuecsm}  M&-1DEE,,       qs.8 AAc|jdzt|jkr|ddS t |} ||j_|j|jd|f|j|j<||j|jdS#t$r#}|d|zYd}~dSd}~wwxYw#t$r|dYdSwxYw)aj(ump) lineno Set the next line that will be executed. Only available in the bottom-most frame. This lets you jump back and execute code again, or jump forward to skip code that you don't want to run. It should be noted that not all jumps are allowed -- for instance it is not possible to jump into the middle of a for loop or out of a finally clause. rz)You can only jump within the bottom frameNrzJump failed: %sz)The 'jump' command requires a line number) rrUrr*rVrrrr)r8r rs r do_jumpz Pdb.do_jumpus! =1 DJ / / JJB C C C F 2c((C 2*- &,0Jt},Ea,H#,M 4=)&&tz$-'@AAAAA 2 2 2 ,q0111111111 2 D D D JJB C C C C C C Ds*C AB## C-C  CC65C6ctjd|jj}|j}t |j|j|j}d|j z|_ | d tj |j |||fn$#t$r|YnwxYw| dtj|j|j|_dS)zdebug code Enter a recursive debugger that steps through the code argument (which is an arbitrary expression or statement to be executed in the current environment). Nz(%s) zENTERING RECURSIVE DEBUGGERzLEAVING RECURSIVE DEBUGGER)rJsettracerrrrrrrrrr call_tracingr r`rtrace_dispatchr)r8r rrps r do_debugz Pdb.do_debugs T-)%  $*dk : :T[..000 2333   QUS'6$: ; ; ; ;    OO       1222 T()))y s?BB>=B>c<d|_|dS)z[q(uit) exit Quit from the debugger. The program being executed is aborted. Tr)_user_requested_quitset_quitrws r do_quitz Pdb.do_quits%)! qr cf|dd|_|dS)z=EOF Handles the receipt of EOF as a command. r~Tr)rrrrws r do_EOFz Pdb.do_EOFs0 R$(! qr cf|jj}|j}|j|jz}|jt jzr|dz}|jt jzr|dz}t|D]L}|j |}||vr!| |d||4| |dMdS)zHa(rgs) Print the argument list of the current function. r = z = *** undefined ***N) rrr co_argcountco_kwonlyargcountco_flagsinspect CO_VARARGSCO_VARKEYWORDSrange co_varnamesr)r8r corSrLr1rks r do_argsz Pdb.do_argss] !# NR1 1 ;+ +41Q ;/ /8QqSq A AA>!$Dt|| $$$T ;<<<< ?@@@@  A Ar cd|jvr/|t|jddS|ddS)zQretval Print the return value for the last return of a function. rzNot yet returned!N)rrrr*rws r do_retvalz Pdb.do_retvalsS 4/ / / LLd2<@AA B B B B B JJ* + + + + +r cx t||jj|jS#|xYwr6)rcrrrrrws r _getvalz Pdb._getvals= T]4d6JKK K  OO    s"9c2 | t||jj|jSt||j|jS#t jdd}tj|d }td|zcYSxYw)Nrrz** raised %s **) rcrrrrrJrrarrr4)r8r rrrYs r rzPdb._getval_excepts 2}C!8$:NOOOC%.AAA 2|~~bqb)H18>"1"% 92H=bAGGIIJJJJJr c ||}n#YdSxYw |||dS#|YdSxYwr6)rrr)r8r r"rDs r _msg_val_funczPdb._msg_val_funcsq ,,s##CC  FF  LLc # # # # #  OO      sAAc<||tdS)z@p expression Print the value of the expression. N)rrrws r do_pzPdb.do_ps  3%%%%%r cF||tjdS)zHpp expression Pretty-print the value of the expression. N)rpprintpformatrws r do_ppz Pdb.do_pps" 3/////r c^d|_d}|r|dkr d|vrf|d\}}t|}t|}||kr||z}n4t|}t d|dz }n^#t $r|d|zYdSwxYw|j|dkrt d|jj dz }n |jdz}||dz}|jj j }| d r6|jj d }t|t r|}||} t%j||jj }|||dz ||||jt+|t-||_t-||kr|d dSdS#t0$rYdSwxYw) al(ist) [first [,last] | .] List source code for the current file. Without arguments, list 11 lines around the current line or continue the previous listing. With . as argument, list 11 lines around the current line. With one argument, list 11 lines starting at that line. With two arguments, list the given range; if the second argument is less than the first, it is a count. The current line in the current frame is indicated by "->". If an exception is being debugged, the line where the exception was originally raised or propagated is indicated by ">>", if it differs from the current line. r*NrIr-rr zz>> N) rrrrr rjustrUrr) r8rrr_rcurrent_lineno exc_linenor%r&ss r rzPdb._print_lines_s  -"^N++E266JJ*, ,NZ%eU33 3 3LFDF !!!$$A1vvzzSSS''T :%%T  LLTDKKMM1 2 2 2 2 3 3r c ||}n#YdSxYwd} |jj}n#t$rYnwxYw|r|d|jzdS |j}n#t$rYnwxYw|r|d|jzdS|jtur'|d|jd|j dS|t|dS)z;whatis arg Print the type of the argument. Nz Method %sz Function %szClass rI) rr^rer`rrfrFtyperr)r8r valuer.s r do_whatisz Pdb.do_whatists2 LL%%EE  FF >*DD    D    LLt|3 4 4 4 F >DD    D    LL5 6 6 6 F ?d " " LLL%*:*:*:E>DDFF . . X_---- . .%%c**CADDO & &t}b 9 9# > LLLSSS##6 7 7 7 7 7r c|rM |j|ji|=dS#t$r|d|zYdSwxYw|j|jddS)zundisplay [expression] Do not display the expression any more in the current frame. Without expression, clear all display expressions for the current frame. znot displaying %sN)rrrrOr*rrws r do_undisplayzPdb.do_undisplays  5 6O'' r::3??? 6 6 6 .4555555 6 O   t 4 4 4 4 4s!'"A  A c\fd|j|jiDS)Nc>g|]}||Sr rK)rArr7s r rCz*Pdb.complete_undisplay..s9'''a<<%%''''r )rrrrFs ` r complete_undisplayzPdb.complete_undisplaysA''''4?..t}bAA''' 'r c\i|jj|j}tjd|dS)zinteract Start an interactive interpreter whose global namespace contains all the (global and local) names found in the current scope. z *interactive*)localN)rrrr.interact)r8r rRs r do_interactzPdb.do_interacts7 A ' @4+? @ oR000000r c|}t|dkrRt|j}|D]'}||d|j|(dS|d|jvrFt|dkr3||dd|j|ddSd|dd|j|d<dS)acalias [name [command [parameter parameter ...] ]] Create an alias called 'name' that executes 'command'. The command must *not* be enclosed in quotes. Replaceable parameters can be indicated by %1, %2, and so on, while %* is replaced by all the parameters. If no command is given, the current alias for name is shown. If no name is given, all aliases are listed. Aliases may be nested and can contain anything that can be legally typed at the pdb prompt. Note! You *can* override internal pdb commands with aliases! Those internal commands are then hidden until the alias is removed. Aliasing is recursively applied to the first word of the command line; all other words in the line are left alone. As an example, here are two useful aliases (especially when placed in the .pdbrc file): # Print instance variables (usage "pi classInst") alias pi for k in %1.__dict__.keys(): print("%1.",k,"=",%1.__dict__[k]) # Print instance variables in self alias ps pi self rrNrr)rrUsortedrrQrr )r8r rrQrs r do_aliasz Pdb.do_aliass0yy{{ t99>>$,++--..D G G %%%e1D1DEFFFF F 7dl " "s4yyA~~ LLd1gggt|DG/D/DE F F F F F$'HHT!""X$6$6DLa ! ! !r c|}t|dkrdS|d|jvr|j|d=dSdS)z9unalias name Delete the specified alias. rN)rrUr)r8r rs r do_unaliaszPdb.do_unaliassQyy{{ t99>>66 7dl " " T!W%%% # "r c*fd|jDS)Nc>g|]}||Sr rK)rAar7s r rCz(Pdb.complete_unalias..s*>>>a1<<+=+=>>>>r )rrFs ` r complete_unaliaszPdb.complete_unaliass>>>>4<>>>>r )rrrrrrch |jD]}||dS#t$rYdSwxYwr6)rrr)r8 frame_linenos r rzPdb.print_stack_traces[  $  5 5 &&|4444 5 5     DD s # 11c|\}}||jurd}nd}|||||zdS)Nz> z )rrformat_stack_entry)r8r& prompt_prefixrr%rs r rzPdb.print_stack_entrysd$ v DM ! !FFF V,,\=IIJ K K K K Kr c|s tj||S t|d|z}|S#t$rt|d|z}YnwxYw t jjdkr|d|zdS|j |d|zdS| |j dS#t$r|d|zYdSwxYw)zh(elp) Without argument, print the list of available commands. With a command name as argument, print help about that command. "help pdb" shows the full pdb documentation. "help exec" gives help on the ! command. help_rrzJNo help for %r; please do not run Python with -OO if you need command helpNz&No help for %r; __doc__ string missingzNo help for %r) rrdo_helprrrJflagsoptimizer*r rr)r8r topiccommands r r,z Pdb.do_helpsB .7??4-- - 3 5gm44uww! 5 5 5!$ 44 5y!Q&& 68;<===& CcIJJJ LL//11 2 2 2 2 2 / / / JJ'#- . . . . . . /s)AA"C$!A""C$$"D  D cl||jjpddS)a(!) statement Execute the (one-line) statement in the context of the current stack frame. The exclamation point can be omitted unless the first word of the statement resembles a debugger command. To assign to a global variable you must always prefix the command with a 'global' command, e.g.: (Pdb) global list_options; list_options = ['-l'] (Pdb) r~N)r help_execr rr7s r r2z Pdb.help_exec0s2 dn,299;;<<<<*r r)"rwheredownupbreaktbreakrrrr conditionrstepruntiljumpreturnretvalr continuer*longlistrrppwhatissourcedisplay undisplayrrunaliasdebugquitrz cLt|||dSr6)rr  statementrrs r r r s"EEIIi&)))))r cHt|||Sr6)rr) expressionrrs r rrs 55==Wf 5 55r c(t|||dSr6)r rs r rrs 7F#####r c4tj|i|Sr6)rr)rkwdss r rrs 355=$ '$ ' ''r )headerct}||j||jtjjdSr6)rrrrJ _getframef_back)rpdbs r rrsD %%C  FCM#-//()))))r c|tjd}|tdt}||d|dS)NrzAA valid traceback must be passed if no exception is being handled)rJrrrrr)trs r rrsgy LNN1 y677 7 AGGIIIMM$r c8ttjdSr6)rrJlast_tracebackr r r rrs"#####r zimport x; x.main()c.ttdSr6)r TESTCMDr r r testrsLLLLLr cBddl}|tdSr))pydocpagerr )rs r rrs#LLL KKr ausage: pdb.py [-c command] ... [-m module | pyfile] [arg] ... Debug the Python program given by pyfile. Alternatively, an executable module or package to debug can be specified using the -m switch. Initial commands are read from .pdbrc files in your home directory and in the current directory, if they exist. Commands supplied with -c are executed after commands from .pdbrc files. To let the script run until an exception occurs, use "-c continue". To let the script run up to a given line X in the debugged file, use "-c 'until X'".c 8ddl}|tjdddddg\}}|s(tttjdt d|Dr'tttjd|D}t d |D}|rtnt}||d}| |tjdd<t}|j | |j ||jrdStd n>#t$rKtd |d tddtjddzYnt"$r:tddttjdYnt&$r*t)jtjdYnvt)jtdtdtjd}|jd|td|zdzYnxYwk)Nrrzmhc:rzcommand=rc3$K|] \}}|dvV dS))z-hz--helpNr rAoptoptargs r zmain..s, ; ;{sF3" " ; ; ; ; ; ;r c g|] \}}|dv | S))z-cz --commandr rs r rCzmain..s'MMM;3#9L2L2L2L2L2Lr c3$K|] \}}|dvV dS))z-mNr rs r rzmain..s*AA[S&3&=AAAAAAr Tz*The program finished and will be restarted Restartingzwith arguments:rrz/The program exited via sys.exit(). Exit status:)rz2Uncaught exception. Entering post mortem debuggingz1Running 'cont' or 'step' will restart the programz#Post mortem debugger finished. The z will be restarted)getoptrJrrI_usagerKanyr\r;rMrrrrArrr  SystemExitr SyntaxErrorrarbr) roptsrrmodule_indicatedrCr=rrs r mainrsMMMsx|Vfj5IJJJD$  f    ; ;d ; ; ;;; f   MM$MMMHAADAAAAA+ >--C Sa\\F LLNNNCHQQQK %%CKx   ( ( CHV   '  > ? ? ? ? 1 1 1 ,(9 : : : $#(122,/// 0 0 0 0 0 % % % C M M M M #,..# $ $ $ $ $      ! ! ! HQKKKKK (   ! ! ! F G G G E F F F q!A COD! $ $ $ 7&@&' ( ( ( ( (-(s'2E EAJ0AJ20J$A1JrP)NNr6)3r r?rVrrJrrr+r.r3rrrrrxrartypingrr`r__all__r'r2r r4r;r\rirrr _help_order_commandrrr2r rrrrrrrrrrrrrr r r rsA??F      i    " " "      C !E!E!E!E!EC!E!E!EH$ $ $ $ $ C$ $ $ X ggggg#'37gggV- K KK773 0119??AAFJJ s}$$GX ****6666$$$(((*****    $$$   4(4(4(p zJJJ CHJJJJJr