Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <drow@false.org>
To: gdb-patches@sourceware.org
Cc: dje@google.com
Subject: [rfc] Use substitute-path for filename portion too
Date: Thu, 07 Feb 2008 17:47:00 -0000	[thread overview]
Message-ID: <20080207174645.GA19452@caradoc.them.org> (raw)

I borrowed this bit from Doug's work on canonicalizing filenames last
month.  We ended up without that patch, but does anyone see a problem
with just this part?

This handles the symtabs created by the DWARF-2 reader for header
files in subdirectories.  For instance, if you have
/opt/codesourcery/foo.c which includes /opt/codesourcery/bar/bar.h,
and the current source line is in bar.h, find_and_open_source
will be called with dirname "/opt/codesourcery" and filename
"/opt/codesourcery/bar/bar.h".  We rewrote /opt/codesourcery
but not /opt/codesourcery/bar/bar.h, and ended up searching a number
of silly places for the filename but not the place it was
actually located.

-- 
Daniel Jacobowitz
CodeSourcery

2008-02-07  Doug Evans  <dje@google.com>

	* source.c (find_and_open_source): Always rewrite absolute filenames.

Index: source.c
===================================================================
RCS file: /cvs/src/src/gdb/source.c,v
retrieving revision 1.83
diff -u -p -r1.83 source.c
--- source.c	1 Jan 2008 22:53:13 -0000	1.83
+++ source.c	7 Feb 2008 16:09:34 -0000
@@ -999,10 +999,11 @@ find_and_open_source (struct objfile *ob
 	  strcat (path + len, source_path + len + cdir_len);	/* After $cdir */
 	}
     }
-  else
+
+  if (IS_ABSOLUTE_PATH (filename))
     {
-      /* If dirname is NULL, chances are the path is embedded in
-         the filename.  Try the source path substitution on it.  */
+      /* If filename is absolute path, try the source path
+	 substitution on it.  */
       char *rewritten_filename = rewrite_source_path (filename);
 
       if (rewritten_filename != NULL)


             reply	other threads:[~2008-02-07 17:47 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-07 17:47 Daniel Jacobowitz [this message]
2008-02-07 17:57 ` Joel Brobecker
2008-02-07 18:14   ` Daniel Jacobowitz
2008-02-07 18:28     ` Joel Brobecker
2008-02-07 18:51       ` Aleksandar Ristovski
2008-02-08 15:02       ` Eli Zaretskii
2008-02-08  0:31     ` Doug Evans
2008-02-08 22:20       ` Daniel Jacobowitz
2008-02-08 22:21 ` Daniel Jacobowitz

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=20080207174645.GA19452@caradoc.them.org \
    --to=drow@false.org \
    --cc=dje@google.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