From: Simon Marchi Date: Sat, 20 Nov 2021 02:49:53 +0000 (-0500) Subject: gdb: remove COMPUNIT_DEBUGFORMAT macro, add getter/setter X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=422f1ea279deea8530b679e4770e97f669797543;p=binutils-gdb.git 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 --- diff --git a/gdb/buildsym.c b/gdb/buildsym.c index 855d84bd27a..267b9462abd 100644 --- a/gdb/buildsym.c +++ b/gdb/buildsym.c @@ -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; diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c index 836da8a3b8c..44c7bc306d0 100644 --- a/gdb/mdebugread.c +++ b/gdb/mdebugread.c @@ -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; } diff --git a/gdb/or1k-tdep.c b/gdb/or1k-tdep.c index 1e01df223ad..5670a623024 100644 --- a/gdb/or1k-tdep.c +++ b/gdb/or1k-tdep.c @@ -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)) diff --git a/gdb/source.c b/gdb/source.c index 2160619b34f..3f047467b2e 100644 --- a/gdb/source.c +++ b/gdb/source.c @@ -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"); diff --git a/gdb/symfile.c b/gdb/symfile.c index 8ec214fb8e6..b20284cad98 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -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) { diff --git a/gdb/symmisc.c b/gdb/symmisc.c index 61e3eff562e..4220fd7f939 100644 --- a/gdb/symmisc.c +++ b/gdb/symmisc.c @@ -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) diff --git a/gdb/symtab.h b/gdb/symtab.h index 45d4bc4dc29..2500c8e4166 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h @@ -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; -#define COMPUNIT_DEBUGFORMAT(cust) ((cust)->debugformat) #define COMPUNIT_PRODUCER(cust) ((cust)->producer) #define COMPUNIT_DIRNAME(cust) ((cust)->dirname) #define COMPUNIT_BLOCKVECTOR(cust) ((cust)->blockvector) diff --git a/gdb/z80-tdep.c b/gdb/z80-tdep.c index 46fc64bd69b..4a58fe5138e 100644 --- a/gdb/z80-tdep.c +++ b/gdb/z80-tdep.c @@ -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")))