aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/lib/dwarf.exp
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2021-03-06 09:26:39 -0700
committerTom Tromey <tom@tromey.com>2021-03-06 09:26:39 -0700
commita7308ce01effdd143bfe5e3c7350fa2d5606d12b (patch)
tree0e10c305165080018d6c81067d0717927c45f473 /gdb/testsuite/lib/dwarf.exp
parentfbedd54644116109834c0e0546e6c32ae3c482f9 (diff)
downloadgdb-a7308ce01effdd143bfe5e3c7350fa2d5606d12b.zip
gdb-a7308ce01effdd143bfe5e3c7350fa2d5606d12b.tar.gz
gdb-a7308ce01effdd143bfe5e3c7350fa2d5606d12b.tar.bz2
Avoid crash on missing dwz file
If DWARF contains a reference to a "dwz" file, but there is no .gnu_debugaltlink section, then gdb will crash. This happens because dwarf2_get_dwz_file will return NULL, but some callers do not expect this. This patch changes dwarf2_get_dwz_file so that callers can require a dwz file. Then, it updates the callers that are attempting to process references to the dwz file to require one. This includes a new testcase. The dwarf.exp changes don't handle the new forms exactly correctly -- they are only handled well enough to let this test case complete. gdb/ChangeLog 2021-03-06 Tom Tromey <tom@tromey.com> * dwarf2/read.h (dwarf2_get_dwz_file): Add 'require' parameter. * dwarf2/read.c (dwarf2_get_dwz_file): Add 'require' parameter. (get_abbrev_section_for_cu, read_attribute_value) (get_debug_line_section): Update. * dwarf2/macro.c (dwarf_decode_macro_bytes): Update. gdb/testsuite/ChangeLog 2021-03-06 Tom Tromey <tom@tromey.com> * lib/dwarf.exp (_handle_DW_FORM): Treat DW_FORM_GNU_ref_alt and DW_FORM_GNU_strp_alt like DW_FORM_sec_offset. * gdb.dwarf2/dwznolink.exp: New file.
Diffstat (limited to 'gdb/testsuite/lib/dwarf.exp')
-rw-r--r--gdb/testsuite/lib/dwarf.exp4
1 files changed, 2 insertions, 2 deletions
diff --git a/gdb/testsuite/lib/dwarf.exp b/gdb/testsuite/lib/dwarf.exp
index c1c07be..f8fbd38 100644
--- a/gdb/testsuite/lib/dwarf.exp
+++ b/gdb/testsuite/lib/dwarf.exp
@@ -456,6 +456,8 @@ namespace eval Dwarf {
_op .${size}byte $value
}
+ DW_FORM_GNU_ref_alt -
+ DW_FORM_GNU_strp_alt -
DW_FORM_sec_offset {
variable _cu_offset_size
_op .${_cu_offset_size}byte $value
@@ -553,8 +555,6 @@ namespace eval Dwarf {
DW_FORM_GNU_addr_index -
DW_FORM_GNU_str_index -
- DW_FORM_GNU_ref_alt -
- DW_FORM_GNU_strp_alt -
default {
error "unhandled form $form"