From: Tom Tromey <tromey@adacore.com>
To: Tom Tromey via Gdb-patches <gdb-patches@sourceware.org>
Cc: Simon Marchi <simark@simark.ca>, Tom Tromey <tromey@adacore.com>
Subject: Re: [PATCH 3/6] Pass section index to start_compunit_symtab
Date: Wed, 08 Feb 2023 09:28:14 -0700 [thread overview]
Message-ID: <87wn4s15r5.fsf@tromey.com> (raw)
In-Reply-To: <87k01izlwf.fsf@tromey.com> (Tom Tromey via Gdb-patches's message of "Thu, 19 Jan 2023 06:36:32 -0700")
>>>>> "Tom" == Tom Tromey via Gdb-patches <gdb-patches@sourceware.org> writes:
Tom> I've updated patch #3 to just remove the section index from
Tom> end_compunit_symtab, and I've added a new patch to the series to remove
Tom> compunit_symtab::m_block_line_section.
Here's that patch. I realized I forgot to send it to the list, but I
thought I should note it here before pushing this series.
Tom
commit d401e7bf04c0949dcc5e3d83143b75efc19d5f1e
Author: Tom Tromey <tromey@adacore.com>
Date: Thu Jan 19 06:14:49 2023 -0700
Remove compunit_symtab::m_block_line_section
The previous patch hard-coded SECT_OFF_TEXT into the buildsym code.
After this, it's clear that there is only one caller of
compunit_symtab::set_block_line_section, and it always passes
SECT_OFF_TEXT. So, remove compunit_symtab::m_block_line_section and
use SECT_OFF_TEXT instead.
diff --git a/gdb/buildsym.c b/gdb/buildsym.c
index 41df0f061c1..d82c7672f7c 100644
--- a/gdb/buildsym.c
+++ b/gdb/buildsym.c
@@ -974,8 +974,6 @@ buildsym_compunit::end_compunit_symtab_with_blockvector
set_block_compunit_symtab (b, cu);
}
- cu->set_block_line_section (SECT_OFF_TEXT (m_objfile));
-
cu->set_macro_table (release_macros ());
/* Default any symbols without a specified symtab to the primary symtab. */
diff --git a/gdb/dwarf2/loc.c b/gdb/dwarf2/loc.c
index fe91d609f19..236ad820462 100644
--- a/gdb/dwarf2/loc.c
+++ b/gdb/dwarf2/loc.c
@@ -718,9 +718,7 @@ call_site_target::iterate_over_addresses
case call_site_target::PHYSADDR:
{
dwarf2_per_objfile *per_objfile = call_site->per_objfile;
- compunit_symtab *cust = per_objfile->get_symtab (call_site->per_cu);
- int sect_idx = cust->block_line_section ();
- CORE_ADDR delta = per_objfile->objfile->section_offsets[sect_idx];
+ CORE_ADDR delta = per_objfile->objfile->text_section_offset ();
callback (m_loc.physaddr + delta);
}
@@ -729,9 +727,7 @@ call_site_target::iterate_over_addresses
case call_site_target::ADDRESSES:
{
dwarf2_per_objfile *per_objfile = call_site->per_objfile;
- compunit_symtab *cust = per_objfile->get_symtab (call_site->per_cu);
- int sect_idx = cust->block_line_section ();
- CORE_ADDR delta = per_objfile->objfile->section_offsets[sect_idx];
+ CORE_ADDR delta = per_objfile->objfile->text_section_offset ();
for (unsigned i = 0; i < m_loc.addresses.length; ++i)
callback (m_loc.addresses.values[i] + delta);
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index 6a4c5976f18..45751c9c895 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -6436,9 +6436,7 @@ objfile_type (struct objfile *objfile)
CORE_ADDR
call_site::pc () const
{
- compunit_symtab *cust = this->per_objfile->get_symtab (this->per_cu);
- CORE_ADDR delta
- = this->per_objfile->objfile->section_offsets[cust->block_line_section ()];
+ CORE_ADDR delta = this->per_objfile->objfile->text_section_offset ();
return m_unrelocated_pc + delta;
}
diff --git a/gdb/objfiles.c b/gdb/objfiles.c
index e4fe3562c12..bf5057e723d 100644
--- a/gdb/objfiles.c
+++ b/gdb/objfiles.c
@@ -629,7 +629,7 @@ objfile_relocate1 (struct objfile *objfile,
if (l)
{
for (int i = 0; i < l->nitems; ++i)
- l->item[i].pc += delta[cust->block_line_section ()];
+ l->item[i].pc += delta[SECT_OFF_TEXT (objfile)];
}
}
}
@@ -637,7 +637,7 @@ objfile_relocate1 (struct objfile *objfile,
for (compunit_symtab *cust : objfile->compunits ())
{
struct blockvector *bv = cust->blockvector ();
- int block_line_section = cust->block_line_section ();
+ int block_line_section = SECT_OFF_TEXT (objfile);
if (bv->map () != nullptr)
bv->map ()->relocate (delta[block_line_section]);
diff --git a/gdb/symtab.c b/gdb/symtab.c
index a120c1d5e15..bf3a3e3caaa 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -342,8 +342,7 @@ compunit_symtab::find_call_site (CORE_ADDR pc) const
if (m_call_site_htab == nullptr)
return nullptr;
- CORE_ADDR delta
- = this->objfile ()->section_offsets[this->block_line_section ()];
+ CORE_ADDR delta = this->objfile ()->text_section_offset ();
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 484644f6129..50ce7525793 100644
--- a/gdb/symtab.h
+++ b/gdb/symtab.h
@@ -1786,16 +1786,6 @@ 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;
- }
-
bool locations_valid () const
{
return m_locations_valid;
@@ -1884,10 +1874,6 @@ struct compunit_symtab
all symtabs in a given compilation unit. */
struct blockvector *m_blockvector;
- /* Section in objfile->section_offsets for the blockvector and
- the linetable. Probably always SECT_OFF_TEXT. */
- 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
at function entry points. */
next prev parent reply other threads:[~2023-02-08 16:28 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-18 15:30 [PATCH 0/6] Change how symbol section indices are set Tom Tromey
2023-01-18 15:30 ` [PATCH 1/6] Use default section indexes in fixup_symbol_section Tom Tromey
2023-01-18 17:19 ` Simon Marchi
2023-01-18 19:13 ` Tom Tromey
2023-01-18 15:30 ` [PATCH 2/6] Set section indices when symbols are made Tom Tromey
2023-01-18 21:43 ` Simon Marchi
2023-01-18 22:00 ` Tom Tromey
2023-01-18 15:30 ` [PATCH 3/6] Pass section index to start_compunit_symtab Tom Tromey
2023-01-18 21:55 ` Simon Marchi
2023-01-18 22:02 ` Tom Tromey
2023-01-18 22:06 ` Simon Marchi
2023-01-19 13:36 ` Tom Tromey
2023-02-08 16:28 ` Tom Tromey [this message]
2023-01-18 15:30 ` [PATCH 4/6] Set section index when setting a symbol's block Tom Tromey
2023-01-18 15:30 ` [PATCH 5/6] Remove most calls to fixup_symbol_section Tom Tromey
2023-01-18 15:30 ` [PATCH 6/6] Merge fixup_section and fixup_symbol_section Tom Tromey
2023-02-08 16:28 ` [PATCH 0/6] Change how symbol section indices are set Tom Tromey
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=87wn4s15r5.fsf@tromey.com \
--to=tromey@adacore.com \
--cc=gdb-patches@sourceware.org \
--cc=simark@simark.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).