eSrSSKrSSKrSSKrSSKJr SSKJrJrJ r /SQr \\-\ -r "SS\ 5r "SS 5rS r"S S 5rS rSr"SS\5rSrSrSrg)zDebugger basicsN)contextmanager) CO_GENERATOR CO_COROUTINECO_ASYNC_GENERATOR)BdbQuitBdb Breakpointc\rSrSrSrSrg)rz Exception to give up completely.N)__name__ __module__ __qualname____firstlineno____doc____static_attributes__r )/opt/imh/python3.13/lib/python3.13/bdb.pyrrs*rrcr\rSrSrSrS7SjrSrSr\S5r Sr S r S r S r S rS rSrSrSrSrSrSrSrSrSrSrSrS8SjrSrS7SjrSrSrSr Sr!S7S jr"S!r#S"r$S#r%S9S$jr&S%r'S&r(S'r)S(r*S)r+S*r,S+r-S,r.S-r/S.r0S/r1S0r2S:S1jr3S;S2jr4S;S3jr5S4r6S5r7S6r8g)", generated in interactive mode, are returned unchanged. <>)rgetospathabspathnormcase)r!filenamecanonics rr/ Bdb.canonic+so sXa^+c1 1O,,""8,ggooh/Ggg&&w/G%,LL "rc^SSKnUR5 SUlURSS5 g)z5Set values of attributes as ready to start debugging.rN) linecache checkcachebotframe _set_stopinfo)r!r2s rreset Bdb.reset<s(  4&rc#.# XlSv SUlg7fN)rr!frames rset_enterframeBdb.set_enterframeCs scURU5 UR(a SSS5 gUS:XaURU5sSSS5 $US:XaURX5sSSS5 $US:XaUR X5sSSS5 $US:XaUR X5sSSS5 $US:XaUR sSSS5 $US:XaUR sSSS5 $US:XaUR sSSS5 $US :XaURX5sSSS5 $[S [U55 UR sSSS5 $!,(df  g=f) aDispatch a trace function for debugged frames based on the event. This function is installed as the trace function for debugged frames. Its return value is the new trace function, which is usually itself. The default implementation decides how to dispatch a frame, depending on the type of event (passed in as a string) that is about to be executed. The event can be one of the following: line: A new line of code is going to be executed. call: A function is about to be called or another code block is entered. return: A function or other code block is about to return. exception: An exception has occurred. c_call: A C function is about to be called. c_return: A C function has returned. c_exception: A C function has raised an exception. For the Python events, specialized functions (see the dispatch_*() methods) are called. For the C events, no action is taken. The arg parameter depends on the previous event. Nlinecallreturn exceptionc_call c_exceptionc_returnopcodez*bdb.Bdb.dispatch: unknown debugging event:) r<quitting dispatch_line dispatch_calldispatch_returndispatch_exceptiontrace_dispatchdispatch_opcodeprintrepr)r!r;eventargs rrLBdb.trace_dispatchIs92  '}}( '))%0 ( ' ))%5 ( ' ++E7( ' #..u:( ' **( ' %**( ' "**!( '" ++E7%( '& >U L&&)( ' 's@E E E .E E .E  E $E ?E  E  EcURU5(dURU5(a(URU5 UR(a[eUR $)zInvoke user function and return trace function for line event. If the debugger stops on the current line, invoke self.user_line(). Raise BdbQuit if self.quitting is set. Return self.trace_dispatch to continue tracing in this scope. ) stop_here break_here user_linerGrrLr:s rrHBdb.dispatch_linexsD >>% DOOE$:$: NN5 !}}Gm"""rcURcURUlUR$URU5(dUR U5(dgUR (a.UR R[-(a UR$URX5 UR(a[eUR$)zInvoke user function and return trace function for call event. If the debugger stops on this function call, invoke self.user_call(). Raise BdbQuit if self.quitting is set. Return self.trace_dispatch to continue tracing in this scope. N) r4f_backrLrTbreak_anywhere stopframef_codeco_flagsGENERATOR_AND_COROUTINE_FLAGS user_callrGrr!r;rQs rrIBdb.dispatch_calls == !LLDM&& &u%%)<)>ell336SS&& & u" ==-"""rc URU5(dXR:XaUR(a.URR[ -(a UR $XlURX5 SUlUR(a[eURULa"URS:waURSS5 URS:waURU5 UR $!SUlf=f)zInvoke user function and return trace function for return event. If the debugger stops on this function return, invoke self.user_return(). Raise BdbQuit if self.quitting is set. Return self.trace_dispatch to continue tracing in this scope. Nr')rT returnframer[r\r]r^rLr user_returnrGr stoplinenor5_set_caller_tracefuncr`s rrJBdb.dispatch_returns >>% E-=-=$=~~%,,"7"7:W"W*** ,',$  ,'+$}}Gm~~&4??b+@""4."$**51"""(,$s &C99 Dc"URU5(ahURR[-(aUS[LaUSb(UR X5 UR (a[eUR$UR(auXRLagURRR[-(a;US[[4;a(UR X5 UR (a[eUR$)zInvoke user function and return trace function for exception event. If the debugger stops on this exception, invoke self.user_exception(). Raise BdbQuit if self.quitting is set. Return self.trace_dispatch to continue tracing in this scope. r) rTr\r]r^ StopIterationuser_exceptionrGrr[ GeneratorExitrLr`s rrKBdb.dispatch_exceptions >>% LL)),IIA-/CFN##E/==-""" nnnn!<NN))225RRF}m<<    +}}Gm"""rcURU5(dURU5(a(URU5 UR(a[eUR $)zInvoke user function and return trace function for opcode event. If the debugger stops on the current opcode, invoke self.user_opcode(). Raise BdbQuit if self.quitting is set. Return self.trace_dispatch to continue tracing in this scope. )rTrU user_opcoderGrrLr`s rrMBdb.dispatch_opcodesF >>% DOOE$:$:   U #}}Gm"""rclUcgURH n[R"X5(dM g g)z4Return True if module_name matches any skip pattern.FT)rfnmatch)r! module_namepatterns ris_skipped_moduleBdb.is_skipped_modules0  yyG{44!rcUR(a0URURRS55(agXRLa*UR S:XagUR UR :$UR(dgg)z>Return True if frame is below the starting frame in the stack.r Fr'T)rru f_globalsr)r[ref_linenor:s rrT Bdb.stop_heresg 99%%eoo&9&9*&EFF NN ""$>>T__4 4~~rcURURR5nX R;agURnX0RU;a)URR nX0RU;ag[ X#U5upEU(aNURUlU(a5UR(a$UR[UR55 gg)zReturn True if there is an effective breakpoint for this line. Check for line or function breakpoint and if in effect. Delete temporary breakpoints if effective() says to. FT) r/r\ co_filenamerryco_firstlineno effectivenumber currentbp temporarydo_clearstr)r!r;r.linenobpflags rrUBdb.break_heres << 8 89 ;; & X. .\\00F[[22x7  YYDN c"))n-rc[S5e)z\Remove temporary breakpoint. Must implement in derived classes or get NotImplementedError. z)subclass of bdb must implement do_clear())NotImplementedError)r!rQs rr Bdb.do_clears ""MNNrcfURURR5UR;$)zEReturn True if there is any breakpoint for frame's filename. )r/r\r|rr:s rrZBdb.break_anywheres&||ELL445DDrcg)z&Called if we might stop in a function.Nr )r!r; argument_lists rr_ Bdb.user_call! rcg)z'Called when we stop or break at a line.Nr r:s rrV Bdb.user_line%rrcg)z&Called when a return trap is set here.Nr )r!r; return_values rrdBdb.user_return)rrcg)z$Called when we stop on an exception.Nr )r!r;exc_infos rrkBdb.user_exception-rrcg)z.Called when we are about to execute an opcode.Nr r:s rroBdb.user_opcode1rrcXR:wa=XlURnUb'XlX RLagURnUbM&gggr9)rrf_trace_opcodesr4rY)r!rr;s r_set_trace_opcodesBdb._set_trace_opcodes5sL .. .!. OOE#(5%MM)  # /rcXXlX lSUlX0lUR U5 g)zSet the attributes for stopping. If stoplineno is greater than or equal to 0, then stop at line greater than or equal to the stopline. If stoplineno is -1, then don't stop at all. FN)r[rcrGrer)r!r[rcrerFs rr5Bdb._set_stopinfo?s+#& % 'rcURnU(a3UR(d!X RLaURUlggggr9)rYf_tracer4rL)r! current_frame caller_frames rrfBdb._set_caller_tracefuncNs< %++  4 4]]9Z#'#6#6L :[ 4^^a'F 50rc(URSS5 g)zStop after one line of code.Nr5r!s rset_step Bdb.set_stepcs 4&rc&URSSSS9 g)z!Stop before the next instruction.NT)rFrrs r set_stepinstrBdb.set_stepinstrgs 4d3rc(URUS5 g)z2Stop on the next line in or below the given frame.Nrr:s rset_next Bdb.set_nextks 5$'rcURR[-(aURUSS5 gURURU5 g)z)Stop when returning from the given frame.Nr')r\r]r^r5rYr:s r set_returnBdb.set_returnos; << #@ @   udB /   u||U 3rcUc[R"5RnUR5 UR U5 U(aXUR UlXlURUR4URU'SUlURnU(aMXUR5 SSS5 [R"UR 5 g!,(df  N/=f)z^Start debugging from frame. If frame is not specified, debugging starts from caller's frame. NT) sys _getframerYr6r<rLrr4 f_trace_linesrrrsettracer:s r set_trace Bdb.set_tracevs =MMO**E   ' $ 3 3 % 9>9L9LeNcNc8d..u5&*#  %    ( T(()( 'sAC$C C+cURURSS5 UR(d[R"S5 [R "5R nU(a3XRLa%U?UR nU(aXRLaM%URR5Hunup#X#sUl Ul M 0Ulgg)zpStop only at breakpoints or when finished. If there are no breakpoints, set the system trace function to None. Nr') r5r4rrrrrYrritemsrr)r!r; trace_linesrs r set_continueBdb.set_continues 4==$3{{ LL MMO**EE6M E68<7U7U7[7[7]33 =H:#U%:8^-/D *rcnURUlSUlSUl[R "S5 g)zeSet quitting attribute to True. Raises BdbQuit exception in the next call to a dispatch_*() method. NT)r4r[rcrGrrrs rset_quit Bdb.set_quits*   TrcjURRU/5nX#;aURU5 gg)z/Add breakpoint to breaks, if not already there.N)r setdefaultappend)r!r.r bp_linenoss r_add_to_breaksBdb._add_to_breakss1[[++Hb9  #   f % $rcDURU5nSSKnURX5nU(dSX4-$URX5 [ XX4U5nUR n U (a<UR U 5(aURU lU Rn U (aM<g)zSet a new breakpoint for filename:lineno. If lineno doesn't exist for the filename, return an error message. The filename should be in canonical form. rNzLine %s:%d does not exist) r/r2getlinerr rrZrLrrY) r!r.rrcondfuncnamer2r?rr;s r set_break Bdb.set_breaks<<)  2.(1CC C H- )8 D""5)) $ 3 3 LLEerct[RR5HupURX5 M g)a'Apply all breakpoints (set in other instances) to this one. Populates this instance's breaks list from the Breakpoint class's list, which can have breakpoints set by another Bdb instance. This is necessary for interactive sessions to keep the breakpoints active across multiple calls to run(). N)r bplistkeysrr!r.rs rr Bdb._load_breakss.#-"3"3"8"8": X    1#;rcX4[R;aURURU5 URU(dURU gg)zPrune breakpoints for filename:lineno. A list of breakpoints is maintained in the Bdb instance and in the Breakpoint class. If a breakpoint in the Bdb instance no longer exists in the Breakpoint class, then it's removed from the Bdb instance. N)r rrremovers r _prune_breaksBdb._prune_breakssI  Z%6%6 6 KK ! ( ( 0{{8$ H%%rcURU5nXR;aSU-$X RU;aSX4-$[RX4SSHnUR 5 M UR X5 g)z^Delete breakpoints for filename:lineno. If no breakpoints were set, return an error message. There are no breakpoints in %szThere is no breakpoint at %s:%dN)r/rr rdeleteMer)r!r.rrs r clear_breakBdb.clear_breaks} <<) ;; &3h> > X. .47II I##H$45a8B KKM9 8,rcURU5nUR5 UR UR UR 5 g![an[U5sSnA$SnAff=f)zhDelete a breakpoint by its index in Breakpoint.bpbynumber. If arg is invalid, return an error message. N)get_bpbynumber ValueErrorrrrfiler?)r!rQrerrs rclear_bpbynumberBdb.clear_bpbynumbersX  $$S)B  277BGG,  s8O sA A) A$A)$A)cURU5nXR;aSU-$URUH0n[RX4nUHnUR 5 M M2 URU g)zPDelete all breakpoints in filename. If none were set, return an error message. rN)r/rr rr)r!r.r?blistrs rclear_all_file_breaksBdb.clear_all_file_breakssp <<) ;; &3h> >KK)D%%hn5E * KK !rcUR(dg[RHnU(dM UR5 M 0Ulg)zMDelete all existing breakpoints. If none were set, return an error message. zThere are no breakpointsN)rr bpbynumberr)r!rs rclear_all_breaksBdb.clear_all_breakss8 {{-''Br ( rcU(d [S5e[U5n[RUnUc[SU-5eU$![a [SU-5Sef=f![a [SU-5Sef=f)zReturn a breakpoint by its index in Breakpoint.bybpnumber. For invalid arg values or if the breakpoint doesn't exist, raise a ValueError. zBreakpoint number expectedz Non-numeric breakpoint number %sNz!Breakpoint number %d out of rangezBreakpoint %d already deleted)rintr r IndexError)r!rQrrs rrBdb.get_bpbynumbers 9: : QXF U&&v.B : "m LL!**akk2 3 Am 9As5zA~&AxrcSSKnSSKnUupVURURR5nU<SU<S3nURR (aXRR - nOUS- nUS- nSUR ;a'UR Sn US- nXRU 5- nUb:URXvUR5n U (aXU R5-- nU$XS 3- nU$) aReturn a string with information about a stack entry. The stack entry frame_lineno is a (frame, lineno) tuple. The return string contains the canonical filename, the function name or '', the input arguments, the return value, and the line of code (if it exists). rN()zz() __return__z->zWarning: lineno is None) r2reprlibr/r\r|co_namef_localsrOrrxstrip) r! frame_linenolprefixr2rr;rr.srvr?s rformat_stack_entryBdb.format_stack_entryis "$ << 8 89 & ) <<   %% %A OA T  5>> ) -B IA b! !A  $$XuGDtzz|++ 934 4ArcUcSSKnURnUcUnUR5 [U[5(a [ USS5n[ R"UR5 [XU5 SUl [ R"S5 g![a N*f=f!SUl [ R"S5 f=f)ztDebug a statement executed via the exec() function. globals defaults to __main__.dict; locals defaults to globals. NrzexecT) __main____dict__r6 isinstancercompilerrrLrrrG)r!cmdglobalslocalsrs rrunBdb.runs ? ''G >F c3  #z62C T(()  v &!DM LL     !DM LL s$, B B# B&"B##B&&CcUcSSKnURnUcUnUR5 [R"UR 5 [ XU5SUl[R"S5 $![a Of=fSUl[R"S5 g!SUl[R"S5 f=f)zvDebug an expression executed via the eval() function. globals defaults to __main__.dict; locals defaults to globals. NrT) rrr6rrrLevalrGr)r!exprr"r#rs rruneval Bdb.runevals ? ''G >F  T(() v.!DM LL       DM LL !DM LL s$ A33 B=B"?BB""Cc(URXU5 g)z.For backwards-compatibility. Defers to run().N)r$)r!r!r"r#s rrunctx Bdb.runctxs v&rcUR5 [R"UR5 SnU"U0UD6nSUl[R"S5 U$![a N+f=f!SUl[R"S5 f=f)zGDebug a single function call. Return the result of the function call. NT)r6rrrLrrG)r!funcargskwdsress rruncall Bdb.runcalls|  T(() %%C!DM LL     !DM LL s#A A(%A+'A((A++B ) r4rrrrrrrGrcrr[rerr9)rFFNN)z: NN)9r rrrrr"r/r6rr<rLrHrIrJrKrMrurTrUrrZr_rVrdrkrorr5rfrrrrrrrrrrr rrrrrrrrrrr rr$r)r,r3rr rrrrs  "' -'^ ##,#6#6 # 6OE     % (71'4(4*&0$"& AE0 2 &"   (, 6 .D,('rrc4[5R5 g)zrrr rrclearBreakpointsBreakpoint.clearBreakpointss  !% rcURUR4nSURUR'URUR U5 URU(dURU gg)zDelete the breakpoint from the list associated to a file:line. If it is the last breakpoint in that position, it also deletes the entry for the file:line. N)rr?rrrr)r!indexs rrBreakpoint.deleteMes\DII&'+ $ E!!$'{{5! E""rcSUlg)zMark the breakpoint as enabled.TNr;rs renableBreakpoint.enables  rcSUlg)z Mark the breakpoint as disabled.FNrGrs rdisableBreakpoint.disables  rcZUc[Rn[UR5US9 g)z}Print the output of bpformat(). The optional out argument directs where the output is sent and defaults to standard output. N)r)rstdoutrNbpformat)r!outs rbpprintBreakpoint.bpprints" ;**C dmmoC(rcUR(aSnOSnUR(aUS-nOUS-nSURUURUR4-nUR (aUSUR <3- nUR (aUSUR 4-- nUR(a)URS:aS nOS nUS URU4-- nU$) zReturn a string with information about the breakpoint. The information includes the breakpoint number, temporary status, file:line position, break condition, number of times to ignore, and number of times hit. zdel zkeep zyes zno z%-4dbreakpoint %s at %s:%dz stop only if z ignore next %d hitsr&rz" breakpoint already hit %d time%s)rr;rrr?rr<r=)r!dispretsss rrOBreakpoint.bpformat(s >>DD <<'>D'>D, T04 4990FF 99 DII7 7C ;; , ~= =C 99yy1} 9TYYOK KC rcZSUR<SUR<SUR<3$)z1Return a condensed description of the breakpoint.z breakpoint z at :)rrr?rs r__str__Breakpoint.__str__Fs+/;; 499MMr) rr;rr:rr=r<r?rrr5r9)r rrrrr>rrr" staticmethodrArrHrKrQrOr[rr rrr r sR( D FJ-('' #)<Nrr c"UR(dURUR:waggURRUR:wagUR (dURUlUR UR:wagg)aBReturn True if break should happen here. Whether a break should happen depends on the way that b (the breakpoint) was set. If it was set via line number, check if b.line is the same as the one in the frame. If it was set via function name, check if this is the right function and if it is on the first executable line. FT)rr?ryr\rr:)br;s r checkfuncnamer`Msm :: 66U^^ # ||qzz) ' '',~~$##u~~5 rc[RX4nUHnUR(dM[XB5(dM(U=RS- slUR (d-UR S:aU=R S-slMuUS4s $[UR URUR5nU(a-UR S:aU=R S-slMUS4s $M g! US4ss $=f)aReturn (active breakpoint, delete temporary flag) or (None, None) as breakpoint to act upon. The "active breakpoint" is the first entry in bplist[line, file] (which must exist) that is enabled, for which checkfuncname is True, and that has neither a False condition nor a positive ignore count. The flag, meaning that a temporary breakpoint should be deleted, is False only when the condiion cannot be evaluated (in which case, ignore count is ignored). If no such entry exists, then (None, None) is returned. r&rTFr6) r rr;r`r=rr<r'rxr)rr?r; possiblesr_vals rr~r~ms!!$*-I yy Q&&  ! vvxx!|A 4y  "1665??ENNCxx!|A !"4y( +D   "5z!sAC7,C77Dc,\rSrSrSrSrSrSrSrg)TdbicZURRnU(dSn[SX25 g)N???z+++ call)r\rrN)r!r;r0names rr_ Tdb.user_calls"||##ET j$%rc .SSKnURRnU(dSnURURR5nUR XAR UR5n[SXAR USUR55 g)Nrrgz+++rZ) r2r\rr/r|rryrxrNr)r!r;r2rhfnr?s rrV Tdb.user_linesg||##ET \\%,,22 3  ^^U__E eRsDJJLArc[SU5 g)Nz +++ returnrN)r!r;retvals rrdTdb.user_returns  lF#rc<[SU5 UR5 g)Nz +++ exception)rNr)r!r; exc_stuffs rrkTdb.user_exceptions oy) rr N) r rrrr_rVrdrkrr rrreres&B$rrecR[SUS5 [US-5n[SU5 g)Nzfoo(r z bar returned)rNbar)nxs rfoorys% &!S AbD A .!rc&[SUS5 US- $)Nzbar(rrirn)as rrvrvs &!S Q3Jrc:[5nURS5 g)Nzimport bdb; bdb.foo(10))rer$)rs rtestr}s AEE #$r)rrrrr* contextlibrinspectrrr__all__r^ Exceptionrrrr r`r~reryrvr}r rrrs %BB * ,| ;>P P+i+y y x uNuNt@0j#$ %r