forked from Imagelibrary/binutils-gdb
At the beginning of a session, gdb may attempt to download debuginfo
for all shared libraries associated with the process or core file
being debugged. This can be a waste of time and storage space when much
of the debuginfo ends up not being used during the session.
To reduce the gdb's startup latency and to download only the debuginfo
that is really needed, this patch adds on-demand downloading of debuginfo.
'set debuginfo enabled on' now causes gdb to attempt to download a .gdb_index
for each shared library instead of its full debuginfo. Each corresponding
separate debuginfo will be deferred until gdb needs to expand symtabs
associated with the debuginfo's index.
Because these indices are significantly smaller than their corresponding
debuginfo, this generally reduces the total amount of data gdb downloads.
Reductions of 80%-95% have been observed when debugging large GUI programs.
(gdb) set debuginfod enabled on
(gdb) start
Downloading section .gdb_index for /lib64/libcurl.so.4
[...]
1826 client->server_mhandle = curl_multi_init ();
(gdb) step
Downloading separate debug info for /lib64/libcurl.so.4
Downloading separate debug info for [libcurl dwz]
Downloading source file /usr/src/debug/curl-7.85.0-6.fc37.x86_64/build-full/lib/../../lib/multi.c
curl_multi_init () at ../../lib/multi.c:457
457 {
(gdb)
Some of the key functions below include dwarf2_has_separate_index which
downloads the separate .gdb_index. If successful, the shared library
objfile owns the index until the separate debug objfile is downloaded
or confirmed to not be available.
read_full_dwarf_from_debuginfod downloads the full debuginfo and
initializes the separate debug objfile. It is called by functions
such as dwarf2_gdb_index::expand_symtabs_matching and
dwarf2_base_index_functions::find_pc_sect_compunit_symtab when symtab
expansion is required.
30 lines
892 B
C
30 lines
892 B
C
/* This testcase is part of GDB, the GNU debugger.
|
|
|
|
Copyright 2023-2024 Free Software Foundation, Inc.
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation; either version 3 of the License, or
|
|
(at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
|
|
|
#include <stdio.h>
|
|
|
|
extern void libsection1_test ();
|
|
|
|
int
|
|
main ()
|
|
{
|
|
libsection1_test ();
|
|
printf ("in section exec\n");
|
|
|
|
return 0;
|
|
}
|