Use function.line+offset to locate breakpoints
Andrew Cagney
cagney@gnu.org
Tue Nov 9 16:06:00 GMT 2004
[suggested by RMS]
Say the user enters:
(gdb) break file.c:100
GDB stores this as {file="file.c",line==100} and then maps that onto a
breakpoint address.
When the program is restarted, GDB re-uses the same technique. Again
setting the breakpoint at {file="file.c",line==100} converted into an
address. Unfortunatly, if the source file changes, that location is no
longer correct.
RMS suggests that we, instead or in addition, store the line number of
the function containing {file,line}.
By doing that we can re-insert the breakpoint at:
new-bp-line = new-function-line
+ (old-bp-line - old-function-line)
i.e., a known offset into the function.
Doing this will make GDB robust to at least the most basic of source
code changes.
Thoughts?
Andrew
More information about the Gdb
mailing list