403Webshell
Server IP : 121.121.20.254  /  Your IP : 216.73.216.59
Web Server : Microsoft-IIS/10.0
System : Windows NT WEB-SERVER 10.0 build 20348 (Windows Server 2022) AMD64
User : IUSR ( 0)
PHP Version : 8.3.28
Disable Function : NONE
MySQL : ON  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  C:/Python315/Lib/test/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : C:/Python315/Lib/test/__pycache__/test_remote_pdb.cpython-315.pyc
R
>lqj��c
���]PHs]PHs]PHs]PHs]PHs]PHs]PHs]PHs]PH s]PH$s	]PH(s
]PH,s
]QH0G
s
GsGsGsGs]QHHGsGsGsGsGsGs]QHdGsGs]QHpGs]PHxs]QHxGsG s \OB2%f\
ODQ2g\Q2s#QQ	2s$Q
Q\
OJ2s&QQ
\
OJ2s'\2\
OP\Q2QQ\
OJ222s)Qs*\
OP\OB2%(Q2\
OP\OVQ6g9%c'\OVQ6g9%c\OVQ6gQ2\
OP\OVQ6H9%c
\*2%(Q2\\2QQ\
OJ222222s,\-Q6Xc\
O\2P!P!)�)�closing�contextmanager�redirect_stdout�redirect_stderr�	ExitStack)�is_wasi�cpython_only�force_color�requires_subprocess�
SHORT_TIMEOUT�subTests)�TESTFN�unlink)�List)�
_PdbServer�
_PdbClientzremote debugging is disabledc#� �S9^tt^2Uw�PPP2P!SO2g9h)%fhP!9h3h)zGContext manager killing the subprocess if a Python exception is raised.)�kill)�procs&�)C:\Python315\\Lib\test\test_remote_pdb.py�
kill_on_errorrs9���
��	��J�
���	��I�I�K���
���s*�A
�6� �
A
�3�6�A	�A	�	A
c�`�\sQs]%snQsQsU1QkQksU1QkQksU1QkQksU1Q	kQ
ks	U1QkQks
U1Q
kQksQsUs
P!)�MockSocketFilezJMock socket file for testing _PdbServer without actual socket connections.c�$�,Um,UmP!�N��input_queue�
output_buffer��selfs&r�__init__�MockSocketFile.__init__(s��������c�&:�U]6�cPgQRZQP-!���data�return��bytes)�format�
__classdict__s"�r�__annotate__�!MockSocketFile.write.__annotate__,s���(�(�%�(�D�(r"c�>�UOOU2P!)zSimulate write to socket.)r�append�rr&s&&r�write�MockSocketFile.write,s�����!�!�$�'r"c� :�U]6�cPgQP-!�r%r'�)r*r+s"�rr,�!MockSocketFile.flush.__annotate__0����
�
�t�
r"c��P!)zNo-op flush implementation.r5rs&r�flush�MockSocketFile.flush0���r"c�":�U]6�cPgQRZ-!r4r()r*r+s"�rr,�$MockSocketFile.readline.__annotate__4s���'�'�%�'r"c�b�UO%fQ!UOO]2!)z*Read a line from the prepared input queue.r")r�poprs&r�readline�MockSocketFile.readline4s(����������#�#�A�&�&r"c� :�U]6�cPgQP-!r4r5)r*r+s"�rr,�!MockSocketFile.close.__annotate__:r7r"c��P!)zClose the mock socket file.r5rs&r�close�MockSocketFile.close:r;r"c�&:�U]6�cPgQRZQP-!r$)�dict)r*r+s"�rr,�%MockSocketFile.add_input.__annotate__>s���C�C�d�C�t�Cr"c��UOO[OU2O	2Q*2P!)z,Add input that will be returned by readline.�
)rr/�json�dumps�encoder0s&&r�	add_input�MockSocketFile.add_input>s-��������
�
�4� 0� 7� 7� 9�E� A�Br"c�2:�U]6�cPgQRZRZ*-!r4)rrH)r*r+s"�rr,�&MockSocketFile.get_output.__annotate__Bs���
�
�D��J�
r"c�`�,oUOFDvo[U[2%fJUOQ2%fJ4UO	[
OUO2O222Jx	,UmU![
OcJ�h9h)z;Get the output that was written by the object being tested.rK)
r�
isinstancer)�endswithr/rL�loads�decode�strip�JSONDecodeError)r�resultsr&s&  r�
get_output�MockSocketFile.get_outputBs������&�&�D��$��&�&�4�=�=��+?�+?���N�N�4�:�:�d�k�k�m�.A�.A�.C�#D�E�'� �������+�+����s�AB�B-�(B-�,B-r)�__name__�
__module__�__qualname__�__firstlineno__�__doc__r r1r9r@rErOr[�__static_attributes__�__classdictcell__�r+s@rrr%sK����T� �(�(�
�
�'�'�
�
�C�C�
�
r"rc�`�\sQs]OsnQsQP
QP
QP
QPQPQPQPQ	PQ
PQP-
QksQ
sQsQsQs	Qs
\O\
OO]6�Q2\QQQ-Q1QP-Q1QQ-Q1,2Q22s\O\
OO]6Q2\QQQ-Q1QP-Q1QQ-Q1,2Q22sQ sQ!sQ"sQ#sQ$sQ%sQ&sQ'sQ(sQ)sQ*sQ+sQ,sQ-s Q.s!Q/s"Q0s#Q1s$Q2s%Q3s&Q4s'Us(P!)5�PdbClientTestCasezTests for the _PdbClient class.�simulate_send_failure�#simulate_sigint_during_stdout_write�use_interrupt_socket�expected_outgoing�expected_outgoing_signals�expected_completions�expected_exception�expected_stdout�expected_stdout_substring�expected_statec
��
`$`%`&`'�Ue,oUe,oUe,oUe-oUOQP
2STT
t,tFDvq�UQ6XfJU
MJ	ooo
STT
t,tFDvq�UQ6XfJU
Q*MJ	ooo
QU2n&,n%U$U%U&1Qko[29^tt^2o[O2vooUO	[U22UO	[U22[OOUQ5oUOQOQ	U222UO[O2U%cN[OO[Q
2Q5Um	UO[O2[O 2oU%cUO"n'U'1QkoUUmUO	[OO%Q
UQ52oUO	['U22U%c2[OO[OQ5oPoL@PoUO	[OO%Q[(O*Q52o[-QUUQ5n$Ud5UQ*oUQ*oUO	UO/UUQ52R$O12PPP2WOO2Tt,tFDoUO4]*MJ	ooSFDoUO7Q2%cJPg	STt,tFDo[8O:U2MJ	ooUO=UU2UO=R%U2U
%c*U	%f"UO?U
WOA22L UO=WOA2U	2WOCSTt,tFD"o[OOEU2MJ$	to2STt-tFDoU[GR$U2aJ	ooUO=UU2U%c`WOOHT t,tFD=o [JOL[NOQU O4]*22MJ?	o!o LbWePg,o!UOHFDIo U O4vo"o#UO=U"Q2U!OS[JOLU#22JK	UO=U!U2P!tto
ohtto
oh)%fhCK]9httohttohttohttohtto h)N�write_failed�server�user�promptc3�H�SF �DvqUQ6XfJUw�	J	P!3h)rtr5)�.0�source�ms&  r�	<genexpr>�,PdbClientTestCase.do_test.<locals>.<genexpr>ns������I�F�V�v�5E�a�a��s�"�"c�l:�[R
P2oUe[gUOQ29o%Cc1[OO2oUQ*UOmUQ*UOmUQ*UOm[OOU2[OOO[OQU-29^tt^2[O 2FDFoUQ*UQ*UQ*oRO#VT2oUeLR	O%U2JH	PPP2UQ*o['U[(2%cUg['U[*2%cU!U2!)%fhKP9h)N�completion_request�line�begidx�endidxr@�input)�next�EOFError�get�unittest�mock�Mock�get_line_buffer�return_value�
get_begidx�
get_endidx�seal�patchrH�sys�modules�	itertools�count�completer/rT�
BaseException�str)ru�message�req�
readline_mock�param�prefix�
completion�reply�client�completions�
input_iters&       ���r�
mock_input�-PdbClientTestCase.do_test.<locals>.mock_inputqsC����:�t�,�G������k�k�"6�7�7�s�7� (�
�
� 2� 2� 4�
�=@��[�
�-�-�:�8;�H�
�
�(�(�5�8;�H�
�
�(�(�5��
�
�"�"�=�1��]�]�(�(�-�-�c�k�k�J�
�;V�W�W�!*���!2��!$�V��S��]�S��]�!K��%+�_�_�V�%C�
�%�-�!�#�*�*�:�6�"3�X��G�$�E��%��/�/����%��%�%����7�N�X�W�s�:AF#�F#�#F3	�,F3	)�wrapsr"c3��SF �DIo[U[2%cSL#[OU2O	2Q*w�	JK	P!3h)rK)rTr)rLrMrN)rwrys& rrzr{�s=��%���%��%�Q��.�.�Q�D�J�J�q�M�4H�4H�4J�e�S�S�%�s
�A�6Azsendall failed��side_effectc�^:�[O[O2RU2!r��signal�raise_signal�SIGINT)�s�orig_stdout_writes&�r�sigint_stdout_write�6PdbClientTestCase.do_test.<locals>.sigint_stdout_write�s ����'�'��
�
�6�,�Q�/�/r"z	pdb.input)�speczos.killi90)�pid�
server_socket�interrupt_sock�	exception�msg)r�rK)*�
setdefaultr�socket�
socketpair�
enter_contextrr�r�r��sendall�join�shutdown�SHUT_WR�OSError�SHUT_RD�io�StringIOr1r�r�osrr�assertRaises�cmdloop�
mock_calls�argsrUrLrV�assertEqual�assertIn�getvalue�assert_has_calls�call�getattr�call_args_listr��Signals�int�
from_bytesr/)(r�incomingrgrhrirjrkrlrmrnrorprxry�messages�promptsr��stack�client_sock�server_sock�stdoutr��
input_mockr��	mock_killr�r��	sent_msgs�actual_outgoing�p�k�actual_stater��outgoing_signalsr��signumr�r�r�r�s(&$$$$$$$$$$$                        @@@@r�do_test�PdbClientTestCase.do_testRs�����$� "��$�,�(*�%��'�#%� ��!��N��!�!�.�%�8�'/�F�x�)�&�6�X�3E�A�A�x��F�08�M��9�6�F�f�<L�;�1�X�;�;���M�F��F�
���	�4�[�[�E�'-�'8�'8�':�$�K������� 4�5������ 4�5�"�-�-�,�,�;�,�?�K��������%���
�
� � ����0�$�&.�m�m�&8�&8� '�(8� 9�'9�'��#��$�$�V�^�^�4��[�[�]�F�2�$*�L�L�!�0� 3����,�,��
�
�#�#�K�Z�#�H��J�
����� 7�8�#�!)���!3�!3����!3�!G�� �	�!%��!�/�/��M�M�'�'�	����'�@��	� ��)�-��F�"�-�.�{�;�	�(��/���#�#�D�$5�$5�i�S�$5�$I�J��N�N��s�v-8�,?�,?�,J�,J�K�,J�S�S�X�X�a�[�[�,J�	�K��C��<�<��&�&�&�&��6?�@�i�s�4�:�:�c�?�i��@�����*;�<�����&:�;�$�_��M�M�3�V�_�_�5F�G����V�_�_�.��@��#�#�G�$L�G�q�X�]�]�%7�%7��%:�G�$L�M�7E�F�~�!��7�6�1�-�-�~��F�����~�6��+�2�2�A�A� �A�D����s�~�~�d�i�i��l�;�<�A�
� ��
�(�(�(�!��!�0�0��"�i�i���V�� � ��e�,� �'�'����v�(>�?�1�	
���)�+D�E��mG��M�>�[�[��vL��A��%M��F�� se�
T7�T7�
T=�%
T=�B9U�A)U�=A*U�(BU�+AU�U�!U�:*U!�.U&�9AU+�U	�U	c�6�,o,oUOUUQ5P!)zDTest the behavior when the remote closes the connection immediately.)r�rj�r�)rr�rjs&  r�.test_remote_immediately_closing_the_connection�@PdbClientTestCase.test_remote_immediately_closing_the_connection�s$����������/�	�	
r"c�J�QQ,QN-1,oUOU,Q.Ql-Q5P!)z'Test handling the command_list message.rs�command_list�pdb_commands�r�rjrp)�help�list�continue>r�r�r�r��rr�s& r�test_handling_command_list�,PdbClientTestCase.test_handling_command_list�s=����(D�E�F�
��	
���� �� <��	�	
r"c�B�QQQQQ-1,oUOU,QQ5P!)z1Test handling a message payload with type='info'.rsr��Some message or other
�type�info�r�rjrnr�r�s& r�test_handling_info_message�,PdbClientTestCase.test_handling_info_message�s9���	�#<�f�f�M�N�
��	
���� �5�	�	
r"c�B�QQQQQ-1,oUOU,QQ5P!)z2Test handling a message payload with type='error'.rsr�zSome message or other.r��errorz*** Some message or other.
r�r�r�s& r�test_handling_error_message�-PdbClientTestCase.test_handling_error_messages9���	�#;�V�W�M�N�
��	
���� �:�	�	
r"c�B�QQQQQ-1,oUOU,QQ5P!)z:Test handling a message payload with an unrecognized type.rsr�zSome message.
r��unknownr�r�r�s& r�test_handling_other_message�-PdbClientTestCase.test_handling_other_messages9���	�#4�f�i�H�I�
��	
���� �-�	�	
r"zHelp not available for -OOzhelp_request,expected_substringr��llzUsage: ll | longlistztype help <topic>�pdbz>>> import pdbc�:�QU1,oUOU,UQ5P!)z3Test handling help requests when help is available.rs�r�rjror��r�help_request�expected_substringr�s&&& r�!test_handling_help_when_available�3PdbClientTestCase.test_handling_help_when_available�/���|�$�
��	
���� �&8�	�	
r"z	Needs -OOzNo help for 'll'zUndocumented commandszNo help for 'pdb'c�:�QU1,oUOU,UQ5P!)z7Test handling help requests when help is not available.rsrr�rs&&& r�%test_handling_help_when_not_available�7PdbClientTestCase.test_handling_help_when_not_available1rr"c���QQQ,-1QQQQQ-1QQQQ	Q
-1QQQQ	Q-1QQQQQ-1QQQQ	P-1QQQQQ-1QQQQ	Q
-1QQQQQ-1QQQQ	Q-1QQQQ	Q-1,oUOUQQ-QP-QQ
-QQ-,QQ-Q5P!)z(Test responding to pdb's normal prompts.rsr��bru�(Pdb) �stater�rtr��lst [�...   �0 ]�b [z! b [�b ]r��	lst [
0 ]z!b [
b ]r�r�r�s& r�test_handling_pdb_prompts�+PdbClientTestCase.test_handling_pdb_promptsHs������.�/�
��(�G�U�;�<�
�h��'�7�;�<�
�h��'�5�9�:�
��(�G�U�;�<�
�h��'�2�6�7�
��(�G�U�;�<�
�h��'�5�9�:�
��(�G�U�;�<�
�h��'�7�;�<�
�h��'�5�9�:�
��	
�����,�'��"�
��%� ��+�&�	�$�U�+�	�		
r"c
���QQQ,-1QQQQQ-1QQQQ	Q
-1QQQQ	Q-1QQQQQ-1QQQQ	P-1QQQQQ-1QQQQ	Q
-1QQQQ	Q-1,	oUOUQQ-QP-QQ-,QQ-Q5P!)z/Test responding to pdb's interact mode prompts.rsr�rru�>>> r�interactrtr�r�... rrrr�rzb [
b ]r�r�r�s& r�test_handling_interact_prompts�0PdbClientTestCase.test_handling_interact_promptsbs�������.�/�
��&�'�:�>�?�
�h����9�:�
�h����7�8�
��&�'�:�>�?�
�h����4�5�
��&�'�:�>�?�
�h����7�8�
�h����7�8�

��	
�����,�'��"�
��*�%��
$�Z�0�	�	
r"c�x�QQQQQ-1QQQQQ-1QQQQQ	-1QQQ
QQ-1,oUOUQQ
-,QQQ-Q5P!)�=Test re-prompting after a SyntaxError in a Python expression.rsrur
rr�rtr�z lst [rr� 0 ]r��
lst [
 0 ]z*** IndentationError�r�rjrorpr�r�s& r�%test_retry_pdb_prompt_on_syntax_error�7PdbClientTestCase.test_retry_pdb_prompt_on_syntax_errorys����(�G�U�;�<�
�h��'�8�<�=�
�h��'�7�;�<�
�h��'�6�:�;�	
��	
�����-�(��'=�#�U�+�
	�	
r"c�x�QQQQQ-1QQQQQ-1QQQQQ	-1QQQ
QQ-1,oUOUQQ
-,QQQ-Q5P!)rrsrurrrrtr�z!lst [rrrr�r z*** SyntaxErrorr!r�r�s& r�*test_retry_interact_prompt_on_syntax_error�<PdbClientTestCase.test_retry_interact_prompt_on_syntax_error�s����&�'�:�>�?�
�h����:�;�
�h����9�:�
�h����8�9�	
��	
�����-�(��'8�#�Z�0�
	�	
r"c��QQQQQ-1QQQQQ-1QQQQQ-1QQQQQ	-1QQQQQ-1QQQQP-1QQQQQ-1QQQQQ
-1,oUOUQQ-QQ	-QP-QQ
-,QQ-Q
5P!)z<Test fallback to "dumb" single-line mode for unknown states.rsru�Do it? r�confirmrtr�z! [z
echo hellozecho goodbyer��dumbr�r�r�s& r�&test_handling_unrecognized_prompt_type�8PdbClientTestCase.test_handling_unrecognized_prompt_type�s�����)�W�i�@�A�
�h�	�7�E�:�;�
��)�W�i�@�A�
�h�	�7�L�A�B�
��)�W�i�@�A�
�h�	�7�B�7�8�
��)�W�i�@�A�
�h�	�7�N�C�D�	
��	
�����%� ��,�'��"�
��.�)�	�$�V�,�	�		
r"c�\�QQQQQ-1QQQQQ-1,oUOUQ	Q
-,QQ-Q5P!)z.Test signaling when a prompt gets interrupted.rsrur
rr�rtr�c�L�[O[O2!rr�r5r"r�<lambda>�9PdbClientTestCase.test_sigint_at_prompt.<locals>.<lambda>����V�%8�%8����%Gr"r��INTr�r�r�s& r�test_sigint_at_prompt�'PdbClientTestCase.test_sigint_at_prompt�sa����(�G�U�;�<���h��G��
�	
��	
�����5�!��$�U�+�	�	
r"c�j�QQQQQ-1QQQQQ-1QQQ	QQ
-1,oUOUQQ-,QQ-Q
5P!)z;Test signaling when a continuation prompt gets interrupted.rsrur
rr�rtr��if True:rc�L�[O[O2!rr�r5r"rr/�FPdbClientTestCase.test_sigint_at_continuation_prompt.<locals>.<lambda>�r1r"r�r2r�r�r�s& r�"test_sigint_at_continuation_prompt�4PdbClientTestCase.test_sigint_at_continuation_prompt�sr����(�G�U�;�<�
�h��'�:�>�?���h��G��
�

��	
�����5�!��$�U�+�	�	
r"c
���QQQQQ-1,oQFDLoUOUQ59^tt^2UOUP	U,[O,QQ5PPP2JN	P!)%fhJc9h)	z9Test siginaling when sys.stdout.write() gets interrupted.rsr�r�r�r�)ri)r�rhrirjrkrn)FT)�subTestr�r�r�)rr�ris&  r�test_sigint_when_writing�*PdbClientTestCase.test_sigint_when_writing�sx���	�#<�f�f�M�N�
��%2� ����3G��H�H����%�8<�)=�&(�/5�}�}�o�$=�
��I�H�%2�H�H�H�s�'A 	� A1
�)A1
c�j�QQQQQ-1QQQQ[2-1,oUOUQQ	-,QQ-Q
5P!)z.Test signaling when a prompt gets an EOFError.rsrur
rr�rtr�r��EOFr�)r�r�r�s& r�test_eof_at_prompt�$PdbClientTestCase.test_eof_at_prompt�s\����(�G�U�;�<�
�h��'�8�:�>�?�
��	
�����5�!��$�U�+�	�	
r"c�\�QQQ-1QQQQQ-1,oUOU,Q[Q	Q
-Q5P!)z3Test failing after getting an unrecognized payload.rs�monty�pythonr�r�r�r�r�r�z+Unrecognized payload b'{"monty": "python"}')r�rjrm)r��RuntimeErrorr�s& r�test_unrecognized_json_message�0PdbClientTestCase.test_unrecognized_json_message�sS�����*�+�
�	�#<�f�f�M�N�
��	
���� ��\��F� �	�	
r"c�f�Q	QQQQQ-1,oUOU,QOQQ,2Q5P!)
z1Test continuing after getting a non JSON payload.rsr��	Somethingr�r��
z'*** Invalid JSON from remote: b'spam\n'r�)rssspam)r�r�r�s& r�0test_continuing_after_getting_a_non_json_payload�BPdbClientTestCase.test_continuing_after_getting_a_non_json_payloadsO��
 �
�	�;���?�@�
��	
���� � �I�I�>����	�		
r"c�l�QQQQQ-1QQQQ[2-1,oUOUQQ	-,P	Q
P	-Q5P!)z<Test terminating if write fails due to a half closed socket.rsrur
rr�rtr�r�r2rr)r�rjrgrp)�KeyboardInterruptr�r�s& r�test_write_failing�$PdbClientTestCase.test_write_failings]����(�G�U�;�<�
�h��'�3D�3F�G�H�
��	
���� (�%�0�1�"&�*�D�1�		�	
r"c��QQQQQ-1QQQQQQ	Q
]Q]	-QQ
-1QQQQ,-1,oUOUQQQQQQ
]Q]--QQ
-,QQ,QQ-Q5P!)z2Test requesting tab completions at a (Pdb) prompt.rsrur
rr�rtr}r~z	    mod._rr�r��print(
    mod.__name__)r�r]�__file__r��text�_zmod._r��r�rjrlrpr�r�s& r�test_completion_in_pdb_state�.PdbClientTestCase.test_completion_in_pdb_state&s�����(�G�U�;�<���h�(��� �!� �!�+�
�8��
��
�
�J�'?�@�A�
�� 	
��������� �!� �!�	!���5�6�
�#-�j�!9�#�U�+�	�	
r"c��QQQQQ-1QQQQQ-1QQQ	Q
QQQ
]Q]-QQ-1QQ,QN-1QQQ	QP-1,oUOUQQQQQQ
]Q]--QQ-,,QNQQ-Q5P!)z?Test requesting tab completions at a (Pdb) continuation prompt.rsrur
rr�rtr�r6rr}r~z    brr�z
    bool()r�r�rUrz! br�zif True:
    bool()
