From 57a91ca28fa903375bfc829d8f6ad3fb8f34e1b0 Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Tue, 30 Jul 2024 10:37:01 -0400 Subject: 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 --- gdb/buildsym.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'gdb/buildsym.c') diff --git a/gdb/buildsym.c b/gdb/buildsym.c index 1c762ad..02d6848 100644 --- a/gdb/buildsym.c +++ b/gdb/buildsym.c @@ -951,11 +951,7 @@ buildsym_compunit::end_compunit_symtab_with_blockvector cu->set_producer (m_producer); cu->set_blockvector (blockvector); - { - struct block *b = blockvector->global_block (); - - b->set_compunit_symtab (cu); - } + blockvector->global_block ()->set_compunit (cu); cu->set_macro_table (release_macros ()); -- cgit v1.1