gdb/
authorJan Kratochvil <jan.kratochvil@redhat.com>
Sun, 9 Oct 2011 19:10:52 +0000 (19:10 +0000)
committerJan Kratochvil <jan.kratochvil@redhat.com>
Sun, 9 Oct 2011 19:10:52 +0000 (19:10 +0000)
Code reshuffle.
* gdb-gdb.py (StructMainTypePrettyPrinter): Change
TYPE_SPECIFIC_CALLING_CONVENTION to TYPE_SPECIFIC_FUNC.  Move
calling_convention under func_stuff there.
* gdbtypes.c (make_function_type): Call INIT_FUNC_SPECIFIC.
(init_type) <TYPE_CODE_FUNC>: Likewise.
(recursive_dump_type): Change TYPE_SPECIFIC_CALLING_CONVENTION to
TYPE_SPECIFIC_FUNC.  New comment for tail_call_list.
* gdbtypes.h (enum type_specific_kind): Change
TYPE_SPECIFIC_CALLING_CONVENTION to TYPE_SPECIFIC_FUNC.
(struct main_type) <type_specific>: Change calling_convention to
func_stuff.  Move calling_convention to ...
(struct func_type): ... this new struct.
(INIT_FUNC_SPECIFIC): New #define.
(TYPE_CALLING_CONVENTION): Change calling_convention to func_stuff.

gdb/ChangeLog
gdb/gdb-gdb.py
gdb/gdbtypes.c
gdb/gdbtypes.h

index ee69551aad3e2548b0d9b69abf677935ca90a11a..b97d44ddc8dfc5a1b88b380e2ccd4c20d0cd1007 100644 (file)
@@ -1,3 +1,21 @@
+2011-10-09  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+       Code reshuffle.
+       * gdb-gdb.py (StructMainTypePrettyPrinter): Change
+       TYPE_SPECIFIC_CALLING_CONVENTION to TYPE_SPECIFIC_FUNC.  Move
+       calling_convention under func_stuff there.
+       * gdbtypes.c (make_function_type): Call INIT_FUNC_SPECIFIC.
+       (init_type) <TYPE_CODE_FUNC>: Likewise.
+       (recursive_dump_type): Change TYPE_SPECIFIC_CALLING_CONVENTION to
+       TYPE_SPECIFIC_FUNC.  New comment for tail_call_list.
+       * gdbtypes.h (enum type_specific_kind): Change
+       TYPE_SPECIFIC_CALLING_CONVENTION to TYPE_SPECIFIC_FUNC.
+       (struct main_type) <type_specific>: Change calling_convention to
+       func_stuff.  Move calling_convention to ...
+       (struct func_type): ... this new struct.
+       (INIT_FUNC_SPECIFIC): New #define.
+       (TYPE_CALLING_CONVENTION): Change calling_convention to func_stuff.
+
 2011-10-09  Jan Kratochvil  <jan.kratochvil@redhat.com>
 
        Fix DW_OP_GNU_implicit_pointer for DWARF32 v3+ on 64-bit arches.
index 17adee89b452d5a9f77be307e4da8058c0c25421..ae1d742fa9b869f24881ee0aea7ece6c178ca91d 100644 (file)
@@ -201,9 +201,10 @@ class StructMainTypePrettyPrinter:
                    % type_specific['gnat_stuff']['descriptive_type'])
         elif type_specific_kind == "TYPE_SPECIFIC_FLOATFORMAT":
             img = "floatformat[0..1] = %s" % type_specific['floatformat']
-        elif type_specific_kind == "TYPE_SPECIFIC_CALLING_CONVENTION":
+        elif type_specific_kind == "TYPE_SPECIFIC_FUNC":
             img = ("calling_convention = %d"
-                   % type_specific['calling_convention'])
+                   % type_specific['func_stuff']['calling_convention'])
+            # tail_call_list is not printed.
         else:
             img = ("type_specific = ??? (unknown type_secific_kind: %s)"
                    % type_specific_kind)
index da9bade735f026a1192606c85a60fa7c1cc80718..b1dada519806af2ed9dff78a5ab5394bfbffb326 100644 (file)
@@ -450,6 +450,8 @@ make_function_type (struct type *type, struct type **typeptr)
   TYPE_LENGTH (ntype) = 1;
   TYPE_CODE (ntype) = TYPE_CODE_FUNC;
 
+  INIT_FUNC_SPECIFIC (ntype);
+
   return ntype;
 }
 
