OSDN Git Service

* source.c (find_and_open_source): Try rewriting the source
authorbrobecke <brobecke>
Wed, 24 Jan 2007 00:03:15 +0000 (00:03 +0000)
committerbrobecke <brobecke>
Wed, 24 Jan 2007 00:03:15 +0000 (00:03 +0000)
        path inside filename if dirname is NULL.

gdb/ChangeLog
gdb/source.c

index 27db1d3..52025a7 100644 (file)
@@ -1,5 +1,10 @@
 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
        symbol in the VAR_DOMAIN for Ada structures, unions or enums.
        (new_symbol): Likewise for symbols.
index fa7dd5c..a142b32 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)