Suggestions for Tips and Tricks to add

This is page is just a wish list. If you want to write one (thanks!), create a new page for it, or if it's small enough maybe it's a better fit for the FAQ. Currently, links to new pages are added to HomePageUsingColumn. If we face the problem of having too many such links there that's a good problem to have :-), and we can reorganize then. Once an entry is written, please remove the entry from here.

1. Debugging a segv

2. Apropos Is Your Friend

3. GDB can't find my source files

4. Working with core files

5. Breakpoints

6. Watchpoints

7. Pretty-printers

8. python api

There's got to be some good tips and tricks here.

9. catch syscall, etc

10. ELF, DWARF

11. ABIs

12. all-stop vs non-stop

13. debugging optimized code

14. tracepoints

15. How GDB lies to you

Although GDB tries to present an accurate picture of what your program is doing, that doesn't always happen. Sometimes this is because your program has corrupted state, sometimes it's because the debugging information is missing or wrong, and (occasionally) GDB itself has bugs.

At the beginning of a function, function arguments may be reported incorrectly. You'll know this is happening because if you step by a line or two and look again, the function arguments now look correct. (This is because it usually takes multiple instructions to set up a stack frame - if you stop in the middle of this process, you'll see garbage.)

If your program scribbles on the stack, GDB will do its best, but your backtrace is not going to reflect reality. If you're lucky, you won't see anything, if you're unlucky, it will be subtly wrong.

GDB does lots of stuff behind your back. For instance, when your program raises a signal, GDB gets control for a moment, then silently lets your program continue, but the extra time delay can affect your program's behavior. Similarly for breakpoints.

16. hardcore: stack reconstruction

17. Running the inferior in another tty

It's often nice to have the inferior run in another tty from gdb. However, it's also often easiest to start the inferior from gdb (and thus from gdb's tty). GDB has a "tty" command to set the inferior tty. Plus one might be able to have a wrapper that starts the inferior in another tty.

None: TipsAndTricksTodo (last edited 2013-09-26 23:44:36 by DougEvans)

All content (C) 2008 Free Software Foundation. For terms of use, redistribution, and modification, please see the WikiLicense page.