* [PATCH] gdb: small cleanups in dwarf2_psymtab constructors
@ 2020-04-07 4:19 Simon Marchi
2020-04-07 15:47 ` Tom Tromey
0 siblings, 1 reply; 3+ messages in thread
From: Simon Marchi @ 2020-04-07 4:19 UTC (permalink / raw)
To: gdb-patches
I noticed that only one of the two dwarf2_psymtab constructors are
actually used. The one that is used accepts an `addr` parameter (the
base text offset), but its sole caller passes a constant, 0. We want to
keep calling the three-arguments standard_psymtab constructor form,
however, since it differs from the two-arguments form in subtle ways.
Also, I believe the dwarf2_per_cu_data associated to the created
dwarf2_psymtab should be passed as a constructor argument. That will
help me in a future patchset, to convince myself that the `per_cu_data`
field can't be NULL.
So this patch:
- Removes the two-parameters constructor of dwarf2_psymtab, as it is
unused.
- Removes the `addr` parameter of the remaining constructor, passing 0
directly to the base class' constructor.
- Adds a `per_cu` parameter, to assign the `per_cu_data` field at
construction.
gdb/ChangeLog:
* dwarf2/read.h (struct dwarf2_psymtab): Remove two-parameters
constructor. Remove `addr` parameter from other constructor and
add `per_cu` parameter.
* dwarf2/read.c (create_partial_symtab): Update.
---
gdb/dwarf2/read.c | 3 +--
gdb/dwarf2/read.h | 10 +++-------
2 files changed, 4 insertions(+), 9 deletions(-)
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index 749acb3ba26c..f0d809a68bc6 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -7161,12 +7161,11 @@ create_partial_symtab (struct dwarf2_per_cu_data *per_cu, const char *name)
struct objfile *objfile = per_cu->dwarf2_per_objfile->objfile;
dwarf2_psymtab *pst;
- pst = new dwarf2_psymtab (name, objfile, 0);
+ pst = new dwarf2_psymtab (name, objfile, per_cu);
pst->psymtabs_addrmap_supported = true;
/* This is the glue that links PST into GDB's symbol API. */
- pst->per_cu_data = per_cu;
per_cu->v.psymtab = pst;
return pst;
diff --git a/gdb/dwarf2/read.h b/gdb/dwarf2/read.h
index 039113f87e99..bd743acc7150 100644
--- a/gdb/dwarf2/read.h
+++ b/gdb/dwarf2/read.h
@@ -253,14 +253,10 @@ dwarf2_per_objfile *get_dwarf2_per_objfile (struct objfile *objfile);
/* A partial symtab specialized for DWARF. */
struct dwarf2_psymtab : public standard_psymtab
{
- dwarf2_psymtab (const char *filename, struct objfile *objfile)
- : standard_psymtab (filename, objfile)
- {
- }
-
dwarf2_psymtab (const char *filename, struct objfile *objfile,
- CORE_ADDR addr)
- : standard_psymtab (filename, objfile, addr)
+ dwarf2_per_cu_data *per_cu)
+ : standard_psymtab (filename, objfile, 0),
+ per_cu_data (per_cu)
{
}
--
2.26.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] gdb: small cleanups in dwarf2_psymtab constructors
2020-04-07 4:19 [PATCH] gdb: small cleanups in dwarf2_psymtab constructors Simon Marchi
@ 2020-04-07 15:47 ` Tom Tromey
2020-04-07 15:49 ` Simon Marchi
0 siblings, 1 reply; 3+ messages in thread
From: Tom Tromey @ 2020-04-07 15:47 UTC (permalink / raw)
To: Simon Marchi via Gdb-patches
>>>>> "Simon" == Simon Marchi via Gdb-patches <gdb-patches@sourceware.org> writes:
Simon> * dwarf2/read.h (struct dwarf2_psymtab): Remove two-parameters
Simon> constructor. Remove `addr` parameter from other constructor and
Simon> add `per_cu` parameter.
Simon> * dwarf2/read.c (create_partial_symtab): Update.
Looks good to me. Thank you.
Tom
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] gdb: small cleanups in dwarf2_psymtab constructors
2020-04-07 15:47 ` Tom Tromey
@ 2020-04-07 15:49 ` Simon Marchi
0 siblings, 0 replies; 3+ messages in thread
From: Simon Marchi @ 2020-04-07 15:49 UTC (permalink / raw)
To: Tom Tromey, Simon Marchi via Gdb-patches
On 2020-04-07 11:47 a.m., Tom Tromey wrote:
>>>>>> "Simon" == Simon Marchi via Gdb-patches <gdb-patches@sourceware.org> writes:
>
> Simon> * dwarf2/read.h (struct dwarf2_psymtab): Remove two-parameters
> Simon> constructor. Remove `addr` parameter from other constructor and
> Simon> add `per_cu` parameter.
> Simon> * dwarf2/read.c (create_partial_symtab): Update.
>
> Looks good to me. Thank you.
>
> Tom
>
Thanks, I pushed it.
Simon
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-04-07 15:49 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-07 4:19 [PATCH] gdb: small cleanups in dwarf2_psymtab constructors Simon Marchi
2020-04-07 15:47 ` Tom Tromey
2020-04-07 15:49 ` Simon Marchi
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).