U if8}@sddlZddlZddlZddlmZmZmZdddgZeeBeBZGddde Z GdddZ dd Z Gd ddZ d d Zd dZGddde ZddZddZddZdS)N) CO_GENERATOR CO_COROUTINECO_ASYNC_GENERATORBdbQuitBdb Breakpointc@s eZdZdS)rN)__name__ __module__ __qualname__r r (/opt/alt/python38/lib64/python3.8/bdb.pyr sc@sreZdZdZddZddZddZdd Zd d Zd d ZddZ ddZ ddZ ddZ ddZ ddZddZddZddZd d!Zd"d#Zd[d%d&Zd\d'd(Zd)d*Zd+d,Zd-d.Zd]d/d0Zd1d2Zd3d4Zd^d6d7Zd8d9Zd:d;Zdd?Z d@dAZ!dBdCZ"dDdEZ#dFdGZ$dHdIZ%dJdKZ&dLdMZ'd_dOdPZ(d`dQdRZ)dadSdTZ*dUdVZ+dWdXZ,dYe,_-dS)brNcCs(|r t|nd|_i|_i|_d|_dSN)setskipbreaksfncacheframe_returning)selfrr r r __init__sz Bdb.__init__cCsR|d|dddkr|S|j|}|sNtj|}tj|}||j|<|S)N<>)rgetospathabspathnormcase)rfilenamecanonicr r r r%s    z Bdb.canoniccCs&ddl}|d|_|dddS)Nr) linecache checkcachebotframe _set_stopinfo)rr r r r reset6sz Bdb.resetcCs|jr dS|dkr||S|dkr0|||S|dkrD|||S|dkrX|||S|dkrf|jS|dkrt|jS|dkr|jStdt||jS) NlineZcallreturnZ exceptionZc_callZ c_exceptionZc_returnz*bdb.Bdb.dispatch: unknown debugging event:)quitting dispatch_line dispatch_calldispatch_returndispatch_exceptiontrace_dispatchprintrepr)rframeZeventargr r r r,=s$    zBdb.trace_dispatchcCs.||s||r(|||jr(t|jSr ) stop_here break_here user_liner'rr,rr/r r r r(hs  zBdb.dispatch_linecCsd|jdkr|j|_|jS||s0||s0dS|jrH|jjt@rH|jS| |||j r^t |jSr ) r"f_backr,r1break_anywhere stopframef_codeco_flagsGENERATOR_AND_COROUTINE_FLAGS user_callr'rrr/r0r r r r)ts  zBdb.dispatch_callcCs|||s||jkrv|jr,|jjt@r,|jSz||_|||W5d|_X|j rVt |j|krv|j dkrv| dd|jSNr) r1 returnframer7r8r9r:r,r user_returnr'r stoplinenor#r<r r r r*s zBdb.dispatch_returncCs||rF|jjt@r.|dtkr.|ddks||||jrtnD|jr||jk r|jjjt@r|dtt fkr||||jrt|j S)Nr) r1r8r9r: StopIterationuser_exceptionr'rr7 GeneratorExitr,r<r r r r+s$       zBdb.dispatch_exceptioncCs.|dkr dS|jD]}t||rdSqdSNFT)rfnmatch)rZ module_namepatternr r r is_skipped_modules   zBdb.is_skipped_modulecCsN|jr||jdrdS||jkr@|jdkr4dS|j|jkS|jsJdSdS)NrFrT)rrH f_globalsrr7r@f_linenor4r r r r1s   z Bdb.stop_herecCs||jj}||jkrdS|j}||j|krJ|jj}||j|krJdSt|||\}}|r|j|_|r|j r| t |jdSdSdSrE) rr8 co_filenamerrJco_firstlineno effectivenumberZ currentbp temporarydo_clearstr)rr/rlinenobpflagr r r r2s  zBdb.break_herecCs tddS)Nz)subclass of bdb must implement do_clear())NotImplementedError)rr0r r r rPsz Bdb.do_clearcCs||jj|jkSr )rr8rKrr4r r r r6szBdb.break_anywherecCsdSr r )rr/Z argument_listr r r r;sz Bdb.user_callcCsdSr r r4r r r r3sz Bdb.user_linecCsdSr r )rr/Z return_valuer r r r? szBdb.user_returncCsdSr r )rr/exc_infor r r rC szBdb.user_exceptionrcCs||_||_d|_||_dSNF)r7r>r'r@)rr7r>r@r r r r#szBdb._set_stopinfocCs$|dkr|jd}||||dS)Nr)rJr#)rr/rRr r r set_until"s z Bdb.set_untilcCs0|jr |jj}|r |js |j|_|dddSr )rr5f_tracer,r#)rZ caller_framer r r set_step*s  z Bdb.set_stepcCs||ddSr )r#r4r r r set_next6sz Bdb.set_nextcCs.|jjt@r||ddn||j|dSr=)r8r9r:r#r5r4r r r set_return:s zBdb.set_returncCsL|dkrtj}||r4|j|_||_|j}q|t|jdSr ) sys _getframer5r$r,rYr"rZsettracer4r r r set_traceAs z Bdb.set_tracecCsH||jdd|jsDtdtj}|rD||jk rD|`|j}q*dSr=)r#r"rr]r_r^r5rYr4r r r set_continuePs  zBdb.set_continuecCs"|j|_d|_d|_tddSNT)r"r7r>r'r]r_rr r r set_quit_sz Bdb.set_quitFc Csb||}ddl}|||}|s.d||fS|j|g}||krN||t|||||} dS)NrzLine %s:%d does not exist)rr getliner setdefaultappendr) rrrRrOcondfuncnamer r%listrSr r r set_breakps    z Bdb.set_breakcCs4||ftjkr|j|||j|s0|j|=dSr )rbplistrremoverrrRr r r _prune_breakss zBdb._prune_breakscCsj||}||jkrd|S||j|kr6d||fStj||fddD] }|qL|||dS)NThere are no breakpoints in %szThere is no breakpoint at %s:%d)rrrrldeleteMero)rrrRrSr r r clear_breaks     zBdb.clear_breakc CsZz||}Wn.tk r<}zt|WYSd}~XYnX|||j|jdSr )get_bpbynumber ValueErrorrQrqrofiler%)rr0rSerrr r r clear_bpbynumberszBdb.clear_bpbynumbercCsX||}||jkrd|S|j|D]$}tj||f}|D] }|qz()Z __return__z->) r reprlibrr8rKco_namef_localsr.rerIstrip) rZ frame_linenoZlprefixr rr/rRrsrvr%r r r format_stack_entrys    zBdb.format_stack_entryc Cs|dkrddl}|j}|dkr"|}|t|tr@t|dd}t|jz*zt |||Wnt k rrYnXW5d|_ tdXdS)NrzexecT) __main____dict__r$ isinstancerQcompiler]r_r,r'rr)rcmdglobalslocalsrr r r run5s    zBdb.runc Csz|dkrddl}|j}|dkr"|}|t|jz,zt|||WWStk r^YnXW5d|_tdXdS)NrT) rrr$r]r_r,r'evalr)rexprrrrr r r runevalKs  z Bdb.runevalcCs||||dSr )r)rrrrr r r runctx_sz Bdb.runctxc Ost|dkr|^}}}nV|s&tdnHd|krZ|d}|^}}ddl}|jdtddntdt|d|t|j d}z(z|||}Wnt k rYnXW5d |_ tdX|S) NrAz6descriptor 'runcall' of 'Bdb' object needs an argumentfuncrz0Passing 'func' as keyword argument is deprecated) stacklevelz7runcall expected at least 1 positional argument, got %drT) r TypeErrorpopwarningswarnDeprecationWarningr$r]r_r,r'r)argskwdsrrrresr r r runcallfs2        z Bdb.runcallz($self, func, /, *args, **kwds))N)r)N)N)FNN)r)NN)NN).rr r rrr$r,r(r)r*r+rHr1r2rPr6r;r3r?rCr#rXrZr[r\r`rardrkrorrrwrxrzrsr~rrrrrrrrr__text_signature__r r r r rsZ +               cCstdSr )rr`r r r r r`sr`c@sVeZdZdZiZdgZdddZddZdd Zd d Z dd d Z ddZ ddZ dS)rrNFcCs||_d|_||_||_||_||_d|_d|_d|_t j |_ t j d7_ |j |||f|jkr||j||f |n|g|j||f<dS)NTrr)rifunc_first_executable_linerur%rOrhenabledignorehitsrnextrNryrgrl)rrur%rOrhrir r r rs zBreakpoint.__init__cCs>|j|jf}d|j|j<|j|||j|s:|j|=dSr )rur%ryrNrlrm)rindexr r r rqs    zBreakpoint.deleteMecCs d|_dSrbrrcr r r enableszBreakpoint.enablecCs d|_dSrWrrcr r r disableszBreakpoint.disablecCs"|dkrtj}t||ddS)N)ru)r]stdoutr-bpformat)routr r r bpprintszBreakpoint.bpprintcCs|jr d}nd}|jr |d}n|d}d|j||j|jf}|jrT|d|jf7}|jrj|d|jf7}|jr|jdkrd }nd }|d |j|f7}|S) Nzdel zkeep zyes zno z%-4dbreakpoint %s at %s:%dz stop only if %sz ignore next %d hitsrrz" breakpoint already hit %d time%s)rOrrNrur%rhrr)rZdispZretZssr r r rs(  zBreakpoint.bpformatcCsd|j|j|jfS)Nzbreakpoint %s at %s:%s)rNrur%rcr r r __str__szBreakpoint.__str__)FNN)N) rr r rrlryrrqrrrrrr r r r rs  cCsN|js|j|jkrdSdS|jj|jkr,dS|js:|j|_|j|jkrJdSdSrE)rir%rJr8rr)br/r r r checkfuncnames  rcCstj||f}|D]}|jsqt||s*q|jd7_|jsh|jdkrZ|jd8_qq|dfSqzBt|j|j|j }|r|jdkr|jd8_n|dfWSWq|dfYSXqdS)NrrTF)NN) rrlrrrrhrrrIr)rur%r/Z possiblesrvalr r r rM#s*   rMc@s,eZdZddZddZddZddZd S) TdbcCs |jj}|sd}td||dS)N???z+++ call)r8rr-)rr/rnamer r r r;Tsz Tdb.user_callcCsTddl}|jj}|sd}||jj}|||j|j}td||j|d| dS)Nrrz+++:) r r8rrrKrerJrIr-r)rr/r rfnr%r r r r3Xsz Tdb.user_linecCstd|dS)Nz +++ returnr-)rr/Zretvalr r r r?_szTdb.user_returncCstd||dS)Nz +++ exception)r-ra)rr/Z exc_stuffr r r rCas zTdb.user_exceptionN)rr r r;r3r?rCr r r r rSsrcCs&td|dt|d}td|dS)Nzfoo() z bar returned)r-bar)nxr r r fooes  rcCstd|d|dS)Nzbar(rrAr)ar r r rjs rcCst}|ddS)Nzimport bdb; bdb.foo(10))rr)rr r r testnsr)rFr]rinspectrrr__all__r: Exceptionrrr`rrrMrrrrr r r r s&  {t"0