Use value_at_non_lval in get_call_return_value
authorTom Tromey <tromey@adacore.com>
Wed, 7 Sep 2022 20:01:13 +0000 (14:01 -0600)
committerTom Tromey <tromey@adacore.com>
Tue, 3 Jan 2023 15:45:01 +0000 (08:45 -0700)
get_call_return_value can handle RETURN_VALUE_STRUCT_CONVENTION,
because the call is completely managed by gdb.  However, it does not
handle variably-sized types correctly.  The simplest way to fix this
is to use value_at_non_lval, which does type resolution.

gdb/infcall.c

index acaaf0c029d086a4ed017fe6629b7e11551e756f..e09904f9a35088757d3643c8a2830828994ee80a 100644 (file)
@@ -476,12 +476,7 @@ get_call_return_value (struct call_return_meta_info *ri)
          push_thread_stack_temporary (thr, retval);
        }
       else
-       {
-         retval = allocate_value (ri->value_type);
-         read_value_memory (retval, 0, 1, ri->struct_addr,
-                            value_contents_raw (retval).data (),
-                            ri->value_type->length ());
-       }
+       retval = value_at_non_lval (ri->value_type, ri->struct_addr);
     }
   else
     {