Navigation:
all content © by Mario Emmenlauer.
|
Table of ContentsUsing the GNU Debugger GDBA Sample Session with GDBThe following is a sample session using gdb: gdb /path/to/program GNU gdb 6.3.50-20050815 (Apple version gdb-962) (Sat Jul 26 08:14:40 UTC 2008) Copyright 2004 Free Software Foundation, Inc. (gdb) break malloc_error_break Breakpoint 1 at 0x1374bc6a7e31a11 (gdb) break SomeClass::~SomeClass() Breakpoint 2 at 0x1001a22e6: file ../../../../src/code/SomeClass.h, line 13. Breakpoint 3 at 0x1001a2248: file ../../../../src/code/SomeClass.h, line 13. warning: Multiple breakpoints were set. Use the "delete" command to delete unwanted breakpoints. (gdb) delete 3 (gdb) break myLicenseManager.cxx:330 Breakpoint 3 at 0xa2a9d: file ../../src/code/myLicenseManager.cxx, line 330. (gdb) run Breakpoint 1, myGraphInventor::UpdateColor (this=0x6692e00, aColor=@0x2e6c3cb0) at ../../src/myGraphInventor.cxx:639 639 std::cerr << "myGraphInventor::UpdateColor()" << std::endl; (gdb) list 634 myColor*& aColor) 638 { 639 std::cerr << "myGraphInventor::UpdateColor()" << std::endl; 640 641 // switch off color coding 642 switch (mCurrentColor) { (gdb) run Program received signal EXC_BAD_ACCESS, Could not access memory. Reason: KERN_INVALID_ADDRESS at address: 0x0000000000000001 0x00007fff8320c89c in std::string::find_last_of () (gdb) backtrace #0 0x00007fff8320c89c in std::string::find_last_of () #1 0x000000010059e3d9 in myFileTools::GetPath (aFileName=@0x1) at ../../src/myFileTools.cpp:44 #2 0x0000000103b8e646 in QAction::triggered () #3 0x0000000103b90814 in QAction::activate () #4 0x0000000103f09e6f in QAbstractButtonPrivate::click () (gdb) info threads 4 process 9011 thread 0x6647 0x00007fff83288642 in kevent () * 3 process 9011 thread 0x363f 0x00007fffffe0026d in ?? () 2 process 9011 thread 0x3a07 0x00007fff83261d02 in __semwait_signal () 1 process 9011 local thread 0x2d03 0x00007fff8320c89c in std::string::find_last_of () (gdb) thread 1 [Switching to thread 1 (process 9011 local thread 0x2d03)] 0x00007fff8320c89c in std::string::find_last_of () # using the Tab key (denoted [TAB] here) to auto-complete code lines: (gdb) break myTexture[TAB] Display all 964 possibilities? (y or n) n (gdb) break myTextureFragmentProgram[TAB] myTextureFragmentProgram.cxx myTextureFragmentProgram.h myTextureFragmentProgram::Bias(float, float) myTextureFragmentProgram::Colorize(Color const&) myTextureFragmentProgram::Disable() const myTextureFragmentProgram::Enable() const myTextureFragmentProgram::Interpolate() const myTextureFragmentProgram::Interpolate(bool) myTextureFragmentProgram::SetSource() const myTextureFragmentProgram::SetNumber(int) # use single quotation marks to enclose spaces: (gdb) break 'bpTextureFragmentProgram::Enable() const' Breakpoint 4 at 0x1003f5604: file ../../src/myTextureFragmentProgram.cxx, line 50. (gdb) quit The program is running. Exit anyway? (y or n) y Collection of CommandsA nice collection of commonly used GDB commands can be found here: http://www.yolinux.com/TUTORIALS/GDB-Commands.html
|