python (3.11.7)

(root)/
lib/
python3.11/
idlelib/
__pycache__/
debugger_r.cpython-311.pyc

e/ZdZddlZddlZddlmZdZdadZiZiZ	iZ
iZdZdZ
Gdd	ZGd
dZdZGd
dZGddZGddZGddZGddZdZdZdZdZedkrddlmZeddd dSdS)!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_adapterc8t|}|t|<|SN)id
frametable)framefids  F/BuggyBox/python/3.11.7/bootstrap/lib/python3.11/idlelib/debugger_r.py
wrap_framer
(s
U))CJsOJc|dS|d}t|tjsJt|}|t|<|d|d|f}|S)z0replace info[2], a traceback instance, by its IDNr)
isinstancetypes
TracebackTypertracebacktable)info	tracebacktraceback_id
modified_infos    r	wrap_infor-s]|tG	)U%899999)}}'0|$a$q'<8
rceZdZdZddZdS)GUIProxyc"||_||_dSr)connoid)selfrgui_adap_oids   r__init__zGUIProxy.__init__;s	rNc	|j|jd|t|t	|fidS)Ninteraction)r
remotecallrr
r)r messager
rs    rr$zGUIProxy.interaction?sI	
	TX}%z%'8'8)D//J	!	!	!	!	!rr__name__
__module____qualname__r"r$rrrr9s7   !!!!!!rrceZdZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZ
dZd
ZdZdZdZdZdZdZdZdS)
IdbAdapterc||_dSr)idb)r r/s  rr"zIdbAdapter.__init__Hs
rc8|jdSr)r/set_stepr s rr1zIdbAdapter.set_stepMrc8|jdSr)r/set_quitr2s rr5zIdbAdapter.set_quitPr3rc8|jdSr)r/set_continuer2s rr7zIdbAdapter.set_continueSsrcTt|}|j|dSr)r	r/set_nextr rr
s   rr9zIdbAdapter.set_nextVs'3%     rcTt|}|j|dSr)r	r/
set_returnr:s   rr<zIdbAdapter.set_returnZs'3E"""""rct|}|d}n
t|}|j||\}}d|D}||fS)Nc6g|]\}}t||fSr+)r
).0frame2ks   r
<listcomp>z(IdbAdapter.get_stack.<locals>.<listcomp>es)@@@YVQ*V$$a(@@@r)r	rr/	get_stack)r rtbidr
tbstackis       rrCzIdbAdapter.get_stack^sX3<BB%B8%%eR00q@@%@@@axrcNddl}|j||jdS)Nr)__main__r/run__dict__)r cmdrIs   rrJzIdbAdapter.runhs*S(+,,,,,rc<|j||}|Sr)r/	set_breakr filenamelinenomsgs    rrNzIdbAdapter.set_breaklsh  622
rc<|j||}|Sr)r/clear_breakrOs    rrTzIdbAdapter.clear_breakpsh""8V44
rc:|j|}|Sr)r/clear_all_file_breaksr rPrRs   rrVz IdbAdapter.clear_all_file_breakstsh,,X66
rc<t|}t||Sr)r	getattr)r rnamer
s    r
frame_attrzIdbAdapter.frame_attrzs3ud###rc`t|}|j}t|}|t|<|Sr)r		f_globalsr	dicttabler rr
dictdids     r
frame_globalszIdbAdapter.frame_globals~s+3hh	#
rc`t|}|j}t|}|t|<|Sr)r	f_localsrr^r_s     rframe_localszIdbAdapter.frame_localss+3~hh	#
rc`t|}|j}t|}|t|<|Sr)r	f_coder	codetable)r rr
codecids     r
frame_codezIdbAdapter.frame_codes+3|hh	#
rc*t|}|jSr)rhco_namer rjris   r	code_namezIdbAdapter.code_names~|rc*t|}|jSr)rhco_filenamerns   r
code_filenamezIdbAdapter.code_filenames~rc td)Nz"dict_keys not public or pickleable)NotImplementedErrorr ras  r	dict_keyszIdbAdapter.dict_keyss!"FGGGrc^t|}t|Sr)r^listkeys)r rar`s   rdict_keys_listzIdbAdapter.dict_keys_lists!~DIIKK   rcXt|}||}tj|}|Sr)r^reprlibrepr)r rakeyr`values     r	dict_itemzIdbAdapter.dict_items(~S	U##rN)r(r)r*r"r1r5r7r9r<rCrJrNrTrVr[rbrerkrorrrvrzrr+rrr-r-FsC
   !!!###---$$$   HHH!!!rr-ct||}tj|}t|}|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_debuggerrsI\22I
,y
!
!C#Hh///rc2eZdZdZdZdZdZdZdZdS)
FrameProxyc>||_||_d|_i|_dS)Nr)_conn_fid_oid
_dictcache)r rrs   rr"zFrameProxy.__init__s"
	!	rc*|dddkrt||dkr|S|dkr|S|dkr|S|j|jd|j|fiS)Nr_rgr]rdr[)AttributeError_get_f_code_get_f_globals
