python (3.12.0)

(root)/
lib/
python3.12/
idlelib/
__pycache__/
debugger_r.cpython-312.opt-1.pyc

̑e/$dZddlZddlZddlmZdZdadZiZiZ	iZ
iZdZdZ
Gdd	ZGd
dZdZGd
dZGddZGddZGddZGddZdZdZdZdZedk(rddlmZeddd yy)!aSupport for remote Python debugging.

Some ASCII art to describe the structure:

       IN PYTHON SUBPROCESS          #             IN IDLE PROCESS
                                     #
                                     #        oid='gui_adapter'
                 +----------+        #       +------------+          +-----+
                 | GUIProxy |--remote#call-->| GUIAdapter |--calls-->| GUI |
+-----+--calls-->+----------+        #       +------------+          +-----+
| Idb |                               #                             /
+-----+<-calls--+------------+         #      +----------+<--calls-/
                | IdbAdapter |<--remote#call--| IdbProxy |
                +------------+         #      +----------+
                oid='idb_adapter'      #

The purpose of the Proxy and Adapter classes is to translate certain
arguments and return values that cannot be transported through the RPC
barrier, in particular frame and traceback objects.

N)debuggeridb_adaptergui_adapterc.t|}|t|<|SN)id
frametable)framefids  F/BuggyBox/python/3.12.0/bootstrap/lib/python3.12/idlelib/debugger_r.py
wrap_framer
(s
U)CJsOJcT|y|d}t|}|t|<|d|d|f}|S)z0replace info[2], a traceback instance, by its IDNr)rtracebacktable)info	tracebacktraceback_id
modified_infos    r	wrap_infor-s@|G	)}'0|$a$q'<8
rceZdZdZddZy)GUIProxyc ||_||_yr)connoid)selfrgui_adap_oids   r__init__zGUIProxy.__init__;s	rNc	~|jj|jd|t|t	|fiy)Ninteraction)r
remotecallrr
r)rmessager
rs    rr!zGUIProxy.interaction?s4	
		TXX}%z%'8)D/J	!rr__name__
__module____qualname__rr!rrrr9s !rrceZdZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZ
dZd
ZdZdZdZdZdZdZdZy)
IdbAdapterc||_yr)idb)rr,s  rrzIdbAdapter.__init__Hs	rc8|jjyr)r,set_steprs rr.zIdbAdapter.set_stepMrc8|jjyr)r,set_quitr/s rr2zIdbAdapter.set_quitPr0rc8|jjyr)r,set_continuer/s rr4zIdbAdapter.set_continueSsrcLt|}|jj|yr)r	r,set_nextrrr
s   rr6zIdbAdapter.set_nextVs3% rcLt|}|jj|yr)r	r,
set_returnr7s   rr9zIdbAdapter.set_returnZs3E"rct|}|d}n	t|}|jj||\}}|Dcgc]\}}t	||f}}}||fScc}}wr)r	rr,	get_stackr
)	rrtbidr
tbstackiframe2ks	         rr;zIdbAdapter.get_stack^si3<B%B88%%eR0q:?@YVQ*V$a(@@axAsAcXddl}|jj||jy)Nr)__main__r,run__dict__)rcmdrCs   rrDzIdbAdapter.runhsS(++,rc>|jj||}|Sr)r,	set_breakrfilenamelinenomsgs    rrHzIdbAdapter.set_breaklshh  62
rc>|jj||}|Sr)r,clear_breakrIs    rrNzIdbAdapter.clear_breakpshh""8V4
rc<|jj|}|Sr)r,clear_all_file_breaksrrJrLs   rrPz IdbAdapter.clear_all_file_breakstshh,,X6
rc,t|}t||Sr)r	getattr)rrnamer
s    r
frame_attrzIdbAdapter.frame_attrzs3ud##rcXt|}|j}t|}|t|<|Sr)r		f_globalsr	dicttablerrr
dictdids     r
frame_globalszIdbAdapter.frame_globals~s+3h	#
rcXt|}|j}t|}|t|<|Sr)r	f_localsrrXrYs     rframe_localszIdbAdapter.frame_localss+3~~h	#
rcXt|}|j}t|}|t|<|Sr)r	f_coder	codetable)rrr
codecids     r
frame_codezIdbAdapter.frame_codes+3||h	#
rc,t|}|jSr)rbco_namerrdrcs   r	code_namezIdbAdapter.code_names~||rc,t|}|jSr)rbco_filenamerhs   r
code_filenamezIdbAdapter.code_filenames~rctd)Nz"dict_keys not public or pickleable)NotImplementedErrorrr[s  r	dict_keyszIdbAdapter.dict_keyss!"FGGrcFt|}t|jSr)rXlistkeys)rr[rZs   rdict_keys_listzIdbAdapter.dict_keys_lists~DIIK  rcLt|}||}tj|}|Sr)rXreprlibrepr)rr[keyrZvalues     r	dict_itemzIdbAdapter.dict_items'~S	U#rN)r%r&r'rr.r2r4r6r9r;rDrHrNrPrUr\r_rerirlrprtrzr(rrr*r*Fsg
 !#-$ H!rr*ct||}tj|}t|}|j	t
|t
S)a|Start the debugger and its RPC link in the Python subprocess

    Start the subprocess side of the split debugger and set up that side of the
    RPC link by instantiating the GUIProxy, Idb debugger, and IdbAdapter
    objects and linking them together.  Register the IdbAdapter with the
    RPCServer to handle RPC requests from the split debugger GUI via the
    IdbProxy.

    )rrIdbr*registeridb_adap_oid)
