This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Fix breakpoints when several source files have the same name
- From: Sébastien Granjoux <seb dot sfo at free dot fr>
- To: gdb-patches at sourceware dot org
- Date: Sun, 24 May 2009 12:51:14 +0200
- Subject: Fix breakpoints when several source files have the same name
Hi All,
There is in gdb 6.8 a new bug that makes breakpoints inserted at the
wrong place when a program has several files with the same base name (in
different directories).
In some place, gdb checks only the base name of the file and so doesn't
find the right place for the breakpoints.
I have opened a bug report about this here:
http://sourceware.org/bugzilla/show_bug.cgi?id=9583
I have found it using the mi interface but it appears in the same way
with the other commands.
Here is a fix attached for this bug. It checks if a full name is
available and if yes uses it instead of comparing only the base name.
Regards,
Sébastien
2009-05-24 Sebastien Granjoux <seb.sfo@free.fr>
PR mi/9583:
* symtab.c (find_line_symtab): Use full filename if available
Index: gdb/symtab.c
===================================================================
RCS file: /cvs/src/src/gdb/symtab.c,v
retrieving revision 1.208
diff -u -r1.208 symtab.c
--- gdb/symtab.c 23 May 2009 10:11:42 -0000 1.208
+++ gdb/symtab.c 24 May 2009 10:24:13 -0000
@@ -2408,9 +2408,19 @@
else
best = 0;
+ /* Get symbol full file name if possible */
+ symtab_to_fullname (symtab);
+
ALL_PSYMTABS (objfile, p)
{
- if (strcmp (symtab->filename, p->filename) != 0)
+ const char *fullname;
+
+ if (symtab->fullname && (fullname = psymtab_to_fullname (p)))
+ {
+ if (FILENAME_CMP (symtab->fullname, fullname) != 0)
+ continue;
+ }
+ else if (FILENAME_CMP (symtab->filename, p->filename) != 0)
continue;
PSYMTAB_TO_SYMTAB (p);
}
@@ -2419,8 +2429,14 @@
{
struct linetable *l;
int ind;
+ const char *fullname;
- if (strcmp (symtab->filename, s->filename) != 0)
+ if (symtab->fullname && (fullname = symtab_to_fullname (s)))
+ {
+ if (FILENAME_CMP (symtab->fullname, fullname) != 0)
+ continue;
+ }
+ else if (FILENAME_CMP (symtab->filename, s->filename) != 0)
continue;
l = LINETABLE (s);
ind = find_line_common (l, line, &exact);