Age | Commit message (Collapse) | Author | Files | Lines |
|
Per an earlier discussion, this patch renames the existing "raw" APIs
to use the word "unrelocated" instead.
|
|
This changes psymbols themselves to use unrelocated_addr. This
transform is largely mechanical. I don't think it finds any bugs.
|
|
This changes partial symbol tables to use unrelocated_addr for the
text_high and text_low members. This revealed some latent bugs in
ctfread.c, which are fixed here.
|
|
OBJF_REORDERED is set for nearly every object format. And, despite
the ominous warnings here and there, it does not seem very expensive.
This patch removes the flag entirely.
Reviewed-By: Andrew Burgess <aburgess@redhat.com>
|
|
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.
|
|
quick_symbol_functions::relocated is only needed for psymtabs, and
there it is only needed for Rust. However, because we've switched the
DWARF reader away from psymtabs, this means there's no longer a need
for this method at all.
|
|
Currently, every internal_error call must be passed __FILE__/__LINE__
explicitly, like:
internal_error (__FILE__, __LINE__, "foo %d", var);
The need to pass in explicit __FILE__/__LINE__ is there probably
because the function predates widespread and portable variadic macros
availability. We can use variadic macros nowadays, and in fact, we
already use them in several places, including the related
gdb_assert_not_reached.
So this patch renames the internal_error function to something else,
and then reimplements internal_error as a variadic macro that expands
__FILE__/__LINE__ itself.
The result is that we now should call internal_error like so:
internal_error ("foo %d", var);
Likewise for internal_warning.
The patch adjusts all calls sites. 99% of the adjustments were done
with a perl/sed script.
The non-mechanical changes are in gdbsupport/errors.h,
gdbsupport/gdb_assert.h, and gdb/gdbarch.py.
Approved-By: Simon Marchi <simon.marchi@efficios.com>
Change-Id: Ia6f372c11550ca876829e8fd85048f4502bdcf06
|
|
Introduce symtab_create_debug_printf and symtab_create_debug_printf_v,
to print the debug messages enabled by "set debug symtab-create".
Change-Id: I442500903f72d4635c2dd9eaef770111f317dc04
|
|
While working on addrmaps, I noticed that psymtab_addrmap is no longer
needed now. It was introduced in ancient times as an optimization for
DWARF, but no other symbol reader was ever updated to use it. Now
that DWARF does not use psymtabs, it can be deleted.
|
|
This removes the various addrmap wrapper functions in favor of simple
method calls on the objects themselves.
|
|
The previous patch ensured that partial symbols are read before calling
most of the quick_function's methods.
The psymbol_functions class has the require_partial_symbols method which
serves this exact purpose, and does not need to do it anymore.
This patch renames this method to partial_symbols and makes it an accessor
which asserts that partial symbols have been read at this point.
Regression tested on x86_64-linux.
|
|
Replace with calls to blockvector::blocks, and the appropriate method
call on the returned array_view.
Change-Id: I04d1f39603e4d4c21c96822421431d9a029d8ddd
|
|
Replace with equivalent methods.
Change-Id: I10a6c8a2a86462d9d4a6a6409a3f07a6bea66310
|
|
Remove all macros related to getting and setting some symbol value:
#define SYMBOL_VALUE(symbol) (symbol)->value.ivalue
#define SYMBOL_VALUE_ADDRESS(symbol) \
#define SET_SYMBOL_VALUE_ADDRESS(symbol, new_value) \
#define SYMBOL_VALUE_BYTES(symbol) (symbol)->value.bytes
#define SYMBOL_VALUE_COMMON_BLOCK(symbol) (symbol)->value.common_block
#define SYMBOL_BLOCK_VALUE(symbol) (symbol)->value.block
#define SYMBOL_VALUE_CHAIN(symbol) (symbol)->value.chain
#define MSYMBOL_VALUE(symbol) (symbol)->value.ivalue
#define MSYMBOL_VALUE_RAW_ADDRESS(symbol) ((symbol)->value.address + 0)
#define MSYMBOL_VALUE_ADDRESS(objfile, symbol) \
#define BMSYMBOL_VALUE_ADDRESS(symbol) \
#define SET_MSYMBOL_VALUE_ADDRESS(symbol, new_value) \
#define MSYMBOL_VALUE_BYTES(symbol) (symbol)->value.bytes
#define MSYMBOL_BLOCK_VALUE(symbol) (symbol)->value.block
Replace them with equivalent methods on the appropriate objects.
Change-Id: Iafdab3b8eefc6dc2fd895aa955bf64fafc59ed50
|
|
psymtab_to_symtab is documented as possibly returning nullptr, if the
primary symtab of the partial symtab has no symbols. However,
psymbol_functions::expand_symtabs_matching asserts that the result of
psymtab_to_symtab as non-nullptr.
I caught this assert by trying the CTF symbol reader on a library I
built with -gctf:
$ ./gdb --data-directory=data-directory /tmp/babeltrace-ctf/src/lib/.libs/libbabeltrace2.so.0.0.0
...
Reading symbols from /tmp/babeltrace-ctf/src/lib/.libs/libbabeltrace2.so.0.0.0...
(gdb) maintenance expand-symtabs
/home/simark/src/binutils-gdb/gdb/psymtab.c:1142: internal-error: expand_symtabs_matching: Assertion `symtab != nullptr' failed.
The "symtab" in question is:
$ readelf --ctf=.ctf /tmp/babeltrace-ctf/src/lib/.libs/libbabeltrace2.so.0.0.0
...
CTF archive member: /home/simark/src/babeltrace/src/lib/graph/component-descriptor-set.c:
Header:
Magic number: 0xdff2
Version: 4 (CTF_VERSION_3)
Flags: 0xe (CTF_F_NEWFUNCINFO, CTF_F_IDXSORTED, CTF_F_DYNSTR)
Parent name: .ctf
Compilation unit name: /home/simark/src/babeltrace/src/lib/graph/component-descriptor-set.c
Type section: 0x0 -- 0x13 (0x14 bytes)
String section: 0x14 -- 0x5f (0x4c bytes)
Labels:
Data objects:
Function objects:
Variables:
Types:
0x80000001: (kind 5) bt_bool (*) (const bt_value *) (aligned at 0x8)
Strings:
0x0:
0x1: .ctf
0x6: /home/simark/src/babeltrace/src/lib/graph/component-descriptor-set.c
It contains a single type, and it is skipped by ctf_add_type_cb, because
an identical type was already seen earlier in this objfile. As a
result, no compunit_symtab is created.
Change psymbol_functions::expand_symtabs_matching to expect that
psymtab_to_symtab can return nullptr.
Another possibility would be to make the CTF symbol reader always create
a compunit_symtab, even if there are no symbols in it (like the DWARF
parser does), but so far I don't see any advantage in doing so.
Change-Id: Ic43c38202c838a5eb87630ed1fd61d33528164f4
|
|
Various spots in gdb currently know about the wrap buffer, and so are
careful to call wrap_here to be certain that all output has been
flushed.
Now that the pager is just an ordinary stream, this isn't needed, and
a simple call to gdb_flush is enough.
Similarly, there are places where gdb prints to gdb_stderr, but first
flushes gdb_stdout. stderr_file already flushes gdb_stdout, so these
aren't needed.
|
|
Now that filtered and unfiltered output can be treated identically, we
can unify the printf family of functions. This is done under the name
"gdb_printf". Most of this patch was written by script.
|
|
Now that filtered and unfiltered output can be treated identically, we
can unify the puts family of functions. This is done under the name
"gdb_puts". Most of this patch was written by script.
|
|
This adds a constructor to bound_minimal_symbol, to avoid a build
failure with clang that Simon pointed out.
I also took the opportunity to remove some redundant initializations,
and to change one use of push_back to emplace_back, as suggested by
Simon.
|
|
Add a getter and a setter for a compunit_symtab's blockvector. Remove
the corresponding macro and adjust all callers.
Change-Id: I99484c6619dcbbea7c5d89c72aa660316ca62f64
|
|
Make compunit_primary_filetab a method of compunit_symtab.
Change-Id: Iee3c4f7e36d579bf763c5bba146e5e10d6766768
|
|
This changes all existing calls to wrap_here to call the method on the
appropriate ui_file instead. The choice of ui_file is determined by
context.
|
|
I think it only really makes sense to call wrap_here with an argument
consisting solely of spaces. Given this, it seemed better to me that
the argument be an int, rather than a string. This patch is the
result. Much of it was written by a script.
|
|
In an earlier version of the pager rewrite series, it was important to
audit unfiltered output calls to see which were truly necessary.
This is no longer necessary, but it still seems like a decent cleanup
to change calls to avoid explicitly passing gdb_stdout. That is,
rather than using something like fprintf_unfiltered with gdb_stdout,
the code ought to use plain printf_unfiltered instead.
This patch makes this change. I went ahead and converted all the
_filtered calls I could find, as well, for the same clarity.
|
|
This moves the gdb_regex convenience class to gdbsupport.
|
|
This moves the gdb_argv class to a new header in gdbsupport.
|
|
This commit brings all the changes made by running gdb/copyright.py
as per GDB's Start of New Year Procedure.
For the avoidance of doubt, all changes in this commits were
performed by the script.
|
|
gdb_print_host_address is just a simple wrapper around
fprintf_filtered. However, it is readily replaced in all callers by a
combination of %s and call to host_address_to_string. This also
simplifies the code, so I think it's worthwhile to remove this
function.
Regression tested on x86-64 Fedora 64.
|
|
PR28539 describes a segfault in lambda function search_one_symtab due to
psymbol_functions::expand_symtabs_matching calling expansion_notify with a
nullptr symtab:
...
struct compunit_symtab *symtab =
psymtab_to_symtab (objfile, ps);
if (expansion_notify != NULL)
if (!expansion_notify (symtab))
return false;
...
This happens as follows. The partial symtab ps is a dwarf2_include_psymtab
for some header file:
...
(gdb) p ps.filename
$5 = 0x64fcf80 "/usr/include/c++/11/bits/stl_construct.h"
...
The includer of ps is a shared symtab for a partial unit, with as user:
...
(gdb) p ps.includer().user.filename
$11 = 0x64fc9f0 \
"/usr/src/debug/llvm13-13.0.0-1.2.x86_64/tools/clang/lib/AST/Decl.cpp"
...
The call to psymtab_to_symtab expands the Decl.cpp symtab (and consequently
the shared symtab), but returns nullptr because:
...
struct dwarf2_include_psymtab : public partial_symtab
{
...
compunit_symtab *get_compunit_symtab (struct objfile *objfile) const override
{
return nullptr;
}
...
Fix this by returning the Decl.cpp symtab instead, which fixes the segfault
in the PR.
Tested on x86_64-linux.
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28539
|
|
While debugging another patch series, I wanted to dump an addrmap. I
came up with this patch, which generalizes the addrmap-dumping code
from psymtab.c and moves it to addrmap.c. psymtab.c is changed to use
the new code.
|
|
The final bug fix in this series would duplicate the logic in
psymtab_to_fullname, so this patch extracts the body of this function
into a new function.
|
|
While working on my series to replace the DWARF psymbol reader, I
noticed that the expand_symtabs_matching has an undocumented
invariant. I think that, if this invariant is not followed, then GDB
will crash. So, this patch documents this in the relevant spots and
introduces some asserts to make it clear.
Regression tested on x86-64 Fedora 32.
|
|
Adds a new function to the quick_symbol_functions API to let us know
if there are any unexpanded symbols. This functionality is required
by a later commit. After this commit the functionality is unused, and
untested.
The new function objfile::has_unexpanded_symtabs is added to the
symfile-debug.c file which is a little strange, but this
is (currently) where many of the other objfile::* functions (that call
onto the quick_symbol_functions) are defined, so I'm reluctant to
break this pattern.
There should be no user visible changes after this commit.
gdb/ChangeLog:
* dwarf2/read.c (struct dwarf2_base_index_functions)
<has_unexpanded_symtabs>: Declare.
(dwarf2_base_index_functions::has_unexpanded_symtabs): Define new
function.
* objfiles.h (struct objfile) <has_unexpanded_symtabs>: Declare.
* psympriv.h (struct psymbol_functions) <has_unexpanded_symtabs>:
Declare.
* psymtab.c (psymbol_functions::has_unexpanded_symtabs): Define
new function.
* quick-symbol.h (struct quick_symbol_functions)
<has_unexpanded_symtabs>: Declare.
* symfile-debug.c (objfile::has_unexpanded_symtabs): Define new
function.
|
|
While working on the DWARF psymtab replacement, I needed
addrmap_foreach to accept a gdb::function_view. This seemed like a
worthwhile change on its own, so I've written it separately for
submission.
Regression tested on x86-64 Fedora 32.
gdb/ChangeLog
2021-06-25 Tom Tromey <tom@tromey.com>
* dwarf2/index-write.c (struct addrmap_index_data): Add
initializers.
<operator()>: Declare.
(addrmap_index_data::operator()): Rename from
add_address_entry_worker. Remove 'datap' parameter.
(write_address_map): Update.
* psymtab.c (struct dump_psymtab_addrmap_data): Remove
(dump_psymtab_addrmap_1): Remove 'data' parameter, add other
parameters.
(dump_psymtab_addrmap): Update.
* addrmap.c (struct addrmap_funcs) <foreach>: Remove 'data'
parameter.
(addrmap_foreach, addrmap_fixed_foreach): Likewise.
(struct mutable_foreach_data): Remove.
(addrmap_mutable_foreach_worker): Update.
(addrmap_mutable_foreach): Remove 'data' parameter.
* addrmap.h (addrmap_foreach_fn): Use gdb::function_view.
(addrmap_foreach): Remove 'data' parameter.
|
|
I'm seeing timeouts from gdb.rust/traits.exp when we attempt to print
things with "maint print objfiles".
This happens for two reasons:
1 - GDB does not explicitly split each entry into its own line, but rather
relies on the terminal's width to insert line breaks.
2 - When running the GDB testsuite, such width may be unlimited, which will
prevent GDB from inserting any line breaks.
As a result, the output may be too lengthy and will come in big lines. Tweak
the support library to match the patterns line-by-line, which gives us more
time to match things. Also fix GDB's output to print one entry per line,
regardless of the terminal width.
A similar approach was used in another testcase using the same command (commit
eaeaf44cfdc9a4096a0dd52fa0606f29d4bfd48e). With the new line breaks, we don't
need a particular pattern, so clean up that test as well.
gdb/ChangeLog:
2021-04-27 Luis Machado <luis.machado@linaro.org>
* psymtab.c (psymbol_functions::dump): Output newline.
* symmisc.c (dump_objfile): Likewise.
gdb/testsuite/ChangeLog:
2021-04-27 Luis Machado <luis.machado@linaro.org>
* gdb.base/maint.exp: Drop a pattern that is not needed.
* lib/gdb.exp (readnow): Match line-by-line.
|
|
quick_symbol_functions::map_matching_symbols is only used by the Ada
code. Currently, it both expands certain psymtabs and then walks over
the full symtabs -- including any already-expanded ones -- calling a
callback.
It appears to work lazily as well, in that if the callback returns
false, iteration stops. However, only the psymtab implementation does
this; the DWARF index implementations are not lazy. It turns out,
though, that the only callback that is ever passed here never returns
false.
This patch simplifies this method by removing the callback. The
method is also renamed. In the new scheme, the caller is responsible
for walking the full symtabs, which removes some redundancy as well.
gdb/ChangeLog
2021-04-17 Tom Tromey <tom@tromey.com>
* psymtab.c (psymbol_functions::expand_matching_symbols): Rename
from map_matching_symbols. Change parameters.
* psympriv.h (struct psymbol_functions) <expand_matching_symbols>:
Rename from map_matching_symbols. Change parameters.
* dwarf2/read.c (struct dwarf2_gdb_index)
<expand_matching_symbols>: Rename from map_matching_symbols.
Change parameters.
(struct dwarf2_debug_names_index) <expand_matching_symbols>:
Rename from map_matching_symbols. Change parameters.
(dwarf2_gdb_index::expand_matching_symbols): Rename from
dw2_map_matching_symbols. Change parameters.
(dwarf2_gdb_index::expand_matching_symbols): Remove old
implementation.
(dwarf2_debug_names_index::expand_matching_symbols): Rename from
map_matching_symbols. Change parameters.
* objfiles.h (struct objfile) <expand_matching_symbols>: Rename
from map_matching_symbols. Change parameters.
* symfile-debug.c (objfile::expand_matching_symbols): Rename from
map_matching_symbols. Change parameters.
* ada-lang.c (map_matching_symbols): New function.
(add_nonlocal_symbols): Update.
|
|
This removes quick_symbol_functions::expand_symtabs_with_fullname,
replacing it with a call to expand_symtabs_matching. As with the
previous patches, the implementation is consolidated in the objfile
method.
gdb/ChangeLog
2021-04-17 Tom Tromey <tom@tromey.com>
* quick-symbol.h (struct quick_symbol_functions)
<expand_symtabs_with_fullname>: Remove.
* psymtab.c (psymbol_functions::expand_symtabs_with_fullname):
Remove.
* psympriv.h (struct psymbol_functions)
<expand_symtabs_with_fullname>: Remove.
* dwarf2/read.c (struct dwarf2_base_index_functions)
<expand_symtabs_with_fullname>: Remove.
(dwarf2_base_index_functions::expand_symtabs_with_fullname):
Remove.
* objfiles.h (struct objfile) <expand_symtabs_with_fullname>:
Update comment.
* symfile-debug.c (objfile::expand_symtabs_with_fullname):
Rewrite.
|
|
This removes quick_symbol_functions::expand_symtabs_for_function,
replacing it with a call to expand_symtabs_matching. As with the
previous patches, the implementation is consolidated in the objfile
method.
gdb/ChangeLog
2021-04-17 Tom Tromey <tom@tromey.com>
* symfile-debug.c (objfile::expand_symtabs_for_function):
Rewrite.
* quick-symbol.h (struct quick_symbol_functions)
<expand_symtabs_for_function>: Remove.
* psymtab.c (psymbol_functions::expand_symtabs_for_function):
Remove.
* psympriv.h (struct psymbol_functions)
<expand_symtabs_for_function>: Remove.
* objfiles.h (struct objfile) <expand_symtabs_for_function>:
Update comment.
* dwarf2/read.c (struct dwarf2_gdb_index)
<expand_symtabs_for_function>: Remove.
(struct dwarf2_debug_names_index) <expand_symtabs_for_function>:
Remove.
(find_slot_in_mapped_hash): Remove.
(dw2_symtab_iter_init_common): Merge with dw2_symtab_iter_init.
(dw2_symtab_iter_init): Remove one overload.
(dwarf2_gdb_index::expand_symtabs_for_function)
(dwarf2_debug_names_index::expand_symtabs_for_function): Remove.
|
|
This replaces quick_symbol_functions::map_symtabs_matching_filename
with a call to expand_symtabs_matching. As with the previous patch,
rather than update all callers, the implementation is consolidated in
objfile::map_symtabs_matching_filename.
gdb/ChangeLog
2021-04-17 Tom Tromey <tom@tromey.com>
* symfile-debug.c (objfile::map_symtabs_matching_filename):
Rewrite.
* quick-symbol.h (struct quick_symbol_functions)
<map_symtabs_matching_filename>: Remove.
* psymtab.c (partial_map_expand_apply)
(psymbol_functions::map_symtabs_matching_filename): Remove.
* psympriv.h (struct psymbol_functions)
<map_symtabs_matching_filename>: Remove.
* objfiles.h (struct objfile) <map_symtabs_matching_filename>:
Update comment.
* dwarf2/read.c (struct dwarf2_base_index_functions)
<map_symtabs_matching_filename>: Remove.
(dw2_map_expand_apply)
(dwarf2_base_index_functions::map_symtabs_matching_filename):
Remove.
|
|
This removes quick_symbol_functions, replacing it with calls to
expand_symtabs_matching. Because the replacement is somewhat verbose,
objfile::lookup_symbol is not removed. This consolidates some
duplicated code into this one spot.
gdb/ChangeLog
2021-04-17 Tom Tromey <tom@tromey.com>
* symfile-debug.c (objfile::lookup_symbol): Rewrite.
* quick-symbol.h (struct quick_symbol_functions) <lookup_symbol>:
Remove.
* psymtab.c (psymbol_functions::lookup_symbol): Remove.
* psympriv.h (struct psymbol_functions) <lookup_symbol>: Remove.
* objfiles.h (struct objfile) <lookup_symbol>: Add comment.
* dwarf2/read.c (struct dwarf2_gdb_index) <lookup_symbol>:
Remove.
(struct dwarf2_debug_names_index) <lookup_symbol>: Remove.
(dwarf2_gdb_index::lookup_symbol)
(dwarf2_debug_names_index::lookup_symbol): Remove.
|
|
Currently, expand_symtabs_matching only accepts a search_domain
parameter. However, lookup_symbol uses a domain_enum instead, and the
two, confusingly, do quite different things -- one cannot emulate the
other. So, this patch adds a domain_enum parameter to
expand_symtabs_matching, with UNDEF_DOMAIN used as a wildcard.
This is another step toward replacing lookup_symbol with
expand_symtabs_matching.
gdb/ChangeLog
2021-04-17 Tom Tromey <tom@tromey.com>
* symtab.c (global_symbol_searcher::expand_symtabs): Update.
* symmisc.c (maintenance_expand_symtabs): Update.
* symfile.c (expand_symtabs_matching): Update.
* symfile-debug.c (objfile::expand_symtabs_matching): Add 'domain'
parameter.
* quick-symbol.h (struct quick_symbol_functions)
<expand_symtabs_matching>: Add 'domain' parameter.
* psymtab.c (recursively_search_psymtabs)
(psymbol_functions::expand_symtabs_matching): Add 'domain'
parameter.
* psympriv.h (struct psymbol_functions) <expand_symtabs_matching>:
Add 'domain' parameter.
* objfiles.h (struct objfile) <expand_symtabs_matching>: Add
'domain' parameter.
* linespec.c (iterate_over_all_matching_symtabs): Update.
* dwarf2/read.c (struct dwarf2_gdb_index)
<expand_symtabs_matching>: Add 'domain' parameter.
(struct dwarf2_debug_names_index) <expand_symtabs_matching>: Add
'domain' parameter.
(dw2_expand_symtabs_matching)
(dwarf2_gdb_index::expand_symtabs_matching)
(dw2_debug_names_iterator)
(dwarf2_debug_names_index::expand_symtabs_matching): Add 'domain'
parameter.
|
|
This adds a block search flags parameter to expand_symtabs_matching.
All callers are updated to search both the static and global blocks,
as that was the implied behavior before this patch.
This is a step toward replacing lookup_symbol with
expand_symtabs_matching.
gdb/ChangeLog
2021-04-17 Tom Tromey <tom@tromey.com>
* symtab.c (global_symbol_searcher::expand_symtabs)
(default_collect_symbol_completion_matches_break_on): Update.
* symmisc.c (maintenance_expand_symtabs): Update.
* symfile.h (expand_symtabs_matching): Add search_flags
parameter.
* symfile.c (expand_symtabs_matching): Add search_flags
parameter.
* symfile-debug.c (objfile::expand_symtabs_matching): Add
search_flags parameter.
* quick-symbol.h (struct quick_symbol_functions)
<expand_symtabs_matching>: Add search_flags parameter.
* python/py-symbol.c (gdbpy_lookup_static_symbols): Update.
* psymtab.c (recursively_search_psymtabs)
(psymbol_functions::expand_symtabs_matching): Add search_flags
parameter.
* psympriv.h (struct psymbol_functions) <expand_symtabs_matching>:
Add search_flags parameter.
* objfiles.h (struct objfile) <expand_symtabs_matching>: Add
search_flags parameter.
* linespec.c (iterate_over_all_matching_symtabs): Update.
* dwarf2/read.c (struct dwarf2_gdb_index)
<expand_symtabs_matching>: Add search_flags parameter.
(struct dwarf2_debug_names_index) <expand_symtabs_matching>: Add
search_flags parameter.
(dw2_map_matching_symbols): Update.
(dw2_expand_marked_cus, dw2_expand_symtabs_matching)
(dwarf2_gdb_index::expand_symtabs_matching): Add search_flags
parameter.
(dw2_debug_names_iterator): Change block_index to search flags.
<m_block_index>: Likewise.
(dw2_debug_names_iterator::next)
(dwarf2_debug_names_index::lookup_symbol)
(dwarf2_debug_names_index::expand_symtabs_for_function)
(dwarf2_debug_names_index::map_matching_symbols)
(dwarf2_debug_names_index::map_matching_symbols): Update.
(dwarf2_debug_names_index::expand_symtabs_matching): Add
search_flags parameter.
* ada-lang.c (ada_add_global_exceptions)
(collect_symbol_completion_matches): Update.
|
|
This changes expand_symtabs_exp_notify_ftype to return bool, and
updates all the uses. Now, if the notification function returns
false, the call is short-circuited and stops examining symtabs. This
is a step toward replacing map_symtabs_matching_filename with
expand_symtabs_matching.
gdb/ChangeLog
2021-04-17 Tom Tromey <tom@tromey.com>
* symtab.c (default_collect_symbol_completion_matches_break_on):
Update.
* symfile.h (expand_symtabs_matching): Return bool.
* symfile.c (expand_symtabs_matching): Return bool.
* symfile-debug.c (objfile::expand_symtabs_matching): Return
bool.
* quick-symbol.h (expand_symtabs_exp_notify_ftype): Return bool.
(struct quick_symbol_functions) <expand_symtabs_matching>: Return
bool.
* psymtab.c (psymbol_functions::expand_symtabs_matching): Return
bool.
* psympriv.h (struct psymbol_functions)
<expand_symtabs_matching>: Return bool.
* objfiles.h (struct objfile) <expand_symtabs_matching>: Return
bool.
* dwarf2/read.c (struct dwarf2_gdb_index)
<expand_symtabs_matching>: Return bool.
(struct dwarf2_debug_names_index) <expand_symtabs_matching>:
Return bool.
(dw2_expand_symtabs_matching_symbol): Return bool.
(dw2_expand_symtabs_matching_one, dw2_expand_marked_cus)
(dw2_expand_symtabs_matching)
(dwarf2_gdb_index::expand_symtabs_matching)
(dwarf2_debug_names_index::expand_symtabs_matching)
(dwarf2_debug_names_index::expand_symtabs_matching): Return bool.
|
|
Since partial_symtab is supposed to be objfile-independent (since series
[1]), I think it would make sense for partial_symtab to not take an
objfile as a parameter in its constructor.
This patch replaces that parameter with an objfile_per_bfd_storage
parameter.
The objfile is used for two things:
- to get the objfile_name, for debug messages. We can get that name
from the bfd instead.
- to intern the partial symtab filename. Even though it goes through
an objfile method, the request is actually forwarded to the
underlying objfile_per_bfd_storage. So we can ask the new
objfile_per_bfd_storage instead.
In order to get a reference to the BFD from the objfile_per_bfd_storage,
the BFD is saved in the objfile_per_bfd_storage object.
[1] https://sourceware.org/pipermail/gdb-patches/2021-February/176625.html
gdb/ChangeLog:
* psympriv.h (struct partial_symtab) <partial_symtab>: Change
objfile parameter for objfile_per_bfd_storage, adjust callers.
(struct standard_psymtab) <standard_psymtab>: Likewise.
(struct legacy_psymtab) <legacy_psymtab>: Likewise.
* psymtab.c (partial_symtab::partial_symtab): Likewise.
* ctfread.c (struct ctf_psymtab): Likewise.
* dwarf2/read.h (struct dwarf2_psymtab): Likewise.
* dwarf2/read.c (struct dwarf2_include_psymtab): Likewise.
(dwarf2_create_include_psymtab): Likewise.
* objfiles.h (struct objfile_per_bfd_storage)
<objfile_per_bfd_storage>: Add bfd parameter, adjust callers.
<get_bfd>: New method.
<m_bfd>: New field.
* objfiles.c (get_objfile_bfd_data): Adjust.
Change-Id: I2ed3ab5d2e6f27d034bd4dc26ae2fae7b0b8a2b9
|
|
This simplifies the code a bit.
gdb/ChangeLog:
* psymtab.c (partial_symtab::partial_symtab): Change
last_objfile_name to be an std::string.
* symfile.c (allocate_symtab): Likewise.
Change-Id: I3dfe217233ed9346c2abc04a9b1be0df69a90af8
|
|
This changes quick_symbol_functions::map_symbol_filenames to use a
function_view, and updates all the uses. It also changes the final
parameter to 'bool'. A couple of spots are further updated to use
operator() rather than a lambda.
gdb/ChangeLog
2021-03-26 Tom Tromey <tom@tromey.com>
* symtab.c (struct output_source_filename_data): Add 'output'
method and operator().
(output_source_filename_data::output): Rename from
output_source_filename.
(output_partial_symbol_filename): Remove.
(info_sources_command): Update.
(struct add_partial_filename_data): Add operator().
(add_partial_filename_data::operator()): Rename from
maybe_add_partial_symtab_filename.
(make_source_files_completion_list): Update.
* symfile.c (quick_symbol_functions): Update.
* symfile-debug.c (objfile::map_symbol_filenames): Update.
* quick-symbol.h (symbol_filename_ftype): Change type of 'fun' and
'need_fullname'. Remove 'data' parameter.
(struct quick_symbol_functions) <map_symbol_filenames>: Likewise.
* psymtab.c (psymbol_functions::map_symbol_filenames): Update.
* psympriv.h (struct psymbol_functions) <map_symbol_filenames>:
Change type of 'fun' and 'need_fullname'. Remove 'data'
parameter.
* objfiles.h (struct objfile) <map_symbol_filenames>: Change type
of 'fun' and 'need_fullname'. Remove 'data' parameter.
* mi/mi-cmd-file.c (print_partial_file_name): Remove 'ignore'
parameter.
(mi_cmd_file_list_exec_source_files): Update.
* dwarf2/read.c
(dwarf2_base_index_functions::map_symbol_filenames): Update.
|
|
I noticed that psymbol_functions::expand_symtabs_matching calls
make_ignore_params once per psymtab that is matched. This seems
possibly expensive, so this patch hoists the call out of the loop.
gdb/ChangeLog
2021-03-26 Tom Tromey <tom@tromey.com>
* psymtab.c (psymbol_functions::expand_symtabs_matching): Only
call make_ignore_params once.
|
|
Currently the psymtab variant of expand_symtabs_matching has this
check:
/* We skip shared psymtabs because file-matching doesn't apply
to them; but we search them later in the loop. */
if (ps->user != NULL)
continue;
In a larger series I'm working on, it's convenient to remove this
check. And, I noticed that a similar check is not done for
expand_symtabs_with_fullname. So, it made sense to me to remove the
check here as well.
gdb/ChangeLog
2021-03-26 Tom Tromey <tom@tromey.com>
* psymtab.c (psymbol_functions::expand_symtabs_matching): Remove
"user" check.
|
|
This patch finally changes gdb so that an objfile can have multiple
sources of partial symbols (or mixed partial symbols and other kinds
of indices).
This is done by having each symbol reader create its own
psymbol_functions object and add it to the 'qf' list in the objfile.
gdb/ChangeLog
2021-03-20 Tom Tromey <tom@tromey.com>
* xcoffread.c (xcoff_initial_scan): Create partial symtabs.
* symfile.c (syms_from_objfile_1, reread_symbols): Update.
* psymtab.h (make_psymbol_functions): Don't declare.
* psymtab.c (make_psymbol_functions): Remove.
(maintenance_print_psymbols): Update.
* psympriv.h (struct psymbol_functions): Add no-argument
constructor.
* objfiles.h (struct objfile) <reset_psymtabs>: Remove.
<partial_symtabs>: Remove.
* mdebugread.c (mdebug_build_psymtabs): Create partial symtabs.
* elfread.c (read_partial_symbols): Update.
(elf_symfile_read): Remove check for existing partial symbols.
Don't clear "qf".
* dwarf2/read.c (dwarf2_has_info): Remove check for existing
partial symbols.
(dwarf2_build_psymtabs): Add psymbol_functions parameter. Create
partial symtabs.
* dwarf2/public.h (dwarf2_build_psymtabs): Add psymbol_functions
parameter.
* dbxread.c (dbx_symfile_read): Create partial symtabs.
* ctfread.c (elfctf_build_psymtabs): Create partial symtabs.
|
|
This changes objfile::qf to be a forward_list, and then updates all
the uses to iterate over the list. Note that there is still only ever
a single element in the list; this is handled by clearing the list
whenever an object is added.
gdb/ChangeLog
2021-03-20 Tom Tromey <tom@tromey.com>
* dwarf2/read.c (dwarf2_build_psymtabs): Update.
* symfile.c (syms_from_objfile_1, reread_symbols): Update.
* symfile-debug.c (objfile::has_partial_symbols)
(objfile::find_last_source_symtab)
(objfile::forget_cached_source_info)
(objfile::map_symtabs_matching_filename, objfile::lookup_symbol)
(objfile::print_stats, objfile::dump)
(objfile::expand_symtabs_for_function)
(objfile::expand_all_symtabs)
(objfile::expand_symtabs_with_fullname)
(objfile::map_matching_symbols)
(objfile::expand_symtabs_matching)
(objfile::find_pc_sect_compunit_symtab)
(objfile::map_symbol_filenames)
(objfile::find_compunit_symtab_by_address)
(objfile::lookup_global_symbol_language)
(objfile::require_partial_symbols): Update.
* psymtab.c (maintenance_print_psymbols)
(maintenance_info_psymtabs, maintenance_check_psymtabs): Update.
* objfiles.h (struct objfile) <qf>: Now a forward_list.
* objfiles.c (objfile_relocate1): Update.
* elfread.c (elf_symfile_read): Update.
|