This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[rfc] Use substitute-path for filename portion too


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)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]