diff options
author | Aaron Merey <amerey@redhat.com> | 2024-03-19 18:54:28 -0400 |
---|---|---|
committer | Aaron Merey <amerey@redhat.com> | 2024-03-19 20:43:32 -0400 |
commit | 0ae1349aac5df365380a3a152a98efe3af5491c2 (patch) | |
tree | cf51f5c82f756683ea99440562ae1db755696522 /gdb/dwarf2/read.h | |
parent | af1c8a8d9a60869572921f4d2ef3fdcad4843756 (diff) | |
download | gdb-users/amerey/index-download.zip gdb-users/amerey/index-download.tar.gz gdb-users/amerey/index-download.tar.bz2 |
gdb/debuginfod: Add .debug_line downloadingusers/amerey/index-download
ELF/DWARF section downloading allows gdb to download .gdb_index files in
order to defer full debuginfo downloads. However .gdb_index does not
contain any information regarding source filenames. When a gdb command
includes a filename argument (ex. 'break main.c:50'), this results in
the mass downloading of all deferred debuginfo so that gdb can search the
debuginfo for matching source filenames. This can result in unnecessary
downloads.
To improve this, have gdb instead download each debuginfo's .debug_line
(and .debug_line_str if using DWARF5) when executing these commands.
Download full debuginfo only when its .debug_line contains a matching
filename.
Since the combined size of .debug_line and .debug_line_str is only about
1% the size of the corresponding debuginfo, significant time can be saved
by checking these sections before choosing to download an entire debuginfo.
This patch also redirects stdout and stderr of the debuginfod server
used by testsuite/gdb.debuginfod tests to a server_log standard output
file. While adding tests for this patch I ran into an issue where the
test server would block when logging to stderr, presumably because the
stderr buffer filled up and wasn't being read from. Redirecting the
log to a file fixes this and also makes the server log more accessible
when debugging test failures.
Diffstat (limited to 'gdb/dwarf2/read.h')
-rw-r--r-- | gdb/dwarf2/read.h | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/gdb/dwarf2/read.h b/gdb/dwarf2/read.h index 10cb1ee..617c093 100644 --- a/gdb/dwarf2/read.h +++ b/gdb/dwarf2/read.h @@ -33,6 +33,7 @@ #include "gdbsupport/hash_enum.h" #include "gdbsupport/function-view.h" #include "gdbsupport/packed.h" +#include "dwarf2/line-header.h" /* Hold 'maintenance (set|show) dwarf' commands. */ extern struct cmd_list_element *set_dwarf_cmdlist; @@ -942,4 +943,40 @@ extern htab_up create_quick_file_names_table (unsigned int nr_initial_entries); extern void read_full_dwarf_from_debuginfod (struct objfile *, dwarf2_base_index_functions *); +struct mapped_debug_line +{ + mapped_debug_line (objfile *objfile); + + /* Return true if any of the mapped .debug_line's filenames match + FILE_MATCHER. */ + + bool contains_matching_filename + (gdb::function_view<expand_symtabs_file_matcher_ftype> file_matcher); + + /* Call FUN with each filename in this mapped .debug_line. Include + each file's fullname if NEED_FULLNAME is true. */ + + void map_filenames (gdb::function_view<symbol_filename_ftype> fun, + bool need_fullname); + +private: + std::vector<line_header_up> line_headers; + + gdb::array_view<const gdb_byte> line_data; + gdb::array_view<const gdb_byte> line_str_data; + + std::unique_ptr<index_cache_resource> line_resource; + std::unique_ptr<index_cache_resource> line_str_resource; + + /* Download the .debug_line and .debug_line_str associated with OBJFILE + and populate line_headers. */ + + bool read_debug_line_from_debuginfod (objfile *objfile); + + /* Initialize line_data and line_str_data with the .debug_line and + .debug_line_str downloaded read_debug_line_from_debuginfod. */ + + gdb::array_view<const gdb_byte> read_debug_line_separate + (const char *filename, std::unique_ptr<index_cache_resource> *resource); +}; #endif /* DWARF2READ_H */ |