summaryrefslogtreecommitdiff
path: root/gdb/psympriv.h
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@polymtl.ca>2021-04-02 11:45:25 -0400
committerSimon Marchi <simon.marchi@polymtl.ca>2021-04-02 11:45:37 -0400
commit0072c873792829e2be43acf8bbf1c352c266e4c7 (patch)
tree50a2ade2ef271eede88340679e65e81e0c009a0a /gdb/psympriv.h
parent9984dd9994c3d71fd28f41c50cdece48d6be13a6 (diff)
downloadbinutils-gdb-0072c873792829e2be43acf8bbf1c352c266e4c7.tar.gz
gdb: pass objfile_per_bfd_storage instead of objfile to partial_symtab
Since partial_symtab is supposed to be objfile-independent (since series [1]), I think it would make sense for partial_symtab to not take an objfile as a parameter in its constructor. This patch replaces that parameter with an objfile_per_bfd_storage parameter. The objfile is used for two things: - to get the objfile_name, for debug messages. We can get that name from the bfd instead. - to intern the partial symtab filename. Even though it goes through an objfile method, the request is actually forwarded to the underlying objfile_per_bfd_storage. So we can ask the new objfile_per_bfd_storage instead. In order to get a reference to the BFD from the objfile_per_bfd_storage, the BFD is saved in the objfile_per_bfd_storage object. [1] https://sourceware.org/pipermail/gdb-patches/2021-February/176625.html gdb/ChangeLog: * psympriv.h (struct partial_symtab) <partial_symtab>: Change objfile parameter for objfile_per_bfd_storage, adjust callers. (struct standard_psymtab) <standard_psymtab>: Likewise. (struct legacy_psymtab) <legacy_psymtab>: Likewise. * psymtab.c (partial_symtab::partial_symtab): Likewise. * ctfread.c (struct ctf_psymtab): Likewise. * dwarf2/read.h (struct dwarf2_psymtab): Likewise. * dwarf2/read.c (struct dwarf2_include_psymtab): Likewise. (dwarf2_create_include_psymtab): Likewise. * objfiles.h (struct objfile_per_bfd_storage) <objfile_per_bfd_storage>: Add bfd parameter, adjust callers. <get_bfd>: New method. <m_bfd>: New field. * objfiles.c (get_objfile_bfd_data): Adjust. Change-Id: I2ed3ab5d2e6f27d034bd4dc26ae2fae7b0b8a2b9
Diffstat (limited to 'gdb/psympriv.h')
-rw-r--r--gdb/psympriv.h23
1 files changed, 12 insertions, 11 deletions
diff --git a/gdb/psympriv.h b/gdb/psympriv.h
index 193d64fbcf2..e4bf038108f 100644
--- a/gdb/psympriv.h
+++ b/gdb/psympriv.h
@@ -111,7 +111,8 @@ enum class psymbol_placement
struct partial_symtab
{
- /* Allocate a new partial symbol table associated with OBJFILE.
+ /* Allocate a new partial symbol table.
+
FILENAME (which must be non-NULL) is the filename of this partial
symbol table; it is copied into the appropriate storage. The
partial symtab will also be installed using
@@ -119,7 +120,7 @@ struct partial_symtab
partial_symtab (const char *filename,
psymtab_storage *partial_symtabs,
- struct objfile *objfile)
+ objfile_per_bfd_storage *objfile_per_bfd)
ATTRIBUTE_NONNULL (2) ATTRIBUTE_NONNULL (3);
/* Like the above, but also sets the initial text low and text high
@@ -128,7 +129,7 @@ struct partial_symtab
partial_symtab (const char *filename,
psymtab_storage *partial_symtabs,
- struct objfile *objfile,
+ objfile_per_bfd_storage *objfile_per_bfd,
CORE_ADDR addr)
ATTRIBUTE_NONNULL (2) ATTRIBUTE_NONNULL (3);
@@ -369,16 +370,16 @@ struct standard_psymtab : public partial_symtab
{
standard_psymtab (const char *filename,
psymtab_storage *partial_symtabs,
- struct objfile *objfile)
- : partial_symtab (filename, partial_symtabs, objfile)
+ objfile_per_bfd_storage *objfile_per_bfd)
+ : partial_symtab (filename, partial_symtabs, objfile_per_bfd)
{
}
standard_psymtab (const char *filename,
psymtab_storage *partial_symtabs,
- struct objfile *objfile,
+ objfile_per_bfd_storage *objfile_per_bfd,
CORE_ADDR addr)
- : partial_symtab (filename, partial_symtabs, objfile, addr)
+ : partial_symtab (filename, partial_symtabs, objfile_per_bfd, addr)
{
}
@@ -411,16 +412,16 @@ struct legacy_psymtab : public standard_psymtab
{
legacy_psymtab (const char *filename,
psymtab_storage *partial_symtabs,
- struct objfile *objfile)
- : standard_psymtab (filename, partial_symtabs, objfile)
+ objfile_per_bfd_storage *objfile_per_bfd)
+ : standard_psymtab (filename, partial_symtabs, objfile_per_bfd)
{
}
legacy_psymtab (const char *filename,
psymtab_storage *partial_symtabs,
- struct objfile *objfile,
+ objfile_per_bfd_storage *objfile_per_bfd,
CORE_ADDR addr)
- : standard_psymtab (filename, partial_symtabs, objfile, addr)
+ : standard_psymtab (filename, partial_symtabs, objfile_per_bfd, addr)
{
}