1 /* Print and select stack frames for GDB, the GNU debugger.
3 Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
4 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software
7 This file is part of GDB.
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 59 Temple Place - Suite 330,
22 Boston, MA 02111-1307, USA. */
26 #include "gdb_string.h"
30 #include "expression.h"
37 #include "breakpoint.h"
43 /* Prototypes for exported functions. */
45 void args_info (char *, int);
47 void locals_info (char *, int);
49 void (*selected_frame_level_changed_hook
) (int);
51 void _initialize_stack (void);
53 void return_command (char *, int);
55 /* Prototypes for local functions. */
57 static void down_command (char *, int);
59 static void down_silently_base (char *);
61 static void down_silently_command (char *, int);
63 static void up_command (char *, int);
65 static void up_silently_base (char *);
67 static void up_silently_command (char *, int);
69 void frame_command (char *, int);
71 static void current_frame_command (char *, int);
73 static void select_frame_command (char *, int);
75 static void print_frame_arg_vars (struct frame_info
*, struct ui_file
*);
77 static void catch_info (char *, int);
79 static void args_plus_locals_info (char *, int);
81 static void print_frame_label_vars (struct frame_info
*, int,
84 static void print_frame_local_vars (struct frame_info
*, int,
87 static int print_block_frame_labels (struct block
*, int *,
90 static int print_block_frame_locals (struct block
*,
95 static void print_frame (struct frame_info
*fi
,
99 struct symtab_and_line sal
);
101 static void backtrace_command (char *, int);
103 struct frame_info
*parse_frame_specification (char *);
105 static void frame_info (char *, int);
107 extern int addressprint
; /* Print addresses, or stay symbolic only? */
109 /* Zero means do things normally; we are interacting directly with the
110 user. One means print the full filename and linenumber when a
111 frame is printed, and do so in a format emacs18/emacs19.22 can
112 parse. Two means print similar annotations, but in many more
113 cases and in a slightly different syntax. */
115 int annotation_level
= 0;
118 struct print_stack_frame_args
120 struct frame_info
*fi
;
126 /* Show or print the frame arguments.
127 Pass the args the way catch_errors wants them. */
128 static int print_stack_frame_stub (void *args
);
130 print_stack_frame_stub (void *args
)
132 struct print_stack_frame_args
*p
= (struct print_stack_frame_args
*) args
;
134 print_frame_info (p
->fi
, p
->level
, p
->source
, p
->args
);
138 /* Show or print a stack frame briefly. FRAME_INFI should be the frame info
139 and LEVEL should be its level in the stack (or -1 for level not defined).
140 This prints the level, the function executing, the arguments,
141 and the file name and line number.
142 If the pc is not at the beginning of the source line,
143 the actual pc is printed at the beginning.
145 If SOURCE is 1, print the source line as well.
146 If SOURCE is -1, print ONLY the source line. */
149 print_stack_frame (struct frame_info
*fi
, int level
, int source
)
151 struct print_stack_frame_args args
;
155 args
.source
= source
;
158 catch_errors (print_stack_frame_stub
, (char *) &args
, "", RETURN_MASK_ALL
);
161 struct print_args_args
164 struct frame_info
*fi
;
165 struct ui_file
*stream
;
168 static int print_args_stub (void *);
170 /* Pass the args the way catch_errors wants them. */
173 print_args_stub (void *args
)
176 struct print_args_args
*p
= (struct print_args_args
*) args
;
178 numargs
= FRAME_NUM_ARGS (p
->fi
);
179 print_frame_args (p
->func
, p
->fi
, numargs
, p
->stream
);
183 /* Print information about a frame for frame "fi" at level "level".
184 Used in "where" output, also used to emit breakpoint or step
186 LEVEL is the level of the frame, or -1 if it is the
187 innermost frame but we don't want to print the level.
188 The meaning of the SOURCE argument is:
189 SRC_LINE: Print only source line
190 LOCATION: Print only location
191 LOC_AND_SRC: Print location and source line. */
194 print_frame_info (struct frame_info
*fi
, int level
, int source
, int args
)
196 struct symtab_and_line sal
;
200 if (get_frame_type (fi
) == DUMMY_FRAME
)
202 annotate_frame_begin (level
== -1 ? 0 : level
, get_frame_pc (fi
));
204 /* Do this regardless of SOURCE because we don't have any source
205 to list for this frame. */
208 ui_out_text (uiout
, "#");
209 ui_out_field_fmt_int (uiout
, 2, ui_left
, "level", level
);
211 annotate_function_call ();
212 printf_filtered ("<function called from gdb>\n");
213 annotate_frame_end ();
216 if ((get_frame_type (fi
) == SIGTRAMP_FRAME
))
218 annotate_frame_begin (level
== -1 ? 0 : level
, get_frame_pc (fi
));
220 /* Do this regardless of SOURCE because we don't have any source
221 to list for this frame. */
224 ui_out_text (uiout
, "#");
225 ui_out_field_fmt_int (uiout
, 2, ui_left
, "level", level
);
227 annotate_signal_handler_caller ();
228 printf_filtered ("<signal handler called>\n");
229 annotate_frame_end ();
233 /* If fi is not the innermost frame, that normally means that fi->pc
234 points to *after* the call instruction, and we want to get the
235 line containing the call, never the next line. But if the next
236 frame is a SIGTRAMP_FRAME or a DUMMY_FRAME, then the next frame
237 was not entered as the result of a call, and we want to get the
238 line containing fi->pc. */
239 find_frame_sal (fi
, &sal
);
241 location_print
= (source
== LOCATION
242 || source
== LOC_AND_ADDRESS
243 || source
== SRC_AND_LOC
);
245 if (location_print
|| !sal
.symtab
)
246 print_frame (fi
, level
, source
, args
, sal
);
248 source_print
= (source
== SRC_LINE
|| source
== SRC_AND_LOC
);
251 set_current_source_symtab_and_line (&sal
);
253 if (source_print
&& sal
.symtab
)
255 struct symtab_and_line cursal
;
257 int mid_statement
= (source
== SRC_LINE
) && (get_frame_pc (fi
) != sal
.pc
);
259 if (annotation_level
)
260 done
= identify_source_line (sal
.symtab
, sal
.line
, mid_statement
,
264 if (print_frame_info_listing_hook
)
265 print_frame_info_listing_hook (sal
.symtab
, sal
.line
, sal
.line
+ 1, 0);
268 /* We used to do this earlier, but that is clearly
269 wrong. This function is used by many different
270 parts of gdb, including normal_stop in infrun.c,
271 which uses this to print out the current PC
272 when we stepi/nexti into the middle of a source
273 line. Only the command line really wants this
274 behavior. Other UIs probably would like the
275 ability to decide for themselves if it is desired. */
276 if (addressprint
&& mid_statement
)
278 ui_out_field_core_addr (uiout
, "addr", get_frame_pc (fi
));
279 ui_out_text (uiout
, "\t");
282 print_source_lines (sal
.symtab
, sal
.line
, sal
.line
+ 1, 0);
285 /* Make sure we have at least a default source file */
286 set_default_source_symtab_and_line ();
287 cursal
= get_current_source_symtab_and_line ();
288 cursal
.line
= max (sal
.line
- get_lines_to_list () / 2, 1);
289 set_current_source_symtab_and_line (&cursal
);
293 set_default_breakpoint (1, get_frame_pc (fi
), sal
.symtab
, sal
.line
);
295 annotate_frame_end ();
297 gdb_flush (gdb_stdout
);
301 print_frame (struct frame_info
*fi
,
305 struct symtab_and_line sal
)
308 register char *funname
= 0;
309 enum language funlang
= language_unknown
;
310 struct ui_stream
*stb
;
311 struct cleanup
*old_chain
;
312 struct cleanup
*list_chain
;
314 stb
= ui_out_stream_new (uiout
);
315 old_chain
= make_cleanup_ui_out_stream_delete (stb
);
317 func
= find_pc_function (frame_address_in_block (fi
));
320 /* In certain pathological cases, the symtabs give the wrong
321 function (when we are in the first function in a file which
322 is compiled without debugging symbols, the previous function
323 is compiled with debugging symbols, and the "foo.o" symbol
324 that is supposed to tell us where the file with debugging symbols
325 ends has been truncated by ar because it is longer than 15
326 characters). This also occurs if the user uses asm() to create
327 a function but not stabs for it (in a file compiled -g).
329 So look in the minimal symbol tables as well, and if it comes
330 up with a larger address for the function use that instead.
331 I don't think this can ever cause any problems; there shouldn't
332 be any minimal symbols in the middle of a function; if this is
333 ever changed many parts of GDB will need to be changed (and we'll
334 create a find_pc_minimal_function or some such). */
336 struct minimal_symbol
*msymbol
= lookup_minimal_symbol_by_pc (frame_address_in_block (fi
));
338 && (SYMBOL_VALUE_ADDRESS (msymbol
)
339 > BLOCK_START (SYMBOL_BLOCK_VALUE (func
))))
342 /* There is no particular reason to think the line number
343 information is wrong. Someone might have just put in
344 a label with asm() but left the line numbers alone. */
345 /* In this case we have no way of knowing the source file
346 and line number, so don't print them. */
349 /* We also don't know anything about the function besides
350 its address and name. */
352 funname
= SYMBOL_NAME (msymbol
);
353 funlang
= SYMBOL_LANGUAGE (msymbol
);
357 /* I'd like to use SYMBOL_SOURCE_NAME() here, to display the
358 demangled name that we already have stored in the symbol
359 table, but we stored a version with DMGL_PARAMS turned
360 on, and here we don't want to display parameters. So call
361 the demangler again, with DMGL_ANSI only. (Yes, I know
362 that printf_symbol_filtered() will again try to demangle
363 the name on the fly, but the issue is that if
364 cplus_demangle() fails here, it'll fail there too. So we
365 want to catch the failure ("demangled==NULL" case below)
366 here, while we still have our hands on the function
369 funname
= SYMBOL_NAME (func
);
370 funlang
= SYMBOL_LANGUAGE (func
);
371 if (funlang
== language_cplus
)
373 demangled
= cplus_demangle (funname
, DMGL_ANSI
);
374 if (demangled
== NULL
)
375 /* If the demangler fails, try the demangled name from
376 the symbol table. This'll have parameters, but
377 that's preferable to diplaying a mangled name. */
378 funname
= SYMBOL_SOURCE_NAME (func
);
384 struct minimal_symbol
*msymbol
= lookup_minimal_symbol_by_pc (frame_address_in_block (fi
));
387 funname
= SYMBOL_NAME (msymbol
);
388 funlang
= SYMBOL_LANGUAGE (msymbol
);
392 annotate_frame_begin (level
== -1 ? 0 : level
, get_frame_pc (fi
));
394 list_chain
= make_cleanup_ui_out_tuple_begin_end (uiout
, "frame");
398 ui_out_text (uiout
, "#");
399 ui_out_field_fmt_int (uiout
, 2, ui_left
, "level", level
);
402 if (get_frame_pc (fi
) != sal
.pc
404 || source
== LOC_AND_ADDRESS
)
406 annotate_frame_address ();
407 ui_out_field_core_addr (uiout
, "addr", get_frame_pc (fi
));
408 annotate_frame_address_end ();
409 ui_out_text (uiout
, " in ");
411 annotate_frame_function_name ();
412 fprintf_symbol_filtered (stb
->stream
, funname
? funname
: "??", funlang
,
414 ui_out_field_stream (uiout
, "func", stb
);
415 ui_out_wrap_hint (uiout
, " ");
416 annotate_frame_args ();
418 ui_out_text (uiout
, " (");
421 struct print_args_args args
;
422 struct cleanup
*args_list_chain
;
425 args
.stream
= gdb_stdout
;
426 args_list_chain
= make_cleanup_ui_out_list_begin_end (uiout
, "args");
427 catch_errors (print_args_stub
, &args
, "", RETURN_MASK_ALL
);
428 /* FIXME: args must be a list. If one argument is a string it will
429 have " that will not be properly escaped. */
430 /* Invoke ui_out_tuple_end. */
431 do_cleanups (args_list_chain
);
434 ui_out_text (uiout
, ")");
435 if (sal
.symtab
&& sal
.symtab
->filename
)
437 annotate_frame_source_begin ();
438 ui_out_wrap_hint (uiout
, " ");
439 ui_out_text (uiout
, " at ");
440 annotate_frame_source_file ();
441 ui_out_field_string (uiout
, "file", sal
.symtab
->filename
);
442 annotate_frame_source_file_end ();
443 ui_out_text (uiout
, ":");
444 annotate_frame_source_line ();
445 ui_out_field_int (uiout
, "line", sal
.line
);
446 annotate_frame_source_end ();
450 if (!funname
|| (!sal
.symtab
|| !sal
.symtab
->filename
))
452 char *lib
= PC_SOLIB (get_frame_pc (fi
));
455 annotate_frame_where ();
456 ui_out_wrap_hint (uiout
, " ");
457 ui_out_text (uiout
, " from ");
458 ui_out_field_string (uiout
, "from", lib
);
461 #endif /* PC_SOLIB */
463 /* do_cleanups will call ui_out_tuple_end() for us. */
464 do_cleanups (list_chain
);
465 ui_out_text (uiout
, "\n");
466 do_cleanups (old_chain
);
469 /* Show the frame info. If this is the tui, it will be shown in
470 the source display otherwise, nothing is done */
472 show_stack_frame (struct frame_info
*fi
)
477 /* Read a frame specification in whatever the appropriate format is.
478 Call error() if the specification is in any way invalid (i.e.
479 this function never returns NULL). */
482 parse_frame_specification (char *frame_exp
)
486 CORE_ADDR args
[MAXARGS
];
491 char *addr_string
, *p
;
492 struct cleanup
*tmp_cleanup
;
494 while (*frame_exp
== ' ')
499 if (numargs
> MAXARGS
)
500 error ("Too many args in frame specification");
501 /* Parse an argument. */
502 for (p
= frame_exp
; *p
&& *p
!= ' '; p
++)
504 addr_string
= savestring (frame_exp
, p
- frame_exp
);
509 tmp_cleanup
= make_cleanup (xfree
, addr_string
);
511 /* NOTE: we call parse_and_eval and then both
512 value_as_long and value_as_address rather than calling
513 parse_and_eval_long and parse_and_eval_address because
514 of the issue of potential side effects from evaluating
516 vp
= parse_and_eval (addr_string
);
518 level
= value_as_long (vp
);
520 args
[numargs
++] = value_as_address (vp
);
521 do_cleanups (tmp_cleanup
);
524 /* Skip spaces, move to possible next arg. */
534 if (deprecated_selected_frame
== NULL
)
535 error ("No selected frame.");
536 return deprecated_selected_frame
;
540 struct frame_info
*fid
=
541 find_relative_frame (get_current_frame (), &level
);
542 struct frame_info
*tfid
;
545 /* find_relative_frame was successful */
548 /* If SETUP_ARBITRARY_FRAME is defined, then frame specifications
549 take at least 2 addresses. It is important to detect this case
550 here so that "frame 100" does not give a confusing error message
551 like "frame specification requires two addresses". This of course
552 does not solve the "frame 100" problem for machines on which
553 a frame specification can be made with one address. To solve
554 that, we need a new syntax for a specifying a frame by address.
555 I think the cleanest syntax is $frame(0x45) ($frame(0x23,0x45) for
556 two args, etc.), but people might think that is too much typing,
557 so I guess *0x23,0x45 would be a possible alternative (commas
558 really should be used instead of spaces to delimit; using spaces
559 normally works in an expression). */
560 #ifdef SETUP_ARBITRARY_FRAME
561 error ("No frame %s", paddr_d (args
[0]));
564 /* If (s)he specifies the frame with an address, he deserves what
565 (s)he gets. Still, give the highest one that matches. */
567 for (fid
= get_current_frame ();
568 fid
&& get_frame_base (fid
) != args
[0];
569 fid
= get_prev_frame (fid
))
573 while ((tfid
= get_prev_frame (fid
)) &&
574 (get_frame_base (tfid
) == args
[0]))
577 /* We couldn't identify the frame as an existing frame, but
578 perhaps we can create one with a single argument. */
582 #ifdef SETUP_ARBITRARY_FRAME
583 return SETUP_ARBITRARY_FRAME (numargs
, args
);
585 /* Usual case. Do it here rather than have everyone supply
586 a SETUP_ARBITRARY_FRAME that does this. */
588 return create_new_frame (args
[0], 0);
589 error ("Too many args in frame specification");
596 /* FRAME_ARGS_ADDRESS_CORRECT is just like FRAME_ARGS_ADDRESS except
597 that if it is unsure about the answer, it returns 0
598 instead of guessing (this happens on the VAX and i960, for example).
600 On most machines, we never have to guess about the args address,
601 so FRAME_ARGS_ADDRESS{,_CORRECT} are the same. */
602 #if !defined (FRAME_ARGS_ADDRESS_CORRECT)
603 #define FRAME_ARGS_ADDRESS_CORRECT FRAME_ARGS_ADDRESS
606 /* Print verbosely the selected frame or the frame at address ADDR.
607 This means absolutely all information in the frame is printed. */
610 frame_info (char *addr_exp
, int from_tty
)
612 struct frame_info
*fi
;
613 struct symtab_and_line sal
;
616 struct frame_info
*calling_frame_info
;
617 int i
, count
, numregs
;
619 enum language funlang
= language_unknown
;
621 if (!target_has_stack
)
624 fi
= parse_frame_specification (addr_exp
);
626 error ("Invalid frame specified.");
628 find_frame_sal (fi
, &sal
);
629 func
= get_frame_function (fi
);
630 /* FIXME: cagney/2002-11-28: Why bother? Won't sal.symtab contain
632 s
= find_pc_symtab (get_frame_pc (fi
));
635 /* I'd like to use SYMBOL_SOURCE_NAME() here, to display
636 * the demangled name that we already have stored in
637 * the symbol table, but we stored a version with
638 * DMGL_PARAMS turned on, and here we don't want
639 * to display parameters. So call the demangler again,
640 * with DMGL_ANSI only. RT
641 * (Yes, I know that printf_symbol_filtered() will
642 * again try to demangle the name on the fly, but
643 * the issue is that if cplus_demangle() fails here,
644 * it'll fail there too. So we want to catch the failure
645 * ("demangled==NULL" case below) here, while we still
646 * have our hands on the function symbol.)
649 funname
= SYMBOL_NAME (func
);
650 funlang
= SYMBOL_LANGUAGE (func
);
651 if (funlang
== language_cplus
)
653 demangled
= cplus_demangle (funname
, DMGL_ANSI
);
654 /* If the demangler fails, try the demangled name
655 * from the symbol table. This'll have parameters,
656 * but that's preferable to diplaying a mangled name.
658 if (demangled
== NULL
)
659 funname
= SYMBOL_SOURCE_NAME (func
);
664 register struct minimal_symbol
*msymbol
= lookup_minimal_symbol_by_pc (get_frame_pc (fi
));
667 funname
= SYMBOL_NAME (msymbol
);
668 funlang
= SYMBOL_LANGUAGE (msymbol
);
671 calling_frame_info
= get_prev_frame (fi
);
673 if (!addr_exp
&& frame_relative_level (deprecated_selected_frame
) >= 0)
675 printf_filtered ("Stack level %d, frame at ",
676 frame_relative_level (deprecated_selected_frame
));
677 print_address_numeric (get_frame_base (fi
), 1, gdb_stdout
);
678 printf_filtered (":\n");
682 printf_filtered ("Stack frame at ");
683 print_address_numeric (get_frame_base (fi
), 1, gdb_stdout
);
684 printf_filtered (":\n");
686 printf_filtered (" %s = ", REGISTER_NAME (PC_REGNUM
));
687 print_address_numeric (get_frame_pc (fi
), 1, gdb_stdout
);
692 printf_filtered (" in ");
693 fprintf_symbol_filtered (gdb_stdout
, funname
, funlang
,
694 DMGL_ANSI
| DMGL_PARAMS
);
698 printf_filtered (" (%s:%d)", sal
.symtab
->filename
, sal
.line
);
699 puts_filtered ("; ");
701 printf_filtered ("saved %s ", REGISTER_NAME (PC_REGNUM
));
702 print_address_numeric (frame_pc_unwind (fi
), 1, gdb_stdout
);
703 printf_filtered ("\n");
707 frameless
= FRAMELESS_FUNCTION_INVOCATION (fi
);
709 printf_filtered (" (FRAMELESS),");
712 if (calling_frame_info
)
714 printf_filtered (" called by frame at ");
715 print_address_numeric (get_frame_base (calling_frame_info
),
718 if (get_next_frame (fi
) && calling_frame_info
)
721 if (get_next_frame (fi
))
723 printf_filtered (" caller of frame at ");
724 print_address_numeric (get_frame_base (get_next_frame (fi
)), 1,
727 if (get_next_frame (fi
) || calling_frame_info
)
728 puts_filtered ("\n");
730 printf_filtered (" source language %s.\n",
731 language_str (s
->language
));
733 #ifdef PRINT_EXTRA_FRAME_INFO
734 PRINT_EXTRA_FRAME_INFO (fi
);
738 /* Address of the argument list for this frame, or 0. */
739 CORE_ADDR arg_list
= FRAME_ARGS_ADDRESS_CORRECT (fi
);
740 /* Number of args for this frame, or -1 if unknown. */
744 printf_filtered (" Arglist at unknown address.\n");
747 printf_filtered (" Arglist at ");
748 print_address_numeric (arg_list
, 1, gdb_stdout
);
749 printf_filtered (",");
751 numargs
= FRAME_NUM_ARGS (fi
);
753 puts_filtered (" args: ");
754 else if (numargs
== 0)
755 puts_filtered (" no args.");
756 else if (numargs
== 1)
757 puts_filtered (" 1 arg: ");
759 printf_filtered (" %d args: ", numargs
);
760 print_frame_args (func
, fi
, numargs
, gdb_stdout
);
761 puts_filtered ("\n");
765 /* Address of the local variables for this frame, or 0. */
766 CORE_ADDR arg_list
= FRAME_LOCALS_ADDRESS (fi
);
769 printf_filtered (" Locals at unknown address,");
772 printf_filtered (" Locals at ");
773 print_address_numeric (arg_list
, 1, gdb_stdout
);
774 printf_filtered (",");
778 if (FRAME_INIT_SAVED_REGS_P ()
779 && get_frame_saved_regs (fi
) == NULL
)
780 FRAME_INIT_SAVED_REGS (fi
);
781 /* Print as much information as possible on the location of all the
792 /* The sp is special; what's displayed isn't the save address, but
793 the value of the previous frame's sp. This is a legacy thing,
794 at one stage the frame cached the previous frame's SP instead
795 of its address, hence it was easiest to just display the cached
799 /* Find out the location of the saved stack pointer with out
800 actually evaluating it. */
801 frame_register_unwind (fi
, SP_REGNUM
, &optimized
, &lval
, &addr
,
803 if (!optimized
&& lval
== not_lval
)
805 void *value
= alloca (MAX_REGISTER_RAW_SIZE
);
807 frame_register_unwind (fi
, SP_REGNUM
, &optimized
, &lval
, &addr
,
809 sp
= extract_address (value
, REGISTER_RAW_SIZE (SP_REGNUM
));
810 printf_filtered (" Previous frame's sp is ");
811 print_address_numeric (sp
, 1, gdb_stdout
);
812 printf_filtered ("\n");
815 else if (!optimized
&& lval
== lval_memory
)
817 printf_filtered (" Previous frame's sp at ");
818 print_address_numeric (addr
, 1, gdb_stdout
);
819 printf_filtered ("\n");
822 else if (!optimized
&& lval
== lval_register
)
824 printf_filtered (" Previous frame's sp in %s\n",
825 REGISTER_NAME (realnum
));
828 /* else keep quiet. */
832 numregs
= NUM_REGS
+ NUM_PSEUDO_REGS
;
833 for (i
= 0; i
< numregs
; i
++)
836 /* Find out the location of the saved register without
837 fetching the corresponding value. */
838 frame_register_unwind (fi
, i
, &optimized
, &lval
, &addr
, &realnum
,
840 /* For moment, only display registers that were saved on the
842 if (!optimized
&& lval
== lval_memory
)
845 puts_filtered (" Saved registers:\n ");
849 printf_filtered (" %s at ", REGISTER_NAME (i
));
850 print_address_numeric (addr
, 1, gdb_stdout
);
854 if (count
|| need_nl
)
855 puts_filtered ("\n");
860 /* Set a limit on the number of frames printed by default in a
863 static int backtrace_limit
;
866 set_backtrace_limit_command (char *count_exp
, int from_tty
)
868 int count
= parse_and_eval_long (count_exp
);
871 error ("Negative argument not meaningful as backtrace limit.");
873 backtrace_limit
= count
;
877 backtrace_limit_info (char *arg
, int from_tty
)
880 error ("\"Info backtrace-limit\" takes no arguments.");
882 printf_unfiltered ("Backtrace limit: %d.\n", backtrace_limit
);
886 /* Print briefly all stack frames or just the innermost COUNT frames. */
888 static void backtrace_command_1 (char *count_exp
, int show_locals
,
891 backtrace_command_1 (char *count_exp
, int show_locals
, int from_tty
)
893 struct frame_info
*fi
;
896 register struct frame_info
*trailing
;
897 register int trailing_level
;
899 if (!target_has_stack
)
902 /* The following code must do two things. First, it must
903 set the variable TRAILING to the frame from which we should start
904 printing. Second, it must set the variable count to the number
905 of frames which we should print, or -1 if all of them. */
906 trailing
= get_current_frame ();
908 /* The target can be in a state where there is no valid frames
909 (e.g., just connected). */
910 if (trailing
== NULL
)
916 count
= parse_and_eval_long (count_exp
);
919 struct frame_info
*current
;
924 while (current
&& count
--)
927 current
= get_prev_frame (current
);
930 /* Will stop when CURRENT reaches the top of the stack. TRAILING
931 will be COUNT below it. */
935 trailing
= get_prev_frame (trailing
);
936 current
= get_prev_frame (current
);
948 struct partial_symtab
*ps
;
950 /* Read in symbols for all of the frames. Need to do this in
951 a separate pass so that "Reading in symbols for xxx" messages
952 don't screw up the appearance of the backtrace. Also
953 if people have strong opinions against reading symbols for
954 backtrace this may have to be an option. */
958 fi
= get_prev_frame (fi
))
961 ps
= find_pc_psymtab (frame_address_in_block (fi
));
963 PSYMTAB_TO_SYMTAB (ps
); /* Force syms to come in */
967 for (i
= 0, fi
= trailing
;
969 i
++, fi
= get_prev_frame (fi
))
973 /* Don't use print_stack_frame; if an error() occurs it probably
974 means further attempts to backtrace would fail (on the other
975 hand, perhaps the code does or could be fixed to make sure
976 the frame->prev field gets set to NULL in that case). */
977 print_frame_info (fi
, trailing_level
+ i
, 0, 1);
979 print_frame_local_vars (fi
, 1, gdb_stdout
);
982 /* If we've stopped before the end, mention that. */
984 printf_filtered ("(More stack frames follow...)\n");
988 backtrace_command (char *arg
, int from_tty
)
990 struct cleanup
*old_chain
= (struct cleanup
*) NULL
;
991 char **argv
= (char **) NULL
;
992 int argIndicatingFullTrace
= (-1), totArgLen
= 0, argc
= 0;
995 if (arg
!= (char *) NULL
)
999 argv
= buildargv (arg
);
1000 old_chain
= make_cleanup_freeargv (argv
);
1002 for (i
= 0; (argv
[i
] != (char *) NULL
); i
++)
1006 for (j
= 0; (j
< strlen (argv
[i
])); j
++)
1007 argv
[i
][j
] = tolower (argv
[i
][j
]);
1009 if (argIndicatingFullTrace
< 0 && subset_compare (argv
[i
], "full"))
1010 argIndicatingFullTrace
= argc
;
1014 totArgLen
+= strlen (argv
[i
]);
1018 if (argIndicatingFullTrace
>= 0)
1022 argPtr
= (char *) xmalloc (totArgLen
+ 1);
1027 memset (argPtr
, 0, totArgLen
+ 1);
1028 for (i
= 0; (i
< (argc
+ 1)); i
++)
1030 if (i
!= argIndicatingFullTrace
)
1032 strcat (argPtr
, argv
[i
]);
1033 strcat (argPtr
, " ");
1039 argPtr
= (char *) NULL
;
1043 backtrace_command_1 (argPtr
, (argIndicatingFullTrace
>= 0), from_tty
);
1045 if (argIndicatingFullTrace
>= 0 && totArgLen
> 0)
1049 do_cleanups (old_chain
);
1052 static void backtrace_full_command (char *arg
, int from_tty
);
1054 backtrace_full_command (char *arg
, int from_tty
)
1056 backtrace_command_1 (arg
, 1, from_tty
);
1060 /* Print the local variables of a block B active in FRAME.
1061 Return 1 if any variables were printed; 0 otherwise. */
1064 print_block_frame_locals (struct block
*b
, register struct frame_info
*fi
,
1065 int num_tabs
, register struct ui_file
*stream
)
1068 register struct symbol
*sym
;
1069 register int values_printed
= 0;
1071 ALL_BLOCK_SYMBOLS (b
, i
, sym
)
1073 switch (SYMBOL_CLASS (sym
))
1080 for (j
= 0; j
< num_tabs
; j
++)
1081 fputs_filtered ("\t", stream
);
1082 fputs_filtered (SYMBOL_SOURCE_NAME (sym
), stream
);
1083 fputs_filtered (" = ", stream
);
1084 print_variable_value (sym
, fi
, stream
);
1085 fprintf_filtered (stream
, "\n");
1089 /* Ignore symbols which are not locals. */
1093 return values_printed
;
1096 /* Same, but print labels. */
1099 print_block_frame_labels (struct block
*b
, int *have_default
,
1100 register struct ui_file
*stream
)
1103 register struct symbol
*sym
;
1104 register int values_printed
= 0;
1106 ALL_BLOCK_SYMBOLS (b
, i
, sym
)
1108 if (STREQ (SYMBOL_NAME (sym
), "default"))
1114 if (SYMBOL_CLASS (sym
) == LOC_LABEL
)
1116 struct symtab_and_line sal
;
1117 sal
= find_pc_line (SYMBOL_VALUE_ADDRESS (sym
), 0);
1119 fputs_filtered (SYMBOL_SOURCE_NAME (sym
), stream
);
1122 fprintf_filtered (stream
, " ");
1123 print_address_numeric (SYMBOL_VALUE_ADDRESS (sym
), 1, stream
);
1125 fprintf_filtered (stream
, " in file %s, line %d\n",
1126 sal
.symtab
->filename
, sal
.line
);
1129 return values_printed
;
1132 /* Print on STREAM all the local variables in frame FRAME,
1133 including all the blocks active in that frame
1136 Returns 1 if the job was done,
1137 or 0 if nothing was printed because we have no info
1138 on the function running in FRAME. */
1141 print_frame_local_vars (register struct frame_info
*fi
, register int num_tabs
,
1142 register struct ui_file
*stream
)
1144 register struct block
*block
= get_frame_block (fi
, 0);
1145 register int values_printed
= 0;
1149 fprintf_filtered (stream
, "No symbol table info available.\n");
1155 if (print_block_frame_locals (block
, fi
, num_tabs
, stream
))
1157 /* After handling the function's top-level block, stop.
1158 Don't continue to its superblock, the block of
1159 per-file symbols. */
1160 if (BLOCK_FUNCTION (block
))
1162 block
= BLOCK_SUPERBLOCK (block
);
1165 if (!values_printed
)
1167 fprintf_filtered (stream
, "No locals.\n");
1171 /* Same, but print labels. */
1174 print_frame_label_vars (register struct frame_info
*fi
, int this_level_only
,
1175 register struct ui_file
*stream
)
1177 register struct blockvector
*bl
;
1178 register struct block
*block
= get_frame_block (fi
, 0);
1179 register int values_printed
= 0;
1180 int index
, have_default
= 0;
1181 char *blocks_printed
;
1182 CORE_ADDR pc
= get_frame_pc (fi
);
1186 fprintf_filtered (stream
, "No symbol table info available.\n");
1190 bl
= blockvector_for_pc (BLOCK_END (block
) - 4, &index
);
1191 blocks_printed
= (char *) alloca (BLOCKVECTOR_NBLOCKS (bl
) * sizeof (char));
1192 memset (blocks_printed
, 0, BLOCKVECTOR_NBLOCKS (bl
) * sizeof (char));
1196 CORE_ADDR end
= BLOCK_END (block
) - 4;
1199 if (bl
!= blockvector_for_pc (end
, &index
))
1200 error ("blockvector blotch");
1201 if (BLOCKVECTOR_BLOCK (bl
, index
) != block
)
1202 error ("blockvector botch");
1203 last_index
= BLOCKVECTOR_NBLOCKS (bl
);
1206 /* Don't print out blocks that have gone by. */
1207 while (index
< last_index
1208 && BLOCK_END (BLOCKVECTOR_BLOCK (bl
, index
)) < pc
)
1211 while (index
< last_index
1212 && BLOCK_END (BLOCKVECTOR_BLOCK (bl
, index
)) < end
)
1214 if (blocks_printed
[index
] == 0)
1216 if (print_block_frame_labels (BLOCKVECTOR_BLOCK (bl
, index
), &have_default
, stream
))
1218 blocks_printed
[index
] = 1;
1224 if (values_printed
&& this_level_only
)
1227 /* After handling the function's top-level block, stop.
1228 Don't continue to its superblock, the block of
1229 per-file symbols. */
1230 if (BLOCK_FUNCTION (block
))
1232 block
= BLOCK_SUPERBLOCK (block
);
1235 if (!values_printed
&& !this_level_only
)
1237 fprintf_filtered (stream
, "No catches.\n");
1243 locals_info (char *args
, int from_tty
)
1245 if (!deprecated_selected_frame
)
1246 error ("No frame selected.");
1247 print_frame_local_vars (deprecated_selected_frame
, 0, gdb_stdout
);
1251 catch_info (char *ignore
, int from_tty
)
1253 struct symtab_and_line
*sal
;
1255 /* Check for target support for exception handling */
1256 sal
= target_enable_exception_callback (EX_EVENT_CATCH
, 1);
1259 /* Currently not handling this */
1260 /* Ideally, here we should interact with the C++ runtime
1261 system to find the list of active handlers, etc. */
1262 fprintf_filtered (gdb_stdout
, "Info catch not supported with this target/compiler combination.\n");
1264 if (!deprecated_selected_frame
)
1265 error ("No frame selected.");
1270 /* Assume g++ compiled code -- old v 4.16 behaviour */
1271 if (!deprecated_selected_frame
)
1272 error ("No frame selected.");
1274 print_frame_label_vars (deprecated_selected_frame
, 0, gdb_stdout
);
1279 print_frame_arg_vars (register struct frame_info
*fi
,
1280 register struct ui_file
*stream
)
1282 struct symbol
*func
= get_frame_function (fi
);
1283 register struct block
*b
;
1285 register struct symbol
*sym
, *sym2
;
1286 register int values_printed
= 0;
1290 fprintf_filtered (stream
, "No symbol table info available.\n");
1294 b
= SYMBOL_BLOCK_VALUE (func
);
1295 ALL_BLOCK_SYMBOLS (b
, i
, sym
)
1297 switch (SYMBOL_CLASS (sym
))
1303 case LOC_REGPARM_ADDR
:
1304 case LOC_BASEREG_ARG
:
1306 fputs_filtered (SYMBOL_SOURCE_NAME (sym
), stream
);
1307 fputs_filtered (" = ", stream
);
1309 /* We have to look up the symbol because arguments can have
1310 two entries (one a parameter, one a local) and the one we
1311 want is the local, which lookup_symbol will find for us.
1312 This includes gcc1 (not gcc2) on the sparc when passing a
1313 small structure and gcc2 when the argument type is float
1314 and it is passed as a double and converted to float by
1315 the prologue (in the latter case the type of the LOC_ARG
1316 symbol is double and the type of the LOC_LOCAL symbol is
1317 float). There are also LOC_ARG/LOC_REGISTER pairs which
1318 are not combined in symbol-reading. */
1320 sym2
= lookup_symbol (SYMBOL_NAME (sym
),
1321 b
, VAR_NAMESPACE
, (int *) NULL
, (struct symtab
**) NULL
);
1322 print_variable_value (sym2
, fi
, stream
);
1323 fprintf_filtered (stream
, "\n");
1327 /* Don't worry about things which aren't arguments. */
1331 if (!values_printed
)
1333 fprintf_filtered (stream
, "No arguments.\n");
1338 args_info (char *ignore
, int from_tty
)
1340 if (!deprecated_selected_frame
)
1341 error ("No frame selected.");
1342 print_frame_arg_vars (deprecated_selected_frame
, gdb_stdout
);
1347 args_plus_locals_info (char *ignore
, int from_tty
)
1349 args_info (ignore
, from_tty
);
1350 locals_info (ignore
, from_tty
);
1354 /* Select frame FI. Also print the stack frame and show the source if
1355 this is the tui version. */
1357 select_and_print_frame (struct frame_info
*fi
)
1362 print_stack_frame (fi
, frame_relative_level (fi
), 1);
1366 /* Return the symbol-block in which the selected frame is executing.
1367 Can return zero under various legitimate circumstances.
1369 If ADDR_IN_BLOCK is non-zero, set *ADDR_IN_BLOCK to the relevant
1370 code address within the block returned. We use this to decide
1371 which macros are in scope. */
1374 get_selected_block (CORE_ADDR
*addr_in_block
)
1376 if (!target_has_stack
)
1379 /* NOTE: cagney/2002-11-28: Why go to all this effort to not create
1380 a selected/current frame? Perhaphs this function is called,
1381 indirectly, by WFI in "infrun.c" where avoiding the creation of
1382 an inner most frame is very important (it slows down single
1383 step). I suspect, though that this was true in the deep dark
1384 past but is no longer the case. A mindless look at all the
1385 callers tends to support this theory. I think we should be able
1386 to assume that there is always a selcted frame. */
1387 /* gdb_assert (deprecated_selected_frame != NULL); So, do you feel
1389 if (!deprecated_selected_frame
)
1391 CORE_ADDR pc
= read_pc ();
1392 if (addr_in_block
!= NULL
)
1393 *addr_in_block
= pc
;
1394 return block_for_pc (pc
);
1396 return get_frame_block (deprecated_selected_frame
, addr_in_block
);
1399 /* Find a frame a certain number of levels away from FRAME.
1400 LEVEL_OFFSET_PTR points to an int containing the number of levels.
1401 Positive means go to earlier frames (up); negative, the reverse.
1402 The int that contains the number of levels is counted toward
1403 zero as the frames for those levels are found.
1404 If the top or bottom frame is reached, that frame is returned,
1405 but the final value of *LEVEL_OFFSET_PTR is nonzero and indicates
1406 how much farther the original request asked to go. */
1409 find_relative_frame (register struct frame_info
*frame
,
1410 register int *level_offset_ptr
)
1412 register struct frame_info
*prev
;
1413 register struct frame_info
*frame1
;
1415 /* Going up is simple: just do get_prev_frame enough times
1416 or until initial frame is reached. */
1417 while (*level_offset_ptr
> 0)
1419 prev
= get_prev_frame (frame
);
1422 (*level_offset_ptr
)--;
1425 /* Going down is just as simple. */
1426 if (*level_offset_ptr
< 0)
1428 while (*level_offset_ptr
< 0)
1430 frame1
= get_next_frame (frame
);
1434 (*level_offset_ptr
)++;
1440 /* The "select_frame" command. With no arg, NOP.
1441 With arg LEVEL_EXP, select the frame at level LEVEL if it is a
1442 valid level. Otherwise, treat level_exp as an address expression
1443 and select it. See parse_frame_specification for more info on proper
1444 frame expressions. */
1448 select_frame_command_wrapper (char *level_exp
, int from_tty
)
1450 select_frame_command (level_exp
, from_tty
);
1454 select_frame_command (char *level_exp
, int from_tty
)
1456 struct frame_info
*frame
;
1457 int level
= frame_relative_level (deprecated_selected_frame
);
1459 if (!target_has_stack
)
1460 error ("No stack.");
1462 frame
= parse_frame_specification (level_exp
);
1464 select_frame (frame
);
1465 if (level
!= frame_relative_level (deprecated_selected_frame
))
1466 selected_frame_level_changed_event (frame_relative_level (deprecated_selected_frame
));
1469 /* The "frame" command. With no arg, print selected frame briefly.
1470 With arg, behaves like select_frame and then prints the selected
1474 frame_command (char *level_exp
, int from_tty
)
1476 select_frame_command (level_exp
, from_tty
);
1477 print_stack_frame (deprecated_selected_frame
,
1478 frame_relative_level (deprecated_selected_frame
), 1);
1481 /* The XDB Compatibility command to print the current frame. */
1484 current_frame_command (char *level_exp
, int from_tty
)
1486 if (target_has_stack
== 0 || deprecated_selected_frame
== 0)
1487 error ("No stack.");
1488 print_stack_frame (deprecated_selected_frame
,
1489 frame_relative_level (deprecated_selected_frame
), 1);
1492 /* Select the frame up one or COUNT stack levels
1493 from the previously selected frame, and print it briefly. */
1497 up_silently_base (char *count_exp
)
1499 register struct frame_info
*fi
;
1500 int count
= 1, count1
;
1502 count
= parse_and_eval_long (count_exp
);
1505 if (target_has_stack
== 0 || deprecated_selected_frame
== 0)
1506 error ("No stack.");
1508 fi
= find_relative_frame (deprecated_selected_frame
, &count1
);
1509 if (count1
!= 0 && count_exp
== 0)
1510 error ("Initial frame selected; you cannot go up.");
1512 selected_frame_level_changed_event (frame_relative_level (deprecated_selected_frame
));
1516 up_silently_command (char *count_exp
, int from_tty
)
1518 up_silently_base (count_exp
);
1522 up_command (char *count_exp
, int from_tty
)
1524 up_silently_base (count_exp
);
1525 print_stack_frame (deprecated_selected_frame
,
1526 frame_relative_level (deprecated_selected_frame
), 1);
1529 /* Select the frame down one or COUNT stack levels
1530 from the previously selected frame, and print it briefly. */
1534 down_silently_base (char *count_exp
)
1536 register struct frame_info
*frame
;
1537 int count
= -1, count1
;
1539 count
= -parse_and_eval_long (count_exp
);
1542 if (target_has_stack
== 0 || deprecated_selected_frame
== 0)
1543 error ("No stack.");
1545 frame
= find_relative_frame (deprecated_selected_frame
, &count1
);
1546 if (count1
!= 0 && count_exp
== 0)
1549 /* We only do this if count_exp is not specified. That way "down"
1550 means to really go down (and let me know if that is
1551 impossible), but "down 9999" can be used to mean go all the way
1552 down without getting an error. */
1554 error ("Bottom (i.e., innermost) frame selected; you cannot go down.");
1557 select_frame (frame
);
1558 selected_frame_level_changed_event (frame_relative_level (deprecated_selected_frame
));
1563 down_silently_command (char *count_exp
, int from_tty
)
1565 down_silently_base (count_exp
);
1569 down_command (char *count_exp
, int from_tty
)
1571 down_silently_base (count_exp
);
1572 print_stack_frame (deprecated_selected_frame
,
1573 frame_relative_level (deprecated_selected_frame
), 1);
1577 return_command (char *retval_exp
, int from_tty
)
1579 struct symbol
*thisfun
;
1580 CORE_ADDR selected_frame_addr
;
1581 CORE_ADDR selected_frame_pc
;
1582 struct frame_info
*frame
;
1583 struct value
*return_value
= NULL
;
1585 if (deprecated_selected_frame
== NULL
)
1586 error ("No selected frame.");
1587 thisfun
= get_frame_function (deprecated_selected_frame
);
1588 selected_frame_addr
= get_frame_base (deprecated_selected_frame
);
1589 selected_frame_pc
= get_frame_pc (deprecated_selected_frame
);
1591 /* Compute the return value (if any -- possibly getting errors here). */
1595 struct type
*return_type
= NULL
;
1597 return_value
= parse_and_eval (retval_exp
);
1599 /* Cast return value to the return type of the function. */
1600 if (thisfun
!= NULL
)
1601 return_type
= TYPE_TARGET_TYPE (SYMBOL_TYPE (thisfun
));
1602 if (return_type
== NULL
)
1603 return_type
= builtin_type_int
;
1604 return_value
= value_cast (return_type
, return_value
);
1606 /* Make sure we have fully evaluated it, since
1607 it might live in the stack frame we're about to pop. */
1608 if (VALUE_LAZY (return_value
))
1609 value_fetch_lazy (return_value
);
1612 /* If interactive, require confirmation. */
1618 if (!query ("Make %s return now? ", SYMBOL_SOURCE_NAME (thisfun
)))
1620 error ("Not confirmed.");
1624 else if (!query ("Make selected stack frame return now? "))
1625 error ("Not confirmed.");
1628 /* Do the real work. Pop until the specified frame is current. We
1629 use this method because the deprecated_selected_frame is not valid after
1630 a POP_FRAME. The pc comparison makes this work even if the
1631 selected frame shares its fp with another frame. */
1633 while (selected_frame_addr
!= get_frame_base (frame
= get_current_frame ())
1634 || selected_frame_pc
!= get_frame_pc (frame
))
1637 /* Then pop that frame. */
1641 /* Compute the return value (if any) and store in the place
1642 for return values. */
1645 set_return_value (return_value
);
1647 /* If we are at the end of a call dummy now, pop the dummy frame too. */
1649 if (CALL_DUMMY_HAS_COMPLETED (read_pc(), read_sp (),
1650 get_frame_base (get_current_frame ())))
1653 /* If interactive, print the frame that is now current. */
1656 frame_command ("0", 1);
1658 select_frame_command ("0", 0);
1661 /* Sets the scope to input function name, provided that the
1662 function is within the current stack frame */
1664 struct function_bounds
1666 CORE_ADDR low
, high
;
1669 static void func_command (char *arg
, int from_tty
);
1671 func_command (char *arg
, int from_tty
)
1673 struct frame_info
*fp
;
1675 struct symtabs_and_lines sals
;
1678 struct function_bounds
*func_bounds
= (struct function_bounds
*) NULL
;
1680 if (arg
!= (char *) NULL
)
1683 fp
= parse_frame_specification ("0");
1684 sals
= decode_line_spec (arg
, 1);
1685 func_bounds
= (struct function_bounds
*) xmalloc (
1686 sizeof (struct function_bounds
) * sals
.nelts
);
1687 for (i
= 0; (i
< sals
.nelts
&& !found
); i
++)
1689 if (sals
.sals
[i
].pc
== (CORE_ADDR
) 0 ||
1690 find_pc_partial_function (sals
.sals
[i
].pc
,
1692 &func_bounds
[i
].low
,
1693 &func_bounds
[i
].high
) == 0)
1695 func_bounds
[i
].low
=
1696 func_bounds
[i
].high
= (CORE_ADDR
) NULL
;
1702 for (i
= 0; (i
< sals
.nelts
&& !found
); i
++)
1703 found
= (get_frame_pc (fp
) >= func_bounds
[i
].low
&&
1704 get_frame_pc (fp
) < func_bounds
[i
].high
);
1708 fp
= find_relative_frame (fp
, &level
);
1711 while (!found
&& level
== 0);
1714 xfree (func_bounds
);
1717 printf_filtered ("'%s' not within current stack frame.\n", arg
);
1718 else if (fp
!= deprecated_selected_frame
)
1719 select_and_print_frame (fp
);
1722 /* Gets the language of the current frame. */
1725 get_frame_language (void)
1727 register struct symtab
*s
;
1728 enum language flang
; /* The language of the current frame */
1730 if (deprecated_selected_frame
)
1732 s
= find_pc_symtab (get_frame_pc (deprecated_selected_frame
));
1734 flang
= s
->language
;
1736 flang
= language_unknown
;
1739 flang
= language_unknown
;
1745 _initialize_stack (void)
1748 backtrace_limit
= 30;
1751 add_com ("return", class_stack
, return_command
,
1752 "Make selected stack frame return to its caller.\n\
1753 Control remains in the debugger, but when you continue\n\
1754 execution will resume in the frame above the one now selected.\n\
1755 If an argument is given, it is an expression for the value to return.");
1757 add_com ("up", class_stack
, up_command
,
1758 "Select and print stack frame that called this one.\n\
1759 An argument says how many frames up to go.");
1760 add_com ("up-silently", class_support
, up_silently_command
,
1761 "Same as the `up' command, but does not print anything.\n\
1762 This is useful in command scripts.");
1764 add_com ("down", class_stack
, down_command
,
1765 "Select and print stack frame called by this one.\n\
1766 An argument says how many frames down to go.");
1767 add_com_alias ("do", "down", class_stack
, 1);
1768 add_com_alias ("dow", "down", class_stack
, 1);
1769 add_com ("down-silently", class_support
, down_silently_command
,
1770 "Same as the `down' command, but does not print anything.\n\
1771 This is useful in command scripts.");
1773 add_com ("frame", class_stack
, frame_command
,
1774 "Select and print a stack frame.\n\
1775 With no argument, print the selected stack frame. (See also \"info frame\").\n\
1776 An argument specifies the frame to select.\n\
1777 It can be a stack frame number or the address of the frame.\n\
1778 With argument, nothing is printed if input is coming from\n\
1779 a command file or a user-defined command.");
1781 add_com_alias ("f", "frame", class_stack
, 1);
1785 add_com ("L", class_stack
, current_frame_command
,
1786 "Print the current stack frame.\n");
1787 add_com_alias ("V", "frame", class_stack
, 1);
1789 add_com ("select-frame", class_stack
, select_frame_command
,
1790 "Select a stack frame without printing anything.\n\
1791 An argument specifies the frame to select.\n\
1792 It can be a stack frame number or the address of the frame.\n");
1794 add_com ("backtrace", class_stack
, backtrace_command
,
1795 "Print backtrace of all stack frames, or innermost COUNT frames.\n\
1796 With a negative argument, print outermost -COUNT frames.\n\
1797 Use of the 'full' qualifier also prints the values of the local variables.\n");
1798 add_com_alias ("bt", "backtrace", class_stack
, 0);
1801 add_com_alias ("t", "backtrace", class_stack
, 0);
1802 add_com ("T", class_stack
, backtrace_full_command
,
1803 "Print backtrace of all stack frames, or innermost COUNT frames \n\
1804 and the values of the local variables.\n\
1805 With a negative argument, print outermost -COUNT frames.\n\
1806 Usage: T <count>\n");
1809 add_com_alias ("where", "backtrace", class_alias
, 0);
1810 add_info ("stack", backtrace_command
,
1811 "Backtrace of the stack, or innermost COUNT frames.");
1812 add_info_alias ("s", "stack", 1);
1813 add_info ("frame", frame_info
,
1814 "All about selected stack frame, or frame at ADDR.");
1815 add_info_alias ("f", "frame", 1);
1816 add_info ("locals", locals_info
,
1817 "Local variables of current stack frame.");
1818 add_info ("args", args_info
,
1819 "Argument variables of current stack frame.");
1821 add_com ("l", class_info
, args_plus_locals_info
,
1822 "Argument and local variables of current stack frame.");
1825 add_com ("func", class_stack
, func_command
,
1826 "Select the stack frame that contains <func>.\nUsage: func <name>\n");
1828 add_info ("catch", catch_info
,
1829 "Exceptions that can be caught in the current stack frame.");
1832 add_cmd ("backtrace-limit", class_stack
, set_backtrace_limit_command
,
1833 "Specify maximum number of frames for \"backtrace\" to print by default.",
1835 add_info ("backtrace-limit", backtrace_limit_info
,
1836 "The maximum number of frames for \"backtrace\" to print by default.");