rpchandlerr	gui_proxyr,idb_adaps     rstart_debuggerrs=\2I
,,y
!C#Hh/rc0eZdZdZdZdZdZdZdZy)
FrameProxyc<||_||_d|_i|_y)Nr)_conn_fid_oid
_dictcache)rrrs   rrzFrameProxy.__init__s
	!	rc|dddk(rt||dk(r|jS|dk(r|jS|dk(r|jS|jj|jd|j|fiS)Nr_rarWr^rU)AttributeError_get_f_code_get_f_globals
_get_f_localsrr"rrrrTs  r__getattr__zFrameProxy.__getattr__s8s? &&8##%%;&&((:%%''zz$$TYY&*ii%6<	<rc|jj|jd|jfi}t	|j|j|S)Nre)rr"rr	CodeProxy)rrds  rrzFrameProxy._get_f_codes=jj##DII|dii\2NTYY44rc|jj|jd|jfi}|j	|S)Nr\rr"rr_get_dict_proxyros  rrzFrameProxy._get_f_globalss:jj##DII%)YYL"6##C((rc|jj|jd|jfi}|j	|S)Nr_rros  rrzFrameProxy._get_f_localss:jj##DII~%)YYL"6##C((rc||jvr|j|St|j|j|}||j|<|Sr)r	DictProxyrr)rr[dps   rrzFrameProxy._get_dict_proxysF$//!??3''
tzz499c
2!	rN)	r%r&r'rrrrrrr(rrrrs 
<5)
)
rrceZdZdZdZy)rc.||_||_||_yr)rr_cid)rrrrds    rrzCodeProxy.__init__
		rc|dk(r3|jj|jd|jfiS|dk(r3|jj|jd|jfiSy)Nrgrirkrl)rr"rrrs  rrzCodeProxy.__getattr__sk9::((K*.))r;