_get_f_localsrr%rrr rZs  r__getattr__zFrameProxy.__getattr__s8s?? &&&8##%%%;&&(((:%%'''z$$TY&*i%6<<	<rc|j|jd|jfi}t	|j|j|S)Nrk)rr%rr	CodeProxy)r rjs  rrzFrameProxy._get_f_codes9j##DI|di\2NNTY444rc||j|jd|jfi}||S)Nrbrr%rr_get_dict_proxyrus  rrzFrameProxy._get_f_globalss<j##DI%)YL"66##C(((rc||j|jd|jfi}||S)Nrerrus  rrzFrameProxy._get_f_localss<j##DI~%)YL"66##C(((rc|||jvr
|j|St|j|j|}||j|<|Sr)r	DictProxyrr)r radps   rrzFrameProxy._get_dict_proxysB$/!!?3''
tz49c
2
2!	rN)	r(r)r*r"rrrrrr+rrrrsn
<
<
<555)))
)))
rrceZdZdZdZdS)rc0||_||_||_dSr)rr_cid)r rrrjs    rr"zCodeProxy.__init__
				rc|dkr(|j|jd|jfiS|dkr(|j|jd|jfiSdS)Nrmrorqrr)rr%rrrs  rrzCodeProxy.__getattr__sr9:((K*.)r;;
;=  :((O*.)r;;
;! rN)r(r)r*r"rr+rrrrs2
;;;;;rrc&eZdZdZdZdZdZdS)rc0||_||_||_dSr)rr_did)r rrras    rr"zDictProxy.__init__rrcR|j|jd|jfiS)Nrzrr%rrr2s rryzDictProxy.keyss.z$$TY%5	|RII	IrcT|j|jd|j|fiS)Nrr)r r~s  r__getitem__zDictProxy.__getitem__s.z$$TY&*i%5r;;	;rc t|r)rrs  rrzDictProxy.__getattr__sT"""rN)r(r)r*r"ryrrr+rrrrsSIII;;;#####rrceZdZdZdZdS)
GUIAdapterc"||_||_dSr)rgui)r rrs   rr"zGUIAdapter.__init__s	rcht|j|}|j|||dSr)rrrr$)r r&rrr
s     rr$zGUIAdapter.interaction!s349c**We];;;;;rNr'r+rrrrs2<<<<<rrcVeZdZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZ
dZd
S)IdbProxyc0||_||_||_dSr)rrshell)r rrrs    rr"zIdbProxy.__init__)s	


rcJ|j|j|||}|Sr)rr%r)r 
methodnameargskwargsrs     rcallz
IdbProxy.call.s$	$$TXz4HHrcn|j|jd|fi}||jj_dS)NrJ)r
asyncqueuerrinterp
active_seq)r rLlocalsseqs    rrJzIdbProxy.run4s4i""48USFB??'*
$$$rcfd|j|\}}fd|D}||fS)NrCcDg|]\}}tj||fSr+)rr)r?rrAr s   rrBz&IdbProxy.get_stack.<locals>.<listcomp><s.EEEVS!*TY,,a0EEErrr)r r
rDrFrGs`    rrCzIdbProxy.get_stack9s@99[%*d;;qEEEEuEEEaxrc0|ddS)Nr7rr2s rr7zIdbProxy.set_continue?s		.!!!!!rc0|ddS)Nr1rr2s rr1zIdbProxy.set_stepB		*rc<|d|jdS)Nr9rr r
s  rr9zIdbProxy.set_nextEs		*ej)))))rc<|d|jdS)Nr<rrs  rr<zIdbProxy.set_returnHs		,
+++++rc0|ddS)Nr5rr2s rr5zIdbProxy.set_quitKrrc4|d||}|S)NrNrrOs    rrNzIdbProxy.set_breakNsiiXv66
rc4|d||}|S)NrTrrOs    rrTzIdbProxy.clear_breakRsii
x88
rc2|d|}|S)NrVrrWs   rrVzIdbProxy.clear_all_file_breaksVsii/::
rN)r(r)r*r"rrJrCr7r1r9r<r5rNrTrVr+rrrr's
+++
"""***,,,rrc|ddtfiat||t}t	j||}t
||}|t||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%r!rrrDebuggerrr)rpccltpyshell	idb_proxyrgui_adaps     rstart_remote_debuggerrZsp $$V-A$0?B88L,77I

GY
/
/C&#&&H
OOL(+++JrcXt||tdS)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
unregisterr!rs rclose_remote_debuggerrrs,f%%%
l#####rcB|ddtfidS)Nrstop_the_debugger)r%rrs rrr~s%
f1L?BGGGGGrcl|ddtfi}|tks
JddS)Nrrz Idb restarted with different oid)r%r!r)ridb_adap_oid_rets  rrestart_subprocess_debuggerrsD((1E*6">>|+++-O+++++rrI)mainz!idlelib.idle_test.test_debugger_rrF)	verbosityexit)__doc__r|ridlelibr	debuggingrr!r	r^rhrr
rrr-rrrrrrrrrrr(unittestrr+rr<module>rs1*
	
		



!!!!!!!!hhhhhhhhZ,''''''''T
;
;
;
;
;
;
;
; ########0	<	<	<	<	<	<	<	<11111111f0
$
$
$HHHPPPzD	,FFFFFFr