From 9821f3fa56de3e2c13c234357421ae1839ce27f7 Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Fri, 19 Nov 2021 13:15:24 -0500 Subject: [PATCH] gdb: remove COMPUNIT_OBJFILE macro Remove the macro, update all users to use the getter directly. Change-Id: I3f0fd6f4455d1c4ebd5da73b561eb18a979ef1f6 --- gdb/block.c | 2 +- gdb/buildsym-legacy.c | 2 +- gdb/dwarf2/read.c | 6 +++--- gdb/guile/scm-block.c | 6 +++--- gdb/python/py-progspace.c | 6 +++--- gdb/source.c | 2 +- gdb/symtab.h | 3 +-- 7 files changed, 13 insertions(+), 14 deletions(-) diff --git a/gdb/block.c b/gdb/block.c index 2b6196c09aa..61716458457 100644 --- a/gdb/block.c +++ b/gdb/block.c @@ -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. */ diff --git a/gdb/buildsym-legacy.c b/gdb/buildsym-legacy.c index 8f00902f490..aa7b8b56b89 100644 --- a/gdb/buildsym-legacy.c +++ b/gdb/buildsym-legacy.c @@ -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), diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index 1a749eac334..fe274ed3a1f 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -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)); diff --git a/gdb/guile/scm-block.c b/gdb/guile/scm-block.c index 80cadbe1526..0c63dfb25f8 100644 --- a/gdb/guile/scm-block.c +++ b/gdb/guile/scm-block.c @@ -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; } diff --git a/gdb/python/py-progspace.c b/gdb/python/py-progspace.c index b27ebf4a666..1e01068c59b 100644 --- a/gdb/python/py-progspace.c +++ b/gdb/python/py-progspace.c @@ -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; } diff --git a/gdb/source.c b/gdb/source.c index f749dd64e3b..73c1c1d5188 100644 --- a/gdb/source.c +++ b/gdb/source.c @@ -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)) diff --git a/gdb/symtab.h b/gdb/symtab.h index 995026bbf82..dc15c49ec8e 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h @@ -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; -#define COMPUNIT_OBJFILE(cust) ((cust)->objfile ()) #define COMPUNIT_FILETABS(cust) ((cust)->filetabs) #define COMPUNIT_DEBUGFORMAT(cust) ((cust)->debugformat) #define COMPUNIT_PRODUCER(cust) ((cust)->producer) -- 2.30.2