* source.c (find_and_open_source): Try rewriting the source
authorJoel Brobecker <brobecker@gnat.com>
Wed, 24 Jan 2007 00:03:15 +0000 (00:03 +0000)
committerJoel Brobecker <brobecker@gnat.com>
Wed, 24 Jan 2007 00:03:15 +0000 (00:03 +0000)
        path inside filename if dirname is NULL.

gdb/ChangeLog
gdb/source.c

index 27db1d3420e41b4a002d494526dd22052f3ac5ff..52025a71777223bfa63bcd56b9d3d9054583654e 100644 (file)
@@ -1,3 +1,8 @@
+2007-01-24  Joel Brobecker  <brobecker@adacore.com>
+
+       * source.c (find_and_open_source): Try rewriting the source
+       path inside filename if dirname is NULL.
+
 2007-01-24  Joel Brobecker  <brobecker@adacore.com>
 
        * dwarf2read.c (add_partial_symbol): Create an extra partial
index fa7dd5c63d0f394b1a3f244c099a917c1c3b71ce..a142b32a90f5af96b3fc0f75051fbf589ecf7e3d 100644 (file)
@@ -1001,6 +1001,18 @@ find_and_open_source (struct objfile *objfile,
          strcat (path + len, source_path + len + cdir_len);    /* After $cdir */
        }
     }
+  else
+    {
+      /* If dirname is NULL, chances are the path is embedded in
+         the filename.  Try the source path substitution on it.  */
+      char *rewritten_filename = rewrite_source_path (filename);
+
+      if (rewritten_filename != NULL)
+        {
+          make_cleanup (xfree, rewritten_filename);
+          filename = rewritten_filename;
+        }
+    }
 
   result = openp (path, OPF_SEARCH_IN_PATH, filename, OPEN_MODE, 0, fullname);
   if (result < 0)