This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: 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: Thu, 29 Oct 2009 22:55:19 +0100
- Subject: Re: Fix breakpoints when several source files have the same name
Hi,
I have updated my patch to fix a bug which appears in gdb 6.8 that makes
breakpoints inserted at the wrong place when a program has several files
with the same base name (in different directories).
I have updated my fix to work on the latest development version, the
code has changed a bit. I have signed a copyright assignment with the
FSF for gdb.
There is a bug report opened about this here:
http://sourceware.org/bugzilla/show_bug.cgi?id=9583
Regards,
Sébastien
? .deps
? .gdbinit
? Makefile
? ada-exp.c
? ada-lex.c
? c-exp.c
? config.cache
? config.h
? config.log
? config.status
? cp-name-parser.c
? f-exp.c
? gdb
? gdbtui
? init.c
? jv-exp.c
? m2-exp.c
? objc-exp.c
? observer.h
? observer.inc
? p-exp.c
? stamp-h
? stamp-h1
? stamp-xml
? toto
? toto2
? version.c
? xml-builtin.c
? doc/Makefile
? doc/config.log
? doc/config.status
? gdbserver/Makefile
? gdbserver/config.h
? gdbserver/config.log
? gdbserver/config.status
? gdbserver/gdbreplay
? gdbserver/gdbserver
? gdbserver/reg-i386-linux.c
? gdbserver/stamp-h
? gdbserver/version.c
? gnulib/.deps
? gnulib/Makefile
? gnulib/string.h
? testsuite/Makefile
? testsuite/config.log
? testsuite/config.status
? testsuite/gdb.ada/Makefile
? testsuite/gdb.arch/Makefile
? testsuite/gdb.asm/Makefile
? testsuite/gdb.base/Makefile
? testsuite/gdb.cp/Makefile
? testsuite/gdb.disasm/Makefile
? testsuite/gdb.dwarf2/Makefile
? testsuite/gdb.fortran/Makefile
? testsuite/gdb.java/Makefile
? testsuite/gdb.mi/Makefile
? testsuite/gdb.modula2/Makefile
? testsuite/gdb.objc/Makefile
? testsuite/gdb.opt/Makefile
? testsuite/gdb.pascal/Makefile
? testsuite/gdb.python/Makefile
? testsuite/gdb.reverse/Makefile
? testsuite/gdb.server/Makefile
? testsuite/gdb.stabs/Makefile
? testsuite/gdb.stabs/config.log
? testsuite/gdb.stabs/config.status
? testsuite/gdb.threads/Makefile
? testsuite/gdb.trace/Makefile
? testsuite/gdb.xml/Makefile
Index: symtab.c
===================================================================
RCS file: /cvs/src/src/gdb/symtab.c,v
retrieving revision 1.216
diff -c -p -r1.216 symtab.c
*** symtab.c 19 Oct 2009 09:51:42 -0000 1.216
--- symtab.c 29 Oct 2009 21:39:30 -0000
*************** find_line_symtab (struct symtab *symtab,
*** 2416,2433 ****
ALL_PSYMTABS (objfile, p)
{
! if (strcmp (symtab->filename, p->filename) != 0)
continue;
PSYMTAB_TO_SYMTAB (p);
}
ALL_SYMTABS (objfile, s)
{
struct linetable *l;
int ind;
! if (strcmp (symtab->filename, s->filename) != 0)
continue;
l = LINETABLE (s);
ind = find_line_common (l, line, &exact);
if (ind >= 0)
--- 2416,2440 ----
ALL_PSYMTABS (objfile, p)
{
! if (FILENAME_CMP (symtab->filename, p->filename) != 0)
continue;
PSYMTAB_TO_SYMTAB (p);
}
+ /* Get symbol full file name if possible. */
+ symtab_to_fullname (symtab);
+
ALL_SYMTABS (objfile, s)
{
struct linetable *l;
int ind;
! if (FILENAME_CMP (symtab->filename, s->filename) != 0)
continue;
+ if (symtab->fullname != NULL
+ && symtab_to_fullname (s) != NULL
+ && FILENAME_CMP (symtab->fullname, s->fullname) != 0)
+ continue;
l = LINETABLE (s);
ind = find_line_common (l, line, &exact);
if (ind >= 0)
*************** append_expanded_sal (struct symtabs_and_
*** 4591,4602 ****
}
/* Helper to expand_line_sal below. Search in the symtabs for any
! linetable entry that exactly matches FILENAME and LINENO and append
! them to RET. If there is at least one match, return 1; otherwise,
! return 0, and return the best choice in BEST_ITEM and BEST_SYMTAB. */
static int
! append_exact_match_to_sals (char *filename, int lineno,
struct symtabs_and_lines *ret,
struct linetable_entry **best_item,
struct symtab **best_symtab)
--- 4598,4611 ----
}
/* Helper to expand_line_sal below. Search in the symtabs for any
! linetable entry that exactly matches FULLNAME and LINENO and append
! them to RET. If FULLNAME is NULL or if a symbol has no full name,
! use FILENAME and LINENO instead. If there is at least one match,
! return 1; otherwise, return 0, and return the best choice in BEST_ITEM
! and BEST_SYMTAB. */
static int
! append_exact_match_to_sals (char *filename, char *fullname, int lineno,
struct symtabs_and_lines *ret,
struct linetable_entry **best_item,
struct symtab **best_symtab)
*************** append_exact_match_to_sals (char *filena
*** 4612,4621 ****
ALL_PSPACES (pspace)
ALL_PSPACE_SYMTABS (pspace, objfile, symtab)
{
! if (strcmp (filename, symtab->filename) == 0)
{
struct linetable *l;
int len;
l = LINETABLE (symtab);
if (!l)
continue;
--- 4621,4634 ----
ALL_PSPACES (pspace)
ALL_PSPACE_SYMTABS (pspace, objfile, symtab)
{
! if (FILENAME_CMP (filename, symtab->filename) == 0)
{
struct linetable *l;
int len;
+ if (fullname != NULL
+ && symtab_to_fullname (symtab) != NULL
+ && FILENAME_CMP (fullname, symtab->fullname) != 0)
+ continue;
l = LINETABLE (symtab);
if (!l)
continue;
*************** expand_line_sal (struct symtab_and_line
*** 4700,4706 ****
ALL_PSPACES (pspace)
ALL_PSPACE_PSYMTABS (pspace, objfile, psymtab)
{
! if (strcmp (match_filename, psymtab->filename) == 0)
{
set_current_program_space (pspace);
--- 4713,4719 ----
ALL_PSPACES (pspace)
ALL_PSPACE_PSYMTABS (pspace, objfile, psymtab)
{
! if (FILENAME_CMP (match_filename, psymtab->filename) == 0)
{
set_current_program_space (pspace);
*************** expand_line_sal (struct symtab_and_line
*** 4712,4721 ****
/* Now search the symtab for exact matches and append them. If
none is found, append the best_item and all its exact
matches. */
! exact = append_exact_match_to_sals (match_filename, lineno,
&ret, &best_item, &best_symtab);
if (!exact && best_item)
! append_exact_match_to_sals (best_symtab->filename, best_item->line,
&ret, &best_item, &best_symtab);
}
--- 4725,4737 ----
/* Now search the symtab for exact matches and append them. If
none is found, append the best_item and all its exact
matches. */
! symtab_to_fullname (sal.symtab);
! exact = append_exact_match_to_sals (sal.symtab->filename,
! sal.symtab->fullname, lineno,
&ret, &best_item, &best_symtab);
if (!exact && best_item)
! append_exact_match_to_sals (best_symtab->filename,
! best_symtab->fullname, best_item->line,
&ret, &best_item, &best_symtab);
}
2009-10-29 Sebastien Granjoux <seb.sfo@free.fr>
PR mi/9583:
* symtab.c (find_line_symtab, append_exact_match_to_sals)
(expand_line_sal): Use full filename when setting breakpoints if
available