Python

GDB를 사용한 C API 확장 및 CPython 내부 구조 디버깅

이 문서는 파이썬 GDB 확장인 python-gdb.py 를 GDB 디버거와 함께 사용하여 CPython 확장 및 CPython 인터프리터 자체를 디버깅하는 방법을 설명합니다.

충돌이나 교착 상태(deadlock)와 같은 로우 레벨 문제를 디버깅할 때 GDB와 같은 로우 레벨 디버거가 문제 진단 및 수정에 유용합니다. 기본적으로 GDB(또는 그 프론트엔드들)는 CPython 인터프리터 특유의 하이 레벨 정보를 지원하지 않습니다.

python-gdb.py 확장은 GDB에 CPython 인터프리터 정보를 추가합니다. 이 확장은 현재 실행 중인 파이썬 함수의 스택을 조사하는 데 도움을 줍니다. PyObject* 포인터로 표현된 파이썬 객체가 주어지면, 확장 기능은 해당 객체의 타입과 값을 표시합니다.

CPython 확장을 개발하거나 C로 작성된 CPython의 일부를 수정하는 개발자는 이 문서를 통해 GDB와 python-gdb.py 확장 기능을 함께 사용하는 방법을 배울 수 있습니다.

참고

이 문서는 독자가 GDB의 기본 사항과 CPython C API에 익숙하다고 가정합니다. 이 문서는 devguidePython wiki 에서 제공하는 안내를 통합한 것입니다.

사전 요구 사항

다음이 필요합니다:

  • GDB 7 이상 버전이 필요합니다. (더 이전 버전의 GDB를 사용하는 경우, Python 3.11 이하 소스 코드의 Misc/gdbinit 을 참조하십시오.)

  • 파이썬 및 디버깅 중인 모든 확장 프로그램에 대한 GDB 호환 디버깅 정보가 필요합니다.

  • python-gdb.py 확장 기능이 필요합니다.

해당 확장은 파이썬과 함께 빌드되지만 별도로 배포되거나 포함되지 않을 수 있습니다. 아래에는 몇 가지 일반적인 시스템에 대한 예시 팁을 포함합니다. 지침이 사용자의 시스템과 일치하더라도 최신 정보가 아닐 수 있음에 유의하십시오.

소스에서 빌드한 파이썬을 사용하는 경우의 설정

소스에서 CPython을 빌드할 때 디버깅 정보를 사용할 수 있어야 하며, 빌드 과정에서 리포지토리 루트 디렉토리에 python-gdb.py 파일이 추가되어야 합니다.

기능을 활성화하려면 python-gdb.py 가 포함된 디렉토리를 GDB의 “auto-load-safe-path”에 추가해야 합니다. 이를 수행하지 않은 경우, 최신 버전의 GDB는 이 방법을 안내하는 경고 메시지를 출력합니다.

참고

사용 중인 GDB 버전용 지침이 표시되지 않으면 설정 파일(~/.gdbinit 또는 ~/.config/gdb/gdbinit)에 다음 내용을 추가하십시오:

add-auto-load-safe-path /path/to/cpython

또한 : 로 구분하여 여러 경로를 추가할 수 있습니다.

리눅스 배포판의 파이썬을 사용하는 경우의 설정

대부분의 리눅스 시스템은 python-debuginfo, python-dbg 또는 유사한 이름의 패키지에서 시스템 파이썬에 대한 디버그 정보를 제공합니다. 예:

  • Fedora:

    sudo dnf install gdb
    sudo dnf debuginfo-install python3
    
  • Ubuntu:

    sudo apt install gdb python3-dbg
    

몇몇 최신 리눅스 시스템에서 GDB는 debuginfod 를 사용하여 디버깅 심볼을 자동으로 다운로드할 수 있습니다. 그러나 이 방식은 python-gdb.py 확장을 설치하지 않으므로, 일반적으로 디버그 정보 패키지를 별도로 설치해야 합니다.

디버그 빌드 및 개발 모드 사용

