gdb/mi/mi-cmd-stack.c - gdb

Global variables defined

Data types defined

Functions defined

Source code

  1. /* MI Command Set - stack commands.
  2.    Copyright (C) 2000-2015 Free Software Foundation, Inc.
  3.    Contributed by Cygnus Solutions (a Red Hat company).

  4.    This file is part of GDB.

  5.    This program is free software; you can redistribute it and/or modify
  6.    it under the terms of the GNU General Public License as published by
  7.    the Free Software Foundation; either version 3 of the License, or
  8.    (at your option) any later version.

  9.    This program is distributed in the hope that it will be useful,
  10.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  11.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12.    GNU General Public License for more details.

  13.    You should have received a copy of the GNU General Public License
  14.    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */

  15. #include "defs.h"
  16. #include "target.h"
  17. #include "frame.h"
  18. #include "value.h"
  19. #include "mi-cmds.h"
  20. #include "ui-out.h"
  21. #include "symtab.h"
  22. #include "block.h"
  23. #include "stack.h"
  24. #include "dictionary.h"
  25. #include "language.h"
  26. #include "valprint.h"
  27. #include "utils.h"
  28. #include "mi-getopt.h"
  29. #include "extension.h"
  30. #include <ctype.h>
  31. #include "mi-parse.h"

  32. enum what_to_list { locals, arguments, all };

  33. static void list_args_or_locals (enum what_to_list what,
  34.                                  enum print_values values,
  35.                                  struct frame_info *fi,
  36.                                  int skip_unavailable);

  37. /* True if we want to allow Python-based frame filters.  */
  38. static int frame_filters = 0;

  39. void
  40. mi_cmd_enable_frame_filters (char *command, char **argv, int argc)
  41. {
  42.   if (argc != 0)
  43.     error (_("-enable-frame-filters: no arguments allowed"));
  44.   frame_filters = 1;
  45. }

  46. /* Print a list of the stack frames.  Args can be none, in which case
  47.    we want to print the whole backtrace, or a pair of numbers
  48.    specifying the frame numbers at which to start and stop the
  49.    display.  If the two numbers are equal, a single frame will be
  50.    displayed.  */

  51. void
  52. mi_cmd_stack_list_frames (char *command, char **argv, int argc)
  53. {
  54.   int frame_low;
  55.   int frame_high;
  56.   int i;
  57.   struct cleanup *cleanup_stack;
  58.   struct frame_info *fi;
  59.   enum ext_lang_bt_status result = EXT_LANG_BT_ERROR;
  60.   int raw_arg = 0;
  61.   int oind = 0;
  62.   enum opt
  63.     {
  64.       NO_FRAME_FILTERS
  65.     };
  66.   static const struct mi_opt opts[] =
  67.     {
  68.       {"-no-frame-filters", NO_FRAME_FILTERS, 0},
  69.       { 0, 0, 0 }
  70.     };

  71.   /* Parse arguments.  In this instance we are just looking for
  72.      --no-frame-filters.  */
  73.   while (1)
  74.     {
  75.       char *oarg;
  76.       int opt = mi_getopt ("-stack-list-frames", argc, argv,
  77.                            opts, &oind, &oarg);
  78.       if (opt < 0)
  79.         break;
  80.       switch ((enum opt) opt)
  81.         {
  82.         case NO_FRAME_FILTERS:
  83.           raw_arg = oind;
  84.           break;
  85.         }
  86.     }

  87.   /* After the last option is parsed, there should either be low -
  88.      high range, or no further arguments.  */
  89.   if ((argc - oind != 0) && (argc - oind != 2))
  90.     error (_("-stack-list-frames: Usage: [--no-frame-filters] [FRAME_LOW FRAME_HIGH]"));

  91.   /* If there is a range, set it.  */
  92.   if (argc - oind == 2)
  93.     {
  94.       frame_low = atoi (argv[0 + oind]);
  95.       frame_high = atoi (argv[1 + oind]);
  96.     }
  97.   else
  98.     {
  99.       /* Called with no arguments, it means we want the whole
  100.          backtrace.  */
  101.       frame_low = -1;
  102.       frame_high = -1;
  103.     }

  104.   /* Let's position fi on the frame at which to start the
  105.      display. Could be the innermost frame if the whole stack needs
  106.      displaying, or if frame_low is 0.  */
  107.   for (i = 0, fi = get_current_frame ();
  108.        fi && i < frame_low;
  109.        i++, fi = get_prev_frame (fi));

  110.   if (fi == NULL)
  111.     error (_("-stack-list-frames: Not enough frames in stack."));

  112.   cleanup_stack = make_cleanup_ui_out_list_begin_end (current_uiout, "stack");

  113.   if (! raw_arg && frame_filters)
  114.     {
  115.       int flags = PRINT_LEVEL | PRINT_FRAME_INFO;
  116.       int py_frame_low = frame_low;

  117.       /* We cannot pass -1 to frame_low, as that would signify a
  118.       relative backtrace from the tail of the stack.  So, in the case
  119.       of frame_low == -1, assign and increment it.  */
  120.       if (py_frame_low == -1)
  121.         py_frame_low++;

  122.       result = apply_ext_lang_frame_filter (get_current_frame (), flags,
  123.                                             NO_VALUES,  current_uiout,
  124.                                             py_frame_low, frame_high);
  125.     }

  126.   /* Run the inbuilt backtrace if there are no filters registered, or
  127.      if "--no-frame-filters" has been specified from the command.  */
  128.   if (! frame_filters || raw_arg  || result == EXT_LANG_BT_NO_FILTERS)
  129.     {
  130.       /* Now let's print the frames up to frame_high, or until there are
  131.          frames in the stack.  */
  132.       for (;
  133.            fi && (i <= frame_high || frame_high == -1);
  134.            i++, fi = get_prev_frame (fi))
  135.         {
  136.           QUIT;
  137.           /* Print the location and the address always, even for level 0.
  138.              If args is 0, don't print the arguments.  */
  139.           print_frame_info (fi, 1, LOC_AND_ADDRESS, 0 /* args */, 0);
  140.         }
  141.     }

  142.   do_cleanups (cleanup_stack);
  143. }

  144. void
  145. mi_cmd_stack_info_depth (char *command, char **argv, int argc)
  146. {
  147.   int frame_high;
  148.   int i;
  149.   struct frame_info *fi;

  150.   if (argc > 1)
  151.     error (_("-stack-info-depth: Usage: [MAX_DEPTH]"));

  152.   if (argc == 1)
  153.     frame_high = atoi (argv[0]);
  154.   else
  155.     /* Called with no arguments, it means we want the real depth of
  156.        the stack.  */
  157.     frame_high = -1;

  158.   for (i = 0, fi = get_current_frame ();
  159.        fi && (i < frame_high || frame_high == -1);
  160.        i++, fi = get_prev_frame (fi))
  161.     QUIT;

  162.   ui_out_field_int (current_uiout, "depth", i);
  163. }

  164. /* Print a list of the locals for the current frame.  With argument of
  165.    0, print only the names, with argument of 1 print also the
  166.    values.  */

  167. void
  168. mi_cmd_stack_list_locals (char *command, char **argv, int argc)
  169. {
  170.   struct frame_info *frame;
  171.   int raw_arg = 0;
  172.   enum ext_lang_bt_status result = EXT_LANG_BT_ERROR;
  173.   int print_value;
  174.   int oind = 0;
  175.   int skip_unavailable = 0;
  176.   int i;

  177.   if (argc > 1)
  178.     {
  179.       int i;
  180.       enum opt
  181.       {
  182.         NO_FRAME_FILTERS,
  183.         SKIP_UNAVAILABLE,
  184.       };
  185.       static const struct mi_opt opts[] =
  186.         {
  187.           {"-no-frame-filters", NO_FRAME_FILTERS, 0},
  188.           {"-skip-unavailable", SKIP_UNAVAILABLE, 0},
  189.           { 0, 0, 0 }
  190.         };

  191.       while (1)
  192.         {
  193.           char *oarg;
  194.           /* Don't parse 'print-values' as an option.  */
  195.           int opt = mi_getopt ("-stack-list-locals", argc - 1, argv,
  196.                                opts, &oind, &oarg);

  197.           if (opt < 0)
  198.             break;
  199.           switch ((enum opt) opt)
  200.             {
  201.             case NO_FRAME_FILTERS:
  202.               raw_arg = oind;
  203.             case SKIP_UNAVAILABLE:
  204.               skip_unavailable = 1;
  205.               break;
  206.             }
  207.         }
  208.     }

  209.   /* After the last option is parsed, there should be only
  210.      'print-values'.  */
  211.   if (argc - oind != 1)
  212.     error (_("-stack-list-locals: Usage: [--no-frame-filters] "
  213.              "[--skip-unavailable] PRINT_VALUES"));

  214.   frame = get_selected_frame (NULL);
  215.   print_value = mi_parse_print_values (argv[oind]);

  216.    if (! raw_arg && frame_filters)
  217.      {
  218.        int flags = PRINT_LEVEL | PRINT_LOCALS;

  219.        result = apply_ext_lang_frame_filter (frame, flags, print_value,
  220.                                              current_uiout, 0, 0);
  221.      }

  222.    /* Run the inbuilt backtrace if there are no filters registered, or
  223.       if "--no-frame-filters" has been specified from the command.  */
  224.    if (! frame_filters || raw_arg  || result == EXT_LANG_BT_NO_FILTERS)
  225.      {
  226.        list_args_or_locals (locals, print_value, frame,
  227.                             skip_unavailable);
  228.      }
  229. }

  230. /* Print a list of the arguments for the current frame.  With argument
  231.    of 0, print only the names, with argument of 1 print also the
  232.    values.  */

  233. void
  234. mi_cmd_stack_list_args (char *command, char **argv, int argc)
  235. {
  236.   int frame_low;
  237.   int frame_high;
  238.   int i;
  239.   struct frame_info *fi;
  240.   struct cleanup *cleanup_stack_args;
  241.   enum print_values print_values;
  242.   struct ui_out *uiout = current_uiout;
  243.   int raw_arg = 0;
  244.   int oind = 0;
  245.   int skip_unavailable = 0;
  246.   enum ext_lang_bt_status result = EXT_LANG_BT_ERROR;
  247.   enum opt
  248.   {
  249.     NO_FRAME_FILTERS,
  250.     SKIP_UNAVAILABLE,
  251.   };
  252.   static const struct mi_opt opts[] =
  253.     {
  254.       {"-no-frame-filters", NO_FRAME_FILTERS, 0},
  255.       {"-skip-unavailable", SKIP_UNAVAILABLE, 0},
  256.       { 0, 0, 0 }
  257.     };

  258.   while (1)
  259.     {
  260.       char *oarg;
  261.       int opt = mi_getopt_allow_unknown ("-stack-list-args", argc, argv,
  262.                                          opts, &oind, &oarg);

  263.       if (opt < 0)
  264.         break;
  265.       switch ((enum opt) opt)
  266.         {
  267.         case NO_FRAME_FILTERS:
  268.           raw_arg = oind;
  269.           break;
  270.         case SKIP_UNAVAILABLE:
  271.           skip_unavailable = 1;
  272.           break;
  273.         }
  274.     }

  275.   if (argc - oind != 1 && argc - oind != 3)
  276.     error (_("-stack-list-arguments: Usage: "        \
  277.              "[--no-frame-filters] [--skip-unavailable] "
  278.              "PRINT_VALUES [FRAME_LOW FRAME_HIGH]"));

  279.   if (argc - oind == 3)
  280.     {
  281.       frame_low = atoi (argv[1 + oind]);
  282.       frame_high = atoi (argv[2 + oind]);
  283.     }
  284.   else
  285.     {
  286.       /* Called with no arguments, it means we want args for the whole
  287.          backtrace.  */
  288.       frame_low = -1;
  289.       frame_high = -1;
  290.     }

  291.   print_values = mi_parse_print_values (argv[oind]);

  292.   /* Let's position fi on the frame at which to start the
  293.      display. Could be the innermost frame if the whole stack needs
  294.      displaying, or if frame_low is 0.  */
  295.   for (i = 0, fi = get_current_frame ();
  296.        fi && i < frame_low;
  297.        i++, fi = get_prev_frame (fi));

  298.   if (fi == NULL)
  299.     error (_("-stack-list-arguments: Not enough frames in stack."));

  300.   cleanup_stack_args
  301.     = make_cleanup_ui_out_list_begin_end (uiout, "stack-args");

  302.   if (! raw_arg && frame_filters)
  303.     {
  304.       int flags = PRINT_LEVEL | PRINT_ARGS;
  305.       int py_frame_low = frame_low;

  306.       /* We cannot pass -1 to frame_low, as that would signify a
  307.       relative backtrace from the tail of the stack.  So, in the case
  308.       of frame_low == -1, assign and increment it.  */
  309.       if (py_frame_low == -1)
  310.         py_frame_low++;

  311.       result = apply_ext_lang_frame_filter (get_current_frame (), flags,
  312.                                             print_values, current_uiout,
  313.                                             py_frame_low, frame_high);
  314.     }

  315.      /* Run the inbuilt backtrace if there are no filters registered, or
  316.       if "--no-frame-filters" has been specified from the command.  */
  317.    if (! frame_filters || raw_arg  || result == EXT_LANG_BT_NO_FILTERS)
  318.      {
  319.       /* Now let's print the frames up to frame_high, or until there are
  320.          frames in the stack.  */
  321.       for (;
  322.            fi && (i <= frame_high || frame_high == -1);
  323.            i++, fi = get_prev_frame (fi))
  324.         {
  325.           struct cleanup *cleanup_frame;

  326.           QUIT;
  327.           cleanup_frame = make_cleanup_ui_out_tuple_begin_end (uiout, "frame");
  328.           ui_out_field_int (uiout, "level", i);
  329.           list_args_or_locals (arguments, print_values, fi, skip_unavailable);
  330.           do_cleanups (cleanup_frame);
  331.         }
  332.     }
  333.   do_cleanups (cleanup_stack_args);
  334. }

  335. /* Print a list of the local variables (including arguments) for the
  336.    current frame.  ARGC must be 1 and ARGV[0] specify if only the names,
  337.    or both names and values of the variables must be printed.  See
  338.    parse_print_value for possible values.  */

  339. void
  340. mi_cmd_stack_list_variables (char *command, char **argv, int argc)
  341. {
  342.   struct frame_info *frame;
  343.   int raw_arg = 0;
  344.   enum ext_lang_bt_status result = EXT_LANG_BT_ERROR;
  345.   int print_value;
  346.   int oind = 0;
  347.   int skip_unavailable = 0;

  348.   if (argc > 1)
  349.     {
  350.       int i;
  351.       enum opt
  352.       {
  353.         NO_FRAME_FILTERS,
  354.         SKIP_UNAVAILABLE,
  355.       };
  356.       static const struct mi_opt opts[] =
  357.         {
  358.           {"-no-frame-filters", NO_FRAME_FILTERS, 0},
  359.           {"-skip-unavailable", SKIP_UNAVAILABLE, 0},
  360.           { 0, 0, 0 }
  361.         };

  362.       while (1)
  363.         {
  364.           char *oarg;
  365.           /* Don't parse 'print-values' as an option.  */
  366.           int opt = mi_getopt ("-stack-list-variables", argc - 1,
  367.                                argv, opts, &oind, &oarg);
  368.           if (opt < 0)
  369.             break;
  370.           switch ((enum opt) opt)
  371.             {
  372.             case NO_FRAME_FILTERS:
  373.               raw_arg = oind;
  374.               break;
  375.             case SKIP_UNAVAILABLE:
  376.               skip_unavailable = 1;
  377.               break;
  378.             }
  379.         }
  380.     }

  381.   /* After the last option is parsed, there should be only
  382.      'print-values'.  */
  383.   if (argc - oind != 1)
  384.     error (_("-stack-list-variables: Usage: [--no-frame-filters] " \
  385.              "[--skip-unavailable] PRINT_VALUES"));

  386.    frame = get_selected_frame (NULL);
  387.    print_value = mi_parse_print_values (argv[oind]);

  388.    if (! raw_arg && frame_filters)
  389.      {
  390.        int flags = PRINT_LEVEL | PRINT_ARGS | PRINT_LOCALS;

  391.        result = apply_ext_lang_frame_filter (frame, flags, print_value,
  392.                                              current_uiout, 0, 0);
  393.      }

  394.    /* Run the inbuilt backtrace if there are no filters registered, or
  395.       if "--no-frame-filters" has been specified from the command.  */
  396.    if (! frame_filters || raw_arg  || result == EXT_LANG_BT_NO_FILTERS)
  397.      {
  398.        list_args_or_locals (all, print_value, frame,
  399.                             skip_unavailable);
  400.      }
  401. }

  402. /* Print single local or argument.  ARG must be already read in.  For
  403.    WHAT and VALUES see list_args_or_locals.

  404.    Errors are printed as if they would be the parameter value.  Use
  405.    zeroed ARG iff it should not be printed according to VALUES.  If
  406.    SKIP_UNAVAILABLE is true, only print ARG if it is available.  */

  407. static void
  408. list_arg_or_local (const struct frame_arg *arg, enum what_to_list what,
  409.                    enum print_values values, int skip_unavailable)
  410. {
  411.   struct cleanup *old_chain;
  412.   struct ui_out *uiout = current_uiout;
  413.   struct ui_file *stb;

  414.   gdb_assert (!arg->val || !arg->error);
  415.   gdb_assert ((values == PRINT_NO_VALUES && arg->val == NULL
  416.                && arg->error == NULL)
  417.               || values == PRINT_SIMPLE_VALUES
  418.               || (values == PRINT_ALL_VALUES
  419.                   && (arg->val != NULL || arg->error != NULL)));
  420.   gdb_assert (arg->entry_kind == print_entry_values_no
  421.               || (arg->entry_kind == print_entry_values_only
  422.                   && (arg->val || arg->error)));

  423.   if (skip_unavailable && arg->val != NULL
  424.       && (value_entirely_unavailable (arg->val)
  425.           /* A scalar object that does not have all bits available is
  426.              also considered unavailable, because all bits contribute
  427.              to its representation.  */
  428.           || (val_print_scalar_type_p (value_type (arg->val))
  429.               && !value_bytes_available (arg->val,
  430.                                          value_embedded_offset (arg->val),
  431.                                          TYPE_LENGTH (value_type (arg->val))))))
  432.     return;

  433.   stb = mem_fileopen ();
  434.   old_chain = make_cleanup_ui_file_delete (stb);

  435.   if (values != PRINT_NO_VALUES || what == all)
  436.     make_cleanup_ui_out_tuple_begin_end (uiout, NULL);

  437.   fputs_filtered (SYMBOL_PRINT_NAME (arg->sym), stb);
  438.   if (arg->entry_kind == print_entry_values_only)
  439.     fputs_filtered ("@entry", stb);
  440.   ui_out_field_stream (uiout, "name", stb);

  441.   if (what == all && SYMBOL_IS_ARGUMENT (arg->sym))
  442.     ui_out_field_int (uiout, "arg", 1);

  443.   if (values == PRINT_SIMPLE_VALUES)
  444.     {
  445.       check_typedef (arg->sym->type);
  446.       type_print (arg->sym->type, "", stb, -1);
  447.       ui_out_field_stream (uiout, "type", stb);
  448.     }

  449.   if (arg->val || arg->error)
  450.     {
  451.       volatile struct gdb_exception except;

  452.       if (arg->error)
  453.         except.message = arg->error;
  454.       else
  455.         {
  456.           /* TRY_CATCH has two statements, wrap it in a block.  */

  457.           TRY_CATCH (except, RETURN_MASK_ERROR)
  458.             {
  459.               struct value_print_options opts;

  460.               get_no_prettyformat_print_options (&opts);
  461.               opts.deref_ref = 1;
  462.               common_val_print (arg->val, stb, 0, &opts,
  463.                                 language_def (SYMBOL_LANGUAGE (arg->sym)));
  464.             }
  465.         }
  466.       if (except.message)
  467.         fprintf_filtered (stb, _("<error reading variable: %s>"),
  468.                           except.message);
  469.       ui_out_field_stream (uiout, "value", stb);
  470.     }

  471.   do_cleanups (old_chain);
  472. }

  473. /* Print a list of the objects for the frame FI in a certain form,
  474.    which is determined by VALUES.  The objects can be locals,
  475.    arguments or both, which is determined by WHAT.  If SKIP_UNAVAILABLE
  476.    is true, only print the arguments or local variables whose values
  477.    are available.  */

  478. static void
  479. list_args_or_locals (enum what_to_list what, enum print_values values,
  480.                      struct frame_info *fi, int skip_unavailable)
  481. {
  482.   const struct block *block;
  483.   struct symbol *sym;
  484.   struct block_iterator iter;
  485.   struct cleanup *cleanup_list;
  486.   struct type *type;
  487.   char *name_of_result;
  488.   struct ui_out *uiout = current_uiout;

  489.   block = get_frame_block (fi, 0);

  490.   switch (what)
  491.     {
  492.     case locals:
  493.       name_of_result = "locals";
  494.       break;
  495.     case arguments:
  496.       name_of_result = "args";
  497.       break;
  498.     case all:
  499.       name_of_result = "variables";
  500.       break;
  501.     default:
  502.       internal_error (__FILE__, __LINE__,
  503.                       "unexpected what_to_list: %d", (int) what);
  504.     }

  505.   cleanup_list = make_cleanup_ui_out_list_begin_end (uiout, name_of_result);

  506.   while (block != 0)
  507.     {
  508.       ALL_BLOCK_SYMBOLS (block, iter, sym)
  509.         {
  510.           int print_me = 0;

  511.           switch (SYMBOL_CLASS (sym))
  512.             {
  513.             default:
  514.             case LOC_UNDEF:        /* catches errors        */
  515.             case LOC_CONST:        /* constant              */
  516.             case LOC_TYPEDEF:        /* local typedef         */
  517.             case LOC_LABEL:        /* local label           */
  518.             case LOC_BLOCK:        /* local function        */
  519.             case LOC_CONST_BYTES:        /* loc. byte seq.        */
  520.             case LOC_UNRESOLVED:        /* unresolved static     */
  521.             case LOC_OPTIMIZED_OUT:        /* optimized out         */
  522.               print_me = 0;
  523.               break;

  524.             case LOC_ARG:        /* argument              */
  525.             case LOC_REF_ARG:        /* reference arg         */
  526.             case LOC_REGPARM_ADDR:        /* indirect register arg */
  527.             case LOC_LOCAL:        /* stack local           */
  528.             case LOC_STATIC:        /* static                */
  529.             case LOC_REGISTER:        /* register              */
  530.             case LOC_COMPUTED:        /* computed location     */
  531.               if (what == all)
  532.                 print_me = 1;
  533.               else if (what == locals)
  534.                 print_me = !SYMBOL_IS_ARGUMENT (sym);
  535.               else
  536.                 print_me = SYMBOL_IS_ARGUMENT (sym);
  537.               break;
  538.             }
  539.           if (print_me)
  540.             {
  541.               struct symbol *sym2;
  542.               struct frame_arg arg, entryarg;

  543.               if (SYMBOL_IS_ARGUMENT (sym))
  544.                 sym2 = lookup_symbol (SYMBOL_LINKAGE_NAME (sym),
  545.                                       block, VAR_DOMAIN,
  546.                                       NULL);
  547.               else
  548.                 sym2 = sym;
  549.               gdb_assert (sym2 != NULL);

  550.               memset (&arg, 0, sizeof (arg));
  551.               arg.sym = sym2;
  552.               arg.entry_kind = print_entry_values_no;
  553.               memset (&entryarg, 0, sizeof (entryarg));
  554.               entryarg.sym = sym2;
  555.               entryarg.entry_kind = print_entry_values_no;

  556.               switch (values)
  557.                 {
  558.                 case PRINT_SIMPLE_VALUES:
  559.                   type = check_typedef (sym2->type);
  560.                   if (TYPE_CODE (type) != TYPE_CODE_ARRAY
  561.                       && TYPE_CODE (type) != TYPE_CODE_STRUCT
  562.                       && TYPE_CODE (type) != TYPE_CODE_UNION)
  563.                     {
  564.                 case PRINT_ALL_VALUES:
  565.                   if (SYMBOL_IS_ARGUMENT (sym))
  566.                     read_frame_arg (sym2, fi, &arg, &entryarg);
  567.                   else
  568.                     read_frame_local (sym2, fi, &arg);
  569.                     }
  570.                   break;
  571.                 }

  572.               if (arg.entry_kind != print_entry_values_only)
  573.                 list_arg_or_local (&arg, what, values, skip_unavailable);
  574.               if (entryarg.entry_kind != print_entry_values_no)
  575.                 list_arg_or_local (&entryarg, what, values, skip_unavailable);
  576.               xfree (arg.error);
  577.               xfree (entryarg.error);
  578.             }
  579.         }

  580.       if (BLOCK_FUNCTION (block))
  581.         break;
  582.       else
  583.         block = BLOCK_SUPERBLOCK (block);
  584.     }
  585.   do_cleanups (cleanup_list);
  586. }

  587. void
  588. mi_cmd_stack_select_frame (char *command, char **argv, int argc)
  589. {
  590.   if (argc == 0 || argc > 1)
  591.     error (_("-stack-select-frame: Usage: FRAME_SPEC"));

  592.   select_frame_command (argv[0], 1 /* not used */ );
  593. }

  594. void
  595. mi_cmd_stack_info_frame (char *command, char **argv, int argc)
  596. {
  597.   if (argc > 0)
  598.     error (_("-stack-info-frame: No arguments allowed"));

  599.   print_frame_info (get_selected_frame (NULL), 1, LOC_AND_ADDRESS, 0, 1);
  600. }