gdb: remove COMPUNIT_OBJFILE macro

Remove the macro, update all users to use the getter directly.

Change-Id: I3f0fd6f4455d1c4ebd5da73b561eb18a979ef1f6
This commit is contained in:
Simon Marchi 2021-11-19 13:15:24 -05:00 committed by Simon Marchi
parent f1f58f102e
commit 9821f3fa56
7 changed files with 13 additions and 14 deletions

View File

@ -51,7 +51,7 @@ block_objfile (const struct block *block)
return symbol_objfile (BLOCK_FUNCTION (block));
global_block = (struct global_block *) block_global_block (block);
return COMPUNIT_OBJFILE (global_block->compunit_symtab);
return global_block->compunit_symtab->objfile ();
}
/* See block. */

View File

@ -301,7 +301,7 @@ restart_symtab (struct compunit_symtab *cust,
gdb_assert (buildsym_compunit == nullptr);
buildsym_compunit
= new struct buildsym_compunit (COMPUNIT_OBJFILE (cust),
= new struct buildsym_compunit (cust->objfile (),
name,
COMPUNIT_DIRNAME (cust),
compunit_language (cust),

View File

@ -10722,7 +10722,7 @@ dwarf2_cu::setup_type_unit_groups (struct die_info *die)
gdb_assert (m_builder == nullptr);
struct compunit_symtab *cust = tug_unshare->compunit_symtab;
m_builder.reset (new struct buildsym_compunit
(COMPUNIT_OBJFILE (cust), "",
(cust->objfile (), "",
COMPUNIT_DIRNAME (cust),
compunit_language (cust),
0, cust));
@ -10744,7 +10744,7 @@ dwarf2_cu::setup_type_unit_groups (struct die_info *die)
time. */
tug_unshare->symtabs
= XOBNEWVEC (&COMPUNIT_OBJFILE (cust)->objfile_obstack,
= XOBNEWVEC (&cust->objfile ()->objfile_obstack,
struct symtab *, line_header->file_names_size ());
auto &file_names = line_header->file_names ();
@ -10774,7 +10774,7 @@ dwarf2_cu::setup_type_unit_groups (struct die_info *die)
gdb_assert (m_builder == nullptr);
struct compunit_symtab *cust = tug_unshare->compunit_symtab;
m_builder.reset (new struct buildsym_compunit
(COMPUNIT_OBJFILE (cust), "",
(cust->objfile (), "",
COMPUNIT_DIRNAME (cust),
compunit_language (cust),
0, cust));

View File

@ -685,7 +685,7 @@ gdbscm_lookup_block (SCM pc_scm)
{
cust = find_pc_compunit_symtab (pc);
if (cust != NULL && COMPUNIT_OBJFILE (cust) != NULL)
if (cust != NULL && cust->objfile () != NULL)
block = block_for_pc (pc);
}
catch (const gdb_exception &except)
@ -694,14 +694,14 @@ gdbscm_lookup_block (SCM pc_scm)
}
GDBSCM_HANDLE_GDB_EXCEPTION (exc);
if (cust == NULL || COMPUNIT_OBJFILE (cust) == NULL)
if (cust == NULL || cust->objfile () == NULL)
{
gdbscm_out_of_range_error (FUNC_NAME, SCM_ARG1, pc_scm,
_("cannot locate object file for block"));
}
if (block != NULL)
return bkscm_scm_from_block (block, COMPUNIT_OBJFILE (cust));
return bkscm_scm_from_block (block, cust->objfile ());
return SCM_BOOL_F;
}

View File

@ -388,7 +388,7 @@ pspy_block_for_pc (PyObject *o, PyObject *args)
set_current_program_space (self->pspace);
cust = find_pc_compunit_symtab (pc);
if (cust != NULL && COMPUNIT_OBJFILE (cust) != NULL)
if (cust != NULL && cust->objfile () != NULL)
block = block_for_pc (pc);
}
catch (const gdb_exception &except)
@ -396,11 +396,11 @@ pspy_block_for_pc (PyObject *o, PyObject *args)
GDB_PY_HANDLE_EXCEPTION (except);
}
if (cust == NULL || COMPUNIT_OBJFILE (cust) == NULL)
if (cust == NULL || cust->objfile () == NULL)
Py_RETURN_NONE;
if (block)
return block_to_block_object (block, COMPUNIT_OBJFILE (cust));
return block_to_block_object (block, cust->objfile ());
Py_RETURN_NONE;
}

View File

@ -1186,7 +1186,7 @@ open_source_file (struct symtab *s)
{
if (SYMTAB_COMPUNIT (s) != nullptr)
{
const objfile *ofp = COMPUNIT_OBJFILE (SYMTAB_COMPUNIT (s));
const objfile *ofp = SYMTAB_COMPUNIT (s)->objfile ();
std::string srcpath;
if (IS_ABSOLUTE_PATH (s->filename))

View File

@ -1407,7 +1407,7 @@ struct symtab
#define SYMTAB_BLOCKVECTOR(symtab) \
COMPUNIT_BLOCKVECTOR (SYMTAB_COMPUNIT (symtab))
#define SYMTAB_OBJFILE(symtab) \
COMPUNIT_OBJFILE (SYMTAB_COMPUNIT (symtab))
(SYMTAB_COMPUNIT (symtab)->objfile ())
#define SYMTAB_PSPACE(symtab) (SYMTAB_OBJFILE (symtab)->pspace)
#define SYMTAB_DIRNAME(symtab) \
COMPUNIT_DIRNAME (SYMTAB_COMPUNIT (symtab))
@ -1545,7 +1545,6 @@ struct compunit_symtab
using compunit_symtab_range = next_range<compunit_symtab>;
#define COMPUNIT_OBJFILE(cust) ((cust)->objfile ())
#define COMPUNIT_FILETABS(cust) ((cust)->filetabs)
#define COMPUNIT_DEBUGFORMAT(cust) ((cust)->debugformat)
#define COMPUNIT_PRODUCER(cust) ((cust)->producer)