From 6b9d0dfda4787a072d8e61b6407d5ce42a936a1a Mon Sep 17 00:00:00 2001 From: Hannes Domani Date: Tue, 6 Oct 2020 17:08:42 +0200 Subject: [PATCH] Don't create _Complex type name if there is no target type name This causes gdb to crash in strlen. Happens if init_complex_type is called for a type created by dbx_init_float_type in stabsread.c. gdb/ChangeLog: 2020-10-22 Hannes Domani * gdbtypes.c (init_complex_type): Check target type name. --- gdb/ChangeLog | 4 ++++ gdb/gdbtypes.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 819f448586c..b493eff0062 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,7 @@ +2020-10-22 Hannes Domani + + * gdbtypes.c (init_complex_type): Check target type name. + 2020-10-22 Simon Marchi * target-debug.h (target_debug_print_struct_target_ops_p): diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index e7d9e4cef3e..33d3a464f5b 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -3283,7 +3283,7 @@ init_complex_type (const char *name, struct type *target_type) if (TYPE_MAIN_TYPE (target_type)->flds_bnds.complex_type == nullptr) { - if (name == nullptr) + if (name == nullptr && target_type->name () != nullptr) { char *new_name = (char *) TYPE_ALLOC (target_type, -- 2.30.2