aboutsummaryrefslogtreecommitdiff
path: root/gdb/jit.c
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@efficios.com>2024-07-30 10:37:01 -0400
committerSimon Marchi <simon.marchi@efficios.com>2024-08-21 15:38:11 -0400
commit57a91ca28fa903375bfc829d8f6ad3fb8f34e1b0 (patch)
treecd4778b4594348bf7fe93b38cced367f0155b658 /gdb/jit.c
parent5d683ae3dadd78fa88c243310404480555555246 (diff)
downloadbinutils-57a91ca28fa903375bfc829d8f6ad3fb8f34e1b0.zip
binutils-57a91ca28fa903375bfc829d8f6ad3fb8f34e1b0.tar.gz
binutils-57a91ca28fa903375bfc829d8f6ad3fb8f34e1b0.tar.bz2
gdb: some global_block improvements
Some refactors around struct global_block, all in one patch because they all tie in together and are relatively trivial. - Make block::global_block() and blockvector::global_block() return `global_block *`, instead of `block *`. There is no cost in doing so, and it's a bit more precise. Callers of these methods that need a `global_block *` won't need to cast themselves. - Add some block::as_global_block methods, as a way to get a `global_block *` from a `block *` when you know it's a global block. This is basically a static cast with an assert. - Move set_compunit_symtab to global_block, since it requires the block to be a global block anyway. Rename to just `set_compunit` (I think that compunit_symtab should just be renamed compunit...). - Move the get_block_compunit_symtab free function to be a method of global_block. - Make global_block::compunit_symtab private and rename. - Simplify initialize_block_iterator. Change-Id: I1667a86b5c1a02d0d460cfad55b5d3d48867583d Approved-By: Tom Tromey <tom@tromey.com>
Diffstat (limited to 'gdb/jit.c')
-rw-r--r--gdb/jit.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/gdb/jit.c b/gdb/jit.c
index d451332..89c967d 100644
--- a/gdb/jit.c
+++ b/gdb/jit.c
@@ -613,6 +613,7 @@ finalize_symtab (struct gdb_symtab *stab, struct objfile *objfile)
new_block = new (&objfile->objfile_obstack) global_block;
else
new_block = new (&objfile->objfile_obstack) block;
+
new_block->set_multidict
(mdict_create_linear (&objfile->objfile_obstack, NULL));
new_block->set_superblock (block_iter);
@@ -624,7 +625,7 @@ finalize_symtab (struct gdb_symtab *stab, struct objfile *objfile)
bv->set_block (i, new_block);
if (i == GLOBAL_BLOCK)
- new_block->set_compunit_symtab (cust);
+ new_block->as_global_block ()->set_compunit (cust);
}
/* Fill up the superblock fields for the real blocks, using the