+
    Ni`                         R t ^ RIt^ RIt^ RIt^ RIHtHtHtHt ^ RI	H
t
Ht ^ RIHt R.t. ROt]P                   ! ]4      t ! R R4      tR# )zThis module defines the `GdbController` class
which runs gdb as a subprocess and can write to it and read from it to get
structured output.
N)DictListOptionalUnion)DEFAULT_GDB_TIMEOUT_SEC/DEFAULT_TIME_TO_CHECK_FOR_ADDITIONAL_OUTPUT_SEC)	IoManagerGdbControllerc                      a  ] tR t^t o R]3V 3R lR lltV 3R lR lt]R3V 3R lR llt]RR3V 3R	 lR
 llt	V 3R lR lt
RtV tR# )r	   Nc                J   < V ^8  d   QhRS[ S[S[,          ,          RS[RR/# )   command'time_to_check_for_additional_output_secreturnN)r   r   strfloat)format__classdict__s   "</tmp/pip-target-e6j6ikcs/lib/python/pygdbmi/gdbcontroller.py__annotate__GdbController.__annotate__   s2     /( /($s)$/( 27/( 
	/(    c                   Vf   \         p\        V Uu. uF  pRV9   NK
  	  up4      '       g   \        P                  R4       RV n        Wn        VV n        RV n        V P                  ^ 8  V n        V^ ,          pV'       g   \        R4      h\        P                  ! V4      pVf   \        RV,          4      hWPn        V P                  4        R# u upi )a  
Run gdb as a subprocess. Send commands and receive structured output.
Create new object, along with a gdb subprocess

Args:
    command: Command to run in shell to spawn new gdb subprocess
    time_to_check_for_additional_output_sec: When parsing responses, wait this amout of time before exiting (exits before timeout is reached to save time). If <= 0, full timeout time is used.
Returns:
    New GdbController object
Nz--interpreter=miz%a valid path to gdb must be specifiedz.gdb executable could not be resolved from "%s"zAdding `--interpreter=mi3` (or similar) is recommended to get structured output. See https://sourceware.org/gdb/onlinedocs/gdb/Mode-Options.html#Mode-Options.)DEFAULT_GDB_LAUNCH_COMMANDanyloggerwarningabs_gdb_pathr   r   gdb_process_allow_overwrite_timeout_times
ValueErrorshutilwhichspawn_new_gdb_subprocess)selfr   r   cgdb_pathr   s   &&&   r   __init__GdbController.__init__   s      ?0Gw?w!'1,w?@@NNb !")3 	4 8<881< 	+ 1:DEE "<<1L# DxO 
 %1!%%'9 @s   Cc                    < V ^8  d   QhRS[ /# )r   r   )int)r   r   s   "r   r   r   K   s      $  $#  $r   c           	        V P                   '       dA   \        P                  RV P                   P                  ,          4       V P	                  4        \        P                  RRP                  V P                  4       24       \        P                  ! V P                  R\        P                  \        P                  \        P                  ^ R7      V n         V P                   P                  f   Q hV P                   P                  f   Q h\        V P                   P                  V P                   P                  V P                   P                  V P                  4      V n        V P                   P                  # )zSpawn a new gdb subprocess with the arguments supplied to the object
during initialization. If gdb subprocess already exists, terminate it before
spanwing a new one.
Return int: gdb process id
z'Killing current gdb subprocess (pid %d)zLaunching gdb:  F)shellstdoutstdinstderrbufsize)r   r   debugpidexitjoinr   
subprocessPopenPIPEr/   r.   r   r0   r   
io_managerr$   s   &r   r#   &GdbController.spawn_new_gdb_subprocessK   s    LL9D<L<L<P<PP IIKsxx'=&>?@ &++LL??//??
 %%111&&222#""####88	
 ###r   Tc                <   < V ^8  d   QhRS[ RS[RS[S[,          /# )r   timeout_secraise_error_on_timeoutr   )r   boolr   r   )r   r   s   "r   r   r   m   s2     U UU !%U 
d	Ur   c                8    V P                   P                  W4      # )z>Get gdb response. See IoManager.get_gdb_response() for details)r9   get_gdb_response)r$   r=   r>   s   &&&r   rA   GdbController.get_gdb_responsem   s     //TTr   c                n   < V ^8  d   QhRS[ S[S[S[,          3,          RS[RS[RS[RS[S[,          /# )r   mi_cmd_to_writer=   r>   read_responser   )r   r   r   r   r?   r   )r   r   s   "r   r   r   u   sN     

 

sDI~.

 

 !%	


 

 
d

r   c                :    V P                   P                  WW44      # )z7Write command to gdb. See IoManager.write() for details)r9   write)r$   rD   r=   r>   rE   s   &&&&&r   rG   GdbController.writeu   s!     $$*@
 	
r   c                   < V ^8  d   QhRR/# )r   r   N )r   r   s   "r   r   r      s      d r   c                    V P                   '       dO   V P                   P                  4        V P                   P                  4        V P                   P                  4        RV n         R# )zTerminate gdb processN)r   	terminatewaitcommunicater:   s   &r   r4   GdbController.exit   sO    &&(!!#((*r   )r   r   r   r   r9   r   )__name__
__module____qualname____firstlineno__r   r'   r#   r   rA   rG   r4   __static_attributes____classdictcell__)r   s   @r   r	   r	      sV      (,9h/( /(b $  $H 5'+U U 5'+"

 

 r   )gdbz--nxz--quietz--interpreter=mi3)__doc__loggingr!   r6   typingr   r   r   r   pygdbmi.constantsr   r   pygdbmi.IoManagerr   __all__r   	getLoggerrP   r   r	   rJ   r   r   <module>r^      sT   
    . . ( 
 M 			8	$o or   