aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@efficios.com>2021-11-19 21:49:53 -0500
committerSimon Marchi <simon.marchi@polymtl.ca>2022-02-06 15:48:18 -0500
commit422f1ea279deea8530b679e4770e97f669797543 (patch)
tree24b4b77f180dbaef3ee816c2a17d60429478ae3e
parent510860f2787f354d1c294958e4cc5e81256ece58 (diff)
downloadbinutils-422f1ea279deea8530b679e4770e97f669797543.zip
binutils-422f1ea279deea8530b679e4770e97f669797543.tar.gz
binutils-422f1ea279deea8530b679e4770e97f669797543.tar.bz2
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
-rw-r--r--gdb/buildsym.c2
-rw-r--r--gdb/mdebugread.c2
-rw-r--r--gdb/or1k-tdep.c2
-rw-r--r--gdb/source.c2
-rw-r--r--gdb/symfile.c2
-rw-r--r--gdb/symmisc.c2
-rw-r--r--gdb/symtab.h13
-rw-r--r--gdb/z80-tdep.c2
8 files changed, 18 insertions, 9 deletions
diff --git a/gdb/buildsym.c b/gdb/buildsym.c
index 855d84b..267b946 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 836da8a..44c7bc3 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 1e01df2..5670a62 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 2160619..3f04746 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 8ec214f..b20284c 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 61e3eff..4220fd7 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 45d4bc4..2500c8e 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<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)
diff --git a/gdb/z80-tdep.c b/gdb/z80-tdep.c
index 46fc64b..4a58fe5 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")))