gdb: remove COMPUNIT_DEBUGFORMAT macro, add getter/setter

Add a getter and a setter for a compunit_symtab's debugformat.  Remove
the corresponding macro and adjust all callers.

Change-Id: I1667b02d5322346f8e23abd9f8a584afbcd75975
This commit is contained in:
Simon Marchi 2021-11-19 21:49:53 -05:00 committed by Simon Marchi
parent 510860f278
commit 422f1ea279
8 changed files with 18 additions and 9 deletions

View 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. */ /* Save the debug format string (if any) in the symtab. */
COMPUNIT_DEBUGFORMAT (cu) = m_debugformat; cu->set_debugformat (m_debugformat);
/* Similarly for the producer. */ /* Similarly for the producer. */
COMPUNIT_PRODUCER (cu) = m_producer; COMPUNIT_PRODUCER (cu) = m_producer;

View file

@ -4634,7 +4634,7 @@ new_symtab (const char *name, int maxlines, struct objfile *objfile)
BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK); BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK);
COMPUNIT_BLOCKVECTOR (cust) = bv; COMPUNIT_BLOCKVECTOR (cust) = bv;
COMPUNIT_DEBUGFORMAT (cust) = "ECOFF"; cust->set_debugformat ("ECOFF");
return cust; return cust;
} }

View 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 symtab_and_line prologue_sal = find_pc_line (start_pc, 0);
struct compunit_symtab *compunit struct compunit_symtab *compunit
= SYMTAB_COMPUNIT (prologue_sal.symtab); = SYMTAB_COMPUNIT (prologue_sal.symtab);
const char *debug_format = COMPUNIT_DEBUGFORMAT (compunit); const char *debug_format = compunit->debugformat ();
if ((NULL != debug_format) if ((NULL != debug_format)
&& (strlen ("dwarf") <= strlen (debug_format)) && (strlen ("dwarf") <= strlen (debug_format))

View file

@ -727,7 +727,7 @@ info_source_command (const char *ignore, int from_tty)
COMPUNIT_PRODUCER (cust) != NULL COMPUNIT_PRODUCER (cust) != NULL
? COMPUNIT_PRODUCER (cust) : _("unknown")); ? COMPUNIT_PRODUCER (cust) : _("unknown"));
printf_filtered (_("Compiled with %s debugging format.\n"), printf_filtered (_("Compiled with %s debugging format.\n"),
COMPUNIT_DEBUGFORMAT (cust)); cust->debugformat ());
printf_filtered (_("%s preprocessor macro info.\n"), printf_filtered (_("%s preprocessor macro info.\n"),
COMPUNIT_MACRO_TABLE (cust) != NULL COMPUNIT_MACRO_TABLE (cust) != NULL
? "Includes" : "Does not include"); ? "Includes" : "Does not include");

View file

@ -2831,7 +2831,7 @@ allocate_compunit_symtab (struct objfile *objfile, const char *name)
saved_name = lbasename (name); saved_name = lbasename (name);
cu->name = obstack_strdup (&objfile->objfile_obstack, saved_name); cu->name = obstack_strdup (&objfile->objfile_obstack, saved_name);
COMPUNIT_DEBUGFORMAT (cu) = "unknown"; cu->set_debugformat ("unknown");
if (symtab_create_debug) if (symtab_create_debug)
{ {

View file

@ -777,7 +777,7 @@ maintenance_info_symtabs (const char *regexp, int from_tty)
printf_filtered (" { ((struct compunit_symtab *) %s)\n", printf_filtered (" { ((struct compunit_symtab *) %s)\n",
host_address_to_string (cust)); host_address_to_string (cust));
printf_filtered (" debugformat %s\n", printf_filtered (" debugformat %s\n",
COMPUNIT_DEBUGFORMAT (cust)); cust->debugformat ());
printf_filtered (" producer %s\n", printf_filtered (" producer %s\n",
COMPUNIT_PRODUCER (cust) != NULL COMPUNIT_PRODUCER (cust) != NULL
? COMPUNIT_PRODUCER (cust) ? COMPUNIT_PRODUCER (cust)

View 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. /* Make PRIMARY_FILETAB the primary filetab of this compunit symtab.
PRIMARY_FILETAB must already be a 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 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 for automated testing of gdb but may also be information that is
useful to the user. */ useful to the user. */
const char *debugformat; const char *m_debugformat;
/* String of producer version information, or NULL if we don't know. */ /* String of producer version information, or NULL if we don't know. */
const char *producer; const char *producer;
@ -1577,7 +1587,6 @@ struct compunit_symtab
using compunit_symtab_range = next_range<compunit_symtab>; using compunit_symtab_range = next_range<compunit_symtab>;
#define COMPUNIT_DEBUGFORMAT(cust) ((cust)->debugformat)
#define COMPUNIT_PRODUCER(cust) ((cust)->producer) #define COMPUNIT_PRODUCER(cust) ((cust)->producer)
#define COMPUNIT_DIRNAME(cust) ((cust)->dirname) #define COMPUNIT_DIRNAME(cust) ((cust)->dirname)
#define COMPUNIT_BLOCKVECTOR(cust) ((cust)->blockvector) #define COMPUNIT_BLOCKVECTOR(cust) ((cust)->blockvector)

View 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 symtab_and_line prologue_sal = find_pc_line (func_addr, 0);
struct compunit_symtab *compunit = SYMTAB_COMPUNIT (prologue_sal.symtab); 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 && if (debug_format != NULL &&
!strncasecmp ("dwarf", debug_format, strlen("dwarf"))) !strncasecmp ("dwarf", debug_format, strlen("dwarf")))