From: Tom Tromey <tom@tromey.com>
To: gdb-patches@sourceware.org
Subject: [PATCH 11/26] Do not pass objfile to psymtab_discarder
Date: Sun, 28 Feb 2021 13:37:48 -0700 [thread overview]
Message-ID: <20210228203803.1693413-12-tom@tromey.com> (raw)
In-Reply-To: <20210228203803.1693413-1-tom@tromey.com>
This changes the psymtab_discarder to not assume that partial symtabs
are attached to the objfile. Instead, a psymtab_storage object is
passed directly to it.
gdb/ChangeLog
2021-02-28 Tom Tromey <tom@tromey.com>
* psympriv.h (psymtab_discarder): Take psymtab_storage parameter.
(~psymtab_discarder, keep): Update.
<m_objfile>: Remove.
<m_partial_symtabs>: New member.
* dwarf2/read.c (dwarf2_build_psymtabs): Update.
---
gdb/ChangeLog | 8 ++++++++
gdb/dwarf2/read.c | 2 +-
gdb/psympriv.h | 17 ++++++++---------
3 files changed, 17 insertions(+), 10 deletions(-)
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index a24ead568ee..5c7a4435268 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -6372,7 +6372,7 @@ dwarf2_build_psymtabs (struct objfile *objfile)
/* This isn't really ideal: all the data we allocate on the
objfile's obstack is still uselessly kept around. However,
freeing it seems unsafe. */
- psymtab_discarder psymtabs (objfile);
+ psymtab_discarder psymtabs (objfile->partial_symtabs.get ());
dwarf2_build_psymtabs_hard (per_objfile);
psymtabs.keep ();
diff --git a/gdb/psympriv.h b/gdb/psympriv.h
index 73f00a50992..0f24c104aca 100644
--- a/gdb/psympriv.h
+++ b/gdb/psympriv.h
@@ -446,29 +446,28 @@ class psymtab_discarder
{
public:
- psymtab_discarder (struct objfile *objfile)
- : m_objfile (objfile),
- m_psymtab (objfile->partial_symtabs->psymtabs)
+ psymtab_discarder (psymtab_storage *partial_symtabs)
+ : m_partial_symtabs (partial_symtabs),
+ m_psymtab (partial_symtabs->psymtabs)
{
}
~psymtab_discarder ()
{
- if (m_objfile != NULL)
- m_objfile->partial_symtabs->discard_psymtabs_to (m_psymtab);
+ if (m_partial_symtabs != nullptr)
+ m_partial_symtabs->discard_psymtabs_to (m_psymtab);
}
/* Keep any partial symbol tables that were built. */
void keep ()
{
- m_objfile = NULL;
+ m_partial_symtabs = nullptr;
}
private:
- /* The objfile. If NULL this serves as a sentinel to indicate that
- the psymtabs should be kept. */
- struct objfile *m_objfile;
+ /* The partial symbol storage object. */
+ psymtab_storage *m_partial_symtabs;
/* How far back to free. */
struct partial_symtab *m_psymtab;
};
--
2.26.2
next prev parent reply other threads:[~2021-02-28 20:38 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-28 20:37 [PATCH 00/26] Allow multiple "partial" symtab readers per objfile Tom Tromey
2021-02-28 20:37 ` [PATCH 01/26] Move some DWARF code out of symfile.h Tom Tromey
2021-02-28 20:37 ` [PATCH 02/26] Introduce dwarf2/public.h Tom Tromey
2021-02-28 20:37 ` [PATCH 03/26] Change objfile_has_partial_symbols to a method Tom Tromey
2021-02-28 20:37 ` [PATCH 04/26] Change objfile::has_partial_symbols to return bool Tom Tromey
2021-02-28 20:37 ` [PATCH 05/26] Introduce method wrappers for quick_symbol_functions Tom Tromey
2021-03-22 13:52 ` Simon Marchi
2021-02-28 20:37 ` [PATCH 06/26] Move quick_symbol_functions to a new header Tom Tromey
2021-02-28 20:37 ` [PATCH 07/26] Move sym_fns::qf to objfile Tom Tromey
2021-02-28 20:37 ` [PATCH 08/26] Convert quick_symbol_functions to use methods Tom Tromey
2021-02-28 20:37 ` [PATCH 09/26] Move psymbol_map out of objfile Tom Tromey
2021-02-28 20:37 ` [PATCH 10/26] Change how some psymbol readers access the psymtab storage Tom Tromey
2021-02-28 20:37 ` Tom Tromey [this message]
2021-02-28 20:37 ` [PATCH 12/26] Set per_bfd->partial_symtabs earlier Tom Tromey
2021-02-28 20:37 ` [PATCH 13/26] Change how DWARF indices use addrmap Tom Tromey
2021-02-28 20:37 ` [PATCH 14/26] Move psymtab statistics printing to psymtab.c Tom Tromey
2021-02-28 20:37 ` [PATCH 15/26] Change how DWARF index writer finds address map Tom Tromey
2021-02-28 20:37 ` [PATCH 16/26] Reference psymtabs via per_bfd in DWARF reader Tom Tromey
2021-02-28 20:37 ` [PATCH 17/26] Attach partial symtab storage to psymbol_functions Tom Tromey
2021-02-28 20:37 ` [PATCH 18/26] Rearrange psymtab_storage construction Tom Tromey
2021-02-28 20:37 ` [PATCH 19/26] Remove sym_fns::sym_read_psymbols Tom Tromey
2021-02-28 20:37 ` [PATCH 20/26] Introduce objfile::require_partial_symbols Tom Tromey
2021-02-28 20:37 ` [PATCH 21/26] Add partial_symtabs parameter to psymtab construction functions Tom Tromey
2021-02-28 20:37 ` [PATCH 22/26] Remove last objfile partial_symtab references from psymtab.c Tom Tromey
2021-02-28 20:38 ` [PATCH 23/26] Change count_psyms to be a method on psymbol_functions Tom Tromey
2021-02-28 20:38 ` [PATCH 24/26] Remove objfile::psymtabs Tom Tromey
2021-02-28 20:38 ` [PATCH 25/26] Switch objfile to hold a list of psymbol readers Tom Tromey
2021-02-28 20:38 ` [PATCH 26/26] Allow multiple partial symbol readers per objfile Tom Tromey
2021-03-20 23:33 ` [PATCH 00/26] Allow multiple "partial" symtab " Tom Tromey
2021-03-22 14:13 ` 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=20210228203803.1693413-12-tom@tromey.com \
--to=tom@tromey.com \
--cc=gdb-patches@sourceware.org \
/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).