diff options
author | Simon Marchi <simon.marchi@efficios.com> | 2021-11-19 22:49:01 -0500 |
---|---|---|
committer | Simon Marchi <simon.marchi@polymtl.ca> | 2022-02-06 15:48:19 -0500 |
commit | c61596525811d9b0fe79be8f11e5a142ade96dab (patch) | |
tree | 8bc43629e072791d0790a2264c0b1fcd7998bd3b /gdb/symtab.h | |
parent | 10cc645b6a09c58cf1a5ce53accbe6cf3178ca12 (diff) | |
download | fsf-binutils-gdb-c61596525811d9b0fe79be8f11e5a142ade96dab.zip fsf-binutils-gdb-c61596525811d9b0fe79be8f11e5a142ade96dab.tar.gz fsf-binutils-gdb-c61596525811d9b0fe79be8f11e5a142ade96dab.tar.bz2 |
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
Diffstat (limited to 'gdb/symtab.h')
-rw-r--r-- | gdb/symtab.h | 21 |
1 files changed, 15 insertions, 6 deletions
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<CORE_ADDR> 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<symtab>; -#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 (); } |