+2014-11-18 Doug Evans <xdje42@gmail.com>
+
+ * symtab.h (SYMTAB_DIRNAME): New macro. All uses of member
+ symtab.dirname updated to use it.
+
2014-11-18 Doug Evans <xdje42@gmail.com>
* symtab.h (SYMTAB_OBJFILE): New macro. All uses of member
if (subfile->dirname)
{
/* Reallocate the dirname on the symbol obstack. */
- symtab->dirname =
+ SYMTAB_DIRNAME (symtab) =
obstack_copy0 (&objfile->objfile_obstack,
subfile->dirname,
strlen (subfile->dirname));
}
else
{
- symtab->dirname = NULL;
+ SYMTAB_DIRNAME (symtab) = NULL;
}
/* Use whatever language we have been using for this
{
const struct symtab_and_line *sala = a;
const struct symtab_and_line *salb = b;
+ const char *dira = SYMTAB_DIRNAME (sala->symtab);
+ const char *dirb = SYMTAB_DIRNAME (salb->symtab);
int r;
- if (!sala->symtab->dirname)
+ if (dira == NULL)
{
- if (salb->symtab->dirname)
+ if (dirb != NULL)
return -1;
}
- else if (!salb->symtab->dirname)
+ else if (dirb == NULL)
{
- if (sala->symtab->dirname)
+ if (dira != NULL)
return 1;
}
else
{
- r = filename_cmp (sala->symtab->dirname, salb->symtab->dirname);
+ r = filename_cmp (dira, dirb);
if (r)
return r;
}
symtab = allocate_symtab (stab->file_name, objfile);
/* JIT compilers compile in memory. */
- symtab->dirname = NULL;
+ SYMTAB_DIRNAME (symtab) = NULL;
/* Copy over the linetable entry if one was provided. */
if (stab->linetable)
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)
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.
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);
/* 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);
fprintf_filtered (outfile, "\nSymtab for file %s\n",
symtab_to_filename_for_display (symtab));
- if (symtab->dirname)
+ if (SYMTAB_DIRNAME (symtab) != NULL)
fprintf_filtered (outfile, "Compilation directory is %s\n",
- symtab->dirname);
+ SYMTAB_DIRNAME (symtab));
fprintf_filtered (outfile, "Read from object file %s (",
objfile_name (objfile));
gdb_print_host_address (objfile, outfile);
printf_filtered ("((struct symtab *) %s)\n",
host_address_to_string (symtab));
printf_filtered (" dirname %s\n",
- symtab->dirname ? symtab->dirname : "(null)");
+ SYMTAB_DIRNAME (symtab) != NULL
+ ? SYMTAB_DIRNAME (symtab) : "(null)");
printf_filtered (" fullname %s\n",
symtab->fullname ? symtab->fullname : "(null)");
printf_filtered (" "
#define LINETABLE(symtab) (symtab)->linetable
#define SYMTAB_OBJFILE(symtab) ((symtab)->objfile)
#define SYMTAB_PSPACE(symtab) (SYMTAB_OBJFILE (symtab)->pspace)
+#define SYMTAB_DIRNAME(symtab) ((symtab)->dirname)
/* Call this to set the "primary" field in struct symtab. */
extern void set_symtab_primary (struct symtab *, int primary);