Current File : //usr/share/gdb/python/gdb/dap/__pycache__/io.cpython-39.pyc
a

ɱZh(	�@s0ddlZddlmZmZmZdd�Zdd�ZdS)�N�)�start_thread�send_gdb�logcCs�d}|��}|��}|dkrqP|�d�rB|dd���}t|�}qtd|�qt�}t|�|kr~|�|t|��}||7}qVt�	|�}|S)zHRead a JSON-RPC message from STREAM.
    The decoded object is returned.N�sContent-Length:�zIGNORED: <<<%s>>>)
�readline�strip�
startswith�intr�bytes�len�read�json�loads)�streamZcontent_length�line�dataZnew_data�result�r�#/usr/share/gdb/python/gdb/dap/io.py�	read_jsons 


rcs��fdd�}td|�dS)z�Start the JSON writer thread.
    It will read objects from QUEUE and write them to STREAM,
    following the JSON-RPC protocol.cs�d}���}|durtd�q~||d<|d}t�|�}|�d�}dtt|��d}|�d�}��|���|����qdS)Nr�quit�seqzutf-8zContent-Length: z

�ASCII)	�getrr�dumps�encode�strr
�write�flush)r�objZencodedZ
body_bytes�headerZheader_bytes��queuerrr�_json_writer1s




z'start_json_writer.<locals>._json_writerzJSON writerN)r)rr$r%rr#r�start_json_writer,sr&)rZstartuprrrrr&rrrr�<module>s