*** empty log message ***
[deliverable/binutils-gdb.git] / gdb / source.c
index 38aae31a4a3f9dfc6f84baa5b27160c36bd00a71..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)
@@ -1997,16 +2009,24 @@ Show number of source lines gdb will list by default."), NULL,
 
   add_cmd ("substitute-path", class_files, set_substitute_path_command,
            _("\
-Add a source path substitution rule.  If a substitution rule was previously\n\
-set, it is overridden."), &setlist);
+Usage: set substitute-path FROM TO\n\
+Add a substitution rule replacing FROM into TO in source file names.\n\
+If a substitution rule was previously set for FROM, the old rule\n\
+is replaced by the new one."),
+           &setlist);
 
   add_cmd ("substitute-path", class_files, unset_substitute_path_command,
            _("\
-Remove the current source path substitution rule.  This has no effect\n\
-if no path substitution rule was previously specified."),
+Usage: unset substitute-path [FROM]\n\
+Delete the rule for substituting FROM in source file names.  If FROM\n\
+is not specified, all substituting rules are deleted.\n\
+If the debugger cannot find a rule for FROM, it will display a warning."),
            &unsetlist);
 
   add_cmd ("substitute-path", class_files, show_substitute_path_command,
-           _("Show the current source path substitution rule."),
+           _("\
+Usage: show substitute-path [FROM]\n\
+Print the rule for substituting FROM in source file names. If FROM\n\
+is not specified, print all substitution rules."),
            &showlist);
 }
This page took 0.024692 seconds and 4 git commands to generate.