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  <ssbssa@yahoo.de>

	* gdbtypes.c (init_complex_type): Check target type name.
This commit is contained in:
Hannes Domani 2020-10-06 17:08:42 +02:00
parent 4b4bb603fd
commit 6b9d0dfda4
2 changed files with 5 additions and 1 deletions

View File

@ -1,3 +1,7 @@
2020-10-22 Hannes Domani <ssbssa@yahoo.de>
* gdbtypes.c (init_complex_type): Check target type name.
2020-10-22 Simon Marchi <simon.marchi@polymtl.ca>
* target-debug.h (target_debug_print_struct_target_ops_p):

View File

@ -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,