From: Simon Marchi via Gdb-patches <gdb-patches@sourceware.org>
To: gdb-patches@sourceware.org
Cc: Simon Marchi <simon.marchi@efficios.com>
Subject: [PATCH 15/33] gdb: remove COMPUNIT_MACRO_TABLE macro, add getter/setter
Date: Fri, 28 Jan 2022 07:45:13 -0500 [thread overview]
Message-ID: <20220128124531.2302941-16-simon.marchi@polymtl.ca> (raw)
In-Reply-To: <20220128124531.2302941-1-simon.marchi@polymtl.ca>
From: Simon Marchi <simon.marchi@efficios.com>
Add a getter and a setter for a compunit_symtab's macro table. Remove the
corresponding macro and adjust all callers.
Change-Id: I00615ea72d5ac43d9a865e941cb2de0a979c173a
---
gdb/buildsym.c | 2 +-
gdb/macroscope.c | 4 ++--
gdb/mi/mi-cmd-file.c | 2 +-
gdb/source.c | 4 ++--
gdb/symtab.h | 14 +++++++++++---
5 files changed, 17 insertions(+), 9 deletions(-)
diff --git a/gdb/buildsym.c b/gdb/buildsym.c
index 1b162dac9e07..b42c40830c90 100644
--- a/gdb/buildsym.c
+++ b/gdb/buildsym.c
@@ -1024,7 +1024,7 @@ buildsym_compunit::end_symtab_with_blockvector (struct block *static_block,
cu->set_block_line_section (section);
- COMPUNIT_MACRO_TABLE (cu) = release_macros ();
+ cu->set_macro_table (release_macros ());
/* Default any symbols without a specified symtab to the primary symtab. */
{
diff --git a/gdb/macroscope.c b/gdb/macroscope.c
index 02070967579f..c581c426eda0 100644
--- a/gdb/macroscope.c
+++ b/gdb/macroscope.c
@@ -44,12 +44,12 @@ sal_macro_scope (struct symtab_and_line sal)
if (sal.symtab == NULL)
return NULL;
cust = SYMTAB_COMPUNIT (sal.symtab);
- if (COMPUNIT_MACRO_TABLE (cust) == NULL)
+ if (cust->macro_table () == NULL)
return NULL;
gdb::unique_xmalloc_ptr<struct macro_scope> ms (XNEW (struct macro_scope));
- main_file = macro_main (COMPUNIT_MACRO_TABLE (cust));
+ main_file = macro_main (cust->macro_table ());
inclusion = macro_lookup_inclusion (main_file, sal.symtab->filename);
if (inclusion)
diff --git a/gdb/mi/mi-cmd-file.c b/gdb/mi/mi-cmd-file.c
index 23c6d7021e2e..f4ee791f17b5 100644
--- a/gdb/mi/mi-cmd-file.c
+++ b/gdb/mi/mi-cmd-file.c
@@ -59,7 +59,7 @@ mi_cmd_file_list_exec_source_file (const char *command, char **argv, int argc)
uiout->field_string ("fullname", symtab_to_fullname (st.symtab));
uiout->field_signed ("macro-info",
- COMPUNIT_MACRO_TABLE (SYMTAB_COMPUNIT (st.symtab)) != NULL);
+ SYMTAB_COMPUNIT (st.symtab)->macro_table () != NULL);
}
/* Implement -file-list-exec-source-files command. */
diff --git a/gdb/source.c b/gdb/source.c
index 07ea2af9fd85..e6ba44819413 100644
--- a/gdb/source.c
+++ b/gdb/source.c
@@ -729,8 +729,8 @@ info_source_command (const char *ignore, int from_tty)
printf_filtered (_("Compiled with %s debugging format.\n"),
cust->debugformat ());
printf_filtered (_("%s preprocessor macro info.\n"),
- COMPUNIT_MACRO_TABLE (cust) != NULL
- ? "Includes" : "Does not include");
+ (cust->macro_table () != nullptr
+ ? "Includes" : "Does not include"));
}
\f
diff --git a/gdb/symtab.h b/gdb/symtab.h
index 5419e70ced6a..c319d51a2714 100644
--- a/gdb/symtab.h
+++ b/gdb/symtab.h
@@ -1551,6 +1551,16 @@ struct compunit_symtab
m_epilogue_unwind_valid = epilogue_unwind_valid;
}
+ struct macro_table *macro_table () const
+ {
+ return m_macro_table;
+ }
+
+ void set_macro_table (struct macro_table *macro_table)
+ {
+ m_macro_table = macro_table;
+ }
+
/* Make PRIMARY_FILETAB the primary filetab of this compunit symtab.
PRIMARY_FILETAB must already be a filetab of this compunit symtab. */
@@ -1626,7 +1636,7 @@ struct compunit_symtab
is shared between different symtabs in a given compilation unit.
It's debatable whether it *should* be shared among all the symtabs in
the given compilation unit, but it currently is. */
- struct macro_table *macro_table;
+ struct macro_table *m_macro_table;
/* If non-NULL, then this points to a NULL-terminated vector of
included compunits. When searching the static or global
@@ -1646,8 +1656,6 @@ struct compunit_symtab
using compunit_symtab_range = next_range<compunit_symtab>;
-#define COMPUNIT_MACRO_TABLE(cust) ((cust)->macro_table)
-
/* Return the language of CUST. */
extern enum language compunit_language (const struct compunit_symtab *cust);
--
2.34.1
next prev parent reply other threads:[~2022-01-28 12:51 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-28 12:44 [PATCH 00/33] Remove some more accessor macros Simon Marchi via Gdb-patches
2022-01-28 12:44 ` [PATCH 01/33] gdb: add getter/setter for compunit_symtab::objfile Simon Marchi via Gdb-patches
2022-01-28 12:45 ` [PATCH 02/33] gdb: remove COMPUNIT_OBJFILE macro Simon Marchi via Gdb-patches
2022-01-28 12:45 ` [PATCH 03/33] gdb: rename compunit_primary_filetab to compunit_symtab::primary_filetab Simon Marchi via Gdb-patches
2022-01-28 12:45 ` [PATCH 04/33] gdb: add compunit_symtab::add_filetab method Simon Marchi via Gdb-patches
2022-01-28 12:45 ` [PATCH 05/33] gdb: add compunit_symtab::set_primary_filetab method Simon Marchi via Gdb-patches
2022-01-28 12:45 ` [PATCH 06/33] gdb: move compunit_filetabs to compunit_symtab::filetabs Simon Marchi via Gdb-patches
2022-01-28 12:45 ` [PATCH 07/33] gdb: remove COMPUNIT_FILETABS macro Simon Marchi via Gdb-patches
2022-01-28 12:45 ` [PATCH 08/33] gdb: remove COMPUNIT_DEBUGFORMAT macro, add getter/setter Simon Marchi via Gdb-patches
2022-01-28 12:45 ` [PATCH 09/33] gdb: remove COMPUNIT_PRODUCER " Simon Marchi via Gdb-patches
2022-01-28 12:45 ` [PATCH 10/33] gdb: remove COMPUNIT_DIRNAME " Simon Marchi via Gdb-patches
2022-01-28 12:45 ` [PATCH 11/33] gdb: remove COMPUNIT_BLOCKVECTOR " Simon Marchi via Gdb-patches
2022-01-28 12:45 ` [PATCH 12/33] gdb: remove COMPUNIT_BLOCK_LINE_SECTION " Simon Marchi via Gdb-patches
2022-01-28 12:45 ` [PATCH 13/33] gdb: remove COMPUNIT_LOCATIONS_VALID " Simon Marchi via Gdb-patches
2022-01-28 12:45 ` [PATCH 14/33] gdb: remove COMPUNIT_EPILOGUE_UNWIND_VALID " Simon Marchi via Gdb-patches
2022-01-28 12:45 ` Simon Marchi via Gdb-patches [this message]
2022-01-28 12:45 ` [PATCH 16/33] gdb: remove SYMTAB_COMPUNIT " Simon Marchi via Gdb-patches
2022-01-28 12:45 ` [PATCH 17/33] gdb: remove SYMTAB_LINETABLE " Simon Marchi via Gdb-patches
2022-01-28 12:45 ` [PATCH 18/33] gdb: remove SYMTAB_LANGUAGE " Simon Marchi via Gdb-patches
2022-01-28 12:45 ` [PATCH 19/33] gdb: remove SYMTAB_BLOCKVECTOR macro Simon Marchi via Gdb-patches
2022-01-28 12:45 ` [PATCH 20/33] gdb: remove SYMTAB_OBJFILE macro Simon Marchi via Gdb-patches
2022-01-28 12:45 ` [PATCH 21/33] gdb: remove SYMTAB_PSPACE macro Simon Marchi via Gdb-patches
2022-01-28 12:45 ` [PATCH 22/33] gdb: remove SYMTAB_DIRNAME macro Simon Marchi via Gdb-patches
2022-01-28 12:45 ` [PATCH 23/33] gdb: remove SYMBOL_MATCHES_SEARCH_NAME Simon Marchi via Gdb-patches
2022-01-28 12:45 ` [PATCH 24/33] gdb: remove SYMBOL_ACLASS_INDEX macro, add getter/setter Simon Marchi via Gdb-patches
2022-01-28 12:45 ` [PATCH 25/33] gdb: remove SYMBOL_IMPL macro, add method Simon Marchi via Gdb-patches
2022-01-28 12:45 ` [PATCH 26/33] gdb: remove SYMBOL_CLASS macro, add getter Simon Marchi via Gdb-patches
2022-01-28 12:45 ` [PATCH 27/33] gdb: remove SYMBOL_DOMAIN macro Simon Marchi via Gdb-patches
2022-01-28 12:45 ` [PATCH 28/33] gdb: remove SYMBOL_OBJFILE_OWNED macro Simon Marchi via Gdb-patches
2022-01-28 12:45 ` [PATCH 29/33] gdb: remove SYMBOL_IS_ARGUMENT macro Simon Marchi via Gdb-patches
2022-01-28 12:45 ` [PATCH 30/33] gdb: remove SYMBOL_INLINED macro Simon Marchi via Gdb-patches
2022-01-28 12:45 ` [PATCH 31/33] gdb: remote SYMBOL_IS_CPLUS_TEMPLATE_FUNCTION macro Simon Marchi via Gdb-patches
2022-01-28 12:45 ` [PATCH 32/33] gdb: remove SYMBOL_TYPE macro Simon Marchi via Gdb-patches
2022-01-28 12:45 ` [PATCH 33/33] gdb: remove SYMBOL_LINE macro Simon Marchi via Gdb-patches
2022-02-06 15:22 ` [PATCH 00/33] Remove some more accessor macros Joel Brobecker via Gdb-patches
2022-02-06 21:07 ` Simon Marchi via Gdb-patches
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220128124531.2302941-16-simon.marchi@polymtl.ca \
--to=gdb-patches@sourceware.org \
--cc=simon.marchi@efficios.com \
--cc=simon.marchi@polymtl.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox