diff options
author | Tom Tromey <tom@tromey.com> | 2021-04-17 13:40:04 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2021-04-17 13:40:04 -0600 |
commit | da314dd397ab967af558f2929a79349aa5f96ac8 (patch) | |
tree | b208014a1127187e98feb5a94afa6148f48787bf /gdb/dwarf2 | |
parent | 0b7b2c2adff43d39ee3bd39ebd91a6710d9175e4 (diff) | |
download | fsf-binutils-gdb-da314dd397ab967af558f2929a79349aa5f96ac8.zip fsf-binutils-gdb-da314dd397ab967af558f2929a79349aa5f96ac8.tar.gz fsf-binutils-gdb-da314dd397ab967af558f2929a79349aa5f96ac8.tar.bz2 |
Avoid crash in write_psymtabs_to_index
If I try "save gdb-index" using the executable from
gdb.cp/cmpd-minsyms.exp, gdb will crash. This happens due to a
missing NULL check.
gdb/ChangeLog
2021-04-17 Tom Tromey <tom@tromey.com>
* dwarf2/index-write.c (write_psymtabs_to_index): Check
partial_symtabs.
gdb/testsuite/ChangeLog
2021-04-17 Tom Tromey <tom@tromey.com>
* gdb.dwarf2/gdb-index-nodebug.exp: New file.
Diffstat (limited to 'gdb/dwarf2')
-rw-r--r-- | gdb/dwarf2/index-write.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/gdb/dwarf2/index-write.c b/gdb/dwarf2/index-write.c index f42a253..6cfe415 100644 --- a/gdb/dwarf2/index-write.c +++ b/gdb/dwarf2/index-write.c @@ -1693,7 +1693,8 @@ write_psymtabs_to_index (dwarf2_per_objfile *per_objfile, const char *dir, if (per_objfile->per_bfd->types.size () > 1) error (_("Cannot make an index when the file has multiple .debug_types sections")); - if (!per_bfd->partial_symtabs->psymtabs + if (per_bfd->partial_symtabs == nullptr + || !per_bfd->partial_symtabs->psymtabs || !per_bfd->partial_symtabs->psymtabs_addrmap) return; |