]> Git Repo - binutils.git/blobdiff - gdb/stack.c
* dlltool.c (do_default_excludes): Initialise to true.
[binutils.git] / gdb / stack.c
index af415e2c2f7446f9b795630b9f917213dbea2af3..07bea73a54fb05081abd5abe0a9b20c118db5fe0 100644 (file)
@@ -1,6 +1,6 @@
 /* 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.
 
@@ -35,8 +35,6 @@
 #include "demangle.h"
 #include "inferior.h"
 #include "annotate.h"
-#include "symfile.h"
-#include "objfiles.h"
 #ifdef UI_OUT
 #include "ui-out.h"
 #endif
@@ -582,15 +580,20 @@ print_frame (struct frame_info *fi,
   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
@@ -704,6 +707,7 @@ parse_frame_specification (char *frame_exp)
   int numargs = 0;
 #define        MAXARGS 4
   CORE_ADDR args[MAXARGS];
+  int level;
 
   if (frame_exp)
     {
@@ -723,8 +727,20 @@ parse_frame_specification (char *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);
          }
 
@@ -744,7 +760,6 @@ parse_frame_specification (char *frame_exp)
       /* NOTREACHED */
     case 1:
       {
-       int level = args[0];
        struct frame_info *fid =
        find_relative_frame (get_current_frame (), &level);
        struct frame_info *tfid;
@@ -989,7 +1004,7 @@ frame_info (char *addr_exp, int from_tty)
       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)
          {
This page took 0.026741 seconds and 4 git commands to generate.