From: Simon Marchi <simon.marchi@polymtl.ca>
To: gdb-patches@sourceware.org
Cc: Simon Marchi <simon.marchi@efficios.com>
Subject: [PATCH 12/33] gdb: remove COMPUNIT_BLOCK_LINE_SECTION macro, add getter/setter
Date: Fri, 28 Jan 2022 07:45:10 -0500 [thread overview]
Message-ID: <20220128124531.2302941-13-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 block line section. Remove
the corresponding macro and adjust all callers.
Change-Id: I3eb1a323388ad55eae8bfa45f5bc4a08dc3df455
---
gdb/buildsym.c | 2 +-
gdb/dwarf2/loc.c | 2 +-
gdb/gdbtypes.c | 2 +-
gdb/objfiles.c | 4 ++--
gdb/symtab.c | 2 +-
gdb/symtab.h | 13 +++++++++++--
6 files changed, 17 insertions(+), 8 deletions(-)
diff --git a/gdb/buildsym.c b/gdb/buildsym.c
index 847414968af4..1b162dac9e07 100644
--- a/gdb/buildsym.c
+++ b/gdb/buildsym.c
@@ -1022,7 +1022,7 @@ buildsym_compunit::end_symtab_with_blockvector (struct block *static_block,
set_block_compunit_symtab (b, cu);
}
- COMPUNIT_BLOCK_LINE_SECTION (cu) = section;
+ cu->set_block_line_section (section);
COMPUNIT_MACRO_TABLE (cu) = release_macros ();
diff --git a/gdb/dwarf2/loc.c b/gdb/dwarf2/loc.c
index 69b480e6e869..bf3cadba87ee 100644
--- a/gdb/dwarf2/loc.c
+++ b/gdb/dwarf2/loc.c
@@ -717,7 +717,7 @@ call_site_to_target_addr (struct gdbarch *call_site_gdbarch,
{
dwarf2_per_objfile *per_objfile = call_site->per_objfile;
compunit_symtab *cust = per_objfile->get_symtab (call_site->per_cu);
- int sect_idx = COMPUNIT_BLOCK_LINE_SECTION (cust);
+ int sect_idx = cust->block_line_section ();
CORE_ADDR delta = per_objfile->objfile->section_offsets[sect_idx];
return call_site->target.loc_physaddr () + delta;
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index 8af96c79e6ca..795844733105 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -6285,7 +6285,7 @@ call_site::pc () const
{
compunit_symtab *cust = this->per_objfile->get_symtab (this->per_cu);
CORE_ADDR delta
- = this->per_objfile->objfile->section_offsets[COMPUNIT_BLOCK_LINE_SECTION (cust)];
+ = this->per_objfile->objfile->section_offsets[cust->block_line_section ()];
return m_unrelocated_pc + delta;
}
diff --git a/gdb/objfiles.c b/gdb/objfiles.c
index f363cb453f3a..7e1ec6ca92dd 100644
--- a/gdb/objfiles.c
+++ b/gdb/objfiles.c
@@ -660,7 +660,7 @@ objfile_relocate1 (struct objfile *objfile,
if (l)
{
for (int i = 0; i < l->nitems; ++i)
- l->item[i].pc += delta[COMPUNIT_BLOCK_LINE_SECTION (cust)];
+ l->item[i].pc += delta[cust->block_line_section ()];
}
}
}
@@ -668,7 +668,7 @@ objfile_relocate1 (struct objfile *objfile,
for (compunit_symtab *cust : objfile->compunits ())
{
const struct blockvector *bv = cust->blockvector ();
- int block_line_section = COMPUNIT_BLOCK_LINE_SECTION (cust);
+ int block_line_section = cust->block_line_section ();
if (BLOCKVECTOR_MAP (bv))
addrmap_relocate (BLOCKVECTOR_MAP (bv), delta[block_line_section]);
diff --git a/gdb/symtab.c b/gdb/symtab.c
index a0bc1dfea52e..70a9f10ea4b6 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -338,7 +338,7 @@ compunit_symtab::find_call_site (CORE_ADDR pc) const
return nullptr;
CORE_ADDR delta
- = this->objfile ()->section_offsets[COMPUNIT_BLOCK_LINE_SECTION (this)];
+ = this->objfile ()->section_offsets[this->block_line_section ()];
CORE_ADDR unrelocated_pc = pc - delta;
struct call_site call_site_local (unrelocated_pc, nullptr, nullptr);
diff --git a/gdb/symtab.h b/gdb/symtab.h
index f9318ffdcb46..c59e3c3457c7 100644
--- a/gdb/symtab.h
+++ b/gdb/symtab.h
@@ -1521,6 +1521,16 @@ struct compunit_symtab
m_blockvector = blockvector;
}
+ int block_line_section () const
+ {
+ return m_block_line_section;
+ }
+
+ void set_block_line_section (int block_line_section)
+ {
+ m_block_line_section = block_line_section;
+ }
+
/* Make PRIMARY_FILETAB the primary filetab of this compunit symtab.
PRIMARY_FILETAB must already be a filetab of this compunit symtab. */
@@ -1578,7 +1588,7 @@ struct compunit_symtab
/* Section in objfile->section_offsets for the blockvector and
the linetable. Probably always SECT_OFF_TEXT. */
- int block_line_section;
+ int m_block_line_section;
/* Symtab has been compiled with both optimizations and debug info so that
GDB may stop skipping prologues as variables locations are valid already
@@ -1616,7 +1626,6 @@ struct compunit_symtab
using compunit_symtab_range = next_range<compunit_symtab>;
-#define COMPUNIT_BLOCK_LINE_SECTION(cust) ((cust)->block_line_section)
#define COMPUNIT_LOCATIONS_VALID(cust) ((cust)->locations_valid)
#define COMPUNIT_EPILOGUE_UNWIND_VALID(cust) ((cust)->epilogue_unwind_valid)
#define COMPUNIT_MACRO_TABLE(cust) ((cust)->macro_table)
--
2.34.1
next prev parent reply other threads:[~2022-01-28 12:47 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
2022-01-28 12:44 ` [PATCH 01/33] gdb: add getter/setter for compunit_symtab::objfile Simon Marchi
2022-01-28 12:45 ` [PATCH 02/33] gdb: remove COMPUNIT_OBJFILE macro Simon Marchi
2022-01-28 12:45 ` [PATCH 03/33] gdb: rename compunit_primary_filetab to compunit_symtab::primary_filetab Simon Marchi
2022-01-28 12:45 ` [PATCH 04/33] gdb: add compunit_symtab::add_filetab method Simon Marchi
2022-01-28 12:45 ` [PATCH 05/33] gdb: add compunit_symtab::set_primary_filetab method Simon Marchi
2022-01-28 12:45 ` [PATCH 06/33] gdb: move compunit_filetabs to compunit_symtab::filetabs Simon Marchi
2022-01-28 12:45 ` [PATCH 07/33] gdb: remove COMPUNIT_FILETABS macro Simon Marchi
2022-01-28 12:45 ` [PATCH 08/33] gdb: remove COMPUNIT_DEBUGFORMAT macro, add getter/setter Simon Marchi
2022-01-28 12:45 ` [PATCH 09/33] gdb: remove COMPUNIT_PRODUCER " Simon Marchi
2022-01-28 12:45 ` [PATCH 10/33] gdb: remove COMPUNIT_DIRNAME " Simon Marchi
2022-01-28 12:45 ` [PATCH 11/33] gdb: remove COMPUNIT_BLOCKVECTOR " Simon Marchi
2022-01-28 12:45 ` Simon Marchi [this message]
2022-01-28 12:45 ` [PATCH 13/33] gdb: remove COMPUNIT_LOCATIONS_VALID " Simon Marchi
2022-01-28 12:45 ` [PATCH 14/33] gdb: remove COMPUNIT_EPILOGUE_UNWIND_VALID " Simon Marchi
2022-01-28 12:45 ` [PATCH 15/33] gdb: remove COMPUNIT_MACRO_TABLE " Simon Marchi
2022-01-28 12:45 ` [PATCH 16/33] gdb: remove SYMTAB_COMPUNIT " Simon Marchi
2022-01-28 12:45 ` [PATCH 17/33] gdb: remove SYMTAB_LINETABLE " Simon Marchi
2022-01-28 12:45 ` [PATCH 18/33] gdb: remove SYMTAB_LANGUAGE " Simon Marchi
2022-01-28 12:45 ` [PATCH 19/33] gdb: remove SYMTAB_BLOCKVECTOR macro Simon Marchi
2022-01-28 12:45 ` [PATCH 20/33] gdb: remove SYMTAB_OBJFILE macro Simon Marchi
2022-01-28 12:45 ` [PATCH 21/33] gdb: remove SYMTAB_PSPACE macro Simon Marchi
2022-01-28 12:45 ` [PATCH 22/33] gdb: remove SYMTAB_DIRNAME macro Simon Marchi
2022-01-28 12:45 ` [PATCH 23/33] gdb: remove SYMBOL_MATCHES_SEARCH_NAME Simon Marchi
2022-01-28 12:45 ` [PATCH 24/33] gdb: remove SYMBOL_ACLASS_INDEX macro, add getter/setter Simon Marchi
2022-01-28 12:45 ` [PATCH 25/33] gdb: remove SYMBOL_IMPL macro, add method Simon Marchi
2022-01-28 12:45 ` [PATCH 26/33] gdb: remove SYMBOL_CLASS macro, add getter Simon Marchi
2022-01-28 12:45 ` [PATCH 27/33] gdb: remove SYMBOL_DOMAIN macro Simon Marchi
2022-01-28 12:45 ` [PATCH 28/33] gdb: remove SYMBOL_OBJFILE_OWNED macro Simon Marchi
2022-01-28 12:45 ` [PATCH 29/33] gdb: remove SYMBOL_IS_ARGUMENT macro Simon Marchi
2022-01-28 12:45 ` [PATCH 30/33] gdb: remove SYMBOL_INLINED macro Simon Marchi
2022-01-28 12:45 ` [PATCH 31/33] gdb: remote SYMBOL_IS_CPLUS_TEMPLATE_FUNCTION macro Simon Marchi
2022-01-28 12:45 ` [PATCH 32/33] gdb: remove SYMBOL_TYPE macro Simon Marchi
2022-01-28 12:45 ` [PATCH 33/33] gdb: remove SYMBOL_LINE macro Simon Marchi
2022-02-06 15:22 ` [PATCH 00/33] Remove some more accessor macros Joel Brobecker
2022-02-06 21:07 ` Simon Marchi
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-13-simon.marchi@polymtl.ca \
--to=simon.marchi@polymtl.ca \
--cc=gdb-patches@sourceware.org \
--cc=simon.marchi@efficios.com \
/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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).