aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHannes Domani <ssbssa@yahoo.de>2020-10-06 17:08:42 +0200
committerHannes Domani <ssbssa@yahoo.de>2020-10-22 19:33:40 +0200
commit6b9d0dfda4787a072d8e61b6407d5ce42a936a1a (patch)
treec2d8b4a426a3ab6e7423efa7d4a977263d55abd6
parent4b4bb603fda8dca010c4fc18ae84f9df37b0bb8c (diff)
downloadgdb-6b9d0dfda4787a072d8e61b6407d5ce42a936a1a.zip
gdb-6b9d0dfda4787a072d8e61b6407d5ce42a936a1a.tar.gz
gdb-6b9d0dfda4787a072d8e61b6407d5ce42a936a1a.tar.bz2
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.
-rw-r--r--gdb/ChangeLog4
-rw-r--r--gdb/gdbtypes.c2
2 files changed, 5 insertions, 1 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 819f448..b493eff 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -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):
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index e7d9e4c..33d3a46 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,