Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [rfc] Use substitute-path for filename portion too
@ 2008-02-07 17:47 Daniel Jacobowitz
  2008-02-07 17:57 ` Joel Brobecker
  2008-02-08 22:21 ` Daniel Jacobowitz
  0 siblings, 2 replies; 9+ messages in thread
From: Daniel Jacobowitz @ 2008-02-07 17:47 UTC (permalink / raw)
  To: gdb-patches; +Cc: dje

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)


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2008-02-08 22:21 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-07 17:47 [rfc] Use substitute-path for filename portion too Daniel Jacobowitz
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox