Contents

# Tips and Tricks

- You can use breakpoints as bookmarks: Just set a breakpoint and disable it. Later, you can quickly come back to that breakpoint by double-clicking it in the breakpoint list (or select it and click View Code). Since breakpoints are persistent (i.e. KDbg remembers them across invocations of a program), you get them back next time you invoke KDbg for that particular program.
- You can display a value in the watch section in different ways by prepending gdb's format specifiers in front of the variable to display. E.g. `/x var.member` displays the `var.member` in hexadecimal notation.
- You can set breakpoints in a source files that belong to a shared library. Such breakpoints will be marked as orphaned if the program is not active. Orphaned breakpoints are not effective. In order to make them effective, the program must stop at a time when the shared library is loaded. For this it is usually sufficient to set a breakpoint in `main()`. At the time when this breakpoint is hit, the orphaned breakpoints in the shared library become effective.
- Debugging multi-threaded programs on NPTL-enabled Linux systems (kernel 2.6.x or later and glibc 2.3.x or later) may sometimes fails; gdb stops the program at unexpected instances. In this case the following may help (using bash):

      LD_ASSUME_KERNEL=2.4.19 kdbg myprogram

  I.e. you run KDbg from the command line such that the old Linuxthreads implementation is used.