From ee6f8984bbdbf340816a7f2aebe736f100601b22 Mon Sep 17 00:00:00 2001 From: Doug Evans Date: Tue, 18 Nov 2014 09:28:32 -0800 Subject: SYMTAB_DIRNAME: New macro. gdb/ChangeLog: * symtab.h (SYMTAB_DIRNAME): New macro. All uses of member symtab.dirname updated to use it. --- gdb/source.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'gdb/source.c') diff --git a/gdb/source.c b/gdb/source.c index 894531a..0f69578 100644 --- a/gdb/source.c +++ b/gdb/source.c @@ -659,8 +659,8 @@ source_info (char *ignore, int from_tty) return; } printf_filtered (_("Current source file is %s\n"), s->filename); - if (s->dirname) - printf_filtered (_("Compilation directory is %s\n"), s->dirname); + if (SYMTAB_DIRNAME (s) != NULL) + printf_filtered (_("Compilation directory is %s\n"), SYMTAB_DIRNAME (s)); if (s->fullname) printf_filtered (_("Located in %s\n"), s->fullname); if (s->nlines) @@ -1105,7 +1105,7 @@ open_source_file (struct symtab *s) if (!s) return -1; - return find_and_open_source (s->filename, s->dirname, &s->fullname); + return find_and_open_source (s->filename, SYMTAB_DIRNAME (s), &s->fullname); } /* Finds the fullname that a symtab represents. @@ -1125,7 +1125,8 @@ symtab_to_fullname (struct symtab *s) to handle cases like the file being moved. */ if (s->fullname == NULL) { - int fd = find_and_open_source (s->filename, s->dirname, &s->fullname); + int fd = find_and_open_source (s->filename, SYMTAB_DIRNAME (s), + &s->fullname); if (fd >= 0) close (fd); @@ -1137,10 +1138,11 @@ symtab_to_fullname (struct symtab *s) /* 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 || IS_ABSOLUTE_PATH (s->filename)) + if (SYMTAB_DIRNAME (s) == NULL || IS_ABSOLUTE_PATH (s->filename)) fullname = xstrdup (s->filename); else - fullname = concat (s->dirname, SLASH_STRING, s->filename, NULL); + fullname = concat (SYMTAB_DIRNAME (s), SLASH_STRING, s->filename, + NULL); back_to = make_cleanup (xfree, fullname); s->fullname = rewrite_source_path (fullname); -- cgit v1.1