Shared libraries and breakpoints

KDevelop Felhasználói Kézikönyv -Fordítás alatt: Referencia Kézikönyv a Unix operációs rendszer alatt futó KDevelop Integrált Fejlesztői Környezethez, 1.0 Verzió
Vissza | Fejezet 12. A belső nyomkövető | Tovább

# 12.4. Shared libraries and breakpoints

Shared libraries and breakpoints have a problem that has a reasonable solution. The problem is that gdb will not accept breakpoints in source that is in a shared library which has not yet been opened but will be opened via a dlopen.

The solution is to get gdb to tell us when a shared library has been opened. We do so by setting "stop-on 1". This means that when the user sets a breakpoint, we flag this breakpoint as pending, try to set the breakpoint and if gdb says it succeeded then flag it as active. If gdb is not successful then we leave the breakpoint as pending. The next instruction will always be "continue" .

This is known as "lazy breakpoints"

However, this can lead to a problem when you use the "step over" command and step over code that will load a library. This will trigger a break on the library load, and, normally the debugger would do a "continue" (ie run to the next breakpoint or the end of the code). The user, however, is expecting the program to stop at the next line, so in this situation we do not continue, but leave it at that point (which will be somewhere inside a dlopen command). This is disconcerting but cannot be helped.

Vissza | Tartalom | Tovább
The floating toolbar | Fel | Beépített CVS