더 쉬운 디버깅을 위해 다음 설정을 고려할 수 있습니다:

  • 파이썬의 디버그 빌드 를 사용하십시오. (소스에서 빌드할 때는 configure --with-pydebug 를 사용하고, 리눅스 배포판에서는 가능하면 python-debug 또는 python-dbg 와 같은 패키지를 설치하여 실행하십시오.)

  • 런타임 개발 모드 (-X dev)를 사용하십시오.

두 방식 모두 추가적인 어서션을 활성화하고 일부 최적화를 비활성화합니다. 때로는 이로 인해 찾으려는 버그가 숨겨질 수도 있지만, 대부분의 경우 프로세스가 더 수월해집니다.

python-gdb 확장 사용

확장 기능이 로드되면 두 가지 주요 기능을 제공합니다. 파이썬 값에 대한 프리티 프린터와 추가 명령입니다.

프리티 프린터

이 확장 기능이 활성화되었을 때의 GDB 백트레이스 모습(생략됨)은 다음과 같습니다:

#0  0x000000000041a6b1 in PyObject_Malloc (nbytes=Cannot access memory at address 0x7fffff7fefe8
) at Objects/obmalloc.c:748
#1  0x000000000041b7c0 in _PyObject_DebugMallocApi (id=111 'o', nbytes=24) at Objects/obmalloc.c:1445
#2  0x000000000041b717 in _PyObject_DebugMalloc (nbytes=24) at Objects/obmalloc.c:1412
#3  0x000000000044060a in _PyUnicode_New (length=11) at Objects/unicodeobject.c:346
#4  0x00000000004466aa in PyUnicodeUCS2_DecodeUTF8Stateful (s=0x5c2b8d "__lltrace__", size=11, errors=0x0, consumed=
    0x0) at Objects/unicodeobject.c:2531
#5  0x0000000000446647 in PyUnicodeUCS2_DecodeUTF8 (s=0x5c2b8d "__lltrace__", size=11, errors=0x0)
    at Objects/unicodeobject.c:2495
#6  0x0000000000440d1b in PyUnicodeUCS2_FromStringAndSize (u=0x5c2b8d "__lltrace__", size=11)
    at Objects/unicodeobject.c:551
#7  0x0000000000440d94 in PyUnicodeUCS2_FromString (u=0x5c2b8d "__lltrace__") at Objects/unicodeobject.c:569
#8  0x0000000000584abd in PyDict_GetItemString (v=
    {'Yuck': <type at remote 0xad4730>, '__builtins__': <module at remote 0x7ffff7fd5ee8>, '__file__': 'Lib/test/crashers/nasty_eq_vs_dict.py', '__package__': None, 'y': <Yuck(i=0) at remote 0xaacd80>, 'dict': {0: 0, 1: 1, 2: 2, 3: 3}, '__name__': '__main__', 'z': <Yuck(i=0) at remote 0xaace60>, '__doc__': None}, key=
    0x5c2b8d "__lltrace__") at Objects/dictobject.c:2171

PyDict_GetItemString 의 딕셔너리 인자가 불투명한 PyObject * 포인터가 아니라 그 값의 repr() 로 표시되는 것을 확인하십시오.

해당 확장은 PyObject * 타입의 값에 대해 사용자 정의 인쇄 루틴을 제공하는 방식으로 작동합니다. 객체의 더 낮은 수준의 상세 정보에 접근해야 하는 경우, 값을 해당 유형의 포인터로 캐스팅하십시오. 예:

(gdb) p globals
$1 = {'__builtins__': <module at remote 0x7ffff7fb1868>, '__name__':
'__main__', 'ctypes': <module at remote 0x7ffff7f14360>, '__doc__': None,
'__package__': None}

(gdb) p *(PyDictObject*)globals
$2 = {ob_refcnt = 3, ob_type = 0x3dbdf85820, ma_fill = 5, ma_used = 5,
ma_mask = 7, ma_table = 0x63d0f8, ma_lookup = 0x3dbdc7ea70
<lookdict_string>, ma_smalltable = {{me_hash = 7065186196740147912,
me_key = '__builtins__', me_value = <module at remote 0x7ffff7fb1868>},
{me_hash = -368181376027291943, me_key = '__name__',
me_value ='__main__'}, {me_hash = 0, me_key = 0x0, me_value = 0x0},
{me_hash = 0, me_key = 0x0, me_value = 0x0},
{me_hash = -9177857982131165996, me_key = 'ctypes',
me_value = <module at remote 0x7ffff7f14360>},
{me_hash = -8518757509529533123, me_key = '__doc__', me_value = None},
{me_hash = 0, me_key = 0x0, me_value = 0x0}, {
  me_hash = 6614918939584953775, me_key = '__package__', me_value = None}}}

