From: Joel Brobecker Date: Wed, 24 Jan 2007 00:03:15 +0000 (+0000) Subject: * source.c (find_and_open_source): Try rewriting the source X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=56163ce1d3a08ade22d84d366dc9066df789914a;p=binutils-gdb.git * source.c (find_and_open_source): Try rewriting the source path inside filename if dirname is NULL. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 27db1d3420e..52025a71777 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +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 diff --git a/gdb/source.c b/gdb/source.c index fa7dd5c63d0..a142b32a90f 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)