From: Tom Tromey Date: Fri, 17 Oct 2025 01:17:14 +0000 (-0600) Subject: Remove buildsym_compunit::end_compunit_symtab_with_blockvector X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a0afd6b66effcf411dab750740e581a1f8d34982;p=thirdparty%2Fbinutils-gdb.git Remove buildsym_compunit::end_compunit_symtab_with_blockvector This patch removes buildsym_compunit::end_compunit_symtab_with_blockvector. This method is only called in one spot and the two methods can easily be combined. Approved-By: Simon Marchi --- diff --git a/gdb/buildsym.c b/gdb/buildsym.c index ce671716b45..e2e694cf090 100644 --- a/gdb/buildsym.c +++ b/gdb/buildsym.c @@ -818,13 +818,14 @@ buildsym_compunit::end_compunit_symtab_get_static_block (CORE_ADDR end_addr, } } -/* Subroutine of end_compunit_symtab_from_static_block to simplify it. - Handle the "have blockvector" case. - See end_compunit_symtab_from_static_block for a description of the - arguments. */ +/* Implementation of the second part of end_compunit_symtab. Pass STATIC_BLOCK + as value returned by end_compunit_symtab_get_static_block. + + If EXPANDABLE is non-zero the GLOBAL_BLOCK dictionary is made + expandable. */ struct compunit_symtab * -buildsym_compunit::end_compunit_symtab_with_blockvector +buildsym_compunit::end_compunit_symtab_from_static_block (struct block *static_block, int expandable) { struct compunit_symtab *cu = m_compunit_symtab; @@ -832,7 +833,20 @@ buildsym_compunit::end_compunit_symtab_with_blockvector struct subfile *subfile; CORE_ADDR end_addr; - gdb_assert (static_block != NULL); + if (static_block == nullptr) + { + /* Handle the "no blockvector" case. + When this happens there is nothing to record, so there's nothing + to do: memory will be freed up later. + + Note: We won't be adding a compunit to the objfile's list of + compunits, so there's nothing to unchain. However, since each symtab + is added to the objfile's obstack we can't free that space. + We could do better, but this is believed to be a sufficiently rare + event. */ + return nullptr; + } + gdb_assert (m_subfiles != NULL); end_addr = static_block->end (); @@ -965,37 +979,6 @@ buildsym_compunit::end_compunit_symtab_with_blockvector return cu; } -/* Implementation of the second part of end_compunit_symtab. Pass STATIC_BLOCK - as value returned by end_compunit_symtab_get_static_block. - - If EXPANDABLE is non-zero the GLOBAL_BLOCK dictionary is made - expandable. */ - -struct compunit_symtab * -buildsym_compunit::end_compunit_symtab_from_static_block - (struct block *static_block, int expandable) -{ - struct compunit_symtab *cu; - - if (static_block == NULL) - { - /* Handle the "no blockvector" case. - When this happens there is nothing to record, so there's nothing - to do: memory will be freed up later. - - Note: We won't be adding a compunit to the objfile's list of - compunits, so there's nothing to unchain. However, since each symtab - is added to the objfile's obstack we can't free that space. - We could do better, but this is believed to be a sufficiently rare - event. */ - cu = NULL; - } - else - cu = end_compunit_symtab_with_blockvector (static_block, expandable); - - return cu; -} - /* Finish the symbol definitions for one main source file, close off all the lexical contexts for that file (creating struct block's for them), then make the struct symtab for that file and put it in the diff --git a/gdb/buildsym.h b/gdb/buildsym.h index b568b15fad0..63d2628b2bc 100644 --- a/gdb/buildsym.h +++ b/gdb/buildsym.h @@ -353,9 +353,6 @@ private: void watch_main_source_file_lossage (); - struct compunit_symtab *end_compunit_symtab_with_blockvector - (struct block *static_block, int expandable); - /* The objfile we're reading debug info from. */ struct objfile *m_objfile;