프리티 프린터는 실제로 repr() 을 호출하지 않습니다. 기본 타입의 경우, 그 결과와 가깝게 일치하도록 표시합니다.

혼란을 줄 수 있는 부분은 일부 타입의 사용자 정의 프린터가 GDB의 표준 타입용 기본 프린터와 매우 유사하게 보인다는 점입니다. 예를 들어, 파이썬 int (PyLongObject*)를 위한 프리티 프린터는 일반적인 머신 레벨 정수와 구별할 수 없는 형태를 제공합니다:

(gdb) p some_machine_integer
$3 = 42

(gdb) p some_python_integer
$4 = 42

내부 구조는 PyLongObject* 로 캐스트하여 확인할 수 있습니다:

(gdb) p *(PyLongObject*)some_python_integer
$5 = {ob_base = {ob_base = {ob_refcnt = 8, ob_type = 0x3dad39f5e0}, ob_size = 1},
ob_digit = {42}}

str 유형에서도 비슷한 혼란이 발생할 수 있는데, 출력 결과가 GDB의 char * 용 내장 프린터와 매우 비슷하기 때문입니다:

(gdb) p ptr_to_python_str
$6 = '__builtins__'

str 인스턴스에 대한 프리티 프린터는 기본적으로 홑따옴표를 사용하며(파이썬의 문자열 repr``과 동일), 반면 ``char * 값에 대한 표준 프린터는 쌍따옴표를 사용하고 16진수 주소를 포함합니다:

(gdb) p ptr_to_char_star
$7 = 0x6d72c0 "hello world"

마찬가지로 구현 세부 사항은 PyUnicodeObject* 로 캐스팅하여 확인할 수 있습니다:

(gdb) p *(PyUnicodeObject*)$6
$8 = {ob_base = {ob_refcnt = 33, ob_type = 0x3dad3a95a0}, length = 12,
str = 0x7ffff2128500, hash = 7065186196740147912, state = 1, defenc = 0x0}

py-list

확장 기능은 py-list 명령을 추가하며, 이 명령은 선택한 스레드의 현재 프레임에 대한 파이썬 소스 코드(있는 경우)를 나열합니다. 현재 줄은 “>”로 표시됩니다.

(gdb) py-list
 901        if options.profile:
 902            options.profile = False
 903            profile_me()
 904            return
 905
>906        u = UI()
 907        if not u.quit:
 908            try:
 909                gtk.main()
 910            except KeyboardInterrupt:
 911                # properly quit on a keyboard interrupt...

파이썬 소스 내의 다른 줄 번호부터 목록을 표시하려면 py-list START 를 사용하고, 파이썬 소스의 특정 범위의 줄을 표시하려면 py-list START,END 를 사용하십시오.

py-uppy-down

py-uppy-down 명령은 GDB의 일반적인 updown 과 유사하지만, C 프레임이 아닌 CPython 프레임 수준에서 이동을 시도합니다.

GDB가 관련 프레임 정보를 읽을 수 있는지 여부는 CPython이 어떤 최적화 수준으로 컴파일되었는지에 따라 다릅니다. 내부적으로 명령은 기본 프레임 평가 함수(즉, CPython 내의 핵심 바이트코드 인터프리터 루프)를 실행하는 C 프레임을 찾아 관련 PyFrameObject * 의 값을 조회합니다.

이들은 해당 스레드 내에서(C 수준의) 프레임 번호를 출력합니다.

예를 들면

(gdb) py-up
#37 Frame 0x9420b04, for file /usr/lib/python2.6/site-packages/
gnome_sudoku/main.py, line 906, in start_game ()
    u = UI()