rW)�bin�boolr)r�r�s& r�&test_multiline_completion_in_pdb_state�8PdbClientTestCase.test_multiline_completion_in_pdb_stateJs�����(�G�U�;�<�
�h��'�:�>�?���h�(��� �!� �!�+�
�\��
��
�'?�@�A�
�h��'�2�6�7�!
��$	
��������� �!� �!�	!���2�3�
�":�#�U�+�	�	
r"c��QQQQQ-1QQQQQQ	Q
]Q]
-QQ
-1QQQQ,-1,oUOUQQQQQQ
]Q]--QQ
-,QQ,QQ-Q5P!)z0Test requesting tab completions at a >>> prompt.rsrurrrrtr}r~z
    mod.__rr�r�rSr�r]rTr�rU�__zmod.__r�rWr�r�s& r�!test_completion_in_interact_state�3PdbClientTestCase.test_completion_in_interact_stateps�����&�'�:�>�?���f�(��� �!� �"�+�
�8��
��
�
�J�'?�@�A�
�� 	
��������� �!� �!�	!���5�6�
�#-�j�!9�#�Z�0�	�	
r"c�v�QQQ,-1QQQQQ-1QQQQ	Q
QQ]Q
]-QQ-1,oUOUQQ-,QQ-Q5P!)z:Test requesting tab completions at an unrecognized prompt.rsr�r�rur(rr)rtr}r~rVrr�r�r]r�r*r�r�r�s& r� test_completion_in_unknown_state�2PdbClientTestCase.test_completion_in_unknown_state�s�������.�/�
��)�W�i�@�A���i�(��� �!� �!�+�
�Z��
�
�� 	
�����*�%��$�V�,�	�	
r"c��QQQQQ-1QQQQQQ	Q
]Q]-QQ
-1,oUOUQQQ	QQ	Q
]Q]--QQ
-,P	,QQQP	-Q5P!)z?Test failing to write to the socket to request tab completions.rsrurrrrtr}r~�xyrr�r��xyzr�rUr�rr)r�rjrgrlrpr�r�s& r�$test_write_failure_during_completion�6PdbClientTestCase.test_write_failure_during_completion�s�����&�'�:�>�?���f�(��� �!� �!�+�
�U��
�
��	
��������� �!� �!�	!���%� �
�#'�!#�#�Z���F�	�	
r"c��QQQQQ-1QQQQQQ	Q
]Q]-QQ
-1,oUOUQQQ	QQ	Q
]Q]--QQ
-,,QQ-Q5P!)z5Test failing to read tab completions from the socket.rsrurrrrtr}r~rgrr�r�rhr�rUr�rWr�r�s& r�#test_read_failure_during_completion�5PdbClientTestCase.test_read_failure_during_completion�s�����&�'�:�>�?���f�(��� �!� �!�+�
�U��
�
��	
��������� �!� �!�	!���%� �
�"$�#�Z�0�	�	
r"c��QQQQQ-1QQQQQQ	Q
]Q]-QQ
-1QQQQQQ
-1,oUOUQQQ	QQ	Q
]Q]--QQ
-,Q,QQ-Q5P!)z9Test receiving invalid JSON when getting tab completions.rsrurrrrtr}r~rgrr�r�rhr�rUr�z *** json.decoder.JSONDecodeError)r�rjrorlrp)rss{"completions": r�r�s& r�+test_reading_invalid_json_during_completion�=PdbClientTestCase.test_reading_invalid_json_during_completion�s�����&�'�:�>�?���f�(��� �!� �!�+�
�U��
�
,�
�h����7�8�
��"	
��������� �!� �!�	!���%� �
�'I�!#�#�Z�0�	�	
r"c��QQQQQ-1QQQQQQ	Q
]Q]-QQ
-1Q-1QQQQQ
-1,oUOUQQQ	QQ	Q
]Q]--QQ
-,Q,QQ-Q5P!)zATest receiving an empty JSON object when getting tab completions.rsrurrrrtr}r~rgrr�r�rhr�rUr�z;*** RuntimeError: Failed to get valid completions. Got: {}
)r�rjrnrlrpr�r�s& r�)test_reading_empty_json_during_completion�;PdbClientTestCase.test_reading_empty_json_during_completions�����&�'�:�>�?���f�(��� �!� �!�+�
�U��
��r�N�
�h����7�8�
��"	
��������� �!� �!�	!���%� �
��"$�#�Z�0�%	�	
r"r5))r]r^r_r`rar�r�r�r�r�r�r��skipIfr��flags�optimizerrr	rrr"r%r+r3r9r=rArGrLrPrXr]rardrirlrorrrbrcrds@rrfrfOs�����)�OF�$�	OF�
-2�OF�#�
OF��OF�#'�OF�"�OF� �OF��OF�#%�OF��OF�b
�
�	
�	
�	
��_�_�S�Y�Y�'�'�1�,�.J�K�
�)��d�^�3�4��b�\�.�/��e�_�.�/�
	
