From cb679ca8c215a23df1053399149a40ea788db0ef Mon Sep 17 00:00:00 2001 From: brobecke Date: Wed, 24 Jan 2007 00:03:15 +0000 Subject: [PATCH] * source.c (find_and_open_source): Try rewriting the source path inside filename if dirname is NULL. --- gdb/ChangeLog | 5 +++++ gdb/source.c | 12 ++++++++++++ 2 files changed, 17 insertions(+) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 27db1d3420..52025a7177 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,10 @@ 2007-01-24 Joel Brobecker + * source.c (find_and_open_source): Try rewriting the source + path inside filename if dirname is NULL. + +2007-01-24 Joel Brobecker + * 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. diff --git a/gdb/source.c b/gdb/source.c index fa7dd5c63d..a142b32a90 100644 --- a/gdb/source.c +++ b/gdb/source.c @@ -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) -- 2.11.0