* infcall.c (call_function_by_hand): Function return value is
authorUlrich Weigand <uweigand@de.ibm.com>
Tue, 15 Mar 2011 14:40:22 +0000 (14:40 +0000)
committerUlrich Weigand <uweigand@de.ibm.com>
Tue, 15 Mar 2011 14:40:22 +0000 (14:40 +0000)
always a non_lval, even when using struct_return.

gdb/ChangeLog
gdb/infcall.c

index f441a9fda2ab09c25ba4b28aef179e70db10507c..cb45680906984095ae3fff6fe2390892e78c859a 100644 (file)
@@ -1,3 +1,8 @@
+2011-03-15  Ulrich Weigand  <ulrich.weigand@linaro.org>
+
+       * infcall.c (call_function_by_hand): Function return value is
+       always a non_lval, even when using struct_return.
+
 2011-03-15  Pedro Alves  <pedro@codesourcery.com>
 
        * printcmd.c (ALL_DISPLAYS_SAFE): New.
index 75de56cadac2c7b5454293f2fd9d99b1b9f5ba35..d42248ef5196a98128a0878d538234dc1bc66775 100644 (file)
@@ -1010,29 +1010,29 @@ When the function is done executing, GDB will silently stop."),
     restore_infcall_control_state (inf_status);
 
     /* Figure out the value returned by the function.  */
+    retval = allocate_value (values_type);
 
     if (lang_struct_return)
-      retval = value_at (values_type, struct_addr);
-    else if (TYPE_CODE (target_values_type) == TYPE_CODE_VOID)
+      read_value_memory (retval, 0, 1, struct_addr,
+                        value_contents_raw (retval),
+                        TYPE_LENGTH (values_type));
+    else if (TYPE_CODE (target_values_type) != TYPE_CODE_VOID)
       {
        /* If the function returns void, don't bother fetching the
           return value.  */
-       retval = allocate_value (values_type);
-      }
-    else
-      {
        switch (gdbarch_return_value (gdbarch, value_type (function),
                                      target_values_type, NULL, NULL, NULL))
          {
          case RETURN_VALUE_REGISTER_CONVENTION:
          case RETURN_VALUE_ABI_RETURNS_ADDRESS:
          case RETURN_VALUE_ABI_PRESERVES_ADDRESS:
-           retval = allocate_value (values_type);
            gdbarch_return_value (gdbarch, value_type (function), values_type,
                                  retbuf, value_contents_raw (retval), NULL);
            break;
          case RETURN_VALUE_STRUCT_CONVENTION:
-           retval = value_at (values_type, struct_addr);
+           read_value_memory (retval, 0, 1, struct_addr,
+                              value_contents_raw (retval),
+                              TYPE_LENGTH (values_type));
            break;
          }
       }