�
�	
�
�L�	
��_�_�S�Y�Y�'�'�!�+�[�9�
�)��d�^�/�0��b�\�2�3��e�_�1�2�
	
�
�	
�
�:�	
�
�4
�.
�"
�"
�.
�(
�*� 
�

�
�"
�"
�H$
�L!
�F
�4!
�F 
�D#
�J&
�&
r"rfc�b`�\sQsQsnQsQsQsQsQsQs	Qs
Q	sQ
sQs
QsQ
sUsP!)�RemotePdbTestCase�@zTests for the _PdbServer class.c�
�[2Um[UO2UmPUOmP
UOmQ]Q]QQ]d--UmQ]Q]-Um[OO2oUOUmUOUm]*Um
[OO2UmQUOmQUOmVOmP!)	N�ar�__pdb_convenience_variables�x�c�dztest_file.py�
test_function)r�sockfilerr��botframe�quitting�test_globals�test_localsr�r�r��	f_globals�f_locals�f_lineno�f_code�co_filename�co_name�curframe)r�
frame_infos& r�setUp�RemotePdbTestCase.setUpCs���&�(��
��d�m�m�,���!�����!�����!�!�S�!�-J�S�RU�J�W�����C��+����]�]�'�'�)�
�#�0�0�
��"�.�.�
�� �
��$�M�M�.�.�0�
��(6�
���%�$3�
���!�&���r"c�R�UOOQ2UOOQ2UOO	2oUO[
U2]2UOU]*QQQQ-2UOU]*QQQQ-2P!)z1Test message and error methods send correct JSON.zTest messagez
Test errorr�z
Test message
r�r�r�)r�r�r�r�r[r��len�r�outputss& r�test_message_and_error�(RemotePdbTestCase.test_message_and_errorZs���������(������|�$��-�-�*�*�,������W��q�)�������i�1A�6�6�%R�S�������i��v�w�%O�Pr"c��UOOQQ-2UOO2oUO	UQ2P!)z&Test reading commands from the socket.r�r�)r�rOr��_read_replyr�)r�cmds& r�test_read_command�#RemotePdbTestCase.test_read_commandds?��	
�
�
����&� 1�2��h�h�"�"�$������f�%r"c���P	UOmUO[29^tt^2UOO	2PPP2P!)%fhP!9h)zTest reading EOF command.)r��
_write_failedr�r�r�rs&r�test_read_command_EOF�'RemotePdbTestCase.test_read_command_EOFms@��"&�����
�
�
�x�
(�
(��H�H� � �"�)�
(�
(�
(�s�A�A&	�A&	c
�B�[OOOUOQQQ,Q59^tt^2UO
O
QQQQQQ	]Q
]--2UO
O
QQ-2UOO2oUO
O2oUO[U2]2UOU]*Q
QQ,-2UOUQ2PPP2P!)%fhP!9h)z"Test handling completion requests.�
completenamesr��clear�r�r�rUr~r~rr�r�r�r�)r�r�r��objectr�r�rOr�r[r�r�)rr�r�s&  r�test_completion�!RemotePdbTestCase.test_completionts���]�]�
 �
 �
