diff options
author | Tom Tromey <tom@tromey.com> | 2023-03-24 23:35:02 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2024-01-08 18:40:21 -0700 |
commit | 33c6eaaefcedd45e86d564d014f14cce2620f933 (patch) | |
tree | 65e9699822f70d866cb3e0c6b7d2d05e88712d46 /gdb/testsuite | |
parent | f7840e9e3eb9d1a157eaae772ea6841f1b83f1ba (diff) | |
download | gdb-33c6eaaefcedd45e86d564d014f14cce2620f933.zip gdb-33c6eaaefcedd45e86d564d014f14cce2620f933.tar.gz gdb-33c6eaaefcedd45e86d564d014f14cce2620f933.tar.bz2 |
Do more DWARF reading in the background
This patch rearranges the DWARF reader so that more work is done in
the background. This is PR symtab/29942.
The idea here is that there is only a small amount of work that must
be done on the main thread when scanning DWARF -- before the main
scan, the only part is mapping the section data.
Currently, the DWARF reader uses the quick_symbol_functions "lazy"
functionality to defer even starting to read. This patch instead
changes the reader to start reading immediately, but doing more in
worker tasks.
Before this patch, "file" on my machine:
(gdb) file /tmp/gdb
2023-10-23 12:29:56.885 - command started
Reading symbols from /tmp/gdb...
2023-10-23 12:29:58.047 - command finished
Command execution time: 5.867228 (cpu), 1.162444 (wall)
After the patch, more work is done in the background and so this takes
a bit less time:
(gdb) file /tmp/gdb
2023-10-23 13:25:51.391 - command started
Reading symbols from /tmp/gdb...
2023-10-23 13:25:51.712 - command finished
Command execution time: 1.894500 (cpu), 0.320306 (wall)
I think this could be further sped up by using the shared library load
map to avoid objfile loops like the one in expand_symtab_containing_pc
-- it seems like the correct objfile could be chosen more directly.
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29942
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30174
Diffstat (limited to 'gdb/testsuite')
-rw-r--r-- | gdb/testsuite/gdb.dwarf2/debug-aranges-duplicate-offset-warning.exp | 9 | ||||
-rw-r--r-- | gdb/testsuite/gdb.dwarf2/dw2-error.exp | 1 | ||||
-rw-r--r-- | gdb/testsuite/gdb.dwarf2/dw2-missing-cu-tag.exp | 2 | ||||
-rw-r--r-- | gdb/testsuite/gdb.dwarf2/dw2-stack-boundary.exp | 2 | ||||
-rw-r--r-- | gdb/testsuite/gdb.dwarf2/dw2-using-debug-str.exp | 2 | ||||
-rw-r--r-- | gdb/testsuite/gdb.dwarf2/dw2-zero-range.exp | 4 | ||||
-rw-r--r-- | gdb/testsuite/gdb.dwarf2/fission-reread.exp | 5 | ||||
-rw-r--r-- | gdb/testsuite/gdb.dwarf2/no-gnu-debuglink.exp | 1 | ||||
-rw-r--r-- | gdb/testsuite/gdb.dwarf2/struct-with-sig-2.exp | 10 |
9 files changed, 28 insertions, 8 deletions
diff --git a/gdb/testsuite/gdb.dwarf2/debug-aranges-duplicate-offset-warning.exp b/gdb/testsuite/gdb.dwarf2/debug-aranges-duplicate-offset-warning.exp index 4e8ce14..af0c8df 100644 --- a/gdb/testsuite/gdb.dwarf2/debug-aranges-duplicate-offset-warning.exp +++ b/gdb/testsuite/gdb.dwarf2/debug-aranges-duplicate-offset-warning.exp @@ -57,9 +57,12 @@ Dwarf::assemble $asm_file { } } -if { [prepare_for_testing "failed to prepare" ${testfile} \ - [list $srcfile $asm_file] {nodebug}] } { - return -1 +save_vars { GDBFLAGS } { + append GDBFLAGS " -iex \"maint set dwarf synchronous on\"" + if { [prepare_for_testing "failed to prepare" ${testfile} \ + [list $srcfile $asm_file] {nodebug}] } { + return -1 + } } set readnow_p [readnow] diff --git a/gdb/testsuite/gdb.dwarf2/dw2-error.exp b/gdb/testsuite/gdb.dwarf2/dw2-error.exp index 76886d5..f8dc08d 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-error.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-error.exp @@ -31,6 +31,7 @@ if {[build_executable $testfile.exp $testfile $srcfile {nodebug quiet}]} { clean_restart gdb_test_no_output "set breakpoint pending off" +gdb_test_no_output "maint set dwarf synchronous on" set host_binfile [gdb_remote_download host $binfile] diff --git a/gdb/testsuite/gdb.dwarf2/dw2-missing-cu-tag.exp b/gdb/testsuite/gdb.dwarf2/dw2-missing-cu-tag.exp index f57e808..f24c793 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-missing-cu-tag.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-missing-cu-tag.exp @@ -49,6 +49,8 @@ set host_binfile [gdb_remote_download host $binfile] # Restart with no executable. clean_restart +gdb_test_no_output "maint set dwarf synchronous on" + # This pattern is hit when GDB does not use -readnow (i.e. the default # behaviour). set pattern1 \ diff --git a/gdb/testsuite/gdb.dwarf2/dw2-stack-boundary.exp b/gdb/testsuite/gdb.dwarf2/dw2-stack-boundary.exp index a72564c..65b91b3 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-stack-boundary.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-stack-boundary.exp @@ -25,6 +25,8 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" object {}] != "" clean_restart +gdb_test_no_output "maint set dwarf synchronous on" + set host_binfile [gdb_remote_download host $binfile] gdb_test_no_output "set complaints 100" set w1 0 diff --git a/gdb/testsuite/gdb.dwarf2/dw2-using-debug-str.exp b/gdb/testsuite/gdb.dwarf2/dw2-using-debug-str.exp index 7974cb7..ec5d318 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-using-debug-str.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-using-debug-str.exp @@ -128,6 +128,8 @@ if {[run_on_host "objcopy" [gdb_find_objcopy] "$args"]} { # executable we're going to get an error, which we check for below. clean_restart +gdb_test_no_output "maint set dwarf synchronous on" + set line1 "Reading symbols from \[^\r\n\]+" set dwarf_error "Dwarf Error: DW_FORM_strp used without required section" diff --git a/gdb/testsuite/gdb.dwarf2/dw2-zero-range.exp b/gdb/testsuite/gdb.dwarf2/dw2-zero-range.exp index 7bef056..38c85a4 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-zero-range.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-zero-range.exp @@ -124,7 +124,7 @@ foreach_with_prefix ranges_sect {ranges rnglists} { with_complaints 1 { set test "Zero address complaint - relocated - psymtab" set have_complaint 0 - gdb_test_multiple "sharedlibrary [file tail $lib1]" $test { + gdb_test_multiple "maint with dwarf synchronous on -- sharedlibrary [file tail $lib1]" $test { -re -wrap $re { set have_complaint 1 } @@ -144,12 +144,14 @@ foreach_with_prefix ranges_sect {ranges rnglists} { clean_restart # Test for presence of complaint, with lib1 unrelocated. + gdb_test_no_output "maint set dwarf synchronous on" with_complaints 1 { gdb_load $lib1 set test "Zero address complaint - unrelocated - psymtab" set have_complaint [regexp $re.* $gdb_file_cmd_msg] gdb_assert { $have_complaint } $test } + gdb_test_no_output "maint set dwarf synchronous off" if { ! $readnow_p } { with_complaints 1 { diff --git a/gdb/testsuite/gdb.dwarf2/fission-reread.exp b/gdb/testsuite/gdb.dwarf2/fission-reread.exp index 01e9ead..884a835 100644 --- a/gdb/testsuite/gdb.dwarf2/fission-reread.exp +++ b/gdb/testsuite/gdb.dwarf2/fission-reread.exp @@ -60,7 +60,10 @@ pass "$testfile - unload" # Test-case for PR24620: Delete the .dwo file and verify that # save gdb-index doesn't crash. remote_file target delete $dwo -clean_restart $binfile +save_vars { GDBFLAGS } { + append GDBFLAGS " -iex \"maint set dwarf synchronous on\"" + clean_restart $binfile +} set output_dir [standard_output_file ""] set cmd "save gdb-index" gdb_test_multiple "$cmd $output_dir" $cmd { diff --git a/gdb/testsuite/gdb.dwarf2/no-gnu-debuglink.exp b/gdb/testsuite/gdb.dwarf2/no-gnu-debuglink.exp index a76136f..ff9c4dd 100644 --- a/gdb/testsuite/gdb.dwarf2/no-gnu-debuglink.exp +++ b/gdb/testsuite/gdb.dwarf2/no-gnu-debuglink.exp @@ -36,6 +36,7 @@ if { [build_executable $testfile.exp $testfile [list $srcfile $asm_file]] } { } clean_restart +gdb_test_no_output "maint set dwarf synchronous on" set msg "\r\nwarning: could not find '\.gnu_debugaltlink' file for \[^\r\n\]*" gdb_test "file $binfile" "$msg" "file command" diff --git a/gdb/testsuite/gdb.dwarf2/struct-with-sig-2.exp b/gdb/testsuite/gdb.dwarf2/struct-with-sig-2.exp index f6877fc..8bf200e 100644 --- a/gdb/testsuite/gdb.dwarf2/struct-with-sig-2.exp +++ b/gdb/testsuite/gdb.dwarf2/struct-with-sig-2.exp @@ -119,9 +119,13 @@ Dwarf::assemble $asm_file { } } -if { [prepare_for_testing "failed to prepare" ${testfile} \ - [list $srcfile $asm_file] {nodebug}] } { - return -1 +save_vars { GDBFLAGS } { + append GDBFLAGS " -iex \"maint set dwarf synchronous on\"" + + if { [prepare_for_testing "failed to prepare" ${testfile} \ + [list $srcfile $asm_file] {nodebug}] } { + return -1 + } } set re "Dwarf Error: .debug_types section not supported in dwz file" |