/* Print and select stack frames for GDB, the GNU debugger.
- Copyright 1986, 1987, 1989, 1991, 1992, 1993, 1994, 1995, 1996,
- 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+ Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995,
+ 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
This file is part of GDB.
#include "demangle.h"
#include "inferior.h"
#include "annotate.h"
-#include "symfile.h"
-#include "objfiles.h"
#ifdef UI_OUT
#include "ui-out.h"
#endif
if (args)
{
struct print_args_args args;
+#ifdef UI_OUT
+ struct cleanup *args_list_chain;
+#endif
args.fi = fi;
args.func = func;
args.stream = gdb_stdout;
#ifdef UI_OUT
ui_out_list_begin (uiout, "args");
+ args_list_chain = make_cleanup_ui_out_list_end (uiout);
catch_errors (print_args_stub, &args, "", RETURN_MASK_ALL);
/* FIXME: args must be a list. If one argument is a string it will
have " that will not be properly escaped. */
- ui_out_list_end (uiout);
+ /* Invoke ui_out_list_end. */
+ do_cleanups (args_list_chain);
#else
catch_errors (print_args_stub, &args, "", RETURN_MASK_ALL);
#endif
int numargs = 0;
#define MAXARGS 4
CORE_ADDR args[MAXARGS];
+ int level;
if (frame_exp)
{
addr_string = savestring (frame_exp, p - frame_exp);
{
+ value_ptr vp;
+
tmp_cleanup = make_cleanup (xfree, addr_string);
- args[numargs++] = parse_and_eval_address (addr_string);
+
+ /* NOTE: we call parse_and_eval and then both
+ value_as_long and value_as_pointer rather than calling
+ parse_and_eval_long and parse_and_eval_address because
+ of the issue of potential side effects from evaluating
+ the expression. */
+ vp = parse_and_eval (addr_string);
+ if (numargs == 0)
+ level = value_as_long (vp);
+
+ args[numargs++] = value_as_pointer (vp);
do_cleanups (tmp_cleanup);
}
/* NOTREACHED */
case 1:
{
- int level = args[0];
struct frame_info *fid =
find_relative_frame (get_current_frame (), &level);
struct frame_info *tfid;
print_address_numeric (fi->saved_regs[SP_REGNUM], 1, gdb_stdout);
printf_filtered ("\n");
count = 0;
- numregs = ARCH_NUM_REGS;
+ numregs = NUM_REGS + NUM_PSEUDO_REGS;
for (i = 0; i < numregs; i++)
if (fi->saved_regs[i] && i != SP_REGNUM)
{