'�
'����/�5?��4I�(�K�K�
�M�M�#�#���C��C��a��a�	�%�
�
�M�M�#�#�W�f�$5�6��(�(�&�&�(�C��m�m�.�.�0�G����S��\�1�-����W�Q�Z�-�*�g�9N�)O�P�
���S�&�)�3K�K�K�K�s�CD
�
D	�D	c���UOOQ2UOO2oUO	[U2]2UO	U]*QQ-2P!)z)Test that do_help sends the help message.�breakr�)r��do_helpr�r[r�r�r�s& r�test_do_help�RemotePdbTestCase.test_do_help�sS��������!��-�-�*�*�,������W��q�)�������f�g�%6�7r"c�:�UOOP2UOUOO2UO	UOO[
2[OOOUOQ29^tt^2oUOOQ2UO2UOOQ2UO2PPP2P!)%fhP!9h)z*Test interaction mode setup and execution.�
_error_excz
print('test')zif:)
r��do_interact�assertIsNotNone�_interact_state�assertIsInstancerHr�r�r�r��_run_in_python_repl�assert_not_called�assert_called_once)r�
mock_errors& r�test_interact_mode�$RemotePdbTestCase.test_interact_mode�s���	
�����R� �	
���T�X�X�5�5�6����d�h�h�6�6��=��]�]�
 �
 �
