This is the mail archive of the gdb-patches@sourceware.org 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]

[RFA] "fix" a problem where a breakpoint would be associated with the wrong source


I ran across a problem where a breakpoint would be associated with the
wrong source.  Not every breakpoint, just some breakpoints.  And
changing the order of .o files on the link line would change which
breakpoints where affected.

A 'bad' breakpoint would give the wrong source file and line number when
it was set.  When the program was run and a bad breakpoint hit, the
wrong source would be shown by the break and by list.  But the break
would, in fact, be at the right place.

In debugging gdb, I narrowed it down (not the cause, just the failure)
to find_function_start_sal().  The call to find_pc_sect_line() was
finding the wrong sal.  I noticed that the right sal was being found
earlier during the processing done by SKIP_PROLOGUE().  There,
find_pc_sect_line() was being called with a null section argument.

This patch seems to "fix" the problem.  But I don't feel comfortable
with it.

Comments?

Index: symtab.c
===================================================================
RCS file: /cvs/src/src/gdb/symtab.c,v
retrieving revision 1.146
diff -a -u -r1.146 symtab.c
--- symtab.c    17 Dec 2005 22:34:03 -0000      1.146
+++ symtab.c    2 Feb 2006 00:57:52 -0000
@@ -2457,7 +2457,7 @@
       /* For overlays, map pc back into its mapped VMA range */
       pc = overlay_mapped_address (pc, section);
     }
-  sal = find_pc_sect_line (pc, SYMBOL_BFD_SECTION (sym), 0);
+  sal = find_pc_sect_line (pc, 0, 0);

   /* Check if SKIP_PROLOGUE left us in mid-line, and the next
      line is still part of the same function.  */
~


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