aboutsummaryrefslogtreecommitdiff
path: root/gdb/stack.c
diff options
context:
space:
mode:
authorJohn Gilmore <gnu@cygnus>1992-06-30 08:53:28 +0000
committerJohn Gilmore <gnu@cygnus>1992-06-30 08:53:28 +0000
commit0f552c5fc6ed8ddf060a01c97cbef7c0c890ffe4 (patch)
tree462825c1bee2156abb8e122392916b114a0cd7f6 /gdb/stack.c
parentc47793da968c7420c6e7c56500d876d83a0705c7 (diff)
downloadgdb-0f552c5fc6ed8ddf060a01c97cbef7c0c890ffe4.zip
gdb-0f552c5fc6ed8ddf060a01c97cbef7c0c890ffe4.tar.gz
gdb-0f552c5fc6ed8ddf060a01c97cbef7c0c890ffe4.tar.bz2
* buildsym.c (scan_file_globals): Beware the null file.
Fix from Jim Williams. * stack.c (return_command): Evaluate expression *before* popping off the stack frames! Fix inspired by Jim Williams. (up_silently_command, down_silently_command): No sel frame is error. * defs.h (memcpy, memset): Conditionalize decls on #ifndef MEM_FNS_DECLARED, since DECstation differs. (alloca): Break out the STDC and non-STDC alloca cases, to make it work on old preprocessors as well as "picky ANSI" ones. * xm-mips.h (memcpy, memset): Declare, and set MEM_FNS_DECLARED. * mips-tdep.c (heuristic_proc_start): Zero arg produces zero. * utils.c (fputs_demangled): Rename SLOP since DECstation system header files define it!
Diffstat (limited to 'gdb/stack.c')
-rw-r--r--gdb/stack.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/gdb/stack.c b/gdb/stack.c
index 7857347..4aeb7c4 100644
--- a/gdb/stack.c
+++ b/gdb/stack.c
@@ -1066,7 +1066,7 @@ up_silently_command (count_exp, from_tty)
count = parse_and_eval_address (count_exp);
count1 = count;
- if (!target_has_stack)
+ if (target_has_stack == 0 || selected_frame == 0)
error ("No stack.");
frame = find_relative_frame (selected_frame, &count1);
@@ -1099,7 +1099,7 @@ down_silently_command (count_exp, from_tty)
count = - parse_and_eval_address (count_exp);
count1 = count;
- if (!target_has_stack)
+ if (target_has_stack == 0 || selected_frame == 0)
error ("No stack.");
frame = find_relative_frame (selected_frame, &count1);
@@ -1129,6 +1129,7 @@ return_command (retval_exp, from_tty)
FRAME frame;
char *funcname;
struct cleanup *back_to;
+ value return_value;
if (selected_frame == NULL)
error ("No selected frame.");
@@ -1136,6 +1137,16 @@ return_command (retval_exp, from_tty)
selected_frame_addr = FRAME_FP (selected_frame);
selected_frame_pc = (get_frame_info (selected_frame))->pc;
+ /* Compute the return value (if any -- possibly getting errors here).
+ Call VALUE_CONTENTS to make sure we have fully evaluated it, since
+ it might live in the stack frame we're about to pop. */
+
+ if (retval_exp)
+ {
+ return_value = parse_and_eval (retval_exp);
+ (void) (VALUE_CONTENTS (return_value));
+ }
+
/* If interactive, require confirmation. */
if (from_tty)
@@ -1173,7 +1184,7 @@ return_command (retval_exp, from_tty)
for return values. */
if (retval_exp)
- set_return_value (parse_and_eval (retval_exp));
+ set_return_value (return_value);
/* If interactive, print the frame that is now current. */