'�
'����,�
?�
?�:��H�H�(�(��9��(�(�*�
�H�H�(�(��/��)�)�+�
@�
?�
?�
?�s�(AD	�	D	�D	c	�f�[OOOUOQ29^tt^2UO
O
QQ-2UO
O
QQ-2UO
O
QQ-2UO
O
QQ-2UO
O
QQ-2UOO2UO
O2oUOQ	U]*2UOU]*Q
QQQ
-2UOU]*Q
QQQ-2UOU]*Q
QQQ-2UOU]*Q
QQQ-2UOU]*Q
QQQ
-2UOU]*QQQQ-2UO[U2]2UOUOO]*QQ,2PPP2P!)%fhP!9h)z%Test registering breakpoint commands.�get_bpbynumberr�z
commands 1�silentzprint('hi')�endr�r@r�rur
rr�z(com) �commandsr�rKr�r��_pdbcmd_silence_frame_status)
r�r�r�r�r�r�rOr�r[r�r�r�r�r�s& r�test_registering_commands�+RemotePdbTestCase.test_registering_commands�s����]�]�
 �
 �
'�
'����2B�
C�
C��M�M�#�#�W�l�$;�<��M�M�#�#�W�h�$7�8��M�M�#�#�W�m�$<�=��M�M�#�#�W�e�$4�5��M�M�#�#�X�u�$5�6�
�H�H�����m�m�.�.�0�G��M�M�.�'�!�*�5����W�Q�Z�(�H�g�u�)M�N����W�Q�Z�(�H�g�z�)R�S����W�Q�Z�(�H�g�z�)R�S����W�Q�Z�(�H�g�z�)R�S����W�Q�Z�(�H�g�u�)M�N����W�Q�Z�)�T�6�6�)J�K����S��\�1�-�������!�!�!�$�/��?�
�+D�
C�
C�
C�s�GH�H0	�(H0	c�X�[OOOUOQ29^tt^2oUO
O
2UO2UOUO
O2PPP2P!)%fhP!9h)zTest the detach method.rE)
r�r�r�r�r�r��detachr��assertFalser�)r�
mock_closes& r�test_detach�RemotePdbTestCase.test_detach�sg��
�]�]�
 �
 �
'�
'��
�
�w�
?�
?�:��H�H�O�O���)�)�+����T�X�X�.�.�/�@�
?�
?�
?�s�AB�B)	�!B)	c�*�[OOOUOQP
Q59^tt^2oQQ,UOmUOOQQ-2UOOQQ-2QoV!mP
UOm	UOO2UOUO]2UOQ2UOQ2UOQ2UOQ2UOO2oSTt,tFDoQ	U7fJUMJ	ooUO[U2]2PPP2P!ttoh)%fhP!9h)
z,Test the command loop with various commands.�onecmdr�r�r�r�r��quitc��UQ6H!)r�r5)r~s&rr��3RemotePdbTestCase.test_cmdloop.<locals>.side_effect�s���v�~�%r"ru)r�r�r�r�r��cmdqueuer�rOr�r�r�r��
call_count�assert_any_callr[r�)r�mock_onecmdr�r��or�s&     r�test_cmdloop�RemotePdbTestCase.test_cmdloop�sH���]�]�
 �
 �
