gdb: remove COMPUNIT_FILETABS macro

I think that most remaining uses of COMPUNIT_FILETABS intend to get the
primary filetab of the compunit_symtab specifically (and not to iterate
over all filetabs, for example, those cases would use compunit_filetabs,
which has been converted to compunit_symtab::filetabs), so replace mosts
uses with compunit_symtab::primary_filetab.

In jit.c, function finalize_symtab, we can save the symtab object
returned by allocate_symtab and use it, it makes things simpler.

Change-Id: I4e51d6d4b40759de8768b61292e5e13c8eae2e38
This commit is contained in:
Simon Marchi
2021-11-19 21:35:17 -05:00
committed by Simon Marchi
parent 102cc23543
commit 510860f278
7 changed files with 24 additions and 24 deletions

View File

@@ -509,7 +509,7 @@ finalize_symtab (struct gdb_symtab *stab, struct objfile *objfile)
});
cust = allocate_compunit_symtab (objfile, stab->file_name.c_str ());
allocate_symtab (cust, stab->file_name.c_str ());
symtab *filetab = allocate_symtab (cust, stab->file_name.c_str ());
add_compunit_symtab_to_objfile (cust);
/* JIT compilers compile in memory. */
@@ -521,9 +521,9 @@ finalize_symtab (struct gdb_symtab *stab, struct objfile *objfile)
size_t size = ((stab->linetable->nitems - 1)
* sizeof (struct linetable_entry)
+ sizeof (struct linetable));
SYMTAB_LINETABLE (COMPUNIT_FILETABS (cust))
SYMTAB_LINETABLE (filetab)
= (struct linetable *) obstack_alloc (&objfile->objfile_obstack, size);
memcpy (SYMTAB_LINETABLE (COMPUNIT_FILETABS (cust)),
memcpy (SYMTAB_LINETABLE (filetab),
stab->linetable.get (), size);
}
@@ -562,7 +562,7 @@ finalize_symtab (struct gdb_symtab *stab, struct objfile *objfile)
/* The name. */
SYMBOL_DOMAIN (block_name) = VAR_DOMAIN;
SYMBOL_ACLASS_INDEX (block_name) = LOC_BLOCK;
symbol_set_symtab (block_name, COMPUNIT_FILETABS (cust));
symbol_set_symtab (block_name, filetab);
SYMBOL_TYPE (block_name) = lookup_function_type (block_type);
SYMBOL_BLOCK_VALUE (block_name) = new_block;