SYMTAB_DIRNAME: New macro.
authorDoug Evans <xdje42@gmail.com>
Tue, 18 Nov 2014 17:28:32 +0000 (09:28 -0800)
committerDoug Evans <xdje42@gmail.com>
Tue, 18 Nov 2014 17:28:32 +0000 (09:28 -0800)
gdb/ChangeLog:

* symtab.h (SYMTAB_DIRNAME): New macro.  All uses of member
symtab.dirname updated to use it.

gdb/ChangeLog
gdb/buildsym.c
gdb/cli/cli-cmds.c
gdb/jit.c
gdb/source.c
gdb/symmisc.c
gdb/symtab.h

index 9d7a84690e1cda4c2e24a9574fb23eb0fcb23276..b9dd637a2837908b2d8364ac07a0a2dd70caad59 100644 (file)
@@ -1,3 +1,8 @@
+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
index 3ea8ff0a9012a038237bbbee55fd1f2b15d7860e..d0f0ddcfa27894cfb8aa9619772f433afa4b2f0b 100644 (file)
@@ -1244,14 +1244,14 @@ end_symtab_with_blockvector (struct block *static_block,
       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
index 0c3cfa7c6b8d583be173fdb3de80b70dd9a32005..79246aca639418e19546263a71e453e68391f7e7 100644 (file)
@@ -1486,21 +1486,23 @@ compare_symtabs (const void *a, const void *b)
 {
   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;
     }
index c12a72f3da518233de709e5afbcac4b3fde7d640..4810018bb0c946e44de69272e719277a60856cbc 100644 (file)
--- a/gdb/jit.c
+++ b/gdb/jit.c
@@ -645,7 +645,7 @@ finalize_symtab (struct gdb_symtab *stab, struct objfile *objfile)
 
   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)
index 894531adb142e5b564a04d8a28f60507fbe44968..0f695784ed67ee3a52809b86c26dfbd80dd3080f 100644 (file)
@@ -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);
index 623bcb32331450d9af85b572f54c8ef25d11b04d..323ebd5022954d7642ccde84f8fdaa59882b3d49 100644 (file)
@@ -297,9 +297,9 @@ dump_symtab_1 (struct objfile *objfile, struct symtab *symtab,
 
   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);
@@ -753,7 +753,8 @@ maintenance_info_symtabs (char *regexp, int from_tty)
              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 ("          "
index fdedd59b4cb27f23599906d9486f814c6b5509d2..e545506a019910e3ce2317b332e16a745ae41799 100644 (file)
@@ -984,6 +984,7 @@ struct symtab
 #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);
This page took 0.036193 seconds and 4 git commands to generate.