aboutsummaryrefslogtreecommitdiff
path: root/gdb/infcmd.c
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>2003-10-20 15:38:02 +0000
committerAndrew Cagney <cagney@redhat.com>2003-10-20 15:38:02 +0000
commit92ad9cd90faf2b59f2434c8f706902df65ee5c2d (patch)
treee6360c92e84b1728ff0f1a86b0ceaba8468e3c9f /gdb/infcmd.c
parent198beae2cfaf8ea8bfd554ef8d3d3feeabc33ed7 (diff)
downloadgdb-92ad9cd90faf2b59f2434c8f706902df65ee5c2d.zip
gdb-92ad9cd90faf2b59f2434c8f706902df65ee5c2d.tar.gz
gdb-92ad9cd90faf2b59f2434c8f706902df65ee5c2d.tar.bz2
2003-10-20 Andrew Cagney <cagney@redhat.com>
* values.c (register_value_being_returned): Update comments. Use "gdbarch_return_value" when available. (using_struct_return): Ditto. (set_return_value): Ditto. Use "gdbarch_return_value" when available.. Print a warning, and not an error, when an unhandled return type is encountered. * infcmd.c: Include "gdb_assert.h". (print_return_value): When gdbarch_return_value_p, and using struct return, assume that the value is not available. * defs.h (return_value_convention): Define. * gdbarch.sh (gdbarch_return_value): New predicate method. * gdbarch.h, gdbarch.c: Re-generate * ppc-sysv-tdep.c (return_value_convention): Delete definition. Index: doc/ChangeLog 2003-10-20 Andrew Cagney <cagney@redhat.com> * gdbint.texinfo (Target Architecture Definition): Document gdbarch_return_value. Add cross references from USE_STRUCT_CONVENTION, EXTRACT_RETURN_VALUE, and STORE_RETURN_VALUE, and from/to EXTRACT_STRUCT_VALUE_ADDRESS.
Diffstat (limited to 'gdb/infcmd.c')
-rw-r--r--gdb/infcmd.c39
1 files changed, 24 insertions, 15 deletions
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index 60ebbea..9287f03 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -44,6 +44,7 @@
#include "reggroups.h"
#include "block.h"
#include <ctype.h>
+#include "gdb_assert.h"
/* Functions exported for general use, in inferior.h: */
@@ -1079,25 +1080,34 @@ print_return_value (int structure_return, struct type *value_type)
ui_out_field_stream (uiout, "return-value", stb);
ui_out_text (uiout, "\n");
}
- else
- {
- /* 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
- return" value. This is just a more complicated case of what
- is already being done in in the inferior function call code.
- In fact, when inferior function calls are made async, this
- will likely be made the norm. */
- /* We cannot determine the contents of the structure because
- it is on the stack, and we don't know where, since we did not
- initiate the call, as opposed to the call_function_by_hand case */
+ /* 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 return" value. This is just
+ a more complicated case of what is already being done in in the
+ inferior function call code. In fact, when inferior function
+ calls are made async, this will likely be made the norm. */
#ifdef DEPRECATED_VALUE_RETURNED_FROM_STACK
- value = 0;
+#define DEPRECATED_VALUE_RETURNED_FROM_STACK_P 1
+#else
+#define DEPRECATED_VALUE_RETURNED_FROM_STACK_P 0
+#endif
+ else if (gdbarch_return_value_p (current_gdbarch)
+ || DEPRECATED_VALUE_RETURNED_FROM_STACK_P)
+ /* We cannot determine the contents of the structure because it is
+ on the stack, and we don't know where, since we did not
+ initiate the call, as opposed to the call_function_by_hand
+ case. */
+ {
+ gdb_assert (gdbarch_return_value (current_gdbarch, value_type, NULL, NULL, NULL)
+ == RETURN_VALUE_STRUCT_CONVENTION);
ui_out_text (uiout, "Value returned has type: ");
ui_out_field_string (uiout, "return-type", TYPE_NAME (value_type));
ui_out_text (uiout, ".");
ui_out_text (uiout, " Cannot determine contents\n");
-#else
+ return;
+ }
+ else
+ {
if (EXTRACT_STRUCT_VALUE_ADDRESS_P ())
{
CORE_ADDR addr = EXTRACT_STRUCT_VALUE_ADDRESS (stop_registers);
@@ -1133,7 +1143,6 @@ print_return_value (int structure_return, struct type *value_type)
value_print (value, stb->stream, 0, Val_no_prettyprint);
ui_out_field_stream (uiout, "return-value", stb);
ui_out_text (uiout, "\n");
-#endif
}
}