Your IP : 216.73.216.60


Current Path : /opt/alt/python35/lib64/python3.5/test/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/test/__pycache__/test_gdb.cpython-35.opt-2.pyc



���]���
@s�ddlZddlZddlZddlZddlZddlZddlZddlZyddlZWne	k
r�dZYnXddl
mZddlm
Z
mZmZdd�Ze�\ZZZedkr�ejdeeef��ej�rejd��ejjejjej�d	�Zd
Zdd�Zed
�\ZZerwejd��edej�\ZZdekr�dZ eje ej!���dd�Z"e"�Z#dZ$Gdd�dej%�Z&Gdd�de&�Z'ej(e�d�Gdd�de&��Z)Gdd�de&�Z*Gdd�de&�Z+Gd d!�d!e&�Z,Gd"d#�d#e&�Z-d$d%�Z.e/d&kr�e.�dS)'�N)�support)�run_unittest�findfile�python_is_optimizedcCs�yRtjdddgdtjdtjdd�}|�|j�d}WdQRXWn!tk
rutjd	��YnXtjd
|�}|dkr�t	d|��|t
|jd��t
|jd
��fS)N�gdbz-nxz	--version�stdout�stderr�universal_newlinesTrzCouldn't find gdb on the pathz^GNU gdb.*?\b(\d+)\.(\d+)zunable to parse GDB version: %r��)�
subprocess�Popen�PIPE�communicate�OSError�unittest�SkipTest�re�search�	Exception�int�group)�proc�version�match�r�-/opt/alt/python35/lib64/python3.5/test_gdb.py�get_gdb_versions			
r�zFgdb versions before 7.0 didn't support python embedding. Saw %s.%s:
%sz3test_gdb only works on source builds at the moment.z
python-gdb.pyZ123cOs�|r%tjj�}|j|�nd}d}ttfdkrW|ddtf7}tj||dtj	d	tj	d
tj	d|�}|�|j
�\}}WdQRX|jdd
�|jdd
�fS)Nr�--batch�-nxr�z-iexzadd-auto-load-safe-path �stdinrr�envzutf-8�replace)rrr )rr!)�os�environ�copy�update�gdb_major_version�gdb_minor_version�checkout_hook_pathrr
rr�decode)�argsZenv_varsr#Zbase_cmdr�out�errrrr�run_gdb?s				r0z9--eval-command=python import sys; print(sys.version_info)z*gdb not built with embedded python supportz--argszauto-loading has been declinedz3gdb security settings prevent use of custom hooks: cCs[td�\}}tjd|�}|s9tjd��|jd�jd�}d|kS)Nz+--eval-command=python print(dir(gdb.Frame))z.*\[(.*)\].*z1Unable to parse output from gdb.Frame.select testr
z, z'select')r0rrrrr�split)r�_�mZ
gdb_frame_dirrrr�gdb_has_frame_selectesr4�
builtin_idc@saeZdZddedddd�Zdddd�Zdd�Zd	d
�Zdd�ZdS)
�
DebuggerTestsNFcCsDdd|ddg}ttfdkr5|dg7}|rH||7}n
|dg7}d	d
�|D�}|dtjg7}|s�|dg7}|r�|d
|g7}n|r�||g7}t|dt�\}}	|	j�}
g}d|dddf}x3|
D]+}
|
sq|
j|�s|j|
�qW|j	|g�|S)Nzset breakpoint pending yeszbreak %szset print address off�runrr!zset print entry-values no�	backtracecSsg|]}d|�qS)z--eval-command=%sr)�.0�cmdrrr�
<listcomp>�s	z1DebuggerTests.get_stack_trace.<locals>.<listcomp>z--argsz-Sz-c�PYTHONHASHSEEDzFunction "%s" not defined.z5Do you need "set solib-search-path" or "set sysroot"?zBFD: z	warning: )rr!)
r)r*�sys�
executabler0r<�
splitlines�
startswith�append�assertEqual)�self�source�script�
breakpoint�cmds_after_breakpoint�import_site�commandsr-r.r/ZerrlinesZunexpected_errlines�ignore_patterns�linerrr�get_stack_tracevs@
	





	
zDebuggerTests.get_stack_tracecCsx|pdg}|j|dtd|d|�}tjd|tj�}|se|jd||f�|jd�|fS)Nzbacktrace 1rFrGrHzO.*#0\s+builtin_id\s+\(self\=.*,\s+v=\s*(.*?)\)\s+at\s+\S*Python/bltinmodule.c.*zUnexpected gdb output: %r
%sr
)rL�
BREAKPOINT_FNrr�DOTALL�failr)rCrDrGrH�
gdb_outputr3rrr�get_gdb_repr�s		zDebuggerTests.get_gdb_reprcCs*|j|j|�dd||f�dS)N�msgz%r did not end with %r)�
assertTrue�endswith)rC�actualZexp_endrrr�assertEndsWith�szDebuggerTests.assertEndsWithcCs<tj||tj�}|s8|jdd||f�dS)NrRz%r did not match %r)rrrNrO)rCrU�patternr3rrr�assertMultilineMatches�sz$DebuggerTests.assertMultilineMatchescCs
td�S)Nz
gdb_sample.py)r)rCrrr�get_sample_scriptszDebuggerTests.get_sample_script)	�__name__�
__module__�__qualname__rMrLrQrVrXrYrrrrr6rsdr6c@sreZdZdd�Zddd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�Zd2d3�Zd4d5�Zd6d7�Zd8d9�Zd:d;�ZdS)<�PrettyPrintTestscCs&|jd�}|jt|k�dS)Nzid(42))rLrSrM)rCrPrrr�test_getting_backtracesz'PrettyPrintTests.test_getting_backtraceNcCsY|jdt|�d�\}}|s5t|�}|j||d|||f�dS)Nzid(�)z1%r did not equal expected %r; full output was:
%s)rQ�ascii�reprrB)rC�valZexp_repr�gdb_reprrPrrr�
assertGdbReprs#zPrettyPrintTests.assertGdbReprcCsE|jd�|jd�|jd�|jd�|jd�dS)N�*rrlJ)�l�I�5i����l�����I�5)rd)rCrrr�test_ints




