From: Tom Tromey <tom@tromey.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tom@tromey.com>
Subject: [PATCH 06/14] Add "objfile" parameter to two partial_symtab methods
Date: Sat, 15 Feb 2020 16:55:00 -0000 [thread overview]
Message-ID: <20200215165444.32653-7-tom@tromey.com> (raw)
In-Reply-To: <20200215165444.32653-1-tom@tromey.com>
This series will cause partial symtabs to be shared across obfiles.
However, full symtabs and symbols will still be objfile-dependent.
So, a debug info reader will need to know which objfile to consult
when expanding a partial symtab.
This patch adds an objfile parameter to the two relevant methods
partial_symtab. Current implementations simply ignore them.
gdb/ChangeLog
2020-02-15 Tom Tromey <tom@tromey.com>
* psymtab.c (partial_map_expand_apply)
(psym_find_pc_sect_compunit_symtab, psym_lookup_symbol)
(psymtab_to_symtab, psym_find_last_source_symtab, dump_psymtab)
(psym_print_stats, psym_expand_symtabs_for_function)
(psym_map_symbol_filenames, psym_map_matching_symbols)
(psym_expand_symtabs_matching)
(partial_symtab::read_dependencies, maintenance_info_psymtabs)
(maintenance_check_psymtabs): Update.
* psympriv.h (struct partial_symtab) <readin_p,
get_compunit_symtab>: Add objfile parameter.
(struct standard_psymtab) <readin_p, get_compunit_symtab>:
Likewise.
---
gdb/ChangeLog | 15 +++++++++++++++
gdb/psympriv.h | 10 +++++-----
gdb/psymtab.c | 40 ++++++++++++++++++++--------------------
3 files changed, 40 insertions(+), 25 deletions(-)
diff --git a/gdb/psympriv.h b/gdb/psympriv.h
index 1b1f57cf764..0270f0bb9b2 100644
--- a/gdb/psympriv.h
+++ b/gdb/psympriv.h
@@ -139,12 +139,12 @@ struct partial_symtab
/* Return true if the symtab corresponding to this psymtab has been
readin. */
- virtual bool readin_p () const = 0;
+ virtual bool readin_p (struct objfile *) const = 0;
/* Return a pointer to the compunit allocated for this source file.
Return nullptr if !readin or if there was no symtab. */
- virtual struct compunit_symtab *get_compunit_symtab () const = 0;
-
+ virtual struct compunit_symtab *get_compunit_symtab (struct objfile *) const
+ = 0;
/* Return the raw low text address of this partial_symtab. */
CORE_ADDR raw_text_low () const
@@ -310,14 +310,14 @@ struct standard_psymtab : public partial_symtab
{
}
- bool readin_p () const override
+ bool readin_p (struct objfile *) const override
{
return readin;
}
/* Return a pointer to the compunit allocated for this source file.
Return nullptr if !readin or if there was no symtab. */
- struct compunit_symtab *get_compunit_symtab () const override
+ struct compunit_symtab *get_compunit_symtab (struct objfile *) const override
{
return compunit_symtab;
}
diff --git a/gdb/psymtab.c b/gdb/psymtab.c
index 56576b3bcec..5c23ebfd94c 100644
--- a/gdb/psymtab.c
+++ b/gdb/psymtab.c
@@ -131,7 +131,7 @@ partial_map_expand_apply (struct objfile *objfile,
gdb_assert (pst->user == NULL);
/* Don't visit already-expanded psymtabs. */
- if (pst->readin_p ())
+ if (pst->readin_p (objfile))
return 0;
/* This may expand more than one symtab, and we want to iterate over
@@ -385,7 +385,7 @@ psym_find_pc_sect_compunit_symtab (struct objfile *objfile,
msymbol);
if (ps != NULL)
{
- if (warn_if_readin && ps->readin_p ())
+ if (warn_if_readin && ps->readin_p (objfile))
/* Might want to error() here (in case symtab is corrupt and
will cause a core dump), but maybe we can successfully
continue, so let's not. */
@@ -393,7 +393,7 @@ psym_find_pc_sect_compunit_symtab (struct objfile *objfile,
(Internal error: pc %s in read in psymtab, but not in symtab.)\n"),
paddress (get_objfile_arch (objfile), pc));
psymtab_to_symtab (objfile, ps);
- return ps->get_compunit_symtab ();
+ return ps->get_compunit_symtab (objfile);
}
return NULL;
}
@@ -484,8 +484,8 @@ psym_lookup_symbol (struct objfile *objfile,
for (partial_symtab *ps : require_partial_symbols (objfile, true))
{
- if (!ps->readin_p () && lookup_partial_symbol (objfile, ps, name,
- psymtab_index, domain))
+ if (!ps->readin_p (objfile)
+ && lookup_partial_symbol (objfile, ps, name, psymtab_index, domain))
{
struct symbol *sym, *with_opaque = NULL;
struct compunit_symtab *stab = psymtab_to_symtab (objfile, ps);
@@ -750,11 +750,11 @@ psymtab_to_symtab (struct objfile *objfile, struct partial_symtab *pst)
pst = pst->user;
/* If it's been looked up before, return it. */
- if (pst->get_compunit_symtab ())
- return pst->get_compunit_symtab ();
+ if (pst->get_compunit_symtab (objfile))
+ return pst->get_compunit_symtab (objfile);
/* If it has not yet been read in, read it. */
- if (!pst->readin_p ())
+ if (!pst->readin_p (objfile))
{
scoped_restore decrementer = increment_reading_symtab ();
@@ -772,7 +772,7 @@ psymtab_to_symtab (struct objfile *objfile, struct partial_symtab *pst)
printf_filtered (_("done.\n"));
}
- return pst->get_compunit_symtab ();
+ return pst->get_compunit_symtab (objfile);
}
/* Psymtab version of find_last_source_symtab. See its definition in
@@ -795,7 +795,7 @@ psym_find_last_source_symtab (struct objfile *ofp)
if (cs_pst)
{
- if (cs_pst->readin_p ())
+ if (cs_pst->readin_p (ofp))
{
internal_error (__FILE__, __LINE__,
_("select_source_symtab: "
@@ -952,11 +952,11 @@ dump_psymtab (struct objfile *objfile, struct partial_symtab *psymtab,
gdb_print_host_address (objfile, outfile);
fprintf_filtered (outfile, ")\n");
- if (psymtab->readin_p ())
+ if (psymtab->readin_p (objfile))
{
fprintf_filtered (outfile,
" Full symtab was read (at ");
- gdb_print_host_address (psymtab->get_compunit_symtab (), outfile);
+ gdb_print_host_address (psymtab->get_compunit_symtab (objfile), outfile);
fprintf_filtered (outfile, ")\n");
}
@@ -1010,7 +1010,7 @@ psym_print_stats (struct objfile *objfile)
i = 0;
for (partial_symtab *ps : require_partial_symbols (objfile, true))
{
- if (!ps->readin_p ())
+ if (!ps->readin_p (objfile))
i++;
}
printf_filtered (_(" Number of psym tables (not yet expanded): %d\n"), i);
@@ -1050,7 +1050,7 @@ psym_expand_symtabs_for_function (struct objfile *objfile,
{
for (partial_symtab *ps : require_partial_symbols (objfile, true))
{
- if (ps->readin_p ())
+ if (ps->readin_p (objfile))
continue;
if ((lookup_partial_symbol (objfile, ps, func_name, 1, VAR_DOMAIN)
@@ -1105,7 +1105,7 @@ psym_map_symbol_filenames (struct objfile *objfile,
{
const char *fullname;
- if (ps->readin_p ())
+ if (ps->readin_p (objfile))
continue;
/* We can skip shared psymtabs here, because any file name will be
@@ -1185,7 +1185,7 @@ psym_map_matching_symbols
for (partial_symtab *ps : require_partial_symbols (objfile, true))
{
QUIT;
- if (ps->readin_p ()
+ if (ps->readin_p (objfile)
|| match_partial_symbol (objfile, ps, global, name, domain,
ordered_compare))
{
@@ -1320,7 +1320,7 @@ psym_expand_symtabs_matching
{
QUIT;
- if (ps->readin_p ())
+ if (ps->readin_p (objfile))
continue;
/* We skip shared psymtabs because file-matching doesn't apply
@@ -1688,7 +1688,7 @@ partial_symtab::read_dependencies (struct objfile *objfile)
{
for (int i = 0; i < number_of_dependencies; ++i)
{
- if (!dependencies[i]->readin_p ())
+ if (!dependencies[i]->readin_p (objfile))
{
/* Inform about additional files to be read in. */
if (info_verbose)
@@ -2000,7 +2000,7 @@ maintenance_info_psymtabs (const char *regexp, int from_tty)
host_address_to_string (psymtab));
printf_filtered (" readin %s\n",
- psymtab->readin_p () ? "yes" : "no");
+ psymtab->readin_p (objfile) ? "yes" : "no");
printf_filtered (" fullname %s\n",
psymtab->fullname
? psymtab->fullname : "(null)");
@@ -2091,7 +2091,7 @@ maintenance_check_psymtabs (const char *ignore, int from_tty)
/* We don't call psymtab_to_symtab here because that may cause symtab
expansion. When debugging a problem it helps if checkers leave
things unchanged. */
- cust = ps->get_compunit_symtab ();
+ cust = ps->get_compunit_symtab (objfile);
/* First do some checks that don't require the associated symtab. */
if (ps->text_high (objfile) < ps->text_low (objfile))
--
2.17.2
next prev parent reply other threads:[~2020-02-15 16:54 UTC|newest]
Thread overview: 60+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-15 16:54 [PATCH 00/14] Share DWARF partial symtabs between objfiles Tom Tromey
2020-02-15 16:55 ` [PATCH 03/14] Introduce dwarf2_per_objfile::obstack Tom Tromey
2020-02-19 4:13 ` Simon Marchi
2020-02-22 0:44 ` Tom Tromey
2020-02-15 16:55 ` [PATCH 02/14] Simplify setting of reading_partial_symbols Tom Tromey
2020-02-15 16:55 ` [PATCH 08/14] Remove symtab links from dwarf2_psymtab and dwarf2_per_cu_quick_data Tom Tromey
2020-02-18 11:50 ` Luis Machado
2020-02-19 4:47 ` Simon Marchi
2020-02-22 0:38 ` Tom Tromey
2020-02-22 0:36 ` Tom Tromey
2020-02-15 16:55 ` Tom Tromey [this message]
2020-02-18 11:26 ` [PATCH 06/14] Add "objfile" parameter to two partial_symtab methods Luis Machado
2020-02-15 16:55 ` [PATCH 11/14] Split type_unit_group Tom Tromey
2020-02-18 12:08 ` Luis Machado
2020-02-22 0:40 ` Tom Tromey
2020-02-15 16:55 ` [PATCH 10/14] Introduce dwarf2_enter_objfile and use it Tom Tromey
2020-02-18 11:58 ` Luis Machado
2020-02-21 22:54 ` Tom Tromey
2020-02-15 16:55 ` [PATCH 01/14] Fix latent bug in dwarf2_find_containing_comp_unit Tom Tromey
2020-02-19 3:42 ` Simon Marchi
2020-02-19 14:08 ` Tom Tromey
2020-02-20 0:11 ` Tom Tromey
2020-02-20 0:12 ` Tom Tromey
2020-02-20 15:44 ` Simon Marchi
2020-02-20 16:50 ` Tom Tromey
2020-03-07 19:12 ` Christian Biesinger
2020-02-15 16:55 ` [PATCH 04/14] Convert IS_TYPE_UNIT_GROUP to method Tom Tromey
2020-02-15 16:55 ` [PATCH 09/14] Add objfile member to DWARF batons Tom Tromey
2020-02-15 16:55 ` [PATCH 14/14] Share DWARF partial symtabs Tom Tromey
2020-02-18 12:26 ` Luis Machado
2020-02-21 23:03 ` Tom Tromey
2020-02-15 16:55 ` [PATCH 13/14] Move signatured_type::type to unshareable object Tom Tromey
2020-02-15 16:55 ` [PATCH 07/14] Add dwarf2_per_cu_data::index Tom Tromey
2020-02-18 11:39 ` Luis Machado
2020-02-21 23:36 ` Tom Tromey
2020-02-19 4:36 ` Simon Marchi
2020-02-19 5:31 ` Simon Marchi
2020-02-21 23:41 ` Tom Tromey
2020-02-21 23:41 ` Tom Tromey
2020-02-15 16:55 ` [PATCH 12/14] Fix a memory leak and remove an unused member Tom Tromey
2020-02-15 16:55 ` [PATCH 05/14] Introduce dwarf2_unshareable and move die_type_hash Tom Tromey
2020-02-18 11:23 ` Luis Machado
2020-02-19 4:20 ` Simon Marchi
2020-02-21 22:43 ` Tom Tromey
2020-02-17 12:31 ` [PATCH 00/14] Share DWARF partial symtabs between objfiles Luis Machado
2020-02-17 16:59 ` Tom Tromey
2020-02-22 21:50 ` Tom de Vries
2020-02-22 22:01 ` Tom Tromey
2020-02-23 2:37 ` Simon Marchi
2020-02-23 23:58 ` Tom Tromey
2020-02-24 2:52 ` Simon Marchi
2020-02-24 3:07 ` Tom Tromey
2020-02-24 3:22 ` Tom Tromey
2020-02-24 13:42 ` Tom de Vries
2020-02-24 16:00 ` Tom de Vries
2020-02-24 17:29 ` Tom Tromey
2020-02-24 23:15 ` Tom Tromey
2020-02-24 19:18 ` Simon Marchi
2020-02-24 23:20 ` Tom Tromey
2020-02-24 22:48 ` 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=20200215165444.32653-7-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).