(gdb) py-up
#40 Frame 0x948e82c, for file /usr/lib/python2.6/site-packages/
gnome_sudoku/gnome_sudoku.py, line 22, in start_game(main=<module at remote 0xb771b7f4>)
    main.start_game()
(gdb) py-up
Unable to find an older python frame

따라서 우리는 파이썬 스택의 상단에 있게 됩니다.

프레임 번호는 GDB의 표준 backtrace 명령에 의해 표시되는 번호와 일치합니다. 이 명령은 파이썬 코드를 실행하지 않는 C 프레임을 건너뜁니다.

다시 아래로 이동하면:

(gdb) py-down
#37 Frame 0x9420b04, for file /usr/lib/python2.6/site-packages/gnome_sudoku/main.py, line 906, in start_game ()
    u = UI()
(gdb) py-down
#34 (unable to read python frame information)
(gdb) py-down
#23 (unable to read python frame information)
(gdb) py-down
#19 (unable to read python frame information)
(gdb) py-down
#14 Frame 0x99262ac, for file /usr/lib/python2.6/site-packages/gnome_sudoku/game_selector.py, line 201, in run_swallowed_dialog (self=<NewOrSavedGameSelector(new_game_model=<gtk.ListStore at remote 0x98fab44>, puzzle=None, saved_games=[{'gsd.auto_fills': 0, 'tracking': {}, 'trackers': {}, 'notes': [], 'saved_at': 1270084485, 'game': '7 8 0 0 0 0 0 5 6 0 0 9 0 8 0 1 0 0 0 4 6 0 0 0 0 7 0 6 5 0 0 0 4 7 9 2 0 0 0 9 0 1 0 0 0 3 9 7 6 0 0 0 1 8 0 6 0 0 0 0 2 8 0 0 0 5 0 4 0 6 0 0 2 1 0 0 0 0 0 4 5\n7 8 0 0 0 0 0 5 6 0 0 9 0 8 0 1 0 0 0 4 6 0 0 0 0 7 0 6 5 1 8 3 4 7 9 2 0 0 0 9 0 1 0 0 0 3 9 7 6 0 0 0 1 8 0 6 0 0 0 0 2 8 0 0 0 5 0 4 0 6 0 0 2 1 0 0 0 0 0 4 5', 'gsd.impossible_hints': 0, 'timer.__absolute_start_time__': <float at remote 0x984b474>, 'gsd.hints': 0, 'timer.active_time': <float at remote 0x984b494>, 'timer.total_time': <float at remote 0x984b464>}], dialog=<gtk.Dialog at remote 0x98faaa4>, saved_game_model=<gtk.ListStore at remote 0x98fad24>, sudoku_maker=<SudokuMaker(terminated=False, played=[], batch_siz...(truncated)
            swallower.run_dialog(self.dialog)
(gdb) py-down
#11 Frame 0x9aead74, for file /usr/lib/python2.6/site-packages/gnome_sudoku/dialog_swallower.py, line 48, in run_dialog (self=<SwappableArea(running=<gtk.Dialog at remote 0x98faaa4>, main_page=0) at remote 0x98fa6e4>, d=<gtk.Dialog at remote 0x98faaa4>)
            gtk.main()
(gdb) py-down
#8 (unable to read python frame information)
(gdb) py-down
Unable to find a newer python frame

파이썬 스택의 하단에 도달하게 됩니다.

Python 3.12 이후 버전부터는 동일한 C 스택 프레임이 여러 파이썬 스택 프레임에 사용될 수 있음에 유의하십시오. 이는 py-uppy-down 이 한 번에 여러 파이썬 프레임을 이동시킬 수 있음을 의미합니다. 예:

(gdb) py-up
#6 Frame 0x7ffff7fb62b0, for file /tmp/rec.py, line 5, in recursive_function (n=0)
   time.sleep(5)
#6 Frame 0x7ffff7fb6240, for file /tmp/rec.py, line 7, in recursive_function (n=1)
   recursive_function(n-1)
#6 Frame 0x7ffff7fb61d0, for file /tmp/rec.py, line 7, in recursive_function (n=2)
   recursive_function(n-1)