@@ -1951,7 +1953,7 @@ init_type (enum type_code code, int length, int flags,
         TYPE_SPECIFIC_FIELD (type) = TYPE_SPECIFIC_FLOATFORMAT;
         break;
       case TYPE_CODE_FUNC:
-        TYPE_SPECIFIC_FIELD (type) = TYPE_SPECIFIC_CALLING_CONVENTION;
+       INIT_FUNC_SPECIFIC (type);
         break;
     }
   return type;
@@ -3257,9 +3259,10 @@ recursive_dump_type (struct type *type, int spaces)
        puts_filtered ("\n");
        break;
 
-      case TYPE_SPECIFIC_CALLING_CONVENTION:
+      case TYPE_SPECIFIC_FUNC:
        printfi_filtered (spaces, "calling_convention %d\n",
                           TYPE_CALLING_CONVENTION (type));
+       /* tail_call_list is not printed.  */
        break;
     }
 
index 1e96293abf71ebb0073aa25a69b042321d70b621..e78aa0d54a90bf0c2dba729d04e18c2248e30124 100644 (file)
@@ -368,7 +368,7 @@ enum type_specific_kind
   TYPE_SPECIFIC_CPLUS_STUFF,
   TYPE_SPECIFIC_GNAT_STUFF,
   TYPE_SPECIFIC_FLOATFORMAT,
-  TYPE_SPECIFIC_CALLING_CONVENTION
+  TYPE_SPECIFIC_FUNC
 };
 
 /* This structure is space-critical.
@@ -601,10 +601,8 @@ struct main_type
 
     const struct floatformat **floatformat;
 
-    /* For TYPE_CODE_FUNC types, the calling convention for targets
-       supporting multiple ABIs.  Right now this is only fetched from
-       the Dwarf-2 DW_AT_calling_convention attribute.  */
-    unsigned calling_convention;
+    /* For TYPE_CODE_FUNC types,  */
+    struct func_type *func_stuff;
   } type_specific;
 };
 
@@ -890,6 +888,15 @@ struct gnat_aux_type
     struct type* descriptive_type;
   };
 
+/* For TYPE_CODE_FUNC types,  */
+struct func_type
+  {
+    /* The calling convention for targets supporting multiple ABIs.  Right now
+       this is only fetched from the Dwarf-2 DW_AT_calling_convention
+       attribute.  */
+    unsigned calling_convention;
+  };
+
 /* The default value of TYPE_CPLUS_SPECIFIC(T) points to the
    this shared static structure.  */
 
@@ -921,6 +928,12 @@ extern void allocate_gnat_aux_type (struct type *);
 #define HAVE_GNAT_AUX_INFO(type) \
   (TYPE_SPECIFIC_FIELD (type) == TYPE_SPECIFIC_GNAT_STUFF)
 
+#define INIT_FUNC_SPECIFIC(type)                                              \
+  (TYPE_SPECIFIC_FIELD (type) = TYPE_SPECIFIC_FUNC,                           \
+   TYPE_MAIN_TYPE (type)->type_specific.func_stuff                            \
+     = TYPE_ZALLOC (type,                                                     \
+                   sizeof (*TYPE_MAIN_TYPE (type)->type_specific.func_stuff)))
+
 #define TYPE_INSTANCE_FLAGS(thistype) (thistype)->instance_flags
 #define TYPE_MAIN_TYPE(thistype) (thistype)->main_type
 #define TYPE_NAME(thistype) TYPE_MAIN_TYPE(thistype)->name
@@ -986,7 +999,7 @@ extern void allocate_gnat_aux_type (struct type *);
 #define TYPE_FLOATFORMAT(thistype) TYPE_MAIN_TYPE(thistype)->type_specific.floatformat
 #define TYPE_GNAT_SPECIFIC(thistype) TYPE_MAIN_TYPE(thistype)->type_specific.gnat_stuff
 #define TYPE_DESCRIPTIVE_TYPE(thistype) TYPE_GNAT_SPECIFIC(thistype)->descriptive_type
-#define TYPE_CALLING_CONVENTION(thistype) TYPE_MAIN_TYPE(thistype)->type_specific.calling_convention
+#define TYPE_CALLING_CONVENTION(thistype) TYPE_MAIN_TYPE(thistype)->type_specific.func_stuff->calling_convention
 #define TYPE_BASECLASS(thistype,index) TYPE_FIELD_TYPE(thistype, index)
 #define TYPE_N_BASECLASSES(thistype) TYPE_CPLUS_SPECIFIC(thistype)->n_baseclasses
 #define TYPE_BASECLASS_NAME(thistype,index) TYPE_FIELD_NAME(thistype, index)