* ppc-sysv-tdep.c (ppc64_sysv_abi_push_dummy_call): Handle
authorUlrich Weigand <uweigand@de.ibm.com>
Fri, 2 May 2008 23:24:44 +0000 (23:24 +0000)
committerUlrich Weigand <uweigand@de.ibm.com>
Fri, 2 May 2008 23:24:44 +0000 (23:24 +0000)
TYPE_CODE_BOOL and TYPE_CODE_CHAR the same as TYPE_CODE_INT.
Handle TYPE_CODE_REF the same as TYPE_CODE_PTR.
Handle TYPE_CODE_METHOD the same as TYPE_CODE_FUNC.
Allow typedefs when checking for function pointer arguments.
Right-align small structs passed on the stack.
(ppc64_sysv_abi_return_value): Handle TYPE_CODE_BOOL and
TYPE_CODE_CHAR the same as TYPE_CODE_INT.
Handle TYPE_CODE_REF the same as TYPE_CODE_PTR.

gdb/ChangeLog
gdb/ppc-sysv-tdep.c

index c7515cbfdb6b9c32f9a0fb6b3840e5f2b88f867b..496c75ce4423a8d2482b46ea987fe6d18c1035ae 100644 (file)
@@ -1,3 +1,15 @@
+2008-05-02  Ulrich Weigand  <uweigand@de.ibm.com>
+
+       * ppc-sysv-tdep.c (ppc64_sysv_abi_push_dummy_call): Handle
+       TYPE_CODE_BOOL and TYPE_CODE_CHAR the same as TYPE_CODE_INT.
+       Handle TYPE_CODE_REF the same as TYPE_CODE_PTR.
+       Handle TYPE_CODE_METHOD the same as TYPE_CODE_FUNC.
+       Allow typedefs when checking for function pointer arguments.
+       Right-align small structs passed on the stack.
+       (ppc64_sysv_abi_return_value): Handle TYPE_CODE_BOOL and
+       TYPE_CODE_CHAR the same as TYPE_CODE_INT.
+       Handle TYPE_CODE_REF the same as TYPE_CODE_PTR.
+
 2008-05-02  Daniel Jacobowitz  <dan@codesourcery.com>
 
        * Makefile.in (arm-tdep.o): Update.
index 27627dae05bdf41e0a854385e042fcd1bdf93a80..71b89339de2a6a48041a5ac078720f9368232f57 100644 (file)
@@ -1149,7 +1149,10 @@ ppc64_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
            }
          else if ((TYPE_CODE (type) == TYPE_CODE_INT
                    || TYPE_CODE (type) == TYPE_CODE_ENUM
-                   || TYPE_CODE (type) == TYPE_CODE_PTR)
+                   || TYPE_CODE (type) == TYPE_CODE_BOOL
+                   || TYPE_CODE (type) == TYPE_CODE_CHAR
+                   || TYPE_CODE (type) == TYPE_CODE_PTR
+                   || TYPE_CODE (type) == TYPE_CODE_REF)
                   && TYPE_LENGTH (type) <= 8)
            {
              /* Scalars and Pointers get sign[un]extended and go in
@@ -1161,11 +1164,18 @@ ppc64_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
                  /* Convert any function code addresses into
                     descriptors.  */
                  if (TYPE_CODE (type) == TYPE_CODE_PTR
-                     && TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_FUNC)
+                     || TYPE_CODE (type) == TYPE_CODE_REF)
                    {
-                     CORE_ADDR desc = word;
-                     convert_code_addr_to_desc_addr (word, &desc);
-                     word = desc;
+                     struct type *target_type;
+                     target_type = check_typedef (TYPE_TARGET_TYPE (type));
+
+                     if (TYPE_CODE (target_type) == TYPE_CODE_FUNC
+                         || TYPE_CODE (target_type) == TYPE_CODE_METHOD)
+                       {
+                         CORE_ADDR desc = word;
+                         convert_code_addr_to_desc_addr (word, &desc);
+                         word = desc;
+                       }
                    }
                  if (greg <= 10)
                    regcache_cooked_write_unsigned (regcache,
@@ -1206,14 +1216,20 @@ ppc64_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
                  greg++;
                }
              if (write_pass)
-               /* WARNING: cagney/2003-09-21: Strictly speaking, this
-                  isn't necessary, unfortunately, GCC appears to get
-                  "struct convention" parameter passing wrong putting
-                  odd sized structures in memory instead of in a
-                  register.  Work around this by always writing the
-                  value to memory.  Fortunately, doing this
-                  simplifies the code.  */
-               write_memory (gparam, val, TYPE_LENGTH (type));
+               {
+                 /* WARNING: cagney/2003-09-21: Strictly speaking, this
+                    isn't necessary, unfortunately, GCC appears to get
+                    "struct convention" parameter passing wrong putting
+                    odd sized structures in memory instead of in a
+                    register.  Work around this by always writing the
+                    value to memory.  Fortunately, doing this
+                    simplifies the code.  */
+                 int len = TYPE_LENGTH (type);
+                 if (len < tdep->wordsize)
+                   write_memory (gparam + tdep->wordsize - len, val, len);
+                 else
+                   write_memory (gparam, val, len);
+               }
              if (freg <= 13
                  && TYPE_CODE (type) == TYPE_CODE_STRUCT
                  && TYPE_NFIELDS (type) == 1
@@ -1356,7 +1372,9 @@ ppc64_sysv_abi_return_value (struct gdbarch *gdbarch, struct type *func_type,
                                           writebuf);
   /* Integers in r3.  */
   if ((TYPE_CODE (valtype) == TYPE_CODE_INT
-       || TYPE_CODE (valtype) == TYPE_CODE_ENUM)
+       || TYPE_CODE (valtype) == TYPE_CODE_ENUM
+       || TYPE_CODE (valtype) == TYPE_CODE_CHAR
+       || TYPE_CODE (valtype) == TYPE_CODE_BOOL)
       && TYPE_LENGTH (valtype) <= 8)
     {
       if (writebuf != NULL)
@@ -1377,7 +1395,8 @@ ppc64_sysv_abi_return_value (struct gdbarch *gdbarch, struct type *func_type,
       return RETURN_VALUE_REGISTER_CONVENTION;
     }
   /* All pointers live in r3.  */
-  if (TYPE_CODE (valtype) == TYPE_CODE_PTR)
+  if (TYPE_CODE (valtype) == TYPE_CODE_PTR
+      || TYPE_CODE (valtype) == TYPE_CODE_REF)
     {
       /* All pointers live in r3.  */
       if (writebuf != NULL)
This page took 0.038383 seconds and 4 git commands to generate.