#6 Frame 0x7ffff7fb6160, for file /tmp/rec.py, line 7, in recursive_function (n=3)
   recursive_function(n-1)
#6 Frame 0x7ffff7fb60f0, for file /tmp/rec.py, line 7, in recursive_function (n=4)
   recursive_function(n-1)
#6 Frame 0x7ffff7fb6080, for file /tmp/rec.py, line 7, in recursive_function (n=5)
   recursive_function(n-1)
#6 Frame 0x7ffff7fb6020, for file /tmp/rec.py, line 9, in <module> ()
   recursive_function(5)
(gdb) py-up
Unable to find an older python frame

py-bt

py-bt 명령은 현재 스레드에 대한 파이썬 수준의 백트레이스를 표시하려고 시도합니다.

예를 들면

(gdb) py-bt
#8 (unable to read python frame information)
#11 Frame 0x9aead74, for file /usr/lib/python2.6/site-packages/gnome_sudoku/dialog_swallower.py, line 48, in run_dialog (self=<SwappableArea(running=<gtk.Dialog at remote 0x98faaa4>, main_page=0) at remote 0x98fa6e4>, d=<gtk.Dialog at remote 0x98faaa4>)
            gtk.main()
#14 Frame 0x99262ac, for file /usr/lib/python2.6/site-packages/gnome_sudoku/game_selector.py, line 201, in run_swallowed_dialog (self=<NewOrSavedGameSelector(new_game_model=<gtk.ListStore at remote 0x98fab44>, puzzle=None, saved_games=[{'gsd.auto_fills': 0, 'tracking': {}, 'trackers': {}, 'notes': [], 'saved_at': 1270084485, 'game': '7 8 0 0 0 0 0 5 6 0 0 9 0 8 0 1 0 0 0 4 6 0 0 0 0 7 0 6 5 0 0 0 4 7 9 2 0 0 0 9 0 1 0 0 0 3 9 7 6 0 0 0 1 8 0 6 0 0 0 0 2 8 0 0 0 5 0 4 0 6 0 0 2 1 0 0 0 0 0 4 5\n7 8 0 0 0 0 0 5 6 0 0 9 0 8 0 1 0 0 0 4 6 0 0 0 0 7 0 6 5 1 8 3 4 7 9 2 0 0 0 9 0 1 0 0 0 3 9 7 6 0 0 0 1 8 0 6 0 0 0 0 2 8 0 0 0 5 0 4 0 6 0 0 2 1 0 0 0 0 0 4 5', 'gsd.impossible_hints': 0, 'timer.__absolute_start_time__': <float at remote 0x984b474>, 'gsd.hints': 0, 'timer.active_time': <float at remote 0x984b494>, 'timer.total_time': <float at remote 0x984b464>}], dialog=<gtk.Dialog at remote 0x98faaa4>, saved_game_model=<gtk.ListStore at remote 0x98fad24>, sudoku_maker=<SudokuMaker(terminated=False, played=[], batch_siz...(truncated)
            swallower.run_dialog(self.dialog)
#19 (unable to read python frame information)
#23 (unable to read python frame information)
#34 (unable to read python frame information)
#37 Frame 0x9420b04, for file /usr/lib/python2.6/site-packages/gnome_sudoku/main.py, line 906, in start_game ()
    u = UI()
#40 Frame 0x948e82c, for file /usr/lib/python2.6/site-packages/gnome_sudoku/gnome_sudoku.py, line 22, in start_game (main=<module at remote 0xb771b7f4>)
    main.start_game()

프레임 번호는 GDB의 표준 backtrace 명령에 의해 표시되는 번호와 일치합니다.

py-print

py-print 명령은 파이썬 이름을 조회하여 출력하려고 시도합니다. 현재 스레드 내의 로컬 변수를 먼저 확인하고, 그 다음 전역 변수(globals), 마지막으로 빌트인(builtins)을 확인합니다:

