GDB (API)
/home/stan/gdb/src/gdb/stack.c
Go to the documentation of this file.
00001 /* Print and select stack frames for GDB, the GNU debugger.
00002 
00003    Copyright (C) 1986-2013 Free Software Foundation, Inc.
00004 
00005    This file is part of GDB.
00006 
00007    This program is free software; you can redistribute it and/or modify
00008    it under the terms of the GNU General Public License as published by
00009    the Free Software Foundation; either version 3 of the License, or
00010    (at your option) any later version.
00011 
00012    This program is distributed in the hope that it will be useful,
00013    but WITHOUT ANY WARRANTY; without even the implied warranty of
00014    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015    GNU General Public License for more details.
00016 
00017    You should have received a copy of the GNU General Public License
00018    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
00019 
00020 #include "defs.h"
00021 #include "value.h"
00022 #include "symtab.h"
00023 #include "gdbtypes.h"
00024 #include "expression.h"
00025 #include "language.h"
00026 #include "frame.h"
00027 #include "gdbcmd.h"
00028 #include "gdbcore.h"
00029 #include "target.h"
00030 #include "source.h"
00031 #include "breakpoint.h"
00032 #include "demangle.h"
00033 #include "inferior.h"
00034 #include "annotate.h"
00035 #include "ui-out.h"
00036 #include "block.h"
00037 #include "stack.h"
00038 #include "dictionary.h"
00039 #include "exceptions.h"
00040 #include "reggroups.h"
00041 #include "regcache.h"
00042 #include "solib.h"
00043 #include "valprint.h"
00044 #include "gdbthread.h"
00045 #include "cp-support.h"
00046 #include "disasm.h"
00047 #include "inline-frame.h"
00048 #include "linespec.h"
00049 #include "cli/cli-utils.h"
00050 
00051 #include "gdb_assert.h"
00052 #include <ctype.h>
00053 #include "gdb_string.h"
00054 
00055 #include "symfile.h"
00056 #include "python/python.h"
00057 
00058 void (*deprecated_selected_frame_level_changed_hook) (int);
00059 
00060 /* The possible choices of "set print frame-arguments", and the value
00061    of this setting.  */
00062 
00063 static const char *const print_frame_arguments_choices[] =
00064   {"all", "scalars", "none", NULL};
00065 static const char *print_frame_arguments = "scalars";
00066 
00067 /* If non-zero, don't invoke pretty-printers for frame arguments.  */
00068 static int print_raw_frame_arguments;
00069 
00070 /* The possible choices of "set print entry-values", and the value
00071    of this setting.  */
00072 
00073 const char print_entry_values_no[] = "no";
00074 const char print_entry_values_only[] = "only";
00075 const char print_entry_values_preferred[] = "preferred";
00076 const char print_entry_values_if_needed[] = "if-needed";
00077 const char print_entry_values_both[] = "both";
00078 const char print_entry_values_compact[] = "compact";
00079 const char print_entry_values_default[] = "default";
00080 static const char *const print_entry_values_choices[] =
00081 {
00082   print_entry_values_no,
00083   print_entry_values_only,
00084   print_entry_values_preferred,
00085   print_entry_values_if_needed,
00086   print_entry_values_both,
00087   print_entry_values_compact,
00088   print_entry_values_default,
00089   NULL
00090 };
00091 const char *print_entry_values = print_entry_values_default;
00092 
00093 /* Prototypes for local functions.  */
00094 
00095 static void print_frame_local_vars (struct frame_info *, int,
00096                                     struct ui_file *);
00097 
00098 static void print_frame (struct frame_info *frame, int print_level,
00099                          enum print_what print_what,  int print_args,
00100                          struct symtab_and_line sal);
00101 
00102 static void set_last_displayed_sal (int valid,
00103                                     struct program_space *pspace,
00104                                     CORE_ADDR addr,
00105                                     struct symtab *symtab,
00106                                     int line);
00107 
00108 /* Zero means do things normally; we are interacting directly with the
00109    user.  One means print the full filename and linenumber when a
00110    frame is printed, and do so in a format emacs18/emacs19.22 can
00111    parse.  Two means print similar annotations, but in many more
00112    cases and in a slightly different syntax.  */
00113 
00114 int annotation_level = 0;
00115 
00116 /* These variables hold the last symtab and line we displayed to the user.
00117  * This is where we insert a breakpoint or a skiplist entry by default.  */
00118 static int last_displayed_sal_valid = 0;
00119 static struct program_space *last_displayed_pspace = 0;
00120 static CORE_ADDR last_displayed_addr = 0;
00121 static struct symtab *last_displayed_symtab = 0;
00122 static int last_displayed_line = 0;
00123 
00124 
00125 /* Return 1 if we should display the address in addition to the location,
00126    because we are in the middle of a statement.  */
00127 
00128 static int
00129 frame_show_address (struct frame_info *frame,
00130                     struct symtab_and_line sal)
00131 {
00132   /* If there is a line number, but no PC, then there is no location
00133      information associated with this sal.  The only way that should
00134      happen is for the call sites of inlined functions (SAL comes from
00135      find_frame_sal).  Otherwise, we would have some PC range if the
00136      SAL came from a line table.  */
00137   if (sal.line != 0 && sal.pc == 0 && sal.end == 0)
00138     {
00139       if (get_next_frame (frame) == NULL)
00140         gdb_assert (inline_skipped_frames (inferior_ptid) > 0);
00141       else
00142         gdb_assert (get_frame_type (get_next_frame (frame)) == INLINE_FRAME);
00143       return 0;
00144     }
00145 
00146   return get_frame_pc (frame) != sal.pc;
00147 }
00148 
00149 /* Show or print a stack frame FRAME briefly.  The output is format
00150    according to PRINT_LEVEL and PRINT_WHAT printing the frame's
00151    relative level, function name, argument list, and file name and
00152    line number.  If the frame's PC is not at the beginning of the
00153    source line, the actual PC is printed at the beginning.  */
00154 
00155 void
00156 print_stack_frame (struct frame_info *frame, int print_level,
00157                    enum print_what print_what,
00158                    int set_current_sal)
00159 {
00160   volatile struct gdb_exception e;
00161 
00162   /* For mi, alway print location and address.  */
00163   if (ui_out_is_mi_like_p (current_uiout))
00164     print_what = LOC_AND_ADDRESS;
00165 
00166   TRY_CATCH (e, RETURN_MASK_ERROR)
00167     {
00168       int center = (print_what == SRC_LINE || print_what == SRC_AND_LOC);
00169 
00170       print_frame_info (frame, print_level, print_what, 1 /* print_args */,
00171                         set_current_sal);
00172       if (set_current_sal)
00173         set_current_sal_from_frame (frame, center);
00174     }
00175 }
00176 
00177 /* Print nameless arguments of frame FRAME on STREAM, where START is
00178    the offset of the first nameless argument, and NUM is the number of
00179    nameless arguments to print.  FIRST is nonzero if this is the first
00180    argument (not just the first nameless argument).  */
00181 
00182 static void
00183 print_frame_nameless_args (struct frame_info *frame, long start, int num,
00184                            int first, struct ui_file *stream)
00185 {
00186   struct gdbarch *gdbarch = get_frame_arch (frame);
00187   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
00188   int i;
00189   CORE_ADDR argsaddr;
00190   long arg_value;
00191 
00192   for (i = 0; i < num; i++)
00193     {
00194       QUIT;
00195       argsaddr = get_frame_args_address (frame);
00196       if (!argsaddr)
00197         return;
00198       arg_value = read_memory_integer (argsaddr + start,
00199                                        sizeof (int), byte_order);
00200       if (!first)
00201         fprintf_filtered (stream, ", ");
00202       fprintf_filtered (stream, "%ld", arg_value);
00203       first = 0;
00204       start += sizeof (int);
00205     }
00206 }
00207 
00208 /* Print single argument of inferior function.  ARG must be already
00209    read in.
00210 
00211    Errors are printed as if they would be the parameter value.  Use zeroed ARG
00212    iff it should not be printed accoring to user settings.  */
00213 
00214 static void
00215 print_frame_arg (const struct frame_arg *arg)
00216 {
00217   struct ui_out *uiout = current_uiout;
00218   volatile struct gdb_exception except;
00219   struct cleanup *old_chain;
00220   struct ui_file *stb;
00221 
00222   stb = mem_fileopen ();
00223   old_chain = make_cleanup_ui_file_delete (stb);
00224 
00225   gdb_assert (!arg->val || !arg->error);
00226   gdb_assert (arg->entry_kind == print_entry_values_no
00227               || arg->entry_kind == print_entry_values_only
00228               || (!ui_out_is_mi_like_p (uiout)
00229                   && arg->entry_kind == print_entry_values_compact));
00230 
00231   annotate_arg_begin ();
00232 
00233   make_cleanup_ui_out_tuple_begin_end (uiout, NULL);
00234   fprintf_symbol_filtered (stb, SYMBOL_PRINT_NAME (arg->sym),
00235                            SYMBOL_LANGUAGE (arg->sym), DMGL_PARAMS | DMGL_ANSI);
00236   if (arg->entry_kind == print_entry_values_compact)
00237     {
00238       /* It is OK to provide invalid MI-like stream as with
00239          PRINT_ENTRY_VALUE_COMPACT we never use MI.  */
00240       fputs_filtered ("=", stb);
00241 
00242       fprintf_symbol_filtered (stb, SYMBOL_PRINT_NAME (arg->sym),
00243                                SYMBOL_LANGUAGE (arg->sym),
00244                                DMGL_PARAMS | DMGL_ANSI);
00245     }
00246   if (arg->entry_kind == print_entry_values_only
00247       || arg->entry_kind == print_entry_values_compact)
00248     fputs_filtered ("@entry", stb);
00249   ui_out_field_stream (uiout, "name", stb);
00250   annotate_arg_name_end ();
00251   ui_out_text (uiout, "=");
00252 
00253   if (!arg->val && !arg->error)
00254     ui_out_text (uiout, "...");
00255   else
00256     {
00257       if (arg->error)
00258         except.message = arg->error;
00259       else
00260         {
00261           /* TRY_CATCH has two statements, wrap it in a block.  */
00262 
00263           TRY_CATCH (except, RETURN_MASK_ERROR)
00264             {
00265               const struct language_defn *language;
00266               struct value_print_options opts;
00267 
00268               /* Avoid value_print because it will deref ref parameters.  We
00269                  just want to print their addresses.  Print ??? for args whose
00270                  address we do not know.  We pass 2 as "recurse" to val_print
00271                  because our standard indentation here is 4 spaces, and
00272                  val_print indents 2 for each recurse.  */ 
00273 
00274               annotate_arg_value (value_type (arg->val));
00275 
00276               /* Use the appropriate language to display our symbol, unless the
00277                  user forced the language to a specific language.  */
00278               if (language_mode == language_mode_auto)
00279                 language = language_def (SYMBOL_LANGUAGE (arg->sym));
00280               else
00281                 language = current_language;
00282 
00283               get_no_prettyformat_print_options (&opts);
00284               opts.deref_ref = 1;
00285               opts.raw = print_raw_frame_arguments;
00286 
00287               /* True in "summary" mode, false otherwise.  */
00288               opts.summary = !strcmp (print_frame_arguments, "scalars");
00289 
00290               common_val_print (arg->val, stb, 2, &opts, language);
00291             }
00292         }
00293       if (except.message)
00294         fprintf_filtered (stb, _("<error reading variable: %s>"),
00295                           except.message);
00296     }
00297 
00298   ui_out_field_stream (uiout, "value", stb);
00299 
00300   /* Also invoke ui_out_tuple_end.  */
00301   do_cleanups (old_chain);
00302 
00303   annotate_arg_end ();
00304 }
00305 
00306 /* Read in inferior function local SYM at FRAME into ARGP.  Caller is
00307    responsible for xfree of ARGP->ERROR.  This function never throws an
00308    exception.  */
00309 
00310 void
00311 read_frame_local (struct symbol *sym, struct frame_info *frame,
00312                   struct frame_arg *argp)
00313 {
00314   volatile struct gdb_exception except;
00315   struct value *val = NULL;
00316 
00317   TRY_CATCH (except, RETURN_MASK_ERROR)
00318     {
00319       val = read_var_value (sym, frame);
00320     }
00321 
00322   argp->error = (val == NULL) ? xstrdup (except.message) : NULL;
00323   argp->sym = sym;
00324   argp->val = val;
00325 }
00326 
00327 /* Read in inferior function parameter SYM at FRAME into ARGP.  Caller is
00328    responsible for xfree of ARGP->ERROR.  This function never throws an
00329    exception.  */
00330 
00331 void
00332 read_frame_arg (struct symbol *sym, struct frame_info *frame,
00333                 struct frame_arg *argp, struct frame_arg *entryargp)
00334 {
00335   struct value *val = NULL, *entryval = NULL;
00336   char *val_error = NULL, *entryval_error = NULL;
00337   int val_equal = 0;
00338   volatile struct gdb_exception except;
00339 
00340   if (print_entry_values != print_entry_values_only
00341       && print_entry_values != print_entry_values_preferred)
00342     {
00343       TRY_CATCH (except, RETURN_MASK_ERROR)
00344         {
00345           val = read_var_value (sym, frame);
00346         }
00347       if (!val)
00348         {
00349           val_error = alloca (strlen (except.message) + 1);
00350           strcpy (val_error, except.message);
00351         }
00352     }
00353 
00354   if (SYMBOL_COMPUTED_OPS (sym) != NULL
00355       && SYMBOL_COMPUTED_OPS (sym)->read_variable_at_entry != NULL
00356       && print_entry_values != print_entry_values_no
00357       && (print_entry_values != print_entry_values_if_needed
00358           || !val || value_optimized_out (val)))
00359     {
00360       TRY_CATCH (except, RETURN_MASK_ERROR)
00361         {
00362           const struct symbol_computed_ops *ops;
00363 
00364           ops = SYMBOL_COMPUTED_OPS (sym);
00365           entryval = ops->read_variable_at_entry (sym, frame);
00366         }
00367       if (!entryval)
00368         {
00369           entryval_error = alloca (strlen (except.message) + 1);
00370           strcpy (entryval_error, except.message);
00371         }
00372 
00373       if (except.error == NO_ENTRY_VALUE_ERROR
00374           || (entryval && value_optimized_out (entryval)))
00375         {
00376           entryval = NULL;
00377           entryval_error = NULL;
00378         }
00379 
00380       if (print_entry_values == print_entry_values_compact
00381           || print_entry_values == print_entry_values_default)
00382         {
00383           /* For MI do not try to use print_entry_values_compact for ARGP.  */
00384 
00385           if (val && entryval && !ui_out_is_mi_like_p (current_uiout))
00386             {
00387               struct type *type = value_type (val);
00388 
00389               if (!value_optimized_out (val)
00390                   && value_available_contents_eq (val, 0, entryval, 0,
00391                                                   TYPE_LENGTH (type)))
00392                 {
00393                   /* Initialize it just to avoid a GCC false warning.  */
00394                   struct value *val_deref = NULL, *entryval_deref;
00395 
00396                   /* DW_AT_GNU_call_site_value does match with the current
00397                      value.  If it is a reference still try to verify if
00398                      dereferenced DW_AT_GNU_call_site_data_value does not
00399                      differ.  */
00400 
00401                   TRY_CATCH (except, RETURN_MASK_ERROR)
00402                     {
00403                       struct type *type_deref;
00404 
00405                       val_deref = coerce_ref (val);
00406                       if (value_lazy (val_deref))
00407                         value_fetch_lazy (val_deref);
00408                       type_deref = value_type (val_deref);
00409 
00410                       entryval_deref = coerce_ref (entryval);
00411                       if (value_lazy (entryval_deref))
00412                         value_fetch_lazy (entryval_deref);
00413 
00414                       /* If the reference addresses match but dereferenced
00415                          content does not match print them.  */
00416                       if (val != val_deref
00417                           && value_available_contents_eq (val_deref, 0,
00418                                                           entryval_deref, 0,
00419                                                       TYPE_LENGTH (type_deref)))
00420                         val_equal = 1;
00421                     }
00422 
00423                   /* Value was not a reference; and its content matches.  */
00424                   if (val == val_deref)
00425                     val_equal = 1;
00426                   /* If the dereferenced content could not be fetched do not
00427                      display anything.  */
00428                   else if (except.error == NO_ENTRY_VALUE_ERROR)
00429                     val_equal = 1;
00430                   else if (except.message)
00431                     {
00432                       entryval_error = alloca (strlen (except.message) + 1);
00433                       strcpy (entryval_error, except.message);
00434                     }
00435 
00436                   if (val_equal)
00437                     entryval = NULL;
00438                 }
00439             }
00440 
00441           /* Try to remove possibly duplicate error message for ENTRYARGP even
00442              in MI mode.  */
00443 
00444           if (val_error && entryval_error
00445               && strcmp (val_error, entryval_error) == 0)
00446             {
00447               entryval_error = NULL;
00448 
00449               /* Do not se VAL_EQUAL as the same error message may be shown for
00450                  the entry value even if no entry values are present in the
00451                  inferior.  */
00452             }
00453         }
00454     }
00455 
00456   if (entryval == NULL)
00457     {
00458       if (print_entry_values == print_entry_values_preferred)
00459         {
00460           TRY_CATCH (except, RETURN_MASK_ERROR)
00461             {
00462               val = read_var_value (sym, frame);
00463             }
00464           if (!val)
00465             {
00466               val_error = alloca (strlen (except.message) + 1);
00467               strcpy (val_error, except.message);
00468             }
00469         }
00470       if (print_entry_values == print_entry_values_only
00471           || print_entry_values == print_entry_values_both
00472           || (print_entry_values == print_entry_values_preferred
00473               && (!val || value_optimized_out (val))))
00474         {
00475           entryval = allocate_optimized_out_value (SYMBOL_TYPE (sym));
00476           entryval_error = NULL;
00477         }
00478     }
00479   if ((print_entry_values == print_entry_values_compact
00480        || print_entry_values == print_entry_values_if_needed
00481        || print_entry_values == print_entry_values_preferred)
00482       && (!val || value_optimized_out (val)) && entryval != NULL)
00483     {
00484       val = NULL;
00485       val_error = NULL;
00486     }
00487 
00488   argp->sym = sym;
00489   argp->val = val;
00490   argp->error = val_error ? xstrdup (val_error) : NULL;
00491   if (!val && !val_error)
00492     argp->entry_kind = print_entry_values_only;
00493   else if ((print_entry_values == print_entry_values_compact
00494            || print_entry_values == print_entry_values_default) && val_equal)
00495     {
00496       argp->entry_kind = print_entry_values_compact;
00497       gdb_assert (!ui_out_is_mi_like_p (current_uiout));
00498     }
00499   else
00500     argp->entry_kind = print_entry_values_no;
00501 
00502   entryargp->sym = sym;
00503   entryargp->val = entryval;
00504   entryargp->error = entryval_error ? xstrdup (entryval_error) : NULL;
00505   if (!entryval && !entryval_error)
00506     entryargp->entry_kind = print_entry_values_no;
00507   else
00508     entryargp->entry_kind = print_entry_values_only;
00509 }
00510 
00511 /* Print the arguments of frame FRAME on STREAM, given the function
00512    FUNC running in that frame (as a symbol), where NUM is the number
00513    of arguments according to the stack frame (or -1 if the number of
00514    arguments is unknown).  */
00515 
00516 /* Note that currently the "number of arguments according to the
00517    stack frame" is only known on VAX where i refers to the "number of
00518    ints of arguments according to the stack frame".  */
00519 
00520 static void
00521 print_frame_args (struct symbol *func, struct frame_info *frame,
00522                   int num, struct ui_file *stream)
00523 {
00524   struct ui_out *uiout = current_uiout;
00525   int first = 1;
00526   /* Offset of next stack argument beyond the one we have seen that is
00527      at the highest offset, or -1 if we haven't come to a stack
00528      argument yet.  */
00529   long highest_offset = -1;
00530   /* Number of ints of arguments that we have printed so far.  */
00531   int args_printed = 0;
00532   struct cleanup *old_chain;
00533   struct ui_file *stb;
00534   /* True if we should print arguments, false otherwise.  */
00535   int print_args = strcmp (print_frame_arguments, "none");
00536 
00537   stb = mem_fileopen ();
00538   old_chain = make_cleanup_ui_file_delete (stb);
00539 
00540   if (func)
00541     {
00542       struct block *b = SYMBOL_BLOCK_VALUE (func);
00543       struct block_iterator iter;
00544       struct symbol *sym;
00545 
00546       ALL_BLOCK_SYMBOLS (b, iter, sym)
00547         {
00548           struct frame_arg arg, entryarg;
00549 
00550           QUIT;
00551 
00552           /* Keep track of the highest stack argument offset seen, and
00553              skip over any kinds of symbols we don't care about.  */
00554 
00555           if (!SYMBOL_IS_ARGUMENT (sym))
00556             continue;
00557 
00558           switch (SYMBOL_CLASS (sym))
00559             {
00560             case LOC_ARG:
00561             case LOC_REF_ARG:
00562               {
00563                 long current_offset = SYMBOL_VALUE (sym);
00564                 int arg_size = TYPE_LENGTH (SYMBOL_TYPE (sym));
00565 
00566                 /* Compute address of next argument by adding the size of
00567                    this argument and rounding to an int boundary.  */
00568                 current_offset =
00569                   ((current_offset + arg_size + sizeof (int) - 1)
00570                    & ~(sizeof (int) - 1));
00571 
00572                 /* If this is the highest offset seen yet, set
00573                    highest_offset.  */
00574                 if (highest_offset == -1
00575                     || (current_offset > highest_offset))
00576                   highest_offset = current_offset;
00577 
00578                 /* Add the number of ints we're about to print to
00579                    args_printed.  */
00580                 args_printed += (arg_size + sizeof (int) - 1) / sizeof (int);
00581               }
00582 
00583               /* We care about types of symbols, but don't need to
00584                  keep track of stack offsets in them.  */
00585             case LOC_REGISTER:
00586             case LOC_REGPARM_ADDR:
00587             case LOC_COMPUTED:
00588             case LOC_OPTIMIZED_OUT:
00589             default:
00590               break;
00591             }
00592 
00593           /* We have to look up the symbol because arguments can have
00594              two entries (one a parameter, one a local) and the one we
00595              want is the local, which lookup_symbol will find for us.
00596              This includes gcc1 (not gcc2) on SPARC when passing a
00597              small structure and gcc2 when the argument type is float
00598              and it is passed as a double and converted to float by
00599              the prologue (in the latter case the type of the LOC_ARG
00600              symbol is double and the type of the LOC_LOCAL symbol is
00601              float).  */
00602           /* But if the parameter name is null, don't try it.  Null
00603              parameter names occur on the RS/6000, for traceback
00604              tables.  FIXME, should we even print them?  */
00605 
00606           if (*SYMBOL_LINKAGE_NAME (sym))
00607             {
00608               struct symbol *nsym;
00609 
00610               nsym = lookup_symbol (SYMBOL_LINKAGE_NAME (sym),
00611                                     b, VAR_DOMAIN, NULL);
00612               gdb_assert (nsym != NULL);
00613               if (SYMBOL_CLASS (nsym) == LOC_REGISTER
00614                   && !SYMBOL_IS_ARGUMENT (nsym))
00615                 {
00616                   /* There is a LOC_ARG/LOC_REGISTER pair.  This means
00617                      that it was passed on the stack and loaded into a
00618                      register, or passed in a register and stored in a
00619                      stack slot.  GDB 3.x used the LOC_ARG; GDB
00620                      4.0-4.11 used the LOC_REGISTER.
00621 
00622                      Reasons for using the LOC_ARG:
00623 
00624                      (1) Because find_saved_registers may be slow for
00625                          remote debugging.
00626 
00627                      (2) Because registers are often re-used and stack
00628                          slots rarely (never?) are.  Therefore using
00629                          the stack slot is much less likely to print
00630                          garbage.
00631 
00632                      Reasons why we might want to use the LOC_REGISTER:
00633 
00634                      (1) So that the backtrace prints the same value
00635                          as "print foo".  I see no compelling reason
00636                          why this needs to be the case; having the
00637                          backtrace print the value which was passed
00638                          in, and "print foo" print the value as
00639                          modified within the called function, makes
00640                          perfect sense to me.
00641 
00642                      Additional note: It might be nice if "info args"
00643                      displayed both values.
00644 
00645                      One more note: There is a case with SPARC
00646                      structure passing where we need to use the
00647                      LOC_REGISTER, but this is dealt with by creating
00648                      a single LOC_REGPARM in symbol reading.  */
00649 
00650                   /* Leave sym (the LOC_ARG) alone.  */
00651                   ;
00652                 }
00653               else
00654                 sym = nsym;
00655             }
00656 
00657           /* Print the current arg.  */
00658           if (!first)
00659             ui_out_text (uiout, ", ");
00660           ui_out_wrap_hint (uiout, "    ");
00661 
00662           if (!print_args)
00663             {
00664               memset (&arg, 0, sizeof (arg));
00665               arg.sym = sym;
00666               arg.entry_kind = print_entry_values_no;
00667               memset (&entryarg, 0, sizeof (entryarg));
00668               entryarg.sym = sym;
00669               entryarg.entry_kind = print_entry_values_no;
00670             }
00671           else
00672             read_frame_arg (sym, frame, &arg, &entryarg);
00673 
00674           if (arg.entry_kind != print_entry_values_only)
00675             print_frame_arg (&arg);
00676 
00677           if (entryarg.entry_kind != print_entry_values_no)
00678             {
00679               if (arg.entry_kind != print_entry_values_only)
00680                 {
00681                   ui_out_text (uiout, ", ");
00682                   ui_out_wrap_hint (uiout, "    ");
00683                 }
00684 
00685               print_frame_arg (&entryarg);
00686             }
00687 
00688           xfree (arg.error);
00689           xfree (entryarg.error);
00690 
00691           first = 0;
00692         }
00693     }
00694 
00695   /* Don't print nameless args in situations where we don't know
00696      enough about the stack to find them.  */
00697   if (num != -1)
00698     {
00699       long start;
00700 
00701       if (highest_offset == -1)
00702         start = gdbarch_frame_args_skip (get_frame_arch (frame));
00703       else
00704         start = highest_offset;
00705 
00706       print_frame_nameless_args (frame, start, num - args_printed,
00707                                  first, stream);
00708     }
00709 
00710   do_cleanups (old_chain);
00711 }
00712 
00713 /* Set the current source and line to the location given by frame
00714    FRAME, if possible.  When CENTER is true, adjust so the relevant
00715    line is in the center of the next 'list'.  */
00716 
00717 void
00718 set_current_sal_from_frame (struct frame_info *frame, int center)
00719 {
00720   struct symtab_and_line sal;
00721 
00722   find_frame_sal (frame, &sal);
00723   if (sal.symtab)
00724     {
00725       if (center)
00726         sal.line = max (sal.line - get_lines_to_list () / 2, 1);
00727       set_current_source_symtab_and_line (&sal);
00728     }
00729 }
00730 
00731 /* If ON, GDB will display disassembly of the next source line when
00732    execution of the program being debugged stops.
00733    If AUTO (which is the default), or there's no line info to determine
00734    the source line of the next instruction, display disassembly of next
00735    instruction instead.  */
00736 
00737 static enum auto_boolean disassemble_next_line;
00738 
00739 static void
00740 show_disassemble_next_line (struct ui_file *file, int from_tty,
00741                                  struct cmd_list_element *c,
00742                                  const char *value)
00743 {
00744   fprintf_filtered (file,
00745                     _("Debugger's willingness to use "
00746                       "disassemble-next-line is %s.\n"),
00747                     value);
00748 }
00749 
00750 /* Use TRY_CATCH to catch the exception from the gdb_disassembly
00751    because it will be broken by filter sometime.  */
00752 
00753 static void
00754 do_gdb_disassembly (struct gdbarch *gdbarch,
00755                     int how_many, CORE_ADDR low, CORE_ADDR high)
00756 {
00757   volatile struct gdb_exception exception;
00758 
00759   TRY_CATCH (exception, RETURN_MASK_ERROR)
00760     {
00761       gdb_disassembly (gdbarch, current_uiout, 0,
00762                        DISASSEMBLY_RAW_INSN, how_many,
00763                        low, high);
00764     }
00765   if (exception.reason < 0)
00766     {
00767       /* If an exception was thrown while doing the disassembly, print
00768          the error message, to give the user a clue of what happened.  */
00769       exception_print (gdb_stderr, exception);
00770     }
00771 }
00772 
00773 /* Print information about frame FRAME.  The output is format according
00774    to PRINT_LEVEL and PRINT_WHAT and PRINT_ARGS.  The meaning of
00775    PRINT_WHAT is:
00776    
00777    SRC_LINE: Print only source line.
00778    LOCATION: Print only location.
00779    LOC_AND_SRC: Print location and source line.
00780 
00781    Used in "where" output, and to emit breakpoint or step
00782    messages.  */
00783 
00784 void
00785 print_frame_info (struct frame_info *frame, int print_level,
00786                   enum print_what print_what, int print_args,
00787                   int set_current_sal)
00788 {
00789   struct gdbarch *gdbarch = get_frame_arch (frame);
00790   struct symtab_and_line sal;
00791   int source_print;
00792   int location_print;
00793   struct ui_out *uiout = current_uiout;
00794 
00795   if (get_frame_type (frame) == DUMMY_FRAME
00796       || get_frame_type (frame) == SIGTRAMP_FRAME
00797       || get_frame_type (frame) == ARCH_FRAME)
00798     {
00799       struct cleanup *uiout_cleanup
00800         = make_cleanup_ui_out_tuple_begin_end (uiout, "frame");
00801 
00802       annotate_frame_begin (print_level ? frame_relative_level (frame) : 0,
00803                             gdbarch, get_frame_pc (frame));
00804 
00805       /* Do this regardless of SOURCE because we don't have any source
00806          to list for this frame.  */
00807       if (print_level)
00808         {
00809           ui_out_text (uiout, "#");
00810           ui_out_field_fmt_int (uiout, 2, ui_left, "level",
00811                                 frame_relative_level (frame));
00812         }
00813       if (ui_out_is_mi_like_p (uiout))
00814         {
00815           annotate_frame_address ();
00816           ui_out_field_core_addr (uiout, "addr",
00817                                   gdbarch, get_frame_pc (frame));
00818           annotate_frame_address_end ();
00819         }
00820 
00821       if (get_frame_type (frame) == DUMMY_FRAME)
00822         {
00823           annotate_function_call ();
00824           ui_out_field_string (uiout, "func", "<function called from gdb>");
00825         }
00826       else if (get_frame_type (frame) == SIGTRAMP_FRAME)
00827         {
00828           annotate_signal_handler_caller ();
00829           ui_out_field_string (uiout, "func", "<signal handler called>");
00830         }
00831       else if (get_frame_type (frame) == ARCH_FRAME)
00832         {
00833           ui_out_field_string (uiout, "func", "<cross-architecture call>");
00834         }
00835       ui_out_text (uiout, "\n");
00836       annotate_frame_end ();
00837 
00838       do_cleanups (uiout_cleanup);
00839       return;
00840     }
00841 
00842   /* If FRAME is not the innermost frame, that normally means that
00843      FRAME->pc points to *after* the call instruction, and we want to
00844      get the line containing the call, never the next line.  But if
00845      the next frame is a SIGTRAMP_FRAME or a DUMMY_FRAME, then the
00846      next frame was not entered as the result of a call, and we want
00847      to get the line containing FRAME->pc.  */
00848   find_frame_sal (frame, &sal);
00849 
00850   location_print = (print_what == LOCATION 
00851                     || print_what == LOC_AND_ADDRESS
00852                     || print_what == SRC_AND_LOC);
00853 
00854   if (location_print || !sal.symtab)
00855     print_frame (frame, print_level, print_what, print_args, sal);
00856 
00857   source_print = (print_what == SRC_LINE || print_what == SRC_AND_LOC);
00858 
00859   /* If disassemble-next-line is set to auto or on and doesn't have
00860      the line debug messages for $pc, output the next instruction.  */
00861   if ((disassemble_next_line == AUTO_BOOLEAN_AUTO
00862        || disassemble_next_line == AUTO_BOOLEAN_TRUE)
00863       && source_print && !sal.symtab)
00864     do_gdb_disassembly (get_frame_arch (frame), 1,
00865                         get_frame_pc (frame), get_frame_pc (frame) + 1);
00866 
00867   if (source_print && sal.symtab)
00868     {
00869       int done = 0;
00870       int mid_statement = ((print_what == SRC_LINE)
00871                            && frame_show_address (frame, sal));
00872 
00873       if (annotation_level)
00874         done = identify_source_line (sal.symtab, sal.line, mid_statement,
00875                                      get_frame_pc (frame));
00876       if (!done)
00877         {
00878           if (deprecated_print_frame_info_listing_hook)
00879             deprecated_print_frame_info_listing_hook (sal.symtab, 
00880                                                       sal.line, 
00881                                                       sal.line + 1, 0);
00882           else
00883             {
00884               struct value_print_options opts;
00885 
00886               get_user_print_options (&opts);
00887               /* We used to do this earlier, but that is clearly
00888                  wrong.  This function is used by many different
00889                  parts of gdb, including normal_stop in infrun.c,
00890                  which uses this to print out the current PC
00891                  when we stepi/nexti into the middle of a source
00892                  line.  Only the command line really wants this
00893                  behavior.  Other UIs probably would like the
00894                  ability to decide for themselves if it is desired.  */
00895               if (opts.addressprint && mid_statement)
00896                 {
00897                   ui_out_field_core_addr (uiout, "addr",
00898                                           gdbarch, get_frame_pc (frame));
00899                   ui_out_text (uiout, "\t");
00900                 }
00901 
00902               print_source_lines (sal.symtab, sal.line, sal.line + 1, 0);
00903             }
00904         }
00905 
00906       /* If disassemble-next-line is set to on and there is line debug
00907          messages, output assembly codes for next line.  */
00908       if (disassemble_next_line == AUTO_BOOLEAN_TRUE)
00909         do_gdb_disassembly (get_frame_arch (frame), -1, sal.pc, sal.end);
00910     }
00911 
00912   if (set_current_sal)
00913     {
00914       CORE_ADDR pc;
00915 
00916       if (get_frame_pc_if_available (frame, &pc))
00917         set_last_displayed_sal (1, sal.pspace, pc, sal.symtab, sal.line);
00918       else
00919         set_last_displayed_sal (0, 0, 0, 0, 0);
00920     }
00921 
00922   annotate_frame_end ();
00923 
00924   gdb_flush (gdb_stdout);
00925 }
00926 
00927 /* Remember the last symtab and line we displayed, which we use e.g.
00928  * as the place to put a breakpoint when the `break' command is
00929  * invoked with no arguments.  */
00930 
00931 static void
00932 set_last_displayed_sal (int valid, struct program_space *pspace,
00933                         CORE_ADDR addr, struct symtab *symtab,
00934                         int line)
00935 {
00936   last_displayed_sal_valid = valid;
00937   last_displayed_pspace = pspace;
00938   last_displayed_addr = addr;
00939   last_displayed_symtab = symtab;
00940   last_displayed_line = line;
00941   if (valid && pspace == NULL)
00942     {
00943       clear_last_displayed_sal ();
00944       internal_error (__FILE__, __LINE__,
00945                       _("Trying to set NULL pspace."));
00946     }
00947 }
00948 
00949 /* Forget the last sal we displayed.  */
00950 
00951 void
00952 clear_last_displayed_sal (void)
00953 {
00954   last_displayed_sal_valid = 0;
00955   last_displayed_pspace = 0;
00956   last_displayed_addr = 0;
00957   last_displayed_symtab = 0;
00958   last_displayed_line = 0;
00959 }
00960 
00961 /* Is our record of the last sal we displayed valid?  If not,
00962  * the get_last_displayed_* functions will return NULL or 0, as
00963  * appropriate.  */
00964 
00965 int
00966 last_displayed_sal_is_valid (void)
00967 {
00968   return last_displayed_sal_valid;
00969 }
00970 
00971 /* Get the pspace of the last sal we displayed, if it's valid.  */
00972 
00973 struct program_space *
00974 get_last_displayed_pspace (void)
00975 {
00976   if (last_displayed_sal_valid)
00977     return last_displayed_pspace;
00978   return 0;
00979 }
00980 
00981 /* Get the address of the last sal we displayed, if it's valid.  */
00982 
00983 CORE_ADDR
00984 get_last_displayed_addr (void)
00985 {
00986   if (last_displayed_sal_valid)
00987     return last_displayed_addr;
00988   return 0;
00989 }
00990 
00991 /* Get the symtab of the last sal we displayed, if it's valid.  */
00992 
00993 struct symtab*
00994 get_last_displayed_symtab (void)
00995 {
00996   if (last_displayed_sal_valid)
00997     return last_displayed_symtab;
00998   return 0;
00999 }
01000 
01001 /* Get the line of the last sal we displayed, if it's valid.  */
01002 
01003 int
01004 get_last_displayed_line (void)
01005 {
01006   if (last_displayed_sal_valid)
01007     return last_displayed_line;
01008   return 0;
01009 }
01010 
01011 /* Get the last sal we displayed, if it's valid.  */
01012 
01013 void
01014 get_last_displayed_sal (struct symtab_and_line *sal)
01015 {
01016   if (last_displayed_sal_valid)
01017     {
01018       sal->pspace = last_displayed_pspace;
01019       sal->pc = last_displayed_addr;
01020       sal->symtab = last_displayed_symtab;
01021       sal->line = last_displayed_line;
01022     }
01023   else
01024     {
01025       sal->pspace = 0;
01026       sal->pc = 0;
01027       sal->symtab = 0;
01028       sal->line = 0;
01029     }
01030 }
01031 
01032 
01033 /* Attempt to obtain the FUNNAME, FUNLANG and optionally FUNCP of the function
01034    corresponding to FRAME.  FUNNAME needs to be freed by the caller.  */
01035 
01036 void
01037 find_frame_funname (struct frame_info *frame, char **funname,
01038                     enum language *funlang, struct symbol **funcp)
01039 {
01040   struct symbol *func;
01041 
01042   *funname = NULL;
01043   *funlang = language_unknown;
01044   if (funcp)
01045     *funcp = NULL;
01046 
01047   func = get_frame_function (frame);
01048   if (func)
01049     {
01050       /* In certain pathological cases, the symtabs give the wrong
01051          function (when we are in the first function in a file which
01052          is compiled without debugging symbols, the previous function
01053          is compiled with debugging symbols, and the "foo.o" symbol
01054          that is supposed to tell us where the file with debugging
01055          symbols ends has been truncated by ar because it is longer
01056          than 15 characters).  This also occurs if the user uses asm()
01057          to create a function but not stabs for it (in a file compiled
01058          with -g).
01059 
01060          So look in the minimal symbol tables as well, and if it comes
01061          up with a larger address for the function use that instead.
01062          I don't think this can ever cause any problems; there
01063          shouldn't be any minimal symbols in the middle of a function;
01064          if this is ever changed many parts of GDB will need to be
01065          changed (and we'll create a find_pc_minimal_function or some
01066          such).  */
01067 
01068       struct bound_minimal_symbol msymbol;
01069 
01070       /* Don't attempt to do this for inlined functions, which do not
01071          have a corresponding minimal symbol.  */
01072       if (!block_inlined_p (SYMBOL_BLOCK_VALUE (func)))
01073         msymbol
01074           = lookup_minimal_symbol_by_pc (get_frame_address_in_block (frame));
01075       else
01076         memset (&msymbol, 0, sizeof (msymbol));
01077 
01078       if (msymbol.minsym != NULL
01079           && (SYMBOL_VALUE_ADDRESS (msymbol.minsym)
01080               > BLOCK_START (SYMBOL_BLOCK_VALUE (func))))
01081         {
01082           /* We also don't know anything about the function besides
01083              its address and name.  */
01084           func = 0;
01085           *funname = xstrdup (SYMBOL_PRINT_NAME (msymbol.minsym));
01086           *funlang = SYMBOL_LANGUAGE (msymbol.minsym);
01087         }
01088       else
01089         {
01090           *funname = xstrdup (SYMBOL_PRINT_NAME (func));
01091           *funlang = SYMBOL_LANGUAGE (func);
01092           if (funcp)
01093             *funcp = func;
01094           if (*funlang == language_cplus)
01095             {
01096               /* It seems appropriate to use SYMBOL_PRINT_NAME() here,
01097                  to display the demangled name that we already have
01098                  stored in the symbol table, but we stored a version
01099                  with DMGL_PARAMS turned on, and here we don't want to
01100                  display parameters.  So remove the parameters.  */
01101               char *func_only = cp_remove_params (*funname);
01102 
01103               if (func_only)
01104                 {
01105                   xfree (*funname);
01106                   *funname = func_only;
01107                 }
01108             }
01109         }
01110     }
01111   else
01112     {
01113       struct bound_minimal_symbol msymbol;
01114       CORE_ADDR pc;
01115 
01116       if (!get_frame_address_in_block_if_available (frame, &pc))
01117         return;
01118 
01119       msymbol = lookup_minimal_symbol_by_pc (pc);
01120       if (msymbol.minsym != NULL)
01121         {
01122           *funname = xstrdup (SYMBOL_PRINT_NAME (msymbol.minsym));
01123           *funlang = SYMBOL_LANGUAGE (msymbol.minsym);
01124         }
01125     }
01126 }
01127 
01128 static void
01129 print_frame (struct frame_info *frame, int print_level,
01130              enum print_what print_what, int print_args,
01131              struct symtab_and_line sal)
01132 {
01133   struct gdbarch *gdbarch = get_frame_arch (frame);
01134   struct ui_out *uiout = current_uiout;
01135   char *funname = NULL;
01136   enum language funlang = language_unknown;
01137   struct ui_file *stb;
01138   struct cleanup *old_chain, *list_chain;
01139   struct value_print_options opts;
01140   struct symbol *func;
01141   CORE_ADDR pc = 0;
01142   int pc_p;
01143 
01144   pc_p = get_frame_pc_if_available (frame, &pc);
01145 
01146   stb = mem_fileopen ();
01147   old_chain = make_cleanup_ui_file_delete (stb);
01148 
01149   find_frame_funname (frame, &funname, &funlang, &func);
01150   make_cleanup (xfree, funname);
01151 
01152   annotate_frame_begin (print_level ? frame_relative_level (frame) : 0,
01153                         gdbarch, pc);
01154 
01155   list_chain = make_cleanup_ui_out_tuple_begin_end (uiout, "frame");
01156 
01157   if (print_level)
01158     {
01159       ui_out_text (uiout, "#");
01160       ui_out_field_fmt_int (uiout, 2, ui_left, "level",
01161                             frame_relative_level (frame));
01162     }
01163   get_user_print_options (&opts);
01164   if (opts.addressprint)
01165     if (!sal.symtab
01166         || frame_show_address (frame, sal)
01167         || print_what == LOC_AND_ADDRESS)
01168       {
01169         annotate_frame_address ();
01170         if (pc_p)
01171           ui_out_field_core_addr (uiout, "addr", gdbarch, pc);
01172         else
01173           ui_out_field_string (uiout, "addr", "<unavailable>");
01174         annotate_frame_address_end ();
01175         ui_out_text (uiout, " in ");
01176       }
01177   annotate_frame_function_name ();
01178   fprintf_symbol_filtered (stb, funname ? funname : "??",
01179                            funlang, DMGL_ANSI);
01180   ui_out_field_stream (uiout, "func", stb);
01181   ui_out_wrap_hint (uiout, "   ");
01182   annotate_frame_args ();
01183       
01184   ui_out_text (uiout, " (");
01185   if (print_args)
01186     {
01187       struct gdbarch *gdbarch = get_frame_arch (frame);
01188       int numargs;
01189       struct cleanup *args_list_chain;
01190       volatile struct gdb_exception e;
01191 
01192       if (gdbarch_frame_num_args_p (gdbarch))
01193         {
01194           numargs = gdbarch_frame_num_args (gdbarch, frame);
01195           gdb_assert (numargs >= 0);
01196         }
01197       else
01198         numargs = -1;
01199     
01200       args_list_chain = make_cleanup_ui_out_list_begin_end (uiout, "args");
01201       TRY_CATCH (e, RETURN_MASK_ERROR)
01202         {
01203           print_frame_args (func, frame, numargs, gdb_stdout);
01204         }
01205       /* FIXME: ARGS must be a list.  If one argument is a string it
01206           will have " that will not be properly escaped.  */
01207       /* Invoke ui_out_tuple_end.  */
01208       do_cleanups (args_list_chain);
01209       QUIT;
01210     }
01211   ui_out_text (uiout, ")");
01212   if (sal.symtab)
01213     {
01214       const char *filename_display;
01215       
01216       filename_display = symtab_to_filename_for_display (sal.symtab);
01217       annotate_frame_source_begin ();
01218       ui_out_wrap_hint (uiout, "   ");
01219       ui_out_text (uiout, " at ");
01220       annotate_frame_source_file ();
01221       ui_out_field_string (uiout, "file", filename_display);
01222       if (ui_out_is_mi_like_p (uiout))
01223         {
01224           const char *fullname = symtab_to_fullname (sal.symtab);
01225 
01226           ui_out_field_string (uiout, "fullname", fullname);
01227         }
01228       annotate_frame_source_file_end ();
01229       ui_out_text (uiout, ":");
01230       annotate_frame_source_line ();
01231       ui_out_field_int (uiout, "line", sal.line);
01232       annotate_frame_source_end ();
01233     }
01234 
01235   if (pc_p && (funname == NULL || sal.symtab == NULL))
01236     {
01237       char *lib = solib_name_from_address (get_frame_program_space (frame),
01238                                            get_frame_pc (frame));
01239 
01240       if (lib)
01241         {
01242           annotate_frame_where ();
01243           ui_out_wrap_hint (uiout, "  ");
01244           ui_out_text (uiout, " from ");
01245           ui_out_field_string (uiout, "from", lib);
01246         }
01247     }
01248 
01249   /* do_cleanups will call ui_out_tuple_end() for us.  */
01250   do_cleanups (list_chain);
01251   ui_out_text (uiout, "\n");
01252   do_cleanups (old_chain);
01253 }
01254 
01255 
01256 /* Read a frame specification in whatever the appropriate format is
01257    from FRAME_EXP.  Call error(), printing MESSAGE, if the
01258    specification is in any way invalid (so this function never returns
01259    NULL).  When SEPECTED_P is non-NULL set its target to indicate that
01260    the default selected frame was used.  */
01261 
01262 static struct frame_info *
01263 parse_frame_specification_1 (const char *frame_exp, const char *message,
01264                              int *selected_frame_p)
01265 {
01266   int numargs;
01267   struct value *args[4];
01268   CORE_ADDR addrs[ARRAY_SIZE (args)];
01269 
01270   if (frame_exp == NULL)
01271     numargs = 0;
01272   else
01273     {
01274       numargs = 0;
01275       while (1)
01276         {
01277           char *addr_string;
01278           struct cleanup *cleanup;
01279           const char *p;
01280 
01281           /* Skip leading white space, bail of EOL.  */
01282           frame_exp = skip_spaces_const (frame_exp);
01283           if (!*frame_exp)
01284             break;
01285 
01286           /* Parse the argument, extract it, save it.  */
01287           for (p = frame_exp;
01288                *p && !isspace (*p);
01289                p++);
01290           addr_string = savestring (frame_exp, p - frame_exp);
01291           frame_exp = p;
01292           cleanup = make_cleanup (xfree, addr_string);
01293           
01294           /* NOTE: Parse and evaluate expression, but do not use
01295              functions such as parse_and_eval_long or
01296              parse_and_eval_address to also extract the value.
01297              Instead value_as_long and value_as_address are used.
01298              This avoids problems with expressions that contain
01299              side-effects.  */
01300           if (numargs >= ARRAY_SIZE (args))
01301             error (_("Too many args in frame specification"));
01302           args[numargs++] = parse_and_eval (addr_string);
01303 
01304           do_cleanups (cleanup);
01305         }
01306     }
01307 
01308   /* If no args, default to the selected frame.  */
01309   if (numargs == 0)
01310     {
01311       if (selected_frame_p != NULL)
01312         (*selected_frame_p) = 1;
01313       return get_selected_frame (message);
01314     }
01315 
01316   /* None of the remaining use the selected frame.  */
01317   if (selected_frame_p != NULL)
01318     (*selected_frame_p) = 0;
01319 
01320   /* Assume the single arg[0] is an integer, and try using that to
01321      select a frame relative to current.  */
01322   if (numargs == 1)
01323     {
01324       struct frame_info *fid;
01325       int level = value_as_long (args[0]);
01326 
01327       fid = find_relative_frame (get_current_frame (), &level);
01328       if (level == 0)
01329         /* find_relative_frame was successful.  */
01330         return fid;
01331     }
01332 
01333   /* Convert each value into a corresponding address.  */
01334   {
01335     int i;
01336 
01337     for (i = 0; i < numargs; i++)
01338       addrs[i] = value_as_address (args[i]);
01339   }
01340 
01341   /* Assume that the single arg[0] is an address, use that to identify
01342      a frame with a matching ID.  Should this also accept stack/pc or
01343      stack/pc/special.  */
01344   if (numargs == 1)
01345     {
01346       struct frame_id id = frame_id_build_wild (addrs[0]);
01347       struct frame_info *fid;
01348 
01349       /* If (s)he specifies the frame with an address, he deserves
01350          what (s)he gets.  Still, give the highest one that matches.
01351          (NOTE: cagney/2004-10-29: Why highest, or outer-most, I don't
01352          know).  */
01353       for (fid = get_current_frame ();
01354            fid != NULL;
01355            fid = get_prev_frame (fid))
01356         {
01357           if (frame_id_eq (id, get_frame_id (fid)))
01358             {
01359               struct frame_info *prev_frame;
01360 
01361               while (1)
01362                 {
01363                   prev_frame = get_prev_frame (fid);
01364                   if (!prev_frame
01365                       || !frame_id_eq (id, get_frame_id (prev_frame)))
01366                     break;
01367                   fid = prev_frame;
01368                 }
01369               return fid;
01370             }
01371         }
01372       }
01373 
01374   /* We couldn't identify the frame as an existing frame, but
01375      perhaps we can create one with a single argument.  */
01376   if (numargs == 1)
01377     return create_new_frame (addrs[0], 0);
01378   else if (numargs == 2)
01379     return create_new_frame (addrs[0], addrs[1]);
01380   else
01381     error (_("Too many args in frame specification"));
01382 }
01383 
01384 static struct frame_info *
01385 parse_frame_specification (char *frame_exp)
01386 {
01387   return parse_frame_specification_1 (frame_exp, NULL, NULL);
01388 }
01389 
01390 /* Print verbosely the selected frame or the frame at address
01391    ADDR_EXP.  Absolutely all information in the frame is printed.  */
01392 
01393 static void
01394 frame_info (char *addr_exp, int from_tty)
01395 {
01396   struct frame_info *fi;
01397   struct symtab_and_line sal;
01398   struct symbol *func;
01399   struct symtab *s;
01400   struct frame_info *calling_frame_info;
01401   int numregs;
01402   const char *funname = 0;
01403   enum language funlang = language_unknown;
01404   const char *pc_regname;
01405   int selected_frame_p;
01406   struct gdbarch *gdbarch;
01407   struct cleanup *back_to = make_cleanup (null_cleanup, NULL);
01408   CORE_ADDR frame_pc;
01409   int frame_pc_p;
01410   CORE_ADDR caller_pc;
01411 
01412   fi = parse_frame_specification_1 (addr_exp, "No stack.", &selected_frame_p);
01413   gdbarch = get_frame_arch (fi);
01414 
01415   /* Name of the value returned by get_frame_pc().  Per comments, "pc"
01416      is not a good name.  */
01417   if (gdbarch_pc_regnum (gdbarch) >= 0)
01418     /* OK, this is weird.  The gdbarch_pc_regnum hardware register's value can
01419        easily not match that of the internal value returned by
01420        get_frame_pc().  */
01421     pc_regname = gdbarch_register_name (gdbarch, gdbarch_pc_regnum (gdbarch));
01422   else
01423     /* But then, this is weird to.  Even without gdbarch_pc_regnum, an
01424        architectures will often have a hardware register called "pc",
01425        and that register's value, again, can easily not match
01426        get_frame_pc().  */
01427     pc_regname = "pc";
01428 
01429   frame_pc_p = get_frame_pc_if_available (fi, &frame_pc);
01430   find_frame_sal (fi, &sal);
01431   func = get_frame_function (fi);
01432   s = sal.symtab;
01433   if (func)
01434     {
01435       funname = SYMBOL_PRINT_NAME (func);
01436       funlang = SYMBOL_LANGUAGE (func);
01437       if (funlang == language_cplus)
01438         {
01439           /* It seems appropriate to use SYMBOL_PRINT_NAME() here,
01440              to display the demangled name that we already have
01441              stored in the symbol table, but we stored a version
01442              with DMGL_PARAMS turned on, and here we don't want to
01443              display parameters.  So remove the parameters.  */
01444           char *func_only = cp_remove_params (funname);
01445 
01446           if (func_only)
01447             {
01448               funname = func_only;
01449               make_cleanup (xfree, func_only);
01450             }
01451         }
01452     }
01453   else if (frame_pc_p)
01454     {
01455       struct bound_minimal_symbol msymbol;
01456 
01457       msymbol = lookup_minimal_symbol_by_pc (frame_pc);
01458       if (msymbol.minsym != NULL)
01459         {
01460           funname = SYMBOL_PRINT_NAME (msymbol.minsym);
01461           funlang = SYMBOL_LANGUAGE (msymbol.minsym);
01462         }
01463     }
01464   calling_frame_info = get_prev_frame (fi);
01465 
01466   if (selected_frame_p && frame_relative_level (fi) >= 0)
01467     {
01468       printf_filtered (_("Stack level %d, frame at "),
01469                        frame_relative_level (fi));
01470     }
01471   else
01472     {
01473       printf_filtered (_("Stack frame at "));
01474     }
01475   fputs_filtered (paddress (gdbarch, get_frame_base (fi)), gdb_stdout);
01476   printf_filtered (":\n");
01477   printf_filtered (" %s = ", pc_regname);
01478   if (frame_pc_p)
01479     fputs_filtered (paddress (gdbarch, get_frame_pc (fi)), gdb_stdout);
01480   else
01481     fputs_filtered ("<unavailable>", gdb_stdout);
01482 
01483   wrap_here ("   ");
01484   if (funname)
01485     {
01486       printf_filtered (" in ");
01487       fprintf_symbol_filtered (gdb_stdout, funname, funlang,
01488                                DMGL_ANSI | DMGL_PARAMS);
01489     }
01490   wrap_here ("   ");
01491   if (sal.symtab)
01492     printf_filtered (" (%s:%d)", symtab_to_filename_for_display (sal.symtab),
01493                      sal.line);
01494   puts_filtered ("; ");
01495   wrap_here ("    ");
01496   printf_filtered ("saved %s ", pc_regname);
01497   if (frame_unwind_caller_pc_if_available (fi, &caller_pc))
01498     fputs_filtered (paddress (gdbarch, caller_pc), gdb_stdout);
01499   else
01500     fputs_filtered ("<unavailable>", gdb_stdout);
01501   printf_filtered ("\n");
01502 
01503   if (calling_frame_info == NULL)
01504     {
01505       enum unwind_stop_reason reason;
01506 
01507       reason = get_frame_unwind_stop_reason (fi);
01508       if (reason != UNWIND_NO_REASON)
01509         printf_filtered (_(" Outermost frame: %s\n"),
01510                          frame_stop_reason_string (reason));
01511     }
01512   else if (get_frame_type (fi) == TAILCALL_FRAME)
01513     puts_filtered (" tail call frame");
01514   else if (get_frame_type (fi) == INLINE_FRAME)
01515     printf_filtered (" inlined into frame %d",
01516                      frame_relative_level (get_prev_frame (fi)));
01517   else
01518     {
01519       printf_filtered (" called by frame at ");
01520       fputs_filtered (paddress (gdbarch, get_frame_base (calling_frame_info)),
01521                       gdb_stdout);
01522     }
01523   if (get_next_frame (fi) && calling_frame_info)
01524     puts_filtered (",");
01525   wrap_here ("   ");
01526   if (get_next_frame (fi))
01527     {
01528       printf_filtered (" caller of frame at ");
01529       fputs_filtered (paddress (gdbarch, get_frame_base (get_next_frame (fi))),
01530                       gdb_stdout);
01531     }
01532   if (get_next_frame (fi) || calling_frame_info)
01533     puts_filtered ("\n");
01534 
01535   if (s)
01536     printf_filtered (" source language %s.\n",
01537                      language_str (s->language));
01538 
01539   {
01540     /* Address of the argument list for this frame, or 0.  */
01541     CORE_ADDR arg_list = get_frame_args_address (fi);
01542     /* Number of args for this frame, or -1 if unknown.  */
01543     int numargs;
01544 
01545     if (arg_list == 0)
01546       printf_filtered (" Arglist at unknown address.\n");
01547     else
01548       {
01549         printf_filtered (" Arglist at ");
01550         fputs_filtered (paddress (gdbarch, arg_list), gdb_stdout);
01551         printf_filtered (",");
01552 
01553         if (!gdbarch_frame_num_args_p (gdbarch))
01554           {
01555             numargs = -1;
01556             puts_filtered (" args: ");
01557           }
01558         else
01559           {
01560             numargs = gdbarch_frame_num_args (gdbarch, fi);
01561             gdb_assert (numargs >= 0);
01562             if (numargs == 0)
01563               puts_filtered (" no args.");
01564             else if (numargs == 1)
01565               puts_filtered (" 1 arg: ");
01566             else
01567               printf_filtered (" %d args: ", numargs);
01568           }
01569         print_frame_args (func, fi, numargs, gdb_stdout);
01570         puts_filtered ("\n");
01571       }
01572   }
01573   {
01574     /* Address of the local variables for this frame, or 0.  */
01575     CORE_ADDR arg_list = get_frame_locals_address (fi);
01576 
01577     if (arg_list == 0)
01578       printf_filtered (" Locals at unknown address,");
01579     else
01580       {
01581         printf_filtered (" Locals at ");
01582         fputs_filtered (paddress (gdbarch, arg_list), gdb_stdout);
01583         printf_filtered (",");
01584       }
01585   }
01586 
01587   /* Print as much information as possible on the location of all the
01588      registers.  */
01589   {
01590     enum lval_type lval;
01591     int optimized;
01592     int unavailable;
01593     CORE_ADDR addr;
01594     int realnum;
01595     int count;
01596     int i;
01597     int need_nl = 1;
01598 
01599     /* The sp is special; what's displayed isn't the save address, but
01600        the value of the previous frame's sp.  This is a legacy thing,
01601        at one stage the frame cached the previous frame's SP instead
01602        of its address, hence it was easiest to just display the cached
01603        value.  */
01604     if (gdbarch_sp_regnum (gdbarch) >= 0)
01605       {
01606         /* Find out the location of the saved stack pointer with out
01607            actually evaluating it.  */
01608         frame_register_unwind (fi, gdbarch_sp_regnum (gdbarch),
01609                                &optimized, &unavailable, &lval, &addr,
01610                                &realnum, NULL);
01611         if (!optimized && !unavailable && lval == not_lval)
01612           {
01613             enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
01614             int sp_size = register_size (gdbarch, gdbarch_sp_regnum (gdbarch));
01615             gdb_byte value[MAX_REGISTER_SIZE];
01616             CORE_ADDR sp;
01617 
01618             frame_register_unwind (fi, gdbarch_sp_regnum (gdbarch),
01619                                    &optimized, &unavailable, &lval, &addr,
01620                                    &realnum, value);
01621             /* NOTE: cagney/2003-05-22: This is assuming that the
01622                stack pointer was packed as an unsigned integer.  That
01623                may or may not be valid.  */
01624             sp = extract_unsigned_integer (value, sp_size, byte_order);
01625             printf_filtered (" Previous frame's sp is ");
01626             fputs_filtered (paddress (gdbarch, sp), gdb_stdout);
01627             printf_filtered ("\n");
01628             need_nl = 0;
01629           }
01630         else if (!optimized && !unavailable && lval == lval_memory)
01631           {
01632             printf_filtered (" Previous frame's sp at ");
01633             fputs_filtered (paddress (gdbarch, addr), gdb_stdout);
01634             printf_filtered ("\n");
01635             need_nl = 0;
01636           }
01637         else if (!optimized && !unavailable && lval == lval_register)
01638           {
01639             printf_filtered (" Previous frame's sp in %s\n",
01640                              gdbarch_register_name (gdbarch, realnum));
01641             need_nl = 0;
01642           }
01643         /* else keep quiet.  */
01644       }
01645 
01646     count = 0;
01647     numregs = gdbarch_num_regs (gdbarch)
01648               + gdbarch_num_pseudo_regs (gdbarch);
01649     for (i = 0; i < numregs; i++)
01650       if (i != gdbarch_sp_regnum (gdbarch)
01651           && gdbarch_register_reggroup_p (gdbarch, i, all_reggroup))
01652         {
01653           /* Find out the location of the saved register without
01654              fetching the corresponding value.  */
01655           frame_register_unwind (fi, i, &optimized, &unavailable,
01656                                  &lval, &addr, &realnum, NULL);
01657           /* For moment, only display registers that were saved on the
01658              stack.  */
01659           if (!optimized && !unavailable && lval == lval_memory)
01660             {
01661               if (count == 0)
01662                 puts_filtered (" Saved registers:\n ");
01663               else
01664                 puts_filtered (",");
01665               wrap_here (" ");
01666               printf_filtered (" %s at ",
01667                                gdbarch_register_name (gdbarch, i));
01668               fputs_filtered (paddress (gdbarch, addr), gdb_stdout);
01669               count++;
01670             }
01671         }
01672     if (count || need_nl)
01673       puts_filtered ("\n");
01674   }
01675 
01676   do_cleanups (back_to);
01677 }
01678 
01679 /* Print briefly all stack frames or just the innermost COUNT_EXP
01680    frames.  */
01681 
01682 static void
01683 backtrace_command_1 (char *count_exp, int show_locals, int no_filters,
01684                      int from_tty)
01685 {
01686   struct frame_info *fi;
01687   int count;
01688   int i;
01689   struct frame_info *trailing;
01690   int trailing_level, py_start = 0, py_end = 0;
01691   enum py_bt_status result = PY_BT_ERROR;
01692 
01693   if (!target_has_stack)
01694     error (_("No stack."));
01695 
01696   /* The following code must do two things.  First, it must set the
01697      variable TRAILING to the frame from which we should start
01698      printing.  Second, it must set the variable count to the number
01699      of frames which we should print, or -1 if all of them.  */
01700   trailing = get_current_frame ();
01701 
01702   trailing_level = 0;
01703   if (count_exp)
01704     {
01705       count = parse_and_eval_long (count_exp);
01706       if (count < 0)
01707         {
01708           struct frame_info *current;
01709 
01710           py_start = count;
01711           count = -count;
01712 
01713           current = trailing;
01714           while (current && count--)
01715             {
01716               QUIT;
01717               current = get_prev_frame (current);
01718             }
01719 
01720           /* Will stop when CURRENT reaches the top of the stack.
01721              TRAILING will be COUNT below it.  */
01722           while (current)
01723             {
01724               QUIT;
01725               trailing = get_prev_frame (trailing);
01726               current = get_prev_frame (current);
01727               trailing_level++;
01728             }
01729 
01730           count = -1;
01731         }
01732       else
01733         {
01734           py_start = 0;
01735           py_end = count;
01736         }
01737     }
01738   else
01739     {
01740       py_end = -1;
01741       count = -1;
01742     }
01743 
01744   if (info_verbose)
01745     {
01746       /* Read in symbols for all of the frames.  Need to do this in a
01747          separate pass so that "Reading in symbols for xxx" messages
01748          don't screw up the appearance of the backtrace.  Also if
01749          people have strong opinions against reading symbols for
01750          backtrace this may have to be an option.  */
01751       i = count;
01752       for (fi = trailing; fi != NULL && i--; fi = get_prev_frame (fi))
01753         {
01754           CORE_ADDR pc;
01755 
01756           QUIT;
01757           pc = get_frame_address_in_block (fi);
01758           find_pc_sect_symtab_via_partial (pc, find_pc_mapped_section (pc));
01759         }
01760     }
01761 
01762   if (! no_filters)
01763     {
01764       int flags = PRINT_LEVEL | PRINT_FRAME_INFO | PRINT_ARGS;
01765       enum py_frame_args arg_type;
01766 
01767       if (show_locals)
01768         flags |= PRINT_LOCALS;
01769 
01770       if (!strcmp (print_frame_arguments, "scalars"))
01771         arg_type = CLI_SCALAR_VALUES;
01772       else if (!strcmp (print_frame_arguments, "all"))
01773         arg_type = CLI_ALL_VALUES;
01774       else
01775         arg_type = NO_VALUES;
01776 
01777       result = apply_frame_filter (get_current_frame (), flags, arg_type,
01778                                    current_uiout, py_start, py_end);
01779 
01780     }
01781   /* Run the inbuilt backtrace if there are no filters registered, or
01782      "no-filters" has been specified from the command.  */
01783   if (no_filters ||  result == PY_BT_NO_FILTERS)
01784     {
01785       for (i = 0, fi = trailing; fi && count--; i++, fi = get_prev_frame (fi))
01786         {
01787           QUIT;
01788 
01789           /* Don't use print_stack_frame; if an error() occurs it probably
01790              means further attempts to backtrace would fail (on the other
01791              hand, perhaps the code does or could be fixed to make sure
01792              the frame->prev field gets set to NULL in that case).  */
01793 
01794           print_frame_info (fi, 1, LOCATION, 1, 0);
01795           if (show_locals)
01796             {
01797               struct frame_id frame_id = get_frame_id (fi);
01798 
01799               print_frame_local_vars (fi, 1, gdb_stdout);
01800 
01801               /* print_frame_local_vars invalidates FI.  */
01802               fi = frame_find_by_id (frame_id);
01803               if (fi == NULL)
01804                 {
01805                   trailing = NULL;
01806                   warning (_("Unable to restore previously selected frame."));
01807                   break;
01808                 }
01809             }
01810 
01811           /* Save the last frame to check for error conditions.  */
01812           trailing = fi;
01813         }
01814 
01815       /* If we've stopped before the end, mention that.  */
01816       if (fi && from_tty)
01817         printf_filtered (_("(More stack frames follow...)\n"));
01818 
01819       /* If we've run out of frames, and the reason appears to be an error
01820          condition, print it.  */
01821       if (fi == NULL && trailing != NULL)
01822         {
01823           enum unwind_stop_reason reason;
01824 
01825           reason = get_frame_unwind_stop_reason (trailing);
01826           if (reason >= UNWIND_FIRST_ERROR)
01827             printf_filtered (_("Backtrace stopped: %s\n"),
01828                              frame_stop_reason_string (reason));
01829         }
01830     }
01831 }
01832 
01833 static void
01834 backtrace_command (char *arg, int from_tty)
01835 {
01836   struct cleanup *old_chain = make_cleanup (null_cleanup, NULL);
01837   int fulltrace_arg = -1, arglen = 0, argc = 0, no_filters  = -1;
01838   int user_arg = 0;
01839 
01840   if (arg)
01841     {
01842       char **argv;
01843       int i;
01844 
01845       argv = gdb_buildargv (arg);
01846       make_cleanup_freeargv (argv);
01847       argc = 0;
01848       for (i = 0; argv[i]; i++)
01849         {
01850           unsigned int j;
01851 
01852           for (j = 0; j < strlen (argv[i]); j++)
01853             argv[i][j] = tolower (argv[i][j]);
01854 
01855           if (no_filters < 0 && subset_compare (argv[i], "no-filters"))
01856             no_filters = argc;
01857           else
01858             {
01859               if (fulltrace_arg < 0 && subset_compare (argv[i], "full"))
01860                 fulltrace_arg = argc;
01861               else
01862                 {
01863                   user_arg++;
01864                   arglen += strlen (argv[i]);
01865                 }
01866             }
01867           argc++;
01868         }
01869       arglen += user_arg;
01870       if (fulltrace_arg >= 0 || no_filters >= 0)
01871         {
01872           if (arglen > 0)
01873             {
01874               arg = xmalloc (arglen + 1);
01875               make_cleanup (xfree, arg);
01876               arg[0] = 0;
01877               for (i = 0; i < argc; i++)
01878                 {
01879                   if (i != fulltrace_arg && i != no_filters)
01880                     {
01881                       strcat (arg, argv[i]);
01882                       strcat (arg, " ");
01883                     }
01884                 }
01885             }
01886           else
01887             arg = NULL;
01888         }
01889     }
01890 
01891   backtrace_command_1 (arg, fulltrace_arg >= 0 /* show_locals */,
01892                        no_filters >= 0 /* no frame-filters */, from_tty);
01893 
01894   do_cleanups (old_chain);
01895 }
01896 
01897 static void
01898 backtrace_full_command (char *arg, int from_tty)
01899 {
01900   backtrace_command_1 (arg, 1 /* show_locals */, 0, from_tty);
01901 }
01902 
01903 
01904 /* Iterate over the local variables of a block B, calling CB with
01905    CB_DATA.  */
01906 
01907 static void
01908 iterate_over_block_locals (struct block *b,
01909                            iterate_over_block_arg_local_vars_cb cb,
01910                            void *cb_data)
01911 {
01912   struct block_iterator iter;
01913   struct symbol *sym;
01914 
01915   ALL_BLOCK_SYMBOLS (b, iter, sym)
01916     {
01917       switch (SYMBOL_CLASS (sym))
01918         {
01919         case LOC_LOCAL:
01920         case LOC_REGISTER:
01921         case LOC_STATIC:
01922         case LOC_COMPUTED:
01923           if (SYMBOL_IS_ARGUMENT (sym))
01924             break;
01925           if (SYMBOL_DOMAIN (sym) == COMMON_BLOCK_DOMAIN)
01926             break;
01927           (*cb) (SYMBOL_PRINT_NAME (sym), sym, cb_data);
01928           break;
01929 
01930         default:
01931           /* Ignore symbols which are not locals.  */
01932           break;
01933         }
01934     }
01935 }
01936 
01937 
01938 /* Same, but print labels.  */
01939 
01940 #if 0
01941 /* Commented out, as the code using this function has also been
01942    commented out.  FIXME:brobecker/2009-01-13: Find out why the code
01943    was commented out in the first place.  The discussion introducing
01944    this change (2007-12-04: Support lexical blocks and function bodies
01945    that occupy non-contiguous address ranges) did not explain why
01946    this change was made.  */
01947 static int
01948 print_block_frame_labels (struct gdbarch *gdbarch, struct block *b,
01949                           int *have_default, struct ui_file *stream)
01950 {
01951   struct block_iterator iter;
01952   struct symbol *sym;
01953   int values_printed = 0;
01954 
01955   ALL_BLOCK_SYMBOLS (b, iter, sym)
01956     {
01957       if (strcmp (SYMBOL_LINKAGE_NAME (sym), "default") == 0)
01958         {
01959           if (*have_default)
01960             continue;
01961           *have_default = 1;
01962         }
01963       if (SYMBOL_CLASS (sym) == LOC_LABEL)
01964         {
01965           struct symtab_and_line sal;
01966           struct value_print_options opts;
01967 
01968           sal = find_pc_line (SYMBOL_VALUE_ADDRESS (sym), 0);
01969           values_printed = 1;
01970           fputs_filtered (SYMBOL_PRINT_NAME (sym), stream);
01971           get_user_print_options (&opts);
01972           if (opts.addressprint)
01973             {
01974               fprintf_filtered (stream, " ");
01975               fputs_filtered (paddress (gdbarch, SYMBOL_VALUE_ADDRESS (sym)),
01976                               stream);
01977             }
01978           fprintf_filtered (stream, " in file %s, line %d\n",
01979                             sal.symtab->filename, sal.line);
01980         }
01981     }
01982 
01983   return values_printed;
01984 }
01985 #endif
01986 
01987 /* Iterate over all the local variables in block B, including all its
01988    superblocks, stopping when the top-level block is reached.  */
01989 
01990 void
01991 iterate_over_block_local_vars (struct block *block,
01992                                iterate_over_block_arg_local_vars_cb cb,
01993                                void *cb_data)
01994 {
01995   while (block)
01996     {
01997       iterate_over_block_locals (block, cb, cb_data);
01998       /* After handling the function's top-level block, stop.  Don't
01999          continue to its superblock, the block of per-file
02000          symbols.  */
02001       if (BLOCK_FUNCTION (block))
02002         break;
02003       block = BLOCK_SUPERBLOCK (block);
02004     }
02005 }
02006 
02007 /* Data to be passed around in the calls to the locals and args
02008    iterators.  */
02009 
02010 struct print_variable_and_value_data
02011 {
02012   struct frame_id frame_id;
02013   int num_tabs;
02014   struct ui_file *stream;
02015   int values_printed;
02016 };
02017 
02018 /* The callback for the locals and args iterators.  */
02019 
02020 static void
02021 do_print_variable_and_value (const char *print_name,
02022                              struct symbol *sym,
02023                              void *cb_data)
02024 {
02025   struct print_variable_and_value_data *p = cb_data;
02026   struct frame_info *frame;
02027 
02028   frame = frame_find_by_id (p->frame_id);
02029   if (frame == NULL)
02030     {
02031       warning (_("Unable to restore previously selected frame."));
02032       return;
02033     }
02034 
02035   print_variable_and_value (print_name, sym, frame, p->stream, p->num_tabs);
02036 
02037   /* print_variable_and_value invalidates FRAME.  */
02038   frame = NULL;
02039 
02040   p->values_printed = 1;
02041 }
02042 
02043 /* Print all variables from the innermost up to the function block of FRAME.
02044    Print them with values to STREAM indented by NUM_TABS.
02045 
02046    This function will invalidate FRAME.  */
02047 
02048 static void
02049 print_frame_local_vars (struct frame_info *frame, int num_tabs,
02050                         struct ui_file *stream)
02051 {
02052   struct print_variable_and_value_data cb_data;
02053   struct block *block;
02054   CORE_ADDR pc;
02055 
02056   if (!get_frame_pc_if_available (frame, &pc))
02057     {
02058       fprintf_filtered (stream,
02059                         _("PC unavailable, cannot determine locals.\n"));
02060       return;
02061     }
02062 
02063   block = get_frame_block (frame, 0);
02064   if (block == 0)
02065     {
02066       fprintf_filtered (stream, "No symbol table info available.\n");
02067       return;
02068     }
02069 
02070   cb_data.frame_id = get_frame_id (frame);
02071   cb_data.num_tabs = 4 * num_tabs;
02072   cb_data.stream = stream;
02073   cb_data.values_printed = 0;
02074 
02075   iterate_over_block_local_vars (block,
02076                                  do_print_variable_and_value,
02077                                  &cb_data);
02078 
02079   /* do_print_variable_and_value invalidates FRAME.  */
02080   frame = NULL;
02081 
02082   if (!cb_data.values_printed)
02083     fprintf_filtered (stream, _("No locals.\n"));
02084 }
02085 
02086 void
02087 locals_info (char *args, int from_tty)
02088 {
02089   print_frame_local_vars (get_selected_frame (_("No frame selected.")),
02090                           0, gdb_stdout);
02091 }
02092 
02093 /* Iterate over all the argument variables in block B.
02094 
02095    Returns 1 if any argument was walked; 0 otherwise.  */
02096 
02097 void
02098 iterate_over_block_arg_vars (struct block *b,
02099                              iterate_over_block_arg_local_vars_cb cb,
02100                              void *cb_data)
02101 {
02102   struct block_iterator iter;
02103   struct symbol *sym, *sym2;
02104 
02105   ALL_BLOCK_SYMBOLS (b, iter, sym)
02106     {
02107       /* Don't worry about things which aren't arguments.  */
02108       if (SYMBOL_IS_ARGUMENT (sym))
02109         {
02110           /* We have to look up the symbol because arguments can have
02111              two entries (one a parameter, one a local) and the one we
02112              want is the local, which lookup_symbol will find for us.
02113              This includes gcc1 (not gcc2) on the sparc when passing a
02114              small structure and gcc2 when the argument type is float
02115              and it is passed as a double and converted to float by
02116              the prologue (in the latter case the type of the LOC_ARG
02117              symbol is double and the type of the LOC_LOCAL symbol is
02118              float).  There are also LOC_ARG/LOC_REGISTER pairs which
02119              are not combined in symbol-reading.  */
02120 
02121           sym2 = lookup_symbol (SYMBOL_LINKAGE_NAME (sym),
02122                                 b, VAR_DOMAIN, NULL);
02123           (*cb) (SYMBOL_PRINT_NAME (sym), sym2, cb_data);
02124         }
02125     }
02126 }
02127 
02128 /* Print all argument variables of the function of FRAME.
02129    Print them with values to STREAM.
02130 
02131    This function will invalidate FRAME.  */
02132 
02133 static void
02134 print_frame_arg_vars (struct frame_info *frame, struct ui_file *stream)
02135 {
02136   struct print_variable_and_value_data cb_data;
02137   struct symbol *func;
02138   CORE_ADDR pc;
02139 
02140   if (!get_frame_pc_if_available (frame, &pc))
02141     {
02142       fprintf_filtered (stream, _("PC unavailable, cannot determine args.\n"));
02143       return;
02144     }
02145 
02146   func = get_frame_function (frame);
02147   if (func == NULL)
02148     {
02149       fprintf_filtered (stream, _("No symbol table info available.\n"));
02150       return;
02151     }
02152 
02153   cb_data.frame_id = get_frame_id (frame);
02154   cb_data.num_tabs = 0;
02155   cb_data.stream = gdb_stdout;
02156   cb_data.values_printed = 0;
02157 
02158   iterate_over_block_arg_vars (SYMBOL_BLOCK_VALUE (func),
02159                                do_print_variable_and_value, &cb_data);
02160 
02161   /* do_print_variable_and_value invalidates FRAME.  */
02162   frame = NULL;
02163 
02164   if (!cb_data.values_printed)
02165     fprintf_filtered (stream, _("No arguments.\n"));
02166 }
02167 
02168 void
02169 args_info (char *ignore, int from_tty)
02170 {
02171   print_frame_arg_vars (get_selected_frame (_("No frame selected.")),
02172                         gdb_stdout);
02173 }
02174 
02175 
02176 static void
02177 args_plus_locals_info (char *ignore, int from_tty)
02178 {
02179   args_info (ignore, from_tty);
02180   locals_info (ignore, from_tty);
02181 }
02182 
02183 
02184 /* Select frame FRAME.  Also print the stack frame and show the source
02185    if this is the tui version.  */
02186 static void
02187 select_and_print_frame (struct frame_info *frame)
02188 {
02189   select_frame (frame);
02190   if (frame)
02191     print_stack_frame (frame, 1, SRC_AND_LOC, 1);
02192 }
02193 
02194 /* Return the symbol-block in which the selected frame is executing.
02195    Can return zero under various legitimate circumstances.
02196 
02197    If ADDR_IN_BLOCK is non-zero, set *ADDR_IN_BLOCK to the relevant
02198    code address within the block returned.  We use this to decide
02199    which macros are in scope.  */
02200 
02201 struct block *
02202 get_selected_block (CORE_ADDR *addr_in_block)
02203 {
02204   if (!has_stack_frames ())
02205     return 0;
02206 
02207   return get_frame_block (get_selected_frame (NULL), addr_in_block);
02208 }
02209 
02210 /* Find a frame a certain number of levels away from FRAME.
02211    LEVEL_OFFSET_PTR points to an int containing the number of levels.
02212    Positive means go to earlier frames (up); negative, the reverse.
02213    The int that contains the number of levels is counted toward
02214    zero as the frames for those levels are found.
02215    If the top or bottom frame is reached, that frame is returned,
02216    but the final value of *LEVEL_OFFSET_PTR is nonzero and indicates
02217    how much farther the original request asked to go.  */
02218 
02219 struct frame_info *
02220 find_relative_frame (struct frame_info *frame, int *level_offset_ptr)
02221 {
02222   /* Going up is simple: just call get_prev_frame enough times or
02223      until the initial frame is reached.  */
02224   while (*level_offset_ptr > 0)
02225     {
02226       struct frame_info *prev = get_prev_frame (frame);
02227 
02228       if (!prev)
02229         break;
02230       (*level_offset_ptr)--;
02231       frame = prev;
02232     }
02233 
02234   /* Going down is just as simple.  */
02235   while (*level_offset_ptr < 0)
02236     {
02237       struct frame_info *next = get_next_frame (frame);
02238 
02239       if (!next)
02240         break;
02241       (*level_offset_ptr)++;
02242       frame = next;
02243     }
02244 
02245   return frame;
02246 }
02247 
02248 /* The "select_frame" command.  With no argument this is a NOP.
02249    Select the frame at level LEVEL_EXP if it is a valid level.
02250    Otherwise, treat LEVEL_EXP as an address expression and select it.
02251 
02252    See parse_frame_specification for more info on proper frame
02253    expressions.  */
02254 
02255 void
02256 select_frame_command (char *level_exp, int from_tty)
02257 {
02258   select_frame (parse_frame_specification_1 (level_exp, "No stack.", NULL));
02259 }
02260 
02261 /* The "frame" command.  With no argument, print the selected frame
02262    briefly.  With an argument, behave like select_frame and then print
02263    the selected frame.  */
02264 
02265 static void
02266 frame_command (char *level_exp, int from_tty)
02267 {
02268   select_frame_command (level_exp, from_tty);
02269   print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC, 1);
02270 }
02271 
02272 /* The XDB Compatibility command to print the current frame.  */
02273 
02274 static void
02275 current_frame_command (char *level_exp, int from_tty)
02276 {
02277   print_stack_frame (get_selected_frame (_("No stack.")), 1, SRC_AND_LOC, 1);
02278 }
02279 
02280 /* Select the frame up one or COUNT_EXP stack levels from the
02281    previously selected frame, and print it briefly.  */
02282 
02283 static void
02284 up_silently_base (char *count_exp)
02285 {
02286   struct frame_info *frame;
02287   int count = 1;
02288 
02289   if (count_exp)
02290     count = parse_and_eval_long (count_exp);
02291 
02292   frame = find_relative_frame (get_selected_frame ("No stack."), &count);
02293   if (count != 0 && count_exp == NULL)
02294     error (_("Initial frame selected; you cannot go up."));
02295   select_frame (frame);
02296 }
02297 
02298 static void
02299 up_silently_command (char *count_exp, int from_tty)
02300 {
02301   up_silently_base (count_exp);
02302 }
02303 
02304 static void
02305 up_command (char *count_exp, int from_tty)
02306 {
02307   up_silently_base (count_exp);
02308   print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC, 1);
02309 }
02310 
02311 /* Select the frame down one or COUNT_EXP stack levels from the previously
02312    selected frame, and print it briefly.  */
02313 
02314 static void
02315 down_silently_base (char *count_exp)
02316 {
02317   struct frame_info *frame;
02318   int count = -1;
02319 
02320   if (count_exp)
02321     count = -parse_and_eval_long (count_exp);
02322 
02323   frame = find_relative_frame (get_selected_frame ("No stack."), &count);
02324   if (count != 0 && count_exp == NULL)
02325     {
02326       /* We only do this if COUNT_EXP is not specified.  That way
02327          "down" means to really go down (and let me know if that is
02328          impossible), but "down 9999" can be used to mean go all the
02329          way down without getting an error.  */
02330 
02331       error (_("Bottom (innermost) frame selected; you cannot go down."));
02332     }
02333 
02334   select_frame (frame);
02335 }
02336 
02337 static void
02338 down_silently_command (char *count_exp, int from_tty)
02339 {
02340   down_silently_base (count_exp);
02341 }
02342 
02343 static void
02344 down_command (char *count_exp, int from_tty)
02345 {
02346   down_silently_base (count_exp);
02347   print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC, 1);
02348 }
02349 
02350 
02351 void
02352 return_command (char *retval_exp, int from_tty)
02353 {
02354   /* Initialize it just to avoid a GCC false warning.  */
02355   enum return_value_convention rv_conv = RETURN_VALUE_STRUCT_CONVENTION;
02356   struct frame_info *thisframe;
02357   struct gdbarch *gdbarch;
02358   struct symbol *thisfun;
02359   struct value *return_value = NULL;
02360   struct value *function = NULL;
02361   const char *query_prefix = "";
02362 
02363   thisframe = get_selected_frame ("No selected frame.");
02364   thisfun = get_frame_function (thisframe);
02365   gdbarch = get_frame_arch (thisframe);
02366 
02367   if (get_frame_type (get_current_frame ()) == INLINE_FRAME)
02368     error (_("Can not force return from an inlined function."));
02369 
02370   /* Compute the return value.  If the computation triggers an error,
02371      let it bail.  If the return type can't be handled, set
02372      RETURN_VALUE to NULL, and QUERY_PREFIX to an informational
02373      message.  */
02374   if (retval_exp)
02375     {
02376       struct expression *retval_expr = parse_expression (retval_exp);
02377       struct cleanup *old_chain = make_cleanup (xfree, retval_expr);
02378       struct type *return_type = NULL;
02379 
02380       /* Compute the return value.  Should the computation fail, this
02381          call throws an error.  */
02382       return_value = evaluate_expression (retval_expr);
02383 
02384       /* Cast return value to the return type of the function.  Should
02385          the cast fail, this call throws an error.  */
02386       if (thisfun != NULL)
02387         return_type = TYPE_TARGET_TYPE (SYMBOL_TYPE (thisfun));
02388       if (return_type == NULL)
02389         {
02390           if (retval_expr->elts[0].opcode != UNOP_CAST
02391               && retval_expr->elts[0].opcode != UNOP_CAST_TYPE)
02392             error (_("Return value type not available for selected "
02393                      "stack frame.\n"
02394                      "Please use an explicit cast of the value to return."));
02395           return_type = value_type (return_value);
02396         }
02397       do_cleanups (old_chain);
02398       CHECK_TYPEDEF (return_type);
02399       return_value = value_cast (return_type, return_value);
02400 
02401       /* Make sure the value is fully evaluated.  It may live in the
02402          stack frame we're about to pop.  */
02403       if (value_lazy (return_value))
02404         value_fetch_lazy (return_value);
02405 
02406       if (thisfun != NULL)
02407         function = read_var_value (thisfun, thisframe);
02408 
02409       rv_conv = RETURN_VALUE_REGISTER_CONVENTION;
02410       if (TYPE_CODE (return_type) == TYPE_CODE_VOID)
02411         /* If the return-type is "void", don't try to find the
02412            return-value's location.  However, do still evaluate the
02413            return expression so that, even when the expression result
02414            is discarded, side effects such as "return i++" still
02415            occur.  */
02416         return_value = NULL;
02417       else if (thisfun != NULL)
02418         {
02419           rv_conv = struct_return_convention (gdbarch, function, return_type);
02420           if (rv_conv == RETURN_VALUE_STRUCT_CONVENTION
02421               || rv_conv == RETURN_VALUE_ABI_RETURNS_ADDRESS)
02422             {
02423               query_prefix = "The location at which to store the "
02424                 "function's return value is unknown.\n"
02425                 "If you continue, the return value "
02426                 "that you specified will be ignored.\n";
02427               return_value = NULL;
02428             }
02429         }
02430     }
02431 
02432   /* Does an interactive user really want to do this?  Include
02433      information, such as how well GDB can handle the return value, in
02434      the query message.  */
02435   if (from_tty)
02436     {
02437       int confirmed;
02438 
02439       if (thisfun == NULL)
02440         confirmed = query (_("%sMake selected stack frame return now? "),
02441                            query_prefix);
02442       else
02443         confirmed = query (_("%sMake %s return now? "), query_prefix,
02444                            SYMBOL_PRINT_NAME (thisfun));
02445       if (!confirmed)
02446         error (_("Not confirmed"));
02447     }
02448 
02449   /* Discard the selected frame and all frames inner-to it.  */
02450   frame_pop (get_selected_frame (NULL));
02451 
02452   /* Store RETURN_VALUE in the just-returned register set.  */
02453   if (return_value != NULL)
02454     {
02455       struct type *return_type = value_type (return_value);
02456       struct gdbarch *gdbarch = get_regcache_arch (get_current_regcache ());
02457 
02458       gdb_assert (rv_conv != RETURN_VALUE_STRUCT_CONVENTION
02459                   && rv_conv != RETURN_VALUE_ABI_RETURNS_ADDRESS);
02460       gdbarch_return_value (gdbarch, function, return_type,
02461                             get_current_regcache (), NULL /*read*/,
02462                             value_contents (return_value) /*write*/);
02463     }
02464 
02465   /* If we are at the end of a call dummy now, pop the dummy frame
02466      too.  */
02467   if (get_frame_type (get_current_frame ()) == DUMMY_FRAME)
02468     frame_pop (get_current_frame ());
02469 
02470   /* If interactive, print the frame that is now current.  */
02471   if (from_tty)
02472     frame_command ("0", 1);
02473   else
02474     select_frame_command ("0", 0);
02475 }
02476 
02477 /* Sets the scope to input function name, provided that the function
02478    is within the current stack frame.  */
02479 
02480 struct function_bounds
02481 {
02482   CORE_ADDR low, high;
02483 };
02484 
02485 static void
02486 func_command (char *arg, int from_tty)
02487 {
02488   struct frame_info *frame;
02489   int found = 0;
02490   struct symtabs_and_lines sals;
02491   int i;
02492   int level = 1;
02493   struct function_bounds *func_bounds = NULL;
02494   struct cleanup *cleanups;
02495 
02496   if (arg != NULL)
02497     return;
02498 
02499   frame = parse_frame_specification ("0");
02500   sals = decode_line_with_current_source (arg, DECODE_LINE_FUNFIRSTLINE);
02501   cleanups = make_cleanup (xfree, sals.sals);
02502   func_bounds = (struct function_bounds *) xmalloc (
02503                               sizeof (struct function_bounds) * sals.nelts);
02504   make_cleanup (xfree, func_bounds);
02505   for (i = 0; (i < sals.nelts && !found); i++)
02506     {
02507       if (sals.sals[i].pspace != current_program_space)
02508         func_bounds[i].low = func_bounds[i].high = 0;
02509       else if (sals.sals[i].pc == 0
02510                || find_pc_partial_function (sals.sals[i].pc, NULL,
02511                                             &func_bounds[i].low,
02512                                             &func_bounds[i].high) == 0)
02513         {
02514           func_bounds[i].low = func_bounds[i].high = 0;
02515         }
02516     }
02517 
02518   do
02519     {
02520       for (i = 0; (i < sals.nelts && !found); i++)
02521         found = (get_frame_pc (frame) >= func_bounds[i].low
02522                  && get_frame_pc (frame) < func_bounds[i].high);
02523       if (!found)
02524         {
02525           level = 1;
02526           frame = find_relative_frame (frame, &level);
02527         }
02528     }
02529   while (!found && level == 0);
02530 
02531   do_cleanups (cleanups);
02532 
02533   if (!found)
02534     printf_filtered (_("'%s' not within current stack frame.\n"), arg);
02535   else if (frame != get_selected_frame (NULL))
02536     select_and_print_frame (frame);
02537 }
02538 
02539 /* Gets the language of the current frame.  */
02540 
02541 enum language
02542 get_frame_language (void)
02543 {
02544   struct frame_info *frame = deprecated_safe_get_selected_frame ();
02545 
02546   if (frame)
02547     {
02548       volatile struct gdb_exception ex;
02549       CORE_ADDR pc = 0;
02550       struct symtab *s;
02551 
02552       /* We determine the current frame language by looking up its
02553          associated symtab.  To retrieve this symtab, we use the frame
02554          PC.  However we cannot use the frame PC as is, because it
02555          usually points to the instruction following the "call", which
02556          is sometimes the first instruction of another function.  So
02557          we rely on get_frame_address_in_block(), it provides us with
02558          a PC that is guaranteed to be inside the frame's code
02559          block.  */
02560 
02561       TRY_CATCH (ex, RETURN_MASK_ERROR)
02562         {
02563           pc = get_frame_address_in_block (frame);
02564         }
02565       if (ex.reason < 0)
02566         {
02567           if (ex.error != NOT_AVAILABLE_ERROR)
02568             throw_exception (ex);
02569         }
02570       else
02571         {
02572           s = find_pc_symtab (pc);
02573           if (s != NULL)
02574             return s->language;
02575         }
02576     }
02577 
02578   return language_unknown;
02579 }
02580 
02581 
02582 /* Provide a prototype to silence -Wmissing-prototypes.  */
02583 void _initialize_stack (void);
02584 
02585 void
02586 _initialize_stack (void)
02587 {
02588   add_com ("return", class_stack, return_command, _("\
02589 Make selected stack frame return to its caller.\n\
02590 Control remains in the debugger, but when you continue\n\
02591 execution will resume in the frame above the one now selected.\n\
02592 If an argument is given, it is an expression for the value to return."));
02593 
02594   add_com ("up", class_stack, up_command, _("\
02595 Select and print stack frame that called this one.\n\
02596 An argument says how many frames up to go."));
02597   add_com ("up-silently", class_support, up_silently_command, _("\
02598 Same as the `up' command, but does not print anything.\n\
02599 This is useful in command scripts."));
02600 
02601   add_com ("down", class_stack, down_command, _("\
02602 Select and print stack frame called by this one.\n\
02603 An argument says how many frames down to go."));
02604   add_com_alias ("do", "down", class_stack, 1);
02605   add_com_alias ("dow", "down", class_stack, 1);
02606   add_com ("down-silently", class_support, down_silently_command, _("\
02607 Same as the `down' command, but does not print anything.\n\
02608 This is useful in command scripts."));
02609 
02610   add_com ("frame", class_stack, frame_command, _("\
02611 Select and print a stack frame.\nWith no argument, \
02612 print the selected stack frame.  (See also \"info frame\").\n\
02613 An argument specifies the frame to select.\n\
02614 It can be a stack frame number or the address of the frame.\n\
02615 With argument, nothing is printed if input is coming from\n\
02616 a command file or a user-defined command."));
02617 
02618   add_com_alias ("f", "frame", class_stack, 1);
02619 
02620   if (xdb_commands)
02621     {
02622       add_com ("L", class_stack, current_frame_command,
02623                _("Print the current stack frame.\n"));
02624       add_com_alias ("V", "frame", class_stack, 1);
02625     }
02626   add_com ("select-frame", class_stack, select_frame_command, _("\
02627 Select a stack frame without printing anything.\n\
02628 An argument specifies the frame to select.\n\
02629 It can be a stack frame number or the address of the frame.\n"));
02630 
02631   add_com ("backtrace", class_stack, backtrace_command, _("\
02632 Print backtrace of all stack frames, or innermost COUNT frames.\n\
02633 With a negative argument, print outermost -COUNT frames.\nUse of the \
02634 'full' qualifier also prints the values of the local variables.\n\
02635 Use of the 'no-filters' qualifier prohibits frame filters from executing\n\
02636 on this backtrace.\n"));
02637   add_com_alias ("bt", "backtrace", class_stack, 0);
02638   if (xdb_commands)
02639     {
02640       add_com_alias ("t", "backtrace", class_stack, 0);
02641       add_com ("T", class_stack, backtrace_full_command, _("\
02642 Print backtrace of all stack frames, or innermost COUNT frames\n\
02643 and the values of the local variables.\n\
02644 With a negative argument, print outermost -COUNT frames.\n\
02645 Usage: T <count>\n"));
02646     }
02647 
02648   add_com_alias ("where", "backtrace", class_alias, 0);
02649   add_info ("stack", backtrace_command,
02650             _("Backtrace of the stack, or innermost COUNT frames."));
02651   add_info_alias ("s", "stack", 1);
02652   add_info ("frame", frame_info,
02653             _("All about selected stack frame, or frame at ADDR."));
02654   add_info_alias ("f", "frame", 1);
02655   add_info ("locals", locals_info,
02656             _("Local variables of current stack frame."));
02657   add_info ("args", args_info,
02658             _("Argument variables of current stack frame."));
02659   if (xdb_commands)
02660     add_com ("l", class_info, args_plus_locals_info,
02661              _("Argument and local variables of current stack frame."));
02662 
02663   if (dbx_commands)
02664     add_com ("func", class_stack, func_command, _("\
02665 Select the stack frame that contains <func>.\n\
02666 Usage: func <name>\n"));
02667 
02668   add_setshow_enum_cmd ("frame-arguments", class_stack,
02669                         print_frame_arguments_choices, &print_frame_arguments,
02670                         _("Set printing of non-scalar frame arguments"),
02671                         _("Show printing of non-scalar frame arguments"),
02672                         NULL, NULL, NULL, &setprintlist, &showprintlist);
02673 
02674   add_setshow_boolean_cmd ("frame-arguments", no_class,
02675                            &print_raw_frame_arguments, _("\
02676 Set whether to print frame arguments in raw form."), _("\
02677 Show whether to print frame arguments in raw form."), _("\
02678 If set, frame arguments are printed in raw form, bypassing any\n\
02679 pretty-printers for that value."),
02680                            NULL, NULL,
02681                            &setprintrawlist, &showprintrawlist);
02682 
02683   add_setshow_auto_boolean_cmd ("disassemble-next-line", class_stack,
02684                                 &disassemble_next_line, _("\
02685 Set whether to disassemble next source line or insn when execution stops."),
02686                                 _("\
02687 Show whether to disassemble next source line or insn when execution stops."),
02688                                 _("\
02689 If ON, GDB will display disassembly of the next source line, in addition\n\
02690 to displaying the source line itself.  If the next source line cannot\n\
02691 be displayed (e.g., source is unavailable or there's no line info), GDB\n\
02692 will display disassembly of next instruction instead of showing the\n\
02693 source line.\n\
02694 If AUTO, display disassembly of next instruction only if the source line\n\
02695 cannot be displayed.\n\
02696 If OFF (which is the default), never display the disassembly of the next\n\
02697 source line."),
02698                                 NULL,
02699                                 show_disassemble_next_line,
02700                                 &setlist, &showlist);
02701   disassemble_next_line = AUTO_BOOLEAN_FALSE;
02702 
02703   add_setshow_enum_cmd ("entry-values", class_stack,
02704                         print_entry_values_choices, &print_entry_values,
02705                         _("Set printing of function arguments at function "
02706                           "entry"),
02707                         _("Show printing of function arguments at function "
02708                           "entry"),
02709                         _("\
02710 GDB can sometimes determine the values of function arguments at entry,\n\
02711 in addition to their current values.  This option tells GDB whether\n\
02712 to print the current value, the value at entry (marked as val@entry),\n\
02713 or both.  Note that one or both of these values may be <optimized out>."),
02714                         NULL, NULL, &setprintlist, &showprintlist);
02715 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines