* c-typeprint.c (c_type_print_base, case TYPE_CODE_TYPEDEF): Verify
authorDoug Evans <dje@google.com>
Tue, 19 Oct 2010 04:22:20 +0000 (04:22 +0000)
committerDoug Evans <dje@google.com>
Tue, 19 Oct 2010 04:22:20 +0000 (04:22 +0000)
assumptions of when this case happens.  Print "<unnamed typedef>".

gdb/ChangeLog
gdb/c-typeprint.c

index a98fde1ddd0c37b891cc01821b253558a563da8d..bff8559eeb4bd10e0ab18da94bb9e18628bba8d6 100644 (file)
@@ -1,3 +1,8 @@
+2010-10-18  Doug Evans  <dje@google.com>
+
+       * c-typeprint.c (c_type_print_base, case TYPE_CODE_TYPEDEF): Verify
+       assumptions of when this case happens.  Print "<unnamed typedef>".
+
 2010-10-18  Tom Tromey  <tromey@redhat.com>
 
        * valprint.c (val_print_string): Pass 'encoding' to
index 0fd077b36fc132ad86e397f8bd6f47bc97688000..87f7b0d3b6795fac2e8ddf1a0709ad5059a48130 100644 (file)
@@ -707,6 +707,13 @@ c_type_print_base (struct type *type, struct ui_file *stream, int show,
   switch (TYPE_CODE (type))
     {
     case TYPE_CODE_TYPEDEF:
+      /* If we get here, the typedef doesn't have a name, and we couldn't
+        resolve TYPE_TARGET_TYPE.  Not much we can do.  */
+      gdb_assert (TYPE_NAME (type) == NULL);
+      gdb_assert (TYPE_TARGET_TYPE (type) == NULL);
+      fprintf_filtered (stream, _("<unnamed typedef>"));
+      break;
+
     case TYPE_CODE_ARRAY:
     case TYPE_CODE_PTR:
     case TYPE_CODE_MEMBERPTR: