a €šçd÷ã@s dZddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl Z ddl Z ddlZddlZGdd„deƒZgd¢Zdd„Zdd „Zd d „ZGd d „d eƒZdZGdd„dejejƒZedurgd¢ZeD] Zeeedeƒj ¡d7Zqìeej j7Z[[d,dd„Z!d-dd„Z"dd„Z#dd„Z$ddœdd„Z%d.dd „Z&d!d"„Z'd#Z(d$d%„Z)d&d'„Z*d(Z+d)d*„Z,e-d+krœddl.Z.e. ,¡dS)/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 ================= éNc@seZdZdZdS)ÚRestartzBCauses a debugger to be restarted for the debugged python program.N)Ú__name__Ú __module__Ú __qualname__Ú__doc__©rrú/usr/lib64/python3.9/pdb.pyrWsr) ÚrunÚpmÚPdbÚrunevalÚrunctxÚruncallÚ set_traceÚ post_mortemÚhelpcCsœt dt |¡¡}zt |¡}Wnty6YdS0|Lt|ddD].\}}| |¡rJ|||fWdƒSqJWdƒn1sŽ0YdS)Nzdef\s+%s\s*[(]é)Ústart)ÚreÚcompileÚescapeÚtokenizeÚopenÚOSErrorÚ enumerateÚmatch)ÚfuncnameÚfilenameÚcreÚfpÚlinenoÚlinerrrÚ find_function^s  <r"cCsXt |¡\}}t |¡r,|j|jur,|dfSt |¡r>|dfSt ||d…¡|dfS)Nr)ÚinspectÚ findsourceÚisframeÚ f_globalsÚf_localsÚismoduleÚgetblock)ÚobjÚlinesr rrrÚgetsourcelinesks  r,cCs8tt |¡ƒ}| ¡|D]\}}||kr|SqdS©Nr)ÚlistÚdisÚfindlinestartsÚreverse)ÚcodeÚlastiÚ linestartsÚir rrrÚ lasti2linenots   r6c@seZdZdZdd„ZdS)Ú_rstrz#String that doesn't quote its repr.cCs|S©Nr©ÚselfrrrÚ__repr__sz_rstr.__repr__N)rrrrr;rrrrr7}sr7z -> c@s$eZdZdZd¢dd„Zdd„Zd d „Zd d „Zd d„Zdd„Z dd„Z dd„Z dd„Z dd„Z dd„Zdd„Zdd„Zdd „Zd!d"„Zd#d$„Zd%d&„Zd'd(„Zd)d*„Zd+d,„Zd-d.„Zd/d0„Zd1d2„Zd3d4„Zd5d6„ZeZd£d8d9„Zd:d;„ZeZ eZ!eZ"dd?„Z%d@dA„Z&dBdC„Z'eZ(dDdE„Z)eZ*dFdG„Z+eZ,dHdI„Z-eZ.dJdK„Z/e/Z0eZ1eZ2dLdM„Z3e3Z4e3Z5dNdO„Z6dPdQ„Z7e7Z8dRdS„Z9e9Z:dTdU„Z;e;ZdXdY„Z?e?Z@dZd[„ZAeAZBd\d]„ZCeCZDd^d_„ZEeEZFZGd`da„ZHeHZIdbdc„ZJeZKddde„ZLeLZMeLZNdfdg„ZOdhdi„ZPePZQdjdk„ZReRZSdldm„ZTd¤dndo„ZUdpdq„ZVdrds„ZWdtdu„ZXdvdw„ZYeZZeZ[eZ\dxdy„Z]e]Z^dzd{„Z_e_Z`d|d}„ZaeZbd¥dd€„Zcdd‚„ZdeZedƒd„„ZfeZgd…d†„Zhd‡dˆ„Zid‰dŠ„Zjd‹dŒ„ZkddŽ„Zldd„Zmgd‘¢Znd’d“„Zoepfd”d•„Zqd–d—„ZrerZsd˜d™„Ztdšd›„Zudœd„ZvdždŸ„Zwd d¡„ZxdS)¦r NÚtabFTc Csbtjj||dtj ||||¡t d¡|r6d|_d|_i|_ i|_ d|_ d|_ i|_ zddl}| d¡Wnty‚Yn0d|_||_g|_|r@z@ttj d¡ƒ}|j |¡Wdƒn1sÐ0YWntyîYn0z:td ƒ}|j |¡Wdƒn1s0YWnty>Yn0i|_i|_i|_d|_d|_dS) N)Úskipzpdb.Pdbrz(Pdb) ÚFz `@#$%^&*()=+[{]}\|;:'",<>?z~/.pdbrcz.pdbrc)ÚbdbÚBdbÚ__init__ÚcmdÚCmdÚsysÚauditÚ use_rawinputÚpromptÚaliasesÚ displayingÚ mainpyfileÚ_wait_for_mainpyfileÚ tb_linenoÚreadlineÚset_completer_delimsÚ ImportErrorÚ allow_kbdintÚnosigintÚrcLinesrÚosÚpathÚ expanduserÚextendrÚcommandsÚcommands_dopromptÚcommands_silentÚcommands_definingÚ commands_bnum) r:Ú completekeyÚstdinÚstdoutr=rQÚreadrcrMÚrcFilerrrrAŽsF  .  0z Pdb.__init__cCs*|jr t‚| d¡| ¡| |¡dS)Nz- Program interrupted. (Use 'cont' to resume).)rPÚKeyboardInterruptÚmessageÚset_stepr)r:ÚsignumÚframerrrÚsigint_handler½s  zPdb.sigint_handlercCstj |¡| ¡dSr8)r?r@ÚresetÚforgetr9rrrrgÄs z Pdb.resetcCs&d|_g|_d|_d|_|j ¡dSr-)r ÚstackÚcurindexÚcurframerLÚclearr9rrrrhÈs z Pdb.forgetcCsh| ¡| ||¡\|_|_|rDt|jj|jƒ}||j|j<|j }q|j|jd|_ |j j |_ |  ¡Sr-)rhÚ get_stackrirjr6Útb_frameÚf_codeÚtb_lastirLÚtb_nextrkr'Úcurframe_localsÚ execRcLines)r:ÚfÚtbr rrrÚsetupÏs  z Pdb.setupcCsd|js dS|j}| ¡g|_|r`| ¡ ¡}|r|ddkr| |¡r|jt|ƒ7_dSqdS)Nrú#T)rRr1ÚpopÚstripÚonecmdÚreversed)r:rRr!rrrrsás  zPdb.execRcLinescCs.|jr dS| |¡r*| d¡| |d¡dS)znThis method is called when there is the remote possibility that we ever need to stop in this function.Nz--Call--)rKÚ stop_hererbÚ interaction)r:reÚ argument_listrrrÚ user_callõs   z Pdb.user_callcCsH|jr.|j| |jj¡ks$|jdkr(dSd|_| |¡rD| |d¡dS)z;This function is called when we stop or break at this line.rNF)rKrJÚcanonicroÚ co_filenameÚf_linenoÚ bp_commandsr})r:rerrrÚ user_lineþsÿ z Pdb.user_linecCs”t|ddƒr|j|jvr|j}d|_|j}| |d¡|j|D]}| |¡q@||_|j|sr| |j|j ¡|j |r„|  ¡|  ¡dSdS)z¾Call 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) Úgetattrr…rWÚlastcmdrvrzrYÚprint_stack_entryrirjrXÚ_cmdlooprh)r:rer…Ú lastcmd_backr!rrrrƒs"  ÿ    zPdb.bp_commandscCs.|jr dS||jd<| d¡| |d¡dS)z7This function is called when a return trap is set here.NÚ __return__z --Return--)rKr'rbr})r:reÚ return_valuerrrÚ user_return s   zPdb.user_returncCsh|jr dS|\}}}||f|jd<|s2|tur2dnd}| d|t ||¡d ¡f¡| ||¡dS)zoThis function is called if an exception occurs, but only if we are to stop at or just below this level.NÚ __exception__z Internal r>z%s%séÿÿÿÿ)rKr'Ú StopIterationrbÚ tracebackÚformat_exception_onlyryr})r:reÚexc_infoÚexc_typeÚ exc_valueÚ exc_tracebackÚprefixrrrÚuser_exception(s ÿÿÿzPdb.user_exceptioncCs@zd|_| ¡d|_Wq\}}| |¡}||ur||kr|||<| d|||f¡qdS)Nzdisplay %s: %r [old: %r])rIÚgetrkÚitemsÚ_getval_exceptrb)r:rIÚexprÚoldvalueÚnewvaluerrrÚpreloopIs ÿz Pdb.preloopcCsrtjr4zt tjtj¡Wnty,Yn0dt_| ||¡rL| ¡dS| |j|j ¡|  ¡| ¡dSr8) r Ú_previous_sigint_handlerÚsignalÚSIGINTÚ ValueErrorrvrhrˆrirjr‰)r:rer‘rrrr}Vs  zPdb.interactioncCs|dur| t|ƒ¡dS)z{Custom displayhook for the exec in default(), which prevents assignment of the _ variable in the builtins. N)rbÚrepr)r:r*rrrÚ displayhookhszPdb.displayhookcCsº|dd…dkr|dd…}|j}|jj}zvt|dddƒ}tj}tj}tj}z:|jt_|jt_|jt_t|||ƒW|t_|t_|t_n|t_|t_|t_0Wn|  ¡Yn0dS)Nrú!Ú zÚsingle) rrrkr&rrDr^r]r¦ÚexecÚ _error_exc)r:r!ÚlocalsÚglobalsr2Ú save_stdoutÚ save_stdinÚsave_displayhookrrrÚdefaultps*þ z Pdb.defaultcCsØ| ¡s |S| ¡}|d|jvr†|j|d}d}|dd…D] }| dt|ƒ|¡}|d7}q@| dd |dd…¡¡}| ¡}q|ddkrÔ| d¡}|dkrÔ||d d… ¡}|j  |¡|d|…  ¡}|S) z*Handle alias expansion and ';;' separator.rrNú%z%*ú Úaliasz;;é) ryÚsplitrHÚreplaceÚstrÚjoinÚfindÚlstripÚcmdqueueÚappendÚrstrip)r:r!ÚargsÚiiÚtmpArgÚmarkerÚnextrrrÚprecmd…s(ÿ     z Pdb.precmdcCs"|jstj ||¡S| |¡SdS)zÒInterpret the argument as though it had been typed in response to the prompt. Checks whether this line is typed at the normal prompt or in a breakpoint command list definition. N)rZrBrCrzÚhandle_command_def)r:r!rrrrzžsz Pdb.onecmdcCsÂ| |¡\}}}|sdS|dkr0d|j|j<dS|dkrBg|_dS|j|j}|rf| |d|¡n | |¡zt|d|ƒ}Wntyš|j}Yn0|j |j vr¾d|j |j<g|_dSdS) z8Handles one command line during command list definition.NÚsilentTÚendrr³Údo_F) Ú parselinerYr[r¼rWr½r†ÚAttributeErrorr±rÚcommands_resumingrX)r:r!rBÚargÚcmdlistÚfuncrrrrŪs,       zPdb.handle_command_defcCst||jddS)N©Úfile©Úprintr^©r:ÚmsgrrrrbÈsz Pdb.messagecCstd||jddS)Nz***rÏrÑrÓrrrÚerrorËsz Pdb.errorcCs¤| ¡ d¡rgSz| ||||¡}Wnty<g}Yn0t t |¡d¡}|D]H}tj |¡rv|  |d¡qVtj  |¡rV|  ¡ d¡rV|  |d¡qV|S)N)ú:ú,Ú*ú/)ú.pyz.pywrÖ) ryÚendswithÚ_complete_expressionÚ ExceptionÚglobrrSrTÚisdirr½ÚisfileÚlower)r:Útextr!ÚbegidxÚendidxÚretÚglobsÚfnrrrÚ_complete_locationÑs   zPdb._complete_locationcs‡fdd„ttjjƒDƒS)Ncs.g|]&\}}|durt|ƒ ˆ¡rt|ƒ‘qSr8)r¸Ú startswith)Ú.0r5Úbp©rârrÚ ès ÿz*Pdb._complete_bpnumber..)rr?Ú BreakpointÚ bpbynumber©r:râr!rãrärrìrÚ_complete_bpnumberäszPdb._complete_bpnumberc s¾|js gSi|jj¥|j¥}dˆvr¤ˆ d¡‰z,|ˆd}ˆdd…D]}t||ƒ}qHWnttfytgYS0d ˆdd…¡d‰‡‡fdd„t|ƒDƒS‡fdd„|  ¡DƒSdS)NÚ.rrrcs"g|]}| ˆd¡rˆ|‘qS)r©ré©rêÚn)Údottedr—rrríÿóz,Pdb._complete_expression..csg|]}| ˆ¡r|‘qSrrórôrìrrrír÷) rkr&rrr¶r†ÚKeyErrorrÊr¹ÚdirÚkeys)r:râr!rãräÚnsr*Úpartr)rör—rârrÜës   zPdb._complete_expressioncCs6|sttjjƒd}n&z t|ƒ}Wn| d¡YdS0||_||jvrj|j||j||j |f}nd}g|j|<d|j|<d|j |<|j }d|_ d|_ z„z |  ¡Wnft y|rì|d|j|<|d|j|<|d|j |<n|j|=|j|=|j |=| d ¡Yn0Wd|_ ||_ nd|_ ||_ 0dS) 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] ... endNTFz(com) rrµz1command definition aborted, old commands restored)Úlenr?rîrïÚintrÕr[rWrXrYrGrZr™ra)r:rÌÚbnumÚold_command_defsÚ prompt_backrrrÚ do_commandssF%   þ    ÿzPdb.do_commandsrc Cs>|s8|jr4| d¡tjjD]}|r| | ¡¡qdSd}d}d}| d¡}|dkrz||dd… ¡}|d|… ¡}|  d¡}d} |dkr|d|… ¡}|  |¡} | sÂ|  d|¡dS| }||dd… ¡}z t |ƒ}Wn$t y |  d|¡YdS0n¾z t |ƒ}Wn°t yÊzt||jj|jƒ} Wn|} Yn0z.t| d ƒrf| j} | j} | j} | j}| j}WnD| |¡\} }}| s´|  d |¡YYdS| } t |ƒ}Yn0Yn0|sÚ| ¡}| ||¡}|r:| ||||| ¡}|r|  |¡n*| ||¡d }| d |j|j|jf¡dS) a²b(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) Úbreaksrbr?rîrïÚbpformatrºr»r¾ÚrfindÚ lookupmodulerÕrþr¤Úevalrkr&rrÚhasattrrÚ__code__Úco_nameÚco_firstlinenorÚlineinfoÚ defaultFileÚ checklineÚ set_breakÚ get_breaksÚnumberrÐr!)r:rÌÚ temporaryrërr ÚcondÚcommaÚcolonrrtrÎr2ÚokÚlnr!ÚerrrrrÚdo_breakWs„         þ   ÿ  ÿz Pdb.do_breakcCs"|jjj}|dkr|jr|j}|S)zProduce a reasonable default.z)rkrorrJ)r:rrrrr´s zPdb.defaultFilecCs| |d¡dS)z¶tbreak [ ([filename:]lineno | function) [, condition] ] Same arguments as break, but sets a temporary breakpoint: it is automatically deleted when first hit. rN)r©r:rÌrrrÚ do_tbreakÀsz Pdb.do_tbreakc CsÌd}| d¡}t|ƒdkr(|d ¡}nt|ƒdkrB|d ¡}n|S|dkrR|S| d¡}|ddkr~|d=t|ƒdkr~|S| ¡}t|ƒdkrœ|d}n| |d¡}|r²|}|d}t||ƒ} | pÊ|S) N)NNNú'rrér>ròr:)r¶rýryrrr") r:Ú identifierÚfailedÚidstringÚidÚpartsÚfnameÚitemrtÚanswerrrrr És,          z Pdb.lineinfocCs„t|ddƒ}|r|jnd}t |||¡}|s:| d¡dS| ¡}|rr|ddksr|dd…dksr|dd…dkr€| d ¡dS|S) zÈCheck 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. rkNz End of filerrwrz"""z'''zBlank or comment)r†r&Ú linecacheÚgetlinerbryrÕ)r:rr rerær!rrrrês  ÿÿ z Pdb.checklinec Csj| ¡}|D]X}z| |¡}Wn.tyL}z| |¡WYd}~q d}~00| ¡| d|¡q dS)z†enable bpnumber [bpnumber ...] Enables the breakpoints given as a space separated list of breakpoint numbers. Nz Enabled %s)r¶Úget_bpbynumberr¤rÕÚenablerb©r:rÌr¿r5rërrrrÚ do_enables z Pdb.do_enablec Csj| ¡}|D]X}z| |¡}Wn.tyL}z| |¡WYd}~q d}~00| ¡| d|¡q dS)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. Nz Disabled %s)r¶r)r¤rÕÚdisablerbr+rrrÚ do_disables zPdb.do_disablec CsÀ| dd¡}z |d}Wnty.d}Yn0z| |d ¡¡}WnHtyb| d¡YnZtyŽ}z| |¡WYd}~n6d}~00||_|s¬| d|j¡n| d|j¡dS)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. r³rNrúBreakpoint number expectedz#Breakpoint %d is now unconditional.z$New condition set for breakpoint %d.) r¶Ú IndexErrorr)ryrÕr¤rrbr)r:rÌr¿rrërrrrÚ do_condition%s      zPdb.do_conditionc CsÜ| ¡}zt|d ¡ƒ}Wnd}Yn0z| |d ¡¡}WnHty`| d¡YnxtyŒ}z| |¡WYd}~nTd}~00||_|dkrÈ|dkr®d|}nd}| d||j f¡n| d|j ¡dS) a–ignore 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. rrr/Nz %d crossingsz 1 crossingz%Will ignore next %s of breakpoint %d.z-Will stop next time breakpoint %d is reached.) r¶rþryr)r0rÕr¤Úignorerbr)r:rÌr¿ÚcountrërÚcountstrrrrÚ do_ignore@s,     ÿÿz Pdb.do_ignorec Cs†|srz tdƒ}Wnty&d}Yn0| ¡ ¡}|dvrndd„tjjDƒ}| ¡|D]}| d|¡qZdSd|vr|  d¡}|d|…}||d d…}z t |ƒ}Wnt yÈd |}Yn"0|  ||¡dd…}|  ||¡}|rú| |¡n|D]}| d|¡qþdS| ¡} | D]^}z| |¡}Wn0t yd}z| |¡WYd}~n"d}~00| |¡| d|¡q"dS) 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)ÚyÚyescSsg|] }|r|‘qSrr)rêrërrrríqr÷z Pdb.do_clear..z Deleted %sNrÖrzInvalid line number (%s))ÚinputÚEOFErrorryrár?rîrïÚclear_all_breaksrbrrþr¤rÚ clear_breakrÕr¶r)Úclear_bpbynumber) r:rÌÚreplyÚbplistrër5rr rÚ numberlistrrrÚdo_clearcsF             z Pdb.do_clearcCs | ¡dS)zâw(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_tracerrrrÚdo_where–sz Pdb.do_wherecCs^d|krt|jƒks nJ‚||_|j|jd|_|jj|_| |j|j¡d|_dSr-)rýrirjrkr'rrrˆr )r:rrrrÚ _select_frame s   zPdb._select_framecCsx|jdkr| d¡dSzt|p"dƒ}Wn"tyJ| d|¡YdS0|dkrZd}ntd|j|ƒ}| |¡dS)z‚u(p) [count] Move the current frame count (default one) levels up in the stack trace (to an older frame). rz Oldest frameNrúInvalid frame count (%s))rjrÕrþr¤ÚmaxrD©r:rÌr3ÚnewframerrrÚdo_up¨s   z Pdb.do_upcCs–|jdt|jƒkr"| d¡dSzt|p,dƒ}Wn"tyT| d|¡YdS0|dkrnt|jƒd}ntt|jƒd|j|ƒ}| |¡dS)z…d(own) [count] Move the current frame count (default one) levels down in the stack trace (to a newer frame). rz Newest frameNrEr)rjrýrirÕrþr¤ÚminrDrGrrrÚdo_down¼s  z Pdb.do_downcCsf|rPz t|ƒ}Wn"ty2| d|¡YdS0||jjkrT| d¡dSnd}| |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)rþr¤rÕrkr‚Ú set_until)r:rÌr rrrÚdo_untilÐs    z Pdb.do_untilcCs | ¡dS)z§s(tep) Execute the current line, stop at the first possible occasion (either in a function that is called or in the current function). r)rcrrrrÚdo_stepèsz Pdb.do_stepcCs| |j¡dS)zxn(ext) Continue execution until the next line in the current function is reached or it returns. r)Úset_nextrkrrrrÚdo_nextòs z Pdb.do_nextc Csz|rrddl}tjdd…}z| |¡t_Wn8tyb}z | d||f¡WYd}~dSd}~00|tjdd…<t‚dS)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". rNrzCannot run %s: %s)ÚshlexrDÚargvr¶r¤rÕr)r:rÌrRÚargv0ÚerrrÚdo_runûsz Pdb.do_runcCs| |j¡dS)zPr(eturn) Continue execution until the current function returns. r)Ú set_returnrkrrrrÚ do_returns z Pdb.do_returncCs<|js0zt tj|j¡t_Wnty.Yn0| ¡dS)z]c(ont(inue)) Continue execution, only stop when a breakpoint is encountered. r)rQr¢r£rfr r¡r¤Ú set_continuerrrrÚ do_continuesÿ zPdb.do_continuec Cs¾|jdt|jƒkr"| d¡dSz t|ƒ}WntyJ| d¡Ynp0z:||j_|j|jd|f|j|j<| |j|j¡Wn2ty¸}z| d|¡WYd}~n d}~00dS)a£j(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 frameNz)The 'jump' command requires a line numberrzJump failed: %s) rjrýrirÕrþr¤rkr‚rˆ)r:rÌrUrrrÚdo_jump*s    z Pdb.do_jumpcCsšt d¡|jj}|j}t|j|j|jƒ}d|j   ¡|_ |  d¡zt  |j |||f¡Wntyv| ¡Yn0|  d¡t |j¡|j|_dS)zÆdebug 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)rDÚsettracerkr&rrr r\r]r^rGryrbÚ call_tracingr rÝr«Útrace_dispatchr‡)r:rÌr­r¬ÚprrrÚdo_debugGs     z Pdb.do_debugcCsd|_| ¡dS)z[q(uit) exit Quit from the debugger. The program being executed is aborted. Tr)Ú_user_requested_quitÚset_quitrrrrÚdo_quit]sz Pdb.do_quitcCs| d¡d|_| ¡dS)z=EOF Handles the receipt of EOF as a command. r>Tr)rbrarbrrrrÚdo_EOFhs z Pdb.do_EOFcCsŽ|jj}|j}|j|j}|jtj@r.|d}|jtj@rB|d}t |ƒD]>}|j |}||vrx|  d|||f¡qJ|  d|f¡qJdS)zHa(rgs) Print the argument list of the current function. rz%s = %rz%s = *** undefined ***N) rkrorrÚ co_argcountÚco_kwonlyargcountÚco_flagsr#Ú CO_VARARGSÚCO_VARKEYWORDSÚrangeÚ co_varnamesrb)r:rÌÚcoÚdictrõr5ÚnamerrrÚdo_argsqs   z Pdb.do_argscCs.d|jvr | t|jdƒ¡n | d¡dS)zQretval Print the return value for the last return of a function. r‹zNot yet returned!N)rrrbr¥rÕrrrrÚ do_retval‚s z Pdb.do_retvalcCs0zt||jj|jƒWS| ¡‚Yn0dSr8)rrkr&rrr«rrrrÚ_getvalŒs z Pdb._getvalcCsrz2|durt||jj|jƒWSt||j|jƒWSWn:t ¡dd…}tj|Žd  ¡}t d|ƒYS0dS)Nrµrz** raised %s **) rrkr&rrr'rDr“r‘r’ryr7)r:rÌrer“rrrrrœ“szPdb._getval_exceptcCs,t ¡dd…}| tj|Žd ¡¡dS)Nrµr)rDr“rÕr‘r’ry)r:r“rrrr«žszPdb._error_exccCsJz| |¡}WnYdS0z| ||ƒ¡Wn| ¡Yn0dSr8)rqrbr«)r:rÌrÎÚvalrrrÚ _msg_val_func¢szPdb._msg_val_funccCs| |t¡dS)z@p expression Print the value of the expression. N)rsr¥rrrrÚdo_p¬szPdb.do_pcCs| |tj¡dS)zHpp expression Pretty-print the value of the expression. N)rsÚpprintÚpformatrrrrÚdo_pp²sz Pdb.do_ppcCsbd|_d}|rš|dkršz^d|vrX| d¡\}}t| ¡ƒ}t| ¡ƒ}||krr||}nt| ¡ƒ}td|dƒ}WqÊty–| d|¡YdS0n0|jdus¬|dkrÀtd|jj dƒ}n |jd}|durÚ|d}|jj j }|  |¡}zZt  ||jj¡}| ||d|…|||j¡t|t|ƒƒ|_t|ƒ|krF| d ¡Wnty\Yn0dS) a°l(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.Nròr×rérLé z[EOF])r‡r¶rþryrFr¤rÕr rkr‚rorÚget_file_breaksr'Úgetlinesr&Ú _print_linesrJrýrbra)r:rÌÚlastÚfirstrÚ breaklistr+rrrÚdo_list¼s@          ÿz Pdb.do_listc Csn|jjj}| |¡}zt|jƒ\}}Wn0tyV}z| |¡WYd}~dSd}~00| ||||j¡dS)z\longlist | ll List the whole source code for the current function or frame. N)rkrorrzr,rrÕr|)r:rÌrrr+r rrrrÚ do_longlistïs   zPdb.do_longlistc Cstz| |¡}WnYdS0zt|ƒ\}}Wn4ttfyb}z| |¡WYd}~dSd}~00| ||¡dS)z^source expression Try to get source code for the given object and display it. N)rqr,rÚ TypeErrorrÕr|)r:rÌr*r+r rrrrÚ do_sourceýs z Pdb.do_sourcerc Cs®|r|j}|j |d¡}nd}}t||ƒD]|\}}t|ƒ d¡} t| ƒdkrV| d7} ||vrh| d7} n| d7} ||kr‚| d7} n||kr’| d7} | | d| ¡¡q,d S) zPrint a range of lines.rrér³ÚBz->z>>ú N) r‚rLršrr¸Úrjustrýrbr¾) r:r+rrreÚcurrent_linenoÚ exc_linenor r!Úsrrrr|s    zPdb._print_linescCsÆz| |¡}WnYdS0d}z |jj}Wnty@Yn0|rZ| d|j¡dSz |j}WntyvYn0|r| d|j¡dS|jtur´| d|j|j f¡dS| t|ƒ¡dS)z;whatis arg Print the type of the argument. Nz Method %sz Function %sz Class %s.%s) rqrr rÝrbr Ú __class__Útyperr)r:rÌÚvaluer2rrrÚ do_whatis#s.     z Pdb.do_whatiscCsl|s8| d¡|j |ji¡ ¡D]}| d|¡q"n0| |¡}||j |ji¡|<| d||f¡dS)zâdisplay [expression] Display the value of the expression if it changed, each time execution stops in the current frame. Without expression, list all display expressions for the current frame. zCurrently displaying:z%s: %rzdisplay %s: %rN)rbrIršrkr›rœÚ setdefault)r:rÌr%rrrrrÚ do_displayFs  zPdb.do_displaycCsR|r>z|j |ji¡|=WqNty:| d|¡YqN0n|j |jd¡dS)z·undisplay [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)rIršrkrørÕrxrrrrÚ do_undisplayYs  zPdb.do_undisplaycs‡fdd„|j |ji¡DƒS)Ncsg|]}| ˆ¡r|‘qSrró)rêrUrìrrríis ÿz*Pdb.complete_undisplay..)rIršrkrðrrìrÚcomplete_undisplayhszPdb.complete_undisplaycCs$i|jj¥|j¥}tjd|ddS)z interact Start an interactive interpreter whose global namespace contains all the (global and local) names found in the current scope. z *interactive*)ÚlocalN)rkr&rrr2Úinteract)r:rÌrûrrrÚ do_interactlszPdb.do_interactcCs¤| ¡}t|ƒdkrHt|j ¡ƒ}|D]}| d||j|f¡q&dS|d|jvr„t|ƒdkr„| d|d|j|df¡nd |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 rz%s = %sNrr³)r¶rýÚsortedrHrúrbr¹)r:rÌr¿rúr´rrrÚdo_aliasus "z Pdb.do_aliascCs6| ¡}t|ƒdkrdS|d|jvr2|j|d=dS)z9unalias name Delete the specified alias. rN)r¶rýrH)r:rÌr¿rrrÚ do_unalias˜szPdb.do_unaliascs‡fdd„|jDƒS)Ncsg|]}| ˆ¡r|‘qSrró)rêÚarìrrrí¢r÷z(Pdb.complete_unalias..)rHrðrrìrÚcomplete_unalias¡szPdb.complete_unalias)rZrOrQrXrcr[cCs2z|jD]}| |¡qWnty,Yn0dSr8)rirˆra)r:Ú frame_linenorrrrB°s   zPdb.print_stack_tracecCs6|\}}||jurd}nd}| || ||¡¡dS)Nz> z )rkrbÚformat_stack_entry)r:r›Ú prompt_prefixrer r—rrrrˆ·s  ÿzPdb.print_stack_entrycCsÀ|stj ||¡Sz>zt|d|ƒ}|ƒWWStyLt|d|ƒ}Yn0Wn typ| d|¡YnL0tjjdkr| d|¡dS|j dur¬| d|¡dS|  |j   ¡¡dS)zýh(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_rÈzNo help for %rrµzJNo help for %r; please do not run Python with -OO if you need command helpNz&No help for %r; __doc__ string missing) rBrCÚdo_helpr†rÊrÕrDÚflagsÚoptimizerrbr¾)r:rÌÚtopicÚcommandrrrrŸÂs&    ÿ z Pdb.do_helpcCs| |jjpd ¡¡dS)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)rbÚ help_execrryr9rrrr¤ßs z Pdb.help_execcCs tƒdSr8)rr9rrrÚhelp_pdbësz Pdb.help_pdbcCsÊtj |¡rtj |¡r|Stj tjd|¡}tj |¡rP| |¡|jkrP|Stj |¡\}}|dkrp|d}tj |¡r€|StjD]>}tj  |¡r¢t  |¡}qŠtj ||¡}tj |¡r†|Sq†dS)z·Helper function for break/clear parsing -- may be overridden. lookupmodule() translates (possibly incomplete) file or module name into an absolute file name. rr>rÚN) rSrTÚisabsÚexistsr¹rDr€rJÚsplitextÚislinkÚreadlink)r:rrtÚrootÚextÚdirnameÚfullnamerrrrðs"      zPdb.lookupmodulec Csrd|_d|_ddl}| |¡\}}}| |j¡|_ddl}|j  ¡|j  d|j|j |j |t dœ¡| |¡dS)NTFrÚ__main__)rÚ__file__Ú __package__Ú __loader__Ú__spec__Ú __builtins__)rKraÚrunpyÚ_get_module_detailsr€rrJr¯Ú__dict__rlÚupdateÚparentÚloaderr´r )r:Ú module_namerµÚmod_nameÚmod_specr2r¯rrrÚ _runmodules  úzPdb._runmodulecCsˆddl}|j ¡|j d|tdœ¡d|_| |¡|_d|_t   |¡"}d|  ¡|jf}Wdƒn1sp0Y|  |¡dS)Nrr¯)rr°r´TFzexec(compile(%r, %r, 'exec'))) r¯r·rlr¸r´rKr€rJraÚioÚ open_codeÚreadr )r:rr¯rÚ statementrrrÚ _runscripts þ    ÿ"zPdb._runscript)r<NNNFT)r)N)rN)yrrrr¡rArfrgrhrvrsrr„rƒrr˜r‰r r}r¦r±rÄrzrÅrbrÕrèrñrÜrÚcomplete_commandsrrÚdo_bÚcomplete_breakÚ complete_brÚcomplete_tbreakr rr,Úcomplete_enabler.Úcomplete_disabler1Úcomplete_conditionr5Úcomplete_ignorerAÚdo_clÚcomplete_clearÚ complete_clrCÚdo_wÚdo_btrDrIÚdo_urKÚdo_drNÚdo_untrOÚdo_srQÚdo_nrVÚ do_restartrXÚdo_rrZÚdo_cÚdo_contr[Údo_jr`Úcomplete_debugrcÚdo_qÚdo_exitrdroÚdo_arpÚdo_rvrqrœr«rsrtrwÚcomplete_printÚ complete_pÚ complete_ppr€Údo_lrÚdo_llrƒÚcomplete_sourcer|rŽÚcomplete_whatisrÚcomplete_displayr‘r’r•r—r˜ršrËrBÚ line_prefixrˆrŸÚdo_hr¤r¥rr¾rÃrrrrr Šsìÿ /     M ]!!.   1  ! #    r )"rÚwhereÚdownÚupÚbreakÚtbreakrlr-r*r2Ú conditionrWÚsteprÃÚuntilÚjumpÚreturnÚretvalr Úcontinuer.Úlonglistr¿r_ÚppÚwhatisÚsourceÚdisplayÚ undisplayr”r´ÚunaliasÚdebugÚquitrÈz cCstƒ |||¡dSr8)r r ©rÂr­r¬rrrr Isr cCstƒ |||¡Sr8)r r )Ú expressionr­r¬rrrr Lsr cCst|||ƒdSr8)r rrrrr Osr cOstƒj|i|¤ŽSr8)r r)r¿ÚkwdsrrrrSsr)ÚheadercCs,tƒ}|dur| |¡| t ¡j¡dSr8)r rbrrDÚ _getframeÚf_back)rÚpdbrrrrVs rcCsB|durt ¡d}|dur$tdƒ‚tƒ}| ¡| d|¡dS)NrµzAA valid traceback must be passed if no exception is being handled)rDr“r¤r rgr})Útr_rrrr^s rcCsttjƒdSr8)rrDÚlast_tracebackrrrrr lsr zimport x; x.main()cCs ttƒdSr8)r ÚTESTCMDrrrrÚtesttsr cCsddl}| t¡dSr-)ÚpydocÚpagerr)r rrrrxsrausage: 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 CsXddl}| tjdd…dddg¡\}}|s>ttƒt d¡g}d}|D]B\}}|dvrlttƒt ¡qJ|d vr€| |¡qJ|d vrJd }qJ|d}|s¼tj  |¡s¼td |d ƒt d¡|rüddl }z|  |¡Wn$t yút  ¡t d¡Yn0|tjdd…<|s.tj |¡}tj |¡tjd<tƒ} | j |¡z6|rT|  |¡n |  |¡| jrlWqTtdƒWnØty²td|dƒtdd tjdd…¡ƒYnžtyàtdddtt ¡dƒYnptyt  ¡t d¡YnLt  ¡tdƒtdƒt ¡d} |  d| ¡td|dƒYn0q@dS)Nrrzmhc:rzcommand=rµF)z-hz--help)z-cz --command)z-mTzError:zdoes not existz*The program finished and will be restartedÚ Restartingzwith arguments:r†r³z/The program exited via sys.exit(). Exit status:)rÇz2Uncaught exception. Entering post mortem debuggingz1Running 'cont' or 'step' will restart the programz#Post mortem debugger finished. The z will be restarted)ÚgetoptrDrSrÒÚ_usageÚexitr½rSrTr§rµr¶rÝr‘Ú print_excÚrealpathr­r rRrVr¾rÃrarr¹Ú SystemExitr“Ú SyntaxErrorr}) rÚoptsr¿rWÚ run_as_moduleÚoptÚoptargrJrµrrrrrÚmain‹sr                  ÿrr¯)NN)NN)N)/rrSr¿rrDrBr?r/r2rÞrur¢r#rr‘r'rÝrÚ__all__r"r,r6r¸r7rér@rCr Ú _help_orderÚ_commandr†ryr¤r r r rrrr r r rrrrrrrrrÚsnC    7     L