zPrettyPrintTests.test_intcCs+|jd�|jd�|jd�dS)NTF)rd)rCrrr�test_singletonss

z PrettyPrintTests.test_singletonscCsC|ji�|jddid�|jddddid�dS)N�foo�barz{'foo': 'bar'}Zdouglasrez{'douglas': 42, 'foo': 'bar'})rd)rCrrr�
test_dicts#s
zPrettyPrintTests.test_dictscCs*|jg�|jttd���dS)N�)rd�list�range)rCrrr�
test_lists)s
zPrettyPrintTests.test_listscCsk|jd�|jd�|jd�|jd�|jd�|jtdd�td�D���dS)	N�s(And now for something hopefully the sames7string with embedded NUL here  and then some more texts7this is a tab:	 this is a slash-N:
 this is a slash-R:
s!this is byte 255:� and byte 128:�cSsg|]}|�qSrr)r9�brrrr;:s	z/PrettyPrintTests.test_bytes.<locals>.<listcomp>�)rd�bytesrm)rCrrr�
test_bytes.s




zPrettyPrintTests.test_bytescsptj����fdd�}�jd��jd��jd�|d�|d�|td��dS)	NcsSy|j��d}Wn(tk
rA�j|t|��YnX�j|�dS)NT)�encode�UnicodeEncodeErrorrdr`)�text�	printable)�encodingrCrr�
check_repr?s


z1PrettyPrintTests.test_strings.<locals>.check_repr�z(And now for something hopefully the samez7string with embedded NUL here  and then some more textu☠u文字化けi!�)�locale�getpreferredencodingrd�chr)rCryr)rxrCr�test_strings<s	




zPrettyPrintTests.test_stringscCs4|jt�d�|jdd�|jd�dS)	Nz()r
z(1,)rhri�baz)r
)rhrir)rd�tuple)rCrrr�test_tuples\szPrettyPrintTests.test_tuplescCs�ttfdkr|jd�|jt�d�|jtddg�d�|jtdd	d
g�d�|jd�\}}|j|d
�dS)Nr�z.pretty-printing of sets needs gdb 7.3 or laterzset()�arpz
{'a', 'b'}r!rk�z	{4, 5, 6}z&s = set(['a','b'])
s.remove('a')
id(s)z{'b'})rr�)r)r*�skipTestrd�setrQrB)rCrcrPrrr�	test_setsbs
zPrettyPrintTests.test_setscCsqttfdkr|jd�|jt�d�|jtddg�d�|jtdd	d
g�d�dS)
Nrr�z4pretty-printing of frozensets needs gdb 7.3 or laterzfrozenset()r�rpzfrozenset({'a', 'b'})r!rkr�zfrozenset({4, 5, 6}))rr�)r)r*r�rd�	frozenset)rCrrr�test_frozensetsqs

z PrettyPrintTests.test_frozensetscCsN|jd�\}}|j|d�|jd�\}}|j|d�dS)NzR
try:
    raise RuntimeError("I am an error")
except RuntimeError as e:
    id(e)
zRuntimeError('I am an error',)z=
try:
    a = 1 / 0
except ZeroDivisionError as e:
    id(e)
z&ZeroDivisionError('division by zero',))rQrB)rCrcrPrrr�test_exceptionsys		z PrettyPrintTests.test_exceptionscCsB|jd�\}}tjd|�}|j|dd|�dS)Nz8
class Foo:
    pass
foo = Foo()
foo.an_int = 42
id(foo)z*<Foo\(an_int=42\) at remote 0x-?[0-9a-f]+>rRz'Unexpected new-style class rendering %r)rQrrrS)rCrcrPr3rrr�test_modern_class�s
z"PrettyPrintTests.test_modern_classcCsB|jd�\}}tjd|�}|j|dd|�dS)NzO
class Foo(list):
    pass
foo = Foo()
foo += [1, 2, 3]
foo.an_int = 42
id(foo)z*<Foo\(an_int=42\) at remote 0x-?[0-9a-f]+>rRz'Unexpected new-style class rendering %r)rQrrrS)rCrcrPr3rrr�test_subclassing_list�s
z&PrettyPrintTests.test_subclassing_listcCsB|jd�\}}tjd|�}|j|dd|�dS)NzH
class Foo(tuple):
    pass
foo = Foo((1, 2, 3))
foo.an_int = 42
id(foo)z*<Foo\(an_int=42\) at remote 0x-?[0-9a-f]+>rRz'Unexpected new-style class rendering %r)rQrrrS)rCrcrPr3rrr�test_subclassing_tuple�s
z'PrettyPrintTests.test_subclassing_tuplec	Cs�|r|dg}n	dg}|j|d|�\}}|rO||krOdSd}tj||�}|s�|jd||f�dS)Nr8rGz<.* at remote 0x-?[0-9a-f]+>z$Unexpected gdb representation: %r
%s)rQrrrO)	rCrDZ
corruption�expreprrGrcrPrWr3rrr�
assertSane�s		zPrettyPrintTests.assertSanecCs5|jddddg�\}}|j|d�dS)Nzid(42)rGzset variable v=0r8Z0x0)rQrB)rCrcrPrrr�
test_NULL_ptr�szPrettyPrintTests.test_NULL_ptrcCs|jdd�dS)Nzid(42)zset v->ob_type=0)r�)rCrrr�test_NULL_ob_type�s	z"PrettyPrintTests.test_NULL_ob_typecCs|jdddd�dS)Nzid(42)zset v->ob_type=0xDEADBEEFr��42)r�)rCrrr�test_corrupt_ob_type�s	z%PrettyPrintTests.test_corrupt_ob_typecCs|jdddd�dS)Nzid(42)zset v->ob_type->tp_flags=0x0r�r�)r�)rCrrr�test_corrupt_tp_flags�s	z&PrettyPrintTests.test_corrupt_tp_flagscCs|jdddd�dS)Nzid(42)z"set v->ob_type->tp_name=0xDEADBEEFr�r�)r�)rCrrr�test_corrupt_tp_name�s	z%PrettyPrintTests.test_corrupt_tp_namecCsH|jddd�\}}tjd|�}|j|dd|�dS)Nzid(__builtins__.help)rHTz!<_Helper at remote 0x-?[0-9a-f]+>rRzUnexpected rendering %r)rQrrrS)rCrcrPr3rrr�test_builtins_help�sz#PrettyPrintTests.test_builtins_helpcCsN|jd�\}}|j|d�|jd�\}}|j|d�dS)Nz#a = [3, 4, 5] ; a.append(a) ; id(a)z[3, 4, 5, [...]]z-a = [3, 4, 5] ; b = [a] ; a.append(b) ; id(a)z[3, 4, 5, [[...]]])rQrB)rCrcrPrrr�test_selfreferential_listsz*PrettyPrintTests.test_selfreferential_listcCs)|jd�\}}|j|d�dS)Nz-a = {} ; b = {'bar':a} ; a['foo'] = b ; id(a)z{'foo': {'bar': {...}}})rQrB)rCrcrPrrr�test_selfreferential_dictsz*PrettyPrintTests.test_selfreferential_dictcCs?|jd�\}}|jtjd|�d||f�dS)Nz:
class Foo:
    pass
foo = Foo()
foo.an_attr = foo
id(foo)z1<Foo\(an_attr=<\.\.\.>\) at remote 0x-?[0-9a-f]+>z$Unexpected gdb representation: %r
%s)rQrSrr)rCrcrPrrr�'test_selfreferential_old_style_instancesz8PrettyPrintTests.test_selfreferential_old_style_instancecCsz|jd�\}}|jtjd|�d||f�|jd�\}}|jtjd|�d||f�dS)NzB
class Foo(object):
    pass
foo = Foo()
foo.an_attr = foo
id(foo)z1<Foo\(an_attr=<\.\.\.>\) at remote 0x-?[0-9a-f]+>z$Unexpected gdb representation: %r
%szR
class Foo(object):
    pass
a = Foo()
b = Foo()
a.an_attr = b
b.an_attr = a
id(a)zZ<Foo\(an_attr=<Foo\(an_attr=<\.\.\.>\) at remote 0x-?[0-9a-f]+>\) at remote 0x-?[0-9a-f]+>)rQrSrr)rCrcrPrrr�'test_selfreferential_new_style_instance sz8PrettyPrintTests.test_selfreferential_new_style_instancecCsI|jd�\}}|j|d�|jt|�dtd��dS)Nzid(list(range(1000)))a[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226...(truncated)iz...(truncated))rQrB�len)rCrcrPrrr�test_truncation;s
	z PrettyPrintTests.test_truncationcCs?|jd�\}}|jtjd|�d||f�dS)Nz$import sys; id(sys.stdout.readlines)zO<built-in method readlines of _io.TextIOWrapper object at remote 0x-?[0-9a-f]+>z$Unexpected gdb representation: %r
%s)rQrSrr)rCrcrPrrr�test_builtin_methodWs
z$PrettyPrintTests.test_builtin_methodcCsN|jdddddg�}|jtjd|tj�d||f�dS)Nz:
def foo(a, b, c):
    pass

foo(3, 4, 5)
id(foo.__code__)rFr5rGz:print (PyFrameObject*)(((PyCodeObject*)v)->co_zombieframe)zM.*\s+\$1 =\s+Frame 0x-?[0-9a-f]+, for file <string>, line 3, in foo \(\)\s+.*z$Unexpected gdb representation: %r
%s)rLrSrrrN)rCrPrrr�test_frames^s	zPrettyPrintTests.test_frames) rZr[r\r^rdrfrgrjrnrsr~r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrr]s:
 


r]z&Python was compiled with optimizationsc@s@eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�PyListTestscCs|j||�dS)N)rV)rCZexpectedrUrrr�
assertListingpszPyListTests.assertListingcCs5|jd|j�ddg�}|jd|�dS)NrErGzpy-listz�   5    
   6    def bar(a, b, c):
   7        baz(a, b, c)
   8    
   9    def baz(*args):
 >10        id(42)
  11    
  12    foo(1, 2, 3)
)rLrYr�)rC�btrrr�test_basic_commandss	zPyListTests.test_basic_commandcCs5|jd|j�ddg�}|jd|�dS)NrErGz	py-list 9zI   9    def baz(*args):
 >10        id(42)
  11    
  12    foo(1, 2, 3)
)rLrYr�)rCr�rrr�test_one_abs_arg�s	zPyListTests.test_one_abs_argcCs5|jd|j�ddg�}|jd|�dS)NrErGzpy-list 1,3zR   1    # Sample script for use by test_gdb.py
   2    
   3    def foo(a, b, c):
)rLrYr�)rCr�rrr�test_two_abs_args�s	zPyListTests.test_two_abs_argsN)rZr[r\r�r�r�r�rrrrr�msr�c@s�eZdZejed�eje�d�dd���Zejed�dd��Z	ejed�dd��Z
ejed�eje�d�d	d
���ZdS)�StackNavigationTestsz$test requires py-up/py-down commandsz&Python was compiled with optimizationscCs5|jd|j�ddg�}|j|d�dS)NrErGzpy-upzp^.*
#[0-9]+ Frame 0x-?[0-9a-f]+, for file .*gdb_sample.py, line 7, in bar \(a=1, b=2, c=3\)
    baz\(a, b, c\)
$)rLrYrX)rCr�rrr�test_pyup_command�s	z&StackNavigationTests.test_pyup_commandcCs5|jd|j�ddg�}|j|d�dS)NrErGzpy-downz$Unable to find a newer python frame
)rLrYrV)rCr�rrr�test_down_at_bottom�s	z(StackNavigationTests.test_down_at_bottomcCs9|jd|j�ddgd�}|j|d�dS)NrErGzpy-upr!z%Unable to find an older python frame
)rLrYrV)rCr�rrr�test_up_at_top�s	z#StackNavigationTests.test_up_at_topcCs8|jd|j�dddg�}|j|d�dS)NrErGzpy-upzpy-downz�^.*
#[0-9]+ Frame 0x-?[0-9a-f]+, for file .*gdb_sample.py, line 7, in bar \(a=1, b=2, c=3\)
    baz\(a, b, c\)
#[0-9]+ Frame 0x-?[0-9a-f]+, for file .*gdb_sample.py, line 10, in baz \(args=\(1, 2, 3\)\)
    id\(42\)
$)rLrYrX)rCr�rrr�test_up_then_down�s	z&StackNavigationTests.test_up_then_downN)rZr[r\r�
skipUnless�HAS_PYUP_PYDOWN�skipIfrr�r�r�r�rrrrr��sr�c@s�eZdZeje�d�dd��Zeje�d�dd��Zeje	d�dd��Z
eje�d�eje	d�d	d
���Zeje�d�eje	d�dd���Zd
S)�	PyBtTestsz&Python was compiled with optimizationscCs5|jd|j�ddg�}|j|d�dS)NrErGzpy-bta^.*
Traceback \(most recent call first\):
  File ".*gdb_sample.py", line 10, in baz
    id\(42\)
  File ".*gdb_sample.py", line 7, in bar
    baz\(a, b, c\)
  File ".*gdb_sample.py", line 4, in foo
    bar\(a, b, c\)
  File ".*gdb_sample.py", line 12, in <module>
    foo\(1, 2, 3\)
)rLrYrX)rCr�rrr�test_bt�s	zPyBtTests.test_btcCs5|jd|j�ddg�}|j|d�dS)NrErGz
py-bt-fulla>^.*
#[0-9]+ Frame 0x-?[0-9a-f]+, for file .*gdb_sample.py, line 7, in bar \(a=1, b=2, c=3\)
    baz\(a, b, c\)
#[0-9]+ Frame 0x-?[0-9a-f]+, for file .*gdb_sample.py, line 4, in foo \(a=1, b=2, c=3\)
    bar\(a, b, c\)
#[0-9]+ Frame 0x-?[0-9a-f]+, for file .*gdb_sample.py, line 12, in <module> \(\)
    foo\(1, 2, 3\)
)rLrYrX)rCr�rrr�test_bt_full�s	zPyBtTests.test_bt_fullz*Python was compiled without thread supportcCsZd}|j|ddg�}|jd|�|j|ddg�}|jd|�dS)NaN
from threading import Thread

class TestThread(Thread):
    # These threads would run forever, but we'll interrupt things with the
    # debugger
    def run(self):
        i = 0
        while 1:
             i += 1

t = {}
for i in range(4):
   t[i] = TestThread()
   t[i].start()

# Trigger a breakpoint on the main thread
id(42)

rGzthread apply all py-btzWaiting for the GILzthread apply all py-bt-full)rL�assertIn)rCr:rPrrr�test_threads�szPyBtTests.test_threadscCsfd}|j|ddddg�}|jd|�|j|ddddg�}|jd|�dS)NzRfrom gc import collect
id(42)
def foo():
    collect()
def bar():
    foo()
bar()
rGzbreak update_refs�continuezpy-btzGarbage-collectingz
py-bt-full)rLr�)rCr:rPrrr�test_gc
s	zPyBtTests.test_gccCsid}|j|dddddg�}|jd|�|j|ddddg�}|jd	|�dS)
NzLfrom time import gmtime
def foo():
    gmtime(1)
def bar():
    foo()
bar()
rFZtime_gmtimerGr�zpy-btz<built-in method gmtimez
py-bt-fullz#0 <built-in method gmtime)rLr�)rCr:rPrrr�test_pycfunction&szPyBtTests.test_pycfunctionN)
rZr[r\rr�rr�r�r��_threadr�r�r�rrrrr��s	!		r�c@s�eZdZeje�d�dd��Zeje�d�ejed�dd���Z	eje�d�dd��Z
eje�d�d	d
��ZdS)�PyPrintTestsz&Python was compiled with optimizationscCs5|jd|j�ddg�}|j|d�dS)NrErGz
py-print argsz".*\nlocal 'args' = \(1, 2, 3\)\n.*)rLrYrX)rCr�rrrr�Gs	zPyPrintTests.test_basic_commandz$test requires py-up/py-down commandscCs>|jd|j�dddddg�}|j|d�dS)NrErGzpy-upz
py-print cz
py-print bz
py-print az3.*\nlocal 'c' = 3\nlocal 'b' = 2\nlocal 'a' = 1\n.*)rLrYrX)rCr�rrr�test_print_after_upPs	z PyPrintTests.test_print_after_upcCs5|jd|j�ddg�}|j|d�dS)NrErGzpy-print __name__z&.*\nglobal '__name__' = '__main__'\n.*)rLrYrX)rCr�rrr�test_printing_globalYs	z!PyPrintTests.test_printing_globalcCs5|jd|j�ddg�}|j|d�dS)NrErGzpy-print lenzV.*\nbuiltin 'len' = <built-in method len of module object at remote 0x-?[0-9a-f]+>\n.*)rLrYrX)rCr�rrr�test_printing_builtinas	z"PyPrintTests.test_printing_builtinN)rZr[r\rr�rr�r�r�r�r�r�rrrrr�Fs!r�c@sdeZdZeje�d�dd��Zejed�eje�d�dd���Z	dS)�
PyLocalsTestsz&Python was compiled with optimizationscCs5|jd|j�ddg�}|j|d�dS)NrErGz	py-localsz.*\nargs = \(1, 2, 3\)\n.*)rLrYrX)rCr�rrrr�js	z PyLocalsTests.test_basic_commandz$test requires py-up/py-down commandscCs8|jd|j�dddg�}|j|d�dS)NrErGzpy-upz	py-localsz.*\na = 1\nb = 2\nc = 3\n.*)rLrYrX)rCr�rrr�test_locals_after_uprs	z"PyLocalsTests.test_locals_after_upN)
rZr[r\rr�rr�r�r�r�rrrrr�is
r�cCs_tjrBtdttf�x"tj�D]}td|�q*Wttt	t
ttt
�dS)NzGDB version %s.%s:� r!z    )r�verbose�printr)r*�gdb_versionr?rr]r�r�r�r�r�)rKrrr�	test_main{s	r��__main__)0r%r�pprintrr=�	sysconfigrr{r��ImportErrorZtestrZtest.supportrrrrr�r)r*r�is_python_build�path�join�dirnamer>r+r<r0Z
gdbpy_versionr2Zgdbpy_errorsrR�rstripr4r�rMZTestCaser6r]r�r�r�r�r�r�r�rZrrrr�<module>s`
	

			��h(-�#