]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
gdb: Make dbxread rely less on global variables
authorGuinevere Larsen <guinevere@redhat.com>
Fri, 6 Sep 2024 17:47:44 +0000 (14:47 -0300)
committerGuinevere Larsen <guinevere@redhat.com>
Fri, 20 Sep 2024 20:01:35 +0000 (17:01 -0300)
commit890f0ceb616bf64caee9d09c7b14159f19fd7111
tree1c31ade60beb57f90326cef7978fad25c1aec893
parentb0170acd5a9e834e2b37ff151fa817e9a7a1412a
gdb: Make dbxread rely less on global variables

The file dbxread.c, which is responsible for reading stabs information
for multiple file formats, relies heavily on setting and using global
variables over the course of reading symbols.

Future patches aim to make stabs reading more file format independent,
and this patch starts that change by introducing a stabs_context struct,
that will hold all the relevant variables. This context struct is saved
on the registry key inside the objfile being read. Some of those global
variables have been deemed irrelevant:
* dbxread_objfile - Since we're saving in an objfile, this is redundant
* symfile_bfd - It is trivial to get the bfd pointer from the objfile,
  so also unnecessary
* string_table_offset - was never initialized, just used to set a value.
  That usage was substituted by a hardcoded 0
* next_file_string_table_offset - was only used by read_dbx_symtab, so
  it was turned into a local variable there.

As I was moving variables, I also couldn't think of a good reason for
the bincl_list to be a pointer, so it was changed to just be an
std::vector.

Approved-By: Tom Tromey <tom@tromey.com>
gdb/dbxread.c
gdb/gdb-stabs.h