(gdb) py-print self
local 'self' = <SwappableArea(running=<gtk.Dialog at remote 0x98faaa4>,
main_page=0) at remote 0x98fa6e4>
(gdb) py-print __name__
global '__name__' = 'gnome_sudoku.dialog_swallower'
(gdb) py-print len
builtin 'len' = <built-in function len>
(gdb) py-print scarlet_pimpernel
'scarlet_pimpernel' not found

현재 C 프레임이 여러 개의 파이썬 프레임에 해당하는 경우, py-print 는 첫 번째 프레임만 고려합니다.

py-locals

py-locals 명령은 선택된 스레드의 현재 파이썬 프레임 내에 있는 모든 파이썬 로컬 변수를 찾아 그 표현을 출력합니다:

(gdb) py-locals
self = <SwappableArea(running=<gtk.Dialog at remote 0x98faaa4>,
main_page=0) at remote 0x98fa6e4>
d = <gtk.Dialog at remote 0x98faaa4>

현재 C 프레임이 여러 개의 파이썬 프레임에 해당하는 경우, 모든 프레임의 로컬 변수가 표시됩니다:

(gdb) py-locals
Locals for recursive_function
n = 0
Locals for recursive_function
n = 1
Locals for recursive_function
n = 2
Locals for recursive_function
n = 3
Locals for recursive_function
n = 4
Locals for recursive_function
n = 5
Locals for <module>

GDB 명령과 함께 사용

확장 명령은 GDB의 내장 명령을 보완합니다. 예를 들어, 다음과 같이 py-bt``에 표시된 프레임 번호를 ``frame 명령과 함께 사용하여 선택한 스레드 내의 특정 프레임으로 이동할 수 있습니다:

(gdb) py-bt
(output snipped)
#68 Frame 0xaa4560, for file Lib/test/regrtest.py, line 1548, in <module> ()
        main()
(gdb) frame 68
#68 0x00000000004cd1e6 in PyEval_EvalFrameEx (f=Frame 0xaa4560, for file Lib/test/regrtest.py, line 1548, in <module> (), throwflag=0) at Python/ceval.c:2665
2665                            x = call_function(&sp, oparg);
(gdb) py-list
1543        # Run the tests in a context manager that temporary changes the CWD to a
1544        # temporary and writable directory. If it's not possible to create or
1545        # change the CWD, the original CWD will be used. The original CWD is
1546        # available from test_support.SAVEDCWD.
1547        with test_support.temp_cwd(TESTCWD, quiet=True):
>1548            main()

info threads 명령은 프로세스 내의 스레드 목록을 보여주며, thread 명령을 사용하여 다른 스레드를 선택할 수 있습니다:

(gdb) info threads
  105 Thread 0x7fffefa18710 (LWP 10260)  sem_wait () at ../nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S:86
  104 Thread 0x7fffdf5fe710 (LWP 10259)  sem_wait () at ../nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S:86
* 1 Thread 0x7ffff7fe2700 (LWP 10145)  0x00000038e46d73e3 in select () at ../sysdeps/unix/syscall-template.S:82

thread apply all COMMAND 또는 (줄여서 t a a COMMAND)를 사용하여 모든 스레드에서 명령을 실행할 수 있습니다. py-bt 와 함께 사용하면 모든 스레드가 파이썬 수준에서 수행 중인 작업을 확인할 수 있습니다:

(gdb) t a a py-bt

Thread 105 (Thread 0x7fffefa18710 (LWP 10260)):
#5 Frame 0x7fffd00019d0, for file /home/david/coding/python-svn/Lib/threading.py, line 155, in _acquire_restore (self=<_RLock(_Verbose__verbose=False, _RLock__owner=140737354016512, _RLock__block=<thread.lock at remote 0x858770>, _RLock__count=1) at remote 0xd7ff40>, count_owner=(1, 140737213728528), count=1, owner=140737213728528)
        self.__block.acquire()
