Current File : //proc/self/root/kunden/usr/share/gdb/python/gdb/dap/__pycache__/startup.cpython-39.opt-1.pyc
a

ɱZhQ�@s�ddlZddlZddlZddlZddlZddlZe��Zdaddd�Z	dd�Z
dd�Zd	d
�ZGdd�dej
�Ze�Zd
d�Zdd�Zedd��ZGdd�de�Zdd�Zdd�ZdS)�N�cCstj|||dd�}|��dS)z�Start a new thread, invoking TARGET with *ARGS there.
    This is a helper function that ensures that any GDB signals are
    correctly blocked.T)�name�target�args�daemonN)�gdb�Thread�start)rrr�resultrr�(/usr/share/gdb/python/gdb/dap/startup.py�start_thread"srcs"td��fdd�}td|�dS)z-Start the DAP thread and invoke TARGET there.zset breakpoint pending oncst��a��dS�N)�	threading�current_thread�_dap_threadr�rrr�really_start_dap0sz#start_dap.<locals>.really_start_dapZDAPN)�exec_and_logr)rrrrr�	start_dap*srcst����fdd��}|S)zAA decorator that asserts that FUNC must be run in the GDB thread.cs�|i|��Sr
r�r�kwargs��funcrr�ensure_gdb_thread;sz(in_gdb_thread.<locals>.ensure_gdb_thread��	functools�wraps)rrrrr�
in_gdb_thread8srcst����fdd��}|S)zAA decorator that asserts that FUNC must be run in the DAP thread.cs�|i|��Sr
rrrrr�ensure_dap_threadFsz(in_dap_thread.<locals>.ensure_dap_threadr)rrrrr�
in_dap_threadCsrcs4eZdZdZdZdZdZ�fdd�Zdd�Z�Z	S)	�LoggingParamzWhether DAP logging is enabled.zSet the DAP logging status.zShow the DAP logging status.Ncst��dtjtj�d|_dS)Nzdebug dap-log-file)�super�__init__rZCOMMAND_MAINTENANCEZPARAM_OPTIONAL_FILENAME�value��self��	__class__rrr"Vs
�zLoggingParam.__init__cCs6|jdur|j��d|_|jdur2t|jd�|_dS)N�w�)�log_file�closer#�openr$rrr�get_set_string\s


zLoggingParam.get_set_string)
�__name__�
__module__�__qualname__�__doc__Zset_docZshow_docr*r"r-�
__classcell__rrr&rr Nsr cCs&tjdur"t|tjd�tj��dS)z5Log SOMETHING to the log file, if logging is enabled.N��file)�dap_logr*�print�flush)Z	somethingrrr�logis
r8cCstjdurtjtjd�dS)z9Log a stack trace to the log file, if logging is enabled.Nr3)r5r*�	traceback�	print_excrrrr�	log_stackps
r;cCsTtd|�z(tj|ddd�}|dkr2td|�WntjyNt�Yn0dS)zWExecute the gdb command CMD.
    If logging is enabled, log the command and its output.z+++ T)Zfrom_ttyZ	to_stringr)z>>> N)r8rZexecute�errorr;)�cmd�outputrrrrvsrc@s$eZdZdZdd�Zedd��ZdS)�Invokerz-A simple class that can invoke a gdb command.cCs
||_dSr
�r=)r%r=rrrr"�szInvoker.__init__cCst|j�dSr
)rr=r$rrr�__call__�szInvoker.__call__N)r.r/r0r1r"rrArrrrr?�sr?cCs t|t�rt|�}t�|�dS)z}Send CMD to the gdb thread.
    CMD can be either a function or a string.
    If it is a string, it is passed to gdb.execute.N)�
isinstance�strr?rZ
post_eventr@rrr�send_gdb�s
rDcspt�t�rt���tjddkr8tjddkr8t���nt�����fdd�}t|���	�}t|t
�rl|�|S)z�Send FN to the gdb thread and return its result.
    If FN is a string, it is passed to gdb.execute and None is
    returned as the result.
    If FN throws an exception, this function will throw the
    same exception in the calling thread.
    r���c
sHz��}��|�Wn.tyB}z��|�WYd}~n
d}~00dSr
)Zput�	Exception)�val�e��fnZresult_qrr�message�s
z'send_gdb_with_response.<locals>.message)rBrCr?�sys�version_info�queueZQueueZSimpleQueuerD�getrH)rLrMrIrrKr�send_gdb_with_response�s


rR)r)rrrPrr9rNrZ_gdb_threadrrrrrZ	Parameterr r5r8r;r�objectr?rDrRrrrr�<module>s(