Don't create _Complex type name if there is no target type name
authorHannes Domani <ssbssa@yahoo.de>
Tue, 6 Oct 2020 15:08:42 +0000 (17:08 +0200)
committerHannes Domani <ssbssa@yahoo.de>
Thu, 22 Oct 2020 17:33:40 +0000 (19:33 +0200)
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.

gdb/ChangeLog
gdb/gdbtypes.c

index 819f448586cf9b04b218f8b675d25a767bfb181d..b493eff0062e73d45206b347d7fa6240c4747d22 100644 (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):
index e7d9e4cef3e004218d028005803ab09d36877ade..33d3a464f5ba4eb944b08c5950f5f0ac74989703 100644 (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,