aboutsummaryrefslogtreecommitdiff
path: root/gdb/source.c
diff options
context:
space:
mode:
authorJan Kratochvil <jan.kratochvil@redhat.com>2013-01-13 18:52:45 +0000
committerJan Kratochvil <jan.kratochvil@redhat.com>2013-01-13 18:52:45 +0000
commitf0a4b570b43765effcf5b4a1b12c47b9aab1b16f (patch)
treea67a688ae44ff6f622762793f53b189a96b5b9a9 /gdb/source.c
parentee659f1f4b39952137e2e2ca1d3d111f553037e6 (diff)
downloadgdb-f0a4b570b43765effcf5b4a1b12c47b9aab1b16f.zip
gdb-f0a4b570b43765effcf5b4a1b12c47b9aab1b16f.tar.gz
gdb-f0a4b570b43765effcf5b4a1b12c47b9aab1b16f.tar.bz2
gdb/
* source.c (symtab_to_fullname): Apply rewrite_source_path also for non-existing files. gdb/testsuite/ * gdb.mi/mi-fullname-deleted.exp: Set srcfileabssubst and initdir. (set substitute-path): New test. (fullname present): Remove content. (substituted fullname): New test.
Diffstat (limited to 'gdb/source.c')
-rw-r--r--gdb/source.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/gdb/source.c b/gdb/source.c
index 6e12896..ca6b4f3 100644
--- a/gdb/source.c
+++ b/gdb/source.c
@@ -1094,10 +1094,25 @@ symtab_to_fullname (struct symtab *s)
if (fd >= 0)
close (fd);
- else if (s->dirname == NULL)
- s->fullname = xstrdup (s->filename);
else
- s->fullname = concat (s->dirname, SLASH_STRING, s->filename, NULL);
+ {
+ char *fullname;
+ struct cleanup *back_to;
+
+ /* rewrite_source_path would be applied by find_and_open_source, we
+ should report the pathname where GDB tried to find the file. */
+
+ if (s->dirname == NULL)
+ fullname = xstrdup (s->filename);
+ else
+ fullname = concat (s->dirname, SLASH_STRING, s->filename, NULL);
+
+ back_to = make_cleanup (xfree, fullname);
+ s->fullname = rewrite_source_path (fullname);
+ if (s->fullname == NULL)
+ s->fullname = xstrdup (fullname);
+ do_cleanups (back_to);
+ }
}
return s->fullname;