
    3hh                     `    S SK r S SKrS SKJr  S SKJr  SSKJrJrJ	r	J
r
  S r " S S\5      rg)	    N)support)python_is_optimized   )setup_moduleDebuggerTestsCET_PROTECTIONSAMPLE_SCRIPTc                      [        5         g )N)r        E/opt/python-3.13.8/usr/lib/python3.13/test/test_gdb/test_backtrace.pysetUpModuler   	   s    Nr   c                      \ rS rSr\R
                  " \" 5       S5      S 5       r\R
                  " \" 5       S5      S 5       r\R
                  " \" 5       S5      \	R                  " 5       \	R                  " S5      S 5       5       5       r\R
                  " \" 5       S5      S 5       r\R
                  " \" 5       S5      S 5       rS	rg
)	PyBtTests   z&Python was compiled with optimizationsc                 R    U R                  [        S/S9nU R                  US5        g )Npy-btscriptcmds_after_breakpointaL  ^.*
Traceback \(most recent call first\):
  <built-in method id of module object .*>
  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=a, b=b, c=c\)
  File ".*gdb_sample.py", line 12, in <module>
    foo\(1, 2, 3\)
get_stack_tracer	   assertMultilineMatchesselfbts     r   test_btPyBtTests.test_bt   s6     !!9@	 " C##B%	r   c                 R    U R                  [        S/S9nU R                  US5        g )N
py-bt-fullr   aD  ^.*
#[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=a, b=b, c=c\)
#[0-9]+ Frame 0x-?[0-9a-f]+, for file .*gdb_sample.py, line 12, in <module> \(\)
    foo\(1, 2, 3\)
r   r   s     r   test_bt_fullPyBtTests.test_bt_full"   s6     !!9E " H##B%	r   cpuc                     SnU R                  US/S9nU R                  SU5        U R                  US/S9nU R                  SU5        g )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)

zthread apply all py-btr   zWaiting for the GILzthread apply all py-bt-fullr   assertInr   cmd
gdb_outputs      r   test_threadsPyBtTests.test_threads2   sg    * ))#AY@Z * \
+Z8 ))#A^@_ * a
+Z8r   c                     SnU R                  U/ SQS9nU R                  SU5        U R                  U/ SQS9nU R                  SU5        g )NzRfrom gc import collect
id(42)
def foo():
    collect()
def bar():
    foo()
bar()
)break update_refscontinuer   r%   zGarbage-collecting)r.   r/   r    r&   r(   s      r   test_gcPyBtTests.test_gcV   sc     ))#@j * ,
 	*J7 ))#@o * ,
 	*J7r   c                     [         R                  " S5      nSS/n[        (       a  UR                  S5        UR                  S5        U R	                  UUS9nU R                  US5        g )Nz
            class MyList(list):
                def __init__(self):
                    super(*[]).__init__()   # wrapper_call()

            id("first break point")
            l = MyList()
        zbreak wrapper_callr/   nextr   r%   z1<method-wrapper u?'__init__' of MyList object at )textwrapdedentr   appendr   assertRegex)r   r)   r   r*   s       r   test_wrapper_callPyBtTests.test_wrapper_callp   sx     oo   "6z B> "((0$$W- ))#@U * W
M	Or   r   N)__name__
__module____qualname____firstlineno__unittestskipIfr   r   r!   r   requires_gil_enabledrequires_resourcer+   r0   r8   __static_attributes__r   r   r   r   r      s    __(*=??$ __(*=?? __(*=?!!#u%9 & $?9@ __(*=?
8?
8* __(*=?O?Or   r   )r4   r>   testr   test.supportr   utilr   r   r   r	   r   r   r   r   r   <module>rF      s,       , L LzO zOr   