aboutsummaryrefslogtreecommitdiff
path: root/gdb/block.c
AgeCommit message (Collapse)AuthorFilesLines
2024-11-11Use an iterator range for 'using' directivesTom Tromey1-3/+3
This patch changes block::get_using to return an iterator range. This seemed cleaner to me than the current approach of returning a pointer to the first using directive; all the callers actually use this to iterate.
2024-08-28gdb: add 'maint info blocks' commandAndrew Burgess1-0/+123
While reviewing a patch I wanted to understand which blocks existed at a given address. The 'maint print symbols' command does provide some of this information, but that command displays all blocks within a given symtab. If I want to know which blocks are at a given address I have to figure that out for myself based on the output of 'maint print symbols' ... and I'm too lazy for that! So this command lists just those blocks at a given address, along with information about the blocks type. This new command doesn't list the symbols within each block, for that my expectation is that you'd cross reference the output with that of 'maint print symbols'. The new command format is: maintenance info blocks maintenance info blocks ADDRESS This lists the blocks at ADDRESS, or at the current $pc if ADDRESS is not given. Blocks are listed starting at the global block, then the static block, and then the progressively narrower scoped blocks. For each block we list the internal block pointer (which allows easy cross referencing with 'maint print symbols'), the inferior address range, along with other useful information. Reviewed-By: Eli Zaretskii <eliz@gnu.org> Approved-By: Simon Marchi <simon.marchi@efficios.com>
2024-08-21gdb: some global_block improvementsSimon Marchi1-45/+30
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>
2024-08-14Remove unnecessary default argument from initialize_block_iteratorTom Tromey1-1/+1
I noticed that initialize_block_iterator has a default value for one of its arguments, but this is not needed as this function has a single caller that always passes all arguments. This patch removes the default. Tested by rebuilding.
2024-08-12gdb: drop struct keyword when using bound_minimal_symbolSimon Marchi1-1/+1
This is a simple find / replace from "struct bound_minimal_symbol" to "bound_minimal_symbol", to make things shorter and more consisten througout. In some cases, move variable declarations where first used. Change-Id: Ica4af11c4ac528aa842bfa49a7afe8fe77a66849 Reviewed-by: Keith Seitz <keiths@redhat.com> Approved-By: Andrew Burgess <aburgess@redhat.com>
2024-03-26gdb, gdbserver, gdbsupport: remove includes of early headersSimon Marchi1-1/+0
Now that defs.h, server.h and common-defs.h are included via the `-include` option, it is no longer necessary for source files to include them. Remove all the inclusions of these files I could find. Update the generation scripts where relevant. Change-Id: Ia026cff269c1b7ae7386dd3619bc9bb6a5332837 Approved-By: Pedro Alves <pedro@palves.net>
2024-03-21Require trivial destructor in allocate_on_obstackTom Tromey1-1/+1
This patch makes allocate_on_obstack a little bit safer, by enforcing the rule that objects allocated on an obstack must have a trivial destructor. The static assert is done in a method -- doing it inside the class itself won't work because the class is incomplete at that point.
2024-02-15Move lookup_name_info creation into basic_lookup_transparent_typeTom Tromey1-6/+3
I noticed that basic_lookup_transparent_type calls two different functions that both proceed to create a lookup_name_info. It's more efficient to create this object in the outermost layer possible. Making this change required a few related changes, resulting in this patch. There are still more changes of this sort that could be made. Regression tested on x86-64 Fedora 38.
2024-01-28Use domain_search_flags in lookup_symbol et alTom Tromey1-9/+15
This changes lookup_symbol and associated APIs to accept domain_search_flags rather than a domain_enum. Note that this introduces some new constants to Python and Guile. I chose to break out the documentation patch for this, because the internals here do not change until a later patch, and it seemed simpler to patch the docs just once, rather than twice.
2024-01-12Update copyright year range in header of all files managed by GDBAndrew Burgess1-1/+1
This commit is the result of the following actions: - Running gdb/copyright.py to update all of the copyright headers to include 2024, - Manually updating a few files the copyright.py script told me to update, these files had copyright headers embedded within the file, - Regenerating gdbsupport/Makefile.in to refresh it's copyright date, - Using grep to find other files that still mentioned 2023. If these files were updated last year from 2022 to 2023 then I've updated them this year to 2024. I'm sure I've probably missed some dates. Feel free to fix them up as you spot them.
2023-11-14Add block::function_blockTom Tromey1-0/+13
This adds the method block::function_block, to easily access a block's enclosing function block.
2023-09-07Simplify block_find_symbolTom Tromey1-32/+11
block_find_symbol takes a callback function, but only two callbacks are ever passed to it -- and they are similar enough that it seems cleaner to just have block_find_symbol do the work itself. Also, block_find_symbol can take a lookup_name_info as an argument, following the general idea of pushing the construction of these objects as high in the call chain as feasible. Regression tested on x86-64 Fedora 38. Tested-By: Alexandra Petlanova Hajkova <ahajkova@redhat.com>
2023-08-31Add symbol::matches methodTom Tromey1-7/+5
This adds symbol::matches, a wrapper for symbol_matches_domain. Most places calling symbol_matches_domain can call this method instead, which is a bit less wordy and also (IMO) clearer. Approved-By: Simon Marchi <simon.marchi@efficios.com>
2023-02-19Convert contained_in to methodTom Tromey1-4/+3
This converts contained_in to be a method of block.
2023-02-19Remove allocate_block and allocate_global_blockTom Tromey1-23/+0
This removes allocate_block and allocate_global_block in favor of simply calling 'new'.
2023-02-19Have global_block inherit from blockTom Tromey1-3/+1
This changes global_block to inherit from block, which is what was always intended.
2023-02-19Use 'new' for block and global_blockTom Tromey1-4/+2
This changes block and global_block to add initializers, and then to use 'new' for allocation.
2023-02-19Remove ALL_BLOCK_SYMBOLS_WITH_NAMETom Tromey1-9/+3
This removes ALL_BLOCK_SYMBOLS_WITH_NAME in favor of foreach.
2023-02-19Combine both styles of block iteratorTom Tromey1-32/+22
This merges the two styles of block iterator, having the initialization API decide which to use based on an optional parameter.
2023-02-19Store 'name' in block_iteratorTom Tromey1-10/+12
This changes the block_iterator to store the 'name' that is used by block_iter_match_next. This avoids any problem where the name could be passed inconsistently, and also makes the subsequent patches easier to understand.
2023-02-19Convert block_static_link to methodTom Tromey1-4/+4
This converts block_static_link to be a method. This was mostly written by script.
2023-02-19Convert set_block_compunit_symtab to methodTom Tromey1-4/+4
This converts set_block_compunit_symtab to be a method. This was mostly written by script.
2023-02-19Convert block_static_block and block_global_block to methodsTom Tromey1-8/+10
This converts block_static_block and block_global_block to be methods. This was mostly written by script. It was simpler to convert them at the same time because they're often used near each other.
2023-02-19Convert block_containing_function to methodTom Tromey1-5/+4
This converts block_containing_function to be a method. This was mostly written by script.
2023-02-19Convert block_linkage_function to methodTom Tromey1-6/+4
This converts block_linkage_function to be a method. This was mostly written by script.
2023-02-19Convert more block functions to methodsTom Tromey1-37/+26
This converts block_scope, block_set_scope, block_using, and block_set_using to be methods. These are all done at once to make it easier to also convert block_initialize_namespace at the same time. This was mostly written by script.
2023-02-19Convert block_inlined_p to methodTom Tromey1-6/+6
This converts block_inlined_p to be a method. This was mostly written by script.
2023-02-19Convert block_gdbarch to methodTom Tromey1-4/+4
This converts block_gdbarch to be a method. This was mostly written by script.
2023-02-19Convert block_objfile to methodTom Tromey1-6/+6
This converts block_objfile to be a method. This was mostly written by script.
2023-02-19Don't allow NULL as an argument to block_global_blockTom Tromey1-5/+1
block_global_block has special behavior when the block is NULL. Remove this and patch up the callers instead.
2023-02-19Don't allow NULL as an argument to block_static_blockTom Tromey1-2/+2
block_static_block has special behavior when the block is NULL. Remove this and patch up the callers instead.
2023-02-19Don't allow NULL as an argument to block_usingTom Tromey1-1/+1
block_using has special behavior when the block is NULL. Remove this. No caller seems to be affected.
2023-02-19Avoid extra allocations in blockTom Tromey1-0/+12
block_set_scope and block_set_using unconditionally allocate the block namespace object. However, this isn't truly needed, so arrange to only allocate when it is.
2023-02-19Rearrange block.c to avoid a forward declarationTom Tromey1-13/+10
Moving block_initialize_namespace before its callers lets us avoid a forward declaration.
2023-01-01Update copyright year range in header of all files managed by GDBJoel Brobecker1-1/+1
This commit is the result of running the gdb/copyright.py script, which automated the update of the copyright year range for all source files managed by the GDB project to be updated to include year 2023.
2022-06-12Remove addrmap wrapper functionsTom Tromey1-2/+2
This removes the various addrmap wrapper functions in favor of simple method calls on the objects themselves.
2022-04-27gdb: remove BLOCKVECTOR_MAP macroSimon Marchi1-2/+2
Replace with equivalent methods. Change-Id: I4e56c76dfc363c1447686fb29c4212ea18b4dba0
2022-04-27gdb: remove BLOCKVECTOR_BLOCK and BLOCKVECTOR_NBLOCKS macrosSimon Marchi1-8/+6
Replace with calls to blockvector::blocks, and the appropriate method call on the returned array_view. Change-Id: I04d1f39603e4d4c21c96822421431d9a029d8ddd
2022-04-27gdb: remove BLOCK_NAMESPACE macroSimon Marchi1-10/+10
Replace with equivalent methods. Change-Id: If86b8cbdfb0f52e22c929614cd53e73358bab76a
2022-04-27gdb: remove BLOCK_MULTIDICT macroSimon Marchi1-6/+6
Replace with equivalent methods. Change-Id: If9a239c511a664f2a59fecb6d1cd579881b23dc2
2022-04-27gdb: remove BLOCK_SUPERBLOCK macroSimon Marchi1-20/+20
Replace with equivalent methods. Change-Id: I334a319909a50b5cc5570a45c38c70e10dc00630
2022-04-27gdb: remove BLOCK_FUNCTION macroSimon Marchi1-12/+12
Replace with equivalent methods. Change-Id: I31ec00f5bf85335c8b23d306ca0fe0b84d489101
2022-04-27gdb: remove BLOCK_{START,END} macrosSimon Marchi1-3/+3
Replace with equivalent methods. Change-Id: I10a6c8a2a86462d9d4a6a6409a3f07a6bea66310
2022-04-20Replace symbol_arch with symbol::archTom Tromey1-1/+1
This turns symbol_arch into a method on symbol.
2022-04-20Replace symbol_objfile with symbol::objfileTom Tromey1-1/+1
This turns symbol_objfile into a method on symbol.
2022-02-06gdb: remove SYMBOL_TYPE macroSimon Marchi1-2/+2
Add a getter and a setter for a symbol's type. Remove the corresponding macro and adjust all callers. Change-Id: Ie1a137744c5bfe1df4d4f9ae5541c5299577c8de
2022-02-06gdb: remove SYMBOL_INLINED macroSimon Marchi1-1/+1
Add a getter and a setter for whether a symbol is inlined. Remove the corresponding macro and adjust all callers. Change-Id: I934468da3b5a32dd6b161a6f252a6b1b94737279
2022-02-06gdb: remove SYMBOL_IS_ARGUMENT macroSimon Marchi1-1/+1
Add a getter and a setter for whether a symbol is an argument. Remove the corresponding macro and adjust all callers. Change-Id: I71b4f0465f3dfd2ed8b9e140bd3f7d5eb8d9ee81
2022-02-06gdb: remove SYMBOL_DOMAIN macroSimon Marchi1-9/+8
Add a getter and a setter for a symbol's domain. Remove the corresponding macro and adjust all callers. Change-Id: I54465b50ac89739c663859a726aef8cdc6e4b8f3
2022-02-06gdb: remove SYMBOL_CLASS macro, add getterSimon Marchi1-5/+4
Change-Id: I83211d5a47efc0564386e5b5ea4a29c00b1fd46a