diff options
author | Andrew Cagney <cagney@redhat.com> | 2003-10-02 04:40:58 +0000 |
---|---|---|
committer | Andrew Cagney <cagney@redhat.com> | 2003-10-02 04:40:58 +0000 |
commit | 5fe830e4fe7e59c595fac7082edb4954e17a7688 (patch) | |
tree | 55f991d8a7cf010be108660dd195484028959b29 /gdb/infcmd.c | |
parent | d810ef463692eb22404564fffbcbbafe0adc7891 (diff) | |
download | gdb-5fe830e4fe7e59c595fac7082edb4954e17a7688.zip gdb-5fe830e4fe7e59c595fac7082edb4954e17a7688.tar.gz gdb-5fe830e4fe7e59c595fac7082edb4954e17a7688.tar.bz2 |
2003-10-01 Andrew Cagney <cagney@redhat.com>
* value.h (register_value_being_returned): Declare. Replace
"value_being_returned".
* infcall.c (call_function_by_hand): Use
register_value_being_returned.
* infcmd.c (print_return_value): Call
"register_value_being_returned", handle struct return locally.
* values.c (register_value_being_returned): New function. Replace
"value_being_returned".
Diffstat (limited to 'gdb/infcmd.c')
-rw-r--r-- | gdb/infcmd.c | 36 |
1 files changed, 29 insertions, 7 deletions
diff --git a/gdb/infcmd.c b/gdb/infcmd.c index 9fa0559..cb6acf0 100644 --- a/gdb/infcmd.c +++ b/gdb/infcmd.c @@ -1070,7 +1070,7 @@ print_return_value (int structure_return, struct type *value_type) if (!structure_return) { - value = value_being_returned (value_type, stop_registers, 0); + value = register_value_being_returned (value_type, stop_registers); stb = ui_out_stream_new (uiout); ui_out_text (uiout, "Value returned is "); ui_out_field_fmt (uiout, "gdb-result-var", "$%d", record_latest_value (value)); @@ -1081,11 +1081,6 @@ print_return_value (int structure_return, struct type *value_type) } else { - /* FIXME: 2003-09-27: This code block should be handling the - "use struct convention" case, and not the function - value_being_returned. This would allow the dramatic - simplification of value_being_returned (perhaphs renamed to - register_value_being_returned). */ /* FIXME: 2003-09-27: When returning from a nested inferior function call, it's possible (with no help from the architecture vector) to locate and return/print a "struct @@ -1103,7 +1098,34 @@ print_return_value (int structure_return, struct type *value_type) ui_out_text (uiout, "."); ui_out_text (uiout, " Cannot determine contents\n"); #else - value = value_being_returned (value_type, stop_registers, 1); + if (EXTRACT_STRUCT_VALUE_ADDRESS_P ()) + { + CORE_ADDR addr = EXTRACT_STRUCT_VALUE_ADDRESS (stop_registers); + if (!addr) + error ("Function return value unknown."); + value = value_at (value_type, addr, NULL); + } + else if (DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS_P ()) + { + char *buf = deprecated_grub_regcache_for_registers (stop_registers); + CORE_ADDR addr = DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS (buf); + if (!addr) + error ("Function return value unknown."); + value = value_at (value_type, addr, NULL); + } + else + { + /* It is "struct return" yet the value is being extracted, + presumably from registers, using EXTRACT_RETURN_VALUE. + This doesn't make sense. Unfortunatly, the legacy + interfaces allowed this behavior. Sigh! */ + value = allocate_value (value_type); + CHECK_TYPEDEF (value_type); + /* If the function returns void, don't bother fetching the + return value. */ + EXTRACT_RETURN_VALUE (value_type, stop_registers, + VALUE_CONTENTS_RAW (value)); + } stb = ui_out_stream_new (uiout); ui_out_text (uiout, "Value returned is "); ui_out_field_fmt (uiout, "gdb-result-var", "$%d", record_latest_value (value)); |