;= ::((O*.))r;
;!rN)r%r&r'rrr(rrrrs
;rrc$eZdZdZdZdZdZy)rc.||_||_||_yr)rr_did)rrrr[s    rrzDictProxy.__init__rrch|jj|jd|jfiS)Nrtrr"rrr/s rrszDictProxy.keyss.zz$$TYY%5		|RI	Ircj|jj|jd|j|fiS)Nrzr)rrxs  r__getitem__zDictProxy.__getitem__s/zz$$TYY&*ii%5r;	;rct|r)rrs  rrzDictProxy.__getattr__s
T""rN)r%r&r'rrsrrr(rrrrsI;#rrceZdZdZdZy)
GUIAdapterc ||_||_yr)rgui)rrrs   rrzGUIAdapter.__init__s	rcjt|j|}|jj|||yr)rrrr!)rr#rrr
s     rr!zGUIAdapter.interaction!s(499c*We];rNr$r(rrrrs<rrcTeZdZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZ
dZy
)IdbProxyc.||_||_||_yr)rrshell)rrrrs    rrzIdbProxy.__init__)s	
rcV|jj|j|||}|Sr)rr"r)r
methodnameargskwargsrys     rcallz
IdbProxy.call.s%		$$TXXz4Hrc|jj|jd|fi}||jj_y)NrD)r
asyncqueuerrinterp
active_seq)rrFlocalsseqs    rrDzIdbProxy.run4s4ii""488USFB?'*

$rc|jd|j|\}}|Dcgc]\}}t|j||f}}}||fScc}}w)Nr;)rrrr)rr
r<r>r?rrAs       rr;zIdbProxy.get_stack9sR99[%**d;q?DEVS!*TYY,a0EEaxFs"Ac&|jdy)Nr4rr/s rr4zIdbProxy.set_continue?s		.!rc&|jdy)Nr.rr/s rr.zIdbProxy.set_stepB		*rc<|jd|jy)Nr6rrrr
s  rr6zIdbProxy.set_nextEs		*ejj)rc<|jd|jy)Nr9rrs  rr9zIdbProxy.set_returnHs		,

+rc&|jdy)Nr2rr/s rr2zIdbProxy.set_quitKrrc,|jd||}|S)NrHrrIs    rrHzIdbProxy.set_breakNsiiXv6
rc,|jd||}|S)NrNrrIs    rrNzIdbProxy.clear_breakRsii
x8
rc*|jd|}|S)NrPrrQs   rrPzIdbProxy.clear_all_file_breaksVsii/:
rN)r%r&r'rrrDr;r4r.r6r9r2rHrNrPr(rrrr's>
+
"*,rrc|jddtfiat||t}t	j
||}t
||}|jt||S)a]Start the subprocess debugger, initialize the debugger GUI and RPC link

    Request the RPCServer start the Python subprocess debugger and link.  Set
    up the Idle side of the split debugger by instantiating the IdbProxy,
    debugger GUI, and debugger GUIAdapter objects and linking them together.

    Register the GUIAdapter with the RPCClient to handle debugger GUI
    interaction requests coming from the subprocess debugger via the GUIProxy.

    The IdbAdapter will pass execution and environment requests coming from the
    Idle debugger GUI to the subprocess debugger via the IdbProxy.

    execstart_the_debugger)r"rr~rrDebuggerrr})rpccltpyshell	idb_proxyrgui_adaps     rstart_remote_debuggerrZs_ $$V-A$0?B8L,7I


GY
/C&#&H
OOL(+JrcDt||jty)a]Shut down subprocess debugger and Idle side of debugger RPC link

    Request that the RPCServer shut down the subprocess debugger and link.
    Unregister the GUIAdapter, which will cause a GC on the Idle process
    debugger and RPC link objects.  (The second reference to the debugger GUI
    is deleted in pyshell.close_remote_debugger().)

    N)close_subprocess_debugger
unregisterrrs rclose_remote_debuggerrrsf%
l#rc6|jddtfiy)Nrstop_the_debugger)r"r~rs rrr~s
f1L?BGrc6|jddtfi}y)Nrr)r"r)ridb_adap_oid_rets  rrestart_subprocess_debuggerrs((1E*6">rrC)mainz!idlelib.idle_test.test_debugger_rrF)	verbosityexit)__doc__rvtypesidlelibr	debuggingr~rr	rXrbrr
rrr*rrrrrrrrrrr%unittestrr(rr<module>rs*
	
		

!!hhZ,''T
;
; ##0	<	<11f0
$HPz	,Fr