This is the mail archive of the
gdb@sources.redhat.com
mailing list for the GDB project.
Use function.line+offset to locate breakpoints
- From: Andrew Cagney <cagney at gnu dot org>
- To: gdb at sources dot redhat dot com
- Date: Tue, 09 Nov 2004 11:00:12 -0500
- Subject: Use function.line+offset to locate breakpoints
[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