[8/9] Use value_at_non_lval in get_call_return_value

Message ID 20221007180120.1866772-9-tromey@adacore.com
State Committed
Commit 3360bae61faee3b57e4defa33cd7387be5c0dea8
Headers
Series Fix "finish" with variably-sized types |

Commit Message

Tom Tromey Oct. 7, 2022, 6:01 p.m. UTC
  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 | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
  

Patch

diff --git a/gdb/infcall.c b/gdb/infcall.c
index 21270ef48d3..9b679d930e9 100644
--- a/gdb/infcall.c
+++ b/gdb/infcall.c
@@ -448,12 +448,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
     {