]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb: remove COMPUNIT_DEBUGFORMAT macro, add getter/setter
authorSimon Marchi <simon.marchi@efficios.com>
Sat, 20 Nov 2021 02:49:53 +0000 (21:49 -0500)
committerSimon Marchi <simon.marchi@polymtl.ca>
Sun, 6 Feb 2022 20:48:18 +0000 (15:48 -0500)
Add a getter and a setter for a compunit_symtab's debugformat.  Remove
the corresponding macro and adjust all callers.

Change-Id: I1667b02d5322346f8e23abd9f8a584afbcd75975

gdb/buildsym.c
gdb/mdebugread.c
gdb/or1k-tdep.c
gdb/source.c
gdb/symfile.c
gdb/symmisc.c
gdb/symtab.h
gdb/z80-tdep.c

index 855d84bd27a62e08864fd41aa2e84b3710e6e118..267b9462abd403ae1913b365161b737aa0107f63 100644 (file)
@@ -1010,7 +1010,7 @@ buildsym_compunit::end_symtab_with_blockvector (struct block *static_block,
     }
 
   /* Save the debug format string (if any) in the symtab.  */
-  COMPUNIT_DEBUGFORMAT (cu) = m_debugformat;
+  cu->set_debugformat (m_debugformat);
 
   /* Similarly for the producer.  */
   COMPUNIT_PRODUCER (cu) = m_producer;
index 836da8a3b8caa7360a40c5fbe32a2ff4738a737a..44c7bc306d073edf153148e4b867d40f8a39097e 100644 (file)
@@ -4634,7 +4634,7 @@ new_symtab (const char *name, int maxlines, struct objfile *objfile)
     BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK);
   COMPUNIT_BLOCKVECTOR (cust) = bv;
 
-  COMPUNIT_DEBUGFORMAT (cust) = "ECOFF";
+  cust->set_debugformat ("ECOFF");
   return cust;
 }
 
index 1e01df223adda4f21fee6b496f48e28d22841e96..5670a623024ff6c72d987b3c13f1d11068285f6d 100644 (file)
@@ -472,7 +472,7 @@ or1k_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
          struct symtab_and_line prologue_sal = find_pc_line (start_pc, 0);
          struct compunit_symtab *compunit
            = SYMTAB_COMPUNIT (prologue_sal.symtab);
-         const char *debug_format = COMPUNIT_DEBUGFORMAT (compunit);
+         const char *debug_format = compunit->debugformat ();
 
          if ((NULL != debug_format)
              && (strlen ("dwarf") <= strlen (debug_format))
index 2160619b34ffbecde9cb8190aa7fc34b19328855..3f047467b2eb6e55c1f9f77f5261bcd969625db2 100644 (file)
@@ -727,7 +727,7 @@ info_source_command (const char *ignore, int from_tty)
                   COMPUNIT_PRODUCER (cust) != NULL
                   ? COMPUNIT_PRODUCER (cust) : _("unknown"));
   printf_filtered (_("Compiled with %s debugging format.\n"),
-                  COMPUNIT_DEBUGFORMAT (cust));
+                  cust->debugformat ());
   printf_filtered (_("%s preprocessor macro info.\n"),
                   COMPUNIT_MACRO_TABLE (cust) != NULL
                   ? "Includes" : "Does not include");
index 8ec214fb8e65cfd992e1c063117956f582de8093..b20284cad988c724f009bfa070f4e1feff3bffe7 100644 (file)
@@ -2831,7 +2831,7 @@ allocate_compunit_symtab (struct objfile *objfile, const char *name)
   saved_name = lbasename (name);
   cu->name = obstack_strdup (&objfile->objfile_obstack, saved_name);
 
-  COMPUNIT_DEBUGFORMAT (cu) = "unknown";
+  cu->set_debugformat ("unknown");
 
   if (symtab_create_debug)
     {
index 61e3eff562e50378555e0d63c3569a4e693e329b..4220fd7f93954cd0250db4efd9c6cd19aab26bdd 100644 (file)
@@ -777,7 +777,7 @@ maintenance_info_symtabs (const char *regexp, int from_tty)
                        printf_filtered ("  { ((struct compunit_symtab *) %s)\n",
                                         host_address_to_string (cust));
                        printf_filtered ("    debugformat %s\n",
-                                        COMPUNIT_DEBUGFORMAT (cust));
+                                        cust->debugformat ());
                        printf_filtered ("    producer %s\n",
                                         COMPUNIT_PRODUCER (cust) != NULL
                                         ? COMPUNIT_PRODUCER (cust)
index 45d4bc4dc2998b3c2be74431cde0029fb365e9ce..2500c8e4166de4a9034a18f4a0620dff59ff3caf 100644 (file)
@@ -1482,6 +1482,16 @@ struct compunit_symtab
       }
   }
 
+  const char *debugformat () const
+  {
+    return m_debugformat;
+  }
+
+  void set_debugformat (const char *debugformat)
+  {
+    m_debugformat = debugformat;
+  }
+
   /* Make PRIMARY_FILETAB the primary filetab of this compunit symtab.
 
      PRIMARY_FILETAB must already be a filetab of this compunit symtab.  */
@@ -1525,7 +1535,7 @@ struct compunit_symtab
      such as "stabs", "dwarf 1", "dwarf 2", "coff", etc.  This is mostly useful
      for automated testing of gdb but may also be information that is
      useful to the user.  */
-  const char *debugformat;
+  const char *m_debugformat;
 
   /* String of producer version information, or NULL if we don't know.  */
   const char *producer;
@@ -1577,7 +1587,6 @@ struct compunit_symtab
 
 using compunit_symtab_range = next_range<compunit_symtab>;
 
-#define COMPUNIT_DEBUGFORMAT(cust) ((cust)->debugformat)
 #define COMPUNIT_PRODUCER(cust) ((cust)->producer)
 #define COMPUNIT_DIRNAME(cust) ((cust)->dirname)
 #define COMPUNIT_BLOCKVECTOR(cust) ((cust)->blockvector)
index 46fc64bd69b3e8376d4c56359465a7e520ac0bc1..4a58fe5138ea009f11db16471a0f5f47b1b7acd4 100644 (file)
@@ -496,7 +496,7 @@ z80_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
     {
       struct symtab_and_line prologue_sal = find_pc_line (func_addr, 0);
       struct compunit_symtab *compunit = SYMTAB_COMPUNIT (prologue_sal.symtab);
-      const char *debug_format = COMPUNIT_DEBUGFORMAT (compunit);
+      const char *debug_format = compunit->debugformat ();
 
       if (debug_format != NULL &&
          !strncasecmp ("dwarf", debug_format, strlen("dwarf")))