This is the mail archive of the gdb@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]