From c61596525811d9b0fe79be8f11e5a142ade96dab Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Fri, 19 Nov 2021 22:49:01 -0500 Subject: gdb: remove SYMTAB_COMPUNIT macro, add getter/setter Add a getter and a setter for a symtab's compunit_symtab. Remove the corresponding macro and adjust all callers. For brevity, I chose the name "compunit" instead of "compunit_symtab" the the field, getter and setter names. Since we are already in symtab context, the _symtab suffix seems redundant. Change-Id: I4b9b731c96e3594f7733e75af1e3d01bc0e4fe92 --- gdb/symtab.h | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'gdb/symtab.h') diff --git a/gdb/symtab.h b/gdb/symtab.h index c319d51..c313d54 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h @@ -1373,6 +1373,16 @@ typedef std::vector section_offsets; struct symtab { + struct compunit_symtab *compunit () const + { + return m_compunit; + } + + void set_compunit (struct compunit_symtab *compunit) + { + m_compunit = compunit; + } + /* Unordered chain of all filetabs in the compunit, with the exception that the "main" source file is the first entry in the list. */ @@ -1380,7 +1390,7 @@ struct symtab /* Backlink to containing compunit symtab. */ - struct compunit_symtab *compunit_symtab; + struct compunit_symtab *m_compunit; /* Table mapping core addresses to line numbers for this file. Can be NULL if none. Never shared between different symtabs. */ @@ -1405,15 +1415,14 @@ struct symtab using symtab_range = next_range; -#define SYMTAB_COMPUNIT(symtab) ((symtab)->compunit_symtab) #define SYMTAB_LINETABLE(symtab) ((symtab)->linetable) #define SYMTAB_LANGUAGE(symtab) ((symtab)->language) #define SYMTAB_BLOCKVECTOR(symtab) \ - (SYMTAB_COMPUNIT (symtab)->blockvector ()) + (symtab->compunit ()->blockvector ()) #define SYMTAB_OBJFILE(symtab) \ - (SYMTAB_COMPUNIT (symtab)->objfile ()) + (symtab->compunit ()->objfile ()) #define SYMTAB_PSPACE(symtab) (SYMTAB_OBJFILE (symtab)->pspace) -#define SYMTAB_DIRNAME(symtab) (SYMTAB_COMPUNIT (symtab)->dirname ()) +#define SYMTAB_DIRNAME(symtab) ((symtab)->compunit ()->dirname ()) /* Compunit symtabs contain the actual "symbol table", aka blockvector, as well as the list of all source files (what gdb has historically associated with @@ -1665,7 +1674,7 @@ extern enum language compunit_language (const struct compunit_symtab *cust); static inline bool is_main_symtab_of_compunit_symtab (struct symtab *symtab) { - return symtab == SYMTAB_COMPUNIT (symtab)->primary_filetab (); + return symtab == symtab->compunit ()->primary_filetab (); } -- cgit v1.1