From: Simon Marchi Date: Fri, 28 Jan 2022 03:01:10 +0000 (-0500) Subject: gdb: remove SYMBOL_OBJFILE_OWNED macro X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7b3ecc7555438f05dda657d0ed6a43ee71a3901d;p=binutils-gdb.git gdb: remove SYMBOL_OBJFILE_OWNED macro Add a getter and a setter for whether a symbol is objfile owned. Remove the corresponding macro and adjust all callers. Change-Id: Ib7ef3718d65553ae924ca04c3fd478b0f4f3147c --- diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index dd1be604563..77d6c07c6a9 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -3352,7 +3352,7 @@ See set/show multiple-symbol.")); && SYMBOL_TYPE (syms[i].symbol)->code () == TYPE_CODE_ENUM); struct symtab *symtab = NULL; - if (SYMBOL_OBJFILE_OWNED (syms[i].symbol)) + if (syms[i].symbol->is_objfile_owned ()) symtab = symbol_symtab (syms[i].symbol); if (SYMBOL_LINE (syms[i].symbol) != 0 && symtab != NULL) @@ -4376,7 +4376,7 @@ cache_symbol (const char *name, domain_enum domain, struct symbol *sym, /* Symbols for builtin types don't have a block. For now don't cache such symbols. */ - if (sym != NULL && !SYMBOL_OBJFILE_OWNED (sym)) + if (sym != NULL && !sym->is_objfile_owned ()) return; /* If the symbol is a local symbol, then do not cache it, as a search diff --git a/gdb/guile/scm-symbol.c b/gdb/guile/scm-symbol.c index 9816a90a8dd..caad90f4678 100644 --- a/gdb/guile/scm-symbol.c +++ b/gdb/guile/scm-symbol.c @@ -101,7 +101,7 @@ syscm_get_symbol_map (struct symbol *symbol) { htab_t htab; - if (SYMBOL_OBJFILE_OWNED (symbol)) + if (symbol->is_objfile_owned ()) { struct objfile *objfile = symbol_objfile (symbol); @@ -362,7 +362,7 @@ gdbscm_symbol_symtab (SCM self) = syscm_get_valid_symbol_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME); const struct symbol *symbol = s_smob->symbol; - if (!SYMBOL_OBJFILE_OWNED (symbol)) + if (!symbol->is_objfile_owned ()) return SCM_BOOL_F; return stscm_scm_from_symtab (symbol_symtab (symbol)); } diff --git a/gdb/language.c b/gdb/language.c index b33ff7ff0da..1d4b1b31252 100644 --- a/gdb/language.c +++ b/gdb/language.c @@ -998,7 +998,7 @@ language_arch_info::type_and_symbol::alloc_type_symbol symbol->m_name = type->name (); symbol->set_language (lang, nullptr); symbol->owner.arch = gdbarch; - SYMBOL_OBJFILE_OWNED (symbol) = 0; + symbol->set_is_objfile_owned (0); symbol->set_section_index (0); SYMBOL_TYPE (symbol) = type; symbol->set_domain (VAR_DOMAIN); diff --git a/gdb/printcmd.c b/gdb/printcmd.c index 0b0a1d63a81..787d8d77128 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -1686,7 +1686,7 @@ info_address_command (const char *exp, int from_tty) puts_filtered (sym->print_name ()); printf_filtered ("\" is "); val = SYMBOL_VALUE (sym); - if (SYMBOL_OBJFILE_OWNED (sym)) + if (sym->is_objfile_owned ()) section = sym->obj_section (symbol_objfile (sym)); else section = NULL; diff --git a/gdb/python/py-symbol.c b/gdb/python/py-symbol.c index fe62809c19b..708474331d7 100644 --- a/gdb/python/py-symbol.c +++ b/gdb/python/py-symbol.c @@ -88,7 +88,7 @@ sympy_get_symtab (PyObject *self, void *closure) SYMPY_REQUIRE_VALID (self, symbol); - if (!SYMBOL_OBJFILE_OWNED (symbol)) + if (!symbol->is_objfile_owned ()) Py_RETURN_NONE; return symtab_to_symtab_object (symbol_symtab (symbol)); @@ -302,7 +302,7 @@ set_symbol (symbol_object *obj, struct symbol *symbol) { obj->symbol = symbol; obj->prev = NULL; - if (SYMBOL_OBJFILE_OWNED (symbol) + if (symbol->is_objfile_owned () && symbol_symtab (symbol) != NULL) { struct objfile *objfile = symbol_objfile (symbol); @@ -348,7 +348,7 @@ sympy_dealloc (PyObject *obj) if (sym_obj->prev) sym_obj->prev->next = sym_obj->next; else if (sym_obj->symbol != NULL - && SYMBOL_OBJFILE_OWNED (sym_obj->symbol) + && sym_obj->symbol->is_objfile_owned () && symbol_symtab (sym_obj->symbol) != NULL) { set_objfile_data (symbol_objfile (sym_obj->symbol), diff --git a/gdb/symmisc.c b/gdb/symmisc.c index 9bba067a07f..cb16b5c202b 100644 --- a/gdb/symmisc.c +++ b/gdb/symmisc.c @@ -502,7 +502,7 @@ print_symbol (struct gdbarch *gdbarch, struct symbol *symbol, { struct obj_section *section; - if (SYMBOL_OBJFILE_OWNED (symbol)) + if (symbol->is_objfile_owned ()) section = symbol->obj_section (symbol_objfile (symbol)); else section = NULL; diff --git a/gdb/symtab.c b/gdb/symtab.c index 5e4a461deb9..8bdc6cab960 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -1789,7 +1789,7 @@ fixup_symbol_section (struct symbol *sym, struct objfile *objfile) if (!sym) return NULL; - if (!SYMBOL_OBJFILE_OWNED (sym)) + if (!sym->is_objfile_owned ()) return sym; /* We either have an OBJFILE, or we can get at it from the sym's @@ -6534,7 +6534,7 @@ initialize_ordinary_address_classes (void) struct objfile * symbol_objfile (const struct symbol *symbol) { - gdb_assert (SYMBOL_OBJFILE_OWNED (symbol)); + gdb_assert (symbol->is_objfile_owned ()); return symbol->owner.symtab->objfile (); } @@ -6543,7 +6543,7 @@ symbol_objfile (const struct symbol *symbol) struct gdbarch * symbol_arch (const struct symbol *symbol) { - if (!SYMBOL_OBJFILE_OWNED (symbol)) + if (!symbol->is_objfile_owned ()) return symbol->owner.arch; return symbol->owner.symtab->objfile ()->arch (); } @@ -6553,7 +6553,7 @@ symbol_arch (const struct symbol *symbol) struct symtab * symbol_symtab (const struct symbol *symbol) { - gdb_assert (SYMBOL_OBJFILE_OWNED (symbol)); + gdb_assert (symbol->is_objfile_owned ()); return symbol->owner.symtab; } @@ -6562,7 +6562,7 @@ symbol_symtab (const struct symbol *symbol) void symbol_set_symtab (struct symbol *symbol, struct symtab *symtab) { - gdb_assert (SYMBOL_OBJFILE_OWNED (symbol)); + gdb_assert (symbol->is_objfile_owned ()); symbol->owner.symtab = symtab; } diff --git a/gdb/symtab.h b/gdb/symtab.h index 2825697fc19..ef9e653dfad 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h @@ -1115,7 +1115,7 @@ struct symbol : public general_symbol_info, public allocate_on_obstack /* Class-initialization of bitfields is only allowed in C++20. */ : m_domain (UNDEF_DOMAIN), m_aclass_index (0), - is_objfile_owned (1), + m_is_objfile_owned (1), is_argument (0), is_inlined (0), maybe_copied (0), @@ -1168,6 +1168,16 @@ struct symbol : public general_symbol_info, public allocate_on_obstack m_domain = domain; } + bool is_objfile_owned () const + { + return m_is_objfile_owned; + } + + void set_is_objfile_owned (bool is_objfile_owned) + { + m_is_objfile_owned = is_objfile_owned; + } + /* Data type of value */ struct type *type = nullptr; @@ -1199,7 +1209,7 @@ struct symbol : public general_symbol_info, public allocate_on_obstack /* If non-zero then symbol is objfile-owned, use owner.symtab. Otherwise symbol is arch-owned, use owner.arch. */ - unsigned int is_objfile_owned : 1; + unsigned int m_is_objfile_owned : 1; /* Whether this is an argument. */ @@ -1270,7 +1280,6 @@ struct block_symbol /* Note: There is no accessor macro for symbol.owner because it is "private". */ -#define SYMBOL_OBJFILE_OWNED(symbol) ((symbol)->is_objfile_owned) #define SYMBOL_IS_ARGUMENT(symbol) (symbol)->is_argument #define SYMBOL_INLINED(symbol) (symbol)->is_inlined #define SYMBOL_IS_CPLUS_TEMPLATE_FUNCTION(symbol) \