binutils-gdb/gdb/stack.c

2054 lines
60 KiB
C
Raw Normal View History

/* Print and select stack frames for GDB, the GNU debugger.
2002-01-17 23:15:18 +01:00
2007-01-09 18:59:20 +01:00
Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995,
1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007
Free Software Foundation, Inc.
1999-07-07 22:19:36 +02:00
This file is part of GDB.
1999-07-07 22:19:36 +02:00
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
1999-07-07 22:19:36 +02:00
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
1999-07-07 22:19:36 +02:00
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
* breakpoint.c: * arm-tdep.c: * ia64-tdep.c: * i386-tdep.c: * hpread.c: * hppa-tdep.c: * hppa-hpux-tdep.c: * gnu-nat.c: * gdbtypes.c: * gdbarch.h: * gdbarch.c: * eval.c: * dwarf2read.c: * dbxread.c: * copying: * symfile.c: * stabsread.c: * sh64-tdep.c: * sh-tdep.c: * s390-tdep.c: * rs6000-tdep.c: * remote.c: * remote-mips.c: * mips-tdep.c: * mdebugread.c: * linux-nat.c: * infrun.c: * xcoffread.c: * win32-nat.c: * valops.c: * utils.c: * tracepoint.c: * target.c: * symtab.c: * c-exp.y: * ada-valprint.c: * ada-typeprint.c: * ada-lex.l: * ada-lang.h: * ada-lang.c: * ada-exp.y: * alphafbsd-tdep.c: * alphabsd-tdep.h: * alphabsd-tdep.c: * alphabsd-nat.c: * alpha-tdep.h: * alpha-tdep.c: * alpha-osf1-tdep.c: * alpha-nat.c: * alpha-mdebug-tdep.c: * alpha-linux-tdep.c: * alpha-linux-nat.c: * aix-thread.c: * abug-rom.c: * arch-utils.c: * annotate.h: * annotate.c: * amd64obsd-tdep.c: * amd64obsd-nat.c: * amd64nbsd-tdep.c: * amd64nbsd-nat.c: * amd64fbsd-tdep.c: * amd64fbsd-nat.c: * amd64bsd-nat.c: * amd64-tdep.h: * amd64-tdep.c: * amd64-sol2-tdep.c: * amd64-nat.h: * amd64-nat.c: * amd64-linux-tdep.c: * amd64-linux-nat.c: * alphanbsd-tdep.c: * block.h: * block.c: * bfd-target.h: * bfd-target.c: * bcache.h: * bcache.c: * ax.h: * ax-general.c: * ax-gdb.h: * ax-gdb.c: * avr-tdep.c: * auxv.h: * auxv.c: * armnbsd-tdep.c: * armnbsd-nat.c: * arm-tdep.h: * arm-linux-nat.c: * arch-utils.h: * charset.c: * call-cmds.h: * c-valprint.c: * c-typeprint.c: * c-lang.h: * c-lang.c: * buildsym.h: * buildsym.c: * bsd-uthread.h: * bsd-uthread.c: * bsd-kvm.h: * bsd-kvm.c: * breakpoint.h: * core-regset.c: * core-aout.c: * completer.h: * completer.c: * complaints.h: * complaints.c: * command.h: * coffread.c: * coff-solib.h: * coff-solib.c: * coff-pe-read.h: * coff-pe-read.c: * cli-out.h: * cli-out.c: * charset.h: * dink32-rom.c: * dictionary.h: * dictionary.c: * demangle.c: * defs.h: * dcache.h: * dcache.c: * d10v-tdep.c: * cpu32bug-rom.c: * cp-valprint.c: * cp-support.h: * cp-support.c: * cp-namespace.c: * cp-abi.h: * cp-abi.c: * corelow.c: * corefile.c: * environ.c: * elfread.c: * dwarfread.c: * dwarf2loc.c: * dwarf2expr.h: * dwarf2expr.c: * dwarf2-frame.h: * dwarf2-frame.c: * dve3900-rom.c: * dummy-frame.h: * dummy-frame.c: * dsrec.c: * doublest.h: * doublest.c: * disasm.h: * disasm.c: * fork-child.c: * findvar.c: * fbsd-nat.h: * fbsd-nat.c: * f-valprint.c: * f-typeprint.c: * f-lang.h: * f-lang.c: * expression.h: * expprint.c: * exec.h: * exec.c: * exceptions.h: * exceptions.c: * event-top.h: * event-top.c: * event-loop.h: * event-loop.c: * gdb.c: * gdb-stabs.h: * gdb-events.h: * gdb-events.c: * gcore.c: * frv-tdep.h: * frv-tdep.c: * frv-linux-tdep.c: * frame.h: * frame.c: * frame-unwind.h: * frame-unwind.c: * frame-base.h: * frame-base.c: * gdb_vfork.h: * gdb_thread_db.h: * gdb_string.h: * gdb_stat.h: * gdb_regex.h: * gdb_ptrace.h: * gdb_proc_service.h: * gdb_obstack.h: * gdb_locale.h: * gdb_dirent.h: * gdb_curses.h: * gdb_assert.h: * gdbarch.sh: * gdb.h: * hpux-thread.c: * hppabsd-nat.c: * hppa-tdep.h: * hpacc-abi.c: * h8300-tdep.c: * gregset.h: * go32-nat.c: * gnu-v3-abi.c: * gnu-v2-abi.h: * gnu-v2-abi.c: * gnu-nat.h: * glibc-tdep.c: * gdbtypes.h: * gdbcore.h: * gdbcmd.h: * i386nbsd-tdep.c: * i386nbsd-nat.c: * i386gnu-tdep.c: * i386gnu-nat.c: * i386fbsd-tdep.c: * i386fbsd-nat.c: * i386bsd-tdep.c: * i386bsd-nat.h: * i386bsd-nat.c: * i386-tdep.h: * i386-sol2-nat.c: * i386-nto-tdep.c: * i386-nat.c: * i386-linux-tdep.h: * i386-linux-tdep.c: * i386-linux-nat.c: * i386-cygwin-tdep.c: * inf-ttrace.c: * inf-ptrace.h: * inf-ptrace.c: * inf-loop.h: * inf-loop.c: * inf-child.h: * inf-child.c: * ia64-tdep.h: * ia64-linux-nat.c: * i387-tdep.h: * i387-tdep.c: * i386v4-nat.c: * i386v-nat.c: * i386obsd-tdep.c: * i386obsd-nat.c: * kod.c: * jv-valprint.c: * jv-typeprint.c: * jv-lang.h: * jv-lang.c: * irix5-nat.c: * iq2000-tdep.c: * interps.h: * interps.c: * inftarg.c: * inflow.h: * inflow.c: * inferior.h: * infcmd.c: * infcall.h: * infcall.c: * inf-ttrace.h: * m32r-tdep.h: * m32r-tdep.c: * m32r-rom.c: * m32r-linux-tdep.c: * m32r-linux-nat.c: * m2-valprint.c: * m2-typeprint.c: * m2-lang.h: * m2-lang.c: * lynx-nat.c: * linux-thread-db.c: * linux-nat.h: * linespec.c: * libunwind-frame.h: * libunwind-frame.c: * language.h: * language.c: * macroexp.c: * macrocmd.c: * m88kbsd-nat.c: * m88k-tdep.h: * m88k-tdep.c: * m68klinux-tdep.c: * m68klinux-nat.c: * m68kbsd-tdep.c: * m68kbsd-nat.c: * m68k-tdep.h: * m68k-tdep.c: * mips-linux-nat.c: * mips-irix-tdep.c: * minsyms.c: * memattr.h: * memattr.c: * mem-break.c: * mdebugread.h: * main.h: * main.c: * macrotab.h: * macrotab.c: * macroscope.h: * macroscope.c: * macroexp.h: * nbsd-tdep.c: * mt-tdep.c: * monitor.h: * monitor.c: * mn10300-tdep.h: * mn10300-tdep.c: * mn10300-linux-tdep.c: * mipsv4-nat.c: * mipsread.c: * mipsnbsd-tdep.h: * mipsnbsd-tdep.c: * mipsnbsd-nat.c: * mips64obsd-tdep.c: * mips64obsd-nat.c: * mips-tdep.h: * mips-mdebug-tdep.c: * mips-linux-tdep.c: * osabi.h: * osabi.c: * ocd.h: * ocd.c: * observer.c: * objfiles.h: * objfiles.c: * objc-lang.h: * objc-lang.c: * objc-exp.y: * nto-tdep.h: * nto-tdep.c: * nto-procfs.c: * nlmread.c: * nbsd-tdep.h: * ppcobsd-tdep.c: * ppcobsd-nat.c: * ppcnbsd-tdep.h: * ppcnbsd-tdep.c: * ppcnbsd-nat.c: * ppcbug-rom.c: * ppc-tdep.h: * ppc-sysv-tdep.c: * ppc-linux-tdep.c: * ppc-linux-nat.c: * ppc-bdm.c: * parser-defs.h: * parse.c: * p-valprint.c: * p-typeprint.c: * p-lang.h: * p-lang.c: * remote-fileio.h: * remote-fileio.c: * remote-est.c: * remote-e7000.c: * regset.h: * regset.c: * reggroups.h: * reggroups.c: * regcache.h: * regcache.c: * proc-why.c: * proc-service.c: * proc-events.c: * printcmd.c: * ppcobsd-tdep.h: * sentinel-frame.h: * sentinel-frame.c: * scm-valprint.c: * scm-tags.h: * scm-lang.h: * scm-lang.c: * scm-exp.c: * s390-tdep.h: * rom68k-rom.c: * remote.h: * remote-utils.c: * remote-st.c: * remote-sim.c: * remote-sds.c: * remote-rdp.c: * remote-rdi.c: * remote-hms.c: * sim-regno.h: * shnbsd-tdep.h: * shnbsd-tdep.c: * shnbsd-nat.c: * sh-tdep.h: * serial.h: * serial.c: * ser-unix.h: * ser-unix.c: * ser-tcp.c: * ser-pipe.c: * ser-go32.c: * ser-e7kpc.c: * ser-base.h: * ser-base.c: * solib.c: * solib-svr4.h: * solib-svr4.c: * solib-sunos.c: * solib-som.h: * solib-som.c: * solib-pa64.h: * solib-pa64.c: * solib-osf.c: * solib-null.c: * solib-legacy.c: * solib-irix.c: * solib-frv.c: * solib-aix5.c: * sol-thread.c: * sparc64-linux-tdep.c: * sparc64-linux-nat.c: * sparc-tdep.h: * sparc-tdep.c: * sparc-sol2-tdep.c: * sparc-sol2-nat.c: * sparc-nat.h: * sparc-nat.c: * sparc-linux-tdep.c: * sparc-linux-nat.c: * source.h: * source.c: * somread.c: * solist.h: * solib.h: * std-regs.c: * stack.h: * stack.c: * stabsread.h: * sparcobsd-tdep.c: * sparcnbsd-tdep.c: * sparcnbsd-nat.c: * sparc64obsd-tdep.c: * sparc64nbsd-tdep.c: * sparc64nbsd-nat.c: * sparc64fbsd-tdep.c: * sparc64fbsd-nat.c: * sparc64-tdep.h: * sparc64-tdep.c: * sparc64-sol2-tdep.c: * sparc64-nat.c: * ui-file.c: * typeprint.h: * typeprint.c: * tramp-frame.h: * tramp-frame.c: * trad-frame.h: * trad-frame.c: * tracepoint.h: * top.c: * tobs.inc: * thread.c: * terminal.h: * target.h: * symfile.h: * stop-gdb.c: * vaxbsd-nat.c: * vax-tdep.h: * vax-tdep.c: * vax-nat.c: * varobj.h: * varobj.c: * value.h: * value.c: * valprint.h: * valprint.c: * v850-tdep.c: * uw-thread.c: * user-regs.c: * ui-out.h: * ui-out.c: * ui-file.h: * xcoffsolib.h: * xcoffsolib.c: * wrapper.c: * wince.c: * wince-stub.h: * wince-stub.c: * vaxobsd-tdep.c: * vaxnbsd-tdep.c: * gdb_gcore.sh: * copying.c: * configure.ac: * aclocal.m4: * acinclude.m4: * reply_mig_hack.awk: * observer.sh: * gdb_mbuild.sh: * arm-linux-tdep.c: * blockframe.c: * dbug-rom.c: * environ.h: * dwarf2loc.h: * gdb-events.sh: * glibc-tdep.h: * gdb_wait.h: * gdbthread.h: * i386-sol2-tdep.c: * hppabsd-tdep.c: * hppa-linux-nat.c: * hppa-hpux-nat.c: * ia64-linux-tdep.c: * infptrace.c: * linespec.h: * maint.c: * mips-mdebug-tdep.h: * remote-m32r-sdi.c: * s390-nat.c: * rs6000-nat.c: * remote-utils.h: * sh3-rom.c: * sh-linux-tdep.c: * top.h: * symtab.h: * symmisc.c: * symfile-mem.c: * srec.h: * user-regs.h: * version.h: * valarith.c: * xstormy16-tdep.c: * wrapper.h: * Makefile.in: * f-exp.y: * cris-tdep.c: * cp-name-parser.y: * procfs.c: * proc-utils.h: * proc-flags.c: * proc-api.c: * p-exp.y: * m68hc11-tdep.c: * m2-exp.y: * kod.h: * kod-cisco.c: * jv-exp.y: * hppa-linux-tdep.c: Add (c) after Copyright. Update the FSF address.
2005-12-17 23:34:03 +01:00
Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
#include "defs.h"
#include "value.h"
#include "symtab.h"
#include "gdbtypes.h"
#include "expression.h"
#include "language.h"
#include "frame.h"
#include "gdbcmd.h"
#include "gdbcore.h"
#include "target.h"
* source.c: Make global variables current_source_symtab and current_source_line static. (list_command): Moved to cli/cli-cmds.c. (ambiguous_line_spec): Moved to cli/cli-cmds.c. (get_first_line_listed): New accessor function. (get_lines_to_list): New accessor function. (get_current_source_symtab_and_line): New function. Retrieves the position in the source code that we consider current. (get_current_or_default_source_symtab_and_line): New function. Like the above but attempts to determine a default position if one is not currently defined. (set_current_source_symtab_and_line): New function. Sets the source code position considered current and returns the previously set one. (clear_current_source_symtab_and_line): Reset stored information about a current source line. (_initialize_source): Remove registration for the "list" command and its alias. * source.h: Add declarations for the new functions above. * symtab.h: Remove declarations for the global variables mentioned above. * breakpoint.c (parse_breakpoint_sals): Use accessor functions to obtain current source line. * linespec.c (decode_line_1): Ditto. * macroscope.c (default_macro_scope): Ditto. * scm-lang.c (scm_unpac): Ditto. * stack.c (print_frame_info_base): Ditto. * symfile.c (clear_symtab_users): Ditto. * symtab.c (decode_line_spec): Ditto. * cli/cli-cmds.c (list_command): Moved here from source.c. (ambiguous_line_spec): Moved here from source.c. (_init_cli_cmds): Add definition for "list" and its alias. * Makefile.in: Update dependencies.
2002-09-20 16:58:59 +02:00
#include "source.h"
#include "breakpoint.h"
#include "demangle.h"
#include "inferior.h"
#include "annotate.h"
2000-02-03 05:14:45 +01:00
#include "ui-out.h"
2003-02-19 David Carlton <carlton@math.stanford.edu> * Makefile.in (SFILES): Add block.c. (block_h): New. (COMMON_OBS): Add block.o. (block.o): New. (x86-64-tdep.o): Add $(block_h). (values.o, valops.o, tracepoint.o, symtab.o, symmisc.o, symfile.o) (stack.o, printcmd.o, p-exp.tab.o, parse.o, objfiles.o) (objc-exp.tab.o, objc-lang.o, nlmread.o, mips-tdep.o, mdebugread.o) (m2-exp.tab.o, linespec.o, jv-lang.o, jv-exp.tab.o, infcmd.o) (f-valprint.o, findvar.o, f-exp.tab.o, expprint.o, coffread.o) (c-exp.tab.o, buildsym.o, breakpoint.o, blockframe.o, ax-gdb.o) (alpha-tdep.o, ada-lang.o, ada-exp.tab.o, mi-cmd-stack.o): Ditto. * value.h: Add opaque declaration for struct block. * parser-defs.h, objc-lang.h, buildsym.h, breakpoint.h: Ditto. * ada-lang.h: Ditto. * x86-64-tdep.c: #include "block.h" * values.c, valops.c, tracepoint.c, symtab.c, symmisc.c: Ditto. * symfile.c, stack.c, printcmd.c, p-exp.y, parse.c: Ditto. * objfiles.c, objc-exp.y, objc-lang.c, nlmread.c: Ditto. * mips-tdep.c, mdebugread.c, m2-exp.y, linespec.c: Ditto. * jv-lang.c, jv-exp.y, infcmd.c, f-valprint.c: Ditto. * findvar.c, f-exp.y, expprint.c, coffread.c, c-exp.y: Ditto. * buildsym.c, breakpoint.c, blockframe.c, ax-gdb.c: Ditto. * alpha-tdep.c, ada-lang.c, ada-exp.y: Ditto. * blockframe.c (blockvector_for_pc_sect): Move to "block.c". (blockvector_for_pc, block_for_pc_sect, block_for_pc): Ditto. * symtab.c (block_function): Ditto. (contained_in): Ditto. * frame.h: Move block_for_pc and block_for_pc_sect declarations to block.h. Add opaque declaration for struct block. * symtab.h: Move block_function and contained_in declarations to block.h. Add opaque declarations for struct block, struct blockvector. (struct block): Move to block.h. (struct blockvector): Ditto. (BLOCK_START, BLOCK_END, BLOCK_FUNCTION, BLOCK_SUPERBLOCK) (BLOCK_GCC_COMPILED, BLOCK_HASHTABLE, BLOCK_NSYMS, BLOCK_SYM) (BLOCK_BUCKETS, BLOCK_BUCKET, BLOCK_HASHTABLE_SIZE) (ALL_BLOCK_SYMBOLS, BLOCK_SHOULD_SORT, BLOCKVECTOR_NBLOCKS) (BLOCKVECTOR_BLOCK, GLOBAL_BLOCK, STATIC_BLOCK, FIRST_LOCAL_BLOCK): Ditto. * block.c: New file. * block.h: New file. 2003-02-19 David Carlton <carlton@math.stanford.edu> * mi-cmd-stack.c: #include "block.h"
2003-02-20 01:01:07 +01:00
#include "block.h"
2003-06-08 Andrew Cagney <cagney@redhat.com> * acinclude.m4 (gcc_AC_CHECK_DECL, (gcc_AC_CHECK_DECL): Stolen from GCC's acinclude.m4. * configure.in: Check for getopt's delcaration. * aclocal.m4, config.in, configure: Re-generate. * main.c (error_init): Delete declaration. * defs.h (error_init): Declare. * rs6000-tdep.c (rs6000_fetch_pointer_argument): Make static. (rs6000_convert_from_func_ptr_addr): Make static. (_initialize_rs6000_tdep): Add declaration. * cli/cli-cmds.c (dont_repeat): Delete declaration. (show_commands, set_verbose, show_history): Delete declaration. * top.h (set_verbose): Add declaration. (show_history, set_history, show_commands): Add declaration. (do_restore_instream_cleanup): Add declaration. * objc-lang.c (specialcmp): Make static. (print_object_command): Make static. (find_objc_msgsend): Make static. (find_objc_msgcall_submethod_helper): Make static. (find_objc_msgcall_submethod): Make static. (_initialize_objc_language): Add declaration. (find_implementation_from_class): Make static. (find_implementation): Make static. * objc-exp.y (yylex): Delete lookup_struct_typedef declaration. * objc-lang.h (lookup_struct_typedef): Add declaration. * cli/cli-interp.c (_initialize_cli_interp): Add declaration. * cli/cli-script.c (clear_hook_in_cleanup): Make static. (do_restore_user_call_depth): Make static. (do_restore_instream_cleanup): Delete declaration. (dont_repeat): Delete declaration. * cli/cli-decode.c (add_abbrev_cmd): Delete function. * cli/cli-dump.c (_initialize_cli_dump): Add declaration. * reggroups.c (_initialize_reggroup): Add declaration. * cp-support.c (_initialize_cp_support): Add declaration. * cp-abi.c (_initialize_cp_abi): Add declaration. * hpacc-abi.c (_initialize_hpacc_abi): Add declaration. * gnu-v3-abi.c (gnuv3_baseclass_offset): Make static. (_initialize_gnu_v3_abi): Add declaration. * gnu-v2-abi.c (gnuv2_value_rtti_type): Make static. (_initialize_gnu_v2_abi): Add declaration. * frame-base.c (_initialize_frame_base): Add declaration. * doublest.c (floatformat_from_length): Make static. * frame-unwind.c (_initialize_frame_unwind): Add declaration. * frame.c (create_sentinel_frame): Make static. (_initialize_frame): Add declaration. * top.c (do_catch_errors): Make static. (gdb_rl_operate_and_get_next_completion): Make static. * typeprint.c: Include "typeprint.h". * sentinel-frame.c (sentinel_frame_prev_register): Make static. (sentinel_frame_this_id): Make static. * p-valprint.c (_initialize_pascal_valprint): Add declaration. * ui-out.c (make_cleanup_ui_out_begin_end): Delete function. * dwarf2-frame.c (dwarf2_frame_cache): Make static. * p-exp.y (push_current_type, pop_current_type): ISO C declaration. * dwarf2expr.h (dwarf_expr_context): ISO C declaration. * maint.c (maintenance_print_architecture): Make static. * signals/signals.c (_initialize_signals): Add declaration. * std-regs.c (_initialize_frame_reg): Add declaration. * jv-exp.y (push_variable): ISO C definition. (push_qualified_expression_name): Ditto. * memattr.c (_initialize_mem): Add declaration. * remote.c (remote_check_watch_resources): Make static. (remote_stopped_by_watchpoint): Make static. (remote_stopped_data_address): Make static. * d10v-tdep.c (nr_dmap_regs): Make static. (a0_regnum): Make static. (d10v_frame_unwind_cache): Make static. (d10v_frame_p): Make static. * osabi.c (show_osabi): Make static. (_initialize_gdb_osabi): Add extern declaration. * gdbtypes.c (make_qualified_type): Make static. (safe_parse_type): Make static. * macrocmd.c (_initialize_macrocmd): Add extern declaration. * macrotab.c (macro_bcache_free): Make static. * interps.c (interp_set_quiet): Make static. (interpreter_exec_cmd): Make static. * stack.h (select_frame_command): New file. * stack.c: Include "stack.h". (select_frame_command_wrapper): Delete function. (select_frame_command): Make global. * infcall.c: Include "infcall.h". * linespec.c: Include "linespec.h". * symfile.c (sections_overlap): Make static. * cp-support.h (cp_initialize_namespace): ISO C declaration. * charset.c (_initialize_charset): Add missing prototype. * regcache.c (init_legacy_regcache_descr): Make static. (do_regcache_xfree): Make static. (regcache_xfer_part): Make static. (_initialize_regcache): Add missing prototype. * breakpoint.c (parse_breakpoint_sals): Make static. (breakpoint_sals_to_pc): Make static. * interps.h (clear_interpreter_hooks): ISO C declaration. * Makefile.in (stack_h): Define. (stack.o, typeprint.o, mi-main.o): Update dependencies. (mi-cmd-stack.o, infcall.o, linespec.o): Update dependencies. Index: mi/ChangeLog 2003-06-08 Andrew Cagney <cagney@redhat.com> * mi-parse.c (_initialize_mi_parse): Delete function. * mi-main.c: Include "mi-main.h". * mi-interp.c (_initialize_mi_interp): Add declaration. * mi-cmd-stack.c: Include "stack.h". (select_frame_command_wrapper): Delete extern declaration. (mi_cmd_stack_select_frame): Replace select_frame_command_wrapper with select_frame_command.
2003-06-08 20:27:14 +02:00
#include "stack.h"
2003-06-11 David Carlton <carlton@bactrian.org> * dictionary.h: New. * dictionary.c: New. * block.h: Add opaque declaration for struct dictionary. (struct block): Add 'dict' member; delete 'hashtable', 'nsyms', 'sym' members. (BLOCK_DICT): New macro. Delete macros BLOCK_HASHTABLE, BLOCK_NSYMS, BLOCK_SYM, BLOCK_BUCKETS, BLOCK_BUCKET, BLOCK_HASHTABLE_SIZE, BLOCK_SHOULD_SORT. (ALL_BLOCK_SYMBOLS): Update definition. * Makefile.in (SFILES): Add dictionary.c. (dictionary_h): New. (COMMON_OBS): Add dictionary.o. (dictionary.o): New. (ada-lang.o): Depend on dictionary_h. (buildsym.o, coffread.o, jv-lang.o, mdebugread.o, objfiles.o) (stack.o, symmisc.o, symtab.o, tracepoint.o, valops.o) (mi-cmd-stack.o): Ditto. (gdbtk-cmds.o): Update dependencies. (gdbtk-stack.o): Ditto. * ada-lang.c: Include dictionary.h. (symtab_for_sym): Update uses of ALL_BLOCK_SYMBOLS. (fill_in_ada_prototype, debug_print_block): Ditto. (ada_add_block_symbols): Update uses of ALL_BLOCK_SYMBOLS; replace explicit iteration by use of ALL_BLOCK_SYMBOLS. Delete variable 'is_sorted'. * mdebugread.c: Include dictionary.h. (struct parse_stack): Delete 'maxsyms' member. (parse_symbol): Update calls to new_block. Delete calls to shrink_block. Use dictionary methods. (psymtab_to_symtab_1): Delete calls to sort_symtab_syms. Update calls to new_symtab. Don't maintain maxsyms data. (mylookup_symbol): Update use of ALL_BLOCK_SYMBOLS. (add_symbol): Just call dict_add_symbol. (new_symtab): Delete 'maxsyms' argument. (new_symtab): Update calls to new_block. (new_block): Delete 'maxsyms' argument; add 'function' argument. (shrink_block): Delete function. (fixup_sigtramp): Update call to new_block. Add symbol via dict_add_symbol. * jv-lang.c: Include dictionary.h. (get_java_class_symtab): Set the BLOCK_DICT of the blocks appropriately. Set class_symtab->free_func. Make sure the blockvector is big enough to hold two blocks. (add_class_symtab_symbol): Use dictionary methods. (free_class_block): New function. (type_from_class): Replace explicit iteration by ALL_BLOCK_SYMBOLS. * symtab.h (struct symtab): Replace 'free_ptr' method by 'free_func'. * dwarf2read.c (psymtab_to_symtab_1): Delete call to sort_symtab_syms. * dwarfread.c (psymtab_to_symtab_1): Delete call to sort_symtab_syms. * coffread.c (coff_symfile_read): Delete call to sort_symtab_syms. Include dictionary.h. (patch_opaque_types): Update use of ALL_BLOCK_SYMBOLS. * dbxread.c (dbx_psymtab_to_symtab_1): Delete call to sort_symtab_syms. * objfiles.c: Include dictionary.h. (objfile_relocate): Update use of ALL_BLOCK_SYMBOLS. * buildsym.c: Include dictionary.h. (finish_block): Use dictionary methods. (end_symtab): Set free_func to NULL, not free_ptr. * tracepoint.c: Include dictionary.h. (add_local_symbols): Update use of ALL_BLOCK_SYMBOLS. (scope_info): Ditto. * stack.c: Include dictionary.h. (print_block_frame_locals): Update use of ALL_BLOCK_SYMBOLS. (print_block_frame_labels, print_frame_arg_vars) (print_frame_args): Ditto. * symmisc.c (free_symtab_block): Use dictionary methods. (dump_symtab): Ditto. (free_symtab): Replace use of 'free_ptr' by 'free_func'. Include dictionary.h. * symfile.h: Delete declarations of sort_block_syms, sort_symtab_syms. * symfile.c (sort_block_syms): Delete. (sort_symtab_syms): Delete. * symtab.c: Include dictionary.h. (lookup_block_symbol): Use dictionary iterators. (find_pc_sect_symtab): Update use of ALL_BLOCK_SYMBOLS. (search_symbols, make_symbol_completion_list): Ditto. (make_symbol_overload_list): Ditto. * valops.c (value_of_local): Use dict_empty. Include dictionary.h. 2003-06-11 David Carlton <carlton@bactrian.org> * generic/gdbtk-stack.c: Include dictionary.h. (gdb_block_vars): Update use of ALL_BLOCK_SYMBOLS. (gdb_get_blocks, gdb_get_vars_command): Ditto. * generic/gdbtk-cmds.c: Include dictionary.h. (gdb_listfuncs): Update use of ALL_BLOCK_SYMBOLS. 2003-06-11 David Carlton <carlton@bactrian.org> * mi-cmd-stack.c: Include dictionary.h. (list_args_or_locals): Update use of ALL_BLOCK_SYMBOLS.
2003-06-12 01:29:49 +02:00
#include "dictionary.h"
#include "exceptions.h"
#include "reggroups.h"
#include "regcache.h"
* solib.h (CLEAR_SOLIB, SOLIB_ADD) (SOLIB_CREATE_INFERIOR_HOOK, SOLIB_REMOVE_INFERIOR_HOOK) (SOLIB_IN_DYNAMIC_LINKER, SOLIB_RESTART) (DISABLE_UNSETTABLE_BREAK, PC_SOLIB) (IN_SOLIB_DYNSYM_RESOLVE_CODE): Remove defines and orphaned comments. * breakpoint.c: Include "solib.h". (insert_bp_location) [!DISABLE_UNSETTABLE_BREAK]: Call solib_address. (remove_solib_event_breakpoints, create_solib_event_breakpoint) (disable_breakpoints_in_shlibs) (disable_breakpoints_in_unloaded_shlib) (re_enable_breakpoints_in_shlibs): Compile if SOLIB_ADD isn't defined. If PC_SOLIB isn't defined, call solib_address. (_initialize_breakpoint): Unconditionally install observer. * corelow.c: Include "solib.h". [SOLIB_ADD] (solib_add_stub): Remove prototype. (core_close) [!CLEAR_SOLIB]: Call clear_solib. (solib_add_stub) [!SOLIB_ADD] Call solib_add. (core_open): Unconditionally call solib_add_stub. * fork-child.c: Include "solib.h". (fork_inferior) [!SOLIB_CREATE_INFERIOR_HOOK]: Call solib_create_inferior_hook. * infcmd.c: Include "solib.h". (attach_command) [!SOLIB_ADD]: Call shlib_rescan. Unconditionally call re_enable_breakpoints_in_shlibs. * infrun.c: Include "solib.h". (SOLIB_IN_SYNSYM_RESOLVE_CODE): Don't define if not already defined. (stop_on_solib_events, show_stop_on_solib_events): Include unconditionally. (follow_exec) [!SOLIB_CREATE_INFERIOR_HOOK]: Call solib_create_inferior_hook. (handle_inferior_event) [!SOLIB_ADD]: Call shlib_add. [!IN_SOLIB_DYNSYM_RESOLVE_CODE]: Call in_solib_dynsym_resolve_code. (_initialize_infrun): Unconditionally add "stop_on_solib-events" command. * remote.c: Include "solib.h". (remote_open_1): Unconditionally call no_shared_libraries. [!SOLIB_CREATE_INFERIOR_HOOK] Call solib_create_inferior_hook. * stack.c: Include "solib.h". (print_frame) [!PC_SOLIB] Call shlib_for_pc. * xcoffsolib.c (no_shared_libraries): Remove function. * Makefile.in (SFILES): Add solib.c. (ALLDEPFILES): Remove solib.c. (COMMON_OBS): Add solib.o. (breakpoint.o, corelow.o, fork-chiled.o, infcmd.o, infrun.o) (remote.o, stack.o): Update dependencies.
2005-05-12 22:21:18 +02:00
#include "solib.h"
#include "valprint.h"
#include "gdb_assert.h"
#include <ctype.h>
#include "gdb_string.h"
2004-04-21 Andrew Cagney <cagney@redhat.com> * annotate.h (deprecated_annotate_starting_hook) (deprecated_annotate_stopped_hook) (deprecated_annotate_exited_hook) (deprecated_annotate_signal_hook) (deprecated_annotate_signalled_hook): Deprecate. * tracepoint.h (deprecated_create_tracepoint_hook) (deprecated_delete_tracepoint_hook) (deprecated_modify_tracepoint_hook) (deprecated_trace_find_hook) (deprecated_trace_start_stop_hook): Deprecate. * target.h (deprecated_target_new_objfile_hook): Deprecate. * remote.h (deprecated_target_resume_hook) (deprecated_target_wait_loop_hook): Deprecate. * gdbcore.h (deprecated_exec_file_display_hook) (deprecated_file_changed_hook): Deprecate. * frame.h (deprecated_selected_frame_level_changed_hook): Deprecate. * defs.h (deprecated_modify_breakpoint_hook) (deprecated_command_loop_hook, deprecated_show_load_progress) (deprecated_print_frame_info_listing_hook) (deprecated_query_hook, deprecated_warning_hook) (deprecated_flush_hook, deprecated_create_breakpoint_hook) (deprecated_delete_breakpoint_hook) (deprecated_interactive_hook, deprecated_registers_changed_hook) (deprecated_readline_begin_hook, deprecated_readline_hook) (deprecated_readline_end_hook, deprecated_register_changed_hook) (deprecated_memory_changed_hook, deprecated_init_ui_hook) (deprecated_context_hook, deprecated_target_wait_hook) (deprecated_attach_hook, deprecated_detach_hook) (deprecated_call_command_hook, deprecated_set_hook) (deprecated_error_hook, deprecated_error_begin_hook) (deprecated_ui_load_progress_hook): Deprecate. * valops.c, uw-thread.c, utils.c, tui/tui-io.c: Update. * tui/tui-hooks.c, tracepoint.c, top.c, thread-db.c: Update. * target.c, symfile.c, stack.c, sol-thread.c, rs6000-nat.c: Update. * remote.c, remote-mips.c, regcache.c, mi/mi-interp.c: Update. * main.c, interps.c, infcmd.c, hpux-thread.c, frame.c: Update. * exec.c, dsrec.c, d10v-tdep.c, corefile.c, complaints.c: Update. * cli/cli-script.c, cli/cli-setshow.c, breakpoint.c: Update. * annotate.c, aix-thread.c: Update.
2004-04-22 01:52:21 +02:00
void (*deprecated_selected_frame_level_changed_hook) (int);
/* Prototypes for local functions. */
2000-02-02 01:21:19 +01:00
static void print_frame_local_vars (struct frame_info *, int,
struct ui_file *);
static void print_frame (struct frame_info *frame, int print_level,
enum print_what print_what, int print_args,
2000-01-18 01:55:13 +01:00
struct symtab_and_line sal);
/* Zero means do things normally; we are interacting directly with the
user. One means print the full filename and linenumber when a
frame is printed, and do so in a format emacs18/emacs19.22 can
parse. Two means print similar annotations, but in many more
cases and in a slightly different syntax. */
int annotation_level = 0;
1999-07-07 22:19:36 +02:00
struct print_stack_frame_args
{
struct frame_info *frame;
int print_level;
enum print_what print_what;
int print_args;
};
/* Show or print the frame arguments; stub for catch_errors. */
static int
2000-07-30 03:48:28 +02:00
print_stack_frame_stub (void *args)
{
struct print_stack_frame_args *p = args;
int center = (p->print_what == SRC_LINE || p->print_what == SRC_AND_LOC);
print_frame_info (p->frame, p->print_level, p->print_what, p->print_args);
set_current_sal_from_frame (p->frame, center);
return 0;
}
/* Show or print a stack frame FRAME briefly. The output is format
according to PRINT_LEVEL and PRINT_WHAT printing the frame's
relative level, function name, argument list, and file name and
line number. If the frame's PC is not at the beginning of the
source line, the actual PC is printed at the beginning. */
void
print_stack_frame (struct frame_info *frame, int print_level,
enum print_what print_what)
{
struct print_stack_frame_args args;
args.frame = frame;
args.print_level = print_level;
args.print_what = print_what;
/* For mi, alway print location and address. */
args.print_what = ui_out_is_mi_like_p (uiout) ? LOC_AND_ADDRESS : print_what;
args.print_args = 1;
catch_errors (print_stack_frame_stub, &args, "", RETURN_MASK_ALL);
}
1999-07-07 22:19:36 +02:00
struct print_args_args
{
struct symbol *func;
struct frame_info *frame;
2000-02-02 01:21:19 +01:00
struct ui_file *stream;
};
static int print_args_stub (void *args);
/* Print nameless arguments of frame FRAME on STREAM, where START is
the offset of the first nameless argument, and NUM is the number of
nameless arguments to print. FIRST is nonzero if this is the first
argument (not just the first nameless argument). */
static void
print_frame_nameless_args (struct frame_info *frame, long start, int num,
int first, struct ui_file *stream)
{
int i;
CORE_ADDR argsaddr;
long arg_value;
for (i = 0; i < num; i++)
{
QUIT;
argsaddr = get_frame_args_address (frame);
if (!argsaddr)
return;
arg_value = read_memory_integer (argsaddr + start, sizeof (int));
if (!first)
fprintf_filtered (stream, ", ");
fprintf_filtered (stream, "%ld", arg_value);
first = 0;
start += sizeof (int);
}
}
/* Print the arguments of frame FRAME on STREAM, given the function
FUNC running in that frame (as a symbol), where NUM is the number
of arguments according to the stack frame (or -1 if the number of
arguments is unknown). */
/* Note that currently the "number of argumentss according to the
stack frame" is only known on VAX where i refers to the "number of
ints of argumentss according to the stack frame". */
static void
print_frame_args (struct symbol *func, struct frame_info *frame,
int num, struct ui_file *stream)
{
int first = 1;
/* Offset of next stack argument beyond the one we have seen that is
at the highest offset, or -1 if we haven't come to a stack
argument yet. */
long highest_offset = -1;
/* Number of ints of arguments that we have printed so far. */
int args_printed = 0;
struct cleanup *old_chain, *list_chain;
struct ui_stream *stb;
stb = ui_out_stream_new (uiout);
old_chain = make_cleanup_ui_out_stream_delete (stb);
if (func)
{
struct block *b = SYMBOL_BLOCK_VALUE (func);
struct dict_iterator iter;
struct symbol *sym;
struct value *val;
2003-06-11 David Carlton <carlton@bactrian.org> * dictionary.h: New. * dictionary.c: New. * block.h: Add opaque declaration for struct dictionary. (struct block): Add 'dict' member; delete 'hashtable', 'nsyms', 'sym' members. (BLOCK_DICT): New macro. Delete macros BLOCK_HASHTABLE, BLOCK_NSYMS, BLOCK_SYM, BLOCK_BUCKETS, BLOCK_BUCKET, BLOCK_HASHTABLE_SIZE, BLOCK_SHOULD_SORT. (ALL_BLOCK_SYMBOLS): Update definition. * Makefile.in (SFILES): Add dictionary.c. (dictionary_h): New. (COMMON_OBS): Add dictionary.o. (dictionary.o): New. (ada-lang.o): Depend on dictionary_h. (buildsym.o, coffread.o, jv-lang.o, mdebugread.o, objfiles.o) (stack.o, symmisc.o, symtab.o, tracepoint.o, valops.o) (mi-cmd-stack.o): Ditto. (gdbtk-cmds.o): Update dependencies. (gdbtk-stack.o): Ditto. * ada-lang.c: Include dictionary.h. (symtab_for_sym): Update uses of ALL_BLOCK_SYMBOLS. (fill_in_ada_prototype, debug_print_block): Ditto. (ada_add_block_symbols): Update uses of ALL_BLOCK_SYMBOLS; replace explicit iteration by use of ALL_BLOCK_SYMBOLS. Delete variable 'is_sorted'. * mdebugread.c: Include dictionary.h. (struct parse_stack): Delete 'maxsyms' member. (parse_symbol): Update calls to new_block. Delete calls to shrink_block. Use dictionary methods. (psymtab_to_symtab_1): Delete calls to sort_symtab_syms. Update calls to new_symtab. Don't maintain maxsyms data. (mylookup_symbol): Update use of ALL_BLOCK_SYMBOLS. (add_symbol): Just call dict_add_symbol. (new_symtab): Delete 'maxsyms' argument. (new_symtab): Update calls to new_block. (new_block): Delete 'maxsyms' argument; add 'function' argument. (shrink_block): Delete function. (fixup_sigtramp): Update call to new_block. Add symbol via dict_add_symbol. * jv-lang.c: Include dictionary.h. (get_java_class_symtab): Set the BLOCK_DICT of the blocks appropriately. Set class_symtab->free_func. Make sure the blockvector is big enough to hold two blocks. (add_class_symtab_symbol): Use dictionary methods. (free_class_block): New function. (type_from_class): Replace explicit iteration by ALL_BLOCK_SYMBOLS. * symtab.h (struct symtab): Replace 'free_ptr' method by 'free_func'. * dwarf2read.c (psymtab_to_symtab_1): Delete call to sort_symtab_syms. * dwarfread.c (psymtab_to_symtab_1): Delete call to sort_symtab_syms. * coffread.c (coff_symfile_read): Delete call to sort_symtab_syms. Include dictionary.h. (patch_opaque_types): Update use of ALL_BLOCK_SYMBOLS. * dbxread.c (dbx_psymtab_to_symtab_1): Delete call to sort_symtab_syms. * objfiles.c: Include dictionary.h. (objfile_relocate): Update use of ALL_BLOCK_SYMBOLS. * buildsym.c: Include dictionary.h. (finish_block): Use dictionary methods. (end_symtab): Set free_func to NULL, not free_ptr. * tracepoint.c: Include dictionary.h. (add_local_symbols): Update use of ALL_BLOCK_SYMBOLS. (scope_info): Ditto. * stack.c: Include dictionary.h. (print_block_frame_locals): Update use of ALL_BLOCK_SYMBOLS. (print_block_frame_labels, print_frame_arg_vars) (print_frame_args): Ditto. * symmisc.c (free_symtab_block): Use dictionary methods. (dump_symtab): Ditto. (free_symtab): Replace use of 'free_ptr' by 'free_func'. Include dictionary.h. * symfile.h: Delete declarations of sort_block_syms, sort_symtab_syms. * symfile.c (sort_block_syms): Delete. (sort_symtab_syms): Delete. * symtab.c: Include dictionary.h. (lookup_block_symbol): Use dictionary iterators. (find_pc_sect_symtab): Update use of ALL_BLOCK_SYMBOLS. (search_symbols, make_symbol_completion_list): Ditto. (make_symbol_overload_list): Ditto. * valops.c (value_of_local): Use dict_empty. Include dictionary.h. 2003-06-11 David Carlton <carlton@bactrian.org> * generic/gdbtk-stack.c: Include dictionary.h. (gdb_block_vars): Update use of ALL_BLOCK_SYMBOLS. (gdb_get_blocks, gdb_get_vars_command): Ditto. * generic/gdbtk-cmds.c: Include dictionary.h. (gdb_listfuncs): Update use of ALL_BLOCK_SYMBOLS. 2003-06-11 David Carlton <carlton@bactrian.org> * mi-cmd-stack.c: Include dictionary.h. (list_args_or_locals): Update use of ALL_BLOCK_SYMBOLS.
2003-06-12 01:29:49 +02:00
ALL_BLOCK_SYMBOLS (b, iter, sym)
{
QUIT;
/* Keep track of the highest stack argument offset seen, and
skip over any kinds of symbols we don't care about. */
switch (SYMBOL_CLASS (sym))
{
case LOC_ARG:
case LOC_REF_ARG:
{
long current_offset = SYMBOL_VALUE (sym);
int arg_size = TYPE_LENGTH (SYMBOL_TYPE (sym));
/* Compute address of next argument by adding the size of
this argument and rounding to an int boundary. */
current_offset =
((current_offset + arg_size + sizeof (int) - 1)
& ~(sizeof (int) - 1));
/* If this is the highest offset seen yet, set
highest_offset. */
if (highest_offset == -1
|| (current_offset > highest_offset))
highest_offset = current_offset;
/* Add the number of ints we're about to print to
args_printed. */
args_printed += (arg_size + sizeof (int) - 1) / sizeof (int);
}
/* We care about types of symbols, but don't need to
keep track of stack offsets in them. */
case LOC_REGPARM:
case LOC_REGPARM_ADDR:
case LOC_LOCAL_ARG:
case LOC_BASEREG_ARG:
case LOC_COMPUTED_ARG:
break;
/* Other types of symbols we just skip over. */
default:
continue;
}
/* We have to look up the symbol because arguments can have
two entries (one a parameter, one a local) and the one we
want is the local, which lookup_symbol will find for us.
This includes gcc1 (not gcc2) on SPARC when passing a
small structure and gcc2 when the argument type is float
and it is passed as a double and converted to float by
the prologue (in the latter case the type of the LOC_ARG
symbol is double and the type of the LOC_LOCAL symbol is
float). */
/* But if the parameter name is null, don't try it. Null
parameter names occur on the RS/6000, for traceback
tables. FIXME, should we even print them? */
if (*DEPRECATED_SYMBOL_NAME (sym))
{
struct symbol *nsym;
nsym = lookup_symbol (DEPRECATED_SYMBOL_NAME (sym),
b, VAR_DOMAIN, NULL, NULL);
if (SYMBOL_CLASS (nsym) == LOC_REGISTER)
{
/* There is a LOC_ARG/LOC_REGISTER pair. This means
that it was passed on the stack and loaded into a
register, or passed in a register and stored in a
stack slot. GDB 3.x used the LOC_ARG; GDB
4.0-4.11 used the LOC_REGISTER.
Reasons for using the LOC_ARG:
(1) Because find_saved_registers may be slow for
remote debugging.
(2) Because registers are often re-used and stack
slots rarely (never?) are. Therefore using
the stack slot is much less likely to print
garbage.
Reasons why we might want to use the LOC_REGISTER:
(1) So that the backtrace prints the same value
as "print foo". I see no compelling reason
why this needs to be the case; having the
backtrace print the value which was passed
in, and "print foo" print the value as
modified within the called function, makes
perfect sense to me.
Additional note: It might be nice if "info args"
displayed both values.
One more note: There is a case with SPARC
structure passing where we need to use the
LOC_REGISTER, but this is dealt with by creating
a single LOC_REGPARM in symbol reading. */
/* Leave sym (the LOC_ARG) alone. */
;
}
else
sym = nsym;
}
/* Print the current arg. */
if (!first)
ui_out_text (uiout, ", ");
ui_out_wrap_hint (uiout, " ");
annotate_arg_begin ();
list_chain = make_cleanup_ui_out_tuple_begin_end (uiout, NULL);
fprintf_symbol_filtered (stb->stream, SYMBOL_PRINT_NAME (sym),
SYMBOL_LANGUAGE (sym),
DMGL_PARAMS | DMGL_ANSI);
ui_out_field_stream (uiout, "name", stb);
annotate_arg_name_end ();
ui_out_text (uiout, "=");
/* Avoid value_print because it will deref ref parameters.
We just want to print their addresses. Print ??? for
args whose address we do not know. We pass 2 as
"recurse" to val_print because our standard indentation
here is 4 spaces, and val_print indents 2 for each
recurse. */
val = read_var_value (sym, frame);
annotate_arg_value (val == NULL ? NULL : value_type (val));
if (val)
{
common_val_print (val, stb->stream, 0, 0, 2, Val_no_prettyprint);
ui_out_field_stream (uiout, "value", stb);
}
else
ui_out_text (uiout, "???");
/* Invoke ui_out_tuple_end. */
do_cleanups (list_chain);
annotate_arg_end ();
first = 0;
}
}
/* Don't print nameless args in situations where we don't know
enough about the stack to find them. */
if (num != -1)
{
long start;
if (highest_offset == -1)
start = gdbarch_frame_args_skip (current_gdbarch);
else
start = highest_offset;
print_frame_nameless_args (frame, start, num - args_printed,
first, stream);
}
do_cleanups (old_chain);
}
/* Stub for catch_errors. */
static int
print_args_stub (void *args)
{
struct print_args_args *p = args;
int numargs;
if (gdbarch_frame_num_args_p (current_gdbarch))
2003-06-09 Andrew Cagney <cagney@redhat.com> * gdbarch.sh (FRAME_NUM_ARGS): Change to function with predicate. * gdbarch.h, gdbarch.c: Re-generate. * arch-utils.h (frame_num_args_unknown): Delete both declarations. * arch-utils.c (frame_num_args_unknown): Delete function. * stack.c (print_args_stub): Use FRAME_NUM_ARGS_P. (frame_info): Use FRAME_NUM_ARGS_P. * arm-tdep.c (arm_frame_num_args): Delete function. (arm_gdbarch_init): Do not set frame_num_args. * config/pa/tm-hppa64.h (FRAME_NUM_ARGS): Delete. * hppa-tdep.c (hppa_frame_num_args): Delete function. (hppa_gdbarch_init): Do not set frame_num_args. * config/sparc/tm-sparc.h (FRAME_NUM_ARGS): Delete. * xstormy16-tdep.c (xstormy16_gdbarch_init): Do not set frame_num_args to default frame_num_args_unknown. * v850-tdep.c (v850_gdbarch_init): Ditto. * sparc-tdep.c (sparc_gdbarch_init): Ditto. * sh-tdep.c (sh_gdbarch_init): Ditto. * s390-tdep.c (s390_gdbarch_init): Ditto. * rs6000-tdep.c (rs6000_gdbarch_init): Ditto. * mn10300-tdep.c (mn10300_gdbarch_init): Ditto. * mips-tdep.c (mips_gdbarch_init): Ditto. * mcore-tdep.c (mcore_gdbarch_init): Ditto. * m68k-tdep.c (m68k_gdbarch_init): Ditto. * m68hc11-tdep.c (m68hc11_gdbarch_init): Ditto. * ia64-tdep.c (ia64_gdbarch_init): Ditto. * i386-tdep.c (i386_gdbarch_init): Ditto. * h8300-tdep.c (h8300_gdbarch_init): Ditto. * frv-tdep.c (frv_gdbarch_init): Ditto. * d10v-tdep.c (d10v_gdbarch_init): Ditto. * cris-tdep.c (cris_gdbarch_init): Ditto. * avr-tdep.c (avr_gdbarch_init): Ditto. * alpha-tdep.c (alpha_gdbarch_init): Ditto.
2003-06-09 19:35:59 +02:00
{
numargs = gdbarch_frame_num_args (current_gdbarch, p->frame);
2003-06-09 Andrew Cagney <cagney@redhat.com> * gdbarch.sh (FRAME_NUM_ARGS): Change to function with predicate. * gdbarch.h, gdbarch.c: Re-generate. * arch-utils.h (frame_num_args_unknown): Delete both declarations. * arch-utils.c (frame_num_args_unknown): Delete function. * stack.c (print_args_stub): Use FRAME_NUM_ARGS_P. (frame_info): Use FRAME_NUM_ARGS_P. * arm-tdep.c (arm_frame_num_args): Delete function. (arm_gdbarch_init): Do not set frame_num_args. * config/pa/tm-hppa64.h (FRAME_NUM_ARGS): Delete. * hppa-tdep.c (hppa_frame_num_args): Delete function. (hppa_gdbarch_init): Do not set frame_num_args. * config/sparc/tm-sparc.h (FRAME_NUM_ARGS): Delete. * xstormy16-tdep.c (xstormy16_gdbarch_init): Do not set frame_num_args to default frame_num_args_unknown. * v850-tdep.c (v850_gdbarch_init): Ditto. * sparc-tdep.c (sparc_gdbarch_init): Ditto. * sh-tdep.c (sh_gdbarch_init): Ditto. * s390-tdep.c (s390_gdbarch_init): Ditto. * rs6000-tdep.c (rs6000_gdbarch_init): Ditto. * mn10300-tdep.c (mn10300_gdbarch_init): Ditto. * mips-tdep.c (mips_gdbarch_init): Ditto. * mcore-tdep.c (mcore_gdbarch_init): Ditto. * m68k-tdep.c (m68k_gdbarch_init): Ditto. * m68hc11-tdep.c (m68hc11_gdbarch_init): Ditto. * ia64-tdep.c (ia64_gdbarch_init): Ditto. * i386-tdep.c (i386_gdbarch_init): Ditto. * h8300-tdep.c (h8300_gdbarch_init): Ditto. * frv-tdep.c (frv_gdbarch_init): Ditto. * d10v-tdep.c (d10v_gdbarch_init): Ditto. * cris-tdep.c (cris_gdbarch_init): Ditto. * avr-tdep.c (avr_gdbarch_init): Ditto. * alpha-tdep.c (alpha_gdbarch_init): Ditto.
2003-06-09 19:35:59 +02:00
gdb_assert (numargs >= 0);
}
else
numargs = -1;
print_frame_args (p->func, p->frame, numargs, p->stream);
return 0;
}
/* Set the current source and line to the location given by frame
FRAME, if possible. When CENTER is true, adjust so the relevant
line is in the center of the next 'list'. */
void
set_current_sal_from_frame (struct frame_info *frame, int center)
{
struct symtab_and_line sal;
find_frame_sal (frame, &sal);
if (sal.symtab)
{
if (center)
sal.line = max (sal.line - get_lines_to_list () / 2, 1);
set_current_source_symtab_and_line (&sal);
}
}
/* Print information about frame FRAME. The output is format according
to PRINT_LEVEL and PRINT_WHAT and PRINT ARGS. The meaning of
PRINT_WHAT is:
SRC_LINE: Print only source line.
LOCATION: Print only location.
LOC_AND_SRC: Print location and source line.
Used in "where" output, and to emit breakpoint or step
messages. */
void
print_frame_info (struct frame_info *frame, int print_level,
enum print_what print_what, int print_args)
{
struct symtab_and_line sal;
2000-01-18 01:55:13 +01:00
int source_print;
int location_print;
if (get_frame_type (frame) == DUMMY_FRAME
|| get_frame_type (frame) == SIGTRAMP_FRAME)
{
struct cleanup *uiout_cleanup
= make_cleanup_ui_out_tuple_begin_end (uiout, "frame");
annotate_frame_begin (print_level ? frame_relative_level (frame) : 0,
get_frame_pc (frame));
/* Do this regardless of SOURCE because we don't have any source
1999-07-07 22:19:36 +02:00
to list for this frame. */
if (print_level)
{
ui_out_text (uiout, "#");
ui_out_field_fmt_int (uiout, 2, ui_left, "level",
frame_relative_level (frame));
}
if (ui_out_is_mi_like_p (uiout))
{
annotate_frame_address ();
ui_out_field_core_addr (uiout, "addr", get_frame_pc (frame));
annotate_frame_address_end ();
}
if (get_frame_type (frame) == DUMMY_FRAME)
{
annotate_function_call ();
ui_out_field_string (uiout, "func", "<function called from gdb>");
}
else if (get_frame_type (frame) == SIGTRAMP_FRAME)
{
annotate_signal_handler_caller ();
ui_out_field_string (uiout, "func", "<signal handler called>");
}
ui_out_text (uiout, "\n");
annotate_frame_end ();
do_cleanups (uiout_cleanup);
return;
}
/* If FRAME is not the innermost frame, that normally means that
FRAME->pc points to *after* the call instruction, and we want to
get the line containing the call, never the next line. But if
the next frame is a SIGTRAMP_FRAME or a DUMMY_FRAME, then the
next frame was not entered as the result of a call, and we want
to get the line containing FRAME->pc. */
find_frame_sal (frame, &sal);
location_print = (print_what == LOCATION
|| print_what == LOC_AND_ADDRESS
|| print_what == SRC_AND_LOC);
2000-01-18 01:55:13 +01:00
if (location_print || !sal.symtab)
print_frame (frame, print_level, print_what, print_args, sal);
2000-01-18 01:55:13 +01:00
source_print = (print_what == SRC_LINE || print_what == SRC_AND_LOC);
* source.c: Make global variables current_source_symtab and current_source_line static. (list_command): Moved to cli/cli-cmds.c. (ambiguous_line_spec): Moved to cli/cli-cmds.c. (get_first_line_listed): New accessor function. (get_lines_to_list): New accessor function. (get_current_source_symtab_and_line): New function. Retrieves the position in the source code that we consider current. (get_current_or_default_source_symtab_and_line): New function. Like the above but attempts to determine a default position if one is not currently defined. (set_current_source_symtab_and_line): New function. Sets the source code position considered current and returns the previously set one. (clear_current_source_symtab_and_line): Reset stored information about a current source line. (_initialize_source): Remove registration for the "list" command and its alias. * source.h: Add declarations for the new functions above. * symtab.h: Remove declarations for the global variables mentioned above. * breakpoint.c (parse_breakpoint_sals): Use accessor functions to obtain current source line. * linespec.c (decode_line_1): Ditto. * macroscope.c (default_macro_scope): Ditto. * scm-lang.c (scm_unpac): Ditto. * stack.c (print_frame_info_base): Ditto. * symfile.c (clear_symtab_users): Ditto. * symtab.c (decode_line_spec): Ditto. * cli/cli-cmds.c (list_command): Moved here from source.c. (ambiguous_line_spec): Moved here from source.c. (_init_cli_cmds): Add definition for "list" and its alias. * Makefile.in: Update dependencies.
2002-09-20 16:58:59 +02:00
2000-01-18 01:55:13 +01:00
if (source_print && sal.symtab)
{
int done = 0;
int mid_statement = ((print_what == SRC_LINE)
&& (get_frame_pc (frame) != sal.pc));
2000-01-18 01:55:13 +01:00
if (annotation_level)
done = identify_source_line (sal.symtab, sal.line, mid_statement,
get_frame_pc (frame));
2000-01-18 01:55:13 +01:00
if (!done)
{
2004-04-21 Andrew Cagney <cagney@redhat.com> * annotate.h (deprecated_annotate_starting_hook) (deprecated_annotate_stopped_hook) (deprecated_annotate_exited_hook) (deprecated_annotate_signal_hook) (deprecated_annotate_signalled_hook): Deprecate. * tracepoint.h (deprecated_create_tracepoint_hook) (deprecated_delete_tracepoint_hook) (deprecated_modify_tracepoint_hook) (deprecated_trace_find_hook) (deprecated_trace_start_stop_hook): Deprecate. * target.h (deprecated_target_new_objfile_hook): Deprecate. * remote.h (deprecated_target_resume_hook) (deprecated_target_wait_loop_hook): Deprecate. * gdbcore.h (deprecated_exec_file_display_hook) (deprecated_file_changed_hook): Deprecate. * frame.h (deprecated_selected_frame_level_changed_hook): Deprecate. * defs.h (deprecated_modify_breakpoint_hook) (deprecated_command_loop_hook, deprecated_show_load_progress) (deprecated_print_frame_info_listing_hook) (deprecated_query_hook, deprecated_warning_hook) (deprecated_flush_hook, deprecated_create_breakpoint_hook) (deprecated_delete_breakpoint_hook) (deprecated_interactive_hook, deprecated_registers_changed_hook) (deprecated_readline_begin_hook, deprecated_readline_hook) (deprecated_readline_end_hook, deprecated_register_changed_hook) (deprecated_memory_changed_hook, deprecated_init_ui_hook) (deprecated_context_hook, deprecated_target_wait_hook) (deprecated_attach_hook, deprecated_detach_hook) (deprecated_call_command_hook, deprecated_set_hook) (deprecated_error_hook, deprecated_error_begin_hook) (deprecated_ui_load_progress_hook): Deprecate. * valops.c, uw-thread.c, utils.c, tui/tui-io.c: Update. * tui/tui-hooks.c, tracepoint.c, top.c, thread-db.c: Update. * target.c, symfile.c, stack.c, sol-thread.c, rs6000-nat.c: Update. * remote.c, remote-mips.c, regcache.c, mi/mi-interp.c: Update. * main.c, interps.c, infcmd.c, hpux-thread.c, frame.c: Update. * exec.c, dsrec.c, d10v-tdep.c, corefile.c, complaints.c: Update. * cli/cli-script.c, cli/cli-setshow.c, breakpoint.c: Update. * annotate.c, aix-thread.c: Update.
2004-04-22 01:52:21 +02:00
if (deprecated_print_frame_info_listing_hook)
deprecated_print_frame_info_listing_hook (sal.symtab,
sal.line,
sal.line + 1, 0);
else
2000-01-18 01:55:13 +01:00
{
/* We used to do this earlier, but that is clearly
wrong. This function is used by many different
parts of gdb, including normal_stop in infrun.c,
which uses this to print out the current PC
when we stepi/nexti into the middle of a source
line. Only the command line really wants this
behavior. Other UIs probably would like the
ability to decide for themselves if it is desired. */
if (addressprint && mid_statement)
{
ui_out_field_core_addr (uiout, "addr", get_frame_pc (frame));
ui_out_text (uiout, "\t");
}
print_source_lines (sal.symtab, sal.line, sal.line + 1, 0);
2000-01-18 01:55:13 +01:00
}
}
}
if (print_what != LOCATION)
set_default_breakpoint (1, get_frame_pc (frame), sal.symtab, sal.line);
2000-01-18 01:55:13 +01:00
annotate_frame_end ();
gdb_flush (gdb_stdout);
}
static void
print_frame (struct frame_info *frame, int print_level,
enum print_what print_what, int print_args,
2000-01-18 01:55:13 +01:00
struct symtab_and_line sal)
{
struct symbol *func;
char *funname = NULL;
2000-01-18 01:55:13 +01:00
enum language funlang = language_unknown;
2000-02-03 05:14:45 +01:00
struct ui_stream *stb;
struct cleanup *old_chain, *list_chain;
2000-02-03 05:14:45 +01:00
stb = ui_out_stream_new (uiout);
old_chain = make_cleanup_ui_out_stream_delete (stb);
2000-01-18 01:55:13 +01:00
func = find_pc_function (get_frame_address_in_block (frame));
if (func)
{
/* In certain pathological cases, the symtabs give the wrong
1999-07-07 22:19:36 +02:00
function (when we are in the first function in a file which
is compiled without debugging symbols, the previous function
is compiled with debugging symbols, and the "foo.o" symbol
that is supposed to tell us where the file with debugging
symbols ends has been truncated by ar because it is longer
than 15 characters). This also occurs if the user uses asm()
to create a function but not stabs for it (in a file compiled
with -g).
1999-07-07 22:19:36 +02:00
So look in the minimal symbol tables as well, and if it comes
up with a larger address for the function use that instead.
I don't think this can ever cause any problems; there
shouldn't be any minimal symbols in the middle of a function;
if this is ever changed many parts of GDB will need to be
changed (and we'll create a find_pc_minimal_function or some
such). */
struct minimal_symbol *msymbol =
lookup_minimal_symbol_by_pc (get_frame_address_in_block (frame));
if (msymbol != NULL
1999-07-07 22:19:36 +02:00
&& (SYMBOL_VALUE_ADDRESS (msymbol)
> BLOCK_START (SYMBOL_BLOCK_VALUE (func))))
{
/* We also don't know anything about the function besides
its address and name. */
func = 0;
2003-02-25 David Carlton <carlton@math.stanford.edu> * symtab.h (SYMBOL_NATURAL_NAME): New macro. (SYMBOL_LINKAGE_NAME): Ditto. (SYMBOL_PRINT_NAME): Use SYMBOL_NATURAL_NAME and SYMBOL_LINKAGE_NAME. (struct general_symbol_info): Expand comment. (DEPRECATED_SYMBOL_NAME): Rename from SYMBOL_NAME. (SYMBOL_MATCHES_NAME): Use DEPRECATED_SYMBOL_NAME. (SYMBOL_MATCHES_REGEXP): Ditto. * symtab.c (symbol_natural_name): New function. * objfiles.h: Replace all uses of SYMBOL_NAME by DEPRECATED_SYMBOL_NAME. * xcoffread.c, valops.c, typeprint.c, tracepoint.c: Ditto. * symtab.c, symmisc.c, symfile.c, stack.c, stabsread.c: Ditto. * somsolib.c, sol-thread.c, rs6000-tdep.c, p-valprint.c: Ditto. * printcmd.c, objfiles.c, objc-lang.c, mipsread.c: Ditto. * minsyms.c, mdebugread.c, linespec.c, jv-lang.c: Ditto. * i386-tdep.c, i386-linux-tdep.c, hpread.c, hppa-tdep.c: Ditto. * gnu-v2-abi.c, f-valprint.c, findvar.c, expprint.c: Ditto. * dwarfread.c, dwarf2read.c, dbxread.c, c-valprint.c: Ditto. * cp-valprint.c, coffread.c, buildsym.c, breakpoint.c: Ditto. * blockframe.c, ax-gdb.c, arm-linux-tdep.c, ada-lang.c: Ditto. * ada-exp.y: Ditto. * ada-exp.y: Update copyright. * sol-thread.c, mipsread.c, jv-lang.c, f-valprint.c: Ditto. * cp-valprint.c: Ditto. 2003-02-25 David Carlton <carlton@math.stanford.edu> * generic/gdbtk.h: Replace all instances of SYMBOL_NAME by DEPRECATED_SYMBOL_NAME. * generic/gdbtk-stack.c, generic/gdbtk-cmds.c: Ditto. * generic/gdbtk-stack.c, generic/gdbtk-cmds.c: Update copyright. 2003-02-25 David Carlton <carlton@math.stanford.edu> * mi-cmd-stack.c: Replace all instances of SYMBOL_NAME with DEPRECATED_SYMBOL_NAME. Update copyright.
2003-02-25 22:36:23 +01:00
funname = DEPRECATED_SYMBOL_NAME (msymbol);
funlang = SYMBOL_LANGUAGE (msymbol);
}
else
{
2003-02-25 David Carlton <carlton@math.stanford.edu> * symtab.h (SYMBOL_NATURAL_NAME): New macro. (SYMBOL_LINKAGE_NAME): Ditto. (SYMBOL_PRINT_NAME): Use SYMBOL_NATURAL_NAME and SYMBOL_LINKAGE_NAME. (struct general_symbol_info): Expand comment. (DEPRECATED_SYMBOL_NAME): Rename from SYMBOL_NAME. (SYMBOL_MATCHES_NAME): Use DEPRECATED_SYMBOL_NAME. (SYMBOL_MATCHES_REGEXP): Ditto. * symtab.c (symbol_natural_name): New function. * objfiles.h: Replace all uses of SYMBOL_NAME by DEPRECATED_SYMBOL_NAME. * xcoffread.c, valops.c, typeprint.c, tracepoint.c: Ditto. * symtab.c, symmisc.c, symfile.c, stack.c, stabsread.c: Ditto. * somsolib.c, sol-thread.c, rs6000-tdep.c, p-valprint.c: Ditto. * printcmd.c, objfiles.c, objc-lang.c, mipsread.c: Ditto. * minsyms.c, mdebugread.c, linespec.c, jv-lang.c: Ditto. * i386-tdep.c, i386-linux-tdep.c, hpread.c, hppa-tdep.c: Ditto. * gnu-v2-abi.c, f-valprint.c, findvar.c, expprint.c: Ditto. * dwarfread.c, dwarf2read.c, dbxread.c, c-valprint.c: Ditto. * cp-valprint.c, coffread.c, buildsym.c, breakpoint.c: Ditto. * blockframe.c, ax-gdb.c, arm-linux-tdep.c, ada-lang.c: Ditto. * ada-exp.y: Ditto. * ada-exp.y: Update copyright. * sol-thread.c, mipsread.c, jv-lang.c, f-valprint.c: Ditto. * cp-valprint.c: Ditto. 2003-02-25 David Carlton <carlton@math.stanford.edu> * generic/gdbtk.h: Replace all instances of SYMBOL_NAME by DEPRECATED_SYMBOL_NAME. * generic/gdbtk-stack.c, generic/gdbtk-cmds.c: Ditto. * generic/gdbtk-stack.c, generic/gdbtk-cmds.c: Update copyright. 2003-02-25 David Carlton <carlton@math.stanford.edu> * mi-cmd-stack.c: Replace all instances of SYMBOL_NAME with DEPRECATED_SYMBOL_NAME. Update copyright.
2003-02-25 22:36:23 +01:00
funname = DEPRECATED_SYMBOL_NAME (func);
funlang = SYMBOL_LANGUAGE (func);
1999-07-07 22:19:36 +02:00
if (funlang == language_cplus)
{
/* It seems appropriate to use SYMBOL_PRINT_NAME() here,
to display the demangled name that we already have
stored in the symbol table, but we stored a version
with DMGL_PARAMS turned on, and here we don't want to
display parameters. So call the demangler again, with
DMGL_ANSI only.
Yes, printf_symbol_filtered() will again try to
demangle the name on the fly, but the issue is that
if cplus_demangle() fails here, it will fail there
too. So we want to catch the failure (where DEMANGLED
is NULL below) here, while we still have our hands on
the function symbol.) */
char *demangled = cplus_demangle (funname, DMGL_ANSI);
1999-07-07 22:19:36 +02:00
if (demangled == NULL)
2000-01-18 01:55:13 +01:00
/* If the demangler fails, try the demangled name from
the symbol table. That'll have parameters, but
that's preferable to displaying a mangled name. */
2003-02-20 David Carlton <carlton@math.stanford.edu> * symtab.h (SYMBOL_PRINT_NAME): Rename from SYMBOL_SOURCE_NAME; expand comment. * ada-lang.c (user_select_syms, ada_finish_decode_line_1): Replace SYMBOL_PRINT_NAME with SYMBOL_SOURCE_NAME. * ada-typeprint.c (ada_typedef_print): Ditto. * ax-gdb.c (gen_var_ref): Ditto. * breakpoint.c (print_one_breakpoint): Ditto. * buildsym.c (finish_block): Ditto. * c-valprint.c (c_val_print): Ditto. * expprint.c (print_subexp): Ditto. * findvar.c (locate_var_value): Ditto. * infcmd.c (jump_command): Ditto. * linespec.c (decode_line_2, decode_compound): Ditto. * maint.c (maintenance_translate_address): Ditto. * objc-lang.c (compare_selectors, compare_classes): Ditto. * printcmd.c (build_address_symbolic, sym_info, print_frame_args): Ditto. * p-valprint.c (pascal_val_print): Ditto. * stabsread.c (define_symbol): Ditto. * stack.c (print_frame, frame_info, print_block_frame_locals) (print_frame_arg_vars, return_command): Ditto. * symfile.c (compare_symbols, compare_psymbols): Ditto. * symmisc.c (print_symbol): Ditto. * symtab.c (lookup_partial_symbol, lookup_block_symbol) (compare_search_syms, print_symbol_info, print_msymbol_info) (rbreak_command): Ditto. * tracepoint.c (tracepoints_info): Ditto. * typeprint.c (typedef_print): Ditto. * valops.c (value_of_variable, hand_function_call): Ditto. * cli/cli-cmds.c (edit_command, list_command): Ditto. * ada-typeprint.c: Update Copyright. * infcmd.c, objc-lang.c, p-valprint.c, symmisc.c: Ditto. * tracepoint.c, cli/cli-cmds.c: Ditto.
2003-02-20 18:17:25 +01:00
funname = SYMBOL_PRINT_NAME (func);
1999-07-07 22:19:36 +02:00
}
}
}
else
{
struct minimal_symbol *msymbol =
lookup_minimal_symbol_by_pc (get_frame_address_in_block (frame));
if (msymbol != NULL)
{
2003-02-25 David Carlton <carlton@math.stanford.edu> * symtab.h (SYMBOL_NATURAL_NAME): New macro. (SYMBOL_LINKAGE_NAME): Ditto. (SYMBOL_PRINT_NAME): Use SYMBOL_NATURAL_NAME and SYMBOL_LINKAGE_NAME. (struct general_symbol_info): Expand comment. (DEPRECATED_SYMBOL_NAME): Rename from SYMBOL_NAME. (SYMBOL_MATCHES_NAME): Use DEPRECATED_SYMBOL_NAME. (SYMBOL_MATCHES_REGEXP): Ditto. * symtab.c (symbol_natural_name): New function. * objfiles.h: Replace all uses of SYMBOL_NAME by DEPRECATED_SYMBOL_NAME. * xcoffread.c, valops.c, typeprint.c, tracepoint.c: Ditto. * symtab.c, symmisc.c, symfile.c, stack.c, stabsread.c: Ditto. * somsolib.c, sol-thread.c, rs6000-tdep.c, p-valprint.c: Ditto. * printcmd.c, objfiles.c, objc-lang.c, mipsread.c: Ditto. * minsyms.c, mdebugread.c, linespec.c, jv-lang.c: Ditto. * i386-tdep.c, i386-linux-tdep.c, hpread.c, hppa-tdep.c: Ditto. * gnu-v2-abi.c, f-valprint.c, findvar.c, expprint.c: Ditto. * dwarfread.c, dwarf2read.c, dbxread.c, c-valprint.c: Ditto. * cp-valprint.c, coffread.c, buildsym.c, breakpoint.c: Ditto. * blockframe.c, ax-gdb.c, arm-linux-tdep.c, ada-lang.c: Ditto. * ada-exp.y: Ditto. * ada-exp.y: Update copyright. * sol-thread.c, mipsread.c, jv-lang.c, f-valprint.c: Ditto. * cp-valprint.c: Ditto. 2003-02-25 David Carlton <carlton@math.stanford.edu> * generic/gdbtk.h: Replace all instances of SYMBOL_NAME by DEPRECATED_SYMBOL_NAME. * generic/gdbtk-stack.c, generic/gdbtk-cmds.c: Ditto. * generic/gdbtk-stack.c, generic/gdbtk-cmds.c: Update copyright. 2003-02-25 David Carlton <carlton@math.stanford.edu> * mi-cmd-stack.c: Replace all instances of SYMBOL_NAME with DEPRECATED_SYMBOL_NAME. Update copyright.
2003-02-25 22:36:23 +01:00
funname = DEPRECATED_SYMBOL_NAME (msymbol);
funlang = SYMBOL_LANGUAGE (msymbol);
}
}
annotate_frame_begin (print_level ? frame_relative_level (frame) : 0,
get_frame_pc (frame));
2000-01-18 01:55:13 +01:00
2001-05-12 06:08:24 +02:00
list_chain = make_cleanup_ui_out_tuple_begin_end (uiout, "frame");
2000-01-18 01:55:13 +01:00
if (print_level)
2000-02-03 05:14:45 +01:00
{
ui_out_text (uiout, "#");
ui_out_field_fmt_int (uiout, 2, ui_left, "level",
frame_relative_level (frame));
2000-02-03 05:14:45 +01:00
}
2000-01-18 01:55:13 +01:00
if (addressprint)
if (get_frame_pc (frame) != sal.pc || !sal.symtab
|| print_what == LOC_AND_ADDRESS)
2000-01-18 01:55:13 +01:00
{
annotate_frame_address ();
ui_out_field_core_addr (uiout, "addr", get_frame_pc (frame));
2000-02-03 05:14:45 +01:00
annotate_frame_address_end ();
ui_out_text (uiout, " in ");
2000-01-18 01:55:13 +01:00
}
annotate_frame_function_name ();
fprintf_symbol_filtered (stb->stream, funname ? funname : "??",
funlang, DMGL_ANSI);
2000-02-03 05:14:45 +01:00
ui_out_field_stream (uiout, "func", stb);
ui_out_wrap_hint (uiout, " ");
2000-01-18 01:55:13 +01:00
annotate_frame_args ();
2000-02-03 05:14:45 +01:00
ui_out_text (uiout, " (");
if (print_args)
{
2000-01-18 01:55:13 +01:00
struct print_args_args args;
struct cleanup *args_list_chain;
args.frame = frame;
2000-01-18 01:55:13 +01:00
args.func = func;
args.stream = gdb_stdout;
args_list_chain = make_cleanup_ui_out_list_begin_end (uiout, "args");
2000-01-18 01:55:13 +01:00
catch_errors (print_args_stub, &args, "", RETURN_MASK_ALL);
/* FIXME: ARGS must be a list. If one argument is a string it
will have " that will not be properly escaped. */
2001-05-12 06:08:24 +02:00
/* Invoke ui_out_tuple_end. */
do_cleanups (args_list_chain);
2000-01-18 01:55:13 +01:00
QUIT;
}
2000-02-03 05:14:45 +01:00
ui_out_text (uiout, ")");
2000-01-18 01:55:13 +01:00
if (sal.symtab && sal.symtab->filename)
{
annotate_frame_source_begin ();
2000-02-03 05:14:45 +01:00
ui_out_wrap_hint (uiout, " ");
ui_out_text (uiout, " at ");
annotate_frame_source_file ();
ui_out_field_string (uiout, "file", sal.symtab->filename);
if (ui_out_is_mi_like_p (uiout))
{
const char *fullname = symtab_to_fullname (sal.symtab);
if (fullname != NULL)
ui_out_field_string (uiout, "fullname", fullname);
}
2000-02-03 05:14:45 +01:00
annotate_frame_source_file_end ();
ui_out_text (uiout, ":");
annotate_frame_source_line ();
ui_out_field_int (uiout, "line", sal.line);
2000-01-18 01:55:13 +01:00
annotate_frame_source_end ();
}
2000-01-18 01:55:13 +01:00
if (!funname || (!sal.symtab || !sal.symtab->filename))
{
* solib.h (CLEAR_SOLIB, SOLIB_ADD) (SOLIB_CREATE_INFERIOR_HOOK, SOLIB_REMOVE_INFERIOR_HOOK) (SOLIB_IN_DYNAMIC_LINKER, SOLIB_RESTART) (DISABLE_UNSETTABLE_BREAK, PC_SOLIB) (IN_SOLIB_DYNSYM_RESOLVE_CODE): Remove defines and orphaned comments. * breakpoint.c: Include "solib.h". (insert_bp_location) [!DISABLE_UNSETTABLE_BREAK]: Call solib_address. (remove_solib_event_breakpoints, create_solib_event_breakpoint) (disable_breakpoints_in_shlibs) (disable_breakpoints_in_unloaded_shlib) (re_enable_breakpoints_in_shlibs): Compile if SOLIB_ADD isn't defined. If PC_SOLIB isn't defined, call solib_address. (_initialize_breakpoint): Unconditionally install observer. * corelow.c: Include "solib.h". [SOLIB_ADD] (solib_add_stub): Remove prototype. (core_close) [!CLEAR_SOLIB]: Call clear_solib. (solib_add_stub) [!SOLIB_ADD] Call solib_add. (core_open): Unconditionally call solib_add_stub. * fork-child.c: Include "solib.h". (fork_inferior) [!SOLIB_CREATE_INFERIOR_HOOK]: Call solib_create_inferior_hook. * infcmd.c: Include "solib.h". (attach_command) [!SOLIB_ADD]: Call shlib_rescan. Unconditionally call re_enable_breakpoints_in_shlibs. * infrun.c: Include "solib.h". (SOLIB_IN_SYNSYM_RESOLVE_CODE): Don't define if not already defined. (stop_on_solib_events, show_stop_on_solib_events): Include unconditionally. (follow_exec) [!SOLIB_CREATE_INFERIOR_HOOK]: Call solib_create_inferior_hook. (handle_inferior_event) [!SOLIB_ADD]: Call shlib_add. [!IN_SOLIB_DYNSYM_RESOLVE_CODE]: Call in_solib_dynsym_resolve_code. (_initialize_infrun): Unconditionally add "stop_on_solib-events" command. * remote.c: Include "solib.h". (remote_open_1): Unconditionally call no_shared_libraries. [!SOLIB_CREATE_INFERIOR_HOOK] Call solib_create_inferior_hook. * stack.c: Include "solib.h". (print_frame) [!PC_SOLIB] Call shlib_for_pc. * xcoffsolib.c (no_shared_libraries): Remove function. * Makefile.in (SFILES): Add solib.c. (ALLDEPFILES): Remove solib.c. (COMMON_OBS): Add solib.o. (breakpoint.o, corelow.o, fork-chiled.o, infcmd.o, infrun.o) (remote.o, stack.o): Update dependencies.
2005-05-12 22:21:18 +02:00
#ifdef PC_SOLIB
char *lib = PC_SOLIB (get_frame_pc (frame));
* solib.h (CLEAR_SOLIB, SOLIB_ADD) (SOLIB_CREATE_INFERIOR_HOOK, SOLIB_REMOVE_INFERIOR_HOOK) (SOLIB_IN_DYNAMIC_LINKER, SOLIB_RESTART) (DISABLE_UNSETTABLE_BREAK, PC_SOLIB) (IN_SOLIB_DYNSYM_RESOLVE_CODE): Remove defines and orphaned comments. * breakpoint.c: Include "solib.h". (insert_bp_location) [!DISABLE_UNSETTABLE_BREAK]: Call solib_address. (remove_solib_event_breakpoints, create_solib_event_breakpoint) (disable_breakpoints_in_shlibs) (disable_breakpoints_in_unloaded_shlib) (re_enable_breakpoints_in_shlibs): Compile if SOLIB_ADD isn't defined. If PC_SOLIB isn't defined, call solib_address. (_initialize_breakpoint): Unconditionally install observer. * corelow.c: Include "solib.h". [SOLIB_ADD] (solib_add_stub): Remove prototype. (core_close) [!CLEAR_SOLIB]: Call clear_solib. (solib_add_stub) [!SOLIB_ADD] Call solib_add. (core_open): Unconditionally call solib_add_stub. * fork-child.c: Include "solib.h". (fork_inferior) [!SOLIB_CREATE_INFERIOR_HOOK]: Call solib_create_inferior_hook. * infcmd.c: Include "solib.h". (attach_command) [!SOLIB_ADD]: Call shlib_rescan. Unconditionally call re_enable_breakpoints_in_shlibs. * infrun.c: Include "solib.h". (SOLIB_IN_SYNSYM_RESOLVE_CODE): Don't define if not already defined. (stop_on_solib_events, show_stop_on_solib_events): Include unconditionally. (follow_exec) [!SOLIB_CREATE_INFERIOR_HOOK]: Call solib_create_inferior_hook. (handle_inferior_event) [!SOLIB_ADD]: Call shlib_add. [!IN_SOLIB_DYNSYM_RESOLVE_CODE]: Call in_solib_dynsym_resolve_code. (_initialize_infrun): Unconditionally add "stop_on_solib-events" command. * remote.c: Include "solib.h". (remote_open_1): Unconditionally call no_shared_libraries. [!SOLIB_CREATE_INFERIOR_HOOK] Call solib_create_inferior_hook. * stack.c: Include "solib.h". (print_frame) [!PC_SOLIB] Call shlib_for_pc. * xcoffsolib.c (no_shared_libraries): Remove function. * Makefile.in (SFILES): Add solib.c. (ALLDEPFILES): Remove solib.c. (COMMON_OBS): Add solib.o. (breakpoint.o, corelow.o, fork-chiled.o, infcmd.o, infrun.o) (remote.o, stack.o): Update dependencies.
2005-05-12 22:21:18 +02:00
#else
char *lib = solib_address (get_frame_pc (frame));
* solib.h (CLEAR_SOLIB, SOLIB_ADD) (SOLIB_CREATE_INFERIOR_HOOK, SOLIB_REMOVE_INFERIOR_HOOK) (SOLIB_IN_DYNAMIC_LINKER, SOLIB_RESTART) (DISABLE_UNSETTABLE_BREAK, PC_SOLIB) (IN_SOLIB_DYNSYM_RESOLVE_CODE): Remove defines and orphaned comments. * breakpoint.c: Include "solib.h". (insert_bp_location) [!DISABLE_UNSETTABLE_BREAK]: Call solib_address. (remove_solib_event_breakpoints, create_solib_event_breakpoint) (disable_breakpoints_in_shlibs) (disable_breakpoints_in_unloaded_shlib) (re_enable_breakpoints_in_shlibs): Compile if SOLIB_ADD isn't defined. If PC_SOLIB isn't defined, call solib_address. (_initialize_breakpoint): Unconditionally install observer. * corelow.c: Include "solib.h". [SOLIB_ADD] (solib_add_stub): Remove prototype. (core_close) [!CLEAR_SOLIB]: Call clear_solib. (solib_add_stub) [!SOLIB_ADD] Call solib_add. (core_open): Unconditionally call solib_add_stub. * fork-child.c: Include "solib.h". (fork_inferior) [!SOLIB_CREATE_INFERIOR_HOOK]: Call solib_create_inferior_hook. * infcmd.c: Include "solib.h". (attach_command) [!SOLIB_ADD]: Call shlib_rescan. Unconditionally call re_enable_breakpoints_in_shlibs. * infrun.c: Include "solib.h". (SOLIB_IN_SYNSYM_RESOLVE_CODE): Don't define if not already defined. (stop_on_solib_events, show_stop_on_solib_events): Include unconditionally. (follow_exec) [!SOLIB_CREATE_INFERIOR_HOOK]: Call solib_create_inferior_hook. (handle_inferior_event) [!SOLIB_ADD]: Call shlib_add. [!IN_SOLIB_DYNSYM_RESOLVE_CODE]: Call in_solib_dynsym_resolve_code. (_initialize_infrun): Unconditionally add "stop_on_solib-events" command. * remote.c: Include "solib.h". (remote_open_1): Unconditionally call no_shared_libraries. [!SOLIB_CREATE_INFERIOR_HOOK] Call solib_create_inferior_hook. * stack.c: Include "solib.h". (print_frame) [!PC_SOLIB] Call shlib_for_pc. * xcoffsolib.c (no_shared_libraries): Remove function. * Makefile.in (SFILES): Add solib.c. (ALLDEPFILES): Remove solib.c. (COMMON_OBS): Add solib.o. (breakpoint.o, corelow.o, fork-chiled.o, infcmd.o, infrun.o) (remote.o, stack.o): Update dependencies.
2005-05-12 22:21:18 +02:00
#endif
2000-01-18 01:55:13 +01:00
if (lib)
{
2000-01-18 01:55:13 +01:00
annotate_frame_where ();
2000-02-03 05:14:45 +01:00
ui_out_wrap_hint (uiout, " ");
ui_out_text (uiout, " from ");
ui_out_field_string (uiout, "from", lib);
}
}
1999-10-26 05:43:48 +02:00
2001-05-12 06:08:24 +02:00
/* do_cleanups will call ui_out_tuple_end() for us. */
do_cleanups (list_chain);
2000-02-03 05:14:45 +01:00
ui_out_text (uiout, "\n");
do_cleanups (old_chain);
}
/* Show the frame info. If this is the tui, it will be shown in the
source display otherwise, nothing is done. */
void
show_stack_frame (struct frame_info *frame)
{
}
1999-07-07 22:19:36 +02:00
/* Read a frame specification in whatever the appropriate format is
from FRAME_EXP. Call error(), printing MESSAGE, if the
specification is in any way invalid (so this function never returns
NULL). When SEPECTED_P is non-NULL set its target to indicate that
the default selected frame was used. */
static struct frame_info *
parse_frame_specification_1 (const char *frame_exp, const char *message,
int *selected_frame_p)
{
int numargs;
struct value *args[4];
CORE_ADDR addrs[ARRAY_SIZE (args)];
1999-07-07 22:19:36 +02:00
if (frame_exp == NULL)
numargs = 0;
else
{
char *addr_string;
struct cleanup *tmp_cleanup;
numargs = 0;
while (1)
{
char *addr_string;
struct cleanup *cleanup;
const char *p;
/* Skip leading white space, bail of EOL. */
while (isspace (*frame_exp))
frame_exp++;
if (!*frame_exp)
break;
/* Parse the argument, extract it, save it. */
for (p = frame_exp;
*p && !isspace (*p);
p++);
addr_string = savestring (frame_exp, p - frame_exp);
frame_exp = p;
cleanup = make_cleanup (xfree, addr_string);
/* NOTE: Parse and evaluate expression, but do not use
functions such as parse_and_eval_long or
parse_and_eval_address to also extract the value.
Instead value_as_long and value_as_address are used.
This avoids problems with expressions that contain
side-effects. */
if (numargs >= ARRAY_SIZE (args))
2005-02-10 Andrew Cagney <cagney@gnu.org> Mark up all error and warning messages. * ada-lang.c, amd64-tdep.c, arch-utils.c, breakpoint.c: Update. * bsd-kvm.c, bsd-uthread.c, coff-solib.h, coffread.c: Update. * core-aout.c, core-regset.c, corefile.c, corelow.c: Update. * cp-abi.c, cp-support.c, cp-valprint.c, cris-tdep.c: Update. * dbxread.c, demangle.c, doublest.c, dsrec.c: Update. * dve3900-rom.c, dwarf2expr.c, dwarf2loc.c: Update. * dwarf2read.c, dwarfread.c, elfread.c, eval.c: Update. * event-top.c, exec.c, expprint.c, f-lang.c: Update. * f-typeprint.c, f-valprint.c, fbsd-nat.c, findvar.c: Update. * frame.c, frv-linux-tdep.c, gcore.c, gdbtypes.c: Update. * gnu-nat.c, gnu-v2-abi.c, gnu-v3-abi.c, go32-nat.c: Update. * hpacc-abi.c, hppa-hpux-nat.c, hppa-hpux-tdep.c: Update. * hppa-linux-nat.c, hppa-linux-tdep.c, hppa-tdep.c: Update. * hpread.c, hpux-thread.c, i386-linux-nat.c: Update. * i386-linux-tdep.c, i386-tdep.c, i386bsd-nat.c: Update. * i386gnu-nat.c, i387-tdep.c, ia64-linux-nat.c: Update. * ia64-tdep.c, inf-child.c, inf-ptrace.c, inf-ttrace.c: Update. * infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update. * inftarg.c, interps.c, irix5-nat.c, jv-lang.c: Update. * kod-cisco.c, kod.c, language.c, libunwind-frame.c: Update. * linespec.c, linux-nat.c, linux-thread-db.c, m2-lang.c: Update. * m32r-rom.c, m68hc11-tdep.c, m68k-tdep.c: Update. * m68klinux-nat.c, macrocmd.c, macroexp.c, main.c: Update. * maint.c, mdebugread.c, mem-break.c, memattr.c: Update. * mips-linux-tdep.c, mips-tdep.c, mipsread.c, monitor.c: Update. * nlmread.c, nto-procfs.c, objc-lang.c, objfiles.c: Update. * observer.c, ocd.c, p-lang.c, p-typeprint.c: Update. * p-valprint.c, pa64solib.c, parse.c, ppc-linux-tdep.c: Update. * ppcnbsd-tdep.c, printcmd.c, procfs.c, remote-e7000.c: Update. * remote-fileio.c, remote-m32r-sdi.c, remote-rdi.c: Update. * remote-rdp.c, remote-sim.c, remote-st.c: Update. * remote-utils.c, remote-utils.h, remote.c: Update. * rom68k-rom.c, rs6000-nat.c, s390-tdep.c, scm-lang.c: Update. * ser-e7kpc.c, ser-tcp.c, ser-unix.c, sh-tdep.c: Update. * sh3-rom.c, shnbsd-tdep.c, sol-thread.c, solib-aix5.c: Update. * solib-frv.c, solib-irix.c, solib-osf.c, solib-pa64.c: Update. * solib-som.c, solib-sunos.c, solib-svr4.c, solib.c: Update. * somread.c, somsolib.c, source.c, stabsread.c: Update. * stack.c, std-regs.c, symfile-mem.c, symfile.c: Update. * symmisc.c, symtab.c, target.c, thread.c, top.c: Update. * tracepoint.c, trad-frame.c, typeprint.c, utils.c: Update. * uw-thread.c, valarith.c, valops.c, valprint.c: Update. * value.c, varobj.c, version.in, win32-nat.c, wince.c: Update. * xcoffread.c, xcoffsolib.c, cli/cli-cmds.c: Update. * cli/cli-decode.c, cli/cli-dump.c, cli/cli-logging.c: Update. * cli/cli-script.c, cli/cli-setshow.c, mi/mi-cmd-break.c: Update. * mi/mi-cmd-disas.c, mi/mi-cmd-env.c, mi/mi-cmd-file.c: Update. * mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-getopt.c: Update. * mi/mi-symbol-cmds.c, tui/tui-layout.c, tui/tui-stack.c: Update. * tui/tui-win.c: Update.
2005-02-11 05:06:14 +01:00
error (_("Too many args in frame specification"));
args[numargs++] = parse_and_eval (addr_string);
do_cleanups (cleanup);
}
}
/* If no args, default to the selected frame. */
if (numargs == 0)
{
if (selected_frame_p != NULL)
(*selected_frame_p) = 1;
return get_selected_frame (message);
}
/* None of the remaining use the selected frame. */
if (selected_frame_p != NULL)
(*selected_frame_p) = 0;
/* Assume the single arg[0] is an integer, and try using that to
select a frame relative to current. */
if (numargs == 1)
{
struct frame_info *fid;
int level = value_as_long (args[0]);
fid = find_relative_frame (get_current_frame (), &level);
if (level == 0)
/* find_relative_frame was successful */
return fid;
}
/* Convert each value into a corresponding address. */
{
int i;
for (i = 0; i < numargs; i++)
addrs[i] = value_as_address (args[0]);
}
1999-07-07 22:19:36 +02:00
/* Assume that the single arg[0] is an address, use that to identify
a frame with a matching ID. Should this also accept stack/pc or
stack/pc/special. */
if (numargs == 1)
{
struct frame_id id = frame_id_build_wild (addrs[0]);
struct frame_info *fid;
/* If (s)he specifies the frame with an address, he deserves
what (s)he gets. Still, give the highest one that matches.
(NOTE: cagney/2004-10-29: Why highest, or outer-most, I don't
know). */
for (fid = get_current_frame ();
fid != NULL;
fid = get_prev_frame (fid))
{
if (frame_id_eq (id, get_frame_id (fid)))
{
while (frame_id_eq (id, frame_unwind_id (fid)))
fid = get_prev_frame (fid);
return fid;
}
}
}
/* We couldn't identify the frame as an existing frame, but
perhaps we can create one with a single argument. */
if (numargs == 1)
return create_new_frame (addrs[0], 0);
else if (numargs == 2)
return create_new_frame (addrs[0], addrs[1]);
else
2005-02-10 Andrew Cagney <cagney@gnu.org> Mark up all error and warning messages. * ada-lang.c, amd64-tdep.c, arch-utils.c, breakpoint.c: Update. * bsd-kvm.c, bsd-uthread.c, coff-solib.h, coffread.c: Update. * core-aout.c, core-regset.c, corefile.c, corelow.c: Update. * cp-abi.c, cp-support.c, cp-valprint.c, cris-tdep.c: Update. * dbxread.c, demangle.c, doublest.c, dsrec.c: Update. * dve3900-rom.c, dwarf2expr.c, dwarf2loc.c: Update. * dwarf2read.c, dwarfread.c, elfread.c, eval.c: Update. * event-top.c, exec.c, expprint.c, f-lang.c: Update. * f-typeprint.c, f-valprint.c, fbsd-nat.c, findvar.c: Update. * frame.c, frv-linux-tdep.c, gcore.c, gdbtypes.c: Update. * gnu-nat.c, gnu-v2-abi.c, gnu-v3-abi.c, go32-nat.c: Update. * hpacc-abi.c, hppa-hpux-nat.c, hppa-hpux-tdep.c: Update. * hppa-linux-nat.c, hppa-linux-tdep.c, hppa-tdep.c: Update. * hpread.c, hpux-thread.c, i386-linux-nat.c: Update. * i386-linux-tdep.c, i386-tdep.c, i386bsd-nat.c: Update. * i386gnu-nat.c, i387-tdep.c, ia64-linux-nat.c: Update. * ia64-tdep.c, inf-child.c, inf-ptrace.c, inf-ttrace.c: Update. * infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update. * inftarg.c, interps.c, irix5-nat.c, jv-lang.c: Update. * kod-cisco.c, kod.c, language.c, libunwind-frame.c: Update. * linespec.c, linux-nat.c, linux-thread-db.c, m2-lang.c: Update. * m32r-rom.c, m68hc11-tdep.c, m68k-tdep.c: Update. * m68klinux-nat.c, macrocmd.c, macroexp.c, main.c: Update. * maint.c, mdebugread.c, mem-break.c, memattr.c: Update. * mips-linux-tdep.c, mips-tdep.c, mipsread.c, monitor.c: Update. * nlmread.c, nto-procfs.c, objc-lang.c, objfiles.c: Update. * observer.c, ocd.c, p-lang.c, p-typeprint.c: Update. * p-valprint.c, pa64solib.c, parse.c, ppc-linux-tdep.c: Update. * ppcnbsd-tdep.c, printcmd.c, procfs.c, remote-e7000.c: Update. * remote-fileio.c, remote-m32r-sdi.c, remote-rdi.c: Update. * remote-rdp.c, remote-sim.c, remote-st.c: Update. * remote-utils.c, remote-utils.h, remote.c: Update. * rom68k-rom.c, rs6000-nat.c, s390-tdep.c, scm-lang.c: Update. * ser-e7kpc.c, ser-tcp.c, ser-unix.c, sh-tdep.c: Update. * sh3-rom.c, shnbsd-tdep.c, sol-thread.c, solib-aix5.c: Update. * solib-frv.c, solib-irix.c, solib-osf.c, solib-pa64.c: Update. * solib-som.c, solib-sunos.c, solib-svr4.c, solib.c: Update. * somread.c, somsolib.c, source.c, stabsread.c: Update. * stack.c, std-regs.c, symfile-mem.c, symfile.c: Update. * symmisc.c, symtab.c, target.c, thread.c, top.c: Update. * tracepoint.c, trad-frame.c, typeprint.c, utils.c: Update. * uw-thread.c, valarith.c, valops.c, valprint.c: Update. * value.c, varobj.c, version.in, win32-nat.c, wince.c: Update. * xcoffread.c, xcoffsolib.c, cli/cli-cmds.c: Update. * cli/cli-decode.c, cli/cli-dump.c, cli/cli-logging.c: Update. * cli/cli-script.c, cli/cli-setshow.c, mi/mi-cmd-break.c: Update. * mi/mi-cmd-disas.c, mi/mi-cmd-env.c, mi/mi-cmd-file.c: Update. * mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-getopt.c: Update. * mi/mi-symbol-cmds.c, tui/tui-layout.c, tui/tui-stack.c: Update. * tui/tui-win.c: Update.
2005-02-11 05:06:14 +01:00
error (_("Too many args in frame specification"));
}
static struct frame_info *
parse_frame_specification (char *frame_exp)
{
return parse_frame_specification_1 (frame_exp, NULL, NULL);
}
/* Print verbosely the selected frame or the frame at address
ADDR_EXP. Absolutely all information in the frame is printed. */
static void
2000-07-30 03:48:28 +02:00
frame_info (char *addr_exp, int from_tty)
{
struct frame_info *fi;
struct symtab_and_line sal;
struct symbol *func;
struct symtab *s;
struct frame_info *calling_frame_info;
int i, count, numregs;
char *funname = 0;
enum language funlang = language_unknown;
const char *pc_regname;
int selected_frame_p;
fi = parse_frame_specification_1 (addr_exp, "No stack.", &selected_frame_p);
/* Name of the value returned by get_frame_pc(). Per comments, "pc"
is not a good name. */
if (PC_REGNUM >= 0)
/* OK, this is weird. The PC_REGNUM hardware register's value can
easily not match that of the internal value returned by
get_frame_pc(). */
2007-06-09 Markus Deuling <deuling@de.ibm.com> * gdbarch.sh (REGISTER_NAME): Replace by gdbarch_register_name. * tracepoint.c (scope_info): Likewise. * target.c (debug_print_register): Likewise. * stack.c (frame_info): Likewise. * sh-tdep.c (sh_register_reggroup_p): Likewise. * sh64-tdep.c (sh64_do_fp_register, sh64_do_register) (sh64_media_print_registers_info) (sh64_compact_print_registers_info): Likewise. * rs6000-tdep.c (rs6000_register_reggroup_p): Likewise. * remote-sim.c (gdbsim_fetch_register): Likewise. * remote.c (packet_reg): Likewise (comment). * reggroups.c (default_register_reggroup_p): Likewise. * regcache.c (regcache_dump): Likewise. * printcmd.c (address_info): Likewise. * ppc-linux-nat.c (fetch_register, store_register): Likewise. * mt-dep.c (mt_registers_info): Likewise. * mn10300-tdep.c (mn10300_dwarf2_reg_to_regnum): Likewise (comment). * mips-tdep.c (mips_register_reggroup_p, mips_read_fp_register_single) (mips_read_fp_register_double, mips_print_fp_register) (mips_print_register, print_gp_register_row, mips_print_registers_info) (mips_register_sim_regno): Likewise. * m68klinux-nat.c (regmap, fetch_register, store_register): Likewise. * inf-ptrace.c (inf_ptrace_fetch_register) (inf_ptrace_store_register): Likewise. * infcmd.c (default_print_registers_info): Likewise. * ia64-linux-nat.c (ia64_linux_fetch_register) (ia64_linux_store_register): Likewise. * i386-linux-nat.c (fetch_register, store_register): Likewise. * i386gnu-nat.c (gnu_fetch_registers, gnu_store_registers): Likewise. * hppa-linux-nat.c (fetch_register, store_register): Likewise. * hppa-hpux-nat.c (hppa_hpux_fetch_register) (hppa_hpux_store_register): Likewise. * findvar.c (locate_var_value): Likewise. * dwarf2loc.c (locexpr_describe_location): Likewise. * dwarf2-frame.c (execute_cfa_program): Likewise. * arm-tdep.c (arm_push_dummy_call): Likewise. * arch-utils.c (legacy_register_sim_regno): Likewise. * alpha-tdep.c (alpha_register_reggroup_p): Likewise. * alpha-nat.c (fetch_osf_core_registers): Likewise. * mi/mi-main.c (mi_cmd_data_list_register_names) (mi_cmd_data_list_changed_registers, mi_cmd_data_list_register_values) (mi_cmd_data_write_register_values): Likewise. * gdbarch.c, gdbarch.h: Regenerate.
2007-06-09 15:42:16 +02:00
pc_regname = gdbarch_register_name (current_gdbarch, PC_REGNUM);
else
/* But then, this is weird to. Even without PC_REGNUM, an
architectures will often have a hardware register called "pc",
and that register's value, again, can easily not match
get_frame_pc(). */
pc_regname = "pc";
find_frame_sal (fi, &sal);
func = get_frame_function (fi);
/* FIXME: cagney/2002-11-28: Why bother? Won't sal.symtab contain
the same value? */
s = find_pc_symtab (get_frame_pc (fi));
if (func)
{
/* It seems appropriate to use SYMBOL_PRINT_NAME() here, to
display the demangled name that we already have stored in the
symbol table, but we stored a version with DMGL_PARAMS turned
on, and here we don't want to display parameters. So call the
demangler again, with DMGL_ANSI only.
Yes, printf_symbol_filtered() will again try to demangle the
name on the fly, but the issue is that if cplus_demangle()
fails here, it will fail there too. So we want to catch the
failure (where DEMANGLED is NULL below) here, while we still
have our hands on the function symbol.) */
2003-02-25 David Carlton <carlton@math.stanford.edu> * symtab.h (SYMBOL_NATURAL_NAME): New macro. (SYMBOL_LINKAGE_NAME): Ditto. (SYMBOL_PRINT_NAME): Use SYMBOL_NATURAL_NAME and SYMBOL_LINKAGE_NAME. (struct general_symbol_info): Expand comment. (DEPRECATED_SYMBOL_NAME): Rename from SYMBOL_NAME. (SYMBOL_MATCHES_NAME): Use DEPRECATED_SYMBOL_NAME. (SYMBOL_MATCHES_REGEXP): Ditto. * symtab.c (symbol_natural_name): New function. * objfiles.h: Replace all uses of SYMBOL_NAME by DEPRECATED_SYMBOL_NAME. * xcoffread.c, valops.c, typeprint.c, tracepoint.c: Ditto. * symtab.c, symmisc.c, symfile.c, stack.c, stabsread.c: Ditto. * somsolib.c, sol-thread.c, rs6000-tdep.c, p-valprint.c: Ditto. * printcmd.c, objfiles.c, objc-lang.c, mipsread.c: Ditto. * minsyms.c, mdebugread.c, linespec.c, jv-lang.c: Ditto. * i386-tdep.c, i386-linux-tdep.c, hpread.c, hppa-tdep.c: Ditto. * gnu-v2-abi.c, f-valprint.c, findvar.c, expprint.c: Ditto. * dwarfread.c, dwarf2read.c, dbxread.c, c-valprint.c: Ditto. * cp-valprint.c, coffread.c, buildsym.c, breakpoint.c: Ditto. * blockframe.c, ax-gdb.c, arm-linux-tdep.c, ada-lang.c: Ditto. * ada-exp.y: Ditto. * ada-exp.y: Update copyright. * sol-thread.c, mipsread.c, jv-lang.c, f-valprint.c: Ditto. * cp-valprint.c: Ditto. 2003-02-25 David Carlton <carlton@math.stanford.edu> * generic/gdbtk.h: Replace all instances of SYMBOL_NAME by DEPRECATED_SYMBOL_NAME. * generic/gdbtk-stack.c, generic/gdbtk-cmds.c: Ditto. * generic/gdbtk-stack.c, generic/gdbtk-cmds.c: Update copyright. 2003-02-25 David Carlton <carlton@math.stanford.edu> * mi-cmd-stack.c: Replace all instances of SYMBOL_NAME with DEPRECATED_SYMBOL_NAME. Update copyright.
2003-02-25 22:36:23 +01:00
funname = DEPRECATED_SYMBOL_NAME (func);
1999-07-07 22:19:36 +02:00
funlang = SYMBOL_LANGUAGE (func);
if (funlang == language_cplus)
{
char *demangled = cplus_demangle (funname, DMGL_ANSI);
/* If the demangler fails, try the demangled name from the
symbol table. That'll have parameters, but that's
preferable to displaying a mangled name. */
1999-07-07 22:19:36 +02:00
if (demangled == NULL)
2003-02-20 David Carlton <carlton@math.stanford.edu> * symtab.h (SYMBOL_PRINT_NAME): Rename from SYMBOL_SOURCE_NAME; expand comment. * ada-lang.c (user_select_syms, ada_finish_decode_line_1): Replace SYMBOL_PRINT_NAME with SYMBOL_SOURCE_NAME. * ada-typeprint.c (ada_typedef_print): Ditto. * ax-gdb.c (gen_var_ref): Ditto. * breakpoint.c (print_one_breakpoint): Ditto. * buildsym.c (finish_block): Ditto. * c-valprint.c (c_val_print): Ditto. * expprint.c (print_subexp): Ditto. * findvar.c (locate_var_value): Ditto. * infcmd.c (jump_command): Ditto. * linespec.c (decode_line_2, decode_compound): Ditto. * maint.c (maintenance_translate_address): Ditto. * objc-lang.c (compare_selectors, compare_classes): Ditto. * printcmd.c (build_address_symbolic, sym_info, print_frame_args): Ditto. * p-valprint.c (pascal_val_print): Ditto. * stabsread.c (define_symbol): Ditto. * stack.c (print_frame, frame_info, print_block_frame_locals) (print_frame_arg_vars, return_command): Ditto. * symfile.c (compare_symbols, compare_psymbols): Ditto. * symmisc.c (print_symbol): Ditto. * symtab.c (lookup_partial_symbol, lookup_block_symbol) (compare_search_syms, print_symbol_info, print_msymbol_info) (rbreak_command): Ditto. * tracepoint.c (tracepoints_info): Ditto. * typeprint.c (typedef_print): Ditto. * valops.c (value_of_variable, hand_function_call): Ditto. * cli/cli-cmds.c (edit_command, list_command): Ditto. * ada-typeprint.c: Update Copyright. * infcmd.c, objc-lang.c, p-valprint.c, symmisc.c: Ditto. * tracepoint.c, cli/cli-cmds.c: Ditto.
2003-02-20 18:17:25 +01:00
funname = SYMBOL_PRINT_NAME (func);
1999-07-07 22:19:36 +02:00
}
}
else
{
struct minimal_symbol *msymbol;
msymbol = lookup_minimal_symbol_by_pc (get_frame_pc (fi));
if (msymbol != NULL)
{
2003-02-25 David Carlton <carlton@math.stanford.edu> * symtab.h (SYMBOL_NATURAL_NAME): New macro. (SYMBOL_LINKAGE_NAME): Ditto. (SYMBOL_PRINT_NAME): Use SYMBOL_NATURAL_NAME and SYMBOL_LINKAGE_NAME. (struct general_symbol_info): Expand comment. (DEPRECATED_SYMBOL_NAME): Rename from SYMBOL_NAME. (SYMBOL_MATCHES_NAME): Use DEPRECATED_SYMBOL_NAME. (SYMBOL_MATCHES_REGEXP): Ditto. * symtab.c (symbol_natural_name): New function. * objfiles.h: Replace all uses of SYMBOL_NAME by DEPRECATED_SYMBOL_NAME. * xcoffread.c, valops.c, typeprint.c, tracepoint.c: Ditto. * symtab.c, symmisc.c, symfile.c, stack.c, stabsread.c: Ditto. * somsolib.c, sol-thread.c, rs6000-tdep.c, p-valprint.c: Ditto. * printcmd.c, objfiles.c, objc-lang.c, mipsread.c: Ditto. * minsyms.c, mdebugread.c, linespec.c, jv-lang.c: Ditto. * i386-tdep.c, i386-linux-tdep.c, hpread.c, hppa-tdep.c: Ditto. * gnu-v2-abi.c, f-valprint.c, findvar.c, expprint.c: Ditto. * dwarfread.c, dwarf2read.c, dbxread.c, c-valprint.c: Ditto. * cp-valprint.c, coffread.c, buildsym.c, breakpoint.c: Ditto. * blockframe.c, ax-gdb.c, arm-linux-tdep.c, ada-lang.c: Ditto. * ada-exp.y: Ditto. * ada-exp.y: Update copyright. * sol-thread.c, mipsread.c, jv-lang.c, f-valprint.c: Ditto. * cp-valprint.c: Ditto. 2003-02-25 David Carlton <carlton@math.stanford.edu> * generic/gdbtk.h: Replace all instances of SYMBOL_NAME by DEPRECATED_SYMBOL_NAME. * generic/gdbtk-stack.c, generic/gdbtk-cmds.c: Ditto. * generic/gdbtk-stack.c, generic/gdbtk-cmds.c: Update copyright. 2003-02-25 David Carlton <carlton@math.stanford.edu> * mi-cmd-stack.c: Replace all instances of SYMBOL_NAME with DEPRECATED_SYMBOL_NAME. Update copyright.
2003-02-25 22:36:23 +01:00
funname = DEPRECATED_SYMBOL_NAME (msymbol);
funlang = SYMBOL_LANGUAGE (msymbol);
}
}
calling_frame_info = get_prev_frame (fi);
if (selected_frame_p && frame_relative_level (fi) >= 0)
{
printf_filtered (_("Stack level %d, frame at "),
frame_relative_level (fi));
}
else
{
printf_filtered (_("Stack frame at "));
}
deprecated_print_address_numeric (get_frame_base (fi), 1, gdb_stdout);
printf_filtered (":\n");
printf_filtered (" %s = ", pc_regname);
deprecated_print_address_numeric (get_frame_pc (fi), 1, gdb_stdout);
wrap_here (" ");
if (funname)
{
printf_filtered (" in ");
fprintf_symbol_filtered (gdb_stdout, funname, funlang,
DMGL_ANSI | DMGL_PARAMS);
}
wrap_here (" ");
if (sal.symtab)
printf_filtered (" (%s:%d)", sal.symtab->filename, sal.line);
puts_filtered ("; ");
wrap_here (" ");
printf_filtered ("saved %s ", pc_regname);
deprecated_print_address_numeric (frame_pc_unwind (fi), 1, gdb_stdout);
printf_filtered ("\n");
if (calling_frame_info == NULL)
{
enum unwind_stop_reason reason;
reason = get_frame_unwind_stop_reason (fi);
if (reason != UNWIND_NO_REASON)
printf_filtered (_(" Outermost frame: %s\n"),
frame_stop_reason_string (reason));
}
if (calling_frame_info)
{
printf_filtered (" called by frame at ");
deprecated_print_address_numeric (get_frame_base (calling_frame_info),
1, gdb_stdout);
}
if (get_next_frame (fi) && calling_frame_info)
puts_filtered (",");
wrap_here (" ");
if (get_next_frame (fi))
{
printf_filtered (" caller of frame at ");
deprecated_print_address_numeric (get_frame_base (get_next_frame (fi)), 1,
gdb_stdout);
}
if (get_next_frame (fi) || calling_frame_info)
puts_filtered ("\n");
if (s)
printf_filtered (" source language %s.\n",
language_str (s->language));
{
/* Address of the argument list for this frame, or 0. */
CORE_ADDR arg_list = get_frame_args_address (fi);
/* Number of args for this frame, or -1 if unknown. */
int numargs;
if (arg_list == 0)
printf_filtered (" Arglist at unknown address.\n");
else
{
printf_filtered (" Arglist at ");
deprecated_print_address_numeric (arg_list, 1, gdb_stdout);
printf_filtered (",");
if (!gdbarch_frame_num_args_p (current_gdbarch))
2003-06-09 Andrew Cagney <cagney@redhat.com> * gdbarch.sh (FRAME_NUM_ARGS): Change to function with predicate. * gdbarch.h, gdbarch.c: Re-generate. * arch-utils.h (frame_num_args_unknown): Delete both declarations. * arch-utils.c (frame_num_args_unknown): Delete function. * stack.c (print_args_stub): Use FRAME_NUM_ARGS_P. (frame_info): Use FRAME_NUM_ARGS_P. * arm-tdep.c (arm_frame_num_args): Delete function. (arm_gdbarch_init): Do not set frame_num_args. * config/pa/tm-hppa64.h (FRAME_NUM_ARGS): Delete. * hppa-tdep.c (hppa_frame_num_args): Delete function. (hppa_gdbarch_init): Do not set frame_num_args. * config/sparc/tm-sparc.h (FRAME_NUM_ARGS): Delete. * xstormy16-tdep.c (xstormy16_gdbarch_init): Do not set frame_num_args to default frame_num_args_unknown. * v850-tdep.c (v850_gdbarch_init): Ditto. * sparc-tdep.c (sparc_gdbarch_init): Ditto. * sh-tdep.c (sh_gdbarch_init): Ditto. * s390-tdep.c (s390_gdbarch_init): Ditto. * rs6000-tdep.c (rs6000_gdbarch_init): Ditto. * mn10300-tdep.c (mn10300_gdbarch_init): Ditto. * mips-tdep.c (mips_gdbarch_init): Ditto. * mcore-tdep.c (mcore_gdbarch_init): Ditto. * m68k-tdep.c (m68k_gdbarch_init): Ditto. * m68hc11-tdep.c (m68hc11_gdbarch_init): Ditto. * ia64-tdep.c (ia64_gdbarch_init): Ditto. * i386-tdep.c (i386_gdbarch_init): Ditto. * h8300-tdep.c (h8300_gdbarch_init): Ditto. * frv-tdep.c (frv_gdbarch_init): Ditto. * d10v-tdep.c (d10v_gdbarch_init): Ditto. * cris-tdep.c (cris_gdbarch_init): Ditto. * avr-tdep.c (avr_gdbarch_init): Ditto. * alpha-tdep.c (alpha_gdbarch_init): Ditto.
2003-06-09 19:35:59 +02:00
{
numargs = -1;
puts_filtered (" args: ");
}
else
2003-06-09 Andrew Cagney <cagney@redhat.com> * gdbarch.sh (FRAME_NUM_ARGS): Change to function with predicate. * gdbarch.h, gdbarch.c: Re-generate. * arch-utils.h (frame_num_args_unknown): Delete both declarations. * arch-utils.c (frame_num_args_unknown): Delete function. * stack.c (print_args_stub): Use FRAME_NUM_ARGS_P. (frame_info): Use FRAME_NUM_ARGS_P. * arm-tdep.c (arm_frame_num_args): Delete function. (arm_gdbarch_init): Do not set frame_num_args. * config/pa/tm-hppa64.h (FRAME_NUM_ARGS): Delete. * hppa-tdep.c (hppa_frame_num_args): Delete function. (hppa_gdbarch_init): Do not set frame_num_args. * config/sparc/tm-sparc.h (FRAME_NUM_ARGS): Delete. * xstormy16-tdep.c (xstormy16_gdbarch_init): Do not set frame_num_args to default frame_num_args_unknown. * v850-tdep.c (v850_gdbarch_init): Ditto. * sparc-tdep.c (sparc_gdbarch_init): Ditto. * sh-tdep.c (sh_gdbarch_init): Ditto. * s390-tdep.c (s390_gdbarch_init): Ditto. * rs6000-tdep.c (rs6000_gdbarch_init): Ditto. * mn10300-tdep.c (mn10300_gdbarch_init): Ditto. * mips-tdep.c (mips_gdbarch_init): Ditto. * mcore-tdep.c (mcore_gdbarch_init): Ditto. * m68k-tdep.c (m68k_gdbarch_init): Ditto. * m68hc11-tdep.c (m68hc11_gdbarch_init): Ditto. * ia64-tdep.c (ia64_gdbarch_init): Ditto. * i386-tdep.c (i386_gdbarch_init): Ditto. * h8300-tdep.c (h8300_gdbarch_init): Ditto. * frv-tdep.c (frv_gdbarch_init): Ditto. * d10v-tdep.c (d10v_gdbarch_init): Ditto. * cris-tdep.c (cris_gdbarch_init): Ditto. * avr-tdep.c (avr_gdbarch_init): Ditto. * alpha-tdep.c (alpha_gdbarch_init): Ditto.
2003-06-09 19:35:59 +02:00
{
numargs = gdbarch_frame_num_args (current_gdbarch, fi);
2003-06-09 Andrew Cagney <cagney@redhat.com> * gdbarch.sh (FRAME_NUM_ARGS): Change to function with predicate. * gdbarch.h, gdbarch.c: Re-generate. * arch-utils.h (frame_num_args_unknown): Delete both declarations. * arch-utils.c (frame_num_args_unknown): Delete function. * stack.c (print_args_stub): Use FRAME_NUM_ARGS_P. (frame_info): Use FRAME_NUM_ARGS_P. * arm-tdep.c (arm_frame_num_args): Delete function. (arm_gdbarch_init): Do not set frame_num_args. * config/pa/tm-hppa64.h (FRAME_NUM_ARGS): Delete. * hppa-tdep.c (hppa_frame_num_args): Delete function. (hppa_gdbarch_init): Do not set frame_num_args. * config/sparc/tm-sparc.h (FRAME_NUM_ARGS): Delete. * xstormy16-tdep.c (xstormy16_gdbarch_init): Do not set frame_num_args to default frame_num_args_unknown. * v850-tdep.c (v850_gdbarch_init): Ditto. * sparc-tdep.c (sparc_gdbarch_init): Ditto. * sh-tdep.c (sh_gdbarch_init): Ditto. * s390-tdep.c (s390_gdbarch_init): Ditto. * rs6000-tdep.c (rs6000_gdbarch_init): Ditto. * mn10300-tdep.c (mn10300_gdbarch_init): Ditto. * mips-tdep.c (mips_gdbarch_init): Ditto. * mcore-tdep.c (mcore_gdbarch_init): Ditto. * m68k-tdep.c (m68k_gdbarch_init): Ditto. * m68hc11-tdep.c (m68hc11_gdbarch_init): Ditto. * ia64-tdep.c (ia64_gdbarch_init): Ditto. * i386-tdep.c (i386_gdbarch_init): Ditto. * h8300-tdep.c (h8300_gdbarch_init): Ditto. * frv-tdep.c (frv_gdbarch_init): Ditto. * d10v-tdep.c (d10v_gdbarch_init): Ditto. * cris-tdep.c (cris_gdbarch_init): Ditto. * avr-tdep.c (avr_gdbarch_init): Ditto. * alpha-tdep.c (alpha_gdbarch_init): Ditto.
2003-06-09 19:35:59 +02:00
gdb_assert (numargs >= 0);
if (numargs == 0)
puts_filtered (" no args.");
else if (numargs == 1)
puts_filtered (" 1 arg: ");
else
printf_filtered (" %d args: ", numargs);
}
print_frame_args (func, fi, numargs, gdb_stdout);
puts_filtered ("\n");
}
}
{
/* Address of the local variables for this frame, or 0. */
CORE_ADDR arg_list = get_frame_locals_address (fi);
if (arg_list == 0)
printf_filtered (" Locals at unknown address,");
else
{
printf_filtered (" Locals at ");
deprecated_print_address_numeric (arg_list, 1, gdb_stdout);
printf_filtered (",");
}
}
/* Print as much information as possible on the location of all the
registers. */
{
enum lval_type lval;
int optimized;
CORE_ADDR addr;
int realnum;
int count;
int i;
int need_nl = 1;
/* The sp is special; what's displayed isn't the save address, but
the value of the previous frame's sp. This is a legacy thing,
at one stage the frame cached the previous frame's SP instead
of its address, hence it was easiest to just display the cached
value. */
if (SP_REGNUM >= 0)
{
/* Find out the location of the saved stack pointer with out
actually evaluating it. */
frame_register_unwind (fi, SP_REGNUM, &optimized, &lval, &addr,
&realnum, NULL);
if (!optimized && lval == not_lval)
{
gdb_byte value[MAX_REGISTER_SIZE];
CORE_ADDR sp;
frame_register_unwind (fi, SP_REGNUM, &optimized, &lval, &addr,
&realnum, value);
/* NOTE: cagney/2003-05-22: This is assuming that the
stack pointer was packed as an unsigned integer. That
may or may not be valid. */
2004-08-02 Andrew Cagney <cagney@gnu.org> Replace DEPRECATED_REGISTER_RAW_SIZE with register_size. * rs6000-tdep.c (rs6000_push_dummy_call) (rs6000_extract_return_value): Use register_size. * xstormy16-tdep.c (xstormy16_get_saved_register) (xstormy16_extract_return_value): Ditto. * valops.c (value_assign): Ditto. * v850ice.c (v850ice_fetch_registers, v850ice_store_registers): * v850-tdep.c (v850_extract_return_value): Ditto. * tracepoint.c (collect_symbol): Ditto. * target.c (debug_print_register): Ditto. * stack.c (frame_info): Ditto. * rs6000-nat.c (ARCH64, fetch_register, store_register): Ditto. * rom68k-rom.c (rom68k_supply_one_register): Ditto. * remote.c (struct packet_reg, remote_wait, remote_async_wait) (store_register_using_P): Ditto. * remote-vxmips.c (vx_read_register, vx_write_register): Ditto. * remote-sim.c (gdbsim_fetch_register, gdbsim_store_register): Ditto. * remote-mips.c (mips_wait, mips_fetch_registers): Ditto. * remote-e7000.c (fetch_regs_from_dump, sub2_from_pc): Ditto. * regcache.c (deprecated_read_register_bytes) (deprecated_write_register_bytes, read_register) (write_register): Ditto. * ppc-linux-nat.c (fetch_altivec_register, fetch_register) (supply_vrregset, store_altivec_register, fill_vrregset): Ditto. * monitor.c (monitor_supply_register, monitor_fetch_register) (monitor_store_register): Ditto. * mn10300-tdep.c (mn10300_pop_frame_regular) (mn10300_print_register): Ditto. * mipsv4-nat.c (fill_fpregset): Ditto. * mips-linux-tdep.c (supply_32bit_reg, fill_fpregset) (mips64_fill_fpregset): Ditto. * mi/mi-main.c (register_changed_p, get_register) (mi_cmd_data_write_register_values): Ditto. * lynx-nat.c (fetch_inferior_registers, store_inferior_registers): * irix5-nat.c (fill_gregset, fetch_core_registers): * infrun.c (write_inferior_status_register): Ditto. * infptrace.c (fetch_register, store_register): Ditto. * infcmd.c (default_print_registers_info): Ditto. * ia64-linux-nat.c (COPY_REG, fill_fpregset): Ditto. * ia64-aix-nat.c (COPY_REG, fill_gregset): Ditto. * i386gnu-nat.c (gnu_store_registers, fill): Ditto. * hpux-thread.c (hpux_thread_fetch_registers) (hpux_thread_store_registers): Ditto. * hppah-nat.c (store_inferior_registers, fetch_register): * findvar.c (value_from_register): Ditto. * dve3900-rom.c (fetch_bitmapped_register): * cris-tdep.c (cris_gdbarch_init): Ditto. * alpha-tdep.h: Ditto. * aix-thread.c (pd_enable, fill_sprs64, fill_sprs32): Ditto.
2004-08-03 02:57:27 +02:00
sp = extract_unsigned_integer (value, register_size (current_gdbarch, SP_REGNUM));
printf_filtered (" Previous frame's sp is ");
deprecated_print_address_numeric (sp, 1, gdb_stdout);
printf_filtered ("\n");
need_nl = 0;
}
else if (!optimized && lval == lval_memory)
{
printf_filtered (" Previous frame's sp at ");
deprecated_print_address_numeric (addr, 1, gdb_stdout);
printf_filtered ("\n");
need_nl = 0;
}
else if (!optimized && lval == lval_register)
{
printf_filtered (" Previous frame's sp in %s\n",
2007-06-09 Markus Deuling <deuling@de.ibm.com> * gdbarch.sh (REGISTER_NAME): Replace by gdbarch_register_name. * tracepoint.c (scope_info): Likewise. * target.c (debug_print_register): Likewise. * stack.c (frame_info): Likewise. * sh-tdep.c (sh_register_reggroup_p): Likewise. * sh64-tdep.c (sh64_do_fp_register, sh64_do_register) (sh64_media_print_registers_info) (sh64_compact_print_registers_info): Likewise. * rs6000-tdep.c (rs6000_register_reggroup_p): Likewise. * remote-sim.c (gdbsim_fetch_register): Likewise. * remote.c (packet_reg): Likewise (comment). * reggroups.c (default_register_reggroup_p): Likewise. * regcache.c (regcache_dump): Likewise. * printcmd.c (address_info): Likewise. * ppc-linux-nat.c (fetch_register, store_register): Likewise. * mt-dep.c (mt_registers_info): Likewise. * mn10300-tdep.c (mn10300_dwarf2_reg_to_regnum): Likewise (comment). * mips-tdep.c (mips_register_reggroup_p, mips_read_fp_register_single) (mips_read_fp_register_double, mips_print_fp_register) (mips_print_register, print_gp_register_row, mips_print_registers_info) (mips_register_sim_regno): Likewise. * m68klinux-nat.c (regmap, fetch_register, store_register): Likewise. * inf-ptrace.c (inf_ptrace_fetch_register) (inf_ptrace_store_register): Likewise. * infcmd.c (default_print_registers_info): Likewise. * ia64-linux-nat.c (ia64_linux_fetch_register) (ia64_linux_store_register): Likewise. * i386-linux-nat.c (fetch_register, store_register): Likewise. * i386gnu-nat.c (gnu_fetch_registers, gnu_store_registers): Likewise. * hppa-linux-nat.c (fetch_register, store_register): Likewise. * hppa-hpux-nat.c (hppa_hpux_fetch_register) (hppa_hpux_store_register): Likewise. * findvar.c (locate_var_value): Likewise. * dwarf2loc.c (locexpr_describe_location): Likewise. * dwarf2-frame.c (execute_cfa_program): Likewise. * arm-tdep.c (arm_push_dummy_call): Likewise. * arch-utils.c (legacy_register_sim_regno): Likewise. * alpha-tdep.c (alpha_register_reggroup_p): Likewise. * alpha-nat.c (fetch_osf_core_registers): Likewise. * mi/mi-main.c (mi_cmd_data_list_register_names) (mi_cmd_data_list_changed_registers, mi_cmd_data_list_register_values) (mi_cmd_data_write_register_values): Likewise. * gdbarch.c, gdbarch.h: Regenerate.
2007-06-09 15:42:16 +02:00
gdbarch_register_name (current_gdbarch, realnum));
need_nl = 0;
}
/* else keep quiet. */
}
count = 0;
2007-05-31 Markus Deuling <deuling@de.ibm.com> * gdbarch.sh (NUM_REGS): Replace by gdbarch_num_regs. * i386-tdep.c (i386_dbx_reg_to_regnum) (i386_svr4_reg_to_regnum): Likewise. * inf-ptrace.c (inf_ptrace_fetch_registers) (inf_ptrace_store_registers): Likewise. * corelow.c (get_core_registers): Likewise. * i386-linux-nat.c (supply_gregset, fill_gregset) (i386_linux_fetch_inferior_registers) (i386_linux_store_inferior_registers): Likewise. * remote.c (init_remote_state,packet_reg_from_regnum) (packet_reg_from_pnum,process_g_packet,remote_fetch_registers) (remote_prepare_to_store,store_registers_using_G) (remote_store_registers,remote_arch_state): Likewise. * tracepoint.c (encode_actions): Likewise. * mi/mi-main.c (mi_cmd_data_list_register_names) (mi_cmd_data_list_changed_registers,mi_cmd_data_list_register_values) (mi_cmd_data_write_register_values): Likewise. * tui/tui-regs.c (tui_show_register_group) (tui_show_register_group): Likewise. * xtensa-tdep.h (FP_ALIAS): Likewise. * xtensa-tdep.c (xtensa_register_name,xtensa_register_type) (xtensa_reg_to_regnum,xtensa_pseudo_register_read) (xtensa_pseudo_register_write,xtensa_register_reggroup_p): Likewise. * win32-nat.c (do_win32_fetch_inferior_registers) (do_win32_store_inferior_registers,fetch_elf_core_registers * user-regs.h: Likewise (comment). * user-regs.c (user_reg, user_reg_map_name_to_regnum): Likewise. * trad-frame.c (trad_frame_alloc_saved_regs): Likewise. * target-descriptions.h: Likewise (comment). * target-descriptions.c (tdesc_use_registers): Likewise (comment). * target.c (debug_print_register): Likewise. * stack.c (frame_info): Likewise. * stabsread.c (define_symbol): Likewise. * sh64-tdep.c (sh64_do_pseudo_register,sh64_print_register) (sh64_media_print_registers_info) (sh64_compact_print_registers_info): Likewise. * rs6000-tdep.c (rs6000_register_sim_regno): Likewise. * rs6000-nat.c (fetch_register,store_register): Likewise. * remote-sim.c (one2one_register_sim_regno,gdbsim_fetch_register) (gdbsim_fetch_register,gdbsim_store_register): Likewise. * remote-mips.c (mips_fetch_registers,mips_store_registers): Likewise. * remote-m32r-sdi.c (m32r_fetch_registers) (m32r_store_registers): Likewise. * reggroups.c (default_register_reggroup_p): Likewise. * regcache.c (init_regcache_descr,register_size,regcache,regcache_save) (regcache_restore,regcache_dump): Likewise. * monitor.c (monitor_fetch_registers,monitor_store_registers): Likewise. * mips-tdep.c (mips_xfer_register,mips_register_name) (mips_register_reggroup_p,mips_pseudo_register_read) (mips_pseudo_register_write,mips_convert_register_p,mips_register_type) (mips_unwind_pc,mips_unwind_sp,mips_unwind_dummy_id,set_reg_offset) (mips16_scan_prologue,mips_insn16_frame_cache,reset_saved_regs) (mips32_scan_prologue,mips_insn32_frame_cache,read_next_frame_reg) (mips_n32n64_return_value,mips_o32_return_value,mips_o64_return_value) (print_gp_register_row,mips_print_registers_info) (mips_stab_reg_to_regnum,mips_dwarf_dwarf2_ecoff_reg_to_regnum) (mips_register_sim_regno): Likewise. * mips-linux-tdep.c (mips_linux_o32_sigframe_init) (mips_linux_n32n64_sigframe_init): Likewise. * mips-linux-nat.c (mips_linux_register_addr) (mips64_linux_register_addr): Likewise. * findvar.c (value_of_register): Likewise. * infcmd.c (default_print_registers_info,registers_info) (print_vector_info,print_float_info): Likewise. * mips64obsd-tdep.c (mips64obsd_sigframe_init): Likewise. * inf-child.c (inf_child_fetch_inferior_registers): Likewise. * m68k-tdep.c (m68k_dwarf_reg_to_regnum): Likewise. * m68hc11-tdep.c (m68hc11_frame_unwind_cache(: Likewise. * m32r-tdep.c (m32r_frame_unwind_cache): Likewise. * ia64-linux-nat.c (ia64_register_addr,ia64_cannot_fetch_register) (ia64_cannot_store_register,ia64_linux_fetch_registers) (ia64_linux_store_registers): Likewise. * hpux-thread.c (hpux_thread_fetch_registers) (hpux_thread_store_registers): Likewise. * h8300-tdep.c (E_PSEUDO_CCR_REGNUM,E_PSEUDO_EXR_REGNUM) (h8300_init_frame_cache,h8300_frame_cache,h8300_frame_prev_register) (h8300_register_type): Likewise. * dwarf2-frame.c (dwarf2_frame_cache) (dwarf2_frame_state_alloc_regs): Likewise. * cris-tdep.c (cris_register_size,cris_cannot_fetch_register) (cris_cannot_store_register,crisv32_cannot_fetch_register) (crisv32_cannot_store_register,cris_register_name): Likewise. * avr-tdep.c (avr_frame_unwind_cache): Likewise. * arch-utils.c (legacy_register_sim_regno) (legacy_virtual_frame_pointer): Likewise. * arm-tdep.c (arm_make_prologue_cache,arm_register_sim_regno):Likewise. * arm-tdep.h: Likewise (comment). * frv-tdep.c (frv_register_sim_regno): Likewise. * m68klinux-nat.c (old_fetch_inferior_registers) (old_store_inferior_registers): Likewise. * m32c-tdep.c (m32c_virtual_frame_pointer): Likewise. * irix5-nat.c (fetch_core_registers): Likewise. * hppa-tdep.c (hppa_frame_cache): Likewise. * hppa-linux-nat.c (hppa_linux_register_addr) (hppa_linux_fetch_inferior_registers) (hppa_linux_store_inferior_registers): Likewise. * hppa-hpux-nat.c (hppa_hpux_fetch_inferior_registers) (hppa_hpux_store_inferior_registers): Likewise. * amd64-nat.c (amd64_native_gregset_reg_offset) (amd64_supply_native_gregset,amd64_collect_native_gregset): Likewise. * dbug-rom.c (dbug_regname): Likewise. * m68hc11-tdep.c (m68hc11_frame_unwind_cache) (HARD_PAGE_REGNUM (comment)): Likewise. * gdbarch.sh (NUM_PSEUDO_REGS): Replace by gdbarch_num_pseudo_regs. * i386-tdep.c (i386_dbx_reg_to_regnum) (i386_svr4_reg_to_regnum): Likewise. * mi/mi-main.c (mi_cmd_data_list_register_names) (mi_cmd_data_list_changed_registers,mi_cmd_data_list_register_values) (mi_cmd_data_write_register_values): Likewise. * gdbarch.c, gdbarch.h: Regenerate. * tui/tui-regs.c (tui_show_register_group): Likewise. * xtensa-tdep.h (FP_ALIAS): Likewise. * user-regs.h: Likewise (comment). * user-regs.c (user_reg, user_reg_map_name_to_regnum): Likewise. * trad-frame.c (trad_frame_alloc_saved_regs): Likewise. * target-descriptions.h: Likewise (comment). * target.c (debug_print_register): Likewise. * stack.c (frame_info): Likewise. * stabsread.c (define_symbol): Likewise. * sh64-tdep.c (sh64_print_register,sh64_media_print_registers_info) (sh64_compact_print_registers_info): Likewise. * rs6000-tdep.c (rs6000_register_sim_regno): Likewise. * regcache.c (init_regcache_descr,register_size,regcache,regcache_save (regcache_restore,regcache_dump): Likewise. * mips-tdep.c (print_gp_register_row,mips_print_registers_info) (mips_dwarf_dwarf2_ecoff_reg_to_regnum) (mips_stab_reg_to_regnum): Likewise. * findvar.c (value_of_register): Likewise. * infcmd.c (default_print_registers_info,registers_info) (print_vector_info,print_float_info): Likewise. * m68k-tdep.c (m68k_dwarf_reg_to_regnum): Likewise. * h8300-tdep.c (h8300_register_type): Likewise. * dwarf2-frame.c (dwarf2_frame_cache): Likewise. * frame.h (SIZEOF_FRAME_SAVED_REGS): Likewise. * xtensa-tdep.c (xtensa_register_type,xtensa_reg_to_regnum) (xtensa_pseudo_register_read,xtensa_pseudo_register_write): Likewise. * parse.c: Remove comment. * gdbarch.c, gdbarch.h: Regenerate
2007-05-31 19:32:22 +02:00
numregs = gdbarch_num_regs (current_gdbarch)
+ gdbarch_num_pseudo_regs (current_gdbarch);
for (i = 0; i < numregs; i++)
if (i != SP_REGNUM
&& gdbarch_register_reggroup_p (current_gdbarch, i, all_reggroup))
{
/* Find out the location of the saved register without
fetching the corresponding value. */
frame_register_unwind (fi, i, &optimized, &lval, &addr, &realnum,
NULL);
/* For moment, only display registers that were saved on the
stack. */
if (!optimized && lval == lval_memory)
{
if (count == 0)
puts_filtered (" Saved registers:\n ");
else
puts_filtered (",");
wrap_here (" ");
2007-06-09 Markus Deuling <deuling@de.ibm.com> * gdbarch.sh (REGISTER_NAME): Replace by gdbarch_register_name. * tracepoint.c (scope_info): Likewise. * target.c (debug_print_register): Likewise. * stack.c (frame_info): Likewise. * sh-tdep.c (sh_register_reggroup_p): Likewise. * sh64-tdep.c (sh64_do_fp_register, sh64_do_register) (sh64_media_print_registers_info) (sh64_compact_print_registers_info): Likewise. * rs6000-tdep.c (rs6000_register_reggroup_p): Likewise. * remote-sim.c (gdbsim_fetch_register): Likewise. * remote.c (packet_reg): Likewise (comment). * reggroups.c (default_register_reggroup_p): Likewise. * regcache.c (regcache_dump): Likewise. * printcmd.c (address_info): Likewise. * ppc-linux-nat.c (fetch_register, store_register): Likewise. * mt-dep.c (mt_registers_info): Likewise. * mn10300-tdep.c (mn10300_dwarf2_reg_to_regnum): Likewise (comment). * mips-tdep.c (mips_register_reggroup_p, mips_read_fp_register_single) (mips_read_fp_register_double, mips_print_fp_register) (mips_print_register, print_gp_register_row, mips_print_registers_info) (mips_register_sim_regno): Likewise. * m68klinux-nat.c (regmap, fetch_register, store_register): Likewise. * inf-ptrace.c (inf_ptrace_fetch_register) (inf_ptrace_store_register): Likewise. * infcmd.c (default_print_registers_info): Likewise. * ia64-linux-nat.c (ia64_linux_fetch_register) (ia64_linux_store_register): Likewise. * i386-linux-nat.c (fetch_register, store_register): Likewise. * i386gnu-nat.c (gnu_fetch_registers, gnu_store_registers): Likewise. * hppa-linux-nat.c (fetch_register, store_register): Likewise. * hppa-hpux-nat.c (hppa_hpux_fetch_register) (hppa_hpux_store_register): Likewise. * findvar.c (locate_var_value): Likewise. * dwarf2loc.c (locexpr_describe_location): Likewise. * dwarf2-frame.c (execute_cfa_program): Likewise. * arm-tdep.c (arm_push_dummy_call): Likewise. * arch-utils.c (legacy_register_sim_regno): Likewise. * alpha-tdep.c (alpha_register_reggroup_p): Likewise. * alpha-nat.c (fetch_osf_core_registers): Likewise. * mi/mi-main.c (mi_cmd_data_list_register_names) (mi_cmd_data_list_changed_registers, mi_cmd_data_list_register_values) (mi_cmd_data_write_register_values): Likewise. * gdbarch.c, gdbarch.h: Regenerate.
2007-06-09 15:42:16 +02:00
printf_filtered (" %s at ",
gdbarch_register_name (current_gdbarch, i));
deprecated_print_address_numeric (addr, 1, gdb_stdout);
count++;
}
}
if (count || need_nl)
puts_filtered ("\n");
}
}
/* Print briefly all stack frames or just the innermost COUNT_EXP
frames. */
static void
2000-07-30 03:48:28 +02:00
backtrace_command_1 (char *count_exp, int show_locals, int from_tty)
{
struct frame_info *fi;
int count;
int i;
struct frame_info *trailing;
int trailing_level;
if (!target_has_stack)
2005-02-10 Andrew Cagney <cagney@gnu.org> Mark up all error and warning messages. * ada-lang.c, amd64-tdep.c, arch-utils.c, breakpoint.c: Update. * bsd-kvm.c, bsd-uthread.c, coff-solib.h, coffread.c: Update. * core-aout.c, core-regset.c, corefile.c, corelow.c: Update. * cp-abi.c, cp-support.c, cp-valprint.c, cris-tdep.c: Update. * dbxread.c, demangle.c, doublest.c, dsrec.c: Update. * dve3900-rom.c, dwarf2expr.c, dwarf2loc.c: Update. * dwarf2read.c, dwarfread.c, elfread.c, eval.c: Update. * event-top.c, exec.c, expprint.c, f-lang.c: Update. * f-typeprint.c, f-valprint.c, fbsd-nat.c, findvar.c: Update. * frame.c, frv-linux-tdep.c, gcore.c, gdbtypes.c: Update. * gnu-nat.c, gnu-v2-abi.c, gnu-v3-abi.c, go32-nat.c: Update. * hpacc-abi.c, hppa-hpux-nat.c, hppa-hpux-tdep.c: Update. * hppa-linux-nat.c, hppa-linux-tdep.c, hppa-tdep.c: Update. * hpread.c, hpux-thread.c, i386-linux-nat.c: Update. * i386-linux-tdep.c, i386-tdep.c, i386bsd-nat.c: Update. * i386gnu-nat.c, i387-tdep.c, ia64-linux-nat.c: Update. * ia64-tdep.c, inf-child.c, inf-ptrace.c, inf-ttrace.c: Update. * infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update. * inftarg.c, interps.c, irix5-nat.c, jv-lang.c: Update. * kod-cisco.c, kod.c, language.c, libunwind-frame.c: Update. * linespec.c, linux-nat.c, linux-thread-db.c, m2-lang.c: Update. * m32r-rom.c, m68hc11-tdep.c, m68k-tdep.c: Update. * m68klinux-nat.c, macrocmd.c, macroexp.c, main.c: Update. * maint.c, mdebugread.c, mem-break.c, memattr.c: Update. * mips-linux-tdep.c, mips-tdep.c, mipsread.c, monitor.c: Update. * nlmread.c, nto-procfs.c, objc-lang.c, objfiles.c: Update. * observer.c, ocd.c, p-lang.c, p-typeprint.c: Update. * p-valprint.c, pa64solib.c, parse.c, ppc-linux-tdep.c: Update. * ppcnbsd-tdep.c, printcmd.c, procfs.c, remote-e7000.c: Update. * remote-fileio.c, remote-m32r-sdi.c, remote-rdi.c: Update. * remote-rdp.c, remote-sim.c, remote-st.c: Update. * remote-utils.c, remote-utils.h, remote.c: Update. * rom68k-rom.c, rs6000-nat.c, s390-tdep.c, scm-lang.c: Update. * ser-e7kpc.c, ser-tcp.c, ser-unix.c, sh-tdep.c: Update. * sh3-rom.c, shnbsd-tdep.c, sol-thread.c, solib-aix5.c: Update. * solib-frv.c, solib-irix.c, solib-osf.c, solib-pa64.c: Update. * solib-som.c, solib-sunos.c, solib-svr4.c, solib.c: Update. * somread.c, somsolib.c, source.c, stabsread.c: Update. * stack.c, std-regs.c, symfile-mem.c, symfile.c: Update. * symmisc.c, symtab.c, target.c, thread.c, top.c: Update. * tracepoint.c, trad-frame.c, typeprint.c, utils.c: Update. * uw-thread.c, valarith.c, valops.c, valprint.c: Update. * value.c, varobj.c, version.in, win32-nat.c, wince.c: Update. * xcoffread.c, xcoffsolib.c, cli/cli-cmds.c: Update. * cli/cli-decode.c, cli/cli-dump.c, cli/cli-logging.c: Update. * cli/cli-script.c, cli/cli-setshow.c, mi/mi-cmd-break.c: Update. * mi/mi-cmd-disas.c, mi/mi-cmd-env.c, mi/mi-cmd-file.c: Update. * mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-getopt.c: Update. * mi/mi-symbol-cmds.c, tui/tui-layout.c, tui/tui-stack.c: Update. * tui/tui-win.c: Update.
2005-02-11 05:06:14 +01:00
error (_("No stack."));
/* The following code must do two things. First, it must set the
variable TRAILING to the frame from which we should start
printing. Second, it must set the variable count to the number
of frames which we should print, or -1 if all of them. */
trailing = get_current_frame ();
2000-02-29 08:17:15 +01:00
/* The target can be in a state where there is no valid frames
(e.g., just connected). */
if (trailing == NULL)
2005-02-10 Andrew Cagney <cagney@gnu.org> Mark up all error and warning messages. * ada-lang.c, amd64-tdep.c, arch-utils.c, breakpoint.c: Update. * bsd-kvm.c, bsd-uthread.c, coff-solib.h, coffread.c: Update. * core-aout.c, core-regset.c, corefile.c, corelow.c: Update. * cp-abi.c, cp-support.c, cp-valprint.c, cris-tdep.c: Update. * dbxread.c, demangle.c, doublest.c, dsrec.c: Update. * dve3900-rom.c, dwarf2expr.c, dwarf2loc.c: Update. * dwarf2read.c, dwarfread.c, elfread.c, eval.c: Update. * event-top.c, exec.c, expprint.c, f-lang.c: Update. * f-typeprint.c, f-valprint.c, fbsd-nat.c, findvar.c: Update. * frame.c, frv-linux-tdep.c, gcore.c, gdbtypes.c: Update. * gnu-nat.c, gnu-v2-abi.c, gnu-v3-abi.c, go32-nat.c: Update. * hpacc-abi.c, hppa-hpux-nat.c, hppa-hpux-tdep.c: Update. * hppa-linux-nat.c, hppa-linux-tdep.c, hppa-tdep.c: Update. * hpread.c, hpux-thread.c, i386-linux-nat.c: Update. * i386-linux-tdep.c, i386-tdep.c, i386bsd-nat.c: Update. * i386gnu-nat.c, i387-tdep.c, ia64-linux-nat.c: Update. * ia64-tdep.c, inf-child.c, inf-ptrace.c, inf-ttrace.c: Update. * infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update. * inftarg.c, interps.c, irix5-nat.c, jv-lang.c: Update. * kod-cisco.c, kod.c, language.c, libunwind-frame.c: Update. * linespec.c, linux-nat.c, linux-thread-db.c, m2-lang.c: Update. * m32r-rom.c, m68hc11-tdep.c, m68k-tdep.c: Update. * m68klinux-nat.c, macrocmd.c, macroexp.c, main.c: Update. * maint.c, mdebugread.c, mem-break.c, memattr.c: Update. * mips-linux-tdep.c, mips-tdep.c, mipsread.c, monitor.c: Update. * nlmread.c, nto-procfs.c, objc-lang.c, objfiles.c: Update. * observer.c, ocd.c, p-lang.c, p-typeprint.c: Update. * p-valprint.c, pa64solib.c, parse.c, ppc-linux-tdep.c: Update. * ppcnbsd-tdep.c, printcmd.c, procfs.c, remote-e7000.c: Update. * remote-fileio.c, remote-m32r-sdi.c, remote-rdi.c: Update. * remote-rdp.c, remote-sim.c, remote-st.c: Update. * remote-utils.c, remote-utils.h, remote.c: Update. * rom68k-rom.c, rs6000-nat.c, s390-tdep.c, scm-lang.c: Update. * ser-e7kpc.c, ser-tcp.c, ser-unix.c, sh-tdep.c: Update. * sh3-rom.c, shnbsd-tdep.c, sol-thread.c, solib-aix5.c: Update. * solib-frv.c, solib-irix.c, solib-osf.c, solib-pa64.c: Update. * solib-som.c, solib-sunos.c, solib-svr4.c, solib.c: Update. * somread.c, somsolib.c, source.c, stabsread.c: Update. * stack.c, std-regs.c, symfile-mem.c, symfile.c: Update. * symmisc.c, symtab.c, target.c, thread.c, top.c: Update. * tracepoint.c, trad-frame.c, typeprint.c, utils.c: Update. * uw-thread.c, valarith.c, valops.c, valprint.c: Update. * value.c, varobj.c, version.in, win32-nat.c, wince.c: Update. * xcoffread.c, xcoffsolib.c, cli/cli-cmds.c: Update. * cli/cli-decode.c, cli/cli-dump.c, cli/cli-logging.c: Update. * cli/cli-script.c, cli/cli-setshow.c, mi/mi-cmd-break.c: Update. * mi/mi-cmd-disas.c, mi/mi-cmd-env.c, mi/mi-cmd-file.c: Update. * mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-getopt.c: Update. * mi/mi-symbol-cmds.c, tui/tui-layout.c, tui/tui-stack.c: Update. * tui/tui-win.c: Update.
2005-02-11 05:06:14 +01:00
error (_("No stack."));
2000-02-29 08:17:15 +01:00
trailing_level = 0;
if (count_exp)
{
count = parse_and_eval_long (count_exp);
if (count < 0)
{
struct frame_info *current;
count = -count;
current = trailing;
while (current && count--)
{
QUIT;
current = get_prev_frame (current);
}
1999-07-07 22:19:36 +02:00
/* Will stop when CURRENT reaches the top of the stack.
TRAILING will be COUNT below it. */
while (current)
{
QUIT;
trailing = get_prev_frame (trailing);
current = get_prev_frame (current);
trailing_level++;
}
1999-07-07 22:19:36 +02:00
count = -1;
}
}
else
count = -1;
if (info_verbose)
{
struct partial_symtab *ps;
1999-07-07 22:19:36 +02:00
/* Read in symbols for all of the frames. Need to do this in a
separate pass so that "Reading in symbols for xxx" messages
don't screw up the appearance of the backtrace. Also if
people have strong opinions against reading symbols for
1999-07-07 22:19:36 +02:00
backtrace this may have to be an option. */
i = count;
for (fi = trailing; fi != NULL && i--; fi = get_prev_frame (fi))
{
QUIT;
ps = find_pc_psymtab (get_frame_address_in_block (fi));
if (ps)
PSYMTAB_TO_SYMTAB (ps); /* Force syms to come in. */
}
}
for (i = 0, fi = trailing; fi && count--; i++, fi = get_prev_frame (fi))
{
QUIT;
/* Don't use print_stack_frame; if an error() occurs it probably
1999-07-07 22:19:36 +02:00
means further attempts to backtrace would fail (on the other
hand, perhaps the code does or could be fixed to make sure
the frame->prev field gets set to NULL in that case). */
print_frame_info (fi, 1, LOCATION, 1);
if (show_locals)
1999-07-07 22:19:36 +02:00
print_frame_local_vars (fi, 1, gdb_stdout);
/* Save the last frame to check for error conditions. */
trailing = fi;
}
/* If we've stopped before the end, mention that. */
if (fi && from_tty)
printf_filtered (_("(More stack frames follow...)\n"));
/* If we've run out of frames, and the reason appears to be an error
condition, print it. */
if (fi == NULL && trailing != NULL)
{
enum unwind_stop_reason reason;
reason = get_frame_unwind_stop_reason (trailing);
if (reason > UNWIND_FIRST_ERROR)
printf_filtered (_("Backtrace stopped: %s\n"),
frame_stop_reason_string (reason));
}
}
struct backtrace_command_args
{
char *count_exp;
int show_locals;
int from_tty;
};
/* Stub for catch_errors. */
static int
backtrace_command_stub (void *data)
{
struct backtrace_command_args *args = data;
backtrace_command_1 (args->count_exp, args->show_locals, args->from_tty);
return 0;
}
static void
2000-07-30 03:48:28 +02:00
backtrace_command (char *arg, int from_tty)
{
struct cleanup *old_chain = NULL;
int fulltrace_arg = -1, arglen = 0, argc = 0;
struct backtrace_command_args btargs;
if (arg)
{
char **argv;
int i;
1999-07-07 22:19:36 +02:00
argv = buildargv (arg);
1999-04-26 20:34:20 +02:00
old_chain = make_cleanup_freeargv (argv);
argc = 0;
for (i = 0; argv[i]; i++)
1999-07-07 22:19:36 +02:00
{
unsigned int j;
1999-07-07 22:19:36 +02:00
for (j = 0; j < strlen (argv[i]); j++)
1999-07-07 22:19:36 +02:00
argv[i][j] = tolower (argv[i][j]);
if (fulltrace_arg < 0 && subset_compare (argv[i], "full"))
fulltrace_arg = argc;
1999-07-07 22:19:36 +02:00
else
{
arglen += strlen (argv[i]);
1999-07-07 22:19:36 +02:00
argc++;
}
}
arglen += argc;
if (fulltrace_arg >= 0)
1999-07-07 22:19:36 +02:00
{
if (arglen > 0)
1999-07-07 22:19:36 +02:00
{
arg = xmalloc (arglen + 1);
memset (arg, 0, arglen + 1);
for (i = 0; i < (argc + 1); i++)
1999-07-07 22:19:36 +02:00
{
if (i != fulltrace_arg)
1999-07-07 22:19:36 +02:00
{
strcat (arg, argv[i]);
strcat (arg, " ");
1999-07-07 22:19:36 +02:00
}
}
}
else
arg = NULL;
1999-07-07 22:19:36 +02:00
}
}
btargs.count_exp = arg;
btargs.show_locals = (fulltrace_arg >= 0);
btargs.from_tty = from_tty;
catch_errors (backtrace_command_stub, &btargs, "", RETURN_MASK_ERROR);
if (fulltrace_arg >= 0 && arglen > 0)
xfree (arg);
if (old_chain)
1999-07-07 22:19:36 +02:00
do_cleanups (old_chain);
}
static void
2000-07-30 03:48:28 +02:00
backtrace_full_command (char *arg, int from_tty)
{
struct backtrace_command_args btargs;
btargs.count_exp = arg;
btargs.show_locals = 1;
btargs.from_tty = from_tty;
catch_errors (backtrace_command_stub, &btargs, "", RETURN_MASK_ERROR);
}
1999-07-07 22:19:36 +02:00
/* Print the local variables of a block B active in FRAME on STREAM.
Return 1 if any variables were printed; 0 otherwise. */
static int
print_block_frame_locals (struct block *b, struct frame_info *frame,
2003-06-11 David Carlton <carlton@bactrian.org> * dictionary.h: New. * dictionary.c: New. * block.h: Add opaque declaration for struct dictionary. (struct block): Add 'dict' member; delete 'hashtable', 'nsyms', 'sym' members. (BLOCK_DICT): New macro. Delete macros BLOCK_HASHTABLE, BLOCK_NSYMS, BLOCK_SYM, BLOCK_BUCKETS, BLOCK_BUCKET, BLOCK_HASHTABLE_SIZE, BLOCK_SHOULD_SORT. (ALL_BLOCK_SYMBOLS): Update definition. * Makefile.in (SFILES): Add dictionary.c. (dictionary_h): New. (COMMON_OBS): Add dictionary.o. (dictionary.o): New. (ada-lang.o): Depend on dictionary_h. (buildsym.o, coffread.o, jv-lang.o, mdebugread.o, objfiles.o) (stack.o, symmisc.o, symtab.o, tracepoint.o, valops.o) (mi-cmd-stack.o): Ditto. (gdbtk-cmds.o): Update dependencies. (gdbtk-stack.o): Ditto. * ada-lang.c: Include dictionary.h. (symtab_for_sym): Update uses of ALL_BLOCK_SYMBOLS. (fill_in_ada_prototype, debug_print_block): Ditto. (ada_add_block_symbols): Update uses of ALL_BLOCK_SYMBOLS; replace explicit iteration by use of ALL_BLOCK_SYMBOLS. Delete variable 'is_sorted'. * mdebugread.c: Include dictionary.h. (struct parse_stack): Delete 'maxsyms' member. (parse_symbol): Update calls to new_block. Delete calls to shrink_block. Use dictionary methods. (psymtab_to_symtab_1): Delete calls to sort_symtab_syms. Update calls to new_symtab. Don't maintain maxsyms data. (mylookup_symbol): Update use of ALL_BLOCK_SYMBOLS. (add_symbol): Just call dict_add_symbol. (new_symtab): Delete 'maxsyms' argument. (new_symtab): Update calls to new_block. (new_block): Delete 'maxsyms' argument; add 'function' argument. (shrink_block): Delete function. (fixup_sigtramp): Update call to new_block. Add symbol via dict_add_symbol. * jv-lang.c: Include dictionary.h. (get_java_class_symtab): Set the BLOCK_DICT of the blocks appropriately. Set class_symtab->free_func. Make sure the blockvector is big enough to hold two blocks. (add_class_symtab_symbol): Use dictionary methods. (free_class_block): New function. (type_from_class): Replace explicit iteration by ALL_BLOCK_SYMBOLS. * symtab.h (struct symtab): Replace 'free_ptr' method by 'free_func'. * dwarf2read.c (psymtab_to_symtab_1): Delete call to sort_symtab_syms. * dwarfread.c (psymtab_to_symtab_1): Delete call to sort_symtab_syms. * coffread.c (coff_symfile_read): Delete call to sort_symtab_syms. Include dictionary.h. (patch_opaque_types): Update use of ALL_BLOCK_SYMBOLS. * dbxread.c (dbx_psymtab_to_symtab_1): Delete call to sort_symtab_syms. * objfiles.c: Include dictionary.h. (objfile_relocate): Update use of ALL_BLOCK_SYMBOLS. * buildsym.c: Include dictionary.h. (finish_block): Use dictionary methods. (end_symtab): Set free_func to NULL, not free_ptr. * tracepoint.c: Include dictionary.h. (add_local_symbols): Update use of ALL_BLOCK_SYMBOLS. (scope_info): Ditto. * stack.c: Include dictionary.h. (print_block_frame_locals): Update use of ALL_BLOCK_SYMBOLS. (print_block_frame_labels, print_frame_arg_vars) (print_frame_args): Ditto. * symmisc.c (free_symtab_block): Use dictionary methods. (dump_symtab): Ditto. (free_symtab): Replace use of 'free_ptr' by 'free_func'. Include dictionary.h. * symfile.h: Delete declarations of sort_block_syms, sort_symtab_syms. * symfile.c (sort_block_syms): Delete. (sort_symtab_syms): Delete. * symtab.c: Include dictionary.h. (lookup_block_symbol): Use dictionary iterators. (find_pc_sect_symtab): Update use of ALL_BLOCK_SYMBOLS. (search_symbols, make_symbol_completion_list): Ditto. (make_symbol_overload_list): Ditto. * valops.c (value_of_local): Use dict_empty. Include dictionary.h. 2003-06-11 David Carlton <carlton@bactrian.org> * generic/gdbtk-stack.c: Include dictionary.h. (gdb_block_vars): Update use of ALL_BLOCK_SYMBOLS. (gdb_get_blocks, gdb_get_vars_command): Ditto. * generic/gdbtk-cmds.c: Include dictionary.h. (gdb_listfuncs): Update use of ALL_BLOCK_SYMBOLS. 2003-06-11 David Carlton <carlton@bactrian.org> * mi-cmd-stack.c: Include dictionary.h. (list_args_or_locals): Update use of ALL_BLOCK_SYMBOLS.
2003-06-12 01:29:49 +02:00
int num_tabs, struct ui_file *stream)
{
2003-06-11 David Carlton <carlton@bactrian.org> * dictionary.h: New. * dictionary.c: New. * block.h: Add opaque declaration for struct dictionary. (struct block): Add 'dict' member; delete 'hashtable', 'nsyms', 'sym' members. (BLOCK_DICT): New macro. Delete macros BLOCK_HASHTABLE, BLOCK_NSYMS, BLOCK_SYM, BLOCK_BUCKETS, BLOCK_BUCKET, BLOCK_HASHTABLE_SIZE, BLOCK_SHOULD_SORT. (ALL_BLOCK_SYMBOLS): Update definition. * Makefile.in (SFILES): Add dictionary.c. (dictionary_h): New. (COMMON_OBS): Add dictionary.o. (dictionary.o): New. (ada-lang.o): Depend on dictionary_h. (buildsym.o, coffread.o, jv-lang.o, mdebugread.o, objfiles.o) (stack.o, symmisc.o, symtab.o, tracepoint.o, valops.o) (mi-cmd-stack.o): Ditto. (gdbtk-cmds.o): Update dependencies. (gdbtk-stack.o): Ditto. * ada-lang.c: Include dictionary.h. (symtab_for_sym): Update uses of ALL_BLOCK_SYMBOLS. (fill_in_ada_prototype, debug_print_block): Ditto. (ada_add_block_symbols): Update uses of ALL_BLOCK_SYMBOLS; replace explicit iteration by use of ALL_BLOCK_SYMBOLS. Delete variable 'is_sorted'. * mdebugread.c: Include dictionary.h. (struct parse_stack): Delete 'maxsyms' member. (parse_symbol): Update calls to new_block. Delete calls to shrink_block. Use dictionary methods. (psymtab_to_symtab_1): Delete calls to sort_symtab_syms. Update calls to new_symtab. Don't maintain maxsyms data. (mylookup_symbol): Update use of ALL_BLOCK_SYMBOLS. (add_symbol): Just call dict_add_symbol. (new_symtab): Delete 'maxsyms' argument. (new_symtab): Update calls to new_block. (new_block): Delete 'maxsyms' argument; add 'function' argument. (shrink_block): Delete function. (fixup_sigtramp): Update call to new_block. Add symbol via dict_add_symbol. * jv-lang.c: Include dictionary.h. (get_java_class_symtab): Set the BLOCK_DICT of the blocks appropriately. Set class_symtab->free_func. Make sure the blockvector is big enough to hold two blocks. (add_class_symtab_symbol): Use dictionary methods. (free_class_block): New function. (type_from_class): Replace explicit iteration by ALL_BLOCK_SYMBOLS. * symtab.h (struct symtab): Replace 'free_ptr' method by 'free_func'. * dwarf2read.c (psymtab_to_symtab_1): Delete call to sort_symtab_syms. * dwarfread.c (psymtab_to_symtab_1): Delete call to sort_symtab_syms. * coffread.c (coff_symfile_read): Delete call to sort_symtab_syms. Include dictionary.h. (patch_opaque_types): Update use of ALL_BLOCK_SYMBOLS. * dbxread.c (dbx_psymtab_to_symtab_1): Delete call to sort_symtab_syms. * objfiles.c: Include dictionary.h. (objfile_relocate): Update use of ALL_BLOCK_SYMBOLS. * buildsym.c: Include dictionary.h. (finish_block): Use dictionary methods. (end_symtab): Set free_func to NULL, not free_ptr. * tracepoint.c: Include dictionary.h. (add_local_symbols): Update use of ALL_BLOCK_SYMBOLS. (scope_info): Ditto. * stack.c: Include dictionary.h. (print_block_frame_locals): Update use of ALL_BLOCK_SYMBOLS. (print_block_frame_labels, print_frame_arg_vars) (print_frame_args): Ditto. * symmisc.c (free_symtab_block): Use dictionary methods. (dump_symtab): Ditto. (free_symtab): Replace use of 'free_ptr' by 'free_func'. Include dictionary.h. * symfile.h: Delete declarations of sort_block_syms, sort_symtab_syms. * symfile.c (sort_block_syms): Delete. (sort_symtab_syms): Delete. * symtab.c: Include dictionary.h. (lookup_block_symbol): Use dictionary iterators. (find_pc_sect_symtab): Update use of ALL_BLOCK_SYMBOLS. (search_symbols, make_symbol_completion_list): Ditto. (make_symbol_overload_list): Ditto. * valops.c (value_of_local): Use dict_empty. Include dictionary.h. 2003-06-11 David Carlton <carlton@bactrian.org> * generic/gdbtk-stack.c: Include dictionary.h. (gdb_block_vars): Update use of ALL_BLOCK_SYMBOLS. (gdb_get_blocks, gdb_get_vars_command): Ditto. * generic/gdbtk-cmds.c: Include dictionary.h. (gdb_listfuncs): Update use of ALL_BLOCK_SYMBOLS. 2003-06-11 David Carlton <carlton@bactrian.org> * mi-cmd-stack.c: Include dictionary.h. (list_args_or_locals): Update use of ALL_BLOCK_SYMBOLS.
2003-06-12 01:29:49 +02:00
struct dict_iterator iter;
struct symbol *sym;
int values_printed = 0;
int j;
2003-06-11 David Carlton <carlton@bactrian.org> * dictionary.h: New. * dictionary.c: New. * block.h: Add opaque declaration for struct dictionary. (struct block): Add 'dict' member; delete 'hashtable', 'nsyms', 'sym' members. (BLOCK_DICT): New macro. Delete macros BLOCK_HASHTABLE, BLOCK_NSYMS, BLOCK_SYM, BLOCK_BUCKETS, BLOCK_BUCKET, BLOCK_HASHTABLE_SIZE, BLOCK_SHOULD_SORT. (ALL_BLOCK_SYMBOLS): Update definition. * Makefile.in (SFILES): Add dictionary.c. (dictionary_h): New. (COMMON_OBS): Add dictionary.o. (dictionary.o): New. (ada-lang.o): Depend on dictionary_h. (buildsym.o, coffread.o, jv-lang.o, mdebugread.o, objfiles.o) (stack.o, symmisc.o, symtab.o, tracepoint.o, valops.o) (mi-cmd-stack.o): Ditto. (gdbtk-cmds.o): Update dependencies. (gdbtk-stack.o): Ditto. * ada-lang.c: Include dictionary.h. (symtab_for_sym): Update uses of ALL_BLOCK_SYMBOLS. (fill_in_ada_prototype, debug_print_block): Ditto. (ada_add_block_symbols): Update uses of ALL_BLOCK_SYMBOLS; replace explicit iteration by use of ALL_BLOCK_SYMBOLS. Delete variable 'is_sorted'. * mdebugread.c: Include dictionary.h. (struct parse_stack): Delete 'maxsyms' member. (parse_symbol): Update calls to new_block. Delete calls to shrink_block. Use dictionary methods. (psymtab_to_symtab_1): Delete calls to sort_symtab_syms. Update calls to new_symtab. Don't maintain maxsyms data. (mylookup_symbol): Update use of ALL_BLOCK_SYMBOLS. (add_symbol): Just call dict_add_symbol. (new_symtab): Delete 'maxsyms' argument. (new_symtab): Update calls to new_block. (new_block): Delete 'maxsyms' argument; add 'function' argument. (shrink_block): Delete function. (fixup_sigtramp): Update call to new_block. Add symbol via dict_add_symbol. * jv-lang.c: Include dictionary.h. (get_java_class_symtab): Set the BLOCK_DICT of the blocks appropriately. Set class_symtab->free_func. Make sure the blockvector is big enough to hold two blocks. (add_class_symtab_symbol): Use dictionary methods. (free_class_block): New function. (type_from_class): Replace explicit iteration by ALL_BLOCK_SYMBOLS. * symtab.h (struct symtab): Replace 'free_ptr' method by 'free_func'. * dwarf2read.c (psymtab_to_symtab_1): Delete call to sort_symtab_syms. * dwarfread.c (psymtab_to_symtab_1): Delete call to sort_symtab_syms. * coffread.c (coff_symfile_read): Delete call to sort_symtab_syms. Include dictionary.h. (patch_opaque_types): Update use of ALL_BLOCK_SYMBOLS. * dbxread.c (dbx_psymtab_to_symtab_1): Delete call to sort_symtab_syms. * objfiles.c: Include dictionary.h. (objfile_relocate): Update use of ALL_BLOCK_SYMBOLS. * buildsym.c: Include dictionary.h. (finish_block): Use dictionary methods. (end_symtab): Set free_func to NULL, not free_ptr. * tracepoint.c: Include dictionary.h. (add_local_symbols): Update use of ALL_BLOCK_SYMBOLS. (scope_info): Ditto. * stack.c: Include dictionary.h. (print_block_frame_locals): Update use of ALL_BLOCK_SYMBOLS. (print_block_frame_labels, print_frame_arg_vars) (print_frame_args): Ditto. * symmisc.c (free_symtab_block): Use dictionary methods. (dump_symtab): Ditto. (free_symtab): Replace use of 'free_ptr' by 'free_func'. Include dictionary.h. * symfile.h: Delete declarations of sort_block_syms, sort_symtab_syms. * symfile.c (sort_block_syms): Delete. (sort_symtab_syms): Delete. * symtab.c: Include dictionary.h. (lookup_block_symbol): Use dictionary iterators. (find_pc_sect_symtab): Update use of ALL_BLOCK_SYMBOLS. (search_symbols, make_symbol_completion_list): Ditto. (make_symbol_overload_list): Ditto. * valops.c (value_of_local): Use dict_empty. Include dictionary.h. 2003-06-11 David Carlton <carlton@bactrian.org> * generic/gdbtk-stack.c: Include dictionary.h. (gdb_block_vars): Update use of ALL_BLOCK_SYMBOLS. (gdb_get_blocks, gdb_get_vars_command): Ditto. * generic/gdbtk-cmds.c: Include dictionary.h. (gdb_listfuncs): Update use of ALL_BLOCK_SYMBOLS. 2003-06-11 David Carlton <carlton@bactrian.org> * mi-cmd-stack.c: Include dictionary.h. (list_args_or_locals): Update use of ALL_BLOCK_SYMBOLS.
2003-06-12 01:29:49 +02:00
ALL_BLOCK_SYMBOLS (b, iter, sym)
{
switch (SYMBOL_CLASS (sym))
{
case LOC_LOCAL:
case LOC_REGISTER:
case LOC_STATIC:
case LOC_BASEREG:
case LOC_COMPUTED:
values_printed = 1;
for (j = 0; j < num_tabs; j++)
1999-07-07 22:19:36 +02:00
fputs_filtered ("\t", stream);
2003-02-20 David Carlton <carlton@math.stanford.edu> * symtab.h (SYMBOL_PRINT_NAME): Rename from SYMBOL_SOURCE_NAME; expand comment. * ada-lang.c (user_select_syms, ada_finish_decode_line_1): Replace SYMBOL_PRINT_NAME with SYMBOL_SOURCE_NAME. * ada-typeprint.c (ada_typedef_print): Ditto. * ax-gdb.c (gen_var_ref): Ditto. * breakpoint.c (print_one_breakpoint): Ditto. * buildsym.c (finish_block): Ditto. * c-valprint.c (c_val_print): Ditto. * expprint.c (print_subexp): Ditto. * findvar.c (locate_var_value): Ditto. * infcmd.c (jump_command): Ditto. * linespec.c (decode_line_2, decode_compound): Ditto. * maint.c (maintenance_translate_address): Ditto. * objc-lang.c (compare_selectors, compare_classes): Ditto. * printcmd.c (build_address_symbolic, sym_info, print_frame_args): Ditto. * p-valprint.c (pascal_val_print): Ditto. * stabsread.c (define_symbol): Ditto. * stack.c (print_frame, frame_info, print_block_frame_locals) (print_frame_arg_vars, return_command): Ditto. * symfile.c (compare_symbols, compare_psymbols): Ditto. * symmisc.c (print_symbol): Ditto. * symtab.c (lookup_partial_symbol, lookup_block_symbol) (compare_search_syms, print_symbol_info, print_msymbol_info) (rbreak_command): Ditto. * tracepoint.c (tracepoints_info): Ditto. * typeprint.c (typedef_print): Ditto. * valops.c (value_of_variable, hand_function_call): Ditto. * cli/cli-cmds.c (edit_command, list_command): Ditto. * ada-typeprint.c: Update Copyright. * infcmd.c, objc-lang.c, p-valprint.c, symmisc.c: Ditto. * tracepoint.c, cli/cli-cmds.c: Ditto.
2003-02-20 18:17:25 +01:00
fputs_filtered (SYMBOL_PRINT_NAME (sym), stream);
fputs_filtered (" = ", stream);
print_variable_value (sym, frame, stream);
fprintf_filtered (stream, "\n");
break;
default:
/* Ignore symbols which are not locals. */
break;
}
}
return values_printed;
}
/* Same, but print labels. */
static int
2000-07-30 03:48:28 +02:00
print_block_frame_labels (struct block *b, int *have_default,
struct ui_file *stream)
{
2003-06-11 David Carlton <carlton@bactrian.org> * dictionary.h: New. * dictionary.c: New. * block.h: Add opaque declaration for struct dictionary. (struct block): Add 'dict' member; delete 'hashtable', 'nsyms', 'sym' members. (BLOCK_DICT): New macro. Delete macros BLOCK_HASHTABLE, BLOCK_NSYMS, BLOCK_SYM, BLOCK_BUCKETS, BLOCK_BUCKET, BLOCK_HASHTABLE_SIZE, BLOCK_SHOULD_SORT. (ALL_BLOCK_SYMBOLS): Update definition. * Makefile.in (SFILES): Add dictionary.c. (dictionary_h): New. (COMMON_OBS): Add dictionary.o. (dictionary.o): New. (ada-lang.o): Depend on dictionary_h. (buildsym.o, coffread.o, jv-lang.o, mdebugread.o, objfiles.o) (stack.o, symmisc.o, symtab.o, tracepoint.o, valops.o) (mi-cmd-stack.o): Ditto. (gdbtk-cmds.o): Update dependencies. (gdbtk-stack.o): Ditto. * ada-lang.c: Include dictionary.h. (symtab_for_sym): Update uses of ALL_BLOCK_SYMBOLS. (fill_in_ada_prototype, debug_print_block): Ditto. (ada_add_block_symbols): Update uses of ALL_BLOCK_SYMBOLS; replace explicit iteration by use of ALL_BLOCK_SYMBOLS. Delete variable 'is_sorted'. * mdebugread.c: Include dictionary.h. (struct parse_stack): Delete 'maxsyms' member. (parse_symbol): Update calls to new_block. Delete calls to shrink_block. Use dictionary methods. (psymtab_to_symtab_1): Delete calls to sort_symtab_syms. Update calls to new_symtab. Don't maintain maxsyms data. (mylookup_symbol): Update use of ALL_BLOCK_SYMBOLS. (add_symbol): Just call dict_add_symbol. (new_symtab): Delete 'maxsyms' argument. (new_symtab): Update calls to new_block. (new_block): Delete 'maxsyms' argument; add 'function' argument. (shrink_block): Delete function. (fixup_sigtramp): Update call to new_block. Add symbol via dict_add_symbol. * jv-lang.c: Include dictionary.h. (get_java_class_symtab): Set the BLOCK_DICT of the blocks appropriately. Set class_symtab->free_func. Make sure the blockvector is big enough to hold two blocks. (add_class_symtab_symbol): Use dictionary methods. (free_class_block): New function. (type_from_class): Replace explicit iteration by ALL_BLOCK_SYMBOLS. * symtab.h (struct symtab): Replace 'free_ptr' method by 'free_func'. * dwarf2read.c (psymtab_to_symtab_1): Delete call to sort_symtab_syms. * dwarfread.c (psymtab_to_symtab_1): Delete call to sort_symtab_syms. * coffread.c (coff_symfile_read): Delete call to sort_symtab_syms. Include dictionary.h. (patch_opaque_types): Update use of ALL_BLOCK_SYMBOLS. * dbxread.c (dbx_psymtab_to_symtab_1): Delete call to sort_symtab_syms. * objfiles.c: Include dictionary.h. (objfile_relocate): Update use of ALL_BLOCK_SYMBOLS. * buildsym.c: Include dictionary.h. (finish_block): Use dictionary methods. (end_symtab): Set free_func to NULL, not free_ptr. * tracepoint.c: Include dictionary.h. (add_local_symbols): Update use of ALL_BLOCK_SYMBOLS. (scope_info): Ditto. * stack.c: Include dictionary.h. (print_block_frame_locals): Update use of ALL_BLOCK_SYMBOLS. (print_block_frame_labels, print_frame_arg_vars) (print_frame_args): Ditto. * symmisc.c (free_symtab_block): Use dictionary methods. (dump_symtab): Ditto. (free_symtab): Replace use of 'free_ptr' by 'free_func'. Include dictionary.h. * symfile.h: Delete declarations of sort_block_syms, sort_symtab_syms. * symfile.c (sort_block_syms): Delete. (sort_symtab_syms): Delete. * symtab.c: Include dictionary.h. (lookup_block_symbol): Use dictionary iterators. (find_pc_sect_symtab): Update use of ALL_BLOCK_SYMBOLS. (search_symbols, make_symbol_completion_list): Ditto. (make_symbol_overload_list): Ditto. * valops.c (value_of_local): Use dict_empty. Include dictionary.h. 2003-06-11 David Carlton <carlton@bactrian.org> * generic/gdbtk-stack.c: Include dictionary.h. (gdb_block_vars): Update use of ALL_BLOCK_SYMBOLS. (gdb_get_blocks, gdb_get_vars_command): Ditto. * generic/gdbtk-cmds.c: Include dictionary.h. (gdb_listfuncs): Update use of ALL_BLOCK_SYMBOLS. 2003-06-11 David Carlton <carlton@bactrian.org> * mi-cmd-stack.c: Include dictionary.h. (list_args_or_locals): Update use of ALL_BLOCK_SYMBOLS.
2003-06-12 01:29:49 +02:00
struct dict_iterator iter;
struct symbol *sym;
int values_printed = 0;
2003-06-11 David Carlton <carlton@bactrian.org> * dictionary.h: New. * dictionary.c: New. * block.h: Add opaque declaration for struct dictionary. (struct block): Add 'dict' member; delete 'hashtable', 'nsyms', 'sym' members. (BLOCK_DICT): New macro. Delete macros BLOCK_HASHTABLE, BLOCK_NSYMS, BLOCK_SYM, BLOCK_BUCKETS, BLOCK_BUCKET, BLOCK_HASHTABLE_SIZE, BLOCK_SHOULD_SORT. (ALL_BLOCK_SYMBOLS): Update definition. * Makefile.in (SFILES): Add dictionary.c. (dictionary_h): New. (COMMON_OBS): Add dictionary.o. (dictionary.o): New. (ada-lang.o): Depend on dictionary_h. (buildsym.o, coffread.o, jv-lang.o, mdebugread.o, objfiles.o) (stack.o, symmisc.o, symtab.o, tracepoint.o, valops.o) (mi-cmd-stack.o): Ditto. (gdbtk-cmds.o): Update dependencies. (gdbtk-stack.o): Ditto. * ada-lang.c: Include dictionary.h. (symtab_for_sym): Update uses of ALL_BLOCK_SYMBOLS. (fill_in_ada_prototype, debug_print_block): Ditto. (ada_add_block_symbols): Update uses of ALL_BLOCK_SYMBOLS; replace explicit iteration by use of ALL_BLOCK_SYMBOLS. Delete variable 'is_sorted'. * mdebugread.c: Include dictionary.h. (struct parse_stack): Delete 'maxsyms' member. (parse_symbol): Update calls to new_block. Delete calls to shrink_block. Use dictionary methods. (psymtab_to_symtab_1): Delete calls to sort_symtab_syms. Update calls to new_symtab. Don't maintain maxsyms data. (mylookup_symbol): Update use of ALL_BLOCK_SYMBOLS. (add_symbol): Just call dict_add_symbol. (new_symtab): Delete 'maxsyms' argument. (new_symtab): Update calls to new_block. (new_block): Delete 'maxsyms' argument; add 'function' argument. (shrink_block): Delete function. (fixup_sigtramp): Update call to new_block. Add symbol via dict_add_symbol. * jv-lang.c: Include dictionary.h. (get_java_class_symtab): Set the BLOCK_DICT of the blocks appropriately. Set class_symtab->free_func. Make sure the blockvector is big enough to hold two blocks. (add_class_symtab_symbol): Use dictionary methods. (free_class_block): New function. (type_from_class): Replace explicit iteration by ALL_BLOCK_SYMBOLS. * symtab.h (struct symtab): Replace 'free_ptr' method by 'free_func'. * dwarf2read.c (psymtab_to_symtab_1): Delete call to sort_symtab_syms. * dwarfread.c (psymtab_to_symtab_1): Delete call to sort_symtab_syms. * coffread.c (coff_symfile_read): Delete call to sort_symtab_syms. Include dictionary.h. (patch_opaque_types): Update use of ALL_BLOCK_SYMBOLS. * dbxread.c (dbx_psymtab_to_symtab_1): Delete call to sort_symtab_syms. * objfiles.c: Include dictionary.h. (objfile_relocate): Update use of ALL_BLOCK_SYMBOLS. * buildsym.c: Include dictionary.h. (finish_block): Use dictionary methods. (end_symtab): Set free_func to NULL, not free_ptr. * tracepoint.c: Include dictionary.h. (add_local_symbols): Update use of ALL_BLOCK_SYMBOLS. (scope_info): Ditto. * stack.c: Include dictionary.h. (print_block_frame_locals): Update use of ALL_BLOCK_SYMBOLS. (print_block_frame_labels, print_frame_arg_vars) (print_frame_args): Ditto. * symmisc.c (free_symtab_block): Use dictionary methods. (dump_symtab): Ditto. (free_symtab): Replace use of 'free_ptr' by 'free_func'. Include dictionary.h. * symfile.h: Delete declarations of sort_block_syms, sort_symtab_syms. * symfile.c (sort_block_syms): Delete. (sort_symtab_syms): Delete. * symtab.c: Include dictionary.h. (lookup_block_symbol): Use dictionary iterators. (find_pc_sect_symtab): Update use of ALL_BLOCK_SYMBOLS. (search_symbols, make_symbol_completion_list): Ditto. (make_symbol_overload_list): Ditto. * valops.c (value_of_local): Use dict_empty. Include dictionary.h. 2003-06-11 David Carlton <carlton@bactrian.org> * generic/gdbtk-stack.c: Include dictionary.h. (gdb_block_vars): Update use of ALL_BLOCK_SYMBOLS. (gdb_get_blocks, gdb_get_vars_command): Ditto. * generic/gdbtk-cmds.c: Include dictionary.h. (gdb_listfuncs): Update use of ALL_BLOCK_SYMBOLS. 2003-06-11 David Carlton <carlton@bactrian.org> * mi-cmd-stack.c: Include dictionary.h. (list_args_or_locals): Update use of ALL_BLOCK_SYMBOLS.
2003-06-12 01:29:49 +02:00
ALL_BLOCK_SYMBOLS (b, iter, sym)
{
if (strcmp (DEPRECATED_SYMBOL_NAME (sym), "default") == 0)
{
if (*have_default)
continue;
*have_default = 1;
}
if (SYMBOL_CLASS (sym) == LOC_LABEL)
{
struct symtab_and_line sal;
sal = find_pc_line (SYMBOL_VALUE_ADDRESS (sym), 0);
values_printed = 1;
2003-02-20 David Carlton <carlton@math.stanford.edu> * symtab.h (SYMBOL_PRINT_NAME): Rename from SYMBOL_SOURCE_NAME; expand comment. * ada-lang.c (user_select_syms, ada_finish_decode_line_1): Replace SYMBOL_PRINT_NAME with SYMBOL_SOURCE_NAME. * ada-typeprint.c (ada_typedef_print): Ditto. * ax-gdb.c (gen_var_ref): Ditto. * breakpoint.c (print_one_breakpoint): Ditto. * buildsym.c (finish_block): Ditto. * c-valprint.c (c_val_print): Ditto. * expprint.c (print_subexp): Ditto. * findvar.c (locate_var_value): Ditto. * infcmd.c (jump_command): Ditto. * linespec.c (decode_line_2, decode_compound): Ditto. * maint.c (maintenance_translate_address): Ditto. * objc-lang.c (compare_selectors, compare_classes): Ditto. * printcmd.c (build_address_symbolic, sym_info, print_frame_args): Ditto. * p-valprint.c (pascal_val_print): Ditto. * stabsread.c (define_symbol): Ditto. * stack.c (print_frame, frame_info, print_block_frame_locals) (print_frame_arg_vars, return_command): Ditto. * symfile.c (compare_symbols, compare_psymbols): Ditto. * symmisc.c (print_symbol): Ditto. * symtab.c (lookup_partial_symbol, lookup_block_symbol) (compare_search_syms, print_symbol_info, print_msymbol_info) (rbreak_command): Ditto. * tracepoint.c (tracepoints_info): Ditto. * typeprint.c (typedef_print): Ditto. * valops.c (value_of_variable, hand_function_call): Ditto. * cli/cli-cmds.c (edit_command, list_command): Ditto. * ada-typeprint.c: Update Copyright. * infcmd.c, objc-lang.c, p-valprint.c, symmisc.c: Ditto. * tracepoint.c, cli/cli-cmds.c: Ditto.
2003-02-20 18:17:25 +01:00
fputs_filtered (SYMBOL_PRINT_NAME (sym), stream);
if (addressprint)
{
fprintf_filtered (stream, " ");
deprecated_print_address_numeric (SYMBOL_VALUE_ADDRESS (sym), 1, stream);
}
fprintf_filtered (stream, " in file %s, line %d\n",
sal.symtab->filename, sal.line);
}
}
return values_printed;
}
/* Print on STREAM all the local variables in frame FRAME, including
all the blocks active in that frame at its current PC.
Returns 1 if the job was done, or 0 if nothing was printed because
we have no info on the function running in FRAME. */
static void
print_frame_local_vars (struct frame_info *frame, int num_tabs,
struct ui_file *stream)
{
struct block *block = get_frame_block (frame, 0);
int values_printed = 0;
if (block == 0)
{
fprintf_filtered (stream, "No symbol table info available.\n");
return;
}
1999-07-07 22:19:36 +02:00
while (block)
{
if (print_block_frame_locals (block, frame, num_tabs, stream))
values_printed = 1;
/* After handling the function's top-level block, stop. Don't
continue to its superblock, the block of per-file symbols. */
if (BLOCK_FUNCTION (block))
break;
block = BLOCK_SUPERBLOCK (block);
}
if (!values_printed)
fprintf_filtered (stream, _("No locals.\n"));
}
/* Same, but print labels. */
static void
print_frame_label_vars (struct frame_info *frame, int this_level_only,
struct ui_file *stream)
{
struct blockvector *bl;
struct block *block = get_frame_block (frame, 0);
int values_printed = 0;
int index, have_default = 0;
char *blocks_printed;
CORE_ADDR pc = get_frame_pc (frame);
if (block == 0)
{
fprintf_filtered (stream, "No symbol table info available.\n");
return;
}
bl = blockvector_for_pc (BLOCK_END (block) - 4, &index);
blocks_printed = alloca (BLOCKVECTOR_NBLOCKS (bl) * sizeof (char));
memset (blocks_printed, 0, BLOCKVECTOR_NBLOCKS (bl) * sizeof (char));
while (block != 0)
{
CORE_ADDR end = BLOCK_END (block) - 4;
int last_index;
if (bl != blockvector_for_pc (end, &index))
2005-02-10 Andrew Cagney <cagney@gnu.org> Mark up all error and warning messages. * ada-lang.c, amd64-tdep.c, arch-utils.c, breakpoint.c: Update. * bsd-kvm.c, bsd-uthread.c, coff-solib.h, coffread.c: Update. * core-aout.c, core-regset.c, corefile.c, corelow.c: Update. * cp-abi.c, cp-support.c, cp-valprint.c, cris-tdep.c: Update. * dbxread.c, demangle.c, doublest.c, dsrec.c: Update. * dve3900-rom.c, dwarf2expr.c, dwarf2loc.c: Update. * dwarf2read.c, dwarfread.c, elfread.c, eval.c: Update. * event-top.c, exec.c, expprint.c, f-lang.c: Update. * f-typeprint.c, f-valprint.c, fbsd-nat.c, findvar.c: Update. * frame.c, frv-linux-tdep.c, gcore.c, gdbtypes.c: Update. * gnu-nat.c, gnu-v2-abi.c, gnu-v3-abi.c, go32-nat.c: Update. * hpacc-abi.c, hppa-hpux-nat.c, hppa-hpux-tdep.c: Update. * hppa-linux-nat.c, hppa-linux-tdep.c, hppa-tdep.c: Update. * hpread.c, hpux-thread.c, i386-linux-nat.c: Update. * i386-linux-tdep.c, i386-tdep.c, i386bsd-nat.c: Update. * i386gnu-nat.c, i387-tdep.c, ia64-linux-nat.c: Update. * ia64-tdep.c, inf-child.c, inf-ptrace.c, inf-ttrace.c: Update. * infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update. * inftarg.c, interps.c, irix5-nat.c, jv-lang.c: Update. * kod-cisco.c, kod.c, language.c, libunwind-frame.c: Update. * linespec.c, linux-nat.c, linux-thread-db.c, m2-lang.c: Update. * m32r-rom.c, m68hc11-tdep.c, m68k-tdep.c: Update. * m68klinux-nat.c, macrocmd.c, macroexp.c, main.c: Update. * maint.c, mdebugread.c, mem-break.c, memattr.c: Update. * mips-linux-tdep.c, mips-tdep.c, mipsread.c, monitor.c: Update. * nlmread.c, nto-procfs.c, objc-lang.c, objfiles.c: Update. * observer.c, ocd.c, p-lang.c, p-typeprint.c: Update. * p-valprint.c, pa64solib.c, parse.c, ppc-linux-tdep.c: Update. * ppcnbsd-tdep.c, printcmd.c, procfs.c, remote-e7000.c: Update. * remote-fileio.c, remote-m32r-sdi.c, remote-rdi.c: Update. * remote-rdp.c, remote-sim.c, remote-st.c: Update. * remote-utils.c, remote-utils.h, remote.c: Update. * rom68k-rom.c, rs6000-nat.c, s390-tdep.c, scm-lang.c: Update. * ser-e7kpc.c, ser-tcp.c, ser-unix.c, sh-tdep.c: Update. * sh3-rom.c, shnbsd-tdep.c, sol-thread.c, solib-aix5.c: Update. * solib-frv.c, solib-irix.c, solib-osf.c, solib-pa64.c: Update. * solib-som.c, solib-sunos.c, solib-svr4.c, solib.c: Update. * somread.c, somsolib.c, source.c, stabsread.c: Update. * stack.c, std-regs.c, symfile-mem.c, symfile.c: Update. * symmisc.c, symtab.c, target.c, thread.c, top.c: Update. * tracepoint.c, trad-frame.c, typeprint.c, utils.c: Update. * uw-thread.c, valarith.c, valops.c, valprint.c: Update. * value.c, varobj.c, version.in, win32-nat.c, wince.c: Update. * xcoffread.c, xcoffsolib.c, cli/cli-cmds.c: Update. * cli/cli-decode.c, cli/cli-dump.c, cli/cli-logging.c: Update. * cli/cli-script.c, cli/cli-setshow.c, mi/mi-cmd-break.c: Update. * mi/mi-cmd-disas.c, mi/mi-cmd-env.c, mi/mi-cmd-file.c: Update. * mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-getopt.c: Update. * mi/mi-symbol-cmds.c, tui/tui-layout.c, tui/tui-stack.c: Update. * tui/tui-win.c: Update.
2005-02-11 05:06:14 +01:00
error (_("blockvector blotch"));
if (BLOCKVECTOR_BLOCK (bl, index) != block)
2005-02-10 Andrew Cagney <cagney@gnu.org> Mark up all error and warning messages. * ada-lang.c, amd64-tdep.c, arch-utils.c, breakpoint.c: Update. * bsd-kvm.c, bsd-uthread.c, coff-solib.h, coffread.c: Update. * core-aout.c, core-regset.c, corefile.c, corelow.c: Update. * cp-abi.c, cp-support.c, cp-valprint.c, cris-tdep.c: Update. * dbxread.c, demangle.c, doublest.c, dsrec.c: Update. * dve3900-rom.c, dwarf2expr.c, dwarf2loc.c: Update. * dwarf2read.c, dwarfread.c, elfread.c, eval.c: Update. * event-top.c, exec.c, expprint.c, f-lang.c: Update. * f-typeprint.c, f-valprint.c, fbsd-nat.c, findvar.c: Update. * frame.c, frv-linux-tdep.c, gcore.c, gdbtypes.c: Update. * gnu-nat.c, gnu-v2-abi.c, gnu-v3-abi.c, go32-nat.c: Update. * hpacc-abi.c, hppa-hpux-nat.c, hppa-hpux-tdep.c: Update. * hppa-linux-nat.c, hppa-linux-tdep.c, hppa-tdep.c: Update. * hpread.c, hpux-thread.c, i386-linux-nat.c: Update. * i386-linux-tdep.c, i386-tdep.c, i386bsd-nat.c: Update. * i386gnu-nat.c, i387-tdep.c, ia64-linux-nat.c: Update. * ia64-tdep.c, inf-child.c, inf-ptrace.c, inf-ttrace.c: Update. * infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update. * inftarg.c, interps.c, irix5-nat.c, jv-lang.c: Update. * kod-cisco.c, kod.c, language.c, libunwind-frame.c: Update. * linespec.c, linux-nat.c, linux-thread-db.c, m2-lang.c: Update. * m32r-rom.c, m68hc11-tdep.c, m68k-tdep.c: Update. * m68klinux-nat.c, macrocmd.c, macroexp.c, main.c: Update. * maint.c, mdebugread.c, mem-break.c, memattr.c: Update. * mips-linux-tdep.c, mips-tdep.c, mipsread.c, monitor.c: Update. * nlmread.c, nto-procfs.c, objc-lang.c, objfiles.c: Update. * observer.c, ocd.c, p-lang.c, p-typeprint.c: Update. * p-valprint.c, pa64solib.c, parse.c, ppc-linux-tdep.c: Update. * ppcnbsd-tdep.c, printcmd.c, procfs.c, remote-e7000.c: Update. * remote-fileio.c, remote-m32r-sdi.c, remote-rdi.c: Update. * remote-rdp.c, remote-sim.c, remote-st.c: Update. * remote-utils.c, remote-utils.h, remote.c: Update. * rom68k-rom.c, rs6000-nat.c, s390-tdep.c, scm-lang.c: Update. * ser-e7kpc.c, ser-tcp.c, ser-unix.c, sh-tdep.c: Update. * sh3-rom.c, shnbsd-tdep.c, sol-thread.c, solib-aix5.c: Update. * solib-frv.c, solib-irix.c, solib-osf.c, solib-pa64.c: Update. * solib-som.c, solib-sunos.c, solib-svr4.c, solib.c: Update. * somread.c, somsolib.c, source.c, stabsread.c: Update. * stack.c, std-regs.c, symfile-mem.c, symfile.c: Update. * symmisc.c, symtab.c, target.c, thread.c, top.c: Update. * tracepoint.c, trad-frame.c, typeprint.c, utils.c: Update. * uw-thread.c, valarith.c, valops.c, valprint.c: Update. * value.c, varobj.c, version.in, win32-nat.c, wince.c: Update. * xcoffread.c, xcoffsolib.c, cli/cli-cmds.c: Update. * cli/cli-decode.c, cli/cli-dump.c, cli/cli-logging.c: Update. * cli/cli-script.c, cli/cli-setshow.c, mi/mi-cmd-break.c: Update. * mi/mi-cmd-disas.c, mi/mi-cmd-env.c, mi/mi-cmd-file.c: Update. * mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-getopt.c: Update. * mi/mi-symbol-cmds.c, tui/tui-layout.c, tui/tui-stack.c: Update. * tui/tui-win.c: Update.
2005-02-11 05:06:14 +01:00
error (_("blockvector botch"));
last_index = BLOCKVECTOR_NBLOCKS (bl);
index += 1;
/* Don't print out blocks that have gone by. */
while (index < last_index
&& BLOCK_END (BLOCKVECTOR_BLOCK (bl, index)) < pc)
index++;
while (index < last_index
&& BLOCK_END (BLOCKVECTOR_BLOCK (bl, index)) < end)
{
if (blocks_printed[index] == 0)
{
if (print_block_frame_labels (BLOCKVECTOR_BLOCK (bl, index),
&have_default, stream))
values_printed = 1;
blocks_printed[index] = 1;
}
index++;
}
if (have_default)
return;
if (values_printed && this_level_only)
return;
/* After handling the function's top-level block, stop. Don't
continue to its superblock, the block of per-file symbols. */
if (BLOCK_FUNCTION (block))
break;
block = BLOCK_SUPERBLOCK (block);
}
if (!values_printed && !this_level_only)
fprintf_filtered (stream, _("No catches.\n"));
}
void
2000-07-30 03:48:28 +02:00
locals_info (char *args, int from_tty)
{
print_frame_local_vars (get_selected_frame (_("No frame selected.")),
0, gdb_stdout);
}
static void
2000-07-30 03:48:28 +02:00
catch_info (char *ignore, int from_tty)
{
1999-07-07 22:19:36 +02:00
struct symtab_and_line *sal;
1999-07-07 22:19:36 +02:00
/* Check for target support for exception handling */
sal = target_enable_exception_callback (EX_EVENT_CATCH, 1);
if (sal)
{
/* Currently not handling this. Ideally, here we should
interact with the C++ runtime system to find the list of
active handlers, etc. */
fprintf_filtered (gdb_stdout, _("\
Info catch not supported with this target/compiler combination.\n"));
}
else
{
/* Assume g++ compiled code; old GDB 4.16 behaviour. */
print_frame_label_vars (get_selected_frame (_("No frame selected.")),
0, gdb_stdout);
}
}
static void
print_frame_arg_vars (struct frame_info *frame, struct ui_file *stream)
{
struct symbol *func = get_frame_function (frame);
struct block *b;
2003-06-11 David Carlton <carlton@bactrian.org> * dictionary.h: New. * dictionary.c: New. * block.h: Add opaque declaration for struct dictionary. (struct block): Add 'dict' member; delete 'hashtable', 'nsyms', 'sym' members. (BLOCK_DICT): New macro. Delete macros BLOCK_HASHTABLE, BLOCK_NSYMS, BLOCK_SYM, BLOCK_BUCKETS, BLOCK_BUCKET, BLOCK_HASHTABLE_SIZE, BLOCK_SHOULD_SORT. (ALL_BLOCK_SYMBOLS): Update definition. * Makefile.in (SFILES): Add dictionary.c. (dictionary_h): New. (COMMON_OBS): Add dictionary.o. (dictionary.o): New. (ada-lang.o): Depend on dictionary_h. (buildsym.o, coffread.o, jv-lang.o, mdebugread.o, objfiles.o) (stack.o, symmisc.o, symtab.o, tracepoint.o, valops.o) (mi-cmd-stack.o): Ditto. (gdbtk-cmds.o): Update dependencies. (gdbtk-stack.o): Ditto. * ada-lang.c: Include dictionary.h. (symtab_for_sym): Update uses of ALL_BLOCK_SYMBOLS. (fill_in_ada_prototype, debug_print_block): Ditto. (ada_add_block_symbols): Update uses of ALL_BLOCK_SYMBOLS; replace explicit iteration by use of ALL_BLOCK_SYMBOLS. Delete variable 'is_sorted'. * mdebugread.c: Include dictionary.h. (struct parse_stack): Delete 'maxsyms' member. (parse_symbol): Update calls to new_block. Delete calls to shrink_block. Use dictionary methods. (psymtab_to_symtab_1): Delete calls to sort_symtab_syms. Update calls to new_symtab. Don't maintain maxsyms data. (mylookup_symbol): Update use of ALL_BLOCK_SYMBOLS. (add_symbol): Just call dict_add_symbol. (new_symtab): Delete 'maxsyms' argument. (new_symtab): Update calls to new_block. (new_block): Delete 'maxsyms' argument; add 'function' argument. (shrink_block): Delete function. (fixup_sigtramp): Update call to new_block. Add symbol via dict_add_symbol. * jv-lang.c: Include dictionary.h. (get_java_class_symtab): Set the BLOCK_DICT of the blocks appropriately. Set class_symtab->free_func. Make sure the blockvector is big enough to hold two blocks. (add_class_symtab_symbol): Use dictionary methods. (free_class_block): New function. (type_from_class): Replace explicit iteration by ALL_BLOCK_SYMBOLS. * symtab.h (struct symtab): Replace 'free_ptr' method by 'free_func'. * dwarf2read.c (psymtab_to_symtab_1): Delete call to sort_symtab_syms. * dwarfread.c (psymtab_to_symtab_1): Delete call to sort_symtab_syms. * coffread.c (coff_symfile_read): Delete call to sort_symtab_syms. Include dictionary.h. (patch_opaque_types): Update use of ALL_BLOCK_SYMBOLS. * dbxread.c (dbx_psymtab_to_symtab_1): Delete call to sort_symtab_syms. * objfiles.c: Include dictionary.h. (objfile_relocate): Update use of ALL_BLOCK_SYMBOLS. * buildsym.c: Include dictionary.h. (finish_block): Use dictionary methods. (end_symtab): Set free_func to NULL, not free_ptr. * tracepoint.c: Include dictionary.h. (add_local_symbols): Update use of ALL_BLOCK_SYMBOLS. (scope_info): Ditto. * stack.c: Include dictionary.h. (print_block_frame_locals): Update use of ALL_BLOCK_SYMBOLS. (print_block_frame_labels, print_frame_arg_vars) (print_frame_args): Ditto. * symmisc.c (free_symtab_block): Use dictionary methods. (dump_symtab): Ditto. (free_symtab): Replace use of 'free_ptr' by 'free_func'. Include dictionary.h. * symfile.h: Delete declarations of sort_block_syms, sort_symtab_syms. * symfile.c (sort_block_syms): Delete. (sort_symtab_syms): Delete. * symtab.c: Include dictionary.h. (lookup_block_symbol): Use dictionary iterators. (find_pc_sect_symtab): Update use of ALL_BLOCK_SYMBOLS. (search_symbols, make_symbol_completion_list): Ditto. (make_symbol_overload_list): Ditto. * valops.c (value_of_local): Use dict_empty. Include dictionary.h. 2003-06-11 David Carlton <carlton@bactrian.org> * generic/gdbtk-stack.c: Include dictionary.h. (gdb_block_vars): Update use of ALL_BLOCK_SYMBOLS. (gdb_get_blocks, gdb_get_vars_command): Ditto. * generic/gdbtk-cmds.c: Include dictionary.h. (gdb_listfuncs): Update use of ALL_BLOCK_SYMBOLS. 2003-06-11 David Carlton <carlton@bactrian.org> * mi-cmd-stack.c: Include dictionary.h. (list_args_or_locals): Update use of ALL_BLOCK_SYMBOLS.
2003-06-12 01:29:49 +02:00
struct dict_iterator iter;
struct symbol *sym, *sym2;
int values_printed = 0;
if (func == 0)
{
fprintf_filtered (stream, _("No symbol table info available.\n"));
return;
}
b = SYMBOL_BLOCK_VALUE (func);
2003-06-11 David Carlton <carlton@bactrian.org> * dictionary.h: New. * dictionary.c: New. * block.h: Add opaque declaration for struct dictionary. (struct block): Add 'dict' member; delete 'hashtable', 'nsyms', 'sym' members. (BLOCK_DICT): New macro. Delete macros BLOCK_HASHTABLE, BLOCK_NSYMS, BLOCK_SYM, BLOCK_BUCKETS, BLOCK_BUCKET, BLOCK_HASHTABLE_SIZE, BLOCK_SHOULD_SORT. (ALL_BLOCK_SYMBOLS): Update definition. * Makefile.in (SFILES): Add dictionary.c. (dictionary_h): New. (COMMON_OBS): Add dictionary.o. (dictionary.o): New. (ada-lang.o): Depend on dictionary_h. (buildsym.o, coffread.o, jv-lang.o, mdebugread.o, objfiles.o) (stack.o, symmisc.o, symtab.o, tracepoint.o, valops.o) (mi-cmd-stack.o): Ditto. (gdbtk-cmds.o): Update dependencies. (gdbtk-stack.o): Ditto. * ada-lang.c: Include dictionary.h. (symtab_for_sym): Update uses of ALL_BLOCK_SYMBOLS. (fill_in_ada_prototype, debug_print_block): Ditto. (ada_add_block_symbols): Update uses of ALL_BLOCK_SYMBOLS; replace explicit iteration by use of ALL_BLOCK_SYMBOLS. Delete variable 'is_sorted'. * mdebugread.c: Include dictionary.h. (struct parse_stack): Delete 'maxsyms' member. (parse_symbol): Update calls to new_block. Delete calls to shrink_block. Use dictionary methods. (psymtab_to_symtab_1): Delete calls to sort_symtab_syms. Update calls to new_symtab. Don't maintain maxsyms data. (mylookup_symbol): Update use of ALL_BLOCK_SYMBOLS. (add_symbol): Just call dict_add_symbol. (new_symtab): Delete 'maxsyms' argument. (new_symtab): Update calls to new_block. (new_block): Delete 'maxsyms' argument; add 'function' argument. (shrink_block): Delete function. (fixup_sigtramp): Update call to new_block. Add symbol via dict_add_symbol. * jv-lang.c: Include dictionary.h. (get_java_class_symtab): Set the BLOCK_DICT of the blocks appropriately. Set class_symtab->free_func. Make sure the blockvector is big enough to hold two blocks. (add_class_symtab_symbol): Use dictionary methods. (free_class_block): New function. (type_from_class): Replace explicit iteration by ALL_BLOCK_SYMBOLS. * symtab.h (struct symtab): Replace 'free_ptr' method by 'free_func'. * dwarf2read.c (psymtab_to_symtab_1): Delete call to sort_symtab_syms. * dwarfread.c (psymtab_to_symtab_1): Delete call to sort_symtab_syms. * coffread.c (coff_symfile_read): Delete call to sort_symtab_syms. Include dictionary.h. (patch_opaque_types): Update use of ALL_BLOCK_SYMBOLS. * dbxread.c (dbx_psymtab_to_symtab_1): Delete call to sort_symtab_syms. * objfiles.c: Include dictionary.h. (objfile_relocate): Update use of ALL_BLOCK_SYMBOLS. * buildsym.c: Include dictionary.h. (finish_block): Use dictionary methods. (end_symtab): Set free_func to NULL, not free_ptr. * tracepoint.c: Include dictionary.h. (add_local_symbols): Update use of ALL_BLOCK_SYMBOLS. (scope_info): Ditto. * stack.c: Include dictionary.h. (print_block_frame_locals): Update use of ALL_BLOCK_SYMBOLS. (print_block_frame_labels, print_frame_arg_vars) (print_frame_args): Ditto. * symmisc.c (free_symtab_block): Use dictionary methods. (dump_symtab): Ditto. (free_symtab): Replace use of 'free_ptr' by 'free_func'. Include dictionary.h. * symfile.h: Delete declarations of sort_block_syms, sort_symtab_syms. * symfile.c (sort_block_syms): Delete. (sort_symtab_syms): Delete. * symtab.c: Include dictionary.h. (lookup_block_symbol): Use dictionary iterators. (find_pc_sect_symtab): Update use of ALL_BLOCK_SYMBOLS. (search_symbols, make_symbol_completion_list): Ditto. (make_symbol_overload_list): Ditto. * valops.c (value_of_local): Use dict_empty. Include dictionary.h. 2003-06-11 David Carlton <carlton@bactrian.org> * generic/gdbtk-stack.c: Include dictionary.h. (gdb_block_vars): Update use of ALL_BLOCK_SYMBOLS. (gdb_get_blocks, gdb_get_vars_command): Ditto. * generic/gdbtk-cmds.c: Include dictionary.h. (gdb_listfuncs): Update use of ALL_BLOCK_SYMBOLS. 2003-06-11 David Carlton <carlton@bactrian.org> * mi-cmd-stack.c: Include dictionary.h. (list_args_or_locals): Update use of ALL_BLOCK_SYMBOLS.
2003-06-12 01:29:49 +02:00
ALL_BLOCK_SYMBOLS (b, iter, sym)
{
switch (SYMBOL_CLASS (sym))
{
case LOC_ARG:
case LOC_LOCAL_ARG:
case LOC_REF_ARG:
case LOC_REGPARM:
case LOC_REGPARM_ADDR:
case LOC_BASEREG_ARG:
case LOC_COMPUTED_ARG:
values_printed = 1;
2003-02-20 David Carlton <carlton@math.stanford.edu> * symtab.h (SYMBOL_PRINT_NAME): Rename from SYMBOL_SOURCE_NAME; expand comment. * ada-lang.c (user_select_syms, ada_finish_decode_line_1): Replace SYMBOL_PRINT_NAME with SYMBOL_SOURCE_NAME. * ada-typeprint.c (ada_typedef_print): Ditto. * ax-gdb.c (gen_var_ref): Ditto. * breakpoint.c (print_one_breakpoint): Ditto. * buildsym.c (finish_block): Ditto. * c-valprint.c (c_val_print): Ditto. * expprint.c (print_subexp): Ditto. * findvar.c (locate_var_value): Ditto. * infcmd.c (jump_command): Ditto. * linespec.c (decode_line_2, decode_compound): Ditto. * maint.c (maintenance_translate_address): Ditto. * objc-lang.c (compare_selectors, compare_classes): Ditto. * printcmd.c (build_address_symbolic, sym_info, print_frame_args): Ditto. * p-valprint.c (pascal_val_print): Ditto. * stabsread.c (define_symbol): Ditto. * stack.c (print_frame, frame_info, print_block_frame_locals) (print_frame_arg_vars, return_command): Ditto. * symfile.c (compare_symbols, compare_psymbols): Ditto. * symmisc.c (print_symbol): Ditto. * symtab.c (lookup_partial_symbol, lookup_block_symbol) (compare_search_syms, print_symbol_info, print_msymbol_info) (rbreak_command): Ditto. * tracepoint.c (tracepoints_info): Ditto. * typeprint.c (typedef_print): Ditto. * valops.c (value_of_variable, hand_function_call): Ditto. * cli/cli-cmds.c (edit_command, list_command): Ditto. * ada-typeprint.c: Update Copyright. * infcmd.c, objc-lang.c, p-valprint.c, symmisc.c: Ditto. * tracepoint.c, cli/cli-cmds.c: Ditto.
2003-02-20 18:17:25 +01:00
fputs_filtered (SYMBOL_PRINT_NAME (sym), stream);
fputs_filtered (" = ", stream);
/* We have to look up the symbol because arguments can have
two entries (one a parameter, one a local) and the one we
want is the local, which lookup_symbol will find for us.
This includes gcc1 (not gcc2) on the sparc when passing a
small structure and gcc2 when the argument type is float
and it is passed as a double and converted to float by
the prologue (in the latter case the type of the LOC_ARG
symbol is double and the type of the LOC_LOCAL symbol is
float). There are also LOC_ARG/LOC_REGISTER pairs which
are not combined in symbol-reading. */
2003-02-25 David Carlton <carlton@math.stanford.edu> * symtab.h (SYMBOL_NATURAL_NAME): New macro. (SYMBOL_LINKAGE_NAME): Ditto. (SYMBOL_PRINT_NAME): Use SYMBOL_NATURAL_NAME and SYMBOL_LINKAGE_NAME. (struct general_symbol_info): Expand comment. (DEPRECATED_SYMBOL_NAME): Rename from SYMBOL_NAME. (SYMBOL_MATCHES_NAME): Use DEPRECATED_SYMBOL_NAME. (SYMBOL_MATCHES_REGEXP): Ditto. * symtab.c (symbol_natural_name): New function. * objfiles.h: Replace all uses of SYMBOL_NAME by DEPRECATED_SYMBOL_NAME. * xcoffread.c, valops.c, typeprint.c, tracepoint.c: Ditto. * symtab.c, symmisc.c, symfile.c, stack.c, stabsread.c: Ditto. * somsolib.c, sol-thread.c, rs6000-tdep.c, p-valprint.c: Ditto. * printcmd.c, objfiles.c, objc-lang.c, mipsread.c: Ditto. * minsyms.c, mdebugread.c, linespec.c, jv-lang.c: Ditto. * i386-tdep.c, i386-linux-tdep.c, hpread.c, hppa-tdep.c: Ditto. * gnu-v2-abi.c, f-valprint.c, findvar.c, expprint.c: Ditto. * dwarfread.c, dwarf2read.c, dbxread.c, c-valprint.c: Ditto. * cp-valprint.c, coffread.c, buildsym.c, breakpoint.c: Ditto. * blockframe.c, ax-gdb.c, arm-linux-tdep.c, ada-lang.c: Ditto. * ada-exp.y: Ditto. * ada-exp.y: Update copyright. * sol-thread.c, mipsread.c, jv-lang.c, f-valprint.c: Ditto. * cp-valprint.c: Ditto. 2003-02-25 David Carlton <carlton@math.stanford.edu> * generic/gdbtk.h: Replace all instances of SYMBOL_NAME by DEPRECATED_SYMBOL_NAME. * generic/gdbtk-stack.c, generic/gdbtk-cmds.c: Ditto. * generic/gdbtk-stack.c, generic/gdbtk-cmds.c: Update copyright. 2003-02-25 David Carlton <carlton@math.stanford.edu> * mi-cmd-stack.c: Replace all instances of SYMBOL_NAME with DEPRECATED_SYMBOL_NAME. Update copyright.
2003-02-25 22:36:23 +01:00
sym2 = lookup_symbol (DEPRECATED_SYMBOL_NAME (sym),
b, VAR_DOMAIN, NULL, NULL);
print_variable_value (sym2, frame, stream);
fprintf_filtered (stream, "\n");
break;
default:
/* Don't worry about things which aren't arguments. */
break;
}
}
if (!values_printed)
fprintf_filtered (stream, _("No arguments.\n"));
}
void
2000-07-30 03:48:28 +02:00
args_info (char *ignore, int from_tty)
{
print_frame_arg_vars (get_selected_frame (_("No frame selected.")),
gdb_stdout);
}
static void
2000-07-30 03:48:28 +02:00
args_plus_locals_info (char *ignore, int from_tty)
{
1999-07-07 22:19:36 +02:00
args_info (ignore, from_tty);
locals_info (ignore, from_tty);
}
1999-07-07 22:19:36 +02:00
/* Select frame FRAME. Also print the stack frame and show the source
if this is the tui version. */
static void
select_and_print_frame (struct frame_info *frame)
{
select_frame (frame);
if (frame)
print_stack_frame (frame, 1, SRC_AND_LOC);
}
/* Return the symbol-block in which the selected frame is executing.
Can return zero under various legitimate circumstances.
If ADDR_IN_BLOCK is non-zero, set *ADDR_IN_BLOCK to the relevant
code address within the block returned. We use this to decide
which macros are in scope. */
struct block *
get_selected_block (CORE_ADDR *addr_in_block)
{
if (!target_has_stack)
return 0;
return get_frame_block (get_selected_frame (NULL), addr_in_block);
}
/* Find a frame a certain number of levels away from FRAME.
LEVEL_OFFSET_PTR points to an int containing the number of levels.
Positive means go to earlier frames (up); negative, the reverse.
The int that contains the number of levels is counted toward
zero as the frames for those levels are found.
If the top or bottom frame is reached, that frame is returned,
but the final value of *LEVEL_OFFSET_PTR is nonzero and indicates
how much farther the original request asked to go. */
struct frame_info *
find_relative_frame (struct frame_info *frame, int *level_offset_ptr)
{
/* Going up is simple: just call get_prev_frame enough times or
until the initial frame is reached. */
while (*level_offset_ptr > 0)
{
struct frame_info *prev = get_prev_frame (frame);
if (!prev)
break;
(*level_offset_ptr)--;
frame = prev;
}
/* Going down is just as simple. */
while (*level_offset_ptr < 0)
{
struct frame_info *next = get_next_frame (frame);
if (!next)
break;
(*level_offset_ptr)++;
frame = next;
}
return frame;
}
/* The "select_frame" command. With no argument this is a NOP.
Select the frame at level LEVEL_EXP if it is a valid level.
Otherwise, treat LEVEL_EXP as an address expression and select it.
See parse_frame_specification for more info on proper frame
expressions. */
2000-02-03 05:14:45 +01:00
void
2000-07-30 03:48:28 +02:00
select_frame_command (char *level_exp, int from_tty)
{
select_frame (parse_frame_specification_1 (level_exp, "No stack.", NULL));
}
/* The "frame" command. With no argument, print the selected frame
briefly. With an argument, behave like select_frame and then print
the selected frame. */
static void
2000-07-30 03:48:28 +02:00
frame_command (char *level_exp, int from_tty)
{
select_frame_command (level_exp, from_tty);
print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC);
}
/* The XDB Compatibility command to print the current frame. */
1999-04-26 20:34:20 +02:00
static void
2000-07-30 03:48:28 +02:00
current_frame_command (char *level_exp, int from_tty)
{
print_stack_frame (get_selected_frame (_("No stack.")), 1, SRC_AND_LOC);
1999-04-26 20:34:20 +02:00
}
/* Select the frame up one or COUNT_EXP stack levels from the
previously selected frame, and print it briefly. */
static void
2000-07-30 03:48:28 +02:00
up_silently_base (char *count_exp)
{
struct frame_info *frame;
int count = 1;
if (count_exp)
count = parse_and_eval_long (count_exp);
1999-07-07 22:19:36 +02:00
frame = find_relative_frame (get_selected_frame ("No stack."), &count);
if (count != 0 && count_exp == NULL)
2005-02-10 Andrew Cagney <cagney@gnu.org> Mark up all error and warning messages. * ada-lang.c, amd64-tdep.c, arch-utils.c, breakpoint.c: Update. * bsd-kvm.c, bsd-uthread.c, coff-solib.h, coffread.c: Update. * core-aout.c, core-regset.c, corefile.c, corelow.c: Update. * cp-abi.c, cp-support.c, cp-valprint.c, cris-tdep.c: Update. * dbxread.c, demangle.c, doublest.c, dsrec.c: Update. * dve3900-rom.c, dwarf2expr.c, dwarf2loc.c: Update. * dwarf2read.c, dwarfread.c, elfread.c, eval.c: Update. * event-top.c, exec.c, expprint.c, f-lang.c: Update. * f-typeprint.c, f-valprint.c, fbsd-nat.c, findvar.c: Update. * frame.c, frv-linux-tdep.c, gcore.c, gdbtypes.c: Update. * gnu-nat.c, gnu-v2-abi.c, gnu-v3-abi.c, go32-nat.c: Update. * hpacc-abi.c, hppa-hpux-nat.c, hppa-hpux-tdep.c: Update. * hppa-linux-nat.c, hppa-linux-tdep.c, hppa-tdep.c: Update. * hpread.c, hpux-thread.c, i386-linux-nat.c: Update. * i386-linux-tdep.c, i386-tdep.c, i386bsd-nat.c: Update. * i386gnu-nat.c, i387-tdep.c, ia64-linux-nat.c: Update. * ia64-tdep.c, inf-child.c, inf-ptrace.c, inf-ttrace.c: Update. * infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update. * inftarg.c, interps.c, irix5-nat.c, jv-lang.c: Update. * kod-cisco.c, kod.c, language.c, libunwind-frame.c: Update. * linespec.c, linux-nat.c, linux-thread-db.c, m2-lang.c: Update. * m32r-rom.c, m68hc11-tdep.c, m68k-tdep.c: Update. * m68klinux-nat.c, macrocmd.c, macroexp.c, main.c: Update. * maint.c, mdebugread.c, mem-break.c, memattr.c: Update. * mips-linux-tdep.c, mips-tdep.c, mipsread.c, monitor.c: Update. * nlmread.c, nto-procfs.c, objc-lang.c, objfiles.c: Update. * observer.c, ocd.c, p-lang.c, p-typeprint.c: Update. * p-valprint.c, pa64solib.c, parse.c, ppc-linux-tdep.c: Update. * ppcnbsd-tdep.c, printcmd.c, procfs.c, remote-e7000.c: Update. * remote-fileio.c, remote-m32r-sdi.c, remote-rdi.c: Update. * remote-rdp.c, remote-sim.c, remote-st.c: Update. * remote-utils.c, remote-utils.h, remote.c: Update. * rom68k-rom.c, rs6000-nat.c, s390-tdep.c, scm-lang.c: Update. * ser-e7kpc.c, ser-tcp.c, ser-unix.c, sh-tdep.c: Update. * sh3-rom.c, shnbsd-tdep.c, sol-thread.c, solib-aix5.c: Update. * solib-frv.c, solib-irix.c, solib-osf.c, solib-pa64.c: Update. * solib-som.c, solib-sunos.c, solib-svr4.c, solib.c: Update. * somread.c, somsolib.c, source.c, stabsread.c: Update. * stack.c, std-regs.c, symfile-mem.c, symfile.c: Update. * symmisc.c, symtab.c, target.c, thread.c, top.c: Update. * tracepoint.c, trad-frame.c, typeprint.c, utils.c: Update. * uw-thread.c, valarith.c, valops.c, valprint.c: Update. * value.c, varobj.c, version.in, win32-nat.c, wince.c: Update. * xcoffread.c, xcoffsolib.c, cli/cli-cmds.c: Update. * cli/cli-decode.c, cli/cli-dump.c, cli/cli-logging.c: Update. * cli/cli-script.c, cli/cli-setshow.c, mi/mi-cmd-break.c: Update. * mi/mi-cmd-disas.c, mi/mi-cmd-env.c, mi/mi-cmd-file.c: Update. * mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-getopt.c: Update. * mi/mi-symbol-cmds.c, tui/tui-layout.c, tui/tui-stack.c: Update. * tui/tui-win.c: Update.
2005-02-11 05:06:14 +01:00
error (_("Initial frame selected; you cannot go up."));
select_frame (frame);
}
static void
2000-07-30 03:48:28 +02:00
up_silently_command (char *count_exp, int from_tty)
{
1999-07-07 22:19:36 +02:00
up_silently_base (count_exp);
}
static void
2000-07-30 03:48:28 +02:00
up_command (char *count_exp, int from_tty)
{
up_silently_base (count_exp);
print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC);
}
/* Select the frame down one or COUNT_EXP stack levels from the previously
selected frame, and print it briefly. */
static void
2000-07-30 03:48:28 +02:00
down_silently_base (char *count_exp)
{
struct frame_info *frame;
int count = -1;
if (count_exp)
count = -parse_and_eval_long (count_exp);
1999-07-07 22:19:36 +02:00
frame = find_relative_frame (get_selected_frame ("No stack."), &count);
if (count != 0 && count_exp == NULL)
{
/* We only do this if COUNT_EXP is not specified. That way
"down" means to really go down (and let me know if that is
impossible), but "down 9999" can be used to mean go all the
way down without getting an error. */
error (_("Bottom (innermost) frame selected; you cannot go down."));
}
select_frame (frame);
}
static void
2000-07-30 03:48:28 +02:00
down_silently_command (char *count_exp, int from_tty)
{
down_silently_base (count_exp);
}
static void
2000-07-30 03:48:28 +02:00
down_command (char *count_exp, int from_tty)
{
down_silently_base (count_exp);
print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC);
}
2000-02-03 05:14:45 +01:00
void
2000-07-30 03:48:28 +02:00
return_command (char *retval_exp, int from_tty)
{
struct symbol *thisfun;
2001-11-10 22:34:56 +01:00
struct value *return_value = NULL;
const char *query_prefix = "";
thisfun = get_frame_function (get_selected_frame ("No selected frame."));
/* Compute the return value. If the computation triggers an error,
let it bail. If the return type can't be handled, set
RETURN_VALUE to NULL, and QUERY_PREFIX to an informational
message. */
if (retval_exp)
{
struct type *return_type = NULL;
/* Compute the return value. Should the computation fail, this
call throws an error. */
return_value = parse_and_eval (retval_exp);
/* Cast return value to the return type of the function. Should
the cast fail, this call throws an error. */
if (thisfun != NULL)
return_type = TYPE_TARGET_TYPE (SYMBOL_TYPE (thisfun));
if (return_type == NULL)
return_type = builtin_type_int;
CHECK_TYPEDEF (return_type);
return_value = value_cast (return_type, return_value);
/* Make sure the value is fully evaluated. It may live in the
stack frame we're about to pop. */
if (value_lazy (return_value))
value_fetch_lazy (return_value);
if (TYPE_CODE (return_type) == TYPE_CODE_VOID)
/* If the return-type is "void", don't try to find the
return-value's location. However, do still evaluate the
return expression so that, even when the expression result
is discarded, side effects such as "return i++" still
occur. */
return_value = NULL;
/* FIXME: cagney/2004-01-17: If the architecture implements both
return_value and extract_returned_value_address, should allow
"return" to work - don't set return_value to NULL. */
else if (!gdbarch_return_value_p (current_gdbarch)
&& (TYPE_CODE (return_type) == TYPE_CODE_STRUCT
|| TYPE_CODE (return_type) == TYPE_CODE_UNION))
{
/* NOTE: cagney/2003-10-20: Compatibility hack for legacy
code. Old architectures don't expect STORE_RETURN_VALUE
to be called with with a small struct that needs to be
stored in registers. Don't start doing it now. */
query_prefix = "\
A structure or union return type is not supported by this architecture.\n\
If you continue, the return value that you specified will be ignored.\n";
return_value = NULL;
}
else if (using_struct_return (return_type, 0))
{
query_prefix = "\
The location at which to store the function's return value is unknown.\n\
If you continue, the return value that you specified will be ignored.\n";
return_value = NULL;
}
}
/* Does an interactive user really want to do this? Include
information, such as how well GDB can handle the return value, in
the query message. */
if (from_tty)
{
int confirmed;
if (thisfun == NULL)
2005-02-11 Andrew Cagney <cagney@gnu.org> Mark up error_no_arg, query, perror_with_name, complaint, and internal_error. * breakpoint.c, cp-abi.c, cp-namespace.c, cp-support.c: Update. * cris-tdep.c, dbxread.c, dictionary.c, dsrec.c: Update. * dummy-frame.c, dve3900-rom.c, dwarf2-frame.c, dwarf2expr.c: Update. * dwarf2read.c, dwarfread.c, elfread.c, event-loop.c: Update. * exceptions.c, exec.c, f-lang.c, findvar.c, fork-child.c: Update. * frame-unwind.c, frame.c, frv-linux-tdep.c, frv-tdep.c: Update. * gdb_assert.h, gdbarch.c, gdbtypes.c, gnu-nat.c: Update. * go32-nat.c, hppa-tdep.c, hppabsd-nat.c, hpread.c: Update. * i386-linux-nat.c, i386-nat.c, i386-tdep.c, i386bsd-nat.c: Update. * i386fbsd-nat.c, inf-ptrace.c, inf-ttrace.c, infcall.c: Update. * infcmd.c, inflow.c, infptrace.c, infrun.c, inftarg.c: Update. * interps.c, language.c, linespec.c, linux-nat.c: Update. * m32r-linux-nat.c, m68k-tdep.c, m68kbsd-nat.c: Update. * m68klinux-nat.c, m88kbsd-nat.c, macroexp.c, macroscope.c: Update. * macrotab.c, maint.c, mdebugread.c, memattr.c: Update. * mips-linux-tdep.c, mips-tdep.c, mips64obsd-nat.c: Update. * mipsnbsd-nat.c, mn10300-tdep.c, monitor.c, nto-procfs.c: Update. * objc-lang.c, objfiles.c, objfiles.h, ocd.c, osabi.c: Update. * parse.c, ppc-bdm.c, ppc-linux-nat.c, ppc-sysv-tdep.c: Update. * ppcnbsd-nat.c, ppcobsd-nat.c, printcmd.c, procfs.c: Update. * regcache.c, reggroups.c, remote-e7000.c, remote-mips.c: Update. * remote-rdp.c, remote-sds.c, remote-sim.c, remote-st.c: Update. * remote-utils.c, remote.c, rs6000-nat.c, rs6000-tdep.c: Update. * s390-nat.c, s390-tdep.c, sentinel-frame.c, serial.c: Update. * sh-tdep.c, sh3-rom.c, sh64-tdep.c, shnbsd-nat.c: Update. * solib-aix5.c, solib-svr4.c, solib.c, source.c: Update. * sparc-nat.c, stabsread.c, stack.c, symfile.c, symtab.c: Update. * symtab.h, target.c, tracepoint.c, ui-file.c, ui-out.c: Update. * utils.c, valops.c, valprint.c, vax-nat.c, vaxbsd-nat.c: Update. * win32-nat.c, xcoffread.c, xstormy16-tdep.c: Update. * cli/cli-cmds.c, cli/cli-logging.c, cli/cli-script.c: Update. * cli/cli-setshow.c, mi/mi-cmd-break.c, mi/mi-cmds.c: Update. * mi/mi-console.c, mi/mi-getopt.c, mi/mi-out.c: Update. * tui/tui-file.c, tui/tui-interp.c: Update.
2005-02-11 19:13:55 +01:00
confirmed = query (_("%sMake selected stack frame return now? "),
query_prefix);
else
2005-02-11 Andrew Cagney <cagney@gnu.org> Mark up error_no_arg, query, perror_with_name, complaint, and internal_error. * breakpoint.c, cp-abi.c, cp-namespace.c, cp-support.c: Update. * cris-tdep.c, dbxread.c, dictionary.c, dsrec.c: Update. * dummy-frame.c, dve3900-rom.c, dwarf2-frame.c, dwarf2expr.c: Update. * dwarf2read.c, dwarfread.c, elfread.c, event-loop.c: Update. * exceptions.c, exec.c, f-lang.c, findvar.c, fork-child.c: Update. * frame-unwind.c, frame.c, frv-linux-tdep.c, frv-tdep.c: Update. * gdb_assert.h, gdbarch.c, gdbtypes.c, gnu-nat.c: Update. * go32-nat.c, hppa-tdep.c, hppabsd-nat.c, hpread.c: Update. * i386-linux-nat.c, i386-nat.c, i386-tdep.c, i386bsd-nat.c: Update. * i386fbsd-nat.c, inf-ptrace.c, inf-ttrace.c, infcall.c: Update. * infcmd.c, inflow.c, infptrace.c, infrun.c, inftarg.c: Update. * interps.c, language.c, linespec.c, linux-nat.c: Update. * m32r-linux-nat.c, m68k-tdep.c, m68kbsd-nat.c: Update. * m68klinux-nat.c, m88kbsd-nat.c, macroexp.c, macroscope.c: Update. * macrotab.c, maint.c, mdebugread.c, memattr.c: Update. * mips-linux-tdep.c, mips-tdep.c, mips64obsd-nat.c: Update. * mipsnbsd-nat.c, mn10300-tdep.c, monitor.c, nto-procfs.c: Update. * objc-lang.c, objfiles.c, objfiles.h, ocd.c, osabi.c: Update. * parse.c, ppc-bdm.c, ppc-linux-nat.c, ppc-sysv-tdep.c: Update. * ppcnbsd-nat.c, ppcobsd-nat.c, printcmd.c, procfs.c: Update. * regcache.c, reggroups.c, remote-e7000.c, remote-mips.c: Update. * remote-rdp.c, remote-sds.c, remote-sim.c, remote-st.c: Update. * remote-utils.c, remote.c, rs6000-nat.c, rs6000-tdep.c: Update. * s390-nat.c, s390-tdep.c, sentinel-frame.c, serial.c: Update. * sh-tdep.c, sh3-rom.c, sh64-tdep.c, shnbsd-nat.c: Update. * solib-aix5.c, solib-svr4.c, solib.c, source.c: Update. * sparc-nat.c, stabsread.c, stack.c, symfile.c, symtab.c: Update. * symtab.h, target.c, tracepoint.c, ui-file.c, ui-out.c: Update. * utils.c, valops.c, valprint.c, vax-nat.c, vaxbsd-nat.c: Update. * win32-nat.c, xcoffread.c, xstormy16-tdep.c: Update. * cli/cli-cmds.c, cli/cli-logging.c, cli/cli-script.c: Update. * cli/cli-setshow.c, mi/mi-cmd-break.c, mi/mi-cmds.c: Update. * mi/mi-console.c, mi/mi-getopt.c, mi/mi-out.c: Update. * tui/tui-file.c, tui/tui-interp.c: Update.
2005-02-11 19:13:55 +01:00
confirmed = query (_("%sMake %s return now? "), query_prefix,
SYMBOL_PRINT_NAME (thisfun));
if (!confirmed)
2005-02-10 Andrew Cagney <cagney@gnu.org> Mark up all error and warning messages. * ada-lang.c, amd64-tdep.c, arch-utils.c, breakpoint.c: Update. * bsd-kvm.c, bsd-uthread.c, coff-solib.h, coffread.c: Update. * core-aout.c, core-regset.c, corefile.c, corelow.c: Update. * cp-abi.c, cp-support.c, cp-valprint.c, cris-tdep.c: Update. * dbxread.c, demangle.c, doublest.c, dsrec.c: Update. * dve3900-rom.c, dwarf2expr.c, dwarf2loc.c: Update. * dwarf2read.c, dwarfread.c, elfread.c, eval.c: Update. * event-top.c, exec.c, expprint.c, f-lang.c: Update. * f-typeprint.c, f-valprint.c, fbsd-nat.c, findvar.c: Update. * frame.c, frv-linux-tdep.c, gcore.c, gdbtypes.c: Update. * gnu-nat.c, gnu-v2-abi.c, gnu-v3-abi.c, go32-nat.c: Update. * hpacc-abi.c, hppa-hpux-nat.c, hppa-hpux-tdep.c: Update. * hppa-linux-nat.c, hppa-linux-tdep.c, hppa-tdep.c: Update. * hpread.c, hpux-thread.c, i386-linux-nat.c: Update. * i386-linux-tdep.c, i386-tdep.c, i386bsd-nat.c: Update. * i386gnu-nat.c, i387-tdep.c, ia64-linux-nat.c: Update. * ia64-tdep.c, inf-child.c, inf-ptrace.c, inf-ttrace.c: Update. * infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update. * inftarg.c, interps.c, irix5-nat.c, jv-lang.c: Update. * kod-cisco.c, kod.c, language.c, libunwind-frame.c: Update. * linespec.c, linux-nat.c, linux-thread-db.c, m2-lang.c: Update. * m32r-rom.c, m68hc11-tdep.c, m68k-tdep.c: Update. * m68klinux-nat.c, macrocmd.c, macroexp.c, main.c: Update. * maint.c, mdebugread.c, mem-break.c, memattr.c: Update. * mips-linux-tdep.c, mips-tdep.c, mipsread.c, monitor.c: Update. * nlmread.c, nto-procfs.c, objc-lang.c, objfiles.c: Update. * observer.c, ocd.c, p-lang.c, p-typeprint.c: Update. * p-valprint.c, pa64solib.c, parse.c, ppc-linux-tdep.c: Update. * ppcnbsd-tdep.c, printcmd.c, procfs.c, remote-e7000.c: Update. * remote-fileio.c, remote-m32r-sdi.c, remote-rdi.c: Update. * remote-rdp.c, remote-sim.c, remote-st.c: Update. * remote-utils.c, remote-utils.h, remote.c: Update. * rom68k-rom.c, rs6000-nat.c, s390-tdep.c, scm-lang.c: Update. * ser-e7kpc.c, ser-tcp.c, ser-unix.c, sh-tdep.c: Update. * sh3-rom.c, shnbsd-tdep.c, sol-thread.c, solib-aix5.c: Update. * solib-frv.c, solib-irix.c, solib-osf.c, solib-pa64.c: Update. * solib-som.c, solib-sunos.c, solib-svr4.c, solib.c: Update. * somread.c, somsolib.c, source.c, stabsread.c: Update. * stack.c, std-regs.c, symfile-mem.c, symfile.c: Update. * symmisc.c, symtab.c, target.c, thread.c, top.c: Update. * tracepoint.c, trad-frame.c, typeprint.c, utils.c: Update. * uw-thread.c, valarith.c, valops.c, valprint.c: Update. * value.c, varobj.c, version.in, win32-nat.c, wince.c: Update. * xcoffread.c, xcoffsolib.c, cli/cli-cmds.c: Update. * cli/cli-decode.c, cli/cli-dump.c, cli/cli-logging.c: Update. * cli/cli-script.c, cli/cli-setshow.c, mi/mi-cmd-break.c: Update. * mi/mi-cmd-disas.c, mi/mi-cmd-env.c, mi/mi-cmd-file.c: Update. * mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-getopt.c: Update. * mi/mi-symbol-cmds.c, tui/tui-layout.c, tui/tui-stack.c: Update. * tui/tui-win.c: Update.
2005-02-11 05:06:14 +01:00
error (_("Not confirmed"));
}
/* NOTE: cagney/2003-01-18: Is this silly? Rather than pop each
frame in turn, should this code just go straight to the relevant
frame and pop that? */
/* First discard all frames inner-to the selected frame (making the
selected frame current). */
{
struct frame_id selected_id = get_frame_id (get_selected_frame (NULL));
while (!frame_id_eq (selected_id, get_frame_id (get_current_frame ())))
{
if (frame_id_inner (selected_id, get_frame_id (get_current_frame ())))
/* Caught in the safety net, oops! We've gone way past the
selected frame. */
2005-02-10 Andrew Cagney <cagney@gnu.org> Mark up all error and warning messages. * ada-lang.c, amd64-tdep.c, arch-utils.c, breakpoint.c: Update. * bsd-kvm.c, bsd-uthread.c, coff-solib.h, coffread.c: Update. * core-aout.c, core-regset.c, corefile.c, corelow.c: Update. * cp-abi.c, cp-support.c, cp-valprint.c, cris-tdep.c: Update. * dbxread.c, demangle.c, doublest.c, dsrec.c: Update. * dve3900-rom.c, dwarf2expr.c, dwarf2loc.c: Update. * dwarf2read.c, dwarfread.c, elfread.c, eval.c: Update. * event-top.c, exec.c, expprint.c, f-lang.c: Update. * f-typeprint.c, f-valprint.c, fbsd-nat.c, findvar.c: Update. * frame.c, frv-linux-tdep.c, gcore.c, gdbtypes.c: Update. * gnu-nat.c, gnu-v2-abi.c, gnu-v3-abi.c, go32-nat.c: Update. * hpacc-abi.c, hppa-hpux-nat.c, hppa-hpux-tdep.c: Update. * hppa-linux-nat.c, hppa-linux-tdep.c, hppa-tdep.c: Update. * hpread.c, hpux-thread.c, i386-linux-nat.c: Update. * i386-linux-tdep.c, i386-tdep.c, i386bsd-nat.c: Update. * i386gnu-nat.c, i387-tdep.c, ia64-linux-nat.c: Update. * ia64-tdep.c, inf-child.c, inf-ptrace.c, inf-ttrace.c: Update. * infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update. * inftarg.c, interps.c, irix5-nat.c, jv-lang.c: Update. * kod-cisco.c, kod.c, language.c, libunwind-frame.c: Update. * linespec.c, linux-nat.c, linux-thread-db.c, m2-lang.c: Update. * m32r-rom.c, m68hc11-tdep.c, m68k-tdep.c: Update. * m68klinux-nat.c, macrocmd.c, macroexp.c, main.c: Update. * maint.c, mdebugread.c, mem-break.c, memattr.c: Update. * mips-linux-tdep.c, mips-tdep.c, mipsread.c, monitor.c: Update. * nlmread.c, nto-procfs.c, objc-lang.c, objfiles.c: Update. * observer.c, ocd.c, p-lang.c, p-typeprint.c: Update. * p-valprint.c, pa64solib.c, parse.c, ppc-linux-tdep.c: Update. * ppcnbsd-tdep.c, printcmd.c, procfs.c, remote-e7000.c: Update. * remote-fileio.c, remote-m32r-sdi.c, remote-rdi.c: Update. * remote-rdp.c, remote-sim.c, remote-st.c: Update. * remote-utils.c, remote-utils.h, remote.c: Update. * rom68k-rom.c, rs6000-nat.c, s390-tdep.c, scm-lang.c: Update. * ser-e7kpc.c, ser-tcp.c, ser-unix.c, sh-tdep.c: Update. * sh3-rom.c, shnbsd-tdep.c, sol-thread.c, solib-aix5.c: Update. * solib-frv.c, solib-irix.c, solib-osf.c, solib-pa64.c: Update. * solib-som.c, solib-sunos.c, solib-svr4.c, solib.c: Update. * somread.c, somsolib.c, source.c, stabsread.c: Update. * stack.c, std-regs.c, symfile-mem.c, symfile.c: Update. * symmisc.c, symtab.c, target.c, thread.c, top.c: Update. * tracepoint.c, trad-frame.c, typeprint.c, utils.c: Update. * uw-thread.c, valarith.c, valops.c, valprint.c: Update. * value.c, varobj.c, version.in, win32-nat.c, wince.c: Update. * xcoffread.c, xcoffsolib.c, cli/cli-cmds.c: Update. * cli/cli-decode.c, cli/cli-dump.c, cli/cli-logging.c: Update. * cli/cli-script.c, cli/cli-setshow.c, mi/mi-cmd-break.c: Update. * mi/mi-cmd-disas.c, mi/mi-cmd-env.c, mi/mi-cmd-file.c: Update. * mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-getopt.c: Update. * mi/mi-symbol-cmds.c, tui/tui-layout.c, tui/tui-stack.c: Update. * tui/tui-win.c: Update.
2005-02-11 05:06:14 +01:00
error (_("Problem while popping stack frames (corrupt stack?)"));
frame_pop (get_current_frame ());
}
}
/* Second discard the selected frame (which is now also the current
frame). */
frame_pop (get_current_frame ());
/* Store RETURN_VALUE in the just-returned register set. */
if (return_value != NULL)
{
struct type *return_type = value_type (return_value);
gdb_assert (gdbarch_return_value (current_gdbarch, return_type,
NULL, NULL, NULL)
== RETURN_VALUE_REGISTER_CONVENTION);
gdbarch_return_value (current_gdbarch, return_type,
current_regcache, NULL /*read*/,
value_contents (return_value) /*write*/);
}
/* If we are at the end of a call dummy now, pop the dummy frame
too. */
if (get_frame_type (get_current_frame ()) == DUMMY_FRAME)
frame_pop (get_current_frame ());
/* If interactive, print the frame that is now current. */
if (from_tty)
frame_command ("0", 1);
else
select_frame_command ("0", 0);
}
/* Sets the scope to input function name, provided that the function
is within the current stack frame */
struct function_bounds
{
CORE_ADDR low, high;
};
static void
2000-07-30 03:48:28 +02:00
func_command (char *arg, int from_tty)
{
struct frame_info *frame;
int found = 0;
struct symtabs_and_lines sals;
int i;
int level = 1;
struct function_bounds *func_bounds = NULL;
if (arg != NULL)
return;
frame = parse_frame_specification ("0");
sals = decode_line_spec (arg, 1);
func_bounds = (struct function_bounds *) xmalloc (
sizeof (struct function_bounds) * sals.nelts);
for (i = 0; (i < sals.nelts && !found); i++)
{
if (sals.sals[i].pc == 0
|| find_pc_partial_function (sals.sals[i].pc, NULL,
&func_bounds[i].low,
&func_bounds[i].high) == 0)
{
func_bounds[i].low = func_bounds[i].high = 0;
}
}
do
{
for (i = 0; (i < sals.nelts && !found); i++)
found = (get_frame_pc (frame) >= func_bounds[i].low
&& get_frame_pc (frame) < func_bounds[i].high);
if (!found)
{
level = 1;
frame = find_relative_frame (frame, &level);
}
}
while (!found && level == 0);
if (func_bounds)
2000-12-15 02:01:51 +01:00
xfree (func_bounds);
if (!found)
printf_filtered (_("'%s' not within current stack frame.\n"), arg);
else if (frame != get_selected_frame (NULL))
select_and_print_frame (frame);
}
/* Gets the language of the current frame. */
enum language
2000-07-30 03:48:28 +02:00
get_frame_language (void)
{
struct frame_info *frame = deprecated_safe_get_selected_frame ();
1999-07-07 22:19:36 +02:00
if (frame)
{
/* We determine the current frame language by looking up its
associated symtab. To retrieve this symtab, we use the frame
PC. However we cannot use the frame PC as is, because it
usually points to the instruction following the "call", which
is sometimes the first instruction of another function. So
we rely on get_frame_address_in_block(), it provides us with
a PC that is guaranteed to be inside the frame's code
block. */
CORE_ADDR pc = get_frame_address_in_block (frame);
struct symtab *s = find_pc_symtab (pc);
if (s)
return s->language;
}
return language_unknown;
}
/* Provide a prototype to silence -Wmissing-prototypes. */
void _initialize_stack (void);
void
2000-07-30 03:48:28 +02:00
_initialize_stack (void)
{
1999-07-07 22:19:36 +02:00
#if 0
backtrace_limit = 30;
#endif
add_com ("return", class_stack, return_command, _("\
Make selected stack frame return to its caller.\n\
Control remains in the debugger, but when you continue\n\
execution will resume in the frame above the one now selected.\n\
If an argument is given, it is an expression for the value to return."));
add_com ("up", class_stack, up_command, _("\
Select and print stack frame that called this one.\n\
An argument says how many frames up to go."));
add_com ("up-silently", class_support, up_silently_command, _("\
Same as the `up' command, but does not print anything.\n\
This is useful in command scripts."));
add_com ("down", class_stack, down_command, _("\
Select and print stack frame called by this one.\n\
An argument says how many frames down to go."));
add_com_alias ("do", "down", class_stack, 1);
add_com_alias ("dow", "down", class_stack, 1);
add_com ("down-silently", class_support, down_silently_command, _("\
Same as the `down' command, but does not print anything.\n\
This is useful in command scripts."));
add_com ("frame", class_stack, frame_command, _("\
Select and print a stack frame.\n\
With no argument, print the selected stack frame. (See also \"info frame\").\n\
An argument specifies the frame to select.\n\
It can be a stack frame number or the address of the frame.\n\
With argument, nothing is printed if input is coming from\n\
a command file or a user-defined command."));
add_com_alias ("f", "frame", class_stack, 1);
if (xdb_commands)
{
1999-07-07 22:19:36 +02:00
add_com ("L", class_stack, current_frame_command,
_("Print the current stack frame.\n"));
add_com_alias ("V", "frame", class_stack, 1);
}
add_com ("select-frame", class_stack, select_frame_command, _("\
Select a stack frame without printing anything.\n\
An argument specifies the frame to select.\n\
It can be a stack frame number or the address of the frame.\n"));
add_com ("backtrace", class_stack, backtrace_command, _("\
Print backtrace of all stack frames, or innermost COUNT frames.\n\
With a negative argument, print outermost -COUNT frames.\n\
Use of the 'full' qualifier also prints the values of the local variables.\n"));
add_com_alias ("bt", "backtrace", class_stack, 0);
if (xdb_commands)
{
add_com_alias ("t", "backtrace", class_stack, 0);
add_com ("T", class_stack, backtrace_full_command, _("\
Print backtrace of all stack frames, or innermost COUNT frames \n\
and the values of the local variables.\n\
With a negative argument, print outermost -COUNT frames.\n\
Usage: T <count>\n"));
}
add_com_alias ("where", "backtrace", class_alias, 0);
add_info ("stack", backtrace_command,
_("Backtrace of the stack, or innermost COUNT frames."));
add_info_alias ("s", "stack", 1);
add_info ("frame", frame_info,
_("All about selected stack frame, or frame at ADDR."));
add_info_alias ("f", "frame", 1);
add_info ("locals", locals_info,
_("Local variables of current stack frame."));
add_info ("args", args_info,
_("Argument variables of current stack frame."));
if (xdb_commands)
1999-07-07 22:19:36 +02:00
add_com ("l", class_info, args_plus_locals_info,
_("Argument and local variables of current stack frame."));
if (dbx_commands)
add_com ("func", class_stack, func_command, _("\
Select the stack frame that contains <func>.\n\
Usage: func <name>\n"));
add_info ("catch", catch_info,
_("Exceptions that can be caught in the current stack frame."));
#if 0
add_cmd ("backtrace-limit", class_stack, set_backtrace_limit_command, _(\
"Specify maximum number of frames for \"backtrace\" to print by default."),
&setlist);
add_info ("backtrace-limit", backtrace_limit_info, _("\
The maximum number of frames for \"backtrace\" to print by default."));
#endif
}