'�
'����(��
'�
O�
O�S^�!'�� 0�D�H�H��
�M�M�#�#�W�f�$5�6�
�M�M�#�#�W�f�$5�6�
&�&1�#�!&�D�H�H���H�H����
���[�3�3�Q�7��'�'��/��'�'��/��'�'��/��'�'��/��m�m�.�.�0�G�")�;�'�Q�X��]�q�q�'�G�;����S��\�1�-�;P�
O��8<�9P�
O�
O�s+�C?F�?E<�E<�F�<F�F	�
F	)r�r�r�r�)r]r^r_r`rar�r�r�r�r�r�r�r�r�r�rbrcrds@rrxrx@s@����)�'�.Q�&�#�*�<8�,�$�:0� .� .r"rxz!WASI does not support TCP socketsc�~`�\sQsQsnQsQsQQksQsQsQs	Qs
Q	sQ
sQs
QsQ
sQsQsQsQsUsP!)�PdbConnectTestCase��zCTests for the _connect mechanism using direct socket communication.c�0�[O[O[O2UmUOO	Q2UOO]2UOO
2]*UmP!��	127.0.0.1)r�r)r��AF_INET�SOCK_STREAMr��bind�listen�getsockname�portrs&rr��PdbConnectTestCase.setUp�sc��!�=�=�����9K�9K�L��������.�/�������"��$�$�0�0�2�1�5��	r"c��Ue%[OQUOQ02o[Q*Um[UOQ29^tt^2oUO
U2PPP2P!)%fhP!9h)Na�
                import pdb
                import sys
                import time

                def foo():
                    x = 42
                    return bar()

                def bar():
                    return 42

                def connect_to_debugger():
                    # Create a frame to debug
                    def dummy_function():
                        x = 42
                        # Call connect to establish connection
                        # with the test server
                        frame = sys._getframe()  # Get the current frame
                        pdb._connect(
                            host='127.0.0.1',
                            port=a,
                            frame=frame,
                            commands="",
                            version=pdb._PdbServer.protocol_version(),
                            signal_raising_thread=False,
                            colorize=False,
                        )
                        return x  # This line won't be reached in debugging

                    return dummy_function()

                result = connect_to_debugger()
                foo()
                print(f"Function returned: {result}")
                �_connect_test.py�w��textwrap�dedentr�r
�script_path�openr1�r�script�fs&& r�_create_script�!PdbConnectTestCase._create_script�so���>��_�_�"�*#'�)�)��-�+#�$�F�L"�$6�6���
�$�"�"�C�
(�
(�A�
�G�G�F�O�)�
(�
(�
(�s�A6�6B	�?B	c��UOO2[UO2P![cP!h9hr)r�rErr�r�rs&r�tearDown�PdbConnectTestCase.tearDown,s9������� �	��4�#�#�$���	��	���4�	A�A�Ac�p�[O[OUO,[O
[O
P	Q5oUOO2vq#UOQ2oUOUO2UOUO2V1!)z9Helper to start subprocess and get connected client file.�r��stderrrU�rwb)�
subprocess�Popenr��
executabler��PIPEr��accept�makefile�
addCleanuprE)r�processr�rV�client_files&    r�_connect_and_get_client_file�/PdbConnectTestCase._connect_and_get_client_file3s����"�"�
�^�^�T�-�-�.��?�?��?�?��	
���)�)�0�0�2���!�*�*�5�1������)�)�*�����)�)�*��#�#r"c���,oUO2oU%fU![OUO22oUO	U2QU7fJZU!)z3Helper to read messages until a prompt is received.ru)r@rLrVrWr/)rr�r�r&r�s&&   r�_read_until_prompt�%PdbConnectTestCase._read_until_promptEsV������'�'�)�D���
��	�*�*�T�[�[�]�+�C��O�O�C� ��3����r"c��UO[OQU-2O2Q*2UO	2P!)z)Helper to send a command to the debugger.r�rK)r1rLrMrNr9)rr��commands&&&r�
_send_command� PdbConnectTestCase._send_commandRs8�����$�*�*�g�w�%7�8�?�?�A�E�I�J����r"c	��UO2UO2vq[U29^tt^2UO2o[O
UO
22oUOQU2UOQUQ*2UO2o[O
UO
22oUOQU2UO2o[O
UO
22oUOQU2UOUQ*Q2UOUQ2UOU2oSTt,tFD%oQU7fJQUQ*7fJUQ*MJ'	o	o[U	2o
Q	Q,o[V�P	Q
5FDvq�UOV�2J	UOU
Q2UOUQ2UO[Q
5vq�UOQU
2UOUO ]2PPP2P!ttoh)%fhP!9h)z@Test connecting to a remote debugger and sending basic commands.r�zpdb._connectr�rurr��bt�connect_to_debuggerz<module>)�strictz,Should have received stack trace informationr~��timeout�Function returned: 42)r�r�rr@rLrVrWr�r�rr�r\�zip�
assertTrue�communicater�
returncode)rr�r�r&�initial_datar��prompt_datar�r��text_msg�got_stack_info�expected_stacksr�r�rVs&              r�test_connect_and_basic_commands�2PdbConnectTestCase.test_connect_and_basic_commandsWs������#�@�@�B���
�7�
#�
#��'�'�)�D��:�:�d�k�k�m�4�L��M�M�)�\�2��M�M�.�,�y�*A�B��'�'�)�D��:�:�d�k�k�m�4�L��M�M�.�,�7��'�'�)�D��*�*�T�[�[�]�3�K��M�M�(�K�0����[��1�5�9�
���{�D�1��.�.�{�;�H�3;�U�(�3� �C�'�'�,A�S��^�,S�'��I���(�H�U�!�(�^�N��%��O�
"�/�D�I�I�
���
�
�e�)�J�
�O�O�N�,Z�[�
���{�C�0� �+�+�M�+�B�I�F�
�M�M�1�6�:����W�/�/��3�_$�
#��2U�3$�
#�
#�s1�D+I�"H<�2H<�
H<�B#I�<I�I	�
I	c��UO2UO2vq[U29^tt^2UOU2UO	UQ2UOU2o[QU22oUO
QU2UO	UQ2UOU2o[QU22oUO
QU2UO	UQ2UOU2o[Q[U222oUO
Q	U2UO
Q
U2UO	UQ2UOU2o[Q[U222oUO
Q
U2UO	UQ2UO[Q5vq�UO
QU2UOUO]2PPP2P!)%fhP!9h)z%Test setting and hitting breakpoints.z	break barc3�R�SF �DoQU7fJUQ*w�	J	P!3h�r�r5�rwr�s& rrz�6PdbConnectTestCase.test_breakpoints.<locals>.<genexpr>�s��H���H�S�	�S�@P�.�#�i�.�.�H���	'�'�
Breakpointr~c3�R�SF �DoQU7fJUQ*w�	J	P!3hrr5rs& rrzr�s��X���X�c��c�AQ�>�3�y�>�>�X�r�bar()rc3�R�SF �DoQU7fJUQ*w�	J	P!3hrr5rs& rrzr�s#��6H���6H�s�I�Y\�L\�N�C�	�N�N�6H�rz1   breakpointzbreakpoint already hit 1 timezclear 1c3�R�SF �DoQU7fJUQ*w�	J	P!3hrr5rs& rrzr�s#��7I���7I��Y�Z]�M]�^�S��^�^�7I�rzDeleted breakpointr	r)r�r�rr�rr�r��reversedrrr�r)
rr�r�r��bp_msg�hit_msg�list_msg�	clear_msgr�rVs
&         r�test_breakpoints�#PdbConnectTestCase.test_breakpoints�s�������#�@�@�B���
�7�
#�
#��#�#�K�0�
���{�K�8��.�.�{�;�H��Q�H�Q�Q�F��M�M�,��/�
���{�C�0��.�.�{�;�H��R�X�R�R�G��M�M�'�7�+�
���{�C�0��.�.�{�;�H��]�h�x�6H�]�]�H��M�M�*�H�5��M�M�9�8�D�
���{�I�6��.�.�{�;�H��^�x��7I�^�^�I��M�M�.�	�:�
���{�C�0��+�+�M�+�B�I�F��M�M�1�6�:����W�/�/��3�I$�
#�
#�
#�s�F&G'�'G8	�0G8	c�8�[OQUOQ02oUOUQ5UO	2vq#UO
O
2vqEUOUO2[U29^tt^2UOU2UOUQ2UOO29o%cUOQ2%fJ;UO[ O"O%22UOU2oSTt,tFDoQU7fJUQ*MJ	o	oS	Tt,tFDoQU7fJUMJ	o
oUO'[)U
2]2UOUQ2UOUQ2UO+[,Q	5vq�UO/Q
U2UO1UO2]2PPP2P!ttohttoh)%fhP!9h)z5Test that sending keyboard interrupt breaks into pdb.a
            import time
            import sys
            import socket
            import pdb
            def bar():
                frame = sys._getframe()  # Get the current frame
                pdb._connect(
                    host='127.0.0.1',
                    port=af,
                    frame=frame,
                    commands="",
                    version=pdb._PdbServer.protocol_version(),
                    signal_raising_thread=True,
                    colorize=False,
                )
                print("Connected to debugger")
                iterations = 50
                while iterations > 0:
                    print("Iteration", iterations, flush=True)
                    time.sleep(0.2)
                    iterations -= 1
                return 42

            if __name__ == "__main__":
                print("Function returned:", bar())
            �r�r~�	Iterationr�rziterations = 0r	r)r�r�r�r�r�r�r�r�rErr�rr�r@�
startswithr�r�r��to_bytes�
assertGreaterr�rrr�r�r)rr�r�r��signal_sockrVr~r�r��interrupt_msgs�expected_msgr�s&           r�test_keyboard_interrupt�*PdbConnectTestCase.test_keyboard_interrupt�s������	&��)�)��%
�"���6	
���6��*�#�@�@�B����)�)�0�0�2�������)�)�*�
�7�
#�
#��#�#�K�0�
���{�C�0�
"�.�.�1�1�3�3�$�3��?�?�;�/�/��
����
�
� 6� 6� 8�9��.�.�{�;�H�9A�U���I�QT�DT�n�c�)�n�n��N�U�+9�L�>�C�W��^�C�C�>�L�L����s�<�0�!�4�
���{�,<�=����{�C�0��+�+�M�+�B�I�F��M�M�1�6�:����W�/�/��3�9$�
#��&V��L�)$�
#�
#�sK�AH�H�3AH�5G>�
G>�H�H�'H�-BH�>
H�H	�H	c��UO2UO2vq[U29^tt^2UOU2UO	[
OQQ-2O2Q*2UO2UO[Q5vq4UOQU2UOUO]2UOUP2PPP2P!)%fhP!9h)z1Test that EOF signal properly exits the debugger.r�r@rKr	r)r�r�rr�r1rLrMrNr9rrr�r�r)rr�r�r�r�s&    r�test_handle_eof�"PdbConnectTestCase.test_handle_eof�s�������#�@�@�B���
�7�
#�
#��#�#�K�0�
���d�j�j�(�E�):�;�B�B�D�u�L�M�����%�0�0��0�G�N�F�
�M�M�1�6�:����W�/�/��3����V�R�(�$�
#�
#�
#�s�B6C7�7D	�D	c���[OQUOQ02oUOUQ5UO	2vq#[U29^tt^2UO
2o[OUO22oUOQU2UOUQ*Q2UOQUQ*2UOQUQ*2UO[Q	5vqgUOQ
U2UOQU2UOUO]2PPP2P!)%fhP!9h)z?Test that incompatible protocol versions are properly detected.a�
            import sys
            import pdb

            def run_test():
                frame = sys._getframe()

                # Use a fake version number that's definitely incompatible
                fake_version = 0x01010101 # A fake version that doesn't match any real Python version

                # Connect with the wrong version
                pdb._connect(
                    host='127.0.0.1',
                    port=a�,
                    frame=frame,
                    commands="",
                    version=fake_version,
                    signal_raising_thread=False,
                    colorize=False,
                )

                # This should print if the debugger detaches correctly
                print("Debugger properly detected version mismatch")
                return True

            if __name__ == "__main__":
                print("Test result:", run_test())
            r*r�r�r��incompatiblezprotocol versionr	zTest result: Truez+Debugger properly detected version mismatch)r�r�r�r�r�rr@rLrVrWr�r�rrr)rr�r�r�r&r�r�r�s&       r�test_protocol_version�(PdbConnectTestCase.test_protocol_versions"�����
&��)�)��%
�"���8	
���6��*�#�@�@�B���
�7�
#�
#��'�'�)�D��j�j�����/�G��M�M�)�W�-����W�V�_�g�6��M�M�.�'�)�*<�=��M�M�,�g�i�.@�A�%�0�0��0�G�N�F�
�M�M�-�v�6��M�M�G��P����W�/�/��3�!$�
#�
#�
#�s�C*E�E"	�E"	c��UO2UO2vq[U29^tt^2UOU2,QNoSFD�oUO	V$2UO2o[OUO22oUOQU2UQ6XcUOUQ*P2L0UO2]*oUOUQ*U2UOU2J�	UO	UQ2UO[Q5vq�UOQU2UOUO]2PPP2P!)%fhP!9h)zATest that the help system properly sends help text to the client.r�r~r	r)r�z
help breakz
help continuezhelp pdb)r�r�rr�rr@rLrVrWr�r��splitrrr)
rr�r��
help_commandsr�r&r�rr�r�s
&         r�test_help_system�#PdbConnectTestCase.test_help_systemCs6������#�@�@�B���
�7�
#�
#��#�#�K�0�P�M�$���"�"�;�4�#�+�+�-���*�*�T�[�[�]�3���
�
�f�g�.��&�=��$�$�W�V�_�b�9�"�i�i�k�!�n�G��$�$�W�V�_�g�>��'�'��4�%%�*
���{�C�0�$�0�0��0�G�N�F��M�M�1�6�:����W�/�/��3�A$�
#�
#�
#�s�A9E2�1B7E2�2F	�;F	c�<�UO2UO2vq[U29^tt^2UOU2,QNoSFD%oUO	V$2UOU2J'	UO	UQ2UOU2o[QU22oUO
QU2UO	UQ2UOU2UO	UQ2UOU2o[QU22oUO
QU2UO	UQ2UO[Q	5vqxUO
Q
U2UOUO]2PPP2P!)%fhP!9h)zCTest that multi-line commands work properly over remote connection.ztest_func()c3�R�SF �DoQU7fJUQ*w�	J	P!3hrr5rs& rrz�>PdbConnectTestCase.test_multi_line_commands.<locals>.<genexpr>�� �������I�QT�DT�n�c�)�n�n��r�42zobj = TestClass()zobj.get_value()c3�R�SF �DoQU7fJUQ*w�	J	P!3hrr5rs& rrzrB�rCr�100r~r	r)zdef test_func():
    return 42zfor i in range(3):
    print(i)z#if True:
    x = 42
else:
    x = 0zUtry:
    result = 10/2
    print(result)
except ZeroDivisionError:
    print('Error')ztclass TestClass:
    def __init__(self):
        self.value = 100
    def get_value(self):
        return self.value)r�r�rr�rr�r�rrr�r)	rr�r��multi_line_commandsr�r��
result_msgr�r�s	&        r�test_multi_line_commands�+PdbConnectTestCase.test_multi_line_commandsjsj������#�@�@�B���
�7�
#�
#��#�#�K�0�#��"+���"�"�;�4��'�'��4�+�

���{�M�:��.�.�{�;�H��U��U�U�J��M�M�$�
�+�
���{�,?�@��#�#�K�0�
���{�,=�>��.�.�{�;�H��U��U�U�J��M�M�%��,�
���{�C�0�$�0�0��0�G�N�F��M�M�1�6�:����W�/�/��3�g$�
#�
#�
#�s�E	F
�
F	�F	c���UO2UO2vq[U29^tt^2UOU2UO	UQ2UOU2oPOQU22oUO
QU2UO	UQ2UOU2oPOQU22oUO
QU2UO	UQ2UO[Q5vqVUOQ	U2UOQ
U2UOUO]2PPP2P!)%fhP!9h)z�
Expression results executed via _exec_in_closure() should be written
to the debugger output stream (pdb stdout), not to sys.stdout.
z(lambda: 123)()c3�P�SF �DpOQP2w�	J	P!3hr�r�rs& rrz�QPdbConnectTestCase.test_exec_in_closure_result_uses_pdb_stdout.<locals>.<genexpr>����8���8�C����B�!7�!7�8���&�123zsum(i for i in (1, 2, 3))c3�P�SF �DpOQP2w�	J	P!3hrrMrs& rrzrN�rOrP�6r~r	z
123
z
6
)r�r�rr�rr�r�rr�assertNotInr�r)rr�r�r�rHr�rVs&      r�+test_exec_in_closure_result_uses_pdb_stdout�>PdbConnectTestCase.test_exec_in_closure_result_uses_pdb_stdout�s*��
	
����#�@�@�B���
�7�
#�
#��#�#�K�0����{�,=�>��.�.�{�;�H���� L�8� L�L�J��M�M�%��,����{�,G�H��.�.�{�;�H���� L�8� L�L�J��M�M�#�z�*����{�C�0��+�+�M�+�B�I�F����Y��/����W�f�-����W�/�/��3�%$�
#�
#�
#�s�DE�E&	�E&	)r�r�r�r)r]r^r_r`rar�r�r�r�r�rrr'r2r5r9r>rIrUrbrcrds@rr�r��s^����N�6�+�Z�$�$��
44�l(4�TA4�F)�*24�h%4�N84�t4�4r"r�c�>�P
o]QHGoU![cS!h9h)F��PROCESS_VM_READV_SUPPORTED)�_remote_debuggingrY�ImportErrorrXs r�_supports_remote_attachingr\�s2��!&��
�@�&�%���
��%�%�
�s�
�	��zRemote debugging is not enabled�darwin�linux�win32z*Test only runs on Linux, Windows and MacOSz2Testing on Linux requires process_vm_readv supportc�P`�\sQsQsnQsQ
QksQsQsQsQs	Qs
Q	sUsP!)�PdbAttachTestCasei�c�P�[O[O[O2UmUOO	Q2UOO]2UOO
2]*UmUO2P!r�)	r�r�r��sockr�r�r�r�r�rs&rr��PdbAttachTestCase.setUp�sf���M�M�&�.�.�&�2D�2D�E��	��	�	���'�(��	�	������I�I�)�)�+�A�.��	����r"c��[OQUOQ02o[Q*Um[UOQ29^tt^2oUO
U2PPP2P!)%fhP!9h)a`
            import socket
            import time

            def foo():
                return bar()

            def bar():
                return baz()

            def baz():
                x = 1
                # Trigger attach
                sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
                sock.connect(('127.0.0.1', a))
                sock.close()
                count = 0
                while x == 1 and count < 100:
                    count += 1
                    time.sleep(0.1)
                return x

            result = foo()
            print(f"Function returned: {result}")
            r�r�r�r�s&& rr�� PdbAttachTestCase._create_script�si�����,�-1�I�I�;�
7
�
�
��8"�$6�6���
�$�"�"�C�
(�
(�A�
�G�G�F�O�)�
(�
(�
(�s�A2�2B	�;B	c��UOO2[UO2P![cP!h9hr)rcrErr�r�rs&rr��PdbAttachTestCase.tearDown�s5���	�	����	��4�#�#�$���	��	�r�c��[O[OUO,[O
[O
P	Q5oUO
UOO2UO
UOO2UOO]
2UOO2vq4UO2[OU2o[O2o[O2oUO
UO2UO
UO2UO
UO2UO
UO2[ O"O%QU29^tt^2['U29^tt^2[)U29^tt^2[ O"O%QQQ[+UO,2,29^tt^2[ O"O%Q[.Q59^tt^2[0O22PPP2PPP2PPP2PPP2PPP2UO2UOO72oUOO72oUO8]6wc([;Q	2[;Q
U02[;QU02UO=UO8]2QQ
UO?2QUO?2-QQ
UQU--![.cSO5Q2CK	h9h)%fhCK9h)%fhCK"9h)%fhCK.9h)%fhCK:9h)%fhCKF9h)Tr�z	sys.stdinzsys.argvr��-pz"pdb.exit_with_permission_help_textr�z-Insufficient permissions for remote executionz
server failedzserver stdout:
zserver stderr:
r�r�r�rs) r�r�r�r�r�r�r�r�rEr�rc�
settimeoutr�r�r��waitr�r�r�rrr�r��PermissionErrorr��main�skipTest�readr�printr�r�)	r�client_stdinr��connrV�
client_stdout�
client_stderr�
server_stdout�
server_stderrs	&&       r�do_integration_test�%PdbAttachTestCase.do_integration_tests����"�"�
�^�^�T�-�-�.��?�?��?�?��	
��	
������,�,�-�������,�,�-�	
�	�	���R� ��)�)�"�"�$����
�
���{�{�<�0�����
�
����
�
�����*�*�+����
�+�+�,����
�+�+�,�������%�
�M�M����\�:�:��M�*�*��M�*�*��M�M���
�U�D�#�g�k�k�:J�,K�L�L��M�M���4�/�
 �
�
�
O����
�
�
M�
+�
+�
;�	�������+�+�-�
����+�+�-�
�����"��/�"��$�]�O�4�5��$�]�O�4�5�����+�+�Q�/���-�0�0�2��-�0�0�2��
��-��-��	
�		
��#�
O��
�
�M�N�
O��

�
�
��
M�L�L��
+�*�*��
+�*�*��
;�:�:�s��7O�N,	�?N
�.N�M0�M
�#N�+N
�3N,	�;O�
	M-�M-�)M0�,M-�-M0�0N�9N�;	N�N�
N�	N
�N)�!N)�#	N,	�,N=
�5N=
�7	O�O	�	O	c���[P
29^tt^2UOQ2oPPP2UOWQ*Q*P2UOUQ*Q*P2UOUQ*Q*Q2UOQUQ*Q*2UO	QUQ*Q*2P!)%fhK�9h)	F�ll
x=42
r�r�rsr��Function returned: 42
�while x == 1�)r	rxr�r�rT�r�outputs& r�%test_attach_to_process_without_colors�7PdbAttachTestCase.test_attach_to_process_without_colors@s���
��
�
��-�-�l�;�F� ������)�(�3�R�8������)�(�3�R�8������)�(�3�5N�O��
�
�n�f�X�&6�x�&@�A�������!1�(�!;�<� �
�s�C�C!	�C!	c	�4�[P	29^tt^2UOQ2oPPP2UOWQ*Q*P2UOUQ*Q*P2UOUQ*Q*Q2UOQUQ*Q*2UO	QUQ*Q*2UOQ[
OQ	PUQ*Q*22P!)%fhK�9h)
Tr{r�r�rsr�r|r~r}z[^m]*m)r	rxr�r�rT�re�subrs& r�"test_attach_to_process_with_colors�4PdbAttachTestCase.test_attach_to_process_with_colorsJs���
��
�
��-�-�l�;�F�������)�(�3�R�8������)�(�3�R�8������)�(�3�5N�O��
�
�f�f�X�.�x�8�9�������)9�(�)C�D��
�
�n�b�f�f�\�2�v�h�?O�PX�?Y�&Z�[��
�s�D�D	�D	c	�`�[P
29^tt^2[O[OQQQQ,P	P	Q5oPPP2UOWO]2[OQ6XcQoLQoUOV!O2P!)%fhKc9h)	Fz-mr�rj�999999)rU�capture_outputr]zKThe specified process cannot be attached to due to insufficient permissionszECannot attach to pid 999999, please make sure that the process exists)
r	r��runr�r��assertNotEqualr�platformr�r�)r�resultr�s&  r�#test_attach_to_non_existent_process�5PdbAttachTestCase.test_attach_to_non_existent_processUsz��
��
�
��^�^�S�^�^�T�5�$��$Q�X\�mq�r�F� ����F�-�-�q�1��<�<�8�#�a�E�[�E��
�
�e�]�]�+� �
�s�-B�B-	�&B-	)r�r�rcr)
r]r^r_r`r�r�r�rxr�r�r�rbrcrds@rrara�s0����� �D�9
�v=�	\�	,�	,r"ra�__main__)/r�r�rLr�r�r�r�r�r�r�r��
unittest.mock�
contextlibrrrrr�test.supportrrr	r
rr�test.support.os_helperr
r�typingrr�rr�is_remote_debug_enabled�SkipTestrr�TestCaserfrxrtr�r\r�rar]rnr5r"r�<module>r�s���	���	�	�
�
��
����[�[�i�i�1��
�&��"�"�$�$�
�
�
�:�
;�;�����'�'�Tn
��)�)�n
�bp.��)�)�p.�f��	����=�>�I4��*�*�I4�?��I4�X&�
���S�0�0�2�2�4U�V�	�������)�a�a�c�l�l�g�.E�a�a�#�,�,�Za�Ja�@�B�	�������(�M�M�1K�1M�-M�H�J�
���K,��)�)�K,���J�B�W�K,�\�z���M�M�O�r"

Youez - 2016 - github.com/yon3zu
LinuXploit