Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Sébastien Granjoux" <seb.sfo@free.fr>
To: gdb-patches@sourceware.org
Subject: Fix breakpoints when several source files have the same name
Date: Sun, 24 May 2009 10:49:00 -0000	[thread overview]
Message-ID: <4A1926A2.1000806@free.fr> (raw)

[-- Attachment #1: Type: text/plain, Size: 649 bytes --]

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


[-- Attachment #2: ChangeLog.txt --]
[-- Type: text/plain, Size: 126 bytes --]

2009-05-24  Sebastien Granjoux <seb.sfo@free.fr>

	PR mi/9583:
	* symtab.c (find_line_symtab): Use full filename if available

[-- Attachment #3: fix_9583.diff --]
[-- Type: text/x-patch, Size: 1323 bytes --]

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);

             reply	other threads:[~2009-05-24 10:49 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-24 10:49 Sébastien Granjoux [this message]
2009-09-29 22:20 ` Joel Brobecker
2009-09-30 18:53   ` Sébastien Granjoux
2009-09-30 19:07     ` Jan Kratochvil
2009-10-01 21:05 Sébastien Granjoux
2009-10-01 21:45 ` Joel Brobecker
2009-10-02 20:28   ` Sébastien Granjoux
2009-10-29 21:55 Sébastien Granjoux
2009-11-09 20:31 Sébastien Granjoux
2009-11-09 21:09 ` Joel Brobecker
2009-11-09 21:38   ` Sébastien Granjoux
2009-11-09 22:05     ` Joel Brobecker
2009-11-10 18:46       ` Sébastien Granjoux

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=4A1926A2.1000806@free.fr \
    --to=seb.sfo@free.fr \
    --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