From: "Sébastien Granjoux" <seb.sfo@free.fr>
To: Joel Brobecker <brobecker@adacore.com>
Cc: gdb-patches@sourceware.org
Subject: Re: Fix breakpoints when several source files have the same name
Date: Mon, 09 Nov 2009 21:38:00 -0000 [thread overview]
Message-ID: <4AF88BB4.2030101@free.fr> (raw)
In-Reply-To: <20091109210849.GS4557@adacore.com>
[-- Attachment #1: Type: text/plain, Size: 621 bytes --]
Hi Joel,
Joel Brobecker a écrit :
> Would you mind sending unified diffs, next time. There seems to be
> a preference of unified diffs over context diffs.
No, problem.
> Periods need to be followed by 2 spaces (GNU Coding Standards). I realize
> that the text you started with had the problem too! Also, I believe there
> is a typo "symbol has no full name" -> "symtab has no full name"?
I have fixed all this in the attached patch.
> Pre-approved with the changes above. Have your assignment request
> come through, yet?
Yes, I have received the confirmation a week ago.
Thanks for your review.
Sébastien
[-- Attachment #2: ChangeLog.txt --]
[-- Type: text/plain, Size: 200 bytes --]
2009-11-09 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
[-- Attachment #3: fix_multiple_breakpoint4.path --]
[-- Type: text/plain, Size: 3358 bytes --]
Index: gdb/symtab.c
===================================================================
RCS file: /cvs/src/src/gdb/symtab.c,v
retrieving revision 1.216
diff -U3 -r1.216 symtab.c
--- gdb/symtab.c 19 Oct 2009 09:51:42 -0000 1.216
+++ gdb/symtab.c 9 Nov 2009 21:29:00 -0000
@@ -2416,18 +2416,25 @@
ALL_PSYMTABS (objfile, p)
{
- if (strcmp (symtab->filename, p->filename) != 0)
+ 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 (strcmp (symtab->filename, s->filename) != 0)
+ 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)
@@ -4591,12 +4598,14 @@
}
/* 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. */
+ linetable entry that exactly matches FULLNAME and LINENO and append
+ them to RET. If FULLNAME is NULL or if a symtab 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, int lineno,
+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)
@@ -4612,10 +4621,14 @@
ALL_PSPACES (pspace)
ALL_PSPACE_SYMTABS (pspace, objfile, symtab)
{
- if (strcmp (filename, symtab->filename) == 0)
+ 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;
@@ -4700,7 +4713,7 @@
ALL_PSPACES (pspace)
ALL_PSPACE_PSYMTABS (pspace, objfile, psymtab)
{
- if (strcmp (match_filename, psymtab->filename) == 0)
+ if (FILENAME_CMP (match_filename, psymtab->filename) == 0)
{
set_current_program_space (pspace);
@@ -4712,10 +4725,13 @@
/* 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,
+ 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_item->line,
+ append_exact_match_to_sals (best_symtab->filename,
+ best_symtab->fullname, best_item->line,
&ret, &best_item, &best_symtab);
}
next prev parent reply other threads:[~2009-11-09 21:38 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-09 20:31 Sébastien Granjoux
2009-11-09 21:09 ` Joel Brobecker
2009-11-09 21:38 ` Sébastien Granjoux [this message]
2009-11-09 22:05 ` Joel Brobecker
2009-11-10 18:46 ` Sébastien Granjoux
-- strict thread matches above, loose matches on Subject: below --
2009-10-29 21:55 Sébastien Granjoux
2009-10-01 21:05 Sébastien Granjoux
2009-10-01 21:45 ` Joel Brobecker
2009-10-02 20:28 ` Sébastien Granjoux
2009-05-24 10:49 Sébastien Granjoux
2009-09-29 22:20 ` Joel Brobecker
2009-09-30 18:53 ` Sébastien Granjoux
2009-09-30 19:07 ` Jan Kratochvil
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4AF88BB4.2030101@free.fr \
--to=seb.sfo@free.fr \
--cc=brobecker@adacore.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox