From 32177d6e39a2ed82fdafd7c41456c311b64d09fc Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Thu, 27 Jan 2022 22:08:54 -0500 Subject: [PATCH] gdb: remove SYMBOL_INLINED macro Add a getter and a setter for whether a symbol is inlined. Remove the corresponding macro and adjust all callers. Change-Id: I934468da3b5a32dd6b161a6f252a6b1b94737279 --- gdb/block.c | 2 +- gdb/dwarf2/read.c | 2 +- gdb/linespec.c | 2 +- gdb/symtab.h | 15 ++++++++++++--- 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/gdb/block.c b/gdb/block.c index f7532120286..3d11ea60768 100644 --- a/gdb/block.c +++ b/gdb/block.c @@ -124,7 +124,7 @@ block_containing_function (const struct block *bl) int block_inlined_p (const struct block *bl) { - return BLOCK_FUNCTION (bl) != NULL && SYMBOL_INLINED (BLOCK_FUNCTION (bl)); + return BLOCK_FUNCTION (bl) != NULL && BLOCK_FUNCTION (bl)->is_inlined (); } /* A helper function that checks whether PC is in the blockvector BL. diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index 259401fbbb7..95d4d6fc553 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -21794,7 +21794,7 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu, /* SYMBOL_BLOCK_VALUE (sym) will be filled in later by finish_block. */ sym->set_aclass_index (LOC_BLOCK); - SYMBOL_INLINED (sym) = 1; + sym->set_is_inlined (1); list_to_add = cu->list_in_scope; break; case DW_TAG_template_value_param: diff --git a/gdb/linespec.c b/gdb/linespec.c index ac21bbd2348..7c403679455 100644 --- a/gdb/linespec.c +++ b/gdb/linespec.c @@ -1200,7 +1200,7 @@ iterate_over_all_matching_symtabs { /* Restrict calls to CALLBACK to symbols representing inline symbols only. */ - if (SYMBOL_INLINED (bsym->symbol)) + if (bsym->symbol->is_inlined ()) return callback (bsym); return true; }); diff --git a/gdb/symtab.h b/gdb/symtab.h index f565f125824..9b7d7e35c97 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h @@ -1117,7 +1117,7 @@ struct symbol : public general_symbol_info, public allocate_on_obstack m_aclass_index (0), m_is_objfile_owned (1), m_is_argument (0), - is_inlined (0), + m_is_inlined (0), maybe_copied (0), subclass (SYMBOL_NONE), artificial (false) @@ -1188,6 +1188,16 @@ struct symbol : public general_symbol_info, public allocate_on_obstack m_is_argument = is_argument; } + bool is_inlined () const + { + return m_is_inlined; + } + + void set_is_inlined (bool is_inlined) + { + m_is_inlined = is_inlined; + } + /* Data type of value */ struct type *type = nullptr; @@ -1226,7 +1236,7 @@ struct symbol : public general_symbol_info, public allocate_on_obstack unsigned m_is_argument : 1; /* Whether this is an inlined function (class LOC_BLOCK only). */ - unsigned is_inlined : 1; + unsigned m_is_inlined : 1; /* For LOC_STATIC only, if this is set, then the symbol might be subject to copy relocation. In this case, a minimal symbol @@ -1290,7 +1300,6 @@ struct block_symbol /* Note: There is no accessor macro for symbol.owner because it is "private". */ -#define SYMBOL_INLINED(symbol) (symbol)->is_inlined #define SYMBOL_IS_CPLUS_TEMPLATE_FUNCTION(symbol) \ (((symbol)->subclass) == SYMBOL_TEMPLATE) #define SYMBOL_TYPE(symbol) (symbol)->type -- 2.30.2