o ?Og÷ã@s˜dZddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl Z ddl Z ddlZddlZGdd„deƒZgd¢Zdd„Zdd „ZGd d „d eƒZd ZGd d„dejejƒZedurŠgd¢ZeD]Zeeedeƒj ¡d7Zqqeejj7Z[[d*dd„Z d*dd„Z!dd„Z"dd„Z#ddœdd„Z$d+dd„Z%dd „Z&d!Z'd"d#„Z(d$d%„Z)d&Z*d'd(„Z+e,d)krÊddl-Z-e- +¡dSdS),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ú*/opt/alt/python310/lib64/python3.10/pdb.pyrWsr) ÚrunÚpmÚPdbÚrunevalÚrunctxÚruncallÚ set_traceÚ post_mortemÚhelpcCsžt dt |¡¡}zt |¡}Wn tyYdSw|'t|ddD]\}}| |¡r<|||fWdƒSq%WdƒdS1sHwYdS)Nzdef\s+%s\s*[(]é)Ústart)ÚreÚcompileÚescapeÚtokenizeÚopenÚOSErrorÚ enumerateÚmatch)ÚfuncnameÚfilenameZcreÚfpÚlinenoÚlinerrrÚ find_function^s" ÿ  ýÿ ÿür!cCs8tt |¡ƒ}| ¡|D] \}}||kr|Sq dS©Nr)ÚlistÚdisZfindlinestartsÚreverse)ÚcodeZlastiZ linestartsÚirrrrÚ lasti2linenoks ÿr(c@seZdZdZdd„ZdS)Ú_rstrz#String that doesn't quote its repr.cCs|S©Nr©ÚselfrrrÚ__repr__vsz_rstr.__repr__N)rrrrr-rrrrr)ts r)z -> c@s(eZdZdZ  d¢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 Cs\tjj||dtj ||||¡t d¡|rd|_d|_i|_ i|_ d|_ d|_ i|_ z ddl}| d¡Wn tyAYnwd|_||_g|_|rz ttj d¡ƒ}|j |¡Wdƒn1sgwYWn tyvYnwztd ƒ}|j |¡Wdƒn1swYWn tyœYnwi|_i|_i|_d|_d|_dS) N)Úskipzpdb.Pdbrz(Pdb) ÚFz `@#$%^&*()=+[{]}\|;:'",<>?z~/.pdbrcz.pdbrc)ÚbdbÚBdbÚ__init__ÚcmdÚCmdÚsysÚauditZ use_rawinputÚpromptÚaliasesÚ displayingÚ mainpyfileÚ_wait_for_mainpyfileÚ tb_linenoÚreadlineZset_completer_delimsÚ ImportErrorÚ allow_kbdintÚnosigintÚrcLinesrÚosÚpathÚ expanduserÚextendrÚcommandsÚcommands_dopromptÚcommands_silentÚcommands_definingÚ commands_bnum) r,Ú completekeyÚstdinÚstdoutr/rAZreadrcr>ZrcFilerrrr3…sT  ÿÿ€ ÿ ÿ€ ÿ z Pdb.__init__cCs*|jrt‚| d¡| ¡| |¡dS)Nz- Program interrupted. (Use 'cont' to resume).)r@ÚKeyboardInterruptÚmessageÚset_stepr)r,ZsignumÚframerrrÚsigint_handler´s  zPdb.sigint_handlercCstj |¡| ¡dSr*)r1r2ÚresetÚforgetr+rrrrT»s  z Pdb.resetcCs&d|_g|_d|_d|_|j ¡dSr")rÚstackÚcurindexÚcurframer=Úclearr+rrrrU¿s z Pdb.forgetcCsj| ¡| ||¡\|_|_|r#t|jj|jƒ}||j|j<|j }|s|j|jd|_ |j j |_ |  ¡Sr")rUZ get_stackrVrWr(Útb_frameÚf_codeÚtb_lastir=Útb_nextrXÚf_localsÚcurframe_localsÚ execRcLines)r,ÚfÚtbrrrrÚsetupÆs ú z Pdb.setupcCsj|jsdS|j}| ¡g|_|r3| ¡ ¡}|r/|ddkr/| |¡r/|jt|ƒ7_dS|sdSdS)Nrú#T)rBr%ÚpopÚstripÚonecmdÚreversed)r,rBr rrrr`Øs   øzPdb.execRcLinescCs2|jrdS| |¡r| d¡| |d¡dSdS)znThis method is called when there is the remote possibility that we ever need to stop in this function.Nz--Call--)r<Z stop_hererPÚ interaction)r,rRZ argument_listrrrÚ user_callìs   þz Pdb.user_callcCsL|jr|j| |jj¡ks|jdkrdSd|_| |¡r$| |d¡dSdS)z;This function is called when we stop or break at this line.rNF)r<r;Úcanonicr[Ú co_filenameÚf_linenoÚ bp_commandsri)r,rRrrrÚ user_lineõs  ÿz Pdb.user_linecCs”t|ddƒrH|j|jvrH|j}d|_|j}| |d¡|j|D]}| |¡q ||_|j|s9| |j|j ¡|j |rB|  ¡|  ¡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) ÚgetattrrprGÚlastcmdrcrgrIÚprint_stack_entryrVrWrHÚ_cmdlooprU)r,rRrpZ lastcmd_backr rrrrnÿs      zPdb.bp_commandscCs.|jrdS||jd<| d¡| |d¡dS)z7This function is called when a return trap is set here.NÚ __return__z --Return--)r<r^rPri)r,rRZ return_valuerrrÚ user_returns   zPdb.user_returncCsh|jrdS|\}}}||f|jd<|s|turdnd}| 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.NZ __exception__z Internal r0z%s%séÿÿÿÿ)r<r^Ú StopIterationrPÚ tracebackÚformat_exception_onlyrfri)r,rRÚexc_infoÚexc_typeÚ exc_valueÚ exc_tracebackÚprefixrrrÚuser_exceptions ÿÿÿzPdb.user_exceptioncCs< z d|_| ¡d|_WdSty| d¡Ynwq)NTFz--KeyboardInterrupt--)r@ÚcmdlooprOrPr+rrrrt3s ÿøz Pdb._cmdloopcCsb|j |j¡}|r-| ¡D]!\}}| |¡}||ur,||kr,|||<| d|||f¡q dSdS)Nzdisplay %s: %r [old: %r])r:ÚgetrXÚitemsÚ_getval_exceptrP)r,r:ÚexprZoldvalueZnewvaluerrrÚpreloop@s ÿ€øz Pdb.preloopcCsrtjrz t tjtj¡Wn tyYnwdt_| ||¡r&| ¡dS| |j|j ¡|  ¡| ¡dSr*) r Ú_previous_sigint_handlerÚsignalÚSIGINTÚ ValueErrorrcrUrsrVrWrt)r,rRryrrrriMs ÿ  zPdb.interactioncCs|dur | t|ƒ¡dSdS)z{Custom displayhook for the exec in default(), which prevents assignment of the _ variable in the builtins. N)rPÚrepr)r,ÚobjrrrÚ displayhook_sÿzPdb.displayhookcCs¶|dd…dkr|dd…}|j}|jj}z;t|dddƒ}tj}tj}tj}z|jt_|jt_|jt_t|||ƒW|t_|t_|t_WdS|t_|t_|t_w|  ¡YdS)Nrú!Ú zZsingle) r_rXÚ f_globalsrr6rNrMrÚexecÚ _error_exc)r,r ÚlocalsÚglobalsr&Z save_stdoutZ save_stdinZsave_displayhookrrrÚdefaultgs* þz Pdb.defaultcCsä| ¡s|S| ¡}|d|jvrI|j|d}d}|dd…D]}| dt|ƒ|¡}|d7}q | dd |dd…¡¡}| ¡}|d|jvs|ddkrp| d¡}|dkrp||d d… ¡}|j  |¡|d|…  ¡}|S) z*Handle alias expansion and ';;' separator.rrNú%z%*ú Úaliasz;;é) rfÚsplitr9ÚreplaceÚstrÚjoinÚfindÚlstripÚcmdqueueÚappendÚrstrip)r,r ÚargsZiiZtmpArgZmarkerÚnextrrrÚprecmd|s*ÿ ø  z Pdb.precmdcCs|js tj ||¡S| |¡S)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. )rJr4r5rgÚhandle_command_def)r,r rrrrg•s z Pdb.onecmdcCsÂ| |¡\}}}|s dS|dkrd|j|j<dS|dkr!g|_dS|j|j}|r3| |d|¡n| |¡z t|d|ƒ}Wn tyM|j}Ynw|j |j vr_d|j |j<g|_dSdS) z8Handles one command line during command list definition.NZsilentTÚendrr—Údo_F) Z parselinerIrKr rGr¡rqÚAttributeErrorr•rÚcommands_resumingrH)r,r r4ÚargZcmdlistÚfuncrrrr¦¡s.     ÿ  zPdb.handle_command_defcCst||jddS)N©Úfile©ÚprintrN©r,ÚmsgrrrrP¿óz Pdb.messagecCstd||jddS)Nz***r­r¯r±rrrÚerrorÂóz Pdb.errorcCs¤| ¡ d¡r gSz | ||||¡}Wn tyg}Ynwt t |¡d¡}|D]$}tj |¡r;|  |d¡q+tj  |¡rO|  ¡ d¡rO|  |d¡q+|S)N)ú:ú,Ú*ú/)ú.pyz.pywr¶) rfÚendswithÚ_complete_expressionÚ ExceptionÚglobrrCrDÚisdirr¡ÚisfileÚlower)r,Útextr ÚbegidxÚendidxZretÚglobsÚfnrrrÚ_complete_locationÈs ÿ €zPdb._complete_locationcs‡fdd„ttjjƒDƒS)Ncs.g|]\}}|durt|ƒ ˆ¡rt|ƒ‘qSr*)rœÚ startswith)Ú.0r'Úbp©rÂrrÚ ßs ÿz*Pdb._complete_bpnumber..)rr1Ú BreakpointÚ bpbynumber©r,rÂr rÃrÄrrËrÚ_complete_bpnumberÛszPdb._complete_bpnumberc sº|jsgSi|jj¥|j¥}dˆvrRˆ d¡‰z|ˆd}ˆdd…D]}t||ƒ}q$Wn ttfy:gYSwd ˆdd…¡d‰‡‡fdd„t|ƒDƒS‡fdd„|  ¡DƒS)NÚ.rrrwcs"g|] }| ˆd¡rˆ|‘qS)rw©rÈ©rÉÚn)ÚdottedrrrrÌös"z,Pdb._complete_expression..cóg|] }| ˆ¡r|‘qSrrÒrÓrËrrrÌùó) rXrr_ršrqÚKeyErrorr©rÚdirÚkeys)r,rÂr rÃrÄÚnsrŒÚpartr)rÕrrÂrr¼âs    ÿÿzPdb._complete_expressioncCsB|s ttjjƒd}nzt|ƒ}Wn | d¡YdS||_||jvr4|j||j||j |f}nd}g|j|<d|j|<d|j |<|j }d|_ d|_ zKz|  ¡Wn2t y‡|rt|d|j|<|d|j|<|d|j |<n |j|=|j|=|j |=| d ¡Yn wWd|_ ||_ dSWd|_ ||_ dSd|_ ||_ w) 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)Úlenr1rÍrÎÚintr´rKrGrHrIr8rJrrO)r,r«ZbnumZold_command_defsZ prompt_backrrrÚ do_commandsÿsP%   þ     öÿ ý ÿzPdb.do_commandsrc Cs,|s|jr| d¡tjjD] }|r| | ¡¡qdSd}d}d}| d¡}|dkr=||dd… ¡}|d|… ¡}|  d¡}d} |dkr„|d|… ¡}|  |¡} | s`|  d|¡dS| }||dd… ¡}zt |ƒ}Wnit yƒ|  d|¡YdSwzt |ƒ}WnQt yÛz t||jj|jƒ} Wn|} Yzt| d ƒr¬| j} | j} | j} | j}| j}Wn| |¡\} }}| sÒ|  d |¡YYdS| } t |ƒ}YYnw|sâ| ¡}| ||¡}|r| ||||| ¡}|rý|  |¡dS| ||¡d }| d |j|j|jf¡dSdS) 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.rwzBreakpoint %d at %s:%d) ÚbreaksrPr1rÍrÎZbpformatržrŸr¢ÚrfindÚ lookupmoduler´rÞrŠÚevalrXrr_ÚhasattrràÚ__code__Úco_nameÚco_firstlinenorlÚlineinfoÚ defaultFileÚ checklineZ set_breakÚ get_breaksÚnumberr®r )r,r«Z temporaryrÊrrÚcondZcommaZcolonrrar¬r&ÚokZlnr ÚerrrrrÚdo_breakNsŽ  €     þ  þ  ÿ €è  ÿùz Pdb.do_breakcCs"|jjj}|dkr|jr|j}|S)zProduce a reasonable default.z)rXr[rlr;)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|ƒdkr!|d ¡}n|S|dkr)|S| d¡}|ddkr?|d=t|ƒdkr?|S| ¡}t|ƒdkrN|d}n| |d¡}|rY|}|d}t||ƒ} | pe|S) N)NNNú'rrér0rÑr,)ršrÝrfrêrãr!) r,Z identifierZfailedZidstringÚidÚpartsZfnameÚitemraZanswerrrrréÀs,          z Pdb.lineinfocCs„t|ddƒ}|r |jnd}t |||¡}|s| d¡dS| ¡}|r9|ddks9|dd…dks9|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. rXNz End of filerrdrõz"""z'''zBlank or comment)rqrÚ linecacheÚgetlinerPrfr´)r,rrrRrÅr rrrrëás    z Pdb.checklinec Cój| ¡}|D],}z| |¡}Wnty&}z | |¡WYd}~qd}~ww| ¡| d|¡qdS)z†enable bpnumber [bpnumber ...] Enables the breakpoints given as a space separated list of breakpoint numbers. Nz Enabled %s)ršÚget_bpbynumberrŠr´ÚenablerP©r,r«r£r'rÊrðrrrÚ do_enable÷s€ÿùz Pdb.do_enablec Crû)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´ÚdisablerPrþrrrÚ do_disables€ÿùzPdb.do_disablec CsÆ| dd¡}z|d}Wn tyd}Ynwz | |d ¡¡}Wn&ty2| d¡YdStyI}z | |¡WYd}~dSd}~ww||_|sY| d|j¡dS| 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ürfr´rŠrîrPrí)r,r«r£rîrÊrðrrrÚ do_conditions$   ÿ €ÿzPdb.do_conditionc CsÞ| ¡}z t|d ¡ƒ}Wnd}Yz | |d ¡¡}Wn&ty/| d¡YdStyF}z | |¡WYd}~dSd}~ww||_|dkre|dkrWd|}nd}| d||j f¡dS| 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. rrrNz %d crossingsz 1 crossingz%Will ignore next %s of breakpoint %d.z-Will stop next time breakpoint %d is reached.) ršrÞrfrürr´rŠÚignorerPrí)r,r«r£ÚcountrÊrðZcountstrrrrÚ do_ignore7s0  €ÿ  ÿ ÿz Pdb.do_ignorec Cs‚|s9ztdƒ}Wn tyd}Ynw| ¡ ¡}|dvr7dd„tjjDƒ}| ¡|D] }| d|¡q-dSd|vr‹|  d¡}|d|…}||d d…}zt |ƒ}Wn t ycd |}Ynw|  ||¡dd…}|  ||¡}|r}| |¡dS|D] }| d|¡qdS| ¡} | D]-}z| |¡}Wnt y±}z | |¡WYd}~q‘d}~ww| |¡| 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? Zno)ÚyZyescSsg|]}|r|‘qSrr)rÉrÊrrrrÌhsz Pdb.do_clear..z Deleted %sNr¶rzInvalid line number (%s))ÚinputÚEOFErrorrfrÁr1rÍrÎZclear_all_breaksrPrârÞrŠrìZ clear_breakr´ršrüZclear_bpbynumber) r,r«ZreplyZbplistrÊr'rrrðZ numberlistrrrÚdo_clearZsR  ÿ      ÿ  þ€ÿ ùz Pdb.do_clearcCó | ¡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_traceròrrrÚdo_wheres z Pdb.do_wherecCs>||_|j|jd|_|jj|_| |j|j¡d|_dSr")rWrVrXr^r_rsr)r,rírrrÚ _select_frame—s   zPdb._select_framecCsx|jdkr | d¡dSzt|pdƒ}Wnty%| d|¡YdSw|dkr-d}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))rWr´rÞrŠÚmaxr©r,r«rZnewframerrrÚdo_upŸs   þz Pdb.do_upcCs–|jdt|jƒkr| d¡dSzt|pdƒ}Wnty*| d|¡YdSw|dkr7t|jƒd}n tt|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 frameNrr)rWrÝrVr´rÞrŠÚminrrrrrÚdo_down³s  þz Pdb.do_downcCsf|r(zt|ƒ}Wnty| d|¡YdSw||jjkr'| 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´rXrmZ set_until)r,r«rrrrÚdo_untilÇs  þ  ýz Pdb.do_untilcCr )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)rQròrrrÚdo_stepßsz Pdb.do_stepcCó| |j¡dS)zxn(ext) Continue execution until the next line in the current function is reached or it returns. r)Zset_nextrXròrrrÚdo_nextés z Pdb.do_nextc Csv|r9ddl}tjdd…}z| |¡t_Wnty1}z| d||f¡WYd}~dSd}~ww|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". rNrzCannot run %s: %s)Úshlexr6ÚargvršrŠr´r)r,r«rZargv0ÚerrrÚdo_runòs€þz Pdb.do_runcCr)zPr(eturn) Continue execution until the current function returns. r)Z set_returnrXròrrrÚ do_returns z Pdb.do_returncCs<|jsz t tj|j¡t_Wn tyYnw| ¡dS)z]c(ont(inue)) Continue execution, only stop when a breakpoint is encountered. r)rArˆr‰rSr r‡rŠZ set_continueròrrrÚ do_continuesÿ ûzPdb.do_continuec CsÀ|jdt|jƒkr| d¡dSzt|ƒ}Wnty&| d¡YdSwz||j_|j|jd|f|j|j<| |j|j¡WdSty_}z| d|¡WYd}~dSd}~ww)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) rWrÝrVr´rÞrŠrXrmrs)r,r«rrrrÚdo_jump!s    ÿ€ÿz Pdb.do_jumpcCsšt d¡|jj}|j}t|j|j|jƒ}d|j   ¡|_ |  d¡z t  |j |||f¡Wn ty;| ¡Ynw|  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)r6ÚsettracerXrr_r rLrMrNr8rfrPÚ call_tracingr r½r’Ztrace_dispatchrr)r,r«r”r“ÚprrrÚdo_debug>s    ÿ   z Pdb.do_debugcCsd|_| ¡dS)z[q(uit) exit Quit from the debugger. The program being executed is aborted. Tr)Ú_user_requested_quitÚset_quitròrrrÚdo_quitTsz Pdb.do_quitcCs| d¡d|_| ¡dS)z=EOF Handles the receipt of EOF as a command. r0Tr)rPr&r'ròrrrÚdo_EOF_s z Pdb.do_EOFcCsŽ|jj}|j}|j|j}|jtj@r|d}|jtj@r!|d}t |ƒD]}|j |}||vr<|  d|||f¡q%|  d|f¡q%dS)zHa(rgs) Print the argument list of the current function. rz%s = %rz%s = *** undefined ***N) rXr[r_Ú co_argcountÚco_kwonlyargcountÚco_flagsÚinspectZ CO_VARARGSZCO_VARKEYWORDSÚrangeÚ co_varnamesrP)r,r«ÚcoÚdictrÔr'ÚnamerrrÚdo_argshs   ûz Pdb.do_argscCs0d|jvr| t|jdƒ¡dS| d¡dS)zQretval Print the return value for the last return of a function. ruzNot yet returned!N)r_rPr‹r´ròrrrÚ do_retvalys z Pdb.do_retvalcCs&z t||jj|jƒWS| ¡‚r*)rärXrr_r’ròrrrÚ_getvalƒs z Pdb._getvalcCshz|durt||jj|jƒWSt||j|jƒWSt ¡dd…}tj|Žd  ¡}t d|ƒYS)Nr™rwz** raised %s **) rärXrr_r^r6r{ryrzrfr))r,r«rRr{rðrrrr„ŠszPdb._getval_exceptcCs,t ¡dd…}| tj|Žd ¡¡dS)Nr™rw)r6r{r´ryrzrf)r,r{rrrr’•szPdb._error_exccCsFz| |¡}WnYdSz | ||ƒ¡WdS| ¡YdSr*)r5rPr’)r,r«r¬ÚvalrrrÚ _msg_val_func™szPdb._msg_val_funccCs| |t¡dS)z@p expression Print the value of the expression. N)r7r‹ròrrrÚdo_p£szPdb.do_pcCs| |tj¡dS)zHpp expression Pretty-print the value of the expression. N)r7ÚpprintZpformatròrrrÚdo_pp©sz Pdb.do_ppcCsˆd|_d}|rL|dkrLz/d|vr,| d¡\}}t| ¡ƒ}t| ¡ƒ}||kr+||}n t| ¡ƒ}td|dƒ}Wn)tyK| d|¡YdSw|jdusU|dkr_td|jj dƒ}n|jd}|durl|d}|jj j }|  d ¡r„|jj  d ¡}t|tƒr„|}| |¡}z0t ||jj ¡}| ||d|…|||j¡t|t|ƒƒ|_t|ƒ|kr·| d ¡WdSWdStyÃYdSw) 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éré z\}}t|ƒ d¡} t| ƒdkr+| d7} ||vr4| d7} n| d7} ||krA| d7} n||krI| d7} | | d| ¡¡qd S) zPrint a range of lines.rwrõér—ÚBz->z>>ú N) rmr=r‚rrœÚrjustrÝrPr¢) r,rErrárRZcurrent_linenoZ exc_linenorr ÚsrrrrA s"   ôzPdb._print_linescCsÄz| |¡}WnYdSd}z|jj}Wn tyYnw|r,| d|j¡dSz|j}Wn ty:Ynw|rG| d|j¡dS|jturY| d|j|j f¡dS| t|ƒ¡dS)z;whatis arg Print the type of the argument. Nz Method %sz Function %sz Class %s.%s) r5ràrær½rPrçÚ __class__Útyperr)r,r«Úvaluer&rrrÚ do_whatis s2  ÿ  ÿ z Pdb.do_whatiscCsn|s| d¡|j |ji¡ ¡D] }| d|¡qdS| |¡}||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)rPr:r‚rXrƒr„Ú setdefault)r,r«rør6rrrÚ do_displayCs ÿ zPdb.do_displaycCsT|r z |j |ji¡|=WdSty| d|¡YdSw|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)r:r‚rXrØr´reròrrrÚ do_undisplayVs ÿzPdb.do_undisplaycs‡fdd„|j |ji¡DƒS)NcrÖrrÒ)rÉrrËrrrÌfs ÿz*Pdb.complete_undisplay..)r:r‚rXrÏrrËrÚcomplete_undisplayeszPdb.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*)ZlocalN)rXrr_r&Úinteract)r,r«rÛrrrÚ do_interactiszPdb.do_interactcCs¦| ¡}t|ƒdkr$t|j ¡ƒ}|D]}| d||j|f¡qdS|d|jvrCt|ƒdkrC| d|d|j|df¡dSd |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ÝÚsortedr9rÚrPr)r,r«r£rÚr˜rrrÚdo_aliasrs $ z Pdb.do_aliascCs:| ¡}t|ƒdkr dS|d|jvr|j|d=dSdS)z9unalias name Delete the specified alias. rN)ršrÝr9)r,r«r£rrrÚ do_unalias•s ÿzPdb.do_unaliascs‡fdd„|jDƒS)NcrÖrrÒ)rÉÚarËrrrÌŸr×z(Pdb.complete_unalias..)r9rÏrrËrÚcomplete_unaliasžrµzPdb.complete_unalias)r rrrr(r!cCs2z|jD]}| |¡qWdStyYdSwr*)rVrsrO)r,Ú frame_linenorrrr ­s  ÿ ÿzPdb.print_stack_tracecCs6|\}}||jur d}nd}| || ||¡¡dS)Nz> z )rXrPZformat_stack_entry)r,r_Z prompt_prefixrRrrrrrrs´s   ÿzPdb.print_stack_entrycCsÂ|s tj ||¡Szz t|d|ƒ}|ƒWWSty&t|d|ƒ}YnwWnty9| d|¡YdSwtjjdkrI| d|¡dS|j durW| 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. Zhelp_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) r4r5Údo_helprqr©r´r6ÚflagsÚoptimizerrPr¢)r,r«ZtopicZcommandrrrr`¿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) r0N)rPÚ help_execrrfr+rrrrcÜs z Pdb.help_execcCs tƒdSr*)rr+rrrÚhelp_pdbès z Pdb.help_pdbcCsÔtj |¡rtj |¡r|Stj tjd|¡}tj |¡r(| |¡|jkr(|Stj |¡\}}|dkr8|d}tj |¡r@|StjD]$}tj  |¡rVt  |¡}tj  |¡sKtj ||¡}tj |¡rg|SqCdS)z·Helper function for break/clear parsing -- may be overridden. lookupmodule() translates (possibly incomplete) file or module name into an absolute file name. rr0rºN) rCrDÚisabsÚexistsrr6rkr;ÚsplitextÚislinkÚreadlink)r,rraÚrootZextÚdirnameÚfullnamerrrrãís&     ÿ ÿzPdb.lookupmodulec Csrd|_d|_ddl}| |¡\}}}| |j¡|_ddl}|j  ¡|j  d|j|j |j |t dœ¡| |¡dS)NTFrÚ__main__)rr=Ú __package__Ú __loader__Ú__spec__Ú __builtins__)r<r&ÚrunpyÚ_get_module_detailsrkrlr;rmÚ__dict__rYÚupdateÚparentÚloaderrqr )r,Z module_namerrZmod_nameZmod_specr&rmrrrÚ _runmodules  úzPdb._runmodulecCsˆddl}|j ¡|j d|tdœ¡d|_| |¡|_d|_t   |¡}d|  ¡|jf}Wdƒn1s8wY|  |¡dS)Nrrm)rr=rqTFzexec(compile(%r, %r, 'exec'))) rmrtrYrurqr<rkr;r&ÚioÚ open_codeÚreadr )r,rrmrÚ statementrrrÚ _runscripts þ   ÿÿzPdb._runscript)r.NNNFT)rr*)rN)yrrrr‡r3rSrTrUrcr`rjrornrvr€rtr†rirr•r¥rgr¦rPr´rÇrÐr¼rßZcomplete_commandsrñrêZdo_bZcomplete_breakZ complete_bróZcomplete_tbreakrérërÿZcomplete_enablerZcomplete_disablerZcomplete_conditionrZcomplete_ignorer Zdo_clZcomplete_clearZ complete_clrZdo_wZdo_btrrZdo_urZdo_drZdo_untrZdo_srZdo_nrZ do_restartrZdo_rr Zdo_cZdo_contr!Zdo_jr%Zcomplete_debugr(Zdo_qZdo_exitr)r3Zdo_ar4Zdo_rvr5r„r’r7r8r:Zcomplete_printZ complete_pZ complete_pprFZdo_lrHZdo_llrJZcomplete_sourcerArSZcomplete_whatisrUZcomplete_displayrVrWrYr[r\r^rªr Ú line_prefixrsr`Zdo_hrcrdrãrxr}rrrrr sî ÿ/     M ]!!.    7  ! #     r )"rÚwhereZdownZupÚbreakZtbreakrYrrýrZ conditionrGÚstepr¤ZuntilZjumpÚreturnZretvalr Úcontinuer#Zlonglistr£r$ZppZwhatisÚsourceZdisplayZ undisplayrXr˜ZunaliasÚdebugÚquitr¨z cCstƒ |||¡dSr*)r r ©r|r”r“rrrr Frµr cCstƒ |||¡Sr*)r r )Z expressionr”r“rrrr Isr cCst|||ƒdSr*)r r‡rrrr Lsr cOstƒj|i|¤ŽSr*)r r)r£ÚkwdsrrrrPr³r)ÚheadercCs,tƒ}|dur | |¡| t ¡j¡dSr*)r rPrr6Ú _getframeÚf_back)r‰ÚpdbrrrrSs rcCsB|dur t ¡d}|durtdƒ‚tƒ}| ¡| d|¡dS)Nr™zAA valid traceback must be passed if no exception is being handled)r6r{rŠr rTri)Útr$rrrr[s rcCsttjƒdSr*)rr6Úlast_tracebackrrrrr isr zimport x; x.main()cCs ttƒdSr*)r ÚTESTCMDrrrrÚtestqs rcCsddl}| t¡dSr")ÚpydocZpagerr)r‘rrrrusrausage: 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 CsDddl}| tjdd…dddg¡\}}|sttƒt d¡g}d}|D]!\}}|dvr6ttƒt ¡q%|d vr@| |¡q%|d vrFd }q%|d}|s^tj  |¡s^td |d ƒt d¡|r~ddl }z|  |¡Wnt y}t  ¡t d¡Ynw|tjdd…<|s–tj |¡}tj |¡tjd<tƒ} | j |¡ z|r©|  |¡n|  |¡| jr´WdStdƒWngtyÖtd|dƒtdd tjdd…¡ƒYnKtyìtdddtt ¡dƒYn5tyýt  ¡t d¡Yn$t  ¡tdƒtdƒt ¡d} |  d| ¡td|dƒYq )Nrrzmhc:rzcommand=r™F)z-hz--help)z-cz --command)z-mTzError:zdoes not existz*The program finished and will be restartedZ Restartingzwith arguments:rMr—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)Úgetoptr6rr°Ú_usageÚexitr¡rCrDrfrrrsr½ryÚ print_excÚrealpathrkr rBrFrxr}r&rrÚ SystemExitr{Ú SyntaxErrorri) r’Zoptsr£rGZ run_as_moduleÚoptZoptargr;rrrŒrrrrÚmainˆsz     €   þ             ÿçršrm)NNr*).rrCryrr6r4r1r$r&r¾r9rˆr-rryrùr½rÚ__all__r!r(rœr)r~r2r5r Z _help_orderZ_commandrqrfrcr r r rrrr rrrr“ršrrŒrrrrÚspC   =    L þ