#8 Frame 0x7fffac001640, for file /home/david/coding/python-svn/Lib/threading.py, line 269, in wait (self=<_Condition(_Condition__lock=<_RLock(_Verbose__verbose=False, _RLock__owner=140737354016512, _RLock__block=<thread.lock at remote 0x858770>, _RLock__count=1) at remote 0xd7ff40>, acquire=<instancemethod at remote 0xd80260>, _is_owned=<instancemethod at remote 0xd80160>, _release_save=<instancemethod at remote 0xd803e0>, release=<instancemethod at remote 0xd802e0>, _acquire_restore=<instancemethod at remote 0xd7ee60>, _Verbose__verbose=False, _Condition__waiters=[]) at remote 0xd7fd10>, timeout=None, waiter=<thread.lock at remote 0x858a90>, saved_state=(1, 140737213728528))
            self._acquire_restore(saved_state)
#12 Frame 0x7fffb8001a10, for file /home/david/coding/python-svn/Lib/test/lock_tests.py, line 348, in f ()
            cond.wait()
#16 Frame 0x7fffb8001c40, for file /home/david/coding/python-svn/Lib/test/lock_tests.py, line 37, in task (tid=140737213728528)
                f()

Thread 104 (Thread 0x7fffdf5fe710 (LWP 10259)):
#5 Frame 0x7fffe4001580, for file /home/david/coding/python-svn/Lib/threading.py, line 155, in _acquire_restore (self=<_RLock(_Verbose__verbose=False, _RLock__owner=140737354016512, _RLock__block=<thread.lock at remote 0x858770>, _RLock__count=1) at remote 0xd7ff40>, count_owner=(1, 140736940992272), count=1, owner=140736940992272)
        self.__block.acquire()
#8 Frame 0x7fffc8002090, for file /home/david/coding/python-svn/Lib/threading.py, line 269, in wait (self=<_Condition(_Condition__lock=<_RLock(_Verbose__verbose=False, _RLock__owner=140737354016512, _RLock__block=<thread.lock at remote 0x858770>, _RLock__count=1) at remote 0xd7ff40>, acquire=<instancemethod at remote 0xd80260>, _is_owned=<instancemethod at remote 0xd80160>, _release_save=<instancemethod at remote 0xd803e0>, release=<instancemethod at remote 0xd802e0>, _acquire_restore=<instancemethod at remote 0xd7ee60>, _Verbose__verbose=False, _Condition__waiters=[]) at remote 0xd7fd10>, timeout=None, waiter=<thread.lock at remote 0x858860>, saved_state=(1, 140736940992272))
            self._acquire_restore(saved_state)
#12 Frame 0x7fffac001c90, for file /home/david/coding/python-svn/Lib/test/lock_tests.py, line 348, in f ()
            cond.wait()
#16 Frame 0x7fffac0011c0, for file /home/david/coding/python-svn/Lib/test/lock_tests.py, line 37, in task (tid=140736940992272)
                f()

Thread 1 (Thread 0x7ffff7fe2700 (LWP 10145)):
#5 Frame 0xcb5380, for file /home/david/coding/python-svn/Lib/test/lock_tests.py, line 16, in _wait ()
    time.sleep(0.01)
#8 Frame 0x7fffd00024a0, for file /home/david/coding/python-svn/Lib/test/lock_tests.py, line 378, in _check_notify (self=<ConditionTests(_testMethodName='test_notify', _resultForDoCleanups=<TestResult(_original_stdout=<cStringIO.StringO at remote 0xc191e0>, skipped=[], _mirrorOutput=False, testsRun=39, buffer=False, _original_stderr=<file at remote 0x7ffff7fc6340>, _stdout_buffer=<cStringIO.StringO at remote 0xc9c7f8>, _stderr_buffer=<cStringIO.StringO at remote 0xc9c790>, _moduleSetUpFailed=False, expectedFailures=[], errors=[], _previousTestClass=<type at remote 0x928310>, unexpectedSuccesses=[], failures=[], shouldStop=False, failfast=False) at remote 0xc185a0>, _threads=(0,), _cleanups=[], _type_equality_funcs={<type at remote 0x7eba00>: <instancemethod at remote 0xd750e0>, <type at remote 0x7e7820>: <instancemethod at remote 0xd75160>, <type at remote 0x7e30e0>: <instancemethod at remote 0xd75060>, <type at remote 0x7e7d20>: <instancemethod at remote 0xd751e0>, <type at remote 0x7f19e0...(truncated)
        _wait()