Python File+Line from GDB?
Every so often I get a crash in C/C++ code cause by some function python calls. The problem is I want to know what line number+file python called before the crash, at the moment I just do this with print's, but this is tedious.
Annoyingly this crash happens when the python stack is being printed but there have been other situations when I have been debugging and wanted to know the python line number+file and where there was no python error, Any hints?
---- Here is the backtrace - at #20 or #21 the info might be available. (gdb) bt #0 0x0000000000825962 in SND_Scene::DeleteObject (this=0x18032450, pObject=0x15624320) at intern/SoundSystem/intern/SND_Scene.cpp:498 #1 0x0000000000dcd3c7 in ~KX_SoundActuator (this=0x1dc45270) at source/gameengine/Ketsji/KX_SoundActuator.cpp:76 #2 0x0000000000e704e2 in CValue::Release (this=0x1dc45270) at source/gameengine/Expressions/Value.cpp:584 #3 0x0000000000e46763 in ~SCA_IObject (this=0x18b9f940) at source/gameengine/GameLogic/SCA_IObject.cpp:71 #4 0x0000000000de9408 in ~KX_GameObject (this=0x18b9f940) at source/gameengine/Ketsji/KX_GameObject.cpp:124 #5 0x0000000000d8cffa in ~BL_DeformableGameObject (this=0x18b9f940) at source/gameengine/Converter/BL_DeformableGameObject.cpp:42 #6 0x0000000000e704e2 in CValue::Release (this=0x18b9f940) at source/gameengine/Expressions/Value.cpp:584 #7 0x0000000000d981eb in CValue::SpecialRelease (this=0x18b9f940) at source/gameengine/Expressions/Value.h:239 #8 0x0000000000d9821f in CValue::PyDestructor (P=0x18b9f948) at source/gameengine/Expressions/Value.h:243 #9 0x0000000000f6da29 in _Py_Dealloc (op=0x18b9f948) at Objects/object.c:1933 #10 0x000000000102f08d in frame_dealloc (f=0x15b361c0) at Objects/frameobject.c:416 #11 0x0000000000f6da29 in _Py_Dealloc (op=0x15b361c0) at Objects/object.c:1933 #12 0x0000000000ffa421 in tb_dealloc (tb=0x5dff240) at Python/traceback.c:34 #13 0x0000000000f6da29 in _Py_Dealloc (op=0x5dff240) at Objects/object.c:1933 #14 0x0000000000ffa3a8 in tb_dealloc (tb=0x5dff1c8) at Python/traceback.c:33 #15 0x0000000000f6da29 in _Py_Dealloc (op=0x5dff1c8) at Objects/object.c:1933 #16 0x0000000000f62706 in insertdict (mp=0x1754230, key=0x5dd3790, hash=5897959712516987849, value=0x5dff0d8) at Objects/dictobject.c:416 #17 0x0000000000f62fd5 in PyDict_SetItem (op=0x1754230, key=0x5dd3790, value=0x5dff0d8) at Objects/dictobject.c:641 #18 0x0000000000f6739f in PyDict_SetItemString (v=0x1754230, key=0x11331de "last_traceback", item=0x5dff0d8) at Objects/dictobject.c:2182 #19 0x0000000000ff7897 in PySys_SetObject (name=0x11331de "last_traceback", v=0x5dff0d8) at Python/sysmodule.c:82 #20 0x0000000000ff011a in PyErr_PrintEx (set_sys_last_vars=1) at Python/pythonrun.c:1076 #21 0x0000000000fefdcf in PyErr_Print () at Python/pythonrun.c:978 #22 0x0000000000e25d88 in SCA_PythonController::Trigger (this=0x10d6b350, logicmgr=0x126e4660) at source/gameengine/GameLogic/SCA_PythonController.cpp:309 #23 0x0000000000e3b69a in SCA_LogicManager::BeginFrame (this=0x126e4660, curtime=18.244133488337447, fixedtime=0.016666666666666666) at source/gameengine/GameLogic/SCA_LogicManager.cpp:257 #24 0x0000000000dc08f4 in KX_Scene::LogicBeginFrame (this=0x1e5afca0, curtime=18.244133488337447) at source/gameengine/Ketsji/KX_Scene.cpp:1311 #25 0x0000000000e155e5 in KX_KetsjiEngine::NextFrame (this=0x183f6ed0) at source/gameengine/Ketsji/KX_KetsjiEngine.cpp:440 #26 0x0000000000d5ccc9 in StartKetsjiShell (area=0xb0087d0, scenename=0x10d4fe72 "frank_test", maggie1=0x15a56390, sipo=0x1dc8c790, always_use_expand_framing=1) at source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp:376 #27 0x0000000000628319 in start_game () at source/blender/src/space.c:543 #28 0x000000000062e852 in winqreadview3dspace (sa=0xb0087d0, spacedata=0x1fb5f2f0, evt=0x7fffbf19e150) at source/blender/src/space.c:2464 #29 0x0000000000683170 in scrarea_do_winhandle (area=0xb0087d0, evt=0x7fffbf19e150) at source/blender/src/spacetypes.c:156 #30 0x00000000006d8244 in scrarea_dispatch_events (sa=0xb0087d0) at source/blender/src/editscreen.c:598 #31 0x00000000006d9c00 in screen_dispatch_events () at source/blender/src/editscreen.c:1224 #32 0x00000000006da67a in screenmain () at source/blender/src/editscreen.c:1508 #33 0x00000000004f45ae in main (argc=6, argv=0x7fffbf19e5a8) at source/creator/creator.c:820
On Wed, Jul 16, 2008 at 8:23 AM, Campbell Barton ideasman42@gmail.com wrote:
Every so often I get a crash in C/C++ code cause by some function python calls. The problem is I want to know what line number+file python called before the crash, at the moment I just do this with print's, but this is tedious.
Annoyingly this crash happens when the python stack is being printed but there have been other situations when I have been debugging and wanted to know the python line number+file and where there was no python error, Any hints?
Misc/gdbinit, pystack command
-- Adam Olsen, aka Rhamphoryncus
participants (2)
-
Adam Olsen
-
Campbell Barton