diff options
author | Andrew Burgess <andrew.burgess@embecosm.com> | 2021-03-17 16:48:25 +0000 |
---|---|---|
committer | Andrew Burgess <andrew.burgess@embecosm.com> | 2021-03-22 14:34:53 +0000 |
commit | 702cf3f5df18818eb62da7ffbd70544fa98da3c7 (patch) | |
tree | 6bfe50fd3c8410defe99271d207617e94f727cff /gdb/testsuite/ChangeLog | |
parent | 46fec6428ef7504be486ebd57e2509bde4382918 (diff) | |
download | gdb-702cf3f5df18818eb62da7ffbd70544fa98da3c7.zip gdb-702cf3f5df18818eb62da7ffbd70544fa98da3c7.tar.gz gdb-702cf3f5df18818eb62da7ffbd70544fa98da3c7.tar.bz2 |
gdb: handle invalid DWARF when compilation unit is missing
Replace an abort call in process_psymtab_comp_unit with a real error,
and add a test to cover this case. The case is question is when badly
formed DWARF is missing a DW_TAG_compile_unit, DW_TAG_partial_unit, or
DW_TAG_type_unit as its top level tag.
I then tested with --target_board=readnow and added additional code to
also validate the top-level tag in this case.
I added an assert that would trigger for the readnow case before I
added the fix. I suspect there's lots of places where badly formed
DWARF could result in the builder being nullptr when it shouldn't be,
but I only added this one assert, as this is the one that would have
helped me in this case.
gdb/ChangeLog:
* dwarf2/read.c (process_psymtab_comp_unit): Replace abort with an
error.
(process_full_comp_unit): Validate the top-level tag before
processing the first DIE.
(read_func_scope): Ensure we have a valid builder.
gdb/testsuite/ChangeLog:
* gdb.dwarf2/dw2-missing-cu-tag.c: New file.
* gdb.dwarf2/dw2-missing-cu-tag.exp: New file.
Diffstat (limited to 'gdb/testsuite/ChangeLog')
-rw-r--r-- | gdb/testsuite/ChangeLog | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index cb5dc81..848e089 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,5 +1,10 @@ 2021-03-22 Andrew Burgess <andrew.burgess@embecosm.com> + * gdb.dwarf2/dw2-missing-cu-tag.c: New file. + * gdb.dwarf2/dw2-missing-cu-tag.exp: New file. + +2021-03-22 Andrew Burgess <andrew.burgess@embecosm.com> + * gdb.dwarf2/dw2-using-debug-str.c: New file. * gdb.dwarf2/dw2-using-debug-str.exp: New file. * lib/dwarf.exp (Dwarf::DW_FORM_strp): Create .debug_str section, |