aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@efficios.com>2021-11-19 22:09:25 -0500
committerSimon Marchi <simon.marchi@polymtl.ca>2022-02-06 15:48:18 -0500
commitab5f850eed6aba84050d075e8c8a2cb16a876b15 (patch)
tree05057981c94964184fbeca51093765525eeb01b2
parent422f1ea279deea8530b679e4770e97f669797543 (diff)
downloadgdb-ab5f850eed6aba84050d075e8c8a2cb16a876b15.zip
gdb-ab5f850eed6aba84050d075e8c8a2cb16a876b15.tar.gz
gdb-ab5f850eed6aba84050d075e8c8a2cb16a876b15.tar.bz2
gdb: remove COMPUNIT_PRODUCER macro, add getter/setter
Add a getter and a setter for a compunit_symtab's producer. Remove the corresponding macro and adjust all callers. Change-Id: Ia1d6d8a0e247a08a21af23819d71e49b37d8931b
-rw-r--r--gdb/amd64-tdep.c10
-rw-r--r--gdb/arm-tdep.c6
-rw-r--r--gdb/buildsym.c2
-rw-r--r--gdb/compile/compile.c6
-rw-r--r--gdb/dwarf2/frame.c2
-rw-r--r--gdb/i386-tdep.c6
-rw-r--r--gdb/python/py-symtab.c4
-rw-r--r--gdb/source.c4
-rw-r--r--gdb/symmisc.c5
-rw-r--r--gdb/symtab.h13
10 files changed, 33 insertions, 25 deletions
diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c
index e67aea8..539ebe9 100644
--- a/gdb/amd64-tdep.c
+++ b/gdb/amd64-tdep.c
@@ -2474,8 +2474,8 @@ amd64_skip_xmm_prologue (CORE_ADDR pc, CORE_ADDR start_pc)
start_pc_sal = find_pc_sect_line (start_pc, NULL, 0);
if (start_pc_sal.symtab == NULL
- || producer_is_gcc_ge_4 (COMPUNIT_PRODUCER
- (SYMTAB_COMPUNIT (start_pc_sal.symtab))) < 6
+ || producer_is_gcc_ge_4 (SYMTAB_COMPUNIT
+ (start_pc_sal.symtab)->producer ()) < 6
|| start_pc_sal.pc != start_pc || pc >= start_pc_sal.end)
return pc;
@@ -2545,9 +2545,9 @@ amd64_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR start_pc)
compilers to emit usable line notes. */
if (post_prologue_pc
&& (cust != NULL
- && COMPUNIT_PRODUCER (cust) != NULL
- && (producer_is_llvm (COMPUNIT_PRODUCER (cust))
- || producer_is_icc_ge_19 (COMPUNIT_PRODUCER (cust)))))
+ && cust->producer () != nullptr
+ && (producer_is_llvm (cust->producer ())
+ || producer_is_icc_ge_19 (cust->producer ()))))
return std::max (start_pc, post_prologue_pc);
}
diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
index f46913e..d36856e 100644
--- a/gdb/arm-tdep.c
+++ b/gdb/arm-tdep.c
@@ -1394,9 +1394,9 @@ arm_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
missing (e.g. for -gstabs), assuming the GNU tools. */
if (post_prologue_pc
&& (cust == NULL
- || COMPUNIT_PRODUCER (cust) == NULL
- || startswith (COMPUNIT_PRODUCER (cust), "GNU ")
- || producer_is_llvm (COMPUNIT_PRODUCER (cust))))
+ || cust->producer () == NULL
+ || startswith (cust->producer (), "GNU ")
+ || producer_is_llvm (cust->producer ())))
return post_prologue_pc;
if (post_prologue_pc != 0)
diff --git a/gdb/buildsym.c b/gdb/buildsym.c
index 267b946..2272727 100644
--- a/gdb/buildsym.c
+++ b/gdb/buildsym.c
@@ -1013,7 +1013,7 @@ buildsym_compunit::end_symtab_with_blockvector (struct block *static_block,
cu->set_debugformat (m_debugformat);
/* Similarly for the producer. */
- COMPUNIT_PRODUCER (cu) = m_producer;
+ cu->set_producer (m_producer);
COMPUNIT_BLOCKVECTOR (cu) = blockvector;
{
diff --git a/gdb/compile/compile.c b/gdb/compile/compile.c
index 6794c93..7bd6ac8 100644
--- a/gdb/compile/compile.c
+++ b/gdb/compile/compile.c
@@ -561,11 +561,11 @@ get_selected_pc_producer_options (void)
struct compunit_symtab *symtab = find_pc_compunit_symtab (pc);
const char *cs;
- if (symtab == NULL || symtab->producer == NULL
- || !startswith (symtab->producer, "GNU "))
+ if (symtab == NULL || symtab->producer () == NULL
+ || !startswith (symtab->producer (), "GNU "))
return NULL;
- cs = symtab->producer;
+ cs = symtab->producer ();
while (*cs != 0 && *cs != '-')
cs = skip_spaces (skip_to_space (cs));
if (*cs != '-')
diff --git a/gdb/dwarf2/frame.c b/gdb/dwarf2/frame.c
index b4e699c..0b7ed2c 100644
--- a/gdb/dwarf2/frame.c
+++ b/gdb/dwarf2/frame.c
@@ -745,7 +745,7 @@ dwarf2_frame_find_quirks (struct dwarf2_frame_state *fs,
if (cust == NULL)
return;
- if (producer_is_realview (COMPUNIT_PRODUCER (cust)))
+ if (producer_is_realview (cust->producer ()))
{
if (fde->cie->version == 1)
fs->armcc_cfa_offsets_sf = 1;
diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
index aaa5592..e598a4d 100644
--- a/gdb/i386-tdep.c
+++ b/gdb/i386-tdep.c
@@ -1853,9 +1853,9 @@ i386_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR start_pc)
compilers to emit usable line notes. */
if (post_prologue_pc
&& (cust != NULL
- && COMPUNIT_PRODUCER (cust) != NULL
- && (producer_is_llvm (COMPUNIT_PRODUCER (cust))
- || producer_is_icc_ge_19 (COMPUNIT_PRODUCER (cust)))))
+ && cust->producer () != NULL
+ && (producer_is_llvm (cust->producer ())
+ || producer_is_icc_ge_19 (cust->producer ()))))
return std::max (start_pc, post_prologue_pc);
}
diff --git a/gdb/python/py-symtab.c b/gdb/python/py-symtab.c
index db19e4b..b973b25 100644
--- a/gdb/python/py-symtab.c
+++ b/gdb/python/py-symtab.c
@@ -132,9 +132,9 @@ stpy_get_producer (PyObject *self, void *closure)
STPY_REQUIRE_VALID (self, symtab);
cust = SYMTAB_COMPUNIT (symtab);
- if (COMPUNIT_PRODUCER (cust) != NULL)
+ if (cust->producer () != nullptr)
{
- const char *producer = COMPUNIT_PRODUCER (cust);
+ const char *producer = cust->producer ();
return host_string_to_python_string (producer).release ();
}
diff --git a/gdb/source.c b/gdb/source.c
index 3f04746..07ea2af 100644
--- a/gdb/source.c
+++ b/gdb/source.c
@@ -724,8 +724,8 @@ info_source_command (const char *ignore, int from_tty)
printf_filtered (_("Source language is %s.\n"), language_str (s->language));
printf_filtered (_("Producer is %s.\n"),
- COMPUNIT_PRODUCER (cust) != NULL
- ? COMPUNIT_PRODUCER (cust) : _("unknown"));
+ (cust->producer ()) != nullptr
+ ? cust->producer () : _("unknown"));
printf_filtered (_("Compiled with %s debugging format.\n"),
cust->debugformat ());
printf_filtered (_("%s preprocessor macro info.\n"),
diff --git a/gdb/symmisc.c b/gdb/symmisc.c
index 4220fd7..b946fc8 100644
--- a/gdb/symmisc.c
+++ b/gdb/symmisc.c
@@ -779,9 +779,8 @@ maintenance_info_symtabs (const char *regexp, int from_tty)
printf_filtered (" debugformat %s\n",
cust->debugformat ());
printf_filtered (" producer %s\n",
- COMPUNIT_PRODUCER (cust) != NULL
- ? COMPUNIT_PRODUCER (cust)
- : "(null)");
+ (cust->producer () != nullptr
+ ? cust->producer () : "(null)"));
printf_filtered (" dirname %s\n",
COMPUNIT_DIRNAME (cust) != NULL
? COMPUNIT_DIRNAME (cust)
diff --git a/gdb/symtab.h b/gdb/symtab.h
index 2500c8e..1e3f95d 100644
--- a/gdb/symtab.h
+++ b/gdb/symtab.h
@@ -1492,6 +1492,16 @@ struct compunit_symtab
m_debugformat = debugformat;
}
+ const char *producer () const
+ {
+ return m_producer;
+ }
+
+ void set_producer (const char *producer)
+ {
+ m_producer = producer;
+ }
+
/* Make PRIMARY_FILETAB the primary filetab of this compunit symtab.
PRIMARY_FILETAB must already be a filetab of this compunit symtab. */
@@ -1538,7 +1548,7 @@ struct compunit_symtab
const char *m_debugformat;
/* String of producer version information, or NULL if we don't know. */
- const char *producer;
+ const char *m_producer;
/* Directory in which it was compiled, or NULL if we don't know. */
const char *dirname;
@@ -1587,7 +1597,6 @@ struct compunit_symtab
using compunit_symtab_range = next_range<compunit_symtab>;
-#define COMPUNIT_PRODUCER(cust) ((cust)->producer)
#define COMPUNIT_DIRNAME(cust) ((cust)->dirname)
#define COMPUNIT_BLOCKVECTOR(cust) ((cust)->blockvector)
#define COMPUNIT_BLOCK_LINE_SECTION(cust) ((cust)->block_line_section)