aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog2122
-rw-r--r--gdb/MAINTAINERS19
-rw-r--r--gdb/Makefile.in110
-rw-r--r--gdb/NEWS9
-rw-r--r--gdb/ada-lang.c2
-rw-r--r--gdb/ada-lang.h2
-rw-r--r--gdb/alpha-osf1-tdep.c1
-rw-r--r--gdb/alpha-tdep.c48
-rw-r--r--gdb/arch-utils.c6
-rw-r--r--gdb/arch-utils.h6
-rw-r--r--gdb/arm-linux-tdep.c10
-rw-r--r--gdb/arm-tdep.c697
-rw-r--r--gdb/arm-tdep.h18
-rw-r--r--gdb/armnbsd-tdep.c2
-rw-r--r--gdb/avr-tdep.c25
-rw-r--r--gdb/ax-gdb.h3
-rw-r--r--gdb/block.c57
-rw-r--r--gdb/block.h6
-rw-r--r--gdb/blockframe.c40
-rw-r--r--gdb/breakpoint.c322
-rw-r--r--gdb/buildsym.c157
-rw-r--r--gdb/buildsym.h18
-rw-r--r--gdb/builtin-regs.h2
-rw-r--r--gdb/c-lang.c7
-rw-r--r--gdb/c-lang.h2
-rw-r--r--gdb/cli-out.c41
-rw-r--r--gdb/cli-out.h2
-rw-r--r--gdb/cli/cli-cmds.c5
-rw-r--r--gdb/cli/cli-cmds.h4
-rw-r--r--gdb/cli/cli-script.h4
-rw-r--r--gdb/cli/cli-setshow.h2
-rw-r--r--gdb/config/i386/cygwin.mt2
-rw-r--r--gdb/config/i386/nm-ptx4.h132
-rw-r--r--gdb/config/i386/nm-symmetry.h100
-rw-r--r--gdb/config/i386/ptx.mh14
-rw-r--r--gdb/config/i386/ptx.mt6
-rw-r--r--gdb/config/i386/ptx4.mh16
-rw-r--r--gdb/config/i386/ptx4.mt6
-rw-r--r--gdb/config/i386/symmetry.mh8
-rw-r--r--gdb/config/i386/symmetry.mt6
-rw-r--r--gdb/config/i386/tm-ptx.h394
-rw-r--r--gdb/config/i386/tm-ptx4.h52
-rw-r--r--gdb/config/i386/tm-symmetry.h582
-rw-r--r--gdb/config/i386/xm-ptx.h76
-rw-r--r--gdb/config/i386/xm-ptx4.h54
-rw-r--r--gdb/config/i386/xm-symmetry.h56
-rw-r--r--gdb/config/m68k/tm-delta68.h6
-rw-r--r--gdb/config/m68k/tm-linux.h4
-rw-r--r--gdb/config/m68k/tm-os68k.h4
-rw-r--r--gdb/config/m68k/tm-sun3.h23
-rw-r--r--gdb/config/m68k/tm-vx68.h4
-rw-r--r--gdb/config/mips/mipsm3.mh12
-rw-r--r--gdb/config/mips/mipsm3.mt8
-rw-r--r--gdb/config/mips/tm-irix3.h10
-rw-r--r--gdb/config/mips/tm-irix6.h10
-rw-r--r--gdb/config/mips/tm-mips.h10
-rw-r--r--gdb/config/mips/tm-mipsm3.h134
-rw-r--r--gdb/config/mips/tm-tx39.h6
-rw-r--r--gdb/config/mips/tm-tx39l.h6
-rw-r--r--gdb/config/mips/xm-mipsm3.h58
-rw-r--r--gdb/config/nm-linux.h2
-rw-r--r--gdb/config/nm-lynx.h2
-rw-r--r--gdb/config/nm-m3.h252
-rw-r--r--gdb/config/pa/hppabsd.mh8
-rw-r--r--gdb/config/pa/hppabsd.mt6
-rw-r--r--gdb/config/pa/hppaosf.mh10
-rw-r--r--gdb/config/pa/hppaosf.mt6
-rw-r--r--gdb/config/pa/hppapro.mt6
-rw-r--r--gdb/config/pa/nm-hppab.h246
-rw-r--r--gdb/config/pa/nm-hppah.h7
-rw-r--r--gdb/config/pa/nm-hppao.h86
-rw-r--r--gdb/config/pa/tm-hppa.h46
-rw-r--r--gdb/config/pa/tm-hppa64.h15
-rw-r--r--gdb/config/pa/tm-hppab.h94
-rw-r--r--gdb/config/pa/tm-hppah.h5
-rw-r--r--gdb/config/pa/tm-hppao.h196
-rw-r--r--gdb/config/pa/tm-pro.h28
-rw-r--r--gdb/config/pa/xm-hppab.h48
-rw-r--r--gdb/config/pa/xm-hppah.h2
-rw-r--r--gdb/config/pa/xm-pa.h10
-rw-r--r--gdb/config/rs6000/tm-rs6000.h6
-rw-r--r--gdb/config/sparc/sparclet.mt6
-rw-r--r--gdb/config/sparc/sparclite.mt10
-rw-r--r--gdb/config/sparc/tm-sp64.h28
-rw-r--r--gdb/config/sparc/tm-sparc.h86
-rw-r--r--gdb/config/sparc/tm-sparclet.h316
-rw-r--r--gdb/config/sparc/tm-sparclite.h246
-rw-r--r--gdb/configure.host12
-rw-r--r--gdb/configure.tgt20
-rw-r--r--gdb/cp-abi.h2
-rw-r--r--gdb/cp-namespace.c6
-rw-r--r--gdb/cp-support.c144
-rw-r--r--gdb/cp-support.h39
-rw-r--r--gdb/cp-valprint.c2
-rw-r--r--gdb/cris-tdep.c44
-rw-r--r--gdb/d10v-tdep.c426
-rw-r--r--gdb/defs.h2
-rw-r--r--gdb/disasm.c15
-rw-r--r--gdb/disasm.h2
-rw-r--r--gdb/doc/ChangeLog117
-rw-r--r--gdb/doc/Makefile.in5
-rw-r--r--gdb/doc/gdb.texinfo5814
-rw-r--r--gdb/doc/gdbint.texinfo171
-rw-r--r--gdb/doublest.c43
-rw-r--r--gdb/doublest.h23
-rw-r--r--gdb/dummy-frame.c171
-rw-r--r--gdb/dummy-frame.h6
-rw-r--r--gdb/dwarf2cfi.c2
-rw-r--r--gdb/dwarf2cfi.h2
-rw-r--r--gdb/dwarf2expr.c71
-rw-r--r--gdb/dwarf2expr.h17
-rw-r--r--gdb/dwarf2loc.c288
-rw-r--r--gdb/dwarf2loc.h29
-rw-r--r--gdb/dwarf2read.c160
-rw-r--r--gdb/eval.c2
-rw-r--r--gdb/event-top.h2
-rw-r--r--gdb/expression.h2
-rw-r--r--gdb/f-lang.c2
-rw-r--r--gdb/findvar.c26
-rw-r--r--gdb/fork-child.c5
-rw-r--r--gdb/frame-unwind.c9
-rw-r--r--gdb/frame-unwind.h139
-rw-r--r--gdb/frame.c1375
-rw-r--r--gdb/frame.h293
-rw-r--r--gdb/frv-tdep.c29
-rw-r--r--gdb/gdb.h2
-rwxr-xr-xgdb/gdb_indent.sh4
-rw-r--r--gdb/gdbarch.c978
-rw-r--r--gdb/gdbarch.h590
-rwxr-xr-xgdb/gdbarch.sh78
-rw-r--r--gdb/gdbcmd.h4
-rw-r--r--gdb/gdbcore.h2
-rw-r--r--gdb/gdbserver/ChangeLog11
-rw-r--r--gdb/gdbserver/config.in3
-rwxr-xr-xgdb/gdbserver/configure2
-rw-r--r--gdb/gdbserver/configure.in3
-rw-r--r--gdb/gdbserver/linux-low.c8
-rw-r--r--gdb/gdbthread.h7
-rw-r--r--gdb/gdbtypes.h3
-rw-r--r--gdb/h8300-tdep.c27
-rw-r--r--gdb/hppa-hpux-tdep.c18
-rw-r--r--gdb/hppa-tdep.c421
-rw-r--r--gdb/hppah-nat.c8
-rw-r--r--gdb/hpread.c19
-rw-r--r--gdb/i386-interix-tdep.c16
-rw-r--r--gdb/i386-linux-nat.c25
-rw-r--r--gdb/i386-linux-tdep.c2
-rw-r--r--gdb/i386-tdep.c50
-rw-r--r--gdb/i386-tdep.h4
-rw-r--r--gdb/i386ly-tdep.c2
-rw-r--r--gdb/i387-tdep.c21
-rw-r--r--gdb/i387-tdep.h4
-rw-r--r--gdb/ia64-tdep.c46
-rw-r--r--gdb/infcmd.c79
-rw-r--r--gdb/inferior.h82
-rw-r--r--gdb/infrun.c203
-rw-r--r--gdb/infttrace.c10
-rw-r--r--gdb/jv-lang.c11
-rw-r--r--gdb/language.c59
-rw-r--r--gdb/language.h19
-rw-r--r--gdb/lin-lwp.c231
-rw-r--r--gdb/linespec.h2
-rw-r--r--gdb/linux-proc.c205
-rw-r--r--gdb/m2-lang.c2
-rw-r--r--gdb/m3-nat.c9132
-rw-r--r--gdb/m68hc11-tdep.c32
-rw-r--r--gdb/m68k-tdep.c35
-rw-r--r--gdb/main.c10
-rw-r--r--gdb/maint.c43
-rw-r--r--gdb/mcore-tdep.c31
-rw-r--r--gdb/mdebugread.c10
-rw-r--r--gdb/mi/ChangeLog24
-rw-r--r--gdb/mi/gdbmi.texinfo3902
-rw-r--r--gdb/mi/mi-cmds.c1
-rw-r--r--gdb/mi/mi-cmds.h1
-rw-r--r--gdb/mi/mi-getopt.c16
-rw-r--r--gdb/mi/mi-getopt.h20
-rw-r--r--gdb/mi/mi-main.c9
-rw-r--r--gdb/mi/mi-out.c43
-rw-r--r--gdb/minsyms.c8
-rw-r--r--gdb/mips-tdep.c522
-rw-r--r--gdb/mips-tdep.h2
-rw-r--r--gdb/mipsm3-nat.c772
-rw-r--r--gdb/mn10300-tdep.c31
-rw-r--r--gdb/monitor.h1
-rw-r--r--gdb/ns32k-tdep.c21
-rw-r--r--gdb/ns32knbsd-nat.c4
-rw-r--r--gdb/objc-exp.y5
-rw-r--r--gdb/objc-lang.c92
-rw-r--r--gdb/objc-lang.h14
-rw-r--r--gdb/objfiles.h22
-rw-r--r--gdb/observer.c30
-rw-r--r--gdb/ocd.h3
-rw-r--r--gdb/osabi.c2
-rw-r--r--gdb/p-lang.c2
-rw-r--r--gdb/ppc-linux-tdep.c44
-rw-r--r--gdb/ppc-sysv-tdep.c102
-rw-r--r--gdb/ppc-tdep.h6
-rw-r--r--gdb/printcmd.c19
-rw-r--r--gdb/regcache.c116
-rw-r--r--gdb/regcache.h26
-rw-r--r--gdb/reggroups.c4
-rw-r--r--gdb/remote-utils.h2
-rw-r--r--gdb/remote-vx.c6
-rw-r--r--gdb/remote-vxsparc.c7
-rw-r--r--gdb/remote.h3
-rw-r--r--gdb/rs6000-tdep.c83
-rw-r--r--gdb/s390-nat.c1
-rw-r--r--gdb/s390-tdep.c36
-rw-r--r--gdb/scm-lang.c2
-rw-r--r--gdb/sentinel-frame.c55
-rw-r--r--gdb/ser-unix.h3
-rw-r--r--gdb/serial.h2
-rw-r--r--gdb/sh-tdep.c58
-rw-r--r--gdb/signals/signals.c81
-rw-r--r--gdb/solib-irix.c6
-rw-r--r--gdb/solib-osf.c6
-rw-r--r--gdb/solib-sunos.c4
-rw-r--r--gdb/solib-svr4.c31
-rw-r--r--gdb/solib-svr4.h2
-rw-r--r--gdb/somread.c4
-rw-r--r--gdb/somsolib.c1
-rw-r--r--gdb/somsolib.h12
-rw-r--r--gdb/source.h2
-rw-r--r--gdb/sparc-tdep.c521
-rw-r--r--gdb/sparcl-stub.c1892
-rw-r--r--gdb/sparcl-tdep.c1738
-rw-r--r--gdb/sparclet-rom.c632
-rw-r--r--gdb/sparclet-stub.c2334
-rw-r--r--gdb/srec.h2
-rw-r--r--gdb/stabsread.h2
-rw-r--r--gdb/stack.c26
-rw-r--r--gdb/symfile.c2
-rw-r--r--gdb/symfile.h2
-rw-r--r--gdb/symm-nat.c1804
-rw-r--r--gdb/symm-tdep.c204
-rw-r--r--gdb/symmisc.c140
-rw-r--r--gdb/symtab.c100
-rw-r--r--gdb/symtab.h14
-rw-r--r--gdb/target.h4
-rw-r--r--gdb/testsuite/ChangeLog149
-rw-r--r--gdb/testsuite/gdb.asm/asm-source.exp11
-rw-r--r--gdb/testsuite/gdb.base/args.exp6
-rw-r--r--gdb/testsuite/gdb.base/attach.exp2
-rw-r--r--gdb/testsuite/gdb.base/break.exp4
-rw-r--r--gdb/testsuite/gdb.base/call-rt-st.exp18
-rw-r--r--gdb/testsuite/gdb.base/callfuncs.exp6
-rw-r--r--gdb/testsuite/gdb.base/completion.exp9
-rw-r--r--gdb/testsuite/gdb.base/default.exp6
-rw-r--r--gdb/testsuite/gdb.base/ending-run.exp8
-rw-r--r--gdb/testsuite/gdb.base/help.exp2
-rw-r--r--gdb/testsuite/gdb.base/list.exp5
-rw-r--r--gdb/testsuite/gdb.base/pointers.exp39
-rw-r--r--gdb/testsuite/gdb.base/ptype.c3
-rw-r--r--gdb/testsuite/gdb.base/ptype.exp4
-rw-r--r--gdb/testsuite/gdb.base/sizeof.c1
-rw-r--r--gdb/testsuite/gdb.base/sizeof.exp2
-rw-r--r--gdb/testsuite/gdb.base/watchpoint.c15
-rw-r--r--gdb/testsuite/gdb.base/watchpoint.exp32
-rw-r--r--gdb/testsuite/gdb.c++/casts.exp7
-rw-r--r--gdb/testsuite/gdb.c++/derivation.cc4
-rw-r--r--gdb/testsuite/gdb.c++/derivation.exp18
-rw-r--r--gdb/testsuite/gdb.c++/overload.cc6
-rw-r--r--gdb/testsuite/gdb.c++/overload.exp18
-rw-r--r--gdb/testsuite/gdb.c++/userdef.cc4
-rw-r--r--gdb/testsuite/gdb.c++/userdef.exp17
-rw-r--r--gdb/testsuite/gdb.mi/ChangeLog4
-rw-r--r--gdb/testsuite/gdb.mi/gdb792.exp2
-rw-r--r--gdb/testsuite/gdb.threads/pthreads.exp4
-rw-r--r--gdb/testsuite/gdb.threads/schedlock.c9
-rw-r--r--gdb/testsuite/lib/gdb.exp12
-rw-r--r--gdb/testsuite/lib/mi-support.exp8
-rw-r--r--gdb/thread.c68
-rw-r--r--gdb/tui/ChangeLog14
-rw-r--r--gdb/tui/tui-out.c40
-rw-r--r--gdb/tui/tuiRegs.c8
-rw-r--r--gdb/typeprint.h2
-rw-r--r--gdb/utils.c78
-rw-r--r--gdb/v850-tdep.c31
-rw-r--r--gdb/valarith.c1
-rw-r--r--gdb/valops.c129
-rw-r--r--gdb/valprint.c4
-rw-r--r--gdb/valprint.h6
-rw-r--r--gdb/value.h14
-rw-r--r--gdb/vax-tdep.c25
-rw-r--r--gdb/version.in2
-rw-r--r--gdb/x86-64-tdep.c129
-rw-r--r--gdb/x86-64-tdep.h8
-rw-r--r--gdb/xmodem.h2
-rw-r--r--gdb/xstormy16-tdep.c61
290 files changed, 25805 insertions, 20332 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 605f7be..b9aeef5e 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,2123 @@
+2003-04-16 David Carlton <carlton@bactrian.org>
+
+ * Merge with mainline; tag is carlton_dictionary-20030416-merge.
+
+2003-04-16 Mark Kettenis <kettenis@gnu.org>
+
+ * i386-linux-nat.c: Add some whitespace to make things more
+ readable.
+ (fetch_register, store_register, fetch_inferior_registers,
+ store_inferior_registers): Get rid of assignment in if-statement.
+ (store_register): Fix typo in error message.
+
+2003-04-16 Andrew Cagney <cagney@redhat.com>
+
+ * utils.c (xmmalloc): Always allocate something, matches
+ libiberty/xmalloc's semantics.
+ (xmrealloc, xmcalloc): Ditto.
+
+2003-04-16 Andrew Cagney <cagney@redhat.com>
+
+ * frame.c (get_prev_frame): Do not initialize "unwind" or "type",
+ update comments.
+ (get_frame_type): Initialize unwind and type when needed.
+ (get_frame_id, frame_register_unwind): Ditto.
+
+2003-04-16 Andrew Cagney <cagney@redhat.com>
+
+ * NEWS: Mention that sparclet-*-* and sparclite-*-* have been made
+ obsolete.
+ * sparc-tdep.c: Obsolete SPARCLET and SPARCLITE code.
+ * sparcl-stub.c: Obsolete file.
+ * config/sparc/tm-sparclet.h: Obsolete file.
+ * sparclet-stub.c: Obsolete file.
+ * sparclet-rom.c: Obsolete file.
+ * sparcl-tdep.c: Obsolete file.
+ * config/sparc/tm-sparclite.h: Obsolete file.
+ * config/sparc/sparclite.mt: Obsolete file.
+ * config/sparc/sparclet.mt: Obsolete file.
+ * configure.tgt: Make sparclet-*-*, sparclite-*-*, and
+ sparc86x-*-* obsolete.
+
+2003-04-15 David Carlton <carlton@math.stanford.edu>
+
+ * Makefile.in (SFILES): Add cp-namespace.c.
+ (COMMON_OBS): Add cp-namespace.o.
+ (block.o): Depend on gdb_obstack_h and cp_support_h.
+ (buildsym.o): Depend on cp_support_h.
+ (cp-namespace.o): New.
+ (cp-support.o): Depend on gdb_string_h, demangle_h, gdb_assert_h,
+ gdb_obstack_h, symtab_h, symfile_h, and gdbcmd_h.
+ (dwarf2read.o): Depend on cp_support_h.
+ * jv-lang.c (get_java_class_symtab): Set BLOCK_NAMESPACE.
+ * dwarf2read.c (process_die): Set processing_has_namespace_info,
+ processing_current_namespace.
+ (read_namespace): Update processing_current_namespace; check for
+ anonymous namespaces.
+ (dwarf2_name): New function.
+ (dwarf2_extension): Ditto.
+ * cp-support.h: Update copyright, contributors.
+ Add inclusion guards.
+ Add opaque declaration for structs obstack, block, symbol.
+ (struct using_direct): New struct.
+ Add declarations for cp_find_first_component,
+ cp_entire_prefix_len, processing_has_namespace_info,
+ processing_current_namespace, cp_is_anonymous,
+ cp_add_using_directive, cp_initialize_namespace,
+ cp_finalize_namespace, cp_set_block_scope,
+ cp_scan_for_anonymous_namespaces.
+ * cp-namespace.c: New file.
+ * cp-support.c: Update copyright.
+ Include ctype.h, gdb_assert.h, gdbcmd.h.
+ New variable maint_cplus_cmd_list.
+ (cp_find_first_component): New function.
+ (cp_entire_prefix_len, maint_cplus_command)
+ (first_component_command, _initialize_cp_support): Ditto.
+ * buildsym.c: Include cp-support.h.
+ New variable using_list.
+ (add_symbol_to_list): Check for anonymous namespaces.
+ (finish_block): Set block's scope.
+ (start_symtab): Initialize C++ namespace support.
+ (end_symtab): Finalize C++ namespace support.
+ * block.h: Add opaque declarations for structs
+ block_namespace_info, using_direct, and obstack.
+ Add declarations for block_set_scope and block_set_using.
+ (struct block): Add 'language_specific' member.
+ (BLOCK_NAMESPACE): New macro.
+ * block.c: Include gdb_obstack.h and cp-support.h.
+ (struct block_namespace_info): New struct.
+ (block_set_scope): New function.
+ (block_set_using, block_initialize_namespace): Ditto.
+
+2003-04-14 Kevin Buettner <kevinb@redhat.com>
+
+ * solib-svr4.c (svr4_have_link_map_offsets): New function.
+ (locate_base): Return early if there aren't any link map offsets.
+ (svr4_solib_create_inferior_hook): Warn if shared library support
+ is unavailable.
+
+2003-04-14 David Carlton <carlton@math.stanford.edu>
+
+ * symtab.c (symbol_set_names): Add prefix when storing Java names
+ in hash table. Fix for PR java/1039.
+
+2003-04-14 David Carlton <carlton@math.stanford.edu>
+
+ * symtab.c (symbol_set_names): Rename 'name' arg to
+ 'linkage_name', and 'tmpname' variable to 'linkage_name_copy'.
+ * symtab.h: Change 'name' argument in declaration of
+ symbol_set_names to 'linkage_name'.
+ (SYMBOL_SET_NAMES): Change 'name' argument to 'linkage_name'.
+
+2003-04-14 Andrew Cagney <cagney@redhat.com>
+
+ * mips-tdep.c (mips_read_sp): Do not apply ADDR_BITS_REMOVE,
+ return the fully sign-extended register value.
+ (get_frame_pointer): Ditto.
+ (mips_pop_frame): Initialize "proc_desc" after checking for a
+ dummy frame.
+
+2003-04-14 Andrew Cagney <cagney@redhat.com>
+
+ * mips-tdep.c (mips_push_dummy_frame): Delete function.
+ (MASK, PUSH_FP_REGNUM, GEN_REG_SAVE_MASK): Delete macros.
+ (FLOAT_REG_SAVE_MASK, FLOAT_SINGLE_REG_SAVE_MASK): Delete macro.
+ (mips_push_register): Delete function.
+ (mips_dump_tdep): Delete references to GEN_REG_SAVE_MASK and
+ PUSH_FP_REGNUM.
+
+2003-04-14 Jim Blandy <jimb@redhat.com>
+
+ * symmisc.c: #include "gdb_regex.h".
+ (maintenance_list_symtabs, maintenance_list_psymtabs): New
+ functions.
+ * maint.c (maintenance_list_command): New function.
+ (_initialize_maint_cmds): Register the above as commands.
+ * symtab.h (maintenance_list_symtabs,
+ maintenance_list_psymtabs): New declarations.
+ * cli/cli-cmds.c (maintenancelistlist): New variable.
+ (init_cmd_lists): Initialize it.
+ * cli/cli-cmds.h (maintenancelistlist): New declaration.
+ * gdbcmd.h (maintenancelistlist): New declaration.
+ * Makefile.in (symmisc.o): Update dependencies.
+
+2003-04-14 Elena Zannoni <ezannoni@redhat.com>
+
+ * s390-nat.c: Include asm/types.h for addr_t.
+
+2003-04-14 Corinna Vinschen <vinschen@redhat.com>
+
+ * cp-valprint.c (cp_print_class_method): Call unpack_pointer() with
+ actually incoming type.
+
+2003-04-13 Andrew Cagney <cagney@redhat.com>
+
+ * ppc-linux-tdep.c: Use get_frame_base, get_frame_pc,
+ get_next_frame and get_frame_saved_regs.
+
+2003-04-13 Andrew Cagney <cagney@redhat.com>
+
+ * reggroups.c (default_register_reggroup_p): Use NUM_REGS instead
+ of gdbarch_num_regs.
+
+2003-04-13 Andrew Cagney <cagney@redhat.com>
+
+ * frame.h: Mention what replaced what in "struct frame_info".
+ * hppa-hpux-tdep.c: Use get_frame_base, get_frame_pc and
+ deprecated_update_frame_base_hack and
+ deprecated_update_frame_pc_hack.
+ * hppa-tdep.c: Ditto.
+
+2003-04-13 Daniel Jacobowitz <drow@mvista.com>
+
+ * dwarf2expr.h (struct dwarf_expr_context): Remove extra arguments
+ to read_reg and update its comment. Remove regnum member.
+ * dwarf2expr.c (execute_stack_op): Remove memaddr and expr_lval.
+ Don't call read_reg when setting in_reg. Call read_reg to get
+ the frame base if it's in a register. Return the register number
+ on the stack instead of in the context. Remove extra arguments
+ to read_reg.
+ * dwarf2loc.c (dwarf_expr_read_reg): Remove extra arguments.
+ (dwarf2_evaluate_loc_desc): Call value_from_register. Expect
+ the register number on the expression stack.
+ (needs_frame_read_reg): Remove extra arguments.
+
+2003-04-13 Daniel Jacobowitz <drow@mvista.com>
+
+ * dwarf2expr.c (dwarf2_read_address): Renamed from read_address;
+ made non-static.
+ (execute_stack_op): All callers updated.
+ * dwarf2expr.h: Add prototype for dwarf2_read_address.
+ * dwarf2loc.c (find_location_expression): New function.
+ (dwarf_expr_frame_base): Call it.
+ (dwarf2_evaluate_loc_desc): Handle 0-length location expressions.
+ (dwarf2_tracepoint_var_ref): New function, broken out from
+ locexpr_tracepoint_var_ref.
+ (locexpr_tracepoint_var_ref): Call dwarf2_tracepoint_var_ref.
+ Make static.
+ (loclist_read_variable, loclist_read_needs_frame): New functions.
+ (loclist_describe_location, loclist_tracepoint_var_ref): New
+ functions.
+ (dwarf2_loclist_funcs): New struct location_funcs.
+ * dwarf2loc.h (struct dwarf2_loclist_baton): New type.
+ (struct dwarf2_locexpr_baton): Add comments.
+ (dwarf2_loclist_funcs): New extern.
+ * dwarf2read.c (struct comp_unit_head): Remove DIE member, add
+ base_address and base_known.
+ (dwarf_loc_buffer): New variable.
+ (struct dwarf2_pinfo): Add dwarf_loc_buffer and dwarf_loc_size.
+ (DWARF_LOC_BUFFER, DWARF_LOC_SIZE): New macros.
+ (dwarf2_has_info): Initialize dwarf_loc_offset.
+ (dwarf2_build_psymtabs): Read in .debug_loc.
+ (dwarf2_build_psymtabs_hard): Use DWARF_LOC_BUFFER and
+ DWARF_LOC_SIZE.
+ (psymtab_to_symtab_1): Likewise. Move base address calculation
+ here, from...
+ (dwarf2_get_pc_bounds): ... here. Use the base address from
+ cu_header.
+ (dwarf2_symbol_mark_computed): Handle location lists.
+
+2003-04-13 Daniel Jacobowitz <drow@mvista.com>
+
+ * minsyms.c (install_minimal_symbols): Only switch to gnu-v3 mode
+ if the linkage name demangled successfully.
+
+2003-04-13 Mark Kettenis <kettenis@gnu.org>
+
+ * x86-64-tdep.c (att_flavour, intel_flavour, valid_flavours,
+ disassmbly_flavour): Removed.
+
+ * x86-64-tdep.c (gdb_print_insn_x86_64): Removed.
+
+2003-04-13 Mark Kettenis <kettenis@gnu.org>
+
+ * x86-64-tdep.c (x86_64_breakpoint_from_pc): Removed.
+
+2003-04-12 Andrew Cagney <cagney@redhat.com>
+
+ * frame.h (struct frame_info): Move definition from here ...
+ * frame.c (struct frame_info): ... to here.
+
+2003-04-12 Andrew Cagney <cagney@redhat.com>
+
+ * gdbthread.h (save_infrun_state): Delete parameter
+ "prev_func_start".
+ (struct thread_info): Delete field "prev_func_start".
+ (load_infrun_state): Ditto.
+ * thread.c (load_infrun_state, save_infrun_state): Update.
+ * infrun.c (prev_func_start): Delete variable.
+ (context_switch, init_wait_for_inferior): Update.
+ (stop_stepping, keep_going): Update.
+
+2003-04-12 Andrew Cagney <cagney@redhat.com>
+
+ * gdbarch.sh: Add missing opaque declarations.
+ * gdbarch.h: Regnerate.
+ * symtab.h: Add missing opaque declarations.
+ * value.h, target.h, symfile.h, stabsread.h: Ditto.
+ * x86-64-tdep.h, xmodem.h, monitor.h, typeprint.h: Ditto.
+ * srec.h, solib-svr4.h, source.h, inferior.h: Ditto.
+ * ser-unix.h, serial.h, remote-utils.h, gdbcore.h: Ditto.
+ * ppc-tdep.h, ocd.h, mips-tdep.h, gdbtypes.h: Ditto.
+ * buildsym.h, builtin-regs.h, linespec.h, language.h: Ditto.
+ * i387-tdep.h, gdbthread.h, event-top.h, gdb.h: Ditto.
+ * dwarf2cfi.h, doublest.h, disasm.h, cp-abi.h: Ditto.
+ * cli-out.h, c-lang.h, ax-gdb.h, arch-utils.h: Ditto.
+ * ada-lang.h, config/nm-lynx.h, config/nm-linux.h: Ditto.
+ * config/sparc/tm-sp64.h, config/rs6000/tm-rs6000.h: Ditto.
+ * config/pa/tm-hppah.h, config/m68k/tm-delta68.h: Ditto.
+ * cli/cli-setshow.h, cli/cli-script.h: Ditto.
+
+2003-04-11 Andrew Cagney <cagney@redhat.com>
+
+ * frame.c (get_frame_id): Return this frame's "id".
+ (legacy_get_prev_frame): Set prev's frame ID code_addr to the
+ function start.
+ (legacy_saved_regs_this_id): Replace function body with
+ internal-error.
+ (deprecated_frame_xmalloc): Mark the frame ID as valid, use
+ FRAME_OBSTACK_ZALLOC.
+ (create_new_frame): Mark the frame ID as valid.
+
+2003-04-11 Alexandre Oliva <aoliva@redhat.com>
+
+ * Makefile.in (libbfd_h): Added missing setting.
+ * mips-tdep.c (mips_gdbarch_init): Set disassembler_options
+ according to the selected ABI.
+
+2003-04-11 Jeff Johnston <jjohnstn@redhat.com>
+
+ * gdb_indent.sh: Recognize pid_t and sigset_t as types.
+
+2003-04-11 Andrew Cagney <cagney@redhat.com>
+
+ * gdbarch.sh (DEPRECATED_SAVED_PC_AFTER_CALL): Deprecate
+ SAVED_PC_AFTER_CALL.
+ * gdbarch.h, gdbarch.c: Regenerate.
+ * xstormy16-tdep.c (xstormy16_gdbarch_init): Update.
+ * x86-64-tdep.c (x86_64_init_abi): Update.
+ * vax-tdep.c (vax_gdbarch_init): Update.
+ * v850-tdep.c (v850_gdbarch_init): Update.
+ * sparc-tdep.c (sparc_gdbarch_init): Update.
+ * sh-tdep.c (sh_gdbarch_init): Update.
+ * s390-tdep.c (s390_gdbarch_init): Update.
+ * rs6000-tdep.c (rs6000_gdbarch_init): Update.
+ * ns32k-tdep.c (ns32k_gdbarch_init): Update.
+ * mn10300-tdep.c (mn10300_gdbarch_init): Update.
+ * mips-tdep.c (mips_gdbarch_init): Update.
+ * mcore-tdep.c (mcore_gdbarch_init): Update.
+ * m68k-tdep.c (m68k_gdbarch_init): Update.
+ * m68hc11-tdep.c (m68hc11_gdbarch_init): Update.
+ * ia64-tdep.c (ia64_gdbarch_init): Update.
+ (ia64_saved_pc_after_call): Update declaration.
+ * i386ly-tdep.c (i386lynx_init_abi): Update.
+ * i386-tdep.c (i386_gdbarch_init): Update.
+ * hppa-tdep.c (hppa_gdbarch_init): Update.
+ * h8300-tdep.c (h8300_gdbarch_init): Update.
+ * frv-tdep.c (frv_gdbarch_init): Update.
+ * cris-tdep.c (cris_gdbarch_init): Update.
+ * avr-tdep.c (avr_gdbarch_init): Update.
+ * arm-tdep.c (arm_gdbarch_init): Update.
+ * alpha-tdep.c (alpha_gdbarch_init): Update.
+ * ns32knbsd-nat.c (frame_num_args): Update.
+ * ns32k-tdep.c (umax_frame_num_args): Update.
+ * mips-tdep.c (mips_init_frame_pc_first): Update.
+ * infrun.c (step_over_function): Update.
+ * i386-linux-tdep.c (skip_hurd_resolver): Update.
+ * i386-interix-tdep.c (i386_interix_back_one_frame): Update.
+ * config/sparc/tm-sparc.h (DEPRECATED_SAVED_PC_AFTER_CALL): Update.
+ (DEPRECATED_INIT_FRAME_PC_FIRST): Update.
+ * config/rs6000/tm-rs6000.h (DEPRECATED_INIT_FRAME_PC_FIRST): Update.
+ * config/pa/tm-hppa.h (DEPRECATED_SAVED_PC_AFTER_CALL): Update.
+ * arm-linux-tdep.c (skip_hurd_resolver): Update.
+ * arch-utils.c (init_frame_pc_default): Update.
+ * alpha-tdep.c (alpha_init_frame_pc_first): Update.
+ * x86-64-tdep.h (x86_64_linux_saved_pc_after_call): Update
+ declaration.
+
+2003-04-11 Andrew Cagney <cagney@redhat.com>
+
+ * i387-tdep.c: Update copyright.
+ (i387_to_double): Delete function.
+ (double_to_i387): Delete function.
+
+2003-04-10 Andrew Cagney <cagney@redhat.com>
+
+ * d10v-tdep.c (d10v_frame_this_id): Set the code addr to the
+ frame's function's address. Simplify.
+ (d10v_frame_unwind_cache): Check that the frame's function is
+ non-zero.
+
+2003-04-10 Jim Blandy <jimb@redhat.com>
+
+ * s390-tdep.c (s390_gdbarch_init): Put back accidentally deleted
+ call to set_gdbarch_deprecated_push_arguments.
+
+2003-04-10 Andrew Cagney <cagney@redhat.com>
+
+ * frame.c (fprint_frame_id): New function.
+ (fprint_frame_type, fprint_frame): New function.
+ (frame_pc_unwind, frame_func_unwind): Add/update trace code.
+ (create_sentinel_frame, get_frame_id): Ditto.
+ (frame_id_p, frame_id_eq): Ditto.
+ (frame_id_inner, create_new_frame): Ditto.
+ (legacy_get_prev_frame, get_prev_frame): Ditto.
+ (deprecated_update_frame_pc_hack): Ditto.
+ (frame_register_unwind): Ditto.
+ (deprecated_update_frame_base_hack): Ditto.
+
+2003-04-10 Corinna Vinschen <vinschen@redhat.com>
+
+ * i386-cygwin-tdep.c (i386_cygwin_frame_chain): New function.
+ (i386_cygwin_init_abi): Set i386_cygwin_frame_chain as new
+ frame_chain function.
+ * Makefile.in: Add dependencies due to above change.
+
+2003-04-10 Corinna Vinschen <vinschen@redhat.com>
+
+ * blockframe.c (legacy_frame_chain_valid): Move call to
+ DEPRECATED_FRAME_CHAIN_VALID before calls to inside_entry_func and
+ inside_entry_file.
+
+2003-04-09 Andrew Cagney <cagney@redhat.com>
+
+ * frame.h (struct frame_id): Replace "pc" and "base" with
+ "stack_addr" and "code_addr". Update comments.
+ (frame_id_build): Update parameter names and comment.
+ (struct frame_info): Replace "id_p" and "id" with "this_id".
+ * dummy-frame.c (dummy_frame_this_id): Update.
+ * breakpoint.c (print_one_breakpoint): Update.
+ * frame.c (get_frame_id): Update.
+ (get_frame_base, frame_id_build): Update.
+ (create_sentinel_frame, legacy_get_prev_frame): Update.
+ (deprecated_update_frame_base_hack): Update.
+ (frame_id_p, frame_id_eq): Rework, return 0 when an invalid ID.
+ (frame_id_inner): Ditto.
+
+2003-04-09 Andrew Cagney <cagney@redhat.com>
+
+ * defs.h (gdb_print_host_address): Make "addr" parameter a
+ pointer constant.
+ * utils.c (gdb_print_host_address): Update.
+
+2003-04-09 Kevin Buettner <kevinb@redhat.com>
+
+ * rs6000-tdep.c (frame_get_saved_regs): Don't assume that the
+ register number for R0 is 0.
+
+2003-04-09 J. Brobecker <brobecker@gnat.com>
+
+ * frame.h (struct gdbarch): Add opaque structure definition
+ to avoid a compilation warning on LynxOS 4.0.
+
+2003-04-09 Andrew Cagney <cagney@redhat.com>
+
+ * frame.h (struct frame_info): Delete field "pc". Replace
+ "pc_unwind_cache" and "pc_unwind_cache_p" with "prev_pc"
+ structure.
+ * frame.c (frame_pc_unwind): Update.
+ (create_sentinel_frame): Do not set "pc".
+ (get_prev_frame): Do not set "pc". Use frame_pc_unwind.
+ (get_frame_pc): Call frame_pc_unwind.
+ (deprecated_update_frame_pc_hack): Update.
+ (create_new_frame): Use "pc" not "->pc".
+
+2003-04-09 Andrew Cagney <cagney@redhat.com>
+
+ * frame.c (get_frame_id): Eliminate code updating "frame".
+ (legacy_get_prev_frame): Ditto.
+ (get_frame_base): Return id.base directly.
+ (deprecated_update_frame_base_hack): Update "id.base".
+ * frame.h (struct frame_info): Delete field "frame".
+
+2003-04-09 Andrew Cagney <cagney@redhat.com>
+
+ * NEWS: Mention that the "Sequent family" is obsolete.
+ * configure.tgt: Obsolete i[3456]86-sequent-bsd*,
+ i[3456]86-sequent-sysv4*, and i[3456]86-sequent-sysv*.
+ * configure.host: Obsolete i[3456]86-sequent-bsd*,
+ i[3456]86-sequent-sysv4*, and i[3456]86-sequent-sysv*.
+ * config/i386/tm-ptx4.h: Obsolete file.
+ * config/i386/tm-ptx.h: Obsolete file.
+ * symm-tdep.c: Obsolete file.
+ * config/i386/symmetry.mt: Obsolete file.
+ * config/i386/tm-symmetry.h: Obsolete file.
+ * symm-nat.c: Obsolete file.
+ * config/i386/nm-symmetry.h: Obsolete file.
+ * config/i386/xm-symmetry.h: Obsolete file.
+ * config/i386/symmetry.mh: Obsolete file.
+ * config/i386/nm-ptx4.h: Obsolete file.
+ * config/i386/ptx4.mh: Obsolete file.
+ * config/i386/ptx.mt: Obsolete file.
+ * config/i386/ptx.mh: Obsolete file.
+ * config/i386/xm-ptx4.h: Obsolete file.
+ * config/i386/xm-ptx.h: Obsolete file.
+
+2003-04-09 Andrew Cagney <cagney@redhat.com>
+
+ Obsolete mips*-*-mach3*.
+ * NEWS: Mention that mips*-*-mach3* is obsolete.
+ * m3-nat.c: Obsolete file.
+ * config/nm-m3.h: Obsolete file.
+ * config/mips/tm-mipsm3.h: Obsolete file.
+ * config/mips/mipsm3.mt: Obsolete file.
+ * config/mips/mipsm3.mh: Obsolete file.
+ * config/mips/xm-mipsm3.h: Obsolete file.
+ * mipsm3-nat.c: Obsolete file.
+ * configure.host: Obsolete mips-dec-mach3*.
+ * configure.tgt: Obsolete mips*-*-mach3*.
+
+2003-04-09 Andrew Cagney <cagney@redhat.com>
+
+ * doublest.h: Update copyright.
+ (deprecated_store_floating, deprecated_extract_floating): Rename
+ store_floating and extract_floating. Update comments.
+ * doublest.c: Update copyright.
+ (extract_floating_by_length): Replace extract_floating.
+ (store_floating_by_length): Replace store_floating.
+ (deprecated_extract_floating): New function.
+ (deprecated_store_floating): New function.
+ (extract_typed_floating): Call extract_floating_by_length.
+ (store_typed_floating): Call store_floating_by_length.
+ * x86-64-tdep.c (x86_64_store_return_value): Update.
+ * sh-tdep.c (sh3e_sh4_extract_return_value): Update.
+ (sh64_extract_return_value): Update.
+ (sh_sh4_register_convert_to_virtual): Update.
+ (sh_sh64_register_convert_to_virtual): Update.
+ (sh_sh4_register_convert_to_raw): Update.
+ (sh_sh64_register_convert_to_raw): Update.
+ * rs6000-tdep.c (rs6000_register_convert_to_virtual): Update.
+ (rs6000_register_convert_to_raw): Update.
+ * ia64-tdep.c (ia64_register_convert_to_virtual): Update.
+ (ia64_register_convert_to_raw): Update.
+ * config/i386/tm-symmetry.h (REGISTER_CONVERT_TO_RAW): Update.
+ (REGISTER_CONVERT_TO_VIRTUAL): Update.
+ * arm-linux-tdep.c (arm_linux_push_arguments): Update.
+ * alpha-tdep.c (alpha_register_convert_to_virtual): Update.
+ (alpha_register_convert_to_raw): Update.
+
+2003-04-08 Andrew Cagney <cagney@redhat.com>
+
+ * gdbarch.sh (SAVED_PC_AFTER_CALL): Add a predicate.
+ * gdbarch.h, gdbarch.c: Re-generate.
+ * d10v-tdep.c (d10v_saved_pc_after_call): Delete function.
+ (d10v_gdbarch_init): Do not set saved_pc_after_call.
+ * infrun.c (step_over_function): Call SAVED_PC_AFTER_CALL_P
+ conditionally, use frame_pc_unwind as an alternative. Add
+ comments.
+ * arch-utils.c (init_frame_pc_default): Only call
+ SAVED_PC_AFTER_CALL when available.
+
+2003-04-08 Elena Zannoni <ezannoni@redhat.com>
+
+ * infrun.c (stop_soon): Rename from stop_soon_quietly.
+ (struct inferior_status): Rename stop_soon_quietly field to stop_soon.
+ (clear_proceed_status): Rename stop_soon_quietly to stop_soon.
+ (start_remote): Ditto.
+ (handle_inferior_event): Ditto.
+ (save_inferior_status): Ditto.
+ (restore_inferior_status): Ditto.
+ * infcmd.c (attach_command): Ditto.
+ * fork-child.c (startup_inferior): Ditto.
+ * inferior.h (stop_soon): Rename from stop_soon_quietly.
+ * alpha-tdep.c (heuristic_proc_start): Ditto.
+ * mips-tdep.c (heuristic_proc_start): Ditto.
+ * solib-svr4.c (svr4_solib_create_inferior_hook): Ditto.
+ * solib-sunos.c (sunos_solib_create_inferior_hook): Ditto.
+ * solib-osf.c (osf_solib_create_inferior_hook): Ditto.
+ * solib-irix.c (irix_solib_create_inferior_hook): Ditto.
+ * remote-vx.c (vx_create_inferior): Ditto.
+
+2003-04-08 Elena Zannoni <ezannoni@redhat.com>
+
+ * infrun.c (stop_soon_quietly): Make it an enum, to better
+ override the default behavior of handle_inferior_event.
+ (clear_proceed_status): Update uses of stop_soon_quietly to
+ reflect that it is now an enum.
+ (start_remote): Ditto.
+ (handle_inferior_event): Change logic a bit if stop_soon_quietly
+ is set to handle the new GNU/Linux kernel behavior for
+ attach/sigstop. Update uses of stop_soon_quietly.
+ * inferior.h (enum stop_kind): New enum.
+ * infcmd.c (attach_command): Use STOP_QUIETLY_NO_SIGSTOP.
+ Reset normal handle_inferior_event behavior, afterwards.
+ * fork-child.c (startup_inferior): Update.
+ * alpha-tdep.c (heuristic_proc_start): Update.
+ * solib-svr4.c (svr4_solib_create_inferior_hook): Update.
+ * solib-sunos.c (sunos_solib_create_inferior_hook): Update.
+ * solib-osf.c (osf_solib_create_inferior_hook): Update.
+ * solib-irix.c (irix_solib_create_inferior_hook): Update.
+ * remote-vx.c (vx_create_inferior): Update.
+ * mips-tdep.c (heuristic_proc_start): Update.
+
+2003-04-07 Elena Zannoni <ezannoni@redhat.com>
+
+ * disasm.c (dump_insns): Move variables inside loop, or they will
+ be freed more than once, causing wild memory corruptions.
+ (gdb_disassembly): Look for the substring "-thread",
+ instead of "-threads" in the target name, to make sure to find
+ the 'multi-thread' target. Also, make sure we do the right thing
+ with the "core" target.
+
+2003-04-07 Kevin Buettner <kevinb@redhat.com>
+
+ * mips-tdep.c (mips_print_fp_register): New function, created from
+ do_fp_register_row(). Registers are now (also) printed as hex.
+ Only one register is printed per row.
+ (mips_print_register, do_fp_register_row): Print floating point
+ registers with mips_print_fp_register().
+
+2003-04-06 Andrew Cagney <cagney@redhat.com>
+
+ * valprint.h (inspect_it): Add extern declaration.
+ * objc-lang.c (value_nsstring): Avoid assignment inside of "if".
+ (selectors_info, classes_info): Ditto.
+ (find_objc_msgcall): Fix indentation.
+ (objc_printstr): Delete extern declarations.
+
+ * arm-tdep.c (arm_frameless_function_invocation): Fix typo.
+
+2003-04-06 Andrew Cagney <cagney@redhat.com>
+
+ * frame.h (legacy_frame_chain_valid): Rename frame_chain_valid.
+ Update comment.
+ * frame.c (legacy_saved_regs_this_id): Update.
+ (legacy_get_prev_frame): Update.
+ * xstormy16-tdep.c: Update comment.
+ * sparc-tdep.c (sparc_frame_chain): Update comment.
+ * blockframe.c (legacy_frame_chain_valid): Update.
+
+2003-04-06 Andrew Cagney <cagney@redhat.com>
+
+ * valprint.c (val_print_type_code_int): Delete #ifdef
+ PRINT_TYPELESS_INTEGER code.
+
+ * gdbarch.sh (DEPRECATED_USE_GENERIC_DUMMY_FRAMES)
+ (CALL_DUMMY_LOCATION, DEPRECATED_PC_IN_CALL_DUMMY): Allow partial
+ multi-arch definition.
+ * gdbarch.h: Re-generate.
+
+2003-04-05 Andrew Cagney <cagney@redhat.com>
+
+ Eliminate FRAME_FIND_SAVED_REGS.
+ * config/pa/tm-hppah.h (hppa_hpux_frame_find_saved_regs_in_sigtramp):
+ Change FSR parameter to a pointer.
+ * config/pa/tm-hppa64.h (FRAME_FIND_SAVED_REGS_IN_SIGTRAMP):
+ Assume FSR parameter is a pointer.
+ * hppa-hpux-tdep.c (hppa_hpux_frame_find_saved_regs_in_sigtramp):
+ Make fsr a pointer.
+ * hppa-tdep.c (hppa_frame_find_saved_regs): New function.
+ (hppa_frame_saved_pc): Call hppa_frame_init_saved_regs. Make
+ saved_regs a pointer.
+ (hppa_frame_saved_pc): Ditto.
+ (find_dummy_frame_regs): Make frame_saved_regs a pointer
+ (hppa_pop_frame): Call hppa_frame_init_saved_regs. Make fsr a
+ pointer.
+ (restore_pc_queue): Make fsr a pointer.
+ (hppa_frame_find_saved_regs): Make frame_saved_regs a pointer.
+ (hppa_frame_chain): Make saved_regs a pointer, call
+ hppa_frame_init_saved_regs.
+ * sparc-tdep.c: Include "gdb_assert.h".
+ (sparc_frame_find_saved_regs): Replace internal_error with
+ gdb_assert.
+ * remote-vxsparc.c (vx_read_register): Delete reference to
+ FRAME_FIND_SAVED_REGS.
+ * gdbarch.sh: Delete check for FRAME_FIND_SAVED_REGS.
+ * gdbarch.h: Regenerate.
+ * frame.h (DEPRECATED_FRAME_INIT_SAVED_REGS): Delete macro.
+ (deprecated_get_frame_saved_regs): Delete declaration.
+ (struct frame_saved_regs): Delete definition.
+ * frame.c (deprecated_get_frame_saved_regs): Delete function.
+ * config/pa/tm-hppa.h (hppa_frame_init_saved_regs): Declare.
+ (hppa_frame_find_saved_regs): Delete declaration.
+ (FRAME_FIND_SAVED_REGS): Delete macro.
+ (DEPRECATED_FRAME_INIT_SAVED_REGS): Define.
+ * config/i386/tm-ptx.h (FRAME_FIND_SAVED_REGS): Delete
+ FRAME_FIND_SAVED_REGS in comment.
+
+2003-04-05 Andrew Cagney <cagney@redhat.com>
+
+ * frame.c (frame_func_unwind, get_frame_func): New functions.
+ * frame.h (get_frame_func, frame_func_unwind): Declare.
+ (struct frame_info): Add field "prev_func" for caching the
+ previous frame's function address.
+ * arm-tdep.c (arm_frameless_function_invocation): Combine
+ get_pc_function_start and get_frame_pc into get_frame_func.
+ * sh-tdep.c (sh_nofp_frame_init_saved_regs): Ditto.
+ (sh64_nofp_frame_init_saved_regs): Ditto.
+ * s390-tdep.c (s390_function_start): Ditto.
+ * rs6000-tdep.c (rs6000_pop_frame): Ditto.
+ (rs6000_frameless_function_invocation): Ditto.
+ (rs6000_frame_saved_pc): Ditto.
+ * m68k-tdep.c (m68k_frame_init_saved_regs): Ditto.
+ * ia64-tdep.c (ia64_frame_init_saved_regs): Ditto.
+ * i386-tdep.c (i386_frameless_signal_p): Ditto.
+ (i386_frame_init_saved_regs): Ditto.
+ * hppa-tdep.c (hppa_frame_find_saved_regs): Ditto.
+ * d10v-tdep.c (d10v_frame_unwind_cache): Combine
+ get_pc_function_start and frame_pc_unwind into frame_func_unwind.
+ * cris-tdep.c (cris_frame_init_saved_regs): Ditto.
+ * blockframe.c (frameless_look_for_prologue): Ditto.
+
+2003-04-05 Andrew Cagney <cagney@redhat.com>
+
+ * frame.c (legacy_get_prev_frame): Link prev to next at the
+ function start. Update comments.
+
+2003-04-05 Andrew Cagney <cagney@redhat.com>
+
+ * frame.c (get_frame_id): Update comment.
+ (legacy_get_prev_frame): Update comment.
+ * gdbarch.sh: Delete check for EXTRA_FRAME_INFO.
+ * gdbarch.h: Regenerate.
+ * config/sparc/tm-sparc.h (EXTRA_FRAME_INFO): Delete.
+ * frame.h: Delete #ifdef EXTRA_FRAME_INFO code.
+
+2003-04-05 Andrew Cagney <cagney@redhat.com>
+
+ * stack.c (print_frame_info): Use get_frame_pc.
+
+2003-04-04 Andrew Cagney <cagney@redhat.com>
+
+ * frame.c (get_prev_frame): Do not call frame_type_from_pc. Set
+ the frame's type from the unwinder.
+ (get_frame_type): Map UNKNOWN_FRAME onto NORMAL_FRAME.
+ (create_new_frame, legacy_get_prev_frame): When the unwinder's
+ type isn't UNKNOWN_FRAME, initalize "type" from the unwinder.
+ (get_frame_base_address): Use get_frame_type.
+ (get_frame_locals_address, get_frame_args_address): Ditto.
+ (legacy_saved_regs_unwinder): Set the type to UNKNOWN_TYPE.
+ * frame.h (enum frame_type): Add UNKNOWN_FRAME.
+ (struct frame_info): Add comment explaining why the frame contains
+ a "type" field.
+ * dummy-frame.c (dummy_frame_unwind): Set the type to DUMMY_FRAME.
+ * d10v-tdep.c (d10v_frame_unwind): Set the type to NORMAL_FRAME.
+ * sentinel-frame.c (sentinel_frame_unwinder): Set the type to
+ NORMAL_FRAME.
+ * frame-unwind.h: Include "frame.h".
+ (struct frame_unwind): Add "type" field.
+ * Makefile.in (frame_unwind_h): Add $(frame_h).
+
+2003-04-04 Andrew Cagney <cagney@redhat.com>
+
+ * x86-64-tdep.c (x86_64_unwind_dummy_id): Use frame_id_build.
+ * dummy-frame.c (dummy_frame_this_id): Use frame_id_build.
+ * d10v-tdep.c (d10v_frame_this_id): Use get_frame_pc and
+ get_frame_base.
+ (d10v_unwind_dummy_id): Use frame_id_build.
+ * frame.c (find_frame_sal): Use get_frame_pc.
+ (create_new_frame): Use deprecated_update_frame_pc_hack and
+ deprecated_update_frame_base_hack.
+ (create_sentinel_frame): Add comment about ->pc going away.
+ (get_prev_frame): Add comment about ->pc going away.
+ (legacy_get_prev_frame): Use get_frame_base, get_frame_pc,
+ frame_id_build, deprecated_update_frame_pc_hack and
+ deprecated_update_frame_base_hack.
+ (select_frame): Use get_frame_pc.
+ (legacy_saved_regs_this_id): Use frame_id_build.
+
+2003-04-04 Elena Zannoni <ezannoni@redhat.com>
+
+ * x86-64-tdep.c (x86_64_push_arguments): Handle correctly the
+ signed integer case.
+ (classify_argument): Handle enumerations and references.
+
+2003-04-04 Andrew Cagney <cagney@redhat.com>
+
+ * frame.c (create_sentinel_frame): Initialize the sentinel frame's
+ ID to NULL.
+
+2003-04-01 Adam Fedor <fedor@gnu.org>
+
+ * gdb/objc-lang.c (selectors_info): Replace calls to
+ SYMBOL_DEMANGLED_NAME and DEPRECATED_SYMBOL_NAME with
+ SYMBOL_NATURAL_NAME.
+ (classes_info, find_methods): Likewise.
+
+2003-04-03 Kevin Buettner <kevinb@redhat.com>
+
+ * rs6000-tdep.c (rs6000_gdbarch_init): For xcoff executables, set
+ ``mach'' to the value determined by bfd_default_set_arch_mach().
+
+2003-04-02 Bob Rossi <bob_rossi@cox.net>
+
+ * Makefile.in (SUBDIR_MI_OBS): Add "mi-cmd-file.o".
+ (SUBDIR_MI_SRCS): Add "mi-cmd-file.c".
+ (mi-cmd-file.o): Update dependencies.
+
+2003-04-01 Kevin Buettner <kevinb@redhat.com>
+
+ * mips-tdep.c (mips_dwarf_dwarf2_ecoff_reg_to_regnum)
+ (mips_stab_reg_to_regnum): Add mappings for HI_REGNUM and LO_REGNUM.
+
+2003-04-01 Adam Fedor <fedor@gnu.org>
+
+ * Makefile.in (c_lang.o, jv_lang.o, language.o): Add $(demangle_h).
+ * language.h (struct language_defn): Add la_demangle.
+ (language_demangle): Declare.
+ * language.c (language_demangle): New function.
+ (unk_lang_demangle): Likewise.
+ (unknown_language_defn, auto_language_defn, local_language_defn):
+ Add ukn_lang_demangle.
+ * ada-lang.c (ada_language_defn): Add NULL for la_demangle element.
+ * f-lang.c, m2-lang.c, p-lang.c, scm-lang.c: Likewise.
+ * c-lang.c (c_language_defn, asm_language_defn): Likewise.
+ (cplus_language_defn): Add cplus_demangle for la_demangle element.
+ * jv-lang.c (java_demangle): New function
+ (java_language_defn): Use it for la_demangle element.
+ * objc-lang.c (objc_demangle): Add options argument
+ (objc_language_defn): Use objc_demangle for la_demangle element.
+ * maint.c (maintenance_demangle): Replace switch with
+ call to language_demangle.
+ * utils.c (fprintf_symbol_filtered): Likewise.
+
+2003-04-01 Andrew Cagney <cagney@redhat.com>
+
+ * printcmd.c (print_frame_nameless_args): Delete #ifdef
+ NAMELESS_ARG_VALUE, PRINT_NAMELESS_INTEGER and
+ PRINT_TYPELESS_INTEGER.
+ * config/sparc/tm-sp64.h (DEPRECATED_PUSH_RETURN_ADDRESS): Rename
+ PUSH_RETURN_ADDRESS.
+
+2003-04-01 Andrew Cagney <cagney@redhat.com>
+
+ * Makefile.in (d10v-tdep.o): Update dependencies.
+ * d10v-tdep.c: Include "frame-base.h".
+ (d10v_frame_unwind): Make constant.
+ (d10v_frame_base_address): New function.
+ (d10v_frame_base): New variable.
+ (d10v_gdbarch_init): Set frame_base default.
+ (struct d10v_unwind_cache): Add the field "prev_sp". Update
+ comment for base.
+ (d10v_frame_unwind_cache): Set and use "prev_sp".
+ (d10v_frame_this_id): Use the previous frame's inner most stack
+ address and this frame's func address for the frame ID. Use
+ frame_id_build. Don't analyze beyond the current instruction.
+
+2003-04-01 Andrew Cagney <cagney@redhat.com>
+
+ * frame.h (get_frame_locals_address, get_frame_args_address):
+ Refer to the base address, instead of the address of the first
+ local or parameter.
+
+2003-04-01 Andrew Cagney <cagney@redhat.com>
+
+ Add frame debug info addresses:
+ * frame-base.c: New file.
+ * frame-base.h: New file.
+ * frame.h (struct frame_base): Add opaque declaration.
+ (get_frame_base): Update comment.
+ (get_frame_base_address): Declare.
+ (get_frame_locals_address): Declare.
+ (get_frame_args_address): Declare.
+ (struct frame_info): Add "base" and "base_cache". Update
+ comments on the unwinder.
+ * frame.c: Include "frame-base.h".
+ (get_frame_locals_address): New function.
+ (get_frame_base_address): New function.
+ (get_frame_args_address): New function.
+ * findvar.c (read_var_value): Use get_frame_locals_address and
+ get_frame_args_address.
+ * stack.c (frame_info): Use get_frame_locals_address and
+ get_frame_args_address.
+ (FRAME_ARGS_ADDRESS_CORRECT): Delete conditionally defined macro,
+ moved to "frame-base.c".
+ * printcmd.c (print_frame_nameless_args): Ditto.
+ * symtab.h (address_class): Update comments.
+ * dwarf2loc.c (dwarf_expr_frame_base): Add note about
+ get_frame_base_address.
+ * dwarf2expr.c (execute_stack_op): Ditto.
+ * Makefile.in (frame_base_h): Define.
+ (frame.o): Update dependencies.
+ (frame-base.o): Add dependencies.
+ (SFILES): Add frame-base.c.
+ (COMMON_OBS): Add frame-base.o.
+
+2003-04-01 Andrew Cagney <cagney@redhat.com>
+
+ * gdbarch.sh (CALL_DUMMY_START_OFFSET): Default to zero.
+ CALL_DUMMY_LENGTH): Ditto.
+ * gdbarch.c: Re-generate.
+ * inferior.h (CALL_DUMMY_START_OFFSET): Delete macro.
+ (CALL_DUMMY_LENGTH): Delete macro.
+ * alpha-tdep.c (alpha_gdbarch_init): Do not set above when zero.
+ * arm-tdep.c (arm_gdbarch_init): Ditto.
+ * avr-tdep.c (avr_gdbarch_init): Ditto.
+ * cris-tdep.c (cris_gdbarch_init): Ditto.
+ * d10v-tdep.c (d10v_gdbarch_init): Ditto.
+ * frv-tdep.c (frv_gdbarch_init): Ditto.
+ * h8300-tdep.c (h8300_gdbarch_init): Ditto.
+ * hppa-tdep.c (hppa_gdbarch_init): Ditto.
+ * i386-tdep.c (i386_gdbarch_init): Ditto.
+ * ia64-tdep.c (ia64_gdbarch_init): Ditto.
+ * m68hc11-tdep.c (m68hc11_gdbarch_init): Ditto.
+ * mcore-tdep.c (mcore_gdbarch_init): Ditto.
+ * mips-tdep.c (mips_gdbarch_init): Ditto.
+ * mn10300-tdep.c (mn10300_gdbarch_init): Ditto.
+ * rs6000-tdep.c (rs6000_gdbarch_init): Ditto.
+ * s390-tdep.c (s390_gdbarch_init): Ditto.
+ * sh-tdep.c (sh_gdbarch_init): Ditto.
+ * sparc-tdep.c (sparc_gdbarch_init): Ditto.
+ * v850-tdep.c (v850_gdbarch_init): Ditto.
+ * vax-tdep.c (vax_gdbarch_init): Ditto.
+ * xstormy16-tdep.c (xstormy16_gdbarch_init): Ditto.
+
+2003-04-01 Corinna Vinschen <vinschen@redhat.com>
+
+ * frame.c (get_prev_frame): Disable call to inside_entry_file().
+
+2003-04-01 Andrew Cagney <cagney@redhat.com>
+
+ * gdbarch.sh (CALL_DUMMY_BREAKPOINT_OFFSET): Default to zero.
+ (CALL_DUMMY_BREAKPOINT_OFFSET_P): Delete.
+ * gdbarch.h, gdbarch.c: Re-generate.
+ * config/sparc/tm-sp64.h (CALL_DUMMY_BREAKPOINT_OFFSET_P): Delete.
+ (CALL_DUMMY_BREAKPOINT_OFFSET_P): Delete.
+ * config/pa/tm-hppa64.h (CALL_DUMMY_BREAKPOINT_OFFSET_P): Delete.
+ * inferior.h (CALL_DUMMY_BREAKPOINT_OFFSET_P): Delete.
+ (CALL_DUMMY_BREAKPOINT_OFFSET): Delete.
+ * infcmd.c (run_stack_dummy): Simplify assuming
+ CALL_DUMMY_BREAKPOINT_OFFSET_P.
+ * infrun.c (handle_inferior_event): Ditto.
+ * alpha-tdep.c (alpha_gdbarch_init): Do not set
+ call_dummy_breakpoint_offset or call_dummy_breakpoint_offset_p.
+ * arm-tdep.c (arm_gdbarch_init): Ditto.
+ * avr-tdep.c (avr_gdbarch_init): Ditto.
+ * cris-tdep.c (cris_gdbarch_init): Ditto.
+ * d10v-tdep.c (d10v_gdbarch_init): Ditto.
+ * frv-tdep.c (frv_gdbarch_init): Ditto.
+ * h8300-tdep.c (h8300_gdbarch_init): Ditto.
+ * i386-tdep.c (i386_gdbarch_init): Ditto.
+ * ia64-tdep.c (ia64_gdbarch_init): Ditto.
+ * m68hc11-tdep.c (m68hc11_gdbarch_init): Ditto.
+ * m68k-tdep.c (m68k_gdbarch_init): Ditto.
+ * mcore-tdep.c (mcore_gdbarch_init): Ditto.
+ * mips-tdep.c (mips_gdbarch_init): Ditto.
+ * mn10300-tdep.c (mn10300_gdbarch_init): Ditto.
+ * ns32k-tdep.c (ns32k_gdbarch_init): Ditto.
+ * rs6000-tdep.c (rs6000_gdbarch_init): Ditto.
+ * s390-tdep.c (s390_gdbarch_init): Ditto.
+ * sh-tdep.c (sh_gdbarch_init): Ditto.
+ * sparc-tdep.c (sparc_gdbarch_init): Ditto.
+ * v850-tdep.c (v850_gdbarch_init): Ditto.
+ * vax-tdep.c (vax_gdbarch_init): Ditto.
+ * xstormy16-tdep.c (xstormy16_gdbarch_init): Ditto.
+
+2003-04-01 Daniel Jacobowitz <drow@mvista.com>
+
+ * symfile.c (symfile_relocate_debug_section): Update call to
+ bfd_simple_get_relocated_section_contents.
+
+2003-03-31 Andrew Cagney <cagney@redhat.com>
+
+ * gdbarch.sh (FIX_CALL_DUMMY): Change to function with predicate.
+ * gdbarch.h, gdbarch.c: Regenerate.
+ * inferior.h (FIX_CALL_DUMMY): Delete macro.
+ * valops.c (hand_function_call): Only call FIX_CALL_DUMMY when
+ available.
+ * frame.h (generic_fix_call_dummy): Delete declaration.
+ * dummy-frame.h: Update comment.
+ * dummy-frame.c (generic_fix_call_dummy): Delete function.
+ * xstormy16-tdep.c (xstormy16_gdbarch_init): Do not set
+ fix_call_dummy.
+ * sh-tdep.c (sh_gdbarch_init): Ditto.
+ * s390-tdep.c (s390_gdbarch_init): Ditto.
+ * mn10300-tdep.c (mn10300_gdbarch_init): Ditto.
+ * mcore-tdep.c (mcore_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.
+ * arm-tdep.c (arm_gdbarch_init): Ditto.
+
+2003-03-31 J. Brobecker <brobecker@gnat.com>
+
+ * config/pa/tm-hppa64.h (FRAME_ARGS_ADDRESS): Delete macro, not useful.
+ (INIT_FRAME_AP): Likewise.
+ (EXTRA_FRAME_INFO): Likewise.
+
+2003-03-31 Andrew Cagney <cagney@redhat.com>
+
+ * gdbarch.sh: Include "symfile.h".
+ (CALL_DUMMY_ADDRESS): Default to entry_point_address.
+ * gdbarch.h, gdbarch.c: Re-generate.
+ * inferior.h (CALL_DUMMY_ADDRESS): Delete macro.
+ * xstormy16-tdep.c (xstormy16_gdbarch_init): Do not set
+ call_dummy_address, the default is at entry_point_address.
+ * 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.
+ * mcore-tdep.c (mcore_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.
+ * arm-tdep.c (arm_gdbarch_init): Ditto.
+
+2003-03-31 Andrew Cagney <cagney@redhat.com>
+
+ * gdbarch.sh (CALL_DUMMY_P): Delete.
+ * gdbarch.h, gdbarch.c: Re-generate.
+ * inferior.h (CALL_DUMMY_P): Delete macro.
+ * xstormy16-tdep.c (xstormy16_gdbarch_init): Update.
+ * vax-tdep.c (vax_gdbarch_init): Update.
+ * v850-tdep.c (v850_gdbarch_init): Update.
+ * sparc-tdep.c (sparc_gdbarch_init): Update.
+ * sh-tdep.c (sh_gdbarch_init): Update.
+ * s390-tdep.c (s390_gdbarch_init): Update.
+ * rs6000-tdep.c (rs6000_gdbarch_init): Update.
+ * ns32k-tdep.c (ns32k_gdbarch_init): Update.
+ * mn10300-tdep.c (mn10300_gdbarch_init): Update.
+ * mips-tdep.c (mips_gdbarch_init): Update.
+ * mcore-tdep.c (mcore_gdbarch_init): Update.
+ * m68k-tdep.c (m68k_gdbarch_init): Update.
+ * m68hc11-tdep.c (m68hc11_gdbarch_init): Update.
+ * ia64-tdep.c (ia64_gdbarch_init): Update.
+ * i386-tdep.c (i386_gdbarch_init): Update.
+ * h8300-tdep.c (h8300_gdbarch_init): Update.
+ * frv-tdep.c (frv_gdbarch_init): Update.
+ * d10v-tdep.c (d10v_gdbarch_init): Update.
+ * cris-tdep.c (cris_gdbarch_init): Update.
+ * breakpoint.c (deprecated_frame_in_dummy): Update.
+ * avr-tdep.c (avr_gdbarch_init): Update.
+ * alpha-tdep.c (alpha_gdbarch_init): Update.
+ * arm-tdep.c (arm_gdbarch_init): Update.
+ * dummy-frame.c (dummy_frame_this_id): Update comments.
+ * rs6000-tdep.c (rs6000_extract_struct_value_address): Ditto.
+ * frame.c (legacy_get_prev_frame): Ditto.
+ * valops.c (call_function_by_hand): Delete function.
+ (hand_function_call): Rename to call_function_by_hand
+
+2003-03-30 Andrew Cagney <cagney@redhat.com>
+
+ 2002-11-10 Klee Dienes <kdienes@apple.com>
+ * value.h (struct value): Update comment.
+
+2003-03-30 Andrew Cagney <cagney@redhat.com>
+
+ * d10v-tdep.c: Replace _FP_REGNUM and FP_REGNUM with
+ D10V_FP_REGNUM.
+ (d10v_gdbarch_init): Do not set fp_regnum.
+
+ * frame.c (get_frame_base): Force ID initialization.
+ (get_prev_frame): Move computation of the frame ID from here ...
+ (get_frame_id): ... to here.
+ (legacy_get_prev_frame): Mark the frame ID as valid.
+ * frame.h (struct frame_info): Add field "id_p".
+
+2003-03-30 Mark Kettenis <kettenis@gnu.org>
+
+ * i386-tdep.c (i386_store_struct_return): Removed.
+ (i386_gdbarch_init): Don't set deprecated_store_struct_return.
+
+2003-03-30 Andrew Cagney <cagney@redhat.com>
+
+ * gdbarch.sh (DEPRECATED_DUMMY_WRITE_SP): Replace TARGET_WRITE_SP.
+ * gdbarch.h, gdbarch.c: Regenerate.
+ * v850-tdep.c (v850_gdbarch_init): Set deprecated_dummy_write_sp.
+ * xstormy16-tdep.c (xstormy16_gdbarch_init): Ditto.
+ * mcore-tdep.c (mcore_gdbarch_init): Ditto.
+ * m68k-tdep.c (m68k_gdbarch_init): Ditto.
+ * i386-tdep.c (i386_gdbarch_init): Ditto.
+ * h8300-tdep.c (h8300_gdbarch_init): Ditto.
+ * cris-tdep.c (cris_gdbarch_init): Ditto.
+ * vax-tdep.c (vax_gdbarch_init): Ditto.
+ * s390-tdep.c (s390_gdbarch_init): Ditto.
+ * ns32k-tdep.c (ns32k_gdbarch_init): Ditto.
+ * mn10300-tdep.c (mn10300_gdbarch_init): Ditto.
+ * alpha-tdep.c (alpha_gdbarch_init): Ditto.
+ * sparc-tdep.c (sparc_push_dummy_frame, sparc_pop_frame): Update.
+ * config/sparc/tm-sp64.h (DEPRECATED_DUMMY_WRITE_SP): Update.
+ * config/pa/tm-hppa.h (DEPRECATED_DUMMY_WRITE_SP): Define.
+ * sparc-tdep.c (sparc_gdbarch_init): Update.
+ * sh-tdep.c (sh_gdbarch_init): Update.
+ * rs6000-tdep.c (rs6000_gdbarch_init): Update.
+ * mips-tdep.c (mips_gdbarch_init): Update.
+ * m68hc11-tdep.c (m68hc11_gdbarch_init): Update.
+ * ia64-tdep.c (ia64_gdbarch_init): Update.
+ * frv-tdep.c (frv_gdbarch_init): Update.
+ * avr-tdep.c (avr_gdbarch_init): Update.
+ * valops.c (hand_function_call): Replace TARGET_WRITE_SP with
+ DEPRECATED_DUMMY_WRITE_SP. Call when the method is available,
+ instead of when push_dummy_call is not available.
+
+2003-03-30 Andrew Cagney <cagney@redhat.com>
+
+ * infttrace.c: Include "gdbthread.h".
+ (parent_attach_all): Fix function signature.
+ (call_ptrace): Update call.
+ * Makefile.in (infttrace.o): Update dependencies.
+
+2003-03-30 Andrew Cagney <cagney@redhat.com>
+
+ * gdbarch.sh (DEPRECATED_PUSH_RETURN_ADDRESS): Replace
+ PUSH_RETURN_ADDRESS.
+ * gdbarch.h, gdbarch.c: Regenerate.
+ * xstormy16-tdep.c (xstormy16_gdbarch_init): Update.
+ * x86-64-tdep.c (x86_64_init_abi): Update.
+ * v850-tdep.c (v850_gdbarch_init): Update.
+ * sparc-tdep.c (sparc_gdbarch_init): Update.
+ * sh-tdep.c (sh_gdbarch_init): Update.
+ * s390-tdep.c (s390_gdbarch_init): Update.
+ * rs6000-tdep.c (rs6000_gdbarch_init): Update.
+ * mn10300-tdep.c (mn10300_gdbarch_init): Update.
+ * mips-tdep.c (mips_gdbarch_init): Update.
+ * mcore-tdep.c (mcore_gdbarch_init): Update.
+ * m68hc11-tdep.c (m68hc11_gdbarch_init): Update.
+ * ia64-tdep.c (ia64_gdbarch_init): Update.
+ * i386-tdep.c (i386_gdbarch_init): Update.
+ * h8300-tdep.c (h8300_gdbarch_init): Update.
+ * frv-tdep.c (frv_gdbarch_init): Update.
+ * cris-tdep.c (cris_gdbarch_init): Update.
+ * avr-tdep.c (avr_gdbarch_init): Update.
+ * arm-tdep.c (arm_gdbarch_init): Update.
+ * valops.c (hand_function_call): Update.
+
+2003-03-29 Andrew Cagney <cagney@redhat.com>
+
+ * d10v-tdep.c (d10v_gdbarch_init): Do not set call_dummy_words or
+ sizeof_call_dummy_words.
+ * gdbarch.sh (CALL_DUMMY_WORDS, SIZEOF_CALL_DUMMY_WORDS): Always
+ define.
+ * gdbarch.h: Regenerate.
+
+2003-03-29 Andrew Cagney <cagney@redhat.com>
+
+ * infttrace.h: New file.
+ * hpread.c: Include "gdb_assert.h" and "somsolib.h".
+ (hpread_get_textlow): Detect an uninitialized dn_bufp.
+ (hpread_read_doc_function_type): Detect an initialized type1.
+ (hpread_quick_traverse): Initialize mod_name_string.
+ * somsolib.h: Add #ifdef SOMSOLIB_H wrapper.
+ (som_solib_get_solib_by_pc): Declare.
+ (so_lib_thread_start_addr): Declare.
+ (no_shared_libraries): Declare.
+ * somread.c (init_import_symbols): Make static. Add forward
+ declaration.
+ * config/pa/nm-hppah.h: Include "infttrace.h" for
+ parent_attach_all.
+ (hppa_insert_hw_watchpoint): Declare.
+ (hppa_can_use_hw_watchpoint, hppa_remove_hw_watchpoint): Declare.
+ * hppah-nat.c: Include "gdb_string.h".
+ (parent_attach_all): Delete extern declaration, moved to
+ "infttrace.h".
+ (hppa_can_use_hw_watchpoint): Change type of "type" parameter to
+ int.
+ (hppa_remove_hw_watchpoint, hppa_insert_hw_watchpoint): Ditto.
+ * Makefile.in (infttrace_h): Define.
+ (hpread.o): Update dependencies.
+ (hppah-nat.o, hppa-hpux-tdep.o, hppa-tdep.o): Ditto.
+ * hppa-hpux-tdep.c: Include "gdb_string.h".
+ * hppa-tdep.c (hppa_frame_saved_pc): Initialize "old_pc".
+ * infrun.c (handle_inferior_event): Always initialize
+ stepped_after_stopped_by_watchpoint. Add default and remove
+ fallthrough in switch statement.
+ * infttrace.c (hppa_can_use_hw_watchpoint): Change type of "type"
+ parameter to int.
+ (hppa_remove_hw_watchpoint): Ditto.
+
+2003-03-29 Andrew Cagney <cagney@redhat.com>
+
+ * ns32k-tdep.c (ns32k_gdbarch_init): Set the call dummy breakpoint
+ offset.
+
+2003-03-29 Richard Earnshaw <rearnsha@arm.com>
+
+ * arm-tdep.c (arm_push_arguments): Delete.
+ (struct stack_item): New type.
+ (push_stack_item, pop_stack_item, arm_push_dummy_call): New functions.
+ (arm_store_struct_return): Delte.
+ (arm_gdbarch_init): Register arm_push_dummy_call. Don't register
+ arm_push_arguments or arm_store_struct_return.
+
+2003-03-28 Andrew Cagney <cagney@redhat.com>
+
+ * Makefile.in (d10v-tdep.o): Update dependencies.
+ * remote.h (target_resume_hook, target_wait_loop_hook): Declare.
+ * d10v-tdep.c: Include "remote.h".
+ (target_resume_hook): Delete extern declaration.
+ (target_wait_loop_hook): Ditto.
+ (tdisassemble_command): Eliminate assignment in "if" conditional.
+ (d10v_ts2_register_sim_regno): Eliminate call to
+ legacy_register_sim_regno.
+ (d10v_ts3_register_sim_regno): Ditto.
+
+2003-03-28 Jeff Johnston <jjohnstn@redhat.com>
+
+ * thread.c: Reindented.
+ * lin-lwp.c: Ditto.
+ * linux-proc.c: Ditto.
+
+2003-03-28 Bob Rossi <bob_rossi@cox.net>
+
+ * MAINTAINERS (write after approval): Add myself.
+
+2003-03-27 Theodore A. Roth <troth@openavr.org>
+
+ * objc-exp.y: Add missing semi-colons.
+
+2003-03-27 Andrew Cagney <cagney@redhat.com>
+
+ * regcache.c (write_sp): Delete function and references.
+ * inferior.h (write_sp): Delete declaration.
+ * valops.c (hand_function_call): Replace write_sp with
+ TARGET_WRITE_SP.
+ * sparc-tdep.c (sparc_push_dummy_frame): Ditto.
+ (sparc_pop_frame): Ditto.
+
+2003-03-27 Andrew Cagney <cagney@redhat.com>
+
+ * NEWS: Mention removal of support for hppa*-*-bsd* and
+ hppa*-*-osf* natives, and hppa*-*-pro* target.
+ * config/pa/xm-hppah.h: Do not include "pa/xm-pa.h".
+ * config/pa/xm-pa.h: Obsolete file.
+ * config/pa/xm-hppab.h: Obsolete file.
+ * config/pa/nm-hppab.h: Obsolete file.
+ * config/pa/tm-hppab.h: Obsolete file.
+ * config/pa/tm-hppao.h: Obsolete file.
+ * config/pa/nm-hppao.h: Obsolete file.
+ * config/pa/tm-pro.h: Obsolete file.
+ * config/pa/hppaosf.mt: Obsolete file.
+ * config/pa/hppaosf.mh: Obsolete file.
+ * config/pa/hppapro.mt: Obsolete file.
+ * config/pa/hppabsd.mt: Obsolete file.
+ * config/pa/hppabsd.mh: Obsolete file.
+ * configure.host: Disable hppa*-*-bsd* and hppa*-*-osf*.
+ * configure.tgt: Disable hppa*-*-bsd*, hppa*-*-pro* and
+ hppa*-*-osf*.
+
+2003-03-27 Andrew Cagney <cagney@redhat.com>
+
+ * d10v-tdep.c (d10v_gdbarch_init): Set push_dummy_call instead of
+ push_arguments. Don't set push_return_address or write_sp.
+ (d10v_push_dummy_call): Replace d10v_push_arguments.
+ (d10v_push_return_address, d10v_write_sp): Delete function,
+ handled by push_dummy_call.
+
+2003-03-26 Andrew Cagney <cagney@redhat.com>
+
+ * gdbarch.sh (DEPRECATED_PUSH_ARGUMENTS): Rename PUSH_ARGUMENTS.
+ (push_dummy_call): New pure multi-arch replacement with gdbarch,
+ regcache and dummy_addr parameters.
+ * gdbarch.h, gdbarch.c: Re-generate.
+ * valops.c (hand_function_call): Use gdbarch_push_dummy_call when
+ available; assume it will handle stack alignment and return
+ address issues. Fall back to DEPRECATED_PUSH_ARGUMENTS and
+ legacy_push_arguments.
+ (legacy_push_arguments): Rename default_push_arguments.
+ * value.h (legacy_push_arguments): Rename default_push_arguments.
+ * i386-tdep.c (i386_push_arguments): Call legacy_push_arguments.
+ * config/sparc/tm-sparc.h (DEPRECATED_PUSH_ARGUMENTS): Update.
+ * config/sparc/tm-sp64.h (DEPRECATED_PUSH_ARGUMENTS): Update.
+ * config/pa/tm-hppa.h (DEPRECATED_PUSH_ARGUMENTS): Update.
+ * config/i386/tm-symmetry.h: Update.
+ * xstormy16-tdep.c (xstormy16_gdbarch_init): Update.
+ * x86-64-tdep.c (x86_64_init_abi): Update.
+ * v850-tdep.c (v850_gdbarch_init): Update.
+ * sparc-tdep.c (sparc_gdbarch_init): Update.
+ * sh-tdep.c (sh_gdbarch_init): Update.
+ * s390-tdep.c (s390_gdbarch_init): Update.
+ * rs6000-tdep.c (rs6000_gdbarch_init): Update.
+ * mn10300-tdep.c (mn10300_gdbarch_init): Update.
+ * mips-tdep.c (mips_gdbarch_init): Update.
+ * mcore-tdep.c (mcore_gdbarch_init): Update.
+ * m68hc11-tdep.c (m68hc11_gdbarch_init): Update.
+ * ia64-tdep.c (ia64_gdbarch_init): Update.
+ * i386-tdep.c (i386_gdbarch_init): Update.
+ * hppa-tdep.c (hppa_gdbarch_init): Update.
+ * h8300-tdep.c (h8300_gdbarch_init): Update.
+ * frv-tdep.c (frv_gdbarch_init): Update.
+ * d10v-tdep.c (d10v_gdbarch_init): Update.
+ * cris-tdep.c (cris_gdbarch_init): Update.
+ * avr-tdep.c (avr_gdbarch_init): Update.
+ * arm-tdep.c (arm_gdbarch_init): Update.
+ * arm-linux-tdep.c (arm_linux_init_abi): Update.
+ * alpha-tdep.c (alpha_gdbarch_init): Update.
+
+2003-03-26 Daniel Jacobowitz <drow@mvista.com>
+
+ * signals/signals.c (do_target_signal_to_host): Correct realtime
+ signal range test.
+
+2003-03-26 Daniel Jacobowitz <drow@mvista.com>
+
+ * breakpoint.c (handle_gnu_4_16_catch_command, get_catch_sals)
+ (struct sal_chain, map_catch_names): Remove.
+ (catch_exception_command_1): Don't call
+ handle_gnu_4_16_catch_command.
+
+2003-03-26 Daniel Jacobowitz <drow@mvista.com>
+
+ From Mark Dettinger <dettinge@de.ibm.com>:
+ * dwarf2cfi.c (read_2u): Increment pointer by two.
+
+2003-03-26 Daniel Jacobowitz <drow@mvista.com>
+
+ * signals/signals.c: Fix typos in last change.
+
+2003-03-26 Daniel Jacobowitz <drow@mvista.com>
+
+ * signals/signals.c (REALTIME_LO, REALTIME_HI): Define if
+ not already defined. Use __SIGRTMIN if available.
+ (target_signal_from_host): Remove SIGRTMIN block.
+ (do_target_signal_to_host): Remove SIGRTMIN block; check that
+ the signal is within the realtime range.
+
+2003-03-25 Adam Fedor <fedor@gnu.org>
+
+ * Makefile.in (infrun.o): Add $(language_h)
+ * infrun.c (handle_inferior_event): Use skip_language_trampoline
+ for language specific trampolines.
+ * language.h (struct language_defn): Add skip_trampoline.
+ (skip_language_trampoline): Declare.
+ * language.c (unk_lang_trampoline, skip_language_trampoline):
+ New functions.
+ (unknown_language_defn, auto_language_defn, local_language_defn):
+ Add ukn_lang_trampoline.
+ * ada-lang.c (ada_language_defn): Add NULL for language
+ specific skip_trampoline.
+ * c-lang.c, f-lang.c, jv-lang.c, m2-lang.c, p-lang.c,
+ scm-lang.c: Likewise.
+ * objc-lang.c (objc_skip_trampoline): New function.
+ (objc_language_defn): Add objc_skip_trampoline.
+
+2003-03-25 Andrew Cagney <cagney@redhat.com>
+
+ * frame.c (get_prev_frame): Delay validating a frame's ID -
+ non-NULL, didn't go backwards - until an attempt to unwind it to
+ the previous frame.
+
+2003-03-25 Andrew Cagney <cagney@redhat.com>
+
+ * gdbarch.sh (DEPRECATED_EXTRA_STACK_ALIGNMENT_NEEDED): Replace
+ EXTRA_STACK_ALIGNMENT_NEEDED. Default to 0 not 1.
+ * gdbarch.h, gdbarch.c: Re-generate.
+ * config/sparc/tm-sparc.h
+ (DEPRECATED_EXTRA_STACK_ALIGNMENT_NEEDED): Define.
+ * sparc-tdep.c (sparc_gdbarch_init): Set
+ deprecated_extra_stack_alignment_needed.
+ * config/pa/tm-hppa.h (EXTRA_STACK_ALIGNMENT_NEEDED): Delete.
+ * xstormy16-tdep.c (xstormy16_gdbarch_init): Do not clear
+ extra_stack_alignment_needed.
+ * v850-tdep.c (v850_gdbarch_init): Ditto.
+ * hppa-tdep.c (hppa_gdbarch_init): Ditto.
+ * h8300-tdep.c (h8300_gdbarch_init): Ditto.
+ * d10v-tdep.c (d10v_gdbarch_init): Ditto.
+ * cris-tdep.c (cris_gdbarch_init): Ditto.
+ * m68k-tdep.c (m68k_gdbarch_init): Ditto.
+ * m68hc11-tdep.c (m68hc11_gdbarch_init): Ditto.
+
+2003-03-25 Andrew Cagney <cagney@redhat.com>
+
+ * gdbarch.sh (DEPRECATED_STORE_STRUCT_RETURN): Replace
+ STORE_STRUCT_RETURN.
+ * gdbarch.h, gdbarch.c: Regenerate.
+ * d10v-tdep.c (d10v_store_struct_return): Delete function.
+ (d10v_push_arguments): Set the struct return register.
+ (d10v_gdbarch_init): Update.
+ * xstormy16-tdep.c (xstormy16_gdbarch_init): Update.
+ * x86-64-tdep.c (x86_64_init_abi): Update.
+ * vax-tdep.c (vax_gdbarch_init): Update.
+ * v850-tdep.c (v850_gdbarch_init): Update.
+ * sparc-tdep.c (sparc_gdbarch_init): Update.
+ * sh-tdep.c (sh_gdbarch_init): Update.
+ * s390-tdep.c (s390_gdbarch_init): Update.
+ * rs6000-tdep.c (rs6000_gdbarch_init): Update.
+ * ns32k-tdep.c (ns32k_gdbarch_init): Update.
+ * mn10300-tdep.c (mn10300_gdbarch_init): Update.
+ * mips-tdep.c (mips_gdbarch_init): Update.
+ * mcore-tdep.c (mcore_gdbarch_init): Update.
+ * m68k-tdep.c (m68k_gdbarch_init): Update.
+ * m68hc11-tdep.c (m68hc11_gdbarch_init): Update.
+ * ia64-tdep.c (ia64_gdbarch_init): Update.
+ * i386-tdep.c (i386_gdbarch_init): Update.
+ * hppa-tdep.c (hppa_gdbarch_init): Update.
+ * h8300-tdep.c (h8300_gdbarch_init): Update.
+ * frv-tdep.c (frv_gdbarch_init): Update.
+ * cris-tdep.c (cris_gdbarch_init): Update.
+ * avr-tdep.c (avr_gdbarch_init): Update.
+ * arm-tdep.c (arm_gdbarch_init): Update.
+ * alpha-tdep.c (alpha_gdbarch_init): Update.
+
+2003-03-25 Andrew Cagney <cagney@redhat.com>
+
+ * gdbarch.sh (CALL_DUMMY_STACK_ADJUST_P): Delete.
+ (DEPRECATED_CALL_DUMMY_STACK_ADJUST): Replace
+ CALL_DUMMY_STACK_ADJUST with a predicate variable.
+ * gdbarch.h, gdbarch.c: Regenerate.
+ * xstormy16-tdep.c (xstormy16_gdbarch_init): Do not set
+ call_dummy_stack_adjust_p.
+ * vax-tdep.c (vax_gdbarch_init): Ditto.
+ * v850-tdep.c (v850_gdbarch_init): Ditto.
+ * sh-tdep.c (sh_gdbarch_init): Ditto.
+ * s390-tdep.c (s390_gdbarch_init): Ditto.
+ * rs6000-tdep.c (rs6000_gdbarch_init): Ditto.
+ * ns32k-tdep.c (ns32k_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.
+ * arm-tdep.c (arm_gdbarch_init): Ditto.
+ * alpha-tdep.c (alpha_gdbarch_init): Ditto.
+ * config/sparc/tm-sp64.h (CALL_DUMMY_STACK_ADJUST): Update.
+ * config/sparc/tm-sparc.h (CALL_DUMMY_STACK_ADJUST): Update.
+ * config/sparc/tm-sp64.h (CALL_DUMMY_STACK_ADJUST): Update.
+ * sparc-tdep.c (sparc_gdbarch_init): Update. Do not set
+ call_dummy_stack_adjust_p.
+ * inferior.h (CALL_DUMMY_STACK_ADJUST_P): Delete macro.
+ (CALL_DUMMY_STACK_ADJUST): Delete macro.
+ * sparc-tdep.c (sparc32_push_arguments): Update.
+ * valops.c (hand_function_call): Update.
+
+2003-03-25 Corinna Vinschen <vinschen@redhat.com>
+
+ * xstormy16-tdep.c (xstormy16_gdbarch_init): Add call to
+ set_gdbarch_char_signed.
+
+2003-03-25 Richard Earnshaw <rearnsha@arm.com>
+
+ PR cli/548
+ * arm-tdep.c (_initialize_arm_tdep): Command is "set arm disassembler".
+
+2003-03-25 Richard Earnshaw <rearnsha@arm.com>
+
+ * arm-tdep.c (arm_gdbarch_init): Register the disassembler function.
+ (_initialize_arm_tdep): Don't set tm_print_insn.
+
+2003-03-24 Adam Fedor <fedor@gnu.org>
+
+ * Makefile.in (YYOBJ): Add objc-exp.tab.o
+ * objc-lang.h: Add multiple inclusion protection.
+ (start_msglist, add_msglist, end_msglist): Additional declarations.
+
+2003-03-24 Richard Earnshaw <rearnsha@arm.com>
+
+ * armnbsd-tdep.c (arm_netbsd_aout_init_abi): ARM_FLOAT_SOFT enum
+ value was renamed to ARM_FLOAT_SOFT_FPA.
+
+2003-03-23 Andrew Cagney <cagney@redhat.com>
+
+ * gdbarch.sh (DEPRECATED_FRAME_CHAIN): Replace FRAME_CHAIN.
+ (DEPRECATED_FRAME_CHAIN_VALID): Replace FRAME_CHAIN_VALID.
+ * gdbarch.h, gdbarch.c: Regenerate.
+ * valops.c (hand_function_call): Update.
+ * objfiles.h (DEPRECATED_FRAME_CHAIN_VALID): Update.
+ * frame.c (legacy_saved_regs_this_id): Update.
+ (legacy_get_prev_frame, get_prev_frame, legacy_frame_p): Update.
+ * dummy-frame.h: Update.
+ * config/sparc/tm-sparc.h (DEPRECATED_FRAME_CHAIN): Update.
+ * config/pa/tm-hppa.h (DEPRECATED_FRAME_CHAIN_VALID): Update.
+ * config/m68k/tm-vx68.h (DEPRECATED_FRAME_CHAIN): Update.
+ * config/m68k/tm-os68k.h (DEPRECATED_FRAME_CHAIN): Update.
+ * config/m68k/tm-sun3.h: Update.
+ * blockframe.c (inside_main_func, frame_chain_valid): Update.
+ * xstormy16-tdep.c (xstormy16_gdbarch_init): Update.
+ * x86-64-tdep.c (x86_64_init_abi): Update.
+ * vax-tdep.c (vax_gdbarch_init): Update.
+ * v850-tdep.c (v850_gdbarch_init): Update.
+ * sparc-tdep.c (sparc_frame_chain, sparc_gdbarch_init): Update.
+ * sh-tdep.c (sh_gdbarch_init): Update.
+ * s390-tdep.c (s390_gdbarch_init): Update.
+ * rs6000-tdep.c (rs6000_frame_saved_pc): Update.
+ (rs6000_gdbarch_init, rs6000_frame_saved_pc): Update.
+ (frame_get_saved_regs): Update.
+ * ppc-linux-tdep.c (ppc_linux_init_abi): Update.
+ * ns32k-tdep.c (ns32k_gdbarch_init): Update.
+ * mn10300-tdep.c (mn10300_gdbarch_init): Update.
+ * mips-tdep.c (mips_gdbarch_init): Update.
+ * mcore-tdep.c (mcore_gdbarch_init): Update.
+ * m68k-tdep.c (m68k_gdbarch_init): Update.
+ * m68hc11-tdep.c (m68hc11_gdbarch_init): Update.
+ * ia64-tdep.c (ia64_gdbarch_init): Update.
+ * i386-tdep.c (i386_frame_num_args, i386_gdbarch_init): Update.
+ * i386-interix-tdep.c (i386_interix_init_abi): Update.
+ (i386_interix_back_one_frame): Update.
+ * hppa-tdep.c (hppa_gdbarch_init): Update.
+ (hppa_init_extra_frame_info): Update.
+ * h8300-tdep.c (h8300_gdbarch_init): Update.
+ * frv-tdep.c (frv_gdbarch_init): Update.
+ * cris-tdep.c (cris_gdbarch_init): Update.
+ * avr-tdep.c (avr_gdbarch_init): Update.
+ * arm-tdep.c (arm_gdbarch_init): Update.
+ * alpha-tdep.c (alpha_gdbarch_init): Update.
+
+2003-03-22 Richard Earnshaw <rearnsha@arm.com>
+
+ * arm-tdep.h (arm_float_model): Add AUTO and LAST values.
+ (arm_get_fp_model): Declare.
+ * arm-tdep.c (fp_model_strings): New string array.
+ (arm_fp_model, current_fp_model): New variables.
+ (arm_get_fp_model): New function.
+ (arm_set_fp): New function.
+ (set_fp_model_sfunc): New function.
+ (show_fp_model): New function.
+ (_initialize_arm_tdep): Add new command to set/show the FPU.
+ (arm_extract_return_value): Use arm_get_fp_model.
+ (arm_store_return_value): Likewise.
+ (arm_gdbarch_init): Default fpa model is softfpa. Call arm_set_fp
+ to initialize the floating-point data types.
+ * arm-linux-tdep.c (arm_linux_init_abi): The default floating point
+ model is FPA.
+
+2003-03-22 Richard Earnshaw <rearnsha@arm.com>
+
+ * arm-tdep.c (show_arm_command): Don't print out help. Instead, show
+ the current setting of each value.
+ (_initialize_arm_tdep): Delete variable new_cmd and add new vars
+ new_set and new_show. Use add_setshow_cmd_full and
+ add_setshow_boolean_cmd as appropriate. Deprecate "set/show apcs32"
+ commands and add new version as subcommands of "set/show arm".
+
+2003-03-22 Richard Earnshaw <rearnsha@arm.com>
+
+ * arm-tdep.c (setarmcmdlist, showarmcmdlist): New command lists.
+ (set_arm_command, show_arm_command): New functions.
+ (_initialize_arm_tdep): Add them.
+ (num_disassembly_options): Renamed from num_flavor_options.
+ (valid_disassembly_styles): Renamed from valid_flavors.
+ (disassembly_style): Renamed from disassembly_flavor.
+ (set_disassembly_style_sfunc): Renamed from
+ set_disassembly_flavor_sfunc.
+ (set_disassembly_style): Renamed from set_disassembly_flavor.
+ (arm_othernames): Updated.
+ (_initialize_arm_tdep): Deprecate "set/show disassembly-flavor"
+ command. Add "set/show arm disassembly" commands. Deprecate
+ "othernames" command.
+
+2003-03-22 Richard Earnshaw <rearnsha@arm.com>
+
+ * Makefile.in (elf_reloc_macros_h, elf_arm_h): Define.
+ (arm-tdep.o): Depend on elf_arm_h.
+
+2003-03-22 Richard Earnshaw <rearnsha@arm.com>
+
+ * Makefile.in (coff_internal_h): Define.
+ (arm-tdep.o): Update dependencies.
+
+2003-03-22 Richard Earnshaw <rearnsha@arm.com>
+
+ * arm-tdep.c (prologue_cache): Delete.
+ (check_prologue_cache, save_prologue_cache): Delete.
+ (arm_scan_prologue): Don't check or update the prologue_cache.
+ (arm_gdb_arch_init): Don't initialize it.
+ (_initialize_arm_tdep): Likewise.
+
+2003-03-21 Stephane Carrez <stcarrez@nerim.fr>
+
+ * MAINTAINERS (tui): Maintainer of tui code.
+
+2003-03-21 Corinna Vinschen <vinschen@redhat.com>
+
+ * Makefile.in (ALLDEPFILES): Add i386-cygwin-tdep.c.
+ (i386-cygwin-tdep.o): Add dependencies.
+ * defs.h (enum gdb_osabi): Add GDB_OSABI_CYGWIN.
+ * i386-cygwin-tdep.c: New file.
+ * osabi.c (gdb_osabi_name): Add string for GDB_OSABI_CYGWIN.
+ * config/i386/cygwin.mt (TDEPFILES): Add i386-cygwin-tdep.o.
+
+2003-03-20 Andrew Cagney <cagney@redhat.com>
+
+ * infrun.c (DYNAMIC_TRAMPOLINE_NEXTPC): Delete macro.
+ (handle_inferior_event): Remove code calling
+ DYNAMIC_TRAMPOLINE_NEXTPC.
+
+ * Makefile.in (init.c): Don't add $(srcdir) prefix when a file
+ already has a full path.
+
+ * main.c (gdb_main): Return 1.
+ (captured_main): Call error to report an invalid interpreter.
+
+ * Makefile.in (alpha-osf1-tdep.o): Update dependencies.
+ * alpha-osf1-tdep.c: Include "gdb_string.h".
+
+2003-03-19 J. Brobecker <brobecker@gnat.com>
+
+ Continuing work to convert the hppa targets to multiarch partial.
+
+ * hppa-tdep.c (hppa_gdbarch_init): Set the push_dummy_frame gdbarch
+ method, now that hppa_push_dummy_frame has a conformant prototype.
+ * config/pa/tm-hppa.h (DEPRECATED_PUSH_DUMMY_FRAME): Wrap macro
+ inside "#if !GDB_MULTI_ARCH ... #endif" conditional, in preparation
+ for the switch to multiarch partial.
+
+2003-03-19 Kevin Buettner <kevinb@redhat.com>
+
+ * mdebugread.c (parse_symbol): For stEnd, we're done counting
+ when iss is issNull.
+
+2003-03-18 Kevin Buettner <kevinb@redhat.com>
+
+ * mips-tdep.c (mips_register_name): Fix fencepost error involving
+ NUM_REGS bounds check.
+
+2003-03-18 Kevin Buettner <kevinb@redhat.com>
+
+ * Makefile.in (mips-tdep.o): Add dependency on $(gdb_assert_h).
+ * mips-tdep.c (gdb_assert.h): Include.
+ (mips_generic_reg_names, mips_processor_reg_names): Make static.
+ (mips_register_name): Handle integer registers explicitly. Add
+ bounds checking.
+ (mips_r3041_reg_names, mips_r3051_reg_names, mips_r3081_reg_names)
+ (mips_lsi33k_reg_names): Don't list integer registers; they're
+ handled by mips_register_name() now.
+ * config/mips/tm-irix3.h (MIPS_REGISTER_NAMES): Likewise.
+ * config/mips/tm-irix6.h (MIPS_REGISTER_NAMES): Likewise.
+ * config/mips/tm-mips.h (MIPS_REGISTER_NAMES): Likewise.
+ * config/mips/tm-tx39.h (MIPS_REGISTER_NAMES): Likewise.
+ * config/mips/tm-tx39l.h (MIPS_REGISTER_NAMES): Likewise.
+
+2003-03-18 Andrew Cagney <cagney@redhat.com>
+
+ * printcmd.c (print_scalar_formatted): Change VALADDR parameter to
+ a void pointer.
+ * gdbtypes.h (print_scalar_formatted): Update declaration.
+ * expression.h (enum exp_opcode): Remove non-ISO C trailing comma.
+
+2003-03-18 J. Brobecker <brobecker@gnat.com>
+
+ * infrun.c (observer.h): Add #include.
+ (normal_stop): Add call to observer_notify_normal_stop.
+ * Makefile.in (infrun.o): Add dependency on observer.h.
+
+2003-03-18 J. Brobecker <brobecker@gnat.com>
+
+ Continuing work to convert the hppa targets to multiarch partial.
+ * hppa-tdep.c (hppa_push_dummy_frame): Remove unused function
+ parameter. Reformat comment.
+ * config/pa/tm-hppa.h (hppa_push_dummy_frame): Update profile.
+ (DEPRECATED_PUSH_DUMMY_FRAME): Update call to hppa_push_dummy_frame()
+ to match new profile.
+
+2003-03-18 J. Brobecker <brobecker@gnat.com>
+
+ * hppa-tdep.c (hppa_push_dummy_frame): Remove hack which does not
+ appear to be working in any case.
+
+2003-03-18 J. Brobecker <brobecker@gnat.com>
+
+ * observer.c (observer_test_first_observer): New static variable.
+ (observer_test_second_observer): Likewise.
+ (observer_test_third_observer): Likewise.
+ (observer_test_first_notification_function): New static function.
+ (observer_test_second_notification_function): Likewise.
+ (observer_test_third_notification_function): Likewise.
+
+2003-03-17 J. Brobecker <brobecker@gnat.com>
+
+ * hppa-tdep.c (gdb_assert.h): Add missing #include.
+ * somsolib.c (gdb_assert.h): Likewise.
+ * Makefile.in (hppa-tdep.o): Add dependency on gdb_assert.h.
+ (somsolib.o): Likewise.
+
+2003-03-17 Andrew Cagney <cagney@redhat.com>
+
+ * disasm.c (gdb_disassembly): Set di.mach using the architecture's
+ BFD. Simplify setting of di.endian.
+
+2003-03-17 Andrew Cagney <cagney@redhat.com>
+
+ * rs6000-tdep.c (ppc_floating_point_unit_p): New function.
+ * ppc-tdep.h (ppc_floating_point_unit_p): Declare.
+
+ From Elena Zannoni <ezannoni@redhat.com>
+ * ppc-sysv-tdep.c (ppc_sysv_abi_push_arguments): Handle e500
+ vector and floating-point parameters.
+ (ppc_sysv_abi_use_struct_convention): Handle e500 struct return
+ convention.
+ (ppc_sysv_abi_broken_use_struct_convention): Ditto.
+
+2003-03-17 Fernando Nasser <fnasser@redhat.com>
+
+ * MAINTAINERS: Remove my name from several maintainership roles.
+
+2003-03-17 Andrew Cagney <cagney@redhat.com>
+
+ Fix frame off-by-one bug.
+ * frame-unwind.h (frame_this_id_ftype): Replace
+ frame_unwind_id_ftype.
+ (frame_prev_register_ftype): Replace frame_unwind_reg_ftype.
+ (struct frame_unwind): Replace "id" with "this_id". Replace "reg"
+ with "prev_register".
+ * frame-unwind.c (frame_unwind_find_by_pc): Return
+ legacy_saved_regs_unwind instead of trad_frame_unwind. Update
+ comment.
+ * dummy-frame.c (cached_find_dummy_frame): Delete function.
+ (dummy_frame_this_id): Replace dummy_frame_id_unwind.
+ (dummy_frame_prev_register): Replace dummy_frame_register_unwind.
+ (dummy_frame_unwind): Update.
+ * sentinel-frame.c (sentinel_frame_prev_register): Replace
+ sentinel_frame_register_unwind.
+ (sentinel_frame_this_id): Replace sentinel_frame_id_unwind.
+ (sentinel_frame_unwinder): Update.
+ * frame.h (legacy_saved_regs_unwind): Replace trad_frame_unwind.
+ (struct frame_info): Rename "unwind_cache" to "prologue_cache".
+ * frame.c (create_sentinel_frame): Update. Initialize
+ "prologue_cache" instead of "unwind_cache".
+ (frame_register_unwind): Call this frame's prev_register with the
+ next frame and this frame's prologue cache.
+ (get_prev_frame): Simplify. Always call prev frame's this_id with
+ this frame and prev frame's prologue cache. Document that this
+ call is shifted one to the left when compared to the
+ frame_register_unwind call.
+ (legacy_saved_regs_prev_register): Replace
+ frame_saved_regs_register_unwind.
+ (legacy_saved_regs_this_id): Replace frame_saved_regs_id_unwind.
+ (legacy_saved_regs_unwinder): Replace trad_frame_unwinder.
+ (legacy_saved_regs_unwind): Replace trad_frame_unwind.
+ * d10v-tdep.c (d10v_frame_this_id): Replace d10v_frame_id_unwind.
+ (d10v_frame_unwind): Update.
+ (d10v_frame_prev_register): Replace d10v_frame_register_unwind.
+ (d10v_frame_unwind_cache): Replace this "fi" with "next_frame".
+ (saved_regs_unwinder): Replace this "frame" with "next_frame", and
+ "saved_regs" with "this_saved_regs".
+
+2003-03-16 Andrew Cagney <cagney@redhat.com>
+
+ * frame.c (frame_pop): Don't call target_store_registers. Fix
+ problem reported by Mark Kettenis.
+
+2003-03-16 Mark Kettenis <kettenis@gnu.org>
+
+ * i386-tdep.c (i386_register_type): Renamed from
+ i386_register_virtual_type. Adjust function signature.
+ (i386_gdbarch_init): Set register_type instead of
+ deprecated_max_register_raw_size,
+ deprecated_max_register_virtual_size and register_virtual_type.
+
+2003-03-14 Andrew Cagney <cagney@redhat.com>
+
+ * frame.c (get_prev_frame): When a legacy frame, always call
+ legacy_get_prev_frame. Simplify unwind code using assumption that
+ the unwinder is new.
+ (legacy_get_prev_frame): Handle legacy sentinel frame unwind here.
+ (legacy_frame_p): When no gdbarch_unwind_dummy_id, or
+ SAVED_DUMMY_FRAME_TOS, assume a legacy frame.
+
+2003-03-14 Andrew Cagney <cagney@redhat.com>
+
+ * frame.c (get_saved_register): Delete function.
+ * frame.h (get_saved_register): Delete declaration.
+ * xstormy16-tdep.c: Update comment.
+ * regcache.h: Update comments.
+ * sparc-tdep.c (sparc_init_extra_frame_info): Instead of
+ get_saved_register and extract_address, use
+ frame_read_unsigned_register.
+ (sparc_frame_saved_pc): Ditto.
+ (sparc_get_saved_register): Instead of get_saved_register, use
+ frame_register.
+ (sparc_pop_frame): Ditto.
+ * findvar.c: Update comments.
+ (value_of_register): Call frame_register instead of
+ get_saved_register.
+ (value_from_register): Ditto.
+ * config/sparc/tm-sparc.h: Update comment.
+ * breakpoint.c: Update comment.
+
+2003-03-14 Andrew Cagney <cagney@redhat.com>
+
+ * gdbarch.sh (DEPRECATED_GET_SAVED_REGISTER): Replace
+ GET_SAVED_REGISTER.
+ * gdbarch.h, gdbarch.c: Re-generate.
+ * frame.h: Update comments.
+ * xstormy16-tdep.c (xstormy16_gdbarch_init): Update.
+ * x86-64-tdep.c (x86_64_init_abi): Update.
+ * sparc-tdep.c (sparc_gdbarch_init): Update.
+ * sh-tdep.c (sh_gdbarch_init): Update.
+ * mips-tdep.c (mips_gdbarch_init): Update.
+ * m68hc11-tdep.c (m68hc11_gdbarch_init): Update.
+ * cris-tdep.c (cris_gdbarch_init): Update.
+ * ia64-tdep.c (ia64_gdbarch_init): Update.
+ * frame.c (frame_register): Update.
+ (get_saved_register): Update.
+ * config/sparc/tm-sparc.h (DEPRECATED_GET_SAVED_REGISTER): Update.
+
+2003-03-13 Andrew Cagney <cagney@redhat.com>
+
+ * gdbarch.sh (DEPRECATED_POP_FRAME): Replace POP_FRAME.
+ * gdbarch.h, gdbarch.c: Regenerate.
+ * valops.c (hand_function_call): Update comment.
+ * stack.c (return_command): Update comment.
+ * config/sparc/tm-sparc.h (DEPRECATED_POP_FRAME): Update.
+ * config/pa/tm-hppa.h (DEPRECATED_POP_FRAME): Update.
+ * xstormy16-tdep.c (xstormy16_gdbarch_init): Update.
+ * x86-64-tdep.c (x86_64_init_abi): Update.
+ * vax-tdep.c (vax_gdbarch_init): Update.
+ * v850-tdep.c (v850_gdbarch_init): Update.
+ * sparc-tdep.c (sparc_gdbarch_init): Update.
+ * sh-tdep.c (sh_gdbarch_init): Update.
+ * s390-tdep.c (s390_gdbarch_init): Update.
+ * rs6000-tdep.c (rs6000_gdbarch_init): Update.
+ * ns32k-tdep.c (ns32k_gdbarch_init): Update.
+ * mn10300-tdep.c (mn10300_gdbarch_init): Update.
+ * mips-tdep.c (mips_gdbarch_init): Update.
+ * mcore-tdep.c (mcore_gdbarch_init): Update.
+ * m68k-tdep.c (m68k_gdbarch_init): Update.
+ * m68hc11-tdep.c (m68hc11_gdbarch_init): Update.
+ * ia64-tdep.c (ia64_gdbarch_init): Update.
+ * i386-tdep.c (i386_gdbarch_init): Update.
+ * hppa-tdep.c (hppa_gdbarch_init): Update.
+ * h8300-tdep.c (h8300_gdbarch_init): Update.
+ * frv-tdep.c (frv_gdbarch_init): Update.
+ * cris-tdep.c (cris_gdbarch_init): Update.
+ * avr-tdep.c (avr_gdbarch_init): Update.
+ * arm-tdep.c (arm_gdbarch_init): Update.
+ * alpha-tdep.c (alpha_gdbarch_init): Update.
+
+2003-03-13 Andrew Cagney <cagney@redhat.com>
+
+ * frame.c (legacy_frame_p): New function.
+ (get_prev_frame): Use legacy_frame_p.
+ * frame.h (legacy_frame_p): Declare.
+
+2003-03-13 D. Venkatasubramanian <dvenkat@noida.hcltech.com>
+
+ * MAINTAINERS (write after approval): Alphabetically
+ listing corrected.
+
+2003-03-13 D. Venkatasubramanian <dvenkat@noida.hcltech.com>
+
+ * MAINTAINERS (write after approval): Add myself.
+
+2003-03-12 Andrew Cagney <cagney@redhat.com>
+
+ * frame.c (get_prev_frame): Rename the frame parameter to
+ "this_frame".
+ (get_next_frame, legacy_get_prev_frame): Ditto.
+
+2003-03-12 Andrew Cagney <cagney@redhat.com>
+
+ * frame.c (get_current_frame): Check target_has_registers before
+ checking target_has_stack.
+ * eval.c (evaluate_subexp_standard): Use get_selected_frame,
+ instead of deprecated_selected_frame.
+ * findvar.c (value_of_register): Pass "frame", not
+ deprecated_selected_frame, to value_of_builtin_reg.
+
+2003-03-12 Andrew Cagney <cagney@redhat.com>
+
+ * regcache.c (regcache_cooked_write_signed): New function.
+ (regcache_cooked_write_unsigned): New function.
+ (regcache_cooked_read_unsigned): Fix regnum in range assertion.
+ (regcache_cooked_read_signed): Fix regnum in range assertion.
+ * regcache.h (regcache_cooked_write_signed): Declare.
+ (regcache_cooked_write_unsigned): Declare.
+
+2003-03-12 Andrew Cagney <cagney@redhat.com>
+
+ * gdbarch.sh (DEPRECATED_FRAME_SAVED_PC): Replace FRAME_SAVED_PC.
+ * gdbarch.h, gdbarch.c: Re-generate.
+ * xstormy16-tdep.c (xstormy16_gdbarch_init): Update.
+ * x86-64-tdep.h: Update.
+ * x86-64-tdep.c (x86_64_init_abi): Update.
+ * v850-tdep.c (v850_gdbarch_init): Update.
+ * sparc-tdep.c (sparc_gdbarch_init): Update.
+ * sh-tdep.c (sh_gdbarch_init): Update.
+ * s390-tdep.c (s390_gdbarch_init): Update.
+ * rs6000-tdep.c (rs6000_gdbarch_init): Update.
+ * ppc-linux-tdep.c (ppc_linux_init_abi): Update.
+ * ns32k-tdep.c (ns32k_gdbarch_init): Update.
+ * mn10300-tdep.c (mn10300_gdbarch_init): Update.
+ * mips-tdep.c (mips_gdbarch_init): Update.
+ * mcore-tdep.c (mcore_gdbarch_init): Update.
+ * m68k-tdep.c (m68k_gdbarch_init): Update.
+ * m68hc11-tdep.c (m68hc11_gdbarch_init): Update.
+ * ia64-tdep.c (ia64_gdbarch_init): Update.
+ * i386-tdep.c (i386_gdbarch_init): Update.
+ * i386-interix-tdep.c (i386_interix_init_abi): Update.
+ * hppa-tdep.c (hppa_gdbarch_init): Update.
+ * h8300-tdep.c (h8300_gdbarch_init): Update.
+ * frv-tdep.c (frv_gdbarch_init): Update.
+ * cris-tdep.c (cris_gdbarch_init): Update.
+ * avr-tdep.c (avr_gdbarch_init): Update.
+ * arm-tdep.c (arm_gdbarch_init): Update.
+ * alpha-tdep.c (alpha_gdbarch_init): Update.
+ * sh-tdep.c (sh_init_extra_frame_info): Update.
+ (sh64_init_extra_frame_info): Update.
+ * ns32knbsd-nat.c (frame_num_args): Update.
+ * m68hc11-tdep.c (m68hc11_init_extra_frame_info): Update.
+ * xstormy16-tdep.c (xstormy16_pop_frame): Update.
+ (xstormy16_frame_chain_valid): Update.
+ * vax-tdep.c (vax_saved_pc_after_call): Update.
+ * v850-tdep.c (v850_frame_chain): Update.
+ (v850_pop_frame): Update.
+ (v850_init_extra_frame_info): Update.
+ * sparc-tdep.c (setup_arbitrary_frame): Update.
+ * ns32k-tdep.c (umax_frame_num_args): Update.
+ * s390-tdep.c (s390_pop_frame_regular): Update.
+ * mn10300-tdep.c (mn10300_frame_chain): Update.
+ (mn10300_pop_frame_regular): Update.
+ (mn10300_init_extra_frame_info): Update.
+ * mips-tdep.c (mips_init_frame_pc_first): Update.
+ (mips_frame_chain): Update.
+ (mips_pop_frame): Update.
+ * mcore-tdep.c (mcore_frame_chain): Update.
+ (mcore_pop_frame): Update.
+ (mcore_init_extra_frame_info): Update.
+ * arch-utils.c (init_frame_pc_default): Update.
+ * m68k-tdep.c (isi_frame_num_args): Update.
+ (delta68_frame_num_args): Update.
+ (news_frame_num_args): Update.
+ * ia64-tdep.c (ia64_pop_frame_regular): Update.
+ * alpha-tdep.c (alpha_init_frame_pc_first): Update.
+ (alpha_frame_chain): Update.
+ (alpha_pop_frame): Update.
+ * hppa-tdep.c (hppa_saved_pc_after_call): Update.
+ (hppa_init_extra_frame_info): Update.
+ (hppa_frame_chain): Update.
+ (hppa_frame_chain_valid): Update.
+ * cris-tdep.c (cris_init_extra_frame_info): Update.
+ * avr-tdep.c (avr_init_extra_frame_info): Update.
+ * arm-tdep.c (arm_frame_chain_valid): Update.
+ (arm_init_extra_frame_info): Update.
+ (arm_pop_frame): Update.
+ * frame.c (frame_pc_unwind): Update.
+ * config/sparc/tm-sparc.h (DEPRECATED_FRAME_SAVED_PC): Update.
+ (DEPRECATED_INIT_FRAME_PC_FIRST): Update.
+ * config/rs6000/tm-rs6000.h (DEPRECATED_INIT_FRAME_PC_FIRST): Update.
+ * config/pa/tm-hppa.h (DEPRECATED_FRAME_SAVED_PC): Update.
+ * config/m68k/tm-delta68.h (DEPRECATED_FRAME_SAVED_PC): Update.
+ * config/m68k/tm-linux.h (DEPRECATED_FRAME_SAVED_PC): Update.
+
+2003-03-12 Andrew Cagney <cagney@redhat.com>
+
+ Eliminate the need for POP_FRAME.
+ * frame.c (do_frame_unwind_register): New function.
+ (frame_pop): When no POP_FRAME, pop the frame using register
+ unwind and a scratch regcache.
+ (frame_saved_regs_pop): Delete function.
+ (trad_frame_unwinder): Update.
+ * d10v-tdep.c (d10v_frame_pop): Delete function.
+ (d10v_frame_unwind): Update.
+ * sentinel-frame.c (sentinel_frame_pop): Delete function.
+ (sentinel_frame_unwinder): Update.
+ * dummy-frame.c (dummy_frame_pop): Delete function.
+ (dummy_frame_unwind): Update.
+ * frame-unwind.h (frame_unwind_pop_ftype): Delete definition.
+ (struct frame_unwind): Update.
+
+2003-03-11 Kevin Buettner <kevinb@redhat.com>
+
+ * mips-tdep.c (mips_ecoff_reg_to_regnum): Rename to
+ mips_dwarf_dwarf2_ecoff_reg_to_regnum().
+ (mips_dwarf_dwarf2_ecoff_reg_to_regnum, mips_stab_reg_to_regnum):
+ Do range checks on register number obtained from debugging info.
+ (mips_gdbarch_init): Call set_gdbarch_dwarf_reg_to_regnum() and
+ set_gdbarch_dwarf2_reg_to_regnum(). Adjust call of
+ set_gdbarch_ecoff_reg_to_regnum() to account for new name of
+ mapping function.
+ (do_fp_register_row): Fix typo which caused double type to be
+ used when attempting to unpack a float.
+
+2003-03-11 J. Brobecker <brobecker@gnat.com>
+
+ * breakpoint.c (bpstat_stop_status): Fix a small memory leak.
+
+2003-03-11 Andrew Cagney <cagney@redhat.com>
+
+ * frame.c (deprecated_update_frame_pc_hack): Don't assume a next
+ frame. Problem found by Corinna Vinschen.
+
+2003-03-11 Pierre Muller <muller@ics.u-strasbg.fr>
+
+ * doublest.c (floatformat_from_length): Accept also
+ the real size of 'long double' type.
+
+2003-03-10 Daniel Jacobowitz <drow@mvista.com>
+
+ From Klee Dienes <kdienes@apple.com>:
+ * breakpoint.c (bpstat_copy): Copy the command lines as well
+ as the old value, to match what is freed in bpstat_clear.
+
+2003-03-10 David Carlton <carlton@math.stanford.edu>
+
+ * minsyms.c (add_minsym_to_hash_table): Replace
+ DEPRECATED_SYMBOL_NAME by SYMBOL_LINKAGE_NAME.
+ (compare_minimal_symbols, compact_minimal_symbols)
+ (install_minimal_symbols, find_solib_trampoline_target): Ditto.
+ (lookup_minimal_symbol_text): Use strcmp on linkage names instead
+ of DEPRECATED_SYMBOL_MATCHES_NAME.
+ (lookup_minimal_symbol_solib_trampoline): Ditto.
+
+2003-03-10 Andrew Cagney <cagney@redhat.com>
+
+ * regcache.h (regcache_cooked_read_ftype): Define.
+ (regcache_save, regcache_restore): Add a cooked_read parameter.
+ * regcache.c (regcache_save, regcache_restore): Update.
+ (do_cooked_read): New function.
+ (regcache_cpy): Pass do_cooked_read to regcache_save and
+ regcache_restore.
+
+2003-03-10 Andrew Cagney <cagney@redhat.com>
+
+ * gdbarch.sh (DEPRECATED_FRAME_SAVED_PC): Replace FRAME_SAVED_PC.
+ * gdbarch.h, gdbarch.c: Re-generate.
+ * xstormy16-tdep.c (xstormy16_gdbarch_init): Update.
+ * x86-64-tdep.h: Update.
+ * x86-64-tdep.c (x86_64_init_abi): Update.
+ * v850-tdep.c (v850_gdbarch_init): Update.
+ * sparc-tdep.c (sparc_gdbarch_init): Update.
+ * sh-tdep.c (sh_gdbarch_init): Update.
+ * s390-tdep.c (s390_gdbarch_init): Update.
+ * rs6000-tdep.c (rs6000_gdbarch_init): Update.
+ * ppc-linux-tdep.c (ppc_linux_init_abi): Update.
+ * ns32k-tdep.c (ns32k_gdbarch_init): Update.
+ * mn10300-tdep.c (mn10300_gdbarch_init): Update.
+ * mips-tdep.c (mips_gdbarch_init): Update.
+ * mcore-tdep.c (mcore_gdbarch_init): Update.
+ * m68k-tdep.c (m68k_gdbarch_init): Update.
+ * m68hc11-tdep.c (m68hc11_gdbarch_init): Update.
+ * ia64-tdep.c (ia64_gdbarch_init): Update.
+ * i386-tdep.c (i386_gdbarch_init): Update.
+ * i386-interix-tdep.c (i386_interix_init_abi): Update.
+ * hppa-tdep.c (hppa_gdbarch_init): Update.
+ * h8300-tdep.c (h8300_gdbarch_init): Update.
+ * frv-tdep.c (frv_gdbarch_init): Update.
+ * cris-tdep.c (cris_gdbarch_init): Update.
+ * avr-tdep.c (avr_gdbarch_init): Update.
+ * arm-tdep.c (arm_gdbarch_init): Update.
+ * alpha-tdep.c (alpha_gdbarch_init): Update.
+ * sh-tdep.c (sh_init_extra_frame_info): Update.
+ (sh64_init_extra_frame_info): Update.
+ * ns32knbsd-nat.c (frame_num_args): Update.
+ * m68hc11-tdep.c (m68hc11_init_extra_frame_info): Update.
+ * xstormy16-tdep.c (xstormy16_pop_frame): Update.
+ (xstormy16_frame_chain_valid): Update.
+ * vax-tdep.c (vax_saved_pc_after_call): Update.
+ * v850-tdep.c (v850_frame_chain): Update.
+ (v850_pop_frame): Update.
+ (v850_init_extra_frame_info): Update.
+ * sparc-tdep.c (setup_arbitrary_frame): Update.
+ * ns32k-tdep.c (umax_frame_num_args): Update.
+ * s390-tdep.c (s390_pop_frame_regular): Update.
+ * mn10300-tdep.c (mn10300_frame_chain): Update.
+ (mn10300_pop_frame_regular): Update.
+ (mn10300_init_extra_frame_info): Update.
+ * mips-tdep.c (mips_init_frame_pc_first): Update.
+ (mips_frame_chain): Update.
+ (mips_pop_frame): Update.
+ * mcore-tdep.c (mcore_frame_chain): Update.
+ (mcore_pop_frame): Update.
+ (mcore_init_extra_frame_info): Update.
+ * arch-utils.c (init_frame_pc_default): Update.
+ * m68k-tdep.c (isi_frame_num_args): Update.
+ (delta68_frame_num_args): Update.
+ (news_frame_num_args): Update.
+ * ia64-tdep.c (ia64_pop_frame_regular): Update.
+ * alpha-tdep.c (alpha_init_frame_pc_first): Update.
+ (alpha_frame_chain): Update.
+ (alpha_pop_frame): Update.
+ * hppa-tdep.c (hppa_saved_pc_after_call): Update.
+ (hppa_init_extra_frame_info): Update.
+ (hppa_frame_chain): Update.
+ (hppa_frame_chain_valid): Update.
+ * cris-tdep.c (cris_init_extra_frame_info): Update.
+ * avr-tdep.c (avr_init_extra_frame_info): Update.
+ * arm-tdep.c (arm_frame_chain_valid): Update.
+ (arm_init_extra_frame_info): Update.
+ (arm_pop_frame): Update.
+ * frame.c (frame_pc_unwind): Update.
+ * config/sparc/tm-sparc.h (DEPRECATED_FRAME_SAVED_PC): Update.
+ (DEPRECATED_INIT_FRAME_PC_FIRST): Update.
+ * config/rs6000/tm-rs6000.h (DEPRECATED_INIT_FRAME_PC_FIRST): Update.
+ * config/pa/tm-hppa.h (DEPRECATED_FRAME_SAVED_PC): Update.
+ * config/m68k/tm-delta68.h (DEPRECATED_FRAME_SAVED_PC): Update.
+ * config/m68k/tm-linux.h (DEPRECATED_FRAME_SAVED_PC): Update.
+
+2003-03-10 Andrew Cagney <cagney@redhat.com>
+
+ * gdbarch.sh (gdbarch_unwind_pc): New method.
+ * gdbarch.h, gdbarch.c: Regenerate.
+ * frame.c (frame_pc_unwind): Rewrite. Prefer gdbarch_unwind_pc,
+ but use read_pc and FRAME_SAVED_PC as fall backs.
+ (frame_saved_regs_pc_unwind): Delete function.
+ (trad_frame_unwinder): Update.
+ * frame-unwind.h (frame_unwind_pc_ftype): Delete declaration.
+ (struct frame_unwind): Update.
+ * dummy-frame.c (dummy_frame_pc_unwind): Delete function.
+ (dummy_frame_unwind): Update.
+ * sentinel-frame.c (sentinel_frame_pc_unwind): Delete function.
+ (sentinel_frame_unwinder): Update.
+ * d10v-tdep.c (d10v_frame_pc_unwind): Delete function.
+ (d10v_frame_unwind): Update.
+ (d10v_unwind_pc): New function.
+ (d10v_gdbarch_init): Set unwind_pc.
+
+2003-03-10 Andrew Cagney <cagney@redhat.com>
+
+ * gdbarch.h: Re-generate.
+
+ * d10v-tdep.c (d10v_frame_register_unwind): Correctly unwind the
+ PC.
+ (d10v_frame_pop): Unwind the PC, and not the LR, when restoring
+ the PC register.
+
+2003-03-08 Mark Kettenis <kettenis@gnu.org>
+
+ * gdbarch.sh (save_dummy_frame_tos): Add comment.
+
+2003-03-08 Andrew Cagney <cagney@redhat.com>
+
+ * cli-out.c: Update copyright.
+ (cli_out_data): Define typedef. Use instead of ui_out_data.
+
+2003-03-08 Andrew Cagney <cagney@redhat.com>
+
+ * valarith.c (value_subscripted_rvalue): Copy the array's REGNO to
+ the result.
+
+2003-03-07 Andrew Cagney <cagney@redhat.com>
+
+ * gdbarch.sh: Don't generate two macro definitions when an
+ undefined macro taking no arguments.
+ * gdbarch.h: Regenerate.
+
+2002-03-07 Michal Ludvig <mludvig@suse.cz>
+
+ * x86-64-tdep.c (x86_64_save_dummy_frame_tos)
+ (x86_64_unwind_dummy_id): New functions.
+ (x86_64_init_abi): Register these two new functions.
+
+2003-03-07 Michal Ludvig <mludvig@suse.cz>
+
+ * x86-64-tdep.c (x86_64_function_has_prologue): New function.
+ (x86_64_skip_prologue): Move prologue detection to
+ separate function.
+ * x86-64-tdep.h (x86_64_function_has_prologue): New prototype.
+
+2003-03-05 Andrew Cagney <cagney@redhat.com>
+
+ * d10v-tdep.c (d10v_unwind_dummy_id): New function.
+ (d10v_gdbarch_init): Set unwind_dummy_id and save_dummy_frame_tos.
+ * frame.c (get_prev_frame): Restructure the frame ID unwind code
+ to use unwind_dummy_id when a dummy frame.
+ * gdbarch.sh (unwind_dummy_id): New multi-arch method with
+ predicate.
+ * gdbarch.h, gdbarch.c: Regneerate.
+
+2003-03-05 Andrew Cagney <cagney@redhat.com>
+
+ * d10v-tdep.c (struct d10v_unwind_cache): Add field "base".
+ (d10v_frame_unwind_cache): Rewrite code computing the base and SP.
+ Do not use d10v_read_sp or d10v_read_fp when obtaining register
+ values.
+
2003-03-10 David Carlton <carlton@math.stanford.edu>
* buildsym.c (scan_for_anonymous_namespaces): Allow
@@ -426,7 +2546,6 @@
* f-lang.c (build_fortran_types): New function.
(_initialize_f_language): Gdbarch-register built-in fortran types.
-
* doublest.c (extract_floating): Fix warning text.
2003-02-27 Andrew Cagney <cagney@redhat.com>
@@ -986,7 +3105,6 @@
* gdbtypes.c (make_qualified_type): Set length on newly created type.
(replace_type): Set length on all type variants for a given type.
->>>>>>> 1.3924
2003-02-27 David Carlton <carlton@math.stanford.edu>
* symtab.c (lookup_symbol_aux_namespace_scope): Rename from
diff --git a/gdb/MAINTAINERS b/gdb/MAINTAINERS
index 6315888..15a0ea8 100644
--- a/gdb/MAINTAINERS
+++ b/gdb/MAINTAINERS
@@ -63,7 +63,6 @@ maintainer works with the native maintainer when resolving API issues.
arc Deleted.
arm --target=arm-elf ,-Werror
- Fernando Nasser fnasser@redhat.com
Scott Bambrough scottb@netwinder.org
Richard Earnshaw rearnsha@arm.com
@@ -225,7 +224,6 @@ generic symtabs Jim Blandy jimb@redhat.com
xcoff reader Any maintainer can modify this; please send tricky
ones to Kevin Buettner <kevinb@redhat.com>
linespec Elena Zannoni ezannoni@redhat.com
- Fernando Nasser fnasser@redhat.com
HP/UX readers Any [past] maintainer can modify this.
Please send tricky ones to the symtabs maintainers.
@@ -245,12 +243,13 @@ shared libs (devolved) Kevin Buettner kevinb@redhat.com
remote.c Andrew Cagney cagney@redhat.com
include/remote-sim.h, remote-sim.c
Andrew Cagney cagney@redhat.com
-sds protocol Fernando Nasser fnasser@redhat.com
-rdi/adp protocol Fernando Nasser fnasser@redhat.com
+sds protocol (vacant)
+rdi/adp protocol (vacant)
documentation Eli Zaretskii eliz@gnu.org
-testsuite Fernando Nasser fnasser@redhat.com
+testsuite (Global Maintainers)
config Mark Salter msalter@redhat.com
- lib Mark Salter msalter@redhat.com
+ lib Fernando Nasser fnasser@redhat.com
+ Mark Salter msalter@redhat.com
gdbtk (gdb.gdbtk) Keith Seitz keiths@redhat.com
c++ (gdb.c++) Michael Chastain mec@shout.net
David Carlton carlton@math.stanford.edu
@@ -266,7 +265,7 @@ Kernel Object Display Fernando Nasser fnasser@redhat.com
UI: External (user) interfaces.
-command interpreter Fernando Nasser fnasser@redhat.com
+command interpreter (Global Maintainers)
gdbtk (c & tcl) Jim Ingham jingham@apple.com
Fernando Nasser fnasser@redhat.com
Keith Seitz keiths@redhat.com
@@ -275,8 +274,8 @@ libgui (w/foundry, sn) Jim Ingham jingham@apple.com
mi (gdb/mi) Andrew Cagney cagney@redhat.com
Elena Zannoni ezannoni@redhat.com
Fernando Nasser fnasser@redhat.com
-tui (vacant)
- Technical Contact Point wdb@cup.hp.com
+tui Stephane Carrez stcarrez@nerim.fr
+ (Global Maintainers)
Misc:
@@ -368,6 +367,7 @@ Hans-Peter Nilsson hp@bitrange.com
David O'Brien obrien@freebsd.org
Alexandre Oliva aoliva@redhat.com
Tom Rix trix@redhat.com
+Bob Rossi bob_rossi@cox.net
Theodore A. Roth troth@verinet.com
Ian Roxborough irox@redhat.com
Grace Sainsbury graces@redhat.com
@@ -386,6 +386,7 @@ Petr Sorfa petrs@caldera.com
Gary Thomas gthomas@redhat.com
Jason Thorpe thorpej@wasabisystems.com
Tom Tromey tromey@redhat.com
+D Venkatasubramanian dvenkat@noida.hcltech.com
Corinna Vinschen vinschen@redhat.com
Keith Walker keith.walker@arm.com
Kris Warkentin kewarken@qnx.com
diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index ddc1e66..dffb8aa 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -168,14 +168,14 @@ SUBDIR_CLI_UNINSTALL=
SUBDIR_MI_OBS = \
mi-out.o mi-console.o \
mi-cmds.o mi-cmd-env.o mi-cmd-var.o mi-cmd-break.o mi-cmd-stack.o \
- mi-cmd-disas.o \
+ mi-cmd-file.o mi-cmd-disas.o \
mi-interp.o \
mi-main.o mi-parse.o mi-getopt.o
SUBDIR_MI_SRCS = \
mi/mi-out.c mi/mi-console.c \
mi/mi-cmds.c mi/mi-cmd-env.c \
mi/mi-cmd-var.c mi/mi-cmd-break.c mi/mi-cmd-stack.c \
- mi/mi-cmd-disas.c \
+ mi/mi-cmd-file.c mi/mi-cmd-disas.c \
mi/mi-interp.c \
mi/mi-main.c mi/mi-parse.c mi/mi-getopt.c
SUBDIR_MI_DEPS =
@@ -512,11 +512,12 @@ SFILES = ada-exp.y ada-lang.c ada-typeprint.c ada-valprint.c ada-tasks.c \
c-exp.y c-lang.c c-typeprint.c c-valprint.c \
charset.c cli-out.c coffread.c coff-pe-read.c \
complaints.c completer.c corefile.c \
- cp-abi.c cp-support.c cp-valprint.c \
+ cp-abi.c cp-support.c cp-namespace.c cp-valprint.c \
dbxread.c demangle.c dictionary.c disasm.c doublest.c \
dummy-frame.c dwarfread.c dwarf2expr.c dwarf2loc.c dwarf2read.c \
elfread.c environ.c eval.c event-loop.c event-top.c expprint.c \
f-exp.y f-lang.c f-typeprint.c f-valprint.c findvar.c frame.c \
+ frame-base.c \
frame-unwind.c \
gdbarch.c arch-utils.c gdbtypes.c gnu-v2-abi.c gnu-v3-abi.c \
hpacc-abi.c \
@@ -566,10 +567,14 @@ callback_h = $(INCLUDE_DIR)/gdb/callback.h
coff_sym_h = $(INCLUDE_DIR)/coff/sym.h
coff_symconst_h = $(INCLUDE_DIR)/coff/symconst.h
coff_ecoff_h = $(INCLUDE_DIR)/coff/ecoff.h
+coff_internal_h = $(INCLUDE_DIR)/coff/internal.h
dis_asm_h = $(INCLUDE_DIR)/dis-asm.h
+elf_reloc_macros_h = $(INCLUDE_DIR)/elf/reloc-macros.h
elf_sh_h = $(INCLUDE_DIR)/elf/sh.h
+elf_arm_h = $(INCLUDE_DIR)/elf/arm.h $(elf_reloc_macros_h)
elf_bfd_h = $(BFD_SRC)/elf-bfd.h
libaout_h = $(BFD_SRC)/libaout.h
+libbfd_h = $(BFD_SRC)/libbfd.h
remote_sim_h = $(INCLUDE_DIR)/gdb/remote-sim.h
demangle_h = $(INCLUDE_DIR)/demangle.h
obstack_h = $(INCLUDE_DIR)/obstack.h
@@ -638,7 +643,8 @@ event_top_h = event-top.h
expression_h = expression.h $(symtab_h) $(doublest_h)
f_lang_h = f-lang.h
frame_h = frame.h
-frame_unwind_h = frame-unwind.h
+frame_unwind_h = frame-unwind.h $(frame_h)
+frame_base_h = frame-base.h
gdb_events_h = gdb-events.h
gdb_stabs_h = gdb-stabs.h
gdb_h = gdb.h
@@ -720,6 +726,7 @@ symtab_h = symtab.h
target_h = target.h $(bfd_h) $(symtab_h) $(dcache_h) $(memattr_h)
terminal_h = terminal.h
top_h = top.h
+infttrace_h = infttrace.h
tracepoint_h = tracepoint.h
typeprint_h = typeprint.h
ui_file_h = ui-file.h
@@ -856,7 +863,9 @@ COMMON_OBS = version.o block.o blockframe.o breakpoint.o findvar.o regcache.o \
nlmread.o serial.o mdebugread.o top.o utils.o \
ui-file.o \
frame.o frame-unwind.o doublest.o \
+ frame-base.o \
gnu-v2-abi.o gnu-v3-abi.o hpacc-abi.o cp-abi.o cp-support.o \
+ cp-namespace.o \
reggroups.o
OBS = $(COMMON_OBS) $(ANNOTATE_OBS)
@@ -872,6 +881,7 @@ YYFILES = c-exp.tab.c \
jv-exp.tab.c \
f-exp.tab.c m2-exp.tab.c p-exp.tab.c
YYOBJ = c-exp.tab.o \
+ objc-exp.tab.o \
jv-exp.tab.o \
f-exp.tab.o m2-exp.tab.o p-exp.tab.o
@@ -967,6 +977,13 @@ uninstall: force $(CONFIG_UNINSTALL)
# everything else. The catch is that other modules still take the
# address of these builtin types forcing them to be variables, sigh!
+# NOTE: cagney/2003-03-18: The sed pattern ``s|^\([^ /]...'' is
+# anchored on the first column and excludes the ``/'' character so
+# that it doesn't add the $(srcdir) prefix to any file that already
+# has an absolute path. It turns out that $(DEC)'s True64 make
+# automatically adds the $(srcdir) prefixes when it encounters files
+# in sub-directories such as cli/ and mi/.
+
INIT_FILES = $(OBS) $(TSOBS) $(CONFIG_OBS) $(CONFIG_INITS)
init.c: $(INIT_FILES)
@echo Making init.c
@@ -986,7 +1003,7 @@ init.c: $(INIT_FILES)
-e '/[a-z0-9A-Z_]*-exp.tab.o/d' \
-e 's/\.o/.c/' \
-e 's,signals\.c,signals/signals\.c,' \
- -e 's|\([^ ][^ ]*\)|$(srcdir)/\1|g' | \
+ -e 's|^\([^ /][^ ]*\)|$(srcdir)/\1|g' | \
while read f; do grep '^_initialize_[a-z_0-9A-Z]* *(' $$f 2>/dev/null; done | \
sed -e 's/^.*://' -e 's/^\([a-z_0-9A-Z]*\).*/\1/' | \
( echo _initialize_gdbtypes ; grep -v '^_initialize_gdbtypes$$' ) > init.l-tmp
@@ -1345,7 +1362,7 @@ ALLDEPFILES = \
hppa-tdep.c hppa-hpux-tdep.c \
hppab-nat.c hppah-nat.c hpread.c \
i386-tdep.c i386b-nat.c i386v-nat.c i386-linux-nat.c \
- i386v4-nat.c i386ly-tdep.c \
+ i386v4-nat.c i386ly-tdep.c i386-cygwin-tdep.c \
i386bsd-nat.c i386bsd-tdep.c i386fbsd-nat.c \
i387-tdep.c \
i386-linux-tdep.c i386-nat.c \
@@ -1492,7 +1509,7 @@ alpha-linux-tdep.o: alpha-linux-tdep.c $(defs_h) $(frame_h) $(gdbcore_h) \
alpha-nat.o: alpha-nat.c $(defs_h) $(inferior_h) $(gdbcore_h) $(target_h) \
$(regcache_h) $(alpha_tdep_h) $(gregset_h) $(gdb_string_h)
alpha-osf1-tdep.o: alpha-osf1-tdep.c $(defs_h) $(frame_h) $(gdbcore_h) \
- $(value_h) $(alpha_tdep_h) $(osabi_h)
+ $(value_h) $(osabi_h) $(gdb_string_h) $(alpha_tdep_h)
alpha-tdep.o: alpha-tdep.c $(defs_h) $(frame_h) $(inferior_h) $(symtab_h) \
$(value_h) $(gdbcmd_h) $(gdbcore_h) $(dis_asm_h) $(symfile_h) \
$(objfiles_h) $(gdb_string_h) $(linespec_h) $(regcache_h) \
@@ -1522,9 +1539,9 @@ arm-linux-tdep.o: arm-linux-tdep.c $(defs_h) $(target_h) $(value_h) \
$(osabi_h)
arm-tdep.o: arm-tdep.c $(defs_h) $(frame_h) $(inferior_h) $(gdbcmd_h) \
$(gdbcore_h) $(symfile_h) $(gdb_string_h) $(dis_asm_h) $(regcache_h) \
- $(doublest_h) $(value_h) $(arch_utils_h) $(solib_svr4_h) \
- $(arm_tdep_h) $(gdb_sim_arm_h) $(elf_bfd_h) $(coff_internal_h) \
- $(elf_arm_h) $(gdb_assert_h) $(bfd_in2_h) $(libcoff_h) $(osabi_h)
+ $(doublest_h) $(value_h) $(arch_utils_h) $(solib_svr4_h) $(osabi_h) \
+ $(arm_tdep_h) $(sim_arm_h) $(elf_bfd_h) $(coff_internal_h) \
+ $(elf_arm_h) $(gdb_assert_h)
armnbsd-nat.o: armnbsd-nat.c $(defs_h) $(arm_tdep_h) $(inferior_h) \
$(regcache_h) $(gdbcore_h)
armnbsd-tdep.o: armnbsd-tdep.c $(defs_h) $(arm_tdep_h) $(nbsd_tdep_h) \
@@ -1554,13 +1571,13 @@ buildsym.o: buildsym.c $(defs_h) $(bfd_h) $(gdb_obstack_h) $(symtab_h) \
$(symfile_h) $(objfiles_h) $(gdbtypes_h) $(gdb_assert_h) \
$(complaints_h) $(gdb_string_h) $(expression_h) $(language_h) \
$(bcache_h) $(filenames_h) $(macrotab_h) $(demangle_h) $(buildsym_h) \
- $(stabsread_h) $(block_h) $(dictionary_h) $(cp_support_h) \
- $(stabsread_h) $(block_h)
+ $(stabsread_h) $(block_h) $(dictionary_h) $(cp_support_h)
builtin-regs.o: builtin-regs.c $(defs_h) $(builtin_regs_h) $(gdbtypes_h) \
$(gdb_string_h) $(gdb_assert_h)
c-lang.o: c-lang.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(expression_h) \
$(parser_defs_h) $(language_h) $(c_lang_h) $(valprint_h) \
- $(macroscope_h) $(gdb_assert_h) $(charset_h) $(gdb_string_h)
+ $(macroscope_h) $(gdb_assert_h) $(charset_h) $(gdb_string_h) \
+ $(demangle_h)
c-typeprint.o: c-typeprint.c $(defs_h) $(gdb_obstack_h) $(bfd_h) $(symtab_h) \
$(gdbtypes_h) $(expression_h) $(value_h) $(gdbcore_h) $(target_h) \
$(language_h) $(demangle_h) $(c_lang_h) $(typeprint_h) $(cp_abi_h) \
@@ -1601,8 +1618,10 @@ corelow.o: corelow.c $(defs_h) $(gdb_string_h) $(frame_h) $(inferior_h) \
$(gdbthread_h) $(regcache_h) $(symfile_h) $(readline_h)
cp-abi.o: cp-abi.c $(defs_h) $(value_h) $(cp_abi_h) $(command_h) \
$(gdbcmd_h) $(ui_out_h) $(gdb_string_h)
+cp-namespace.o: cp-namespace.c $(defs_h) $(cp_support_h) $(gdb_obstack_h) \
+ $(symtab_h) $(symfile_h) $(gdb_assert_h) $(block_h)
cp-support.o: cp-support.c $(defs_h) $(cp_support_h) $(gdb_string_h) \
- $(demangle_h) $(gdb_obstack_h) $(gdb_assert_h) $(symtab_h) \
+ $(demangle_h) $(gdb_assert_h) $(gdb_obstack_h) $(symtab_h) \
$(symfile_h) $(block_h) $(objfiles_h) $(gdbtypes_h) $(dictionary_h) \
$(gdbcmd_h)
cp-valprint.o: cp-valprint.c $(defs_h) $(gdb_obstack_h) $(symtab_h) \
@@ -1615,10 +1634,11 @@ cris-tdep.o: cris-tdep.c $(defs_h) $(frame_h) $(symtab_h) $(inferior_h) \
$(gdbtypes_h) $(gdbcore_h) $(gdbcmd_h) $(target_h) $(value_h) \
$(opcode_cris_h) $(arch_utils_h) $(regcache_h) $(symfile_h) \
$(solib_h) $(solib_svr4_h) $(gdb_string_h)
-d10v-tdep.o: d10v-tdep.c $(defs_h) $(frame_h) $(symtab_h) $(gdbtypes_h) \
- $(gdbcmd_h) $(gdbcore_h) $(gdb_string_h) $(value_h) $(inferior_h) \
- $(dis_asm_h) $(symfile_h) $(objfiles_h) $(language_h) $(arch_utils_h) \
- $(regcache_h) $(floatformat_h) $(gdb_sim_d10v_h) $(sim_regno_h) \
+d10v-tdep.o: d10v-tdep.c $(defs_h) $(frame_h) $(frame_unwind_h) \
+ $(frame_base_h) $(symtab_h) $(gdbtypes_h) $(gdbcmd_h) $(gdbcore_h) \
+ $(gdb_string_h) $(value_h) $(inferior_h) $(dis_asm_h) $(symfile_h) \
+ $(objfiles_h) $(language_h) $(arch_utils_h) $(regcache_h) \
+ $(remote_h) $(floatformat_h) $(gdb_sim_d10v_h) $(sim_regno_h) \
$(gdb_assert_h)
dbug-rom.o: dbug-rom.c $(defs_h) $(gdbcore_h) $(target_h) $(monitor_h) \
$(serial_h) $(regcache_h) $(m68k_tdep_h)
@@ -1658,7 +1678,7 @@ dwarf2read.o: dwarf2read.c $(defs_h) $(bfd_h) $(symtab_h) $(gdbtypes_h) \
$(symfile_h) $(objfiles_h) $(elf_dwarf2_h) $(buildsym_h) \
$(demangle_h) $(expression_h) $(filenames_h) $(macrotab_h) \
$(language_h) $(complaints_h) $(bcache_h) $(dwarf2expr_h) \
- $(dwarf2loc_h) $(gdb_string_h) $(gdb_assert_h) $(cp_support_h)
+ $(dwarf2loc_h) $(cp_support_h) $(gdb_string_h) $(gdb_assert_h)
dwarfread.o: dwarfread.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(symfile_h) \
$(objfiles_h) $(elf_dwarf_h) $(buildsym_h) $(demangle_h) \
$(expression_h) $(language_h) $(complaints_h) $(gdb_string_h)
@@ -1701,9 +1721,10 @@ fork-child.o: fork-child.c $(defs_h) $(gdb_string_h) $(frame_h) \
$(terminal_h) $(gdbthread_h) $(command_h)
frame.o: frame.c $(defs_h) $(frame_h) $(target_h) $(value_h) $(inferior_h) \
$(regcache_h) $(gdb_assert_h) $(gdb_string_h) $(builtin_regs_h) \
- $(gdb_obstack_h) $(dummy_frame_h) $(gdbcore_h) $(annotate_h) \
- $(language_h) $(frame_unwind_h) $(command_h) $(gdbcmd_h) \
- $(sentinel_frame_h)
+ $(gdb_obstack_h) $(dummy_frame_h) $(sentinel_frame_h) $(gdbcore_h) \
+ $(annotate_h) $(language_h) $(frame_unwind_h) $(frame_base_h) \
+ $(command_h) $(gdbcmd_h)
+frame-base.o: frame-base.c $(defs_h) $(frame_base_h) $(frame_h)
frame-unwind.o: frame-unwind.c $(defs_h) $(frame_h) $(frame_unwind_h) \
$(gdb_assert_h) $(dummy_frame_h) $(legacy_frame_h)
frv-tdep.o: frv-tdep.c $(defs_h) $(inferior_h) $(symfile_h) $(gdbcore_h) \
@@ -1743,11 +1764,12 @@ h8500-tdep.o: h8500-tdep.c $(defs_h) $(frame_h) $(symtab_h) $(gdbtypes_h) \
hpacc-abi.o: hpacc-abi.c $(defs_h) $(value_h) $(gdb_regex_h) $(gdb_string_h) \
$(gdbtypes_h) $(gdbcore_h) $(cp_abi_h)
hppa-tdep.o: hppa-tdep.c $(defs_h) $(frame_h) $(bfd_h) $(inferior_h) \
- $(value_h) $(regcache_h) $(completer_h) $(symtab_h) $(a_out_encap_h) \
+ $(value_h) $(regcache_h) $(completer_h) $(language_h) $(osabi_h) \
+ $(gdb_assert_h) $(infttrace_h) $(symtab_h) $(a_out_encap_h) \
$(gdb_stat_h) $(gdb_wait_h) $(gdbcore_h) $(gdbcmd_h) $(target_h) \
- $(symfile_h) $(objfiles_h) $(language_h) $(osabi_h)
+ $(symfile_h) $(objfiles_h)
hppa-hpux-tdep.o: hppa-hpux-tdep.c $(defs_h) $(arch_utils_h) $(gdbcore_h) \
- $(osabi_h)
+ $(osabi_h) $(gdb_string_h)
hppab-nat.o: hppab-nat.c $(defs_h) $(inferior_h) $(target_h) $(regcache_h)
hppah-nat.o: hppah-nat.c $(defs_h) $(inferior_h) $(target_h) $(gdbcore_h) \
$(gdb_wait_h) $(regcache_h)
@@ -1756,7 +1778,7 @@ hppam3-nat.o: hppam3-nat.c $(defs_h) $(inferior_h) $(floatformat_h) \
hpread.o: hpread.c $(defs_h) $(bfd_h) $(gdb_string_h) $(hp_symtab_h) \
$(syms_h) $(symtab_h) $(symfile_h) $(objfiles_h) $(buildsym_h) \
$(complaints_h) $(gdb_stabs_h) $(gdbtypes_h) $(demangle_h) \
- $(gdb_string_h)
+ $(somsolib_h) $(gdb_assert_h) $(gdb_string_h)
hpux-thread.o: hpux-thread.c $(defs_h) $(gdbthread_h) $(target_h) \
$(inferior_h) $(regcache_h) $(gdb_stat_h) $(gdbcore_h)
i386-linux-nat.o: i386-linux-nat.c $(defs_h) $(inferior_h) $(gdbcore_h) \
@@ -1788,6 +1810,8 @@ i386gnu-nat.o: i386gnu-nat.c $(defs_h) $(inferior_h) $(floatformat_h) \
i386gnu-tdep.o: i386gnu-tdep.c $(defs_h) $(i386_tdep_h) $(osabi_h)
i386ly-tdep.o: i386ly-tdep.c $(defs_h) $(gdbcore_h) $(inferior_h) \
$(regcache_h) $(target_h) $(i386_tdep_h) $(osabi_h)
+i386-cygwin-tdep.o: i386-cygwin-tdep.c $(defs_h) $(gdb_string_h) \
+ $(i386_tdep_h) $(osabi_h) $(gdbcore_h) $(frame_h) $(dummy_frame_h)
i386nbsd-tdep.o: i386nbsd-tdep.c $(defs_h) $(gdbtypes_h) $(gdbcore_h) \
$(regcache_h) $(arch_utils_h) $(i386_tdep_h) $(i387_tdep_h) \
$(nbsd_tdep_h) $(solib_svr4_h) $(osabi_h)
@@ -1827,11 +1851,12 @@ infptrace.o: infptrace.c $(defs_h) $(frame_h) $(inferior_h) $(target_h) \
infrun.o: infrun.c $(defs_h) $(gdb_string_h) $(symtab_h) $(frame_h) \
$(inferior_h) $(breakpoint_h) $(gdb_wait_h) $(gdbcore_h) $(gdbcmd_h) \
$(cli_script_h) $(target_h) $(gdbthread_h) $(annotate_h) \
- $(symfile_h) $(top_h) $(inf_loop_h) $(regcache_h) $(value_h)
+ $(symfile_h) $(top_h) $(inf_loop_h) $(regcache_h) $(value_h) \
+ $(observer_h) $(language_h)
inftarg.o: inftarg.c $(defs_h) $(frame_h) $(inferior_h) $(target_h) \
$(gdbcore_h) $(command_h) $(gdb_stat_h) $(gdb_wait_h) $(inflow_h)
infttrace.o: infttrace.c $(defs_h) $(frame_h) $(inferior_h) $(target_h) \
- $(gdb_string_h) $(gdb_wait_h) $(command_h) $(gdbcore_h)
+ $(gdb_string_h) $(gdb_wait_h) $(command_h) $(gdbthread_h) $(gdbcore_h)
interps.o: interps.c $(defs_h) $(gdbcmd_h) $(ui_out_h) $(event_loop_h) \
$(event_top_h) $(interps_h) $(completer_h) $(gdb_string_h) \
$(gdb_events_h) $(gdb_assert_h) $(top_h)
@@ -1842,7 +1867,7 @@ irix5-nat.o: irix5-nat.c $(defs_h) $(inferior_h) $(gdbcore_h) $(target_h) \
jv-lang.o: jv-lang.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(expression_h) \
$(parser_defs_h) $(language_h) $(gdbtypes_h) $(symtab_h) \
$(symfile_h) $(objfiles_h) $(gdb_string_h) $(value_h) $(c_lang_h) \
- $(jv_lang_h) $(gdbcore_h) $(dictionary_h) $(block_h)
+ $(jv_lang_h) $(gdbcore_h) $(dictionary_h) $(block_h) $(demangle_h)
jv-typeprint.o: jv-typeprint.c $(defs_h) $(symtab_h) $(gdbtypes_h) \
$(value_h) $(demangle_h) $(jv_lang_h) $(gdb_string_h) $(typeprint_h) \
$(c_lang_h) $(cp_abi_h)
@@ -1854,7 +1879,7 @@ kod.o: kod.c $(defs_h) $(command_h) $(gdbcmd_h) $(target_h) $(gdb_string_h) \
$(kod_h)
language.o: language.c $(defs_h) $(gdb_string_h) $(symtab_h) $(gdbtypes_h) \
$(value_h) $(gdbcmd_h) $(expression_h) $(language_h) $(target_h) \
- $(parser_defs_h) $(jv_lang_h)
+ $(parser_defs_h) $(jv_lang_h) $(demangle_h)
lin-lwp.o: lin-lwp.c $(defs_h) $(gdb_assert_h) $(gdb_string_h) $(gdb_wait_h) \
$(gdbthread_h) $(inferior_h) $(target_h) $(regcache_h) $(gdbcmd_h)
linespec.o: linespec.c $(defs_h) $(symtab_h) $(frame_h) $(command_h) \
@@ -1939,10 +1964,11 @@ mips-linux-tdep.o: mips-linux-tdep.c $(defs_h) $(gdbcore_h) $(target_h) \
$(solib_svr4_h) $(osabi_h) $(gdb_string_h) $(mips_tdep_h) \
$(gdb_assert_h)
mips-nat.o: mips-nat.c $(defs_h) $(inferior_h) $(gdbcore_h) $(regcache_h)
-mips-tdep.o: mips-tdep.c $(defs_h) $(gdb_string_h) $(frame_h) $(inferior_h) \
- $(symtab_h) $(value_h) $(gdbcmd_h) $(language_h) $(gdbcore_h) \
- $(symfile_h) $(objfiles_h) $(gdbtypes_h) $(target_h) $(arch_utils_h) \
- $(regcache_h) $(osabi_h) $(mips_tdep_h) $(block_h) $(opcode_mips_h) \
+mips-tdep.o: mips-tdep.c $(defs_h) $(gdb_string_h) $(gdb_assert_h) \
+ $(frame_h) $(inferior_h) $(symtab_h) $(value_h) $(gdbcmd_h) \
+ $(language_h) $(gdbcore_h) $(symfile_h) $(objfiles_h) \
+ $(gdbtypes_h) $(target_h) $(arch_utils_h) $(regcache_h) \
+ $(osabi_h) $(mips_tdep_h) $(block_h) $(opcode_mips_h) \
$(elf_mips_h) $(elf_bfd_h) $(symcat_h)
mipsm3-nat.o: mipsm3-nat.c $(defs_h) $(inferior_h) $(regcache_h)
mipsnbsd-nat.o: mipsnbsd-nat.c $(defs_h) $(inferior_h) $(regcache_h) \
@@ -2110,7 +2136,7 @@ remote.o: remote.c $(defs_h) $(gdb_string_h) $(inferior_h) $(bfd_h) \
$(symfile_h) $(target_h) $(gdbcmd_h) $(objfiles_h) $(gdb_stabs_h) \
$(gdbthread_h) $(remote_h) $(regcache_h) $(value_h) $(gdb_assert_h) \
$(event_loop_h) $(event_top_h) $(inf_loop_h) $(serial_h) \
- $(gdbcore_h)
+ $(gdbcore_h) $(solib_h)
rom68k-rom.o: rom68k-rom.c $(defs_h) $(gdbcore_h) $(target_h) $(monitor_h) \
$(serial_h) $(regcache_h) $(value_h) $(m68k_tdep_h)
rs6000-nat.o: rs6000-nat.c $(defs_h) $(inferior_h) $(target_h) $(gdbcore_h) \
@@ -2187,7 +2213,7 @@ somread.o: somread.c $(defs_h) $(bfd_h) $(symtab_h) $(symfile_h) \
somsolib.o: somsolib.c $(defs_h) $(frame_h) $(bfd_h) $(som_h) $(libhppa_h) \
$(gdbcore_h) $(symtab_h) $(breakpoint_h) $(symfile_h) $(objfiles_h) \
$(inferior_h) $(gdb_stabs_h) $(gdb_stat_h) $(gdbcmd_h) $(language_h) \
- $(regcache_h)
+ $(regcache_h) $(gdb_assert_h)
source.o: source.c $(defs_h) $(symtab_h) $(expression_h) $(language_h) \
$(command_h) $(source_h) $(gdbcmd_h) $(frame_h) $(value_h) \
$(gdb_string_h) $(gdb_stat_h) $(gdbcore_h) $(gdb_regex_h) \
@@ -2197,9 +2223,9 @@ sparc-linux-nat.o: sparc-linux-nat.c $(defs_h) $(regcache_h) $(gregset_h)
sparc-nat.o: sparc-nat.c $(defs_h) $(inferior_h) $(target_h) $(gdbcore_h) \
$(regcache_h) $(gdb_wait_h)
sparc-stub.o: sparc-stub.c
-sparc-tdep.o: sparc-tdep.c $(defs_h) $(arch_utils_h) $(frame_h) \
- $(inferior_h) $(target_h) $(value_h) $(bfd_h) $(gdb_string_h) \
- $(regcache_h) $(osabi_h) $(gregset_h) $(gdbcore_h) $(symfile_h)
+sparc-tdep.o: sparc-tdep.c $(defs_h) $(arch_utils_h) $(frame_h) $(inferior_h) \
+ $(target_h) $(value_h) $(bfd_h) $(gdb_string_h) $(regcache_h) \
+ $(osabi_h) $(gregset_h) $(gdbcore_h) $(gdb_assert_h) $(symfile_h)
sparc64nbsd-nat.o: sparc64nbsd-nat.c $(defs_h) $(inferior_h) $(regcache_h) \
$(sparcnbsd_tdep_h)
sparcl-stub.o: sparcl-stub.c
@@ -2243,7 +2269,7 @@ symm-tdep.o: symm-tdep.c $(defs_h) $(frame_h) $(inferior_h) $(symtab_h) \
symmisc.o: symmisc.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(bfd_h) \
$(symfile_h) $(objfiles_h) $(breakpoint_h) $(command_h) \
$(gdb_obstack_h) $(language_h) $(bcache_h) $(gdb_string_h) \
- $(readline_h) $(block_h) $(dictionary_h)
+ $(readline_h) $(block_h) $(gdb_regex_h) $(dictionary_h)
symtab.o: symtab.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(gdbcore_h) \
$(frame_h) $(target_h) $(value_h) $(symfile_h) $(objfiles_h) \
$(gdbcmd_h) $(call_cmds_h) $(gdb_regex_h) $(expression_h) \
@@ -2536,6 +2562,10 @@ mi-cmd-break.o: $(srcdir)/mi/mi-cmd-break.c $(defs_h) $(mi_cmds_h) \
$(ui_out_h) $(mi_out_h) $(breakpoint_h) $(gdb_string_h) \
$(mi_getopt_h) $(gdb_events_h) $(gdb_h)
$(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/mi/mi-cmd-break.c
+mi-cmd-file.o: $(srcdir)/mi/mi-cmd-file.c $(defs_h) $(mi_cmds_h) \
+ $(ui_out_h) $(mi_out_h) $(breakpoint_h) $(gdb_string_h) \
+ $(mi_getopt_h) $(gdb_events_h) $(gdb_h)
+ $(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/mi/mi-cmd-file.c
mi-cmd-disas.o: $(srcdir)/mi/mi-cmd-disas.c $(defs_h) $(target_h) $(value_h) \
$(mi_cmds_h) $(mi_getopt_h) $(ui_out_h) $(gdb_string_h) $(disasm_h)
$(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/mi/mi-cmd-disas.c
diff --git a/gdb/NEWS b/gdb/NEWS
index eaefeff..8f71195 100644
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -41,6 +41,15 @@ Mitsubishi M32R/D w/simulator m32r-*-elf*
Z8000 simulator z8k-zilog-none or z8ksim
Matsushita MN10200 w/simulator mn10200-*-*
H8/500 simulator h8500-hitachi-hms or h8500hms
+HP/PA running BSD hppa*-*-bsd*
+HP/PA running OSF/1 hppa*-*-osf*
+HP/PA Pro target hppa*-*-pro*
+PMAX (MIPS) running Mach 3.0 mips*-*-mach3*
+Sequent family i[3456]86-sequent-sysv4*
+ i[3456]86-sequent-sysv*
+ i[3456]86-sequent-bsd*
+Tsqware Sparclet sparclet-*-*
+Fujitsu SPARClite sparclite-fujitsu-none or sparclite
* REMOVED configurations and files
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 97e8f2d..b484a5d 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -8025,6 +8025,8 @@ const struct language_defn ada_language_defn = {
ada_print_type, /* Print a type using appropriate syntax */
ada_val_print, /* Print a value using appropriate syntax */
ada_value_print, /* Print a top-level value */
+ NULL, /* Language specific skip_trampoline */
+ NULL, /* Language specific symbol demangler */
{"", "", "", ""}, /* Binary format info */
#if 0
{"8#%lo#", "8#", "o", "#"}, /* Octal format info */
diff --git a/gdb/ada-lang.h b/gdb/ada-lang.h
index 45c156a..3f00b9a 100644
--- a/gdb/ada-lang.h
+++ b/gdb/ada-lang.h
@@ -20,6 +20,8 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#if !defined (ADA_LANG_H)
#define ADA_LANG_H 1
+struct partial_symbol;
+
#include "value.h"
#include "gdbtypes.h"
diff --git a/gdb/alpha-osf1-tdep.c b/gdb/alpha-osf1-tdep.c
index fa5bc5e..4eaa3c4 100644
--- a/gdb/alpha-osf1-tdep.c
+++ b/gdb/alpha-osf1-tdep.c
@@ -23,6 +23,7 @@
#include "gdbcore.h"
#include "value.h"
#include "osabi.h"
+#include "gdb_string.h"
#include "alpha-tdep.h"
diff --git a/gdb/alpha-tdep.c b/gdb/alpha-tdep.c
index b63a92f..44df63d 100644
--- a/gdb/alpha-tdep.c
+++ b/gdb/alpha-tdep.c
@@ -54,7 +54,6 @@ static gdbarch_register_convertible_ftype alpha_register_convertible;
static gdbarch_register_convert_to_virtual_ftype
alpha_register_convert_to_virtual;
static gdbarch_register_convert_to_raw_ftype alpha_register_convert_to_raw;
-static gdbarch_store_struct_return_ftype alpha_store_struct_return;
static gdbarch_deprecated_extract_return_value_ftype alpha_extract_return_value;
static gdbarch_deprecated_extract_struct_value_address_ftype
alpha_extract_struct_value_address;
@@ -66,12 +65,7 @@ static gdbarch_frame_args_address_ftype alpha_frame_args_address;
static gdbarch_frame_locals_address_ftype alpha_frame_locals_address;
static gdbarch_skip_prologue_ftype alpha_skip_prologue;
-static gdbarch_saved_pc_after_call_ftype alpha_saved_pc_after_call;
-static gdbarch_frame_chain_ftype alpha_frame_chain;
-static gdbarch_frame_saved_pc_ftype alpha_frame_saved_pc;
-static gdbarch_push_arguments_ftype alpha_push_arguments;
-static gdbarch_pop_frame_ftype alpha_pop_frame;
static gdbarch_fix_call_dummy_ftype alpha_fix_call_dummy;
static gdbarch_get_longjmp_target_ftype alpha_get_longjmp_target;
@@ -458,8 +452,10 @@ alpha_frame_init_saved_regs (struct frame_info *fi)
static CORE_ADDR
alpha_init_frame_pc_first (int fromleaf, struct frame_info *prev)
{
- return (fromleaf ? SAVED_PC_AFTER_CALL (get_next_frame (prev))
- : get_next_frame (prev) ? FRAME_SAVED_PC (get_next_frame (prev))
+ return (fromleaf
+ ? DEPRECATED_SAVED_PC_AFTER_CALL (get_next_frame (prev))
+ : get_next_frame (prev)
+ ? DEPRECATED_FRAME_SAVED_PC (get_next_frame (prev))
: read_pc ());
}
@@ -559,10 +555,10 @@ heuristic_proc_start (CORE_ADDR pc)
if (start_pc < fence)
{
/* It's not clear to me why we reach this point when
- stop_soon_quietly, but with this test, at least we
+ stop_soon, but with this test, at least we
don't print out warnings for every child forked (eg, on
decstation). 22apr93 rich@cygnus.com. */
- if (!stop_soon_quietly)
+ if (stop_soon == NO_STOP_QUIETLY)
{
static int blurb_printed = 0;
@@ -933,7 +929,7 @@ static CORE_ADDR
alpha_frame_chain (struct frame_info *frame)
{
alpha_extra_func_info_t proc_desc;
- CORE_ADDR saved_pc = FRAME_SAVED_PC (frame);
+ CORE_ADDR saved_pc = DEPRECATED_FRAME_SAVED_PC (frame);
if (saved_pc == 0 || inside_entry_file (saved_pc))
return 0;
@@ -1304,7 +1300,7 @@ alpha_pop_frame (void)
frame->proc_desc? If we do, who will free it?
For now, we don't save a copy... */
- write_register (PC_REGNUM, FRAME_SAVED_PC (frame));
+ write_register (PC_REGNUM, DEPRECATED_FRAME_SAVED_PC (frame));
if (get_frame_saved_regs (frame) == NULL)
alpha_find_saved_regs (frame);
if (proc_desc)
@@ -1464,8 +1460,8 @@ alpha_register_convert_to_virtual (int regnum, struct type *valtype,
if (TYPE_CODE (valtype) == TYPE_CODE_FLT)
{
- double d = extract_floating (raw_buffer, REGISTER_RAW_SIZE (regnum));
- store_floating (virtual_buffer, TYPE_LENGTH (valtype), d);
+ double d = deprecated_extract_floating (raw_buffer, REGISTER_RAW_SIZE (regnum));
+ deprecated_store_floating (virtual_buffer, TYPE_LENGTH (valtype), d);
}
else if (TYPE_CODE (valtype) == TYPE_CODE_INT && TYPE_LENGTH (valtype) <= 4)
{
@@ -1490,8 +1486,8 @@ alpha_register_convert_to_raw (struct type *valtype, int regnum,
if (TYPE_CODE (valtype) == TYPE_CODE_FLT)
{
- double d = extract_floating (virtual_buffer, TYPE_LENGTH (valtype));
- store_floating (raw_buffer, REGISTER_RAW_SIZE (regnum), d);
+ double d = deprecated_extract_floating (virtual_buffer, TYPE_LENGTH (valtype));
+ deprecated_store_floating (raw_buffer, REGISTER_RAW_SIZE (regnum), d);
}
else if (TYPE_CODE (valtype) == TYPE_CODE_INT && TYPE_LENGTH (valtype) <= 4)
{
@@ -1840,32 +1836,30 @@ alpha_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_frameless_function_invocation (gdbarch,
generic_frameless_function_invocation_not);
- set_gdbarch_saved_pc_after_call (gdbarch, alpha_saved_pc_after_call);
+ set_gdbarch_deprecated_saved_pc_after_call (gdbarch, alpha_saved_pc_after_call);
- set_gdbarch_frame_chain (gdbarch, alpha_frame_chain);
- set_gdbarch_frame_saved_pc (gdbarch, alpha_frame_saved_pc);
+ set_gdbarch_deprecated_frame_chain (gdbarch, alpha_frame_chain);
+ set_gdbarch_deprecated_frame_saved_pc (gdbarch, alpha_frame_saved_pc);
set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, alpha_frame_init_saved_regs);
set_gdbarch_use_struct_convention (gdbarch, alpha_use_struct_convention);
set_gdbarch_deprecated_extract_return_value (gdbarch, alpha_extract_return_value);
- set_gdbarch_store_struct_return (gdbarch, alpha_store_struct_return);
+ set_gdbarch_deprecated_store_struct_return (gdbarch, alpha_store_struct_return);
set_gdbarch_deprecated_store_return_value (gdbarch, alpha_store_return_value);
set_gdbarch_deprecated_extract_struct_value_address (gdbarch,
alpha_extract_struct_value_address);
/* Settings for calling functions in the inferior. */
set_gdbarch_deprecated_use_generic_dummy_frames (gdbarch, 0);
- set_gdbarch_call_dummy_length (gdbarch, 0);
- set_gdbarch_push_arguments (gdbarch, alpha_push_arguments);
- set_gdbarch_pop_frame (gdbarch, alpha_pop_frame);
+ set_gdbarch_deprecated_push_arguments (gdbarch, alpha_push_arguments);
+ set_gdbarch_deprecated_pop_frame (gdbarch, alpha_pop_frame);
/* On the Alpha, the call dummy code is never copied to user space,
stopping the user call is achieved via a bp_call_dummy breakpoint.
But we need a fake CALL_DUMMY definition to enable the proper
call_function_by_hand and to avoid zero length array warnings. */
- set_gdbarch_call_dummy_p (gdbarch, 1);
set_gdbarch_call_dummy_words (gdbarch, alpha_call_dummy_words);
set_gdbarch_sizeof_call_dummy_words (gdbarch, 0);
set_gdbarch_frame_args_address (gdbarch, alpha_frame_args_address);
@@ -1876,12 +1870,10 @@ alpha_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
no need for a dummy on the Alpha. PUSH_ARGUMENTS takes care of all
argument handling and bp_call_dummy takes care of stopping the dummy. */
set_gdbarch_call_dummy_address (gdbarch, alpha_call_dummy_address);
- set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 1);
- set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 0);
- set_gdbarch_call_dummy_start_offset (gdbarch, 0);
set_gdbarch_deprecated_pc_in_call_dummy (gdbarch, deprecated_pc_in_call_dummy_at_entry_point);
- set_gdbarch_call_dummy_stack_adjust_p (gdbarch, 0);
set_gdbarch_deprecated_push_dummy_frame (gdbarch, alpha_push_dummy_frame);
+ /* Should be using push_dummy_call. */
+ set_gdbarch_deprecated_dummy_write_sp (gdbarch, generic_target_write_sp);
set_gdbarch_fix_call_dummy (gdbarch, alpha_fix_call_dummy);
set_gdbarch_deprecated_init_frame_pc (gdbarch, init_frame_pc_noop);
set_gdbarch_deprecated_init_frame_pc_first (gdbarch, alpha_init_frame_pc_first);
diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c
index 1016ba1..825bd5c 100644
--- a/gdb/arch-utils.c
+++ b/gdb/arch-utils.c
@@ -383,10 +383,10 @@ init_frame_pc_noop (int fromleaf, struct frame_info *prev)
CORE_ADDR
init_frame_pc_default (int fromleaf, struct frame_info *prev)
{
- if (fromleaf)
- return SAVED_PC_AFTER_CALL (get_next_frame (prev));
+ if (fromleaf && DEPRECATED_SAVED_PC_AFTER_CALL_P ())
+ return DEPRECATED_SAVED_PC_AFTER_CALL (get_next_frame (prev));
else if (get_next_frame (prev) != NULL)
- return FRAME_SAVED_PC (get_next_frame (prev));
+ return DEPRECATED_FRAME_SAVED_PC (get_next_frame (prev));
else
return read_pc ();
}
diff --git a/gdb/arch-utils.h b/gdb/arch-utils.h
index 3452fc8..f3874a0 100644
--- a/gdb/arch-utils.h
+++ b/gdb/arch-utils.h
@@ -22,6 +22,12 @@
#ifndef GDBARCH_UTILS_H
#define GDBARCH_UTILS_H
+struct gdbarch;
+struct frame_info;
+struct minimal_symbol;
+struct type;
+struct gdbarch_info;
+
/* gdbarch trace variable */
extern int gdbarch_debug;
diff --git a/gdb/arm-linux-tdep.c b/gdb/arm-linux-tdep.c
index 1ebe600..91fa88f 100644
--- a/gdb/arm-linux-tdep.c
+++ b/gdb/arm-linux-tdep.c
@@ -181,10 +181,10 @@ arm_linux_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
if (TYPE_CODE_FLT == typecode && REGISTER_SIZE == len)
{
DOUBLEST dblval;
- dblval = extract_floating (val, len);
+ dblval = deprecated_extract_floating (val, len);
len = TARGET_DOUBLE_BIT / TARGET_CHAR_BIT;
val = alloca (len);
- store_floating (val, len, dblval);
+ deprecated_store_floating (val, len, dblval);
}
/* If the argument is a pointer to a function, and it is a Thumb
@@ -406,7 +406,7 @@ skip_hurd_resolver (CORE_ADDR pc)
= lookup_minimal_symbol ("fixup", NULL, objfile);
if (fixup && SYMBOL_VALUE_ADDRESS (fixup) == pc)
- return (SAVED_PC_AFTER_CALL (get_current_frame ()));
+ return (DEPRECATED_SAVED_PC_AFTER_CALL (get_current_frame ()));
}
return 0;
@@ -525,6 +525,8 @@ arm_linux_init_abi (struct gdbarch_info info,
tdep->arm_breakpoint = arm_linux_arm_le_breakpoint;
tdep->arm_breakpoint_size = sizeof (arm_linux_arm_le_breakpoint);
+ tdep->fp_model = ARM_FLOAT_FPA;
+
tdep->jb_pc = ARM_LINUX_JB_PC;
tdep->jb_elt_size = ARM_LINUX_JB_ELEMENT_SIZE;
@@ -534,7 +536,7 @@ arm_linux_init_abi (struct gdbarch_info info,
/* The following two overrides shouldn't be needed. */
set_gdbarch_deprecated_extract_return_value (gdbarch, arm_linux_extract_return_value);
- set_gdbarch_push_arguments (gdbarch, arm_linux_push_arguments);
+ set_gdbarch_deprecated_push_arguments (gdbarch, arm_linux_push_arguments);
/* Shared library handling. */
set_gdbarch_in_solib_call_trampoline (gdbarch, in_plt_section);
diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
index 11b2350..0a029e8 100644
--- a/gdb/arm-tdep.c
+++ b/gdb/arm-tdep.c
@@ -28,7 +28,7 @@
#include "gdbcore.h"
#include "symfile.h"
#include "gdb_string.h"
-#include "dis-asm.h" /* For register flavors. */
+#include "dis-asm.h" /* For register styles. */
#include "regcache.h"
#include "doublest.h"
#include "value.h"
@@ -99,8 +99,27 @@ static int arm_debug;
#define MSYMBOL_SIZE(msym) \
((long) MSYMBOL_INFO (msym) & 0x7fffffff)
+/* The list of available "set arm ..." and "show arm ..." commands. */
+static struct cmd_list_element *setarmcmdlist = NULL;
+static struct cmd_list_element *showarmcmdlist = NULL;
+
+/* The type of floating-point to use. Keep this in sync with enum
+ arm_float_model, and the help string in _initialize_arm_tdep. */
+static const char *fp_model_strings[] =
+{
+ "auto",
+ "softfpa",
+ "fpa",
+ "softvfp",
+ "vfp"
+};
+
+/* A variable that can be configured by the user. */
+static enum arm_float_model arm_fp_model = ARM_FLOAT_AUTO;
+static const char *current_fp_model = "auto";
+
/* Number of different reg name sets (options). */
-static int num_flavor_options;
+static int num_disassembly_options;
/* We have more registers than the disassembler as gdb can print the value
of special registers as well.
@@ -118,19 +137,19 @@ static char * arm_register_name_strings[] =
"fps", "cpsr" }; /* 24 25 */
static char **arm_register_names = arm_register_name_strings;
-/* Valid register name flavors. */
-static const char **valid_flavors;
+/* Valid register name styles. */
+static const char **valid_disassembly_styles;
-/* Disassembly flavor to use. Default to "std" register names. */
-static const char *disassembly_flavor;
+/* Disassembly style to use. Default to "std" register names. */
+static const char *disassembly_style;
/* Index to that option in the opcodes table. */
static int current_option;
/* This is used to keep the bfd arch_info in sync with the disassembly
- flavor. */
-static void set_disassembly_flavor_sfunc(char *, int,
+ style. */
+static void set_disassembly_style_sfunc(char *, int,
struct cmd_list_element *);
-static void set_disassembly_flavor (void);
+static void set_disassembly_style (void);
static void convert_from_extended (const struct floatformat *, const void *,
void *);
@@ -159,7 +178,7 @@ struct frame_extra_info
static int
arm_frame_chain_valid (CORE_ADDR chain, struct frame_info *thisframe)
{
- return (FRAME_SAVED_PC (thisframe) >= LOWEST_PC);
+ return (DEPRECATED_FRAME_SAVED_PC (thisframe) >= LOWEST_PC);
}
/* Set to true if the 32-bit mode is in use. */
@@ -276,7 +295,7 @@ arm_frameless_function_invocation (struct frame_info *fi)
stmdb sp!, {}
sub sp, ip, #4. */
- func_start = (get_pc_function_start (get_frame_pc (fi)) + FUNCTION_START_OFFSET);
+ func_start = (get_frame_func (fi) + FUNCTION_START_OFFSET);
after_prologue = SKIP_PROLOGUE (func_start);
/* There are some frameless functions whose first two instructions
@@ -642,60 +661,6 @@ thumb_scan_prologue (struct frame_info *fi)
}
}
-/* Check if prologue for this frame's PC has already been scanned. If
- it has, copy the relevant information about that prologue and
- return non-zero. Otherwise do not copy anything and return zero.
-
- The information saved in the cache includes:
- * the frame register number;
- * the size of the stack frame;
- * the offsets of saved regs (relative to the old SP); and
- * the offset from the stack pointer to the frame pointer
-
- The cache contains only one entry, since this is adequate for the
- typical sequence of prologue scan requests we get. When performing
- a backtrace, GDB will usually ask to scan the same function twice
- in a row (once to get the frame chain, and once to fill in the
- extra frame information). */
-
-static struct frame_info *prologue_cache;
-
-static int
-check_prologue_cache (struct frame_info *fi)
-{
- int i;
-
- if (get_frame_pc (fi) == get_frame_pc (prologue_cache))
- {
- get_frame_extra_info (fi)->framereg = get_frame_extra_info (prologue_cache)->framereg;
- get_frame_extra_info (fi)->framesize = get_frame_extra_info (prologue_cache)->framesize;
- get_frame_extra_info (fi)->frameoffset = get_frame_extra_info (prologue_cache)->frameoffset;
- for (i = 0; i < NUM_REGS + NUM_PSEUDO_REGS; i++)
- get_frame_saved_regs (fi)[i] = get_frame_saved_regs (prologue_cache)[i];
- return 1;
- }
- else
- return 0;
-}
-
-
-/* Copy the prologue information from fi to the prologue cache. */
-
-static void
-save_prologue_cache (struct frame_info *fi)
-{
- int i;
-
- deprecated_update_frame_pc_hack (prologue_cache, get_frame_pc (fi));
- get_frame_extra_info (prologue_cache)->framereg = get_frame_extra_info (fi)->framereg;
- get_frame_extra_info (prologue_cache)->framesize = get_frame_extra_info (fi)->framesize;
- get_frame_extra_info (prologue_cache)->frameoffset = get_frame_extra_info (fi)->frameoffset;
-
- for (i = 0; i < NUM_REGS + NUM_PSEUDO_REGS; i++)
- get_frame_saved_regs (prologue_cache)[i] = get_frame_saved_regs (fi)[i];
-}
-
-
/* This function decodes an ARM function prologue to determine:
1) the size of the stack frame
2) which registers are saved on it
@@ -770,10 +735,6 @@ arm_scan_prologue (struct frame_info *fi)
LONGEST return_value;
CORE_ADDR prologue_start, prologue_end, current_pc;
- /* Check if this function is already in the cache of frame information. */
- if (check_prologue_cache (fi))
- return;
-
/* Assume there is no frame until proven otherwise. */
get_frame_extra_info (fi)->framereg = ARM_SP_REGNUM;
get_frame_extra_info (fi)->framesize = 0;
@@ -783,7 +744,6 @@ arm_scan_prologue (struct frame_info *fi)
if (arm_pc_is_thumb (get_frame_pc (fi)))
{
thumb_scan_prologue (fi);
- save_prologue_cache (fi);
return;
}
@@ -975,8 +935,6 @@ arm_scan_prologue (struct frame_info *fi)
get_frame_extra_info (fi)->frameoffset = fp_offset - sp_offset;
else
get_frame_extra_info (fi)->frameoffset = 0;
-
- save_prologue_cache (fi);
}
/* Find REGNUM on the stack. Otherwise, it's in an active register.
@@ -1032,7 +990,7 @@ arm_frame_chain (struct frame_info *fi)
return 0;
/* If the caller is the startup code, we're at the end of the chain. */
- caller_pc = FRAME_SAVED_PC (fi);
+ caller_pc = DEPRECATED_FRAME_SAVED_PC (fi);
/* If the caller is Thumb and the caller is ARM, or vice versa,
the frame register of the caller is different from ours.
@@ -1090,7 +1048,7 @@ arm_init_extra_frame_info (int fromleaf, struct frame_info *fi)
get_frame_extra_info (fi)->framereg = 0;
if (get_next_frame (fi))
- deprecated_update_frame_pc_hack (fi, FRAME_SAVED_PC (get_next_frame (fi)));
+ deprecated_update_frame_pc_hack (fi, DEPRECATED_FRAME_SAVED_PC (get_next_frame (fi)));
memset (get_frame_saved_regs (fi), '\000', sizeof get_frame_saved_regs (fi));
@@ -1376,137 +1334,6 @@ arm_fix_call_dummy (char *dummy, CORE_ADDR pc, CORE_ADDR fun, int nargs,
write_register (4, fun);
}
-/* Note: ScottB
-
- This function does not support passing parameters using the FPA
- variant of the APCS. It passes any floating point arguments in the
- general registers and/or on the stack. */
-
-static CORE_ADDR
-arm_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
- int struct_return, CORE_ADDR struct_addr)
-{
- CORE_ADDR fp;
- int argnum;
- int argreg;
- int nstack;
- int simd_argreg;
- int second_pass;
- struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
-
- /* Walk through the list of args and determine how large a temporary
- stack is required. Need to take care here as structs may be
- passed on the stack, and we have to to push them. On the second
- pass, do the store. */
- nstack = 0;
- fp = sp;
- for (second_pass = 0; second_pass < 2; second_pass++)
- {
- /* Compute the FP using the information computed during the
- first pass. */
- if (second_pass)
- fp = sp - nstack;
-
- simd_argreg = 0;
- argreg = ARM_A1_REGNUM;
- nstack = 0;
-
- /* The struct_return pointer occupies the first parameter
- passing register. */
- if (struct_return)
- {
- if (second_pass)
- {
- if (arm_debug)
- fprintf_unfiltered (gdb_stdlog,
- "struct return in %s = 0x%s\n",
- REGISTER_NAME (argreg),
- paddr (struct_addr));
- write_register (argreg, struct_addr);
- }
- argreg++;
- }
-
- for (argnum = 0; argnum < nargs; argnum++)
- {
- int len;
- struct type *arg_type;
- struct type *target_type;
- enum type_code typecode;
- char *val;
-
- arg_type = check_typedef (VALUE_TYPE (args[argnum]));
- len = TYPE_LENGTH (arg_type);
- target_type = TYPE_TARGET_TYPE (arg_type);
- typecode = TYPE_CODE (arg_type);
- val = VALUE_CONTENTS (args[argnum]);
-
- /* If the argument is a pointer to a function, and it is a
- Thumb function, create a LOCAL copy of the value and set
- the THUMB bit in it. */
- if (second_pass
- && TYPE_CODE_PTR == typecode
- && target_type != NULL
- && TYPE_CODE_FUNC == TYPE_CODE (target_type))
- {
- CORE_ADDR regval = extract_address (val, len);
- if (arm_pc_is_thumb (regval))
- {
- val = alloca (len);
- store_address (val, len, MAKE_THUMB_ADDR (regval));
- }
- }
-
- /* Copy the argument to general registers or the stack in
- register-sized pieces. Large arguments are split between
- registers and stack. */
- while (len > 0)
- {
- int partial_len = len < REGISTER_SIZE ? len : REGISTER_SIZE;
-
- if (argreg <= ARM_LAST_ARG_REGNUM)
- {
- /* The argument is being passed in a general purpose
- register. */
- if (second_pass)
- {
- CORE_ADDR regval = extract_address (val,
- partial_len);
- if (arm_debug)
- fprintf_unfiltered (gdb_stdlog,
- "arg %d in %s = 0x%s\n",
- argnum,
- REGISTER_NAME (argreg),
- phex (regval, REGISTER_SIZE));
- write_register (argreg, regval);
- }
- argreg++;
- }
- else
- {
- if (second_pass)
- {
- /* Push the arguments onto the stack. */
- if (arm_debug)
- fprintf_unfiltered (gdb_stdlog,
- "arg %d @ 0x%s + %d\n",
- argnum, paddr (fp), nstack);
- write_memory (fp + nstack, val, REGISTER_SIZE);
- }
- nstack += REGISTER_SIZE;
- }
-
- len -= partial_len;
- val += partial_len;
- }
-
- }
- }
-
- /* Return the bottom of the argument list (pointed to by fp). */
- return fp;
-}
-
/* Pop the current frame. So long as the frame info has been
initialized properly (see arm_init_extra_frame_info), this code
works for dummy frames as well as regular frames. I.e, there's no
@@ -1535,12 +1362,167 @@ arm_pop_frame (void)
read_memory_integer (get_frame_saved_regs (frame)[regnum],
REGISTER_RAW_SIZE (regnum)));
- write_register (ARM_PC_REGNUM, FRAME_SAVED_PC (frame));
+ write_register (ARM_PC_REGNUM, DEPRECATED_FRAME_SAVED_PC (frame));
write_register (ARM_SP_REGNUM, old_SP);
flush_cached_frames ();
}
+/* When arguments must be pushed onto the stack, they go on in reverse
+ order. The code below implements a FILO (stack) to do this. */
+
+struct stack_item
+{
+ int len;
+ struct stack_item *prev;
+ void *data;
+};
+
+static struct stack_item *
+push_stack_item (struct stack_item *prev, void *contents, int len)
+{
+ struct stack_item *si;
+ si = xmalloc (sizeof (struct stack_item));
+ si->data = xmalloc (len);
+ si->len = len;
+ si->prev = prev;
+ memcpy (si->data, contents, len);
+ return si;
+}
+
+static struct stack_item *
+pop_stack_item (struct stack_item *si)
+{
+ struct stack_item *dead = si;
+ si = si->prev;
+ xfree (dead->data);
+ xfree (dead);
+ return si;
+}
+
+/* We currently only support passing parameters in integer registers. This
+ conforms with GCC's default model. Several other variants exist and
+ we should probably support some of them based on the selected ABI. */
+
+static CORE_ADDR
+arm_push_dummy_call (struct gdbarch *gdbarch, struct regcache *regcache,
+ CORE_ADDR dummy_addr, int nargs, struct value **args,
+ CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr)
+{
+ int argnum;
+ int argreg;
+ int nstack;
+ struct stack_item *si = NULL;
+
+ /* Set the return address. For the ARM, the return breakpoint is always
+ at DUMMY_ADDR. */
+ /* XXX Fix for Thumb. */
+ regcache_cooked_write_unsigned (regcache, ARM_LR_REGNUM, dummy_addr);
+
+ /* Walk through the list of args and determine how large a temporary
+ stack is required. Need to take care here as structs may be
+ passed on the stack, and we have to to push them. */
+ nstack = 0;
+
+ argreg = ARM_A1_REGNUM;
+ nstack = 0;
+
+ /* Some platforms require a double-word aligned stack. Make sure sp
+ is correctly aligned before we start. We always do this even if
+ it isn't really needed -- it can never hurt things. */
+ sp &= ~(CORE_ADDR)(2 * REGISTER_SIZE - 1);
+
+ /* The struct_return pointer occupies the first parameter
+ passing register. */
+ if (struct_return)
+ {
+ if (arm_debug)
+ fprintf_unfiltered (gdb_stdlog, "struct return in %s = 0x%s\n",
+ REGISTER_NAME (argreg), paddr (struct_addr));
+ regcache_cooked_write_unsigned (regcache, argreg, struct_addr);
+ argreg++;
+ }
+
+ for (argnum = 0; argnum < nargs; argnum++)
+ {
+ int len;
+ struct type *arg_type;
+ struct type *target_type;
+ enum type_code typecode;
+ char *val;
+
+ arg_type = check_typedef (VALUE_TYPE (args[argnum]));
+ len = TYPE_LENGTH (arg_type);
+ target_type = TYPE_TARGET_TYPE (arg_type);
+ typecode = TYPE_CODE (arg_type);
+ val = VALUE_CONTENTS (args[argnum]);
+
+ /* If the argument is a pointer to a function, and it is a
+ Thumb function, create a LOCAL copy of the value and set
+ the THUMB bit in it. */
+ if (TYPE_CODE_PTR == typecode
+ && target_type != NULL
+ && TYPE_CODE_FUNC == TYPE_CODE (target_type))
+ {
+ CORE_ADDR regval = extract_address (val, len);
+ if (arm_pc_is_thumb (regval))
+ {
+ val = alloca (len);
+ store_address (val, len, MAKE_THUMB_ADDR (regval));
+ }
+ }
+
+ /* Copy the argument to general registers or the stack in
+ register-sized pieces. Large arguments are split between
+ registers and stack. */
+ while (len > 0)
+ {
+ int partial_len = len < REGISTER_SIZE ? len : REGISTER_SIZE;
+
+ if (argreg <= ARM_LAST_ARG_REGNUM)
+ {
+ /* The argument is being passed in a general purpose
+ register. */
+ CORE_ADDR regval = extract_address (val, partial_len);
+ if (arm_debug)
+ fprintf_unfiltered (gdb_stdlog, "arg %d in %s = 0x%s\n",
+ argnum, REGISTER_NAME (argreg),
+ phex (regval, REGISTER_SIZE));
+ regcache_cooked_write_unsigned (regcache, argreg, regval);
+ argreg++;
+ }
+ else
+ {
+ /* Push the arguments onto the stack. */
+ if (arm_debug)
+ fprintf_unfiltered (gdb_stdlog, "arg %d @ sp + %d\n",
+ argnum, nstack);
+ si = push_stack_item (si, val, REGISTER_SIZE);
+ nstack += REGISTER_SIZE;
+ }
+
+ len -= partial_len;
+ val += partial_len;
+ }
+ }
+ /* If we have an odd number of words to push, then decrement the stack
+ by one word now, so first stack argument will be dword aligned. */
+ if (nstack & 4)
+ sp -= 4;
+
+ while (si)
+ {
+ sp -= si->len;
+ write_memory (sp, si->data, si->len);
+ si = pop_stack_item (si);
+ }
+
+ /* Finally, update teh SP register. */
+ regcache_cooked_write_unsigned (regcache, ARM_SP_REGNUM, sp);
+
+ return sp;
+}
+
static void
print_fpu_flags (int flags)
{
@@ -2227,9 +2209,7 @@ arm_extract_return_value (struct type *type,
if (TYPE_CODE_FLT == TYPE_CODE (type))
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
-
- switch (tdep->fp_model)
+ switch (arm_get_fp_model (current_gdbarch))
{
case ARM_FLOAT_FPA:
{
@@ -2244,7 +2224,7 @@ arm_extract_return_value (struct type *type,
}
break;
- case ARM_FLOAT_SOFT:
+ case ARM_FLOAT_SOFT_FPA:
case ARM_FLOAT_SOFT_VFP:
regcache_cooked_read (regs, ARM_A1_REGNUM, valbuf);
if (TYPE_LENGTH (type) > 4)
@@ -2422,10 +2402,9 @@ arm_store_return_value (struct type *type, struct regcache *regs,
if (TYPE_CODE (type) == TYPE_CODE_FLT)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
char buf[ARM_MAX_REGISTER_RAW_SIZE];
- switch (tdep->fp_model)
+ switch (arm_get_fp_model (current_gdbarch))
{
case ARM_FLOAT_FPA:
@@ -2433,7 +2412,7 @@ arm_store_return_value (struct type *type, struct regcache *regs,
regcache_cooked_write (regs, ARM_F0_REGNUM, buf);
break;
- case ARM_FLOAT_SOFT:
+ case ARM_FLOAT_SOFT_FPA:
case ARM_FLOAT_SOFT_VFP:
regcache_cooked_write (regs, ARM_A1_REGNUM, valbuf);
if (TYPE_LENGTH (type) > 4)
@@ -2501,15 +2480,6 @@ arm_store_return_value (struct type *type, struct regcache *regs,
}
}
-/* Store the address of the place in which to copy the structure the
- subroutine will return. This is called from call_function. */
-
-static void
-arm_store_struct_return (CORE_ADDR addr, CORE_ADDR sp)
-{
- write_register (ARM_A1_REGNUM, addr);
-}
-
static int
arm_get_longjmp_target (CORE_ADDR *pc)
{
@@ -2577,16 +2547,92 @@ arm_skip_stub (CORE_ADDR pc)
return 0; /* not a stub */
}
-/* If the user changes the register disassembly flavor used for info
- register and other commands, we have to also switch the flavor used
- in opcodes for disassembly output. This function is run in the set
- disassembly_flavor command, and does that. */
+static void
+set_arm_command (char *args, int from_tty)
+{
+ printf_unfiltered ("\"set arm\" must be followed by an apporpriate subcommand.\n");
+ help_list (setarmcmdlist, "set arm ", all_commands, gdb_stdout);
+}
static void
-set_disassembly_flavor_sfunc (char *args, int from_tty,
+show_arm_command (char *args, int from_tty)
+{
+ cmd_show_list (showarmcmdlist, from_tty, "");
+}
+
+enum arm_float_model
+arm_get_fp_model (struct gdbarch *gdbarch)
+{
+ if (arm_fp_model == ARM_FLOAT_AUTO)
+ return gdbarch_tdep (gdbarch)->fp_model;
+
+ return arm_fp_model;
+}
+
+static void
+arm_set_fp (struct gdbarch *gdbarch)
+{
+ enum arm_float_model fp_model = arm_get_fp_model (gdbarch);
+
+ if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_LITTLE
+ && (fp_model == ARM_FLOAT_SOFT_FPA || fp_model == ARM_FLOAT_FPA))
+ {
+ set_gdbarch_double_format (gdbarch,
+ &floatformat_ieee_double_littlebyte_bigword);
+ set_gdbarch_long_double_format
+ (gdbarch, &floatformat_ieee_double_littlebyte_bigword);
+ }
+ else
+ {
+ set_gdbarch_double_format (gdbarch, &floatformat_ieee_double_little);
+ set_gdbarch_long_double_format (gdbarch,
+ &floatformat_ieee_double_little);
+ }
+}
+
+static void
+set_fp_model_sfunc (char *args, int from_tty,
+ struct cmd_list_element *c)
+{
+ enum arm_float_model fp_model;
+
+ for (fp_model = ARM_FLOAT_AUTO; fp_model != ARM_FLOAT_LAST; fp_model++)
+ if (strcmp (current_fp_model, fp_model_strings[fp_model]) == 0)
+ {
+ arm_fp_model = fp_model;
+ break;
+ }
+
+ if (fp_model == ARM_FLOAT_LAST)
+ internal_error (__FILE__, __LINE__, "Invalid fp model accepted: %s.",
+ current_fp_model);
+
+ if (gdbarch_bfd_arch_info (current_gdbarch)->arch == bfd_arch_arm)
+ arm_set_fp (current_gdbarch);
+}
+
+static void
+show_fp_model (char *args, int from_tty,
+ struct cmd_list_element *c)
+{
+ struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
+
+ if (arm_fp_model == ARM_FLOAT_AUTO
+ && gdbarch_bfd_arch_info (current_gdbarch)->arch == bfd_arch_arm)
+ printf_filtered (" - the default for the current ABI is \"%s\".\n",
+ fp_model_strings[tdep->fp_model]);
+}
+
+/* If the user changes the register disassembly style used for info
+ register and other commands, we have to also switch the style used
+ in opcodes for disassembly output. This function is run in the "set
+ arm disassembly" command, and does that. */
+
+static void
+set_disassembly_style_sfunc (char *args, int from_tty,
struct cmd_list_element *c)
{
- set_disassembly_flavor ();
+ set_disassembly_style ();
}
/* Return the ARM register name corresponding to register I. */
@@ -2597,16 +2643,16 @@ arm_register_name (int i)
}
static void
-set_disassembly_flavor (void)
+set_disassembly_style (void)
{
const char *setname, *setdesc, **regnames;
int numregs, j;
- /* Find the flavor that the user wants in the opcodes table. */
+ /* Find the style that the user wants in the opcodes table. */
int current = 0;
numregs = get_arm_regnames (current, &setname, &setdesc, &regnames);
- while ((disassembly_flavor != setname)
- && (current < num_flavor_options))
+ while ((disassembly_style != setname)
+ && (current < num_disassembly_options))
get_arm_regnames (++current, &setname, &setdesc, &regnames);
current_option = current;
@@ -2630,19 +2676,17 @@ set_disassembly_flavor (void)
set_arm_regname_option (current);
}
-/* arm_othernames implements the "othernames" command. This is kind
- of hacky, and I prefer the set-show disassembly-flavor which is
- also used for the x86 gdb. I will keep this around, however, in
- case anyone is actually using it. */
+/* arm_othernames implements the "othernames" command. This is deprecated
+ by the "set arm disassembly" command. */
static void
arm_othernames (char *names, int n)
{
/* Circle through the various flavors. */
- current_option = (current_option + 1) % num_flavor_options;
+ current_option = (current_option + 1) % num_disassembly_options;
- disassembly_flavor = valid_flavors[current_option];
- set_disassembly_flavor ();
+ disassembly_style = valid_disassembly_styles[current_option];
+ set_disassembly_style ();
}
/* Fetch, and possibly build, an appropriate link_map_offsets structure
@@ -2850,8 +2894,10 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
ready to unwind the PC first (see frame.c:get_prev_frame()). */
set_gdbarch_deprecated_init_frame_pc (gdbarch, init_frame_pc_default);
- /* This is the way it has always defaulted. */
- tdep->fp_model = ARM_FLOAT_FPA;
+ /* We used to default to FPA for generic ARM, but almost nobody uses that
+ now, and we now provide a way for the user to force the model. So
+ default to the most useful variant. */
+ tdep->fp_model = ARM_FLOAT_SOFT_FPA;
/* Breakpoints. */
switch (info.byte_order)
@@ -2884,38 +2930,25 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
tdep->lowest_pc = 0x20;
tdep->jb_pc = -1; /* Longjump support not enabled by default. */
- set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 1);
- set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 0);
-
- set_gdbarch_call_dummy_p (gdbarch, 1);
- set_gdbarch_call_dummy_stack_adjust_p (gdbarch, 0);
-
set_gdbarch_call_dummy_words (gdbarch, arm_call_dummy_words);
set_gdbarch_sizeof_call_dummy_words (gdbarch, 0);
- set_gdbarch_call_dummy_start_offset (gdbarch, 0);
- set_gdbarch_call_dummy_length (gdbarch, 0);
-
- set_gdbarch_fix_call_dummy (gdbarch, generic_fix_call_dummy);
-
- set_gdbarch_call_dummy_address (gdbarch, entry_point_address);
- set_gdbarch_push_return_address (gdbarch, arm_push_return_address);
- set_gdbarch_push_arguments (gdbarch, arm_push_arguments);
+ set_gdbarch_push_dummy_call (gdbarch, arm_push_dummy_call);
/* Frame handling. */
- set_gdbarch_frame_chain_valid (gdbarch, arm_frame_chain_valid);
+ set_gdbarch_deprecated_frame_chain_valid (gdbarch, arm_frame_chain_valid);
set_gdbarch_deprecated_init_extra_frame_info (gdbarch, arm_init_extra_frame_info);
set_gdbarch_read_fp (gdbarch, arm_read_fp);
- set_gdbarch_frame_chain (gdbarch, arm_frame_chain);
+ set_gdbarch_deprecated_frame_chain (gdbarch, arm_frame_chain);
set_gdbarch_frameless_function_invocation
(gdbarch, arm_frameless_function_invocation);
- set_gdbarch_frame_saved_pc (gdbarch, arm_frame_saved_pc);
+ set_gdbarch_deprecated_frame_saved_pc (gdbarch, arm_frame_saved_pc);
set_gdbarch_frame_args_address (gdbarch, arm_frame_args_address);
set_gdbarch_frame_locals_address (gdbarch, arm_frame_locals_address);
set_gdbarch_frame_num_args (gdbarch, arm_frame_num_args);
set_gdbarch_frame_args_skip (gdbarch, 0);
set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, arm_frame_init_saved_regs);
- set_gdbarch_pop_frame (gdbarch, arm_pop_frame);
+ set_gdbarch_deprecated_pop_frame (gdbarch, arm_pop_frame);
/* Address manipulation. */
set_gdbarch_smash_text_address (gdbarch, arm_smash_text_address);
@@ -2928,7 +2961,7 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_skip_prologue (gdbarch, arm_skip_prologue);
/* Get the PC when a frame might not be available. */
- set_gdbarch_saved_pc_after_call (gdbarch, arm_saved_pc_after_call);
+ set_gdbarch_deprecated_saved_pc_after_call (gdbarch, arm_saved_pc_after_call);
/* The stack grows downward. */
set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
@@ -2964,7 +2997,6 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
/* Returning results. */
set_gdbarch_extract_return_value (gdbarch, arm_extract_return_value);
set_gdbarch_store_return_value (gdbarch, arm_store_return_value);
- set_gdbarch_store_struct_return (gdbarch, arm_store_struct_return);
set_gdbarch_use_struct_convention (gdbarch, arm_use_struct_convention);
set_gdbarch_extract_struct_value_address (gdbarch,
arm_extract_struct_value_address);
@@ -2973,6 +3005,9 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
/* XXX For an RDI target we should ask the target if it can single-step. */
set_gdbarch_software_single_step (gdbarch, arm_software_single_step);
+ /* Disassembly. */
+ set_gdbarch_print_insn (gdbarch, gdb_print_insn_arm);
+
/* Minsymbol frobbing. */
set_gdbarch_elf_make_msymbol_special (gdbarch, arm_elf_make_msymbol_special);
set_gdbarch_coff_make_msymbol_special (gdbarch,
@@ -2999,20 +3034,7 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
case BFD_ENDIAN_LITTLE:
set_gdbarch_float_format (gdbarch, &floatformat_ieee_single_little);
- if (tdep->fp_model == ARM_FLOAT_VFP
- || tdep->fp_model == ARM_FLOAT_SOFT_VFP)
- {
- set_gdbarch_double_format (gdbarch, &floatformat_ieee_double_little);
- set_gdbarch_long_double_format (gdbarch,
- &floatformat_ieee_double_little);
- }
- else
- {
- set_gdbarch_double_format
- (gdbarch, &floatformat_ieee_double_littlebyte_bigword);
- set_gdbarch_long_double_format
- (gdbarch, &floatformat_ieee_double_littlebyte_bigword);
- }
+ arm_set_fp (gdbarch);
break;
default:
@@ -3020,22 +3042,6 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
"arm_gdbarch_init: bad byte order for float format");
}
- /* We can't use SIZEOF_FRAME_SAVED_REGS here, since that still
- references the old architecture vector, not the one we are
- building here. */
- if (get_frame_saved_regs (prologue_cache) != NULL)
- xfree (get_frame_saved_regs (prologue_cache));
-
- /* We can't use NUM_REGS nor NUM_PSEUDO_REGS here, since that still
- references the old architecture vector, not the one we are
- building here. */
- {
- CORE_ADDR *saved_regs = xcalloc (1, (sizeof (CORE_ADDR)
- * (gdbarch_num_regs (gdbarch)
- + gdbarch_num_pseudo_regs (gdbarch))));
- deprecated_set_frame_saved_regs_hack (prologue_cache, saved_regs);
- }
-
return gdbarch;
}
@@ -3077,7 +3083,7 @@ _initialize_arm_tdep (void)
{
struct ui_file *stb;
long length;
- struct cmd_list_element *new_cmd;
+ struct cmd_list_element *new_set, *new_show;
const char *setname;
const char *setdesc;
const char **regnames;
@@ -3100,31 +3106,39 @@ _initialize_arm_tdep (void)
gdbarch_register_osabi (bfd_arch_arm, 0, GDB_OSABI_ARM_APCS,
arm_init_abi_apcs);
- tm_print_insn = gdb_print_insn_arm;
-
/* Get the number of possible sets of register names defined in opcodes. */
- num_flavor_options = get_arm_regname_num_options ();
+ num_disassembly_options = get_arm_regname_num_options ();
+
+ /* Add root prefix command for all "set arm"/"show arm" commands. */
+ add_prefix_cmd ("arm", no_class, set_arm_command,
+ "Various ARM-specific commands.",
+ &setarmcmdlist, "set arm ", 0, &setlist);
+
+ add_prefix_cmd ("arm", no_class, show_arm_command,
+ "Various ARM-specific commands.",
+ &showarmcmdlist, "show arm ", 0, &showlist);
/* Sync the opcode insn printer with our register viewer. */
parse_arm_disassembler_option ("reg-names-std");
/* Begin creating the help text. */
stb = mem_fileopen ();
- fprintf_unfiltered (stb, "Set the disassembly flavor.\n\
-The valid values are:\n");
+ fprintf_unfiltered (stb, "Set the disassembly style.\n"
+ "The valid values are:\n");
/* Initialize the array that will be passed to add_set_enum_cmd(). */
- valid_flavors = xmalloc ((num_flavor_options + 1) * sizeof (char *));
- for (i = 0; i < num_flavor_options; i++)
+ valid_disassembly_styles
+ = xmalloc ((num_disassembly_options + 1) * sizeof (char *));
+ for (i = 0; i < num_disassembly_options; i++)
{
numregs = get_arm_regnames (i, &setname, &setdesc, &regnames);
- valid_flavors[i] = setname;
+ valid_disassembly_styles[i] = setname;
fprintf_unfiltered (stb, "%s - %s\n", setname,
setdesc);
/* Copy the default names (if found) and synchronize disassembler. */
if (!strcmp (setname, "std"))
{
- disassembly_flavor = setname;
+ disassembly_style = setname;
current_option = i;
for (j = 0; j < numregs; j++)
arm_register_names[j] = (char *) regnames[j];
@@ -3132,40 +3146,73 @@ The valid values are:\n");
}
}
/* Mark the end of valid options. */
- valid_flavors[num_flavor_options] = NULL;
+ valid_disassembly_styles[num_disassembly_options] = NULL;
/* Finish the creation of the help text. */
fprintf_unfiltered (stb, "The default is \"std\".");
helptext = ui_file_xstrdup (stb, &length);
ui_file_delete (stb);
- /* Add the disassembly-flavor command. */
- new_cmd = add_set_enum_cmd ("disassembly-flavor", no_class,
- valid_flavors,
- &disassembly_flavor,
+ /* Add the deprecated disassembly-flavor command. */
+ new_set = add_set_enum_cmd ("disassembly-flavor", no_class,
+ valid_disassembly_styles,
+ &disassembly_style,
helptext,
&setlist);
- set_cmd_sfunc (new_cmd, set_disassembly_flavor_sfunc);
- add_show_from_set (new_cmd, &showlist);
-
- /* ??? Maybe this should be a boolean. */
- add_show_from_set (add_set_cmd ("apcs32", no_class,
- var_zinteger, (char *) &arm_apcs_32,
- "Set usage of ARM 32-bit mode.\n", &setlist),
- &showlist);
+ set_cmd_sfunc (new_set, set_disassembly_style_sfunc);
+ deprecate_cmd (new_set, "set arm disassembly");
+ deprecate_cmd (add_show_from_set (new_set, &showlist),
+ "show arm disassembly");
+
+ /* And now add the new interface. */
+ new_set = add_set_enum_cmd ("disassembler", no_class,
+ valid_disassembly_styles, &disassembly_style,
+ helptext, &setarmcmdlist);
+
+ set_cmd_sfunc (new_set, set_disassembly_style_sfunc);
+ add_show_from_set (new_set, &showarmcmdlist);
+
+ add_setshow_cmd_full ("apcs32", no_class,
+ var_boolean, (char *) &arm_apcs_32,
+ "Set usage of ARM 32-bit mode.",
+ "Show usage of ARM 32-bit mode.",
+ NULL, NULL,
+ &setlist, &showlist, &new_set, &new_show);
+ deprecate_cmd (new_set, "set arm apcs32");
+ deprecate_cmd (new_show, "show arm apcs32");
+
+ add_setshow_boolean_cmd ("apcs32", no_class, &arm_apcs_32,
+ "Set usage of ARM 32-bit mode. "
+ "When off, a 26-bit PC will be used.",
+ "Show usage of ARM 32-bit mode. "
+ "When off, a 26-bit PC will be used.",
+ NULL, NULL,
+ &setarmcmdlist, &showarmcmdlist);
+
+ /* Add a command to allow the user to force the FPU model. */
+ new_set = add_set_enum_cmd
+ ("fpu", no_class, fp_model_strings, &current_fp_model,
+ "Set the floating point type.\n"
+ "auto - Determine the FP typefrom the OS-ABI.\n"
+ "softfpa - Software FP, mixed-endian doubles on little-endian ARMs.\n"
+ "fpa - FPA co-processor (GCC compiled).\n"
+ "softvfp - Software FP with pure-endian doubles.\n"
+ "vfp - VFP co-processor.",
+ &setarmcmdlist);
+ set_cmd_sfunc (new_set, set_fp_model_sfunc);
+ set_cmd_sfunc (add_show_from_set (new_set, &showarmcmdlist), show_fp_model);
/* Add the deprecated "othernames" command. */
-
- add_com ("othernames", class_obscure, arm_othernames,
- "Switch to the next set of register names.");
-
- /* Allocate the prologue_cache. */
- prologue_cache = deprecated_frame_xmalloc ();
- deprecated_set_frame_extra_info_hack (prologue_cache, xcalloc (1, sizeof (struct frame_extra_info)));
+ deprecate_cmd (add_com ("othernames", class_obscure, arm_othernames,
+ "Switch to the next set of register names."),
+ "set arm disassembly");
/* Debugging flag. */
- add_show_from_set (add_set_cmd ("arm", class_maintenance, var_zinteger,
- &arm_debug, "Set arm debugging.\n\
-When non-zero, arm specific debugging is enabled.", &setdebuglist),
- &showdebuglist);
+ add_setshow_boolean_cmd ("arm", class_maintenance, &arm_debug,
+ "Set ARM debugging. "
+ "When on, arm-specific debugging is enabled.",
+ "Show ARM debugging. "
+ "When on, arm-specific debugging is enabled.",
+ NULL, NULL,
+ &setdebuglist, &showdebuglist);
}
diff --git a/gdb/arm-tdep.h b/gdb/arm-tdep.h
index b8c4711..26f3a83 100644
--- a/gdb/arm-tdep.h
+++ b/gdb/arm-tdep.h
@@ -109,16 +109,24 @@ enum gdb_regnum {
only generate 2 of those. The third is APCS_FLOAT, where arguments to
functions are passed in floating-point registers.
- In addition to the traditional models, VFP adds two more. */
+ In addition to the traditional models, VFP adds two more.
+
+ If you update this enum, don't forget to update fp_model_strings in
+ arm-tdep.c. */
enum arm_float_model
{
- ARM_FLOAT_SOFT,
- ARM_FLOAT_FPA,
- ARM_FLOAT_SOFT_VFP,
- ARM_FLOAT_VFP
+ ARM_FLOAT_AUTO, /* Automatic detection. Do not set in tdep. */
+ ARM_FLOAT_SOFT_FPA, /* Traditional soft-float (mixed-endian on LE ARM). */
+ ARM_FLOAT_FPA, /* FPA co-processor. GCC calling convention. */
+ ARM_FLOAT_SOFT_VFP, /* Soft-float with pure-endian doubles. */
+ ARM_FLOAT_VFP, /* Full VFP calling convention. */
+ ARM_FLOAT_LAST /* Keep at end. */
};
+/* A method to the setting based on user's choice and ABI setting. */
+enum arm_float_model arm_get_fp_model (struct gdbarch *);
+
/* Target-dependent structure in gdbarch. */
struct gdbarch_tdep
{
diff --git a/gdb/armnbsd-tdep.c b/gdb/armnbsd-tdep.c
index d12fda0..88cf2e5 100644
--- a/gdb/armnbsd-tdep.c
+++ b/gdb/armnbsd-tdep.c
@@ -66,7 +66,7 @@ arm_netbsd_aout_init_abi (struct gdbarch_info info,
set_gdbarch_in_solib_call_trampoline
(gdbarch, arm_netbsd_aout_in_solib_call_trampoline);
- tdep->fp_model = ARM_FLOAT_SOFT;
+ tdep->fp_model = ARM_FLOAT_SOFT_FPA;
}
static void
diff --git a/gdb/avr-tdep.c b/gdb/avr-tdep.c
index 975132a..b787c81 100644
--- a/gdb/avr-tdep.c
+++ b/gdb/avr-tdep.c
@@ -736,7 +736,7 @@ avr_init_extra_frame_info (int fromleaf, struct frame_info *fi)
int reg;
if (get_next_frame (fi))
- deprecated_update_frame_pc_hack (fi, FRAME_SAVED_PC (get_next_frame (fi)));
+ deprecated_update_frame_pc_hack (fi, DEPRECATED_FRAME_SAVED_PC (get_next_frame (fi)));
frame_extra_info_zalloc (fi, sizeof (struct frame_extra_info));
frame_saved_regs_zalloc (fi);
@@ -1147,7 +1147,7 @@ avr_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_write_pc (gdbarch, avr_write_pc);
set_gdbarch_read_fp (gdbarch, avr_read_fp);
set_gdbarch_read_sp (gdbarch, avr_read_sp);
- set_gdbarch_write_sp (gdbarch, avr_write_sp);
+ set_gdbarch_deprecated_dummy_write_sp (gdbarch, avr_write_sp);
set_gdbarch_num_regs (gdbarch, AVR_NUM_REGS);
@@ -1168,25 +1168,18 @@ avr_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_print_insn (gdbarch, print_insn_avr);
set_gdbarch_call_dummy_address (gdbarch, avr_call_dummy_address);
- set_gdbarch_call_dummy_start_offset (gdbarch, 0);
- set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 1);
- set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 0);
- set_gdbarch_call_dummy_length (gdbarch, 0);
- set_gdbarch_call_dummy_p (gdbarch, 1);
set_gdbarch_call_dummy_words (gdbarch, avr_call_dummy_words);
- set_gdbarch_call_dummy_stack_adjust_p (gdbarch, 0);
- set_gdbarch_fix_call_dummy (gdbarch, generic_fix_call_dummy);
/* set_gdbarch_believe_pcc_promotion (gdbarch, 1); // TRoth: should this be set? */
set_gdbarch_address_to_pointer (gdbarch, avr_address_to_pointer);
set_gdbarch_pointer_to_address (gdbarch, avr_pointer_to_address);
- set_gdbarch_push_arguments (gdbarch, avr_push_arguments);
- set_gdbarch_push_return_address (gdbarch, avr_push_return_address);
- set_gdbarch_pop_frame (gdbarch, avr_pop_frame);
+ set_gdbarch_deprecated_push_arguments (gdbarch, avr_push_arguments);
+ set_gdbarch_deprecated_push_return_address (gdbarch, avr_push_return_address);
+ set_gdbarch_deprecated_pop_frame (gdbarch, avr_pop_frame);
set_gdbarch_use_struct_convention (gdbarch, generic_use_struct_convention);
- set_gdbarch_store_struct_return (gdbarch, avr_store_struct_return);
+ set_gdbarch_deprecated_store_struct_return (gdbarch, avr_store_struct_return);
set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, avr_scan_prologue);
set_gdbarch_deprecated_init_extra_frame_info (gdbarch, avr_init_extra_frame_info);
@@ -1200,11 +1193,11 @@ avr_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
avr_remote_translate_xfer_address);
set_gdbarch_frame_args_skip (gdbarch, 0);
set_gdbarch_frameless_function_invocation (gdbarch, frameless_look_for_prologue); /* ??? */
- set_gdbarch_frame_chain (gdbarch, avr_frame_chain);
- set_gdbarch_frame_saved_pc (gdbarch, avr_frame_saved_pc);
+ set_gdbarch_deprecated_frame_chain (gdbarch, avr_frame_chain);
+ set_gdbarch_deprecated_frame_saved_pc (gdbarch, avr_frame_saved_pc);
set_gdbarch_frame_args_address (gdbarch, avr_frame_address);
set_gdbarch_frame_locals_address (gdbarch, avr_frame_address);
- set_gdbarch_saved_pc_after_call (gdbarch, avr_saved_pc_after_call);
+ set_gdbarch_deprecated_saved_pc_after_call (gdbarch, avr_saved_pc_after_call);
set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown);
set_gdbarch_convert_from_func_ptr_addr (gdbarch,
diff --git a/gdb/ax-gdb.h b/gdb/ax-gdb.h
index 3e1006a..b091384 100644
--- a/gdb/ax-gdb.h
+++ b/gdb/ax-gdb.h
@@ -20,7 +20,8 @@
#ifndef AX_GDB_H
#define AX_GDB_H
-
+
+struct expression;
/* Types and enums */
diff --git a/gdb/block.c b/gdb/block.c
index eda282a..603744e 100644
--- a/gdb/block.c
+++ b/gdb/block.c
@@ -30,7 +30,7 @@
C++ files, namely using declarations and the current namespace in
scope. */
-struct namespace_info
+struct block_namespace_info
{
const char *scope;
struct using_direct *using;
@@ -160,30 +160,6 @@ block_for_pc (register CORE_ADDR pc)
/* Now come some functions designed to deal with C++ namespace issues.
The accessors are safe to use even in the non-C++ case. */
-/* This returns the using directives associated to BLOCK (but _not_
- its parents), if any. */
-
-static struct using_direct *
-block_using (const struct block *block)
-{
- if (BLOCK_NAMESPACE (block) == NULL)
- return NULL;
- else
- return BLOCK_NAMESPACE (block)->using;
-}
-
-/* Set block_using (BLOCK) to USING; if needed, allocate memory via
- OBSTACK. */
-
-void
-block_set_using (struct block *block, struct using_direct *using,
- struct obstack *obstack)
-{
- block_initialize_namespace (block, obstack);
-
- BLOCK_NAMESPACE (block)->using = using;
-}
-
/* This returns the namespace that BLOCK is enclosed in, or "" if it
isn't enclosed in a namespace at all. This travels the chain of
superblocks looking for a scope, if necessary. */
@@ -201,7 +177,7 @@ block_scope (const struct block *block)
return "";
}
-/* Set block_scope (BLOCK) to SCOPE; if needed, allocate memory via
+/* Set BLOCK's scope member to SCOPE; if needed, allocate memory via
OBSTACK. (It won't make a copy of SCOPE, however, so that already
has to be allocated correctly.) */
@@ -214,6 +190,32 @@ block_set_scope (struct block *block, const char *scope,
BLOCK_NAMESPACE (block)->scope = scope;
}
+/* This returns the using directives associated to BLOCK (but _not_
+ its parents), if any. */
+
+static struct using_direct *
+block_using (const struct block *block)
+{
+ if (BLOCK_NAMESPACE (block) == NULL)
+ return NULL;
+ else
+ return BLOCK_NAMESPACE (block)->using;
+}
+
+/* Set BLOCK's using member to USING; if needed, allocate memory via
+ OBSTACK. (It won't make a copy of USING, however, so that already
+ has to be allocated correctly.) */
+
+void
+block_set_using (struct block *block,
+ struct using_direct *using,
+ struct obstack *obstack)
+{
+ block_initialize_namespace (block, obstack);
+
+ BLOCK_NAMESPACE (block)->using = using;
+}
+
/* If BLOCK_NAMESPACE (block) is NULL, allocate it via OBSTACK and
ititialize its members to zero. */
@@ -223,7 +225,7 @@ block_initialize_namespace (struct block *block, struct obstack *obstack)
if (BLOCK_NAMESPACE (block) == NULL)
{
BLOCK_NAMESPACE (block)
- = obstack_alloc (obstack, sizeof (struct namespace_info));
+ = obstack_alloc (obstack, sizeof (struct block_namespace_info));
BLOCK_NAMESPACE (block)->scope = NULL;
BLOCK_NAMESPACE (block)->using = NULL;
}
@@ -319,4 +321,3 @@ allocate_block (struct obstack *obstack)
return bl;
}
-
diff --git a/gdb/block.h b/gdb/block.h
index 36d9601..4a67085 100644
--- a/gdb/block.h
+++ b/gdb/block.h
@@ -26,10 +26,10 @@
struct symbol;
struct symtab;
-struct dictionary;
-struct namespace_info;
+struct block_namespace_info;
struct using_direct;
struct obstack;
+struct dictionary;
/* All of the name-scope contours of the program
are represented by `struct block' objects.
@@ -92,7 +92,7 @@ struct block
this block: using directives and the current namespace
scope. */
- struct namespace_info *namespace;
+ struct block_namespace_info *namespace;
}
cplus_specific;
}
diff --git a/gdb/blockframe.c b/gdb/blockframe.c
index 69ca9d8..fd4eefd 100644
--- a/gdb/blockframe.c
+++ b/gdb/blockframe.c
@@ -44,11 +44,11 @@
void _initialize_blockframe (void);
-/* Is ADDR inside the startup file? Note that if your machine
- has a way to detect the bottom of the stack, there is no need
- to call this function from FRAME_CHAIN_VALID; the reason for
- doing so is that some machines have no way of detecting bottom
- of stack.
+/* Is ADDR inside the startup file? Note that if your machine has a
+ way to detect the bottom of the stack, there is no need to call
+ this function from DEPRECATED_FRAME_CHAIN_VALID; the reason for
+ doing so is that some machines have no way of detecting bottom of
+ stack.
A PC of zero is always considered to be the bottom of the stack. */
@@ -75,7 +75,7 @@ inside_entry_file (CORE_ADDR addr)
that correspond to the main() function. See comments above for why
we might want to do this.
- Typically called from FRAME_CHAIN_VALID.
+ Typically called from DEPRECATED_FRAME_CHAIN_VALID.
A PC of zero is always considered to be the bottom of the stack. */
@@ -87,9 +87,10 @@ inside_main_func (CORE_ADDR pc)
if (symfile_objfile == 0)
return 0;
- /* If the addr range is not set up at symbol reading time, set it up now.
- This is for FRAME_CHAIN_VALID_ALTERNATE. I do this for coff, because
- it is unable to set it up and symbol reading time. */
+ /* If the addr range is not set up at symbol reading time, set it up
+ now. This is for DEPRECATED_FRAME_CHAIN_VALID_ALTERNATE. I do
+ this for coff, because it is unable to set it up and symbol
+ reading time. */
if (symfile_objfile->ei.main_func_lowpc == INVALID_ENTRY_LOWPC &&
symfile_objfile->ei.main_func_highpc == INVALID_ENTRY_HIGHPC)
@@ -113,7 +114,7 @@ inside_main_func (CORE_ADDR pc)
that correspond to the process entry point function. See comments
in objfiles.h for why we might want to do this.
- Typically called from FRAME_CHAIN_VALID.
+ Typically called from DEPRECATED_FRAME_CHAIN_VALID.
A PC of zero is always considered to be the bottom of the stack. */
@@ -145,7 +146,7 @@ frameless_look_for_prologue (struct frame_info *frame)
{
CORE_ADDR func_start, after_prologue;
- func_start = get_pc_function_start (get_frame_pc (frame));
+ func_start = get_frame_func (frame);
if (func_start)
{
func_start += FUNCTION_START_OFFSET;
@@ -553,12 +554,12 @@ deprecated_pc_in_call_dummy_at_entry_point (CORE_ADDR pc, CORE_ADDR sp,
&& (pc) <= (CALL_DUMMY_ADDRESS () + DECR_PC_AFTER_BREAK));
}
-/* Function: frame_chain_valid
- Returns true for a user frame or a call_function_by_hand dummy frame,
- and false for the CRT0 start-up frame. Purpose is to terminate backtrace. */
+/* Returns true for a user frame or a call_function_by_hand dummy
+ frame, and false for the CRT0 start-up frame. Purpose is to
+ terminate backtrace. */
int
-frame_chain_valid (CORE_ADDR fp, struct frame_info *fi)
+legacy_frame_chain_valid (CORE_ADDR fp, struct frame_info *fi)
{
/* Don't prune CALL_DUMMY frames. */
if (DEPRECATED_USE_GENERIC_DUMMY_FRAMES
@@ -574,6 +575,11 @@ frame_chain_valid (CORE_ADDR fp, struct frame_info *fi)
if (INNER_THAN (fp, get_frame_base (fi)))
return 0;
+ /* If the architecture has a custom DEPRECATED_FRAME_CHAIN_VALID,
+ call it now. */
+ if (DEPRECATED_FRAME_CHAIN_VALID_P ())
+ return DEPRECATED_FRAME_CHAIN_VALID (fp, fi);
+
/* If we're already inside the entry function for the main objfile, then it
isn't valid. */
if (inside_entry_func (get_frame_pc (fi)))
@@ -586,9 +592,5 @@ frame_chain_valid (CORE_ADDR fp, struct frame_info *fi)
if (inside_entry_file (frame_pc_unwind (fi)))
return 0;
- /* If the architecture has a custom FRAME_CHAIN_VALID, call it now. */
- if (FRAME_CHAIN_VALID_P ())
- return FRAME_CHAIN_VALID (fp, fi);
-
return 1;
}
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 5104c3d..6bbc642 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -81,10 +81,6 @@ static void clear_command (char *, int);
static void catch_command (char *, int);
-static void handle_gnu_4_16_catch_command (char *, int, int);
-
-static struct symtabs_and_lines get_catch_sals (int);
-
static void watch_command (char *, int);
static int can_use_hardware_watchpoint (struct value *);
@@ -1680,7 +1676,7 @@ breakpoint_inserted_here_p (CORE_ADDR pc)
/* Return nonzero if FRAME is a dummy frame. We can't use
DEPRECATED_PC_IN_CALL_DUMMY because figuring out the saved SP would
- take too much time, at least using get_saved_register on the 68k.
+ take too much time, at least using frame_register() on the 68k.
This means that for this function to work right a port must use the
bp_call_dummy breakpoint. */
@@ -1689,9 +1685,6 @@ deprecated_frame_in_dummy (struct frame_info *frame)
{
struct breakpoint *b;
- if (!CALL_DUMMY_P)
- return 0;
-
/* This function is used by two files: get_frame_type(), after first
checking that !DEPRECATED_USE_GENERIC_DUMMY_FRAMES; and
sparc-tdep.c, which doesn't yet use generic dummy frames anyway. */
@@ -1817,6 +1810,11 @@ bpstat_copy (bpstat bs)
{
tmp = (bpstat) xmalloc (sizeof (*tmp));
memcpy (tmp, bs, sizeof (*tmp));
+ if (bs->commands != NULL)
+ tmp->commands = copy_command_lines (bs->commands);
+ if (bs->old_val != NULL)
+ tmp->old_val = value_copy (bs->old_val);
+
if (p == NULL)
/* This is the first thing in the chain. */
retval = tmp;
@@ -2759,9 +2757,9 @@ bpstat_stop_status (CORE_ADDR *pc, int not_a_sw_breakpoint)
/* We will stop here */
if (b->disposition == disp_disable)
b->enable_state = bp_disabled;
- bs->commands = copy_command_lines (b->commands);
if (b->silent)
bs->print = 0;
+ bs->commands = b->commands;
if (bs->commands &&
(STREQ ("silent", bs->commands->line) ||
(xdb_commands && STREQ ("Q", bs->commands->line))))
@@ -2769,6 +2767,7 @@ bpstat_stop_status (CORE_ADDR *pc, int not_a_sw_breakpoint)
bs->commands = bs->commands->next;
bs->print = 0;
}
+ bs->commands = copy_command_lines (bs->commands);
}
}
/* Print nothing for this entry if we dont stop or if we dont print. */
@@ -3420,7 +3419,7 @@ print_one_breakpoint (struct breakpoint *b,
ui_out_text (uiout, "\tstop only in stack frame at ");
/* FIXME: cagney/2002-12-01: Shouldn't be poeking around inside
the frame ID. */
- ui_out_field_core_addr (uiout, "frame", b->frame_id.base);
+ ui_out_field_core_addr (uiout, "frame", b->frame_id.stack_addr);
ui_out_text (uiout, "\n");
}
@@ -5701,187 +5700,6 @@ enable_catch_breakpoint (void)
}
#endif /* 0 */
-struct sal_chain
-{
- struct sal_chain *next;
- struct symtab_and_line sal;
-};
-
-#if 0
-/* Not really used -- invocation in handle_gnu_4_16_catch_command
- had been commented out in the v.4.16 sources, and stays
- disabled there now because "catch NAME" syntax isn't allowed.
- pai/1997-07-11 */
-/* This isn't used; I don't know what it was for. */
-/* For each catch clause identified in ARGS, run FUNCTION
- with that clause as an argument. */
-static struct symtabs_and_lines
-map_catch_names (char *args, int (*function) ())
-{
- register char *p = args;
- register char *p1;
- struct symtabs_and_lines sals;
-#if 0
- struct sal_chain *sal_chain = 0;
-#endif
-
- if (p == 0)
- error_no_arg ("one or more catch names");
-
- sals.nelts = 0;
- sals.sals = NULL;
-
- while (*p)
- {
- p1 = p;
- /* Don't swallow conditional part. */
- if (p1[0] == 'i' && p1[1] == 'f'
- && (p1[2] == ' ' || p1[2] == '\t'))
- break;
-
- if (isalpha (*p1))
- {
- p1++;
- while (isalnum (*p1) || *p1 == '_' || *p1 == '$')
- p1++;
- }
-
- if (*p1 && *p1 != ' ' && *p1 != '\t')
- error ("Arguments must be catch names.");
-
- *p1 = 0;
-#if 0
- if (function (p))
- {
- struct sal_chain *next = (struct sal_chain *)
- alloca (sizeof (struct sal_chain));
- next->next = sal_chain;
- next->sal = get_catch_sal (p);
- sal_chain = next;
- goto win;
- }
-#endif
- printf_unfiltered ("No catch clause for exception %s.\n", p);
-#if 0
- win:
-#endif
- p = p1;
- while (*p == ' ' || *p == '\t')
- p++;
- }
-}
-#endif
-
-/* This shares a lot of code with `print_frame_label_vars' from stack.c. */
-
-static struct symtabs_and_lines
-get_catch_sals (int this_level_only)
-{
- register struct blockvector *bl;
- register struct block *block;
- int index, have_default = 0;
- CORE_ADDR pc;
- struct symtabs_and_lines sals;
- struct sal_chain *sal_chain = 0;
- char *blocks_searched;
-
- /* Not sure whether an error message is always the correct response,
- but it's better than a core dump. */
- if (deprecated_selected_frame == NULL)
- error ("No selected frame.");
- block = get_frame_block (deprecated_selected_frame, 0);
- pc = get_frame_pc (deprecated_selected_frame);
-
- sals.nelts = 0;
- sals.sals = NULL;
-
- if (block == 0)
- error ("No symbol table info available.\n");
-
- bl = blockvector_for_pc (BLOCK_END (block) - 4, &index);
- blocks_searched = (char *) alloca (BLOCKVECTOR_NBLOCKS (bl) * sizeof (char));
- memset (blocks_searched, 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))
- error ("blockvector blotch");
- if (BLOCKVECTOR_BLOCK (bl, index) != block)
- 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_searched[index] == 0)
- {
- struct block *b = BLOCKVECTOR_BLOCK (bl, index);
- struct dict_iterator iter;
- register struct symbol *sym;
-
- ALL_BLOCK_SYMBOLS (b, iter, sym)
- {
- if (STREQ (DEPRECATED_SYMBOL_NAME (sym), "default"))
- {
- if (have_default)
- continue;
- have_default = 1;
- }
- if (SYMBOL_CLASS (sym) == LOC_LABEL)
- {
- struct sal_chain *next = (struct sal_chain *)
- alloca (sizeof (struct sal_chain));
- next->next = sal_chain;
- next->sal = find_pc_line (SYMBOL_VALUE_ADDRESS (sym),
- 0);
- sal_chain = next;
- }
- }
- blocks_searched[index] = 1;
- }
- index++;
- }
- if (have_default)
- break;
- if (sal_chain && this_level_only)
- break;
-
- /* 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 (sal_chain)
- {
- struct sal_chain *tmp_chain;
-
- /* Count the number of entries. */
- for (index = 0, tmp_chain = sal_chain; tmp_chain;
- tmp_chain = tmp_chain->next)
- index++;
-
- sals.nelts = index;
- sals.sals = (struct symtab_and_line *)
- xmalloc (index * sizeof (struct symtab_and_line));
- for (index = 0; sal_chain; sal_chain = sal_chain->next, index++)
- sals.sals[index] = sal_chain->sal;
- }
-
- return sals;
-}
-
static void
ep_skip_leading_whitespace (char **s)
{
@@ -6219,23 +6037,8 @@ catch_exception_command_1 (enum exception_event_kind ex_event, char *arg,
else
return; /* something went wrong with setting up callbacks */
}
- else
- {
- /* No callbacks from runtime system for exceptions.
- Try GNU C++ exception breakpoints using labels in debug info. */
- if (ex_event == EX_EVENT_CATCH)
- {
- handle_gnu_4_16_catch_command (arg, tempflag, from_tty);
- }
- else if (ex_event == EX_EVENT_THROW)
- {
- /* Set a breakpoint on __raise_exception () */
- warning ("Unsupported with this platform/compiler combination.");
- warning ("Perhaps you can achieve the effect you want by setting");
- warning ("a breakpoint on __raise_exception().");
- }
- }
+ warning ("Unsupported with this platform/compiler combination.");
}
/* Cover routine to allow wrapping target_enable_exception_catchpoints
@@ -6255,111 +6058,6 @@ cover_target_enable_exception_callback (void *arg)
return 1; /*is valid */
}
-
-
-/* This is the original v.4.16 and earlier version of the
- catch_command_1() function. Now that other flavours of "catch"
- have been introduced, and since exception handling can be handled
- in other ways (through target ops) also, this is used only for the
- GNU C++ exception handling system.
- Note: Only the "catch" flavour of GDB 4.16 is handled here. The
- "catch NAME" is now no longer allowed in catch_command_1(). Also,
- there was no code in GDB 4.16 for "catch throw".
-
- Called from catch_exception_command_1 () */
-
-
-static void
-handle_gnu_4_16_catch_command (char *arg, int tempflag, int from_tty)
-{
- /* First, translate ARG into something we can deal with in terms
- of breakpoints. */
-
- struct symtabs_and_lines sals;
- struct symtab_and_line sal;
- register struct expression *cond = 0;
- register struct breakpoint *b;
- char *save_arg;
- int i;
-
- init_sal (&sal); /* initialize to zeroes */
-
- /* If no arg given, or if first arg is 'if ', all active catch clauses
- are breakpointed. */
-
- if (!arg || (arg[0] == 'i' && arg[1] == 'f'
- && (arg[2] == ' ' || arg[2] == '\t')))
- {
- /* Grab all active catch clauses. */
- sals = get_catch_sals (0);
- }
- else
- {
- /* Grab selected catch clauses. */
- error ("catch NAME not implemented");
-
-#if 0
- /* Not sure why this code has been disabled. I'm leaving
- it disabled. We can never come here now anyway
- since we don't allow the "catch NAME" syntax.
- pai/1997-07-11 */
-
- /* This isn't used; I don't know what it was for. */
- sals = map_catch_names (arg, catch_breakpoint);
-#endif
- }
-
- if (!sals.nelts)
- return;
-
- save_arg = arg;
- for (i = 0; i < sals.nelts; i++)
- {
- resolve_sal_pc (&sals.sals[i]);
-
- while (arg && *arg)
- {
- if (arg[0] == 'i' && arg[1] == 'f'
- && (arg[2] == ' ' || arg[2] == '\t'))
- cond = parse_exp_1 ((arg += 2, &arg),
- block_for_pc (sals.sals[i].pc), 0);
- else
- error ("Junk at end of arguments.");
- }
- arg = save_arg;
- }
-
- for (i = 0; i < sals.nelts; i++)
- {
- sal = sals.sals[i];
-
- if (from_tty)
- describe_other_breakpoints (sal.pc, sal.section);
-
- /* Important -- this is an ordinary breakpoint. For platforms
- with callback support for exceptions,
- create_exception_catchpoint() will create special bp types
- (bp_catch_catch and bp_catch_throw), and there is code in
- insert_breakpoints() and elsewhere that depends on that. */
- b = set_raw_breakpoint (sal, bp_breakpoint);
- set_breakpoint_count (breakpoint_count + 1);
- b->number = breakpoint_count;
-
- b->cond = cond;
- b->enable_state = bp_enabled;
- b->disposition = tempflag ? disp_del : disp_donttouch;
-
- mention (b);
- }
-
- if (sals.nelts > 1)
- {
- warning ("Multiple breakpoints were set.");
- warning ("Use the \"delete\" command to delete unwanted breakpoints.");
- }
- xfree (sals.sals);
-}
-
static void
catch_command_1 (char *arg, int tempflag, int from_tty)
{
diff --git a/gdb/buildsym.c b/gdb/buildsym.c
index 494da48..71980ab 100644
--- a/gdb/buildsym.c
+++ b/gdb/buildsym.c
@@ -44,9 +44,9 @@
#include "macrotab.h"
#include "demangle.h" /* Needed by SYMBOL_INIT_DEMANGLED_NAME. */
#include "block.h"
-#include "dictionary.h"
-#include "gdb_assert.h"
#include "cp-support.h"
+#include "dictionary.h"
+
/* Ask buildsym.h to define the vars it normally declares `extern'. */
#define EXTERN
/**/
@@ -66,15 +66,8 @@ static struct pending *free_pendings;
otherwise empty symtab from being tossed. */
static int have_line_numbers;
-
-/* List of using directives that are active in the current file. */
-
-static struct using_direct *using_list;
-
static int compare_line_numbers (const void *ln1p, const void *ln2p);
-
-static void scan_for_anonymous_namespaces (struct symbol *symbol);
/* Initial sizes of data structures. These are realloc'd larger if
@@ -139,71 +132,8 @@ add_symbol_to_list (struct symbol *symbol, struct pending **listhead)
/* Check to see if we might need to look for a mention of anonymous
namespaces. */
- if (SYMBOL_LANGUAGE (symbol) == language_cplus
- && !processing_has_namespace_info
- && SYMBOL_CPLUS_DEMANGLED_NAME (symbol) != NULL)
- scan_for_anonymous_namespaces (symbol);
-}
-
-/* Check to see if a symbol is contained within an anonymous
- namespace; if so, add an appropriate using directive. */
-
-static void
-scan_for_anonymous_namespaces (struct symbol *symbol)
-{
- const char *name = SYMBOL_CPLUS_DEMANGLED_NAME (symbol);
- unsigned int previous_component;
- unsigned int next_component;
- const char *len;
- const char *anonymous_name;
- int anonymous_len;
-
- /* Start with a quick-and-dirty check for mentions of anonymous
- namespaces. */
-
- switch (cp_is_anonymous (name))
- {
- case 1:
- anonymous_name = "(anonymous namespace)";
- break;
- case 2:
- /* FIXME: carlton/2003-03-10: This corresponds to GCCv2, and
- urrently, the demangler actually can't demangle all anonymous
- namespace mentions correctly. (See PR gdb/1134.) Given
- GCCv2's lack of namespace support, I'm tempted to skip this
- case entirely. */
- anonymous_name = "{anonymous}";
- break;
- default:
- return;
- }
-
- anonymous_len = strlen (anonymous_name);
-
- previous_component = 0;
- next_component = cp_find_first_component (name + previous_component);
-
- while (name[next_component] == ':')
- {
- if ((next_component - previous_component) == anonymous_len
- && (strncmp (name + previous_component, anonymous_name,
- anonymous_len)
- == 0))
- {
- /* We've found a component of the name that's an anonymous
- namespace. So add symbols in it to the namespace given
- by the previous component if there is one, or to the
- global namespace if there isn't. */
- add_using_directive (name,
- previous_component == 0
- ? 0 : previous_component - 2,
- next_component);
- }
- /* The "+ 2" is for the "::". */
- previous_component = next_component + 2;
- next_component = (previous_component
- + cp_find_first_component (name + previous_component));
- }
+ if (SYMBOL_LANGUAGE (symbol) == language_cplus)
+ cp_scan_for_anonymous_namespaces (symbol);
}
/* Find a symbol named NAME on a LIST. NAME need not be
@@ -231,34 +161,6 @@ find_symbol_in_list (struct pending *list, char *name, int length)
return (NULL);
}
-/* Add a using directive to using_list. NAME is the start of a string
- that should contain the namespaces we want to add as initial
- substrings, OUTER_LENGTH is the end of the outer namespace, and
- INNER_LENGTH is the end of the inner namespace. If the using
- directive in question has already been added, don't add it
- twice. */
-
-void
-add_using_directive (const char *name, unsigned int outer_length,
- unsigned int inner_length)
-{
- struct using_direct *current;
- struct using_direct *new_node;
-
- /* Has it already been added? */
-
- for (current = using_list; current != NULL; current = current->next)
- {
- if ((strncmp (current->inner, name, inner_length) == 0)
- && (strlen (current->inner) == inner_length)
- && (strlen (current->outer) == outer_length))
- return;
- }
-
- using_list = cp_add_using (name, inner_length, outer_length,
- using_list);
-}
-
/* At end of reading syms, or in case of quit, really free as many
`struct pending's as we can easily find. */
@@ -447,39 +349,10 @@ finish_block (struct symbol *symbol, struct pending **listhead,
}
}
- /* If we're in the C++ case, record the namespace that the
- function was defined in. Make sure that the name was
- originally mangled: if not, there certainly isn't any
- namespace information to worry about! */
- if (SYMBOL_LANGUAGE (symbol) == language_cplus
- && SYMBOL_CPLUS_DEMANGLED_NAME (symbol) != NULL)
+ /* If we're in the C++ case, set the block's scope. */
+ if (SYMBOL_LANGUAGE (symbol) == language_cplus)
{
- if (processing_has_namespace_info)
- {
- block_set_scope
- (block, obsavestring (processing_current_prefix,
- strlen (processing_current_prefix),
- &objfile->symbol_obstack),
- &objfile->symbol_obstack);
- }
- else
- {
- /* Try to figure out the appropriate namespace from the
- demangled name. */
-
- /* FIXME: carlton/2003-02-21: If the function in
- question is a method of a class, the name will
- actually include the name of the class as well. This
- should be harmless, but is a little unfortunate. */
-
- const char *name = SYMBOL_CPLUS_DEMANGLED_NAME (symbol);
- unsigned int prefix_len = cp_entire_prefix_len (name);
-
- block_set_scope (block,
- obsavestring (name, prefix_len,
- &objfile->symbol_obstack),
- &objfile->symbol_obstack);
- }
+ cp_set_block_scope (symbol, block, &objfile->symbol_obstack);
}
}
else
@@ -911,8 +784,6 @@ start_symtab (const char *name, char *dirname, CORE_ADDR start_addr)
global_symbols = NULL;
within_function = 0;
have_line_numbers = 0;
- processing_has_namespace_info = 0;
- using_list = NULL;
/* Context stack is initially empty. Allocate first one with room
for 10 levels; reuse it forever afterward. */
@@ -924,6 +795,10 @@ start_symtab (const char *name, char *dirname, CORE_ADDR start_addr)
}
context_stack_depth = 0;
+ /* Set up support for C++ namespace support, in case we need it. */
+
+ cp_initialize_namespace ();
+
/* Initialize the list of sub source files with one entry for this
file (the top-level source file). */
@@ -1045,14 +920,8 @@ end_symtab (CORE_ADDR end_addr, struct objfile *objfile, int section)
finish_block (0, &global_symbols, 0, last_source_start_addr, end_addr,
objfile);
blockvector = make_blockvector (objfile);
- if (using_list != NULL)
- {
- block_set_using (BLOCKVECTOR_BLOCK (blockvector, STATIC_BLOCK),
- cp_copy_usings (using_list,
- &objfile->symbol_obstack),
- &objfile->symbol_obstack);
- using_list = NULL;
- }
+ cp_finalize_namespace (BLOCKVECTOR_BLOCK (blockvector, STATIC_BLOCK),
+ &objfile->symbol_obstack);
}
#ifndef PROCESS_LINENUMBER_HOOK
diff --git a/gdb/buildsym.h b/gdb/buildsym.h
index 026b13e..0a3c087 100644
--- a/gdb/buildsym.h
+++ b/gdb/buildsym.h
@@ -22,6 +22,9 @@
#if !defined (BUILDSYM_H)
#define BUILDSYM_H 1
+struct objfile;
+struct symbol;
+
/* This module provides definitions used for creating and adding to
the symbol table. These routines are called from various symbol-
file-reading routines.
@@ -85,18 +88,6 @@ EXTERN unsigned char processing_gcc_compilation;
EXTERN unsigned char processing_acc_compilation;
-/* When set, the file that we're processing seems to have debugging
- info for C++ namespaces, so buildsym.c shouldn't try to guess
- namespace info itself. */
-
-EXTERN unsigned char processing_has_namespace_info;
-
-/* If processing_has_namespace_info is nonzero, this string should
- contain the name of the current prefix (namespaces plus classes).
- The string is temporary; copy it if you need it. */
-
-EXTERN const char *processing_current_prefix;
-
/* Count symbols as they are processed, for error messages. */
EXTERN unsigned int symnum;
@@ -241,9 +232,6 @@ extern void add_symbol_to_list (struct symbol *symbol,
extern struct symbol *find_symbol_in_list (struct pending *list,
char *name, int length);
-extern void add_using_directive (const char *name, unsigned int outer_length,
- unsigned int inner_length);
-
extern void finish_block (struct symbol *symbol,
struct pending **listhead,
struct pending_block *old_blocks,
diff --git a/gdb/builtin-regs.h b/gdb/builtin-regs.h
index fb9fbcf..631903a 100644
--- a/gdb/builtin-regs.h
+++ b/gdb/builtin-regs.h
@@ -24,6 +24,8 @@
#ifndef BUILTIN_REGS_H
#define BUILTIN_REGS_H
+struct frame_info;
+
extern int builtin_reg_map_name_to_regnum (const char *str, int len);
extern const char *builtin_reg_map_regnum_to_name (int regnum);
diff --git a/gdb/c-lang.c b/gdb/c-lang.c
index 4b4af16..e492b9a 100644
--- a/gdb/c-lang.c
+++ b/gdb/c-lang.c
@@ -31,6 +31,7 @@
#include "gdb_assert.h"
#include "charset.h"
#include "gdb_string.h"
+#include "demangle.h"
extern void _initialize_c_language (void);
static void c_emit_char (int c, struct ui_file * stream, int quoter);
@@ -552,6 +553,8 @@ const struct language_defn c_language_defn =
c_print_type, /* Print a type using appropriate syntax */
c_val_print, /* Print a value using appropriate syntax */
c_value_print, /* Print a top-level value */
+ NULL, /* Language specific skip_trampoline */
+ NULL, /* Language specific symbol demangler */
{"", "", "", ""}, /* Binary format info */
{"0%lo", "0", "o", ""}, /* Octal format info */
{"%ld", "", "d", ""}, /* Decimal format info */
@@ -604,6 +607,8 @@ const struct language_defn cplus_language_defn =
c_print_type, /* Print a type using appropriate syntax */
c_val_print, /* Print a value using appropriate syntax */
c_value_print, /* Print a top-level value */
+ NULL, /* Language specific skip_trampoline */
+ cplus_demangle, /* Language specific symbol demangler */
{"", "", "", ""}, /* Binary format info */
{"0%lo", "0", "o", ""}, /* Octal format info */
{"%ld", "", "d", ""}, /* Decimal format info */
@@ -633,6 +638,8 @@ const struct language_defn asm_language_defn =
c_print_type, /* Print a type using appropriate syntax */
c_val_print, /* Print a value using appropriate syntax */
c_value_print, /* Print a top-level value */
+ NULL, /* Language specific skip_trampoline */
+ NULL, /* Language specific symbol demangler */
{"", "", "", ""}, /* Binary format info */
{"0%lo", "0", "o", ""}, /* Octal format info */
{"%ld", "", "d", ""}, /* Decimal format info */
diff --git a/gdb/c-lang.h b/gdb/c-lang.h
index 0c6c730..2cc00ca 100644
--- a/gdb/c-lang.h
+++ b/gdb/c-lang.h
@@ -23,6 +23,8 @@
#if !defined (C_LANG_H)
#define C_LANG_H 1
+struct ui_file;
+
#include "value.h"
#include "macroexp.h"
diff --git a/gdb/cli-out.c b/gdb/cli-out.c
index e3b45cd..38bf36f 100644
--- a/gdb/cli-out.c
+++ b/gdb/cli-out.c
@@ -1,6 +1,6 @@
/* Output generating routines for GDB CLI.
- Copyright 1999, 2000, 2002 Free Software Foundation, Inc.
+ Copyright 1999, 2000, 2002, 2003 Free Software Foundation, Inc.
Contributed by Cygnus Solutions.
Written by Fernando Nasser for Cygnus.
@@ -33,6 +33,7 @@ struct ui_out_data
struct ui_file *stream;
int suppress_output;
};
+typedef struct ui_out_data cli_out_data;
/* These are the CLI output functions */
@@ -110,7 +111,7 @@ cli_table_begin (struct ui_out *uiout, int nbrofcols,
int nr_rows,
const char *tblid)
{
- struct ui_out_data *data = ui_out_data (uiout);
+ cli_out_data *data = ui_out_data (uiout);
if (nr_rows == 0)
data->suppress_output = 1;
else
@@ -124,7 +125,7 @@ cli_table_begin (struct ui_out *uiout, int nbrofcols,
void
cli_table_body (struct ui_out *uiout)
{
- struct ui_out_data *data = ui_out_data (uiout);
+ cli_out_data *data = ui_out_data (uiout);
if (data->suppress_output)
return;
/* first, close the table header line */
@@ -136,7 +137,7 @@ cli_table_body (struct ui_out *uiout)
void
cli_table_end (struct ui_out *uiout)
{
- struct ui_out_data *data = ui_out_data (uiout);
+ cli_out_data *data = ui_out_data (uiout);
data->suppress_output = 0;
}
@@ -147,7 +148,7 @@ cli_table_header (struct ui_out *uiout, int width, enum ui_align alignment,
const char *col_name,
const char *colhdr)
{
- struct ui_out_data *data = ui_out_data (uiout);
+ cli_out_data *data = ui_out_data (uiout);
if (data->suppress_output)
return;
cli_field_string (uiout, 0, width, alignment, 0, colhdr);
@@ -161,7 +162,7 @@ cli_begin (struct ui_out *uiout,
int level,
const char *id)
{
- struct ui_out_data *data = ui_out_data (uiout);
+ cli_out_data *data = ui_out_data (uiout);
if (data->suppress_output)
return;
}
@@ -173,7 +174,7 @@ cli_end (struct ui_out *uiout,
enum ui_out_type type,
int level)
{
- struct ui_out_data *data = ui_out_data (uiout);
+ cli_out_data *data = ui_out_data (uiout);
if (data->suppress_output)
return;
}
@@ -187,7 +188,7 @@ cli_field_int (struct ui_out *uiout, int fldno, int width,
{
char buffer[20]; /* FIXME: how many chars long a %d can become? */
- struct ui_out_data *data = ui_out_data (uiout);
+ cli_out_data *data = ui_out_data (uiout);
if (data->suppress_output)
return;
sprintf (buffer, "%d", value);
@@ -201,7 +202,7 @@ cli_field_skip (struct ui_out *uiout, int fldno, int width,
enum ui_align alignment,
const char *fldname)
{
- struct ui_out_data *data = ui_out_data (uiout);
+ cli_out_data *data = ui_out_data (uiout);
if (data->suppress_output)
return;
cli_field_string (uiout, fldno, width, alignment, fldname, "");
@@ -221,7 +222,7 @@ cli_field_string (struct ui_out *uiout,
int before = 0;
int after = 0;
- struct ui_out_data *data = ui_out_data (uiout);
+ cli_out_data *data = ui_out_data (uiout);
if (data->suppress_output)
return;
@@ -268,7 +269,7 @@ cli_field_fmt (struct ui_out *uiout, int fldno,
const char *format,
va_list args)
{
- struct ui_out_data *data = ui_out_data (uiout);
+ cli_out_data *data = ui_out_data (uiout);
if (data->suppress_output)
return;
@@ -281,7 +282,7 @@ cli_field_fmt (struct ui_out *uiout, int fldno,
void
cli_spaces (struct ui_out *uiout, int numspaces)
{
- struct ui_out_data *data = ui_out_data (uiout);
+ cli_out_data *data = ui_out_data (uiout);
if (data->suppress_output)
return;
print_spaces_filtered (numspaces, data->stream);
@@ -290,7 +291,7 @@ cli_spaces (struct ui_out *uiout, int numspaces)
void
cli_text (struct ui_out *uiout, const char *string)
{
- struct ui_out_data *data = ui_out_data (uiout);
+ cli_out_data *data = ui_out_data (uiout);
if (data->suppress_output)
return;
fputs_filtered (string, data->stream);
@@ -300,7 +301,7 @@ void
cli_message (struct ui_out *uiout, int verbosity,
const char *format, va_list args)
{
- struct ui_out_data *data = ui_out_data (uiout);
+ cli_out_data *data = ui_out_data (uiout);
if (data->suppress_output)
return;
if (ui_out_get_verblvl (uiout) >= verbosity)
@@ -310,7 +311,7 @@ cli_message (struct ui_out *uiout, int verbosity,
void
cli_wrap_hint (struct ui_out *uiout, char *identstring)
{
- struct ui_out_data *data = ui_out_data (uiout);
+ cli_out_data *data = ui_out_data (uiout);
if (data->suppress_output)
return;
wrap_here (identstring);
@@ -319,7 +320,7 @@ cli_wrap_hint (struct ui_out *uiout, char *identstring)
void
cli_flush (struct ui_out *uiout)
{
- struct ui_out_data *data = ui_out_data (uiout);
+ cli_out_data *data = ui_out_data (uiout);
gdb_flush (data->stream);
}
@@ -334,7 +335,7 @@ out_field_fmt (struct ui_out *uiout, int fldno,
const char *fldname,
const char *format,...)
{
- struct ui_out_data *data = ui_out_data (uiout);
+ cli_out_data *data = ui_out_data (uiout);
va_list args;
va_start (args, format);
@@ -348,7 +349,7 @@ out_field_fmt (struct ui_out *uiout, int fldno,
static void
field_separator (void)
{
- struct ui_out_data *data = ui_out_data (uiout);
+ cli_out_data *data = ui_out_data (uiout);
fputc_filtered (' ', data->stream);
}
@@ -359,7 +360,7 @@ cli_out_new (struct ui_file *stream)
{
int flags = ui_source_list;
- struct ui_out_data *data = XMALLOC (struct ui_out_data);
+ cli_out_data *data = XMALLOC (cli_out_data);
data->stream = stream;
data->suppress_output = 0;
return ui_out_new (&cli_ui_out_impl, data, flags);
@@ -368,7 +369,7 @@ cli_out_new (struct ui_file *stream)
struct ui_file *
cli_out_set_stream (struct ui_out *uiout, struct ui_file *stream)
{
- struct ui_out_data *data = ui_out_data (uiout);
+ cli_out_data *data = ui_out_data (uiout);
struct ui_file *old = data->stream;
data->stream = stream;
return old;
diff --git a/gdb/cli-out.h b/gdb/cli-out.h
index a984d05..8bca872 100644
--- a/gdb/cli-out.h
+++ b/gdb/cli-out.h
@@ -22,6 +22,8 @@
#ifndef CLI_OUT_H
#define CLI_OUT_H
+struct ui_file;
+
extern struct ui_out *cli_out_new (struct ui_file *stream);
extern struct ui_file *cli_out_set_stream (struct ui_out *uiout,
diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c
index 108329a..c33c242 100644
--- a/gdb/cli/cli-cmds.c
+++ b/gdb/cli/cli-cmds.c
@@ -171,6 +171,10 @@ struct cmd_list_element *maintenanceinfolist;
struct cmd_list_element *maintenanceprintlist;
+/* Chain containing all defined "maintenance list" subcommands. */
+
+struct cmd_list_element *maintenancelistlist;
+
struct cmd_list_element *setprintlist;
struct cmd_list_element *showprintlist;
@@ -1032,6 +1036,7 @@ init_cmd_lists (void)
maintenancelist = NULL;
maintenanceinfolist = NULL;
maintenanceprintlist = NULL;
+ maintenancelistlist = NULL;
setprintlist = NULL;
showprintlist = NULL;
setchecklist = NULL;
diff --git a/gdb/cli/cli-cmds.h b/gdb/cli/cli-cmds.h
index a6e574e..1f340ef 100644
--- a/gdb/cli/cli-cmds.h
+++ b/gdb/cli/cli-cmds.h
@@ -87,6 +87,10 @@ extern struct cmd_list_element *maintenanceinfolist;
extern struct cmd_list_element *maintenanceprintlist;
+/* Chain containing all defined "maintenance list" subcommands. */
+
+extern struct cmd_list_element *maintenancelistlist;
+
extern struct cmd_list_element *setprintlist;
extern struct cmd_list_element *showprintlist;
diff --git a/gdb/cli/cli-script.h b/gdb/cli/cli-script.h
index 898e3cc..03cb841 100644
--- a/gdb/cli/cli-script.h
+++ b/gdb/cli/cli-script.h
@@ -19,6 +19,10 @@
#if !defined (CLI_SCRIPT_H)
#define CLI_SCRIPT_H 1
+struct ui_file;
+struct command_line;
+struct cmd_list_element;
+
/* Exported to cli/cli-cmds.c */
extern void script_from_file (FILE *stream, char *file);
diff --git a/gdb/cli/cli-setshow.h b/gdb/cli/cli-setshow.h
index 393612a..470b8b7 100644
--- a/gdb/cli/cli-setshow.h
+++ b/gdb/cli/cli-setshow.h
@@ -19,6 +19,8 @@
#if !defined (CLI_SETSHOW_H)
#define CLI_SETSHOW_H 1
+struct cmd_list_element;
+
/* Exported to cli/cli-cmds.c and gdb/top.c */
/* Do a "set" or "show" command. ARG is NULL if no argument, or the text
diff --git a/gdb/config/i386/cygwin.mt b/gdb/config/i386/cygwin.mt
index 4dfc0c2..6c16345 100644
--- a/gdb/config/i386/cygwin.mt
+++ b/gdb/config/i386/cygwin.mt
@@ -1,5 +1,5 @@
# Target: Intel 386 run win32
-TDEPFILES= i386-tdep.o i387-tdep.o
+TDEPFILES= i386-tdep.o i386-cygwin-tdep.o i387-tdep.o
TM_FILE= tm-cygwin.h
diff --git a/gdb/config/i386/nm-ptx4.h b/gdb/config/i386/nm-ptx4.h
index 9c8f41c..74db165 100644
--- a/gdb/config/i386/nm-ptx4.h
+++ b/gdb/config/i386/nm-ptx4.h
@@ -1,66 +1,66 @@
-/* Definitions to make GDB run on a Sequent Symmetry under ptx
- with Weitek 1167 and i387 support.
- Copyright 1986, 1987, 1989, 1992, 1994, 1996, 2000
- Free Software Foundation, Inc.
-
- This file is part of GDB.
-
- 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.
-
- 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.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-
-#include "regcache.h"
-
-#include "config/nm-sysv4.h"
-
-#undef USE_PROC_FS
-
-#include "i386/nm-symmetry.h"
-
-#define PTRACE_READ_REGS(pid,regaddr) mptrace (XPT_RREGS, (pid), (regaddr), 0)
-#define PTRACE_WRITE_REGS(pid,regaddr) \
- mptrace (XPT_WREGS, (pid), (regaddr), 0)
-
-/* Override copies of {fetch,store}_inferior_registers in infptrace.c. */
-
-#define FETCH_INFERIOR_REGISTERS
-
-/* We must fetch all the regs before storing, since we store all at once. */
-
-#define CHILD_PREPARE_TO_STORE() deprecated_read_register_bytes (0, NULL, REGISTER_BYTES)
-
-#define CHILD_WAIT
-struct target_waitstatus;
-extern ptid_t child_wait (ptid_t, struct target_waitstatus *);
-
-/*
- * ptx does attach as of ptx version 2.1. Prior to that, the interface
- * exists but does not work.
- *
- * FIXME: Using attach/detach requires using the ptx MPDEBUGGER
- * interface. There are still problems with that, so for now don't
- * enable attach/detach. If you turn it on anyway, it will mostly
- * work, but has a number of bugs. -fubar, 2/94.
- */
-/*#define ATTACH_DETACH 1 */
-#undef ATTACH_DETACH
-#define PTRACE_ATTACH XPT_DEBUG
-#define PTRACE_DETACH XPT_UNDEBUG
-/*
- * The following drivel is needed because there are two ptrace-ish
- * calls on ptx: ptrace() and mptrace(), each of which does about half
- * of the ptrace functions.
- */
-#define PTRACE_ATTACH_CALL(pid) ptx_do_attach(pid)
-#define PTRACE_DETACH_CALL(pid, signo) ptx_do_detach(pid, signo)
+// OBSOLETE /* Definitions to make GDB run on a Sequent Symmetry under ptx
+// OBSOLETE with Weitek 1167 and i387 support.
+// OBSOLETE Copyright 1986, 1987, 1989, 1992, 1994, 1996, 2000
+// OBSOLETE Free Software Foundation, Inc.
+// OBSOLETE
+// OBSOLETE This file is part of GDB.
+// OBSOLETE
+// OBSOLETE This program is free software; you can redistribute it and/or modify
+// OBSOLETE it under the terms of the GNU General Public License as published by
+// OBSOLETE the Free Software Foundation; either version 2 of the License, or
+// OBSOLETE (at your option) any later version.
+// OBSOLETE
+// OBSOLETE This program is distributed in the hope that it will be useful,
+// OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of
+// OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// OBSOLETE GNU General Public License for more details.
+// OBSOLETE
+// OBSOLETE You should have received a copy of the GNU General Public License
+// OBSOLETE along with this program; if not, write to the Free Software
+// OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330,
+// OBSOLETE Boston, MA 02111-1307, USA. */
+// OBSOLETE
+// OBSOLETE #include "regcache.h"
+// OBSOLETE
+// OBSOLETE #include "config/nm-sysv4.h"
+// OBSOLETE
+// OBSOLETE #undef USE_PROC_FS
+// OBSOLETE
+// OBSOLETE #include "i386/nm-symmetry.h"
+// OBSOLETE
+// OBSOLETE #define PTRACE_READ_REGS(pid,regaddr) mptrace (XPT_RREGS, (pid), (regaddr), 0)
+// OBSOLETE #define PTRACE_WRITE_REGS(pid,regaddr) \
+// OBSOLETE mptrace (XPT_WREGS, (pid), (regaddr), 0)
+// OBSOLETE
+// OBSOLETE /* Override copies of {fetch,store}_inferior_registers in infptrace.c. */
+// OBSOLETE
+// OBSOLETE #define FETCH_INFERIOR_REGISTERS
+// OBSOLETE
+// OBSOLETE /* We must fetch all the regs before storing, since we store all at once. */
+// OBSOLETE
+// OBSOLETE #define CHILD_PREPARE_TO_STORE() deprecated_read_register_bytes (0, NULL, REGISTER_BYTES)
+// OBSOLETE
+// OBSOLETE #define CHILD_WAIT
+// OBSOLETE struct target_waitstatus;
+// OBSOLETE extern ptid_t child_wait (ptid_t, struct target_waitstatus *);
+// OBSOLETE
+// OBSOLETE /*
+// OBSOLETE * ptx does attach as of ptx version 2.1. Prior to that, the interface
+// OBSOLETE * exists but does not work.
+// OBSOLETE *
+// OBSOLETE * FIXME: Using attach/detach requires using the ptx MPDEBUGGER
+// OBSOLETE * interface. There are still problems with that, so for now don't
+// OBSOLETE * enable attach/detach. If you turn it on anyway, it will mostly
+// OBSOLETE * work, but has a number of bugs. -fubar, 2/94.
+// OBSOLETE */
+// OBSOLETE /*#define ATTACH_DETACH 1 */
+// OBSOLETE #undef ATTACH_DETACH
+// OBSOLETE #define PTRACE_ATTACH XPT_DEBUG
+// OBSOLETE #define PTRACE_DETACH XPT_UNDEBUG
+// OBSOLETE /*
+// OBSOLETE * The following drivel is needed because there are two ptrace-ish
+// OBSOLETE * calls on ptx: ptrace() and mptrace(), each of which does about half
+// OBSOLETE * of the ptrace functions.
+// OBSOLETE */
+// OBSOLETE #define PTRACE_ATTACH_CALL(pid) ptx_do_attach(pid)
+// OBSOLETE #define PTRACE_DETACH_CALL(pid, signo) ptx_do_detach(pid, signo)
diff --git a/gdb/config/i386/nm-symmetry.h b/gdb/config/i386/nm-symmetry.h
index d3f57e6..72b7d8d 100644
--- a/gdb/config/i386/nm-symmetry.h
+++ b/gdb/config/i386/nm-symmetry.h
@@ -1,50 +1,50 @@
-/* Definitions to make GDB run on a Sequent Symmetry under dynix 3.0,
- with Weitek 1167 and i387 support.
- Copyright 1986, 1987, 1989, 1992, 1994, 1996, 1998, 2000
- Free Software Foundation, Inc.
-
- This file is part of GDB.
-
- 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.
-
- 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.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-
-#include "regcache.h"
-
-/* Override copies of {fetch,store}_inferior_registers in infptrace.c. */
-
-#define FETCH_INFERIOR_REGISTERS
-
-/* We must fetch all the regs before storing, since we store all at once. */
-
-#define CHILD_PREPARE_TO_STORE() deprecated_read_register_bytes (0, NULL, REGISTER_BYTES)
-
-#ifdef _SEQUENT_
-#define CHILD_WAIT
-extern ptid_t child_wait (ptid_t, struct target_waitstatus *);
-#endif
-
-/* This is the amount to subtract from u.u_ar0
- to get the offset in the core file of the register values. */
-
-#ifdef _SEQUENT_
-#include <sys/param.h>
-#include <sys/user.h>
-#include <sys/mc_vmparam.h>
-/* VA_UAREA is defined in <sys/mc_vmparam.h>, and is dependant upon
- sizeof(struct user) */
-#define KERNEL_U_ADDR (VA_UAREA) /* ptx */
-#else
-#define KERNEL_U_ADDR (0x80000000 - (UPAGES * NBPG)) /* dynix */
-#endif
+// OBSOLETE /* Definitions to make GDB run on a Sequent Symmetry under dynix 3.0,
+// OBSOLETE with Weitek 1167 and i387 support.
+// OBSOLETE Copyright 1986, 1987, 1989, 1992, 1994, 1996, 1998, 2000
+// OBSOLETE Free Software Foundation, Inc.
+// OBSOLETE
+// OBSOLETE This file is part of GDB.
+// OBSOLETE
+// OBSOLETE This program is free software; you can redistribute it and/or modify
+// OBSOLETE it under the terms of the GNU General Public License as published by
+// OBSOLETE the Free Software Foundation; either version 2 of the License, or
+// OBSOLETE (at your option) any later version.
+// OBSOLETE
+// OBSOLETE This program is distributed in the hope that it will be useful,
+// OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of
+// OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// OBSOLETE GNU General Public License for more details.
+// OBSOLETE
+// OBSOLETE You should have received a copy of the GNU General Public License
+// OBSOLETE along with this program; if not, write to the Free Software
+// OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330,
+// OBSOLETE Boston, MA 02111-1307, USA. */
+// OBSOLETE
+// OBSOLETE #include "regcache.h"
+// OBSOLETE
+// OBSOLETE /* Override copies of {fetch,store}_inferior_registers in infptrace.c. */
+// OBSOLETE
+// OBSOLETE #define FETCH_INFERIOR_REGISTERS
+// OBSOLETE
+// OBSOLETE /* We must fetch all the regs before storing, since we store all at once. */
+// OBSOLETE
+// OBSOLETE #define CHILD_PREPARE_TO_STORE() deprecated_read_register_bytes (0, NULL, REGISTER_BYTES)
+// OBSOLETE
+// OBSOLETE #ifdef _SEQUENT_
+// OBSOLETE #define CHILD_WAIT
+// OBSOLETE extern ptid_t child_wait (ptid_t, struct target_waitstatus *);
+// OBSOLETE #endif
+// OBSOLETE
+// OBSOLETE /* This is the amount to subtract from u.u_ar0
+// OBSOLETE to get the offset in the core file of the register values. */
+// OBSOLETE
+// OBSOLETE #ifdef _SEQUENT_
+// OBSOLETE #include <sys/param.h>
+// OBSOLETE #include <sys/user.h>
+// OBSOLETE #include <sys/mc_vmparam.h>
+// OBSOLETE /* VA_UAREA is defined in <sys/mc_vmparam.h>, and is dependant upon
+// OBSOLETE sizeof(struct user) */
+// OBSOLETE #define KERNEL_U_ADDR (VA_UAREA) /* ptx */
+// OBSOLETE #else
+// OBSOLETE #define KERNEL_U_ADDR (0x80000000 - (UPAGES * NBPG)) /* dynix */
+// OBSOLETE #endif
diff --git a/gdb/config/i386/ptx.mh b/gdb/config/i386/ptx.mh
index 554b411..048f5e5 100644
--- a/gdb/config/i386/ptx.mh
+++ b/gdb/config/i386/ptx.mh
@@ -1,7 +1,7 @@
-# Host: Sequent Symmetry running ptx 1.3, with Weitek 1167 or i387
-
-XM_FILE= xm-ptx.h
-NATDEPFILES= inftarg.o fork-child.o symm-nat.o corelow.o core-aout.o
-XM_CLIBS= -lPW -lseq
-
-NAT_FILE= nm-symmetry.h
+# OBSOLETE # Host: Sequent Symmetry running ptx 1.3, with Weitek 1167 or i387
+# OBSOLETE
+# OBSOLETE XM_FILE= xm-ptx.h
+# OBSOLETE NATDEPFILES= inftarg.o fork-child.o symm-nat.o corelow.o core-aout.o
+# OBSOLETE XM_CLIBS= -lPW -lseq
+# OBSOLETE
+# OBSOLETE NAT_FILE= nm-symmetry.h
diff --git a/gdb/config/i386/ptx.mt b/gdb/config/i386/ptx.mt
index 757df33..e9551e2 100644
--- a/gdb/config/i386/ptx.mt
+++ b/gdb/config/i386/ptx.mt
@@ -1,3 +1,3 @@
-# Target: Sequent Symmetry running ptx 2.0, with Weitek 1167 or i387.
-TDEPFILES= symm-tdep.o i387-tdep.o i386-tdep.o
-TM_FILE= tm-ptx.h
+# OBSOLETE # Target: Sequent Symmetry running ptx 2.0, with Weitek 1167 or i387.
+# OBSOLETE TDEPFILES= symm-tdep.o i387-tdep.o i386-tdep.o
+# OBSOLETE TM_FILE= tm-ptx.h
diff --git a/gdb/config/i386/ptx4.mh b/gdb/config/i386/ptx4.mh
index e4aa55e..4d23635 100644
--- a/gdb/config/i386/ptx4.mh
+++ b/gdb/config/i386/ptx4.mh
@@ -1,8 +1,8 @@
-# Host: Sequent Symmetry running ptx 1.3, with Weitek 1167 or i387
-
-XM_FILE= xm-ptx4.h
-NATDEPFILES= inftarg.o fork-child.o symm-nat.o corelow.o core-aout.o \
- core-regset.o solib.o solib-svr4.o solib-legacy.o
-XM_CLIBS= -lseq
-
-NAT_FILE= nm-ptx4.h
+# OBSOLETE # Host: Sequent Symmetry running ptx 1.3, with Weitek 1167 or i387
+# OBSOLETE
+# OBSOLETE XM_FILE= xm-ptx4.h
+# OBSOLETE NATDEPFILES= inftarg.o fork-child.o symm-nat.o corelow.o core-aout.o \
+# OBSOLETE core-regset.o solib.o solib-svr4.o solib-legacy.o
+# OBSOLETE XM_CLIBS= -lseq
+# OBSOLETE
+# OBSOLETE NAT_FILE= nm-ptx4.h
diff --git a/gdb/config/i386/ptx4.mt b/gdb/config/i386/ptx4.mt
index f347809..ad268f8 100644
--- a/gdb/config/i386/ptx4.mt
+++ b/gdb/config/i386/ptx4.mt
@@ -1,3 +1,3 @@
-# Target: Sequent Symmetry running ptx 4.0, with Weitek 1167 or i387.
-TDEPFILES= symm-tdep.o i387-tdep.o i386-tdep.o
-TM_FILE= tm-ptx4.h
+# OBSOLETE # Target: Sequent Symmetry running ptx 4.0, with Weitek 1167 or i387.
+# OBSOLETE TDEPFILES= symm-tdep.o i387-tdep.o i386-tdep.o
+# OBSOLETE TM_FILE= tm-ptx4.h
diff --git a/gdb/config/i386/symmetry.mh b/gdb/config/i386/symmetry.mh
index 486a2fb..19c5264 100644
--- a/gdb/config/i386/symmetry.mh
+++ b/gdb/config/i386/symmetry.mh
@@ -1,4 +1,4 @@
-# Host: Sequent Symmetry running Dynix 3.0, with Weitek 1167 or i387.
-XM_FILE= xm-symmetry.h
-NAT_FILE= nm-symmetry.h
-NATDEPFILES= inftarg.o fork-child.o corelow.o core-aout.o symm-nat.o
+# OBSOLETE # Host: Sequent Symmetry running Dynix 3.0, with Weitek 1167 or i387.
+# OBSOLETE XM_FILE= xm-symmetry.h
+# OBSOLETE NAT_FILE= nm-symmetry.h
+# OBSOLETE NATDEPFILES= inftarg.o fork-child.o corelow.o core-aout.o symm-nat.o
diff --git a/gdb/config/i386/symmetry.mt b/gdb/config/i386/symmetry.mt
index a3dba70..8fccbd2 100644
--- a/gdb/config/i386/symmetry.mt
+++ b/gdb/config/i386/symmetry.mt
@@ -1,3 +1,3 @@
-# Target: Sequent Symmetry running Dynix 3.0, with Weitek 1167 or i387.
-TDEPFILES= i386-tdep.o symm-tdep.o i387-tdep.o
-TM_FILE= tm-symmetry.h
+# OBSOLETE # Target: Sequent Symmetry running Dynix 3.0, with Weitek 1167 or i387.
+# OBSOLETE TDEPFILES= i386-tdep.o symm-tdep.o i387-tdep.o
+# OBSOLETE TM_FILE= tm-symmetry.h
diff --git a/gdb/config/i386/tm-ptx.h b/gdb/config/i386/tm-ptx.h
index 80026e3..4d3ba83 100644
--- a/gdb/config/i386/tm-ptx.h
+++ b/gdb/config/i386/tm-ptx.h
@@ -1,200 +1,194 @@
-/* Target machine definitions for GDB on a Sequent Symmetry under ptx
- with Weitek 1167 and i387 support.
-
- Copyright 1986, 1987, 1989, 1991, 1992, 1993, 1994, 1995, 2000,
- 2003 Free Software Foundation, Inc.
-
- Symmetry version by Jay Vosburgh (fubar@sequent.com).
-
- This file is part of GDB.
-
- 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.
-
- 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.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-
-#ifndef TM_PTX_H
-#define TM_PTX_H 1
-
-/* I don't know if this will work for cross-debugging, even if you do get
- a copy of the right include file. */
-
-#include <sys/reg.h>
-
-#ifdef SEQUENT_PTX4
-#include "i386/tm-i386.h"
-#else /* !SEQUENT_PTX4 */
-#include "i386/tm-i386.h"
-#endif
-
-/* Amount PC must be decremented by after a breakpoint. This is often the
- number of bytes in BREAKPOINT but not always (such as now). */
-
-#undef DECR_PC_AFTER_BREAK
-#define DECR_PC_AFTER_BREAK 0
-
-/* Number of machine registers */
-
-#undef NUM_REGS
-#define NUM_REGS 49
-
-/* Initializer for an array of names of registers. There should be at least
- NUM_REGS strings in this initializer. Any excess ones are simply ignored.
- The order of the first 8 registers must match the compiler's numbering
- scheme (which is the same as the 386 scheme) and also regmap in the various
- *-nat.c files. */
-
-#undef REGISTER_NAME
-#define REGISTER_NAMES { "eax", "ecx", "edx", "ebx", \
- "esp", "ebp", "esi", "edi", \
- "eip", "eflags", "st0", "st1", \
- "st2", "st3", "st4", "st5", \
- "st6", "st7", "fp1", "fp2", \
- "fp3", "fp4", "fp5", "fp6", \
- "fp7", "fp8", "fp9", "fp10", \
- "fp11", "fp12", "fp13", "fp14", \
- "fp15", "fp16", "fp17", "fp18", \
- "fp19", "fp20", "fp21", "fp22", \
- "fp23", "fp24", "fp25", "fp26", \
- "fp27", "fp28", "fp29", "fp30", \
- "fp31" }
-
-/* Register numbers of various important registers.
- Note that some of these values are "real" register numbers,
- and correspond to the general registers of the machine,
- and some are "phony" register numbers which are too large
- to be actual register numbers as far as the user is concerned
- but do serve to get the desired values when passed to read_register. */
-
-#define EAX_REGNUM 0
-#define ECX_REGNUM 1
-#define EDX_REGNUM 2
-#define EBX_REGNUM 3
-
-#define ESP_REGNUM 4
-#define EBP_REGNUM 5
-
-#define ESI_REGNUM 6
-#define EDI_REGNUM 7
-
-#define EIP_REGNUM 8
-#define EFLAGS_REGNUM 9
-
-#define ST0_REGNUM 10
-#define ST1_REGNUM 11
-#define ST2_REGNUM 12
-#define ST3_REGNUM 13
-
-#define ST4_REGNUM 14
-#define ST5_REGNUM 15
-#define ST6_REGNUM 16
-#define ST7_REGNUM 17
-
-#define FP1_REGNUM 18 /* first 1167 register */
-/* Get %fp2 - %fp31 by addition, since they are contiguous */
-
-#undef SP_REGNUM
-#define SP_REGNUM ESP_REGNUM /* Contains address of top of stack */
-#undef FP_REGNUM
-#define FP_REGNUM EBP_REGNUM /* Contains address of executing stack frame */
-#undef PC_REGNUM
-#define PC_REGNUM EIP_REGNUM /* Contains program counter */
-#undef PS_REGNUM
-#define PS_REGNUM EFLAGS_REGNUM /* Contains processor status */
-
-/*
- * For ptx, this is a little bit bizarre, since the register block
- * is below the u area in memory. This means that blockend here ends
- * up being negative (for the call from coredep.c) since the value in
- * u.u_ar0 will be less than KERNEL_U_ADDR (and coredep.c passes us
- * u.u_ar0 - KERNEL_U_ADDR in blockend). Since we also define
- * FETCH_INFERIOR_REGISTERS (and supply our own functions for that),
- * the core file case will be the only use of this function.
- */
-
-#define REGISTER_U_ADDR(addr, blockend, regno) \
-{ (addr) = ptx_register_u_addr((blockend), (regno)); }
-
-extern int ptx_register_u_addr (int, int);
-
-/* Total amount of space needed to store our copies of the machine's
- register state, the array `registers'. 10 i*86 registers, 8 i387
- registers, and 31 Weitek 1167 registers */
-
-#undef REGISTER_BYTES
-#define REGISTER_BYTES ((10 * 4) + (8 * 10) + (31 * 4))
-
-/* Largest value REGISTER_RAW_SIZE can have. */
-
-#undef DEPRECATED_MAX_REGISTER_RAW_SIZE
-#define DEPRECATED_MAX_REGISTER_RAW_SIZE 10
-
-/* Nonzero if register N requires conversion
- from raw format to virtual format. */
-
-#undef REGISTER_CONVERTIBLE
-#define REGISTER_CONVERTIBLE(N) \
-((N < ST0_REGNUM) ? 0 : \
- (N < FP1_REGNUM) ? 1 : \
- 0)
-
-/* Convert data from raw format for register REGNUM
- to virtual format for register REGNUM. */
-extern const struct floatformat floatformat_i387_ext; /* from floatformat.h */
-
-#undef REGISTER_CONVERT_TO_VIRTUAL
-#define REGISTER_CONVERT_TO_VIRTUAL(REGNUM,TYPE,FROM,TO) \
-((REGNUM < ST0_REGNUM) ? (void)memcpy ((TO), (FROM), 4) : \
- (REGNUM < FP1_REGNUM) ? (void)floatformat_to_double(&floatformat_i387_ext, \
- (FROM),(TO)) : \
- (void)memcpy ((TO), (FROM), 4))
-
-/* Convert data from virtual format for register REGNUM
- to raw format for register REGNUM. */
-
-#undef REGISTER_CONVERT_TO_RAW
-#define REGISTER_CONVERT_TO_RAW(TYPE,REGNUM,FROM,TO) \
-((REGNUM < ST0_REGNUM) ? (void)memcpy ((TO), (FROM), 4) : \
- (REGNUM < FP1_REGNUM) ? (void)floatformat_from_double(&floatformat_i387_ext, \
- (FROM),(TO)) : \
- (void)memcpy ((TO), (FROM), 4))
-
-/* Return the GDB type object for the "standard" data type
- of data in register N. */
-/*
- * Note: the 1167 registers (the last line, builtin_type_float) are
- * generally used in pairs, with each pair being treated as a double.
- * It it also possible to use them singly as floats. I'm not sure how
- * in gdb to treat the register pair pseudo-doubles. -fubar
- */
-#undef REGISTER_VIRTUAL_TYPE
-#define REGISTER_VIRTUAL_TYPE(N) \
-((N < ST0_REGNUM) ? builtin_type_int : \
- (N < FP1_REGNUM) ? builtin_type_double : \
- builtin_type_float)
-
-/* Extract from an array REGBUF containing the (raw) register state
- a function return value of type TYPE, and copy that, in virtual format,
- into VALBUF. */
-
-#undef DEPRECATED_EXTRACT_RETURN_VALUE
-#define DEPRECATED_EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
- symmetry_extract_return_value(TYPE, REGBUF, VALBUF)
-
-/*
- #undef FRAME_FIND_SAVED_REGS
- #define FRAME_FIND_SAVED_REGS(frame_info, frame_saved_regs) \
- { ptx_frame_find_saved_regs((frame_info), &(frame_saved_regs)); }
- */
-
-#endif /* ifndef TM_PTX_H */
+// OBSOLETE /* Target machine definitions for GDB on a Sequent Symmetry under ptx
+// OBSOLETE with Weitek 1167 and i387 support.
+// OBSOLETE
+// OBSOLETE Copyright 1986, 1987, 1989, 1991, 1992, 1993, 1994, 1995, 2000,
+// OBSOLETE 2003 Free Software Foundation, Inc.
+// OBSOLETE
+// OBSOLETE Symmetry version by Jay Vosburgh (fubar@sequent.com).
+// OBSOLETE
+// OBSOLETE This file is part of GDB.
+// OBSOLETE
+// OBSOLETE This program is free software; you can redistribute it and/or modify
+// OBSOLETE it under the terms of the GNU General Public License as published by
+// OBSOLETE the Free Software Foundation; either version 2 of the License, or
+// OBSOLETE (at your option) any later version.
+// OBSOLETE
+// OBSOLETE This program is distributed in the hope that it will be useful,
+// OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of
+// OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// OBSOLETE GNU General Public License for more details.
+// OBSOLETE
+// OBSOLETE You should have received a copy of the GNU General Public License
+// OBSOLETE along with this program; if not, write to the Free Software
+// OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330,
+// OBSOLETE Boston, MA 02111-1307, USA. */
+// OBSOLETE
+// OBSOLETE #ifndef TM_PTX_H
+// OBSOLETE #define TM_PTX_H 1
+// OBSOLETE
+// OBSOLETE /* I don't know if this will work for cross-debugging, even if you do get
+// OBSOLETE a copy of the right include file. */
+// OBSOLETE
+// OBSOLETE #include <sys/reg.h>
+// OBSOLETE
+// OBSOLETE #ifdef SEQUENT_PTX4
+// OBSOLETE #include "i386/tm-i386.h"
+// OBSOLETE #else /* !SEQUENT_PTX4 */
+// OBSOLETE #include "i386/tm-i386.h"
+// OBSOLETE #endif
+// OBSOLETE
+// OBSOLETE /* Amount PC must be decremented by after a breakpoint. This is often the
+// OBSOLETE number of bytes in BREAKPOINT but not always (such as now). */
+// OBSOLETE
+// OBSOLETE #undef DECR_PC_AFTER_BREAK
+// OBSOLETE #define DECR_PC_AFTER_BREAK 0
+// OBSOLETE
+// OBSOLETE /* Number of machine registers */
+// OBSOLETE
+// OBSOLETE #undef NUM_REGS
+// OBSOLETE #define NUM_REGS 49
+// OBSOLETE
+// OBSOLETE /* Initializer for an array of names of registers. There should be at least
+// OBSOLETE NUM_REGS strings in this initializer. Any excess ones are simply ignored.
+// OBSOLETE The order of the first 8 registers must match the compiler's numbering
+// OBSOLETE scheme (which is the same as the 386 scheme) and also regmap in the various
+// OBSOLETE *-nat.c files. */
+// OBSOLETE
+// OBSOLETE #undef REGISTER_NAME
+// OBSOLETE #define REGISTER_NAMES { "eax", "ecx", "edx", "ebx", \
+// OBSOLETE "esp", "ebp", "esi", "edi", \
+// OBSOLETE "eip", "eflags", "st0", "st1", \
+// OBSOLETE "st2", "st3", "st4", "st5", \
+// OBSOLETE "st6", "st7", "fp1", "fp2", \
+// OBSOLETE "fp3", "fp4", "fp5", "fp6", \
+// OBSOLETE "fp7", "fp8", "fp9", "fp10", \
+// OBSOLETE "fp11", "fp12", "fp13", "fp14", \
+// OBSOLETE "fp15", "fp16", "fp17", "fp18", \
+// OBSOLETE "fp19", "fp20", "fp21", "fp22", \
+// OBSOLETE "fp23", "fp24", "fp25", "fp26", \
+// OBSOLETE "fp27", "fp28", "fp29", "fp30", \
+// OBSOLETE "fp31" }
+// OBSOLETE
+// OBSOLETE /* Register numbers of various important registers.
+// OBSOLETE Note that some of these values are "real" register numbers,
+// OBSOLETE and correspond to the general registers of the machine,
+// OBSOLETE and some are "phony" register numbers which are too large
+// OBSOLETE to be actual register numbers as far as the user is concerned
+// OBSOLETE but do serve to get the desired values when passed to read_register. */
+// OBSOLETE
+// OBSOLETE #define EAX_REGNUM 0
+// OBSOLETE #define ECX_REGNUM 1
+// OBSOLETE #define EDX_REGNUM 2
+// OBSOLETE #define EBX_REGNUM 3
+// OBSOLETE
+// OBSOLETE #define ESP_REGNUM 4
+// OBSOLETE #define EBP_REGNUM 5
+// OBSOLETE
+// OBSOLETE #define ESI_REGNUM 6
+// OBSOLETE #define EDI_REGNUM 7
+// OBSOLETE
+// OBSOLETE #define EIP_REGNUM 8
+// OBSOLETE #define EFLAGS_REGNUM 9
+// OBSOLETE
+// OBSOLETE #define ST0_REGNUM 10
+// OBSOLETE #define ST1_REGNUM 11
+// OBSOLETE #define ST2_REGNUM 12
+// OBSOLETE #define ST3_REGNUM 13
+// OBSOLETE
+// OBSOLETE #define ST4_REGNUM 14
+// OBSOLETE #define ST5_REGNUM 15
+// OBSOLETE #define ST6_REGNUM 16
+// OBSOLETE #define ST7_REGNUM 17
+// OBSOLETE
+// OBSOLETE #define FP1_REGNUM 18 /* first 1167 register */
+// OBSOLETE /* Get %fp2 - %fp31 by addition, since they are contiguous */
+// OBSOLETE
+// OBSOLETE #undef SP_REGNUM
+// OBSOLETE #define SP_REGNUM ESP_REGNUM /* Contains address of top of stack */
+// OBSOLETE #undef FP_REGNUM
+// OBSOLETE #define FP_REGNUM EBP_REGNUM /* Contains address of executing stack frame */
+// OBSOLETE #undef PC_REGNUM
+// OBSOLETE #define PC_REGNUM EIP_REGNUM /* Contains program counter */
+// OBSOLETE #undef PS_REGNUM
+// OBSOLETE #define PS_REGNUM EFLAGS_REGNUM /* Contains processor status */
+// OBSOLETE
+// OBSOLETE /*
+// OBSOLETE * For ptx, this is a little bit bizarre, since the register block
+// OBSOLETE * is below the u area in memory. This means that blockend here ends
+// OBSOLETE * up being negative (for the call from coredep.c) since the value in
+// OBSOLETE * u.u_ar0 will be less than KERNEL_U_ADDR (and coredep.c passes us
+// OBSOLETE * u.u_ar0 - KERNEL_U_ADDR in blockend). Since we also define
+// OBSOLETE * FETCH_INFERIOR_REGISTERS (and supply our own functions for that),
+// OBSOLETE * the core file case will be the only use of this function.
+// OBSOLETE */
+// OBSOLETE
+// OBSOLETE #define REGISTER_U_ADDR(addr, blockend, regno) \
+// OBSOLETE { (addr) = ptx_register_u_addr((blockend), (regno)); }
+// OBSOLETE
+// OBSOLETE extern int ptx_register_u_addr (int, int);
+// OBSOLETE
+// OBSOLETE /* Total amount of space needed to store our copies of the machine's
+// OBSOLETE register state, the array `registers'. 10 i*86 registers, 8 i387
+// OBSOLETE registers, and 31 Weitek 1167 registers */
+// OBSOLETE
+// OBSOLETE #undef REGISTER_BYTES
+// OBSOLETE #define REGISTER_BYTES ((10 * 4) + (8 * 10) + (31 * 4))
+// OBSOLETE
+// OBSOLETE /* Largest value REGISTER_RAW_SIZE can have. */
+// OBSOLETE
+// OBSOLETE #undef DEPRECATED_MAX_REGISTER_RAW_SIZE
+// OBSOLETE #define DEPRECATED_MAX_REGISTER_RAW_SIZE 10
+// OBSOLETE
+// OBSOLETE /* Nonzero if register N requires conversion
+// OBSOLETE from raw format to virtual format. */
+// OBSOLETE
+// OBSOLETE #undef REGISTER_CONVERTIBLE
+// OBSOLETE #define REGISTER_CONVERTIBLE(N) \
+// OBSOLETE ((N < ST0_REGNUM) ? 0 : \
+// OBSOLETE (N < FP1_REGNUM) ? 1 : \
+// OBSOLETE 0)
+// OBSOLETE
+// OBSOLETE /* Convert data from raw format for register REGNUM
+// OBSOLETE to virtual format for register REGNUM. */
+// OBSOLETE extern const struct floatformat floatformat_i387_ext; /* from floatformat.h */
+// OBSOLETE
+// OBSOLETE #undef REGISTER_CONVERT_TO_VIRTUAL
+// OBSOLETE #define REGISTER_CONVERT_TO_VIRTUAL(REGNUM,TYPE,FROM,TO) \
+// OBSOLETE ((REGNUM < ST0_REGNUM) ? (void)memcpy ((TO), (FROM), 4) : \
+// OBSOLETE (REGNUM < FP1_REGNUM) ? (void)floatformat_to_double(&floatformat_i387_ext, \
+// OBSOLETE (FROM),(TO)) : \
+// OBSOLETE (void)memcpy ((TO), (FROM), 4))
+// OBSOLETE
+// OBSOLETE /* Convert data from virtual format for register REGNUM
+// OBSOLETE to raw format for register REGNUM. */
+// OBSOLETE
+// OBSOLETE #undef REGISTER_CONVERT_TO_RAW
+// OBSOLETE #define REGISTER_CONVERT_TO_RAW(TYPE,REGNUM,FROM,TO) \
+// OBSOLETE ((REGNUM < ST0_REGNUM) ? (void)memcpy ((TO), (FROM), 4) : \
+// OBSOLETE (REGNUM < FP1_REGNUM) ? (void)floatformat_from_double(&floatformat_i387_ext, \
+// OBSOLETE (FROM),(TO)) : \
+// OBSOLETE (void)memcpy ((TO), (FROM), 4))
+// OBSOLETE
+// OBSOLETE /* Return the GDB type object for the "standard" data type
+// OBSOLETE of data in register N. */
+// OBSOLETE /*
+// OBSOLETE * Note: the 1167 registers (the last line, builtin_type_float) are
+// OBSOLETE * generally used in pairs, with each pair being treated as a double.
+// OBSOLETE * It it also possible to use them singly as floats. I'm not sure how
+// OBSOLETE * in gdb to treat the register pair pseudo-doubles. -fubar
+// OBSOLETE */
+// OBSOLETE #undef REGISTER_VIRTUAL_TYPE
+// OBSOLETE #define REGISTER_VIRTUAL_TYPE(N) \
+// OBSOLETE ((N < ST0_REGNUM) ? builtin_type_int : \
+// OBSOLETE (N < FP1_REGNUM) ? builtin_type_double : \
+// OBSOLETE builtin_type_float)
+// OBSOLETE
+// OBSOLETE /* Extract from an array REGBUF containing the (raw) register state
+// OBSOLETE a function return value of type TYPE, and copy that, in virtual format,
+// OBSOLETE into VALBUF. */
+// OBSOLETE
+// OBSOLETE #undef DEPRECATED_EXTRACT_RETURN_VALUE
+// OBSOLETE #define DEPRECATED_EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
+// OBSOLETE symmetry_extract_return_value(TYPE, REGBUF, VALBUF)
+// OBSOLETE
+// OBSOLETE #endif /* ifndef TM_PTX_H */
diff --git a/gdb/config/i386/tm-ptx4.h b/gdb/config/i386/tm-ptx4.h
index a13d4a6..5f83db4 100644
--- a/gdb/config/i386/tm-ptx4.h
+++ b/gdb/config/i386/tm-ptx4.h
@@ -1,26 +1,26 @@
-/* Target machine definitions for GDB on a Sequent Symmetry under ptx
- with Weitek 1167 and i387 support.
- Copyright 1986, 1987, 1989, 1991, 1992, 1993, 1994
- Free Software Foundation, Inc.
- Symmetry version by Jay Vosburgh (fubar@sequent.com).
-
- This file is part of GDB.
-
- 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.
-
- 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.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-
-#define SEQUENT_PTX4
-
-#include "i386/tm-ptx.h"
+// OBSOLETE /* Target machine definitions for GDB on a Sequent Symmetry under ptx
+// OBSOLETE with Weitek 1167 and i387 support.
+// OBSOLETE Copyright 1986, 1987, 1989, 1991, 1992, 1993, 1994
+// OBSOLETE Free Software Foundation, Inc.
+// OBSOLETE Symmetry version by Jay Vosburgh (fubar@sequent.com).
+// OBSOLETE
+// OBSOLETE This file is part of GDB.
+// OBSOLETE
+// OBSOLETE This program is free software; you can redistribute it and/or modify
+// OBSOLETE it under the terms of the GNU General Public License as published by
+// OBSOLETE the Free Software Foundation; either version 2 of the License, or
+// OBSOLETE (at your option) any later version.
+// OBSOLETE
+// OBSOLETE This program is distributed in the hope that it will be useful,
+// OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of
+// OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// OBSOLETE GNU General Public License for more details.
+// OBSOLETE
+// OBSOLETE You should have received a copy of the GNU General Public License
+// OBSOLETE along with this program; if not, write to the Free Software
+// OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330,
+// OBSOLETE Boston, MA 02111-1307, USA. */
+// OBSOLETE
+// OBSOLETE #define SEQUENT_PTX4
+// OBSOLETE
+// OBSOLETE #include "i386/tm-ptx.h"
diff --git a/gdb/config/i386/tm-symmetry.h b/gdb/config/i386/tm-symmetry.h
index a15f45f..c8680a3 100644
--- a/gdb/config/i386/tm-symmetry.h
+++ b/gdb/config/i386/tm-symmetry.h
@@ -1,291 +1,291 @@
-/* Target machine definitions for GDB on a Sequent Symmetry under dynix 3.0,
- with Weitek 1167 and i387 support.
-
- Copyright 1986, 1987, 1989, 1991, 1992, 1993, 1994, 1995, 2003 Free
- Software Foundation, Inc.
-
- Symmetry version by Jay Vosburgh (fubar@sequent.com).
-
- This file is part of GDB.
-
- 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.
-
- 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.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-
-#ifndef TM_SYMMETRY_H
-#define TM_SYMMETRY_H 1
-
-#include "regcache.h"
-#include "doublest.h"
-
-/* I don't know if this will work for cross-debugging, even if you do get
- a copy of the right include file. */
-#include <machine/reg.h>
-
-#include "i386/tm-i386.h"
-
-/* Amount PC must be decremented by after a breakpoint. This is often the
- number of bytes in BREAKPOINT but not always (such as now). */
-
-#undef DECR_PC_AFTER_BREAK
-#define DECR_PC_AFTER_BREAK 0
-
-/* Number of machine registers */
-
-#undef NUM_REGS
-#define NUM_REGS 49
-
-/* Initializer for an array of names of registers.
- There should be NUM_REGS strings in this initializer. */
-
-/* Initializer for an array of names of registers. There should be at least
- NUM_REGS strings in this initializer. Any excess ones are simply ignored.
- Symmetry registers are in this weird order to match the register numbers
- in the symbol table entries. If you change the order, things will probably
- break mysteriously for no apparent reason. Also note that the st(0)...
- st(7) 387 registers are represented as st0...st7. */
-
-#undef REGISTER_NAME
-#define REGISTER_NAMES { "eax", "edx", "ecx", "st0", "st1", \
- "ebx", "esi", "edi", "st2", "st3", \
- "st4", "st5", "st6", "st7", "esp", \
- "ebp", "eip", "eflags","fp1", "fp2", \
- "fp3", "fp4", "fp5", "fp6", "fp7", \
- "fp8", "fp9", "fp10", "fp11", "fp12", \
- "fp13", "fp14", "fp15", "fp16", "fp17", \
- "fp18", "fp19", "fp20", "fp21", "fp22", \
- "fp23", "fp24", "fp25", "fp26", "fp27", \
- "fp28", "fp29", "fp30", "fp31" }
-
-/* Register numbers of various important registers.
- Note that some of these values are "real" register numbers,
- and correspond to the general registers of the machine,
- and some are "phony" register numbers which are too large
- to be actual register numbers as far as the user is concerned
- but do serve to get the desired values when passed to read_register. */
-
-#define EAX_REGNUM 0
-#define EDX_REGNUM 1
-#define ECX_REGNUM 2
-#define ST0_REGNUM 3
-#define ST1_REGNUM 4
-#define EBX_REGNUM 5
-#define ESI_REGNUM 6
-#define EDI_REGNUM 7
-#define ST2_REGNUM 8
-#define ST3_REGNUM 9
-
-#define ST4_REGNUM 10
-#define ST5_REGNUM 11
-#define ST6_REGNUM 12
-#define ST7_REGNUM 13
-
-#define FP1_REGNUM 18 /* first 1167 register */
-/* Get %fp2 - %fp31 by addition, since they are contiguous */
-
-#undef SP_REGNUM
-#define SP_REGNUM 14 /* (usp) Contains address of top of stack */
-#define ESP_REGNUM 14
-#undef FP_REGNUM
-#define FP_REGNUM 15 /* (ebp) Contains address of executing stack frame */
-#define EBP_REGNUM 15
-#undef PC_REGNUM
-#define PC_REGNUM 16 /* (eip) Contains program counter */
-#define EIP_REGNUM 16
-#undef PS_REGNUM
-#define PS_REGNUM 17 /* (ps) Contains processor status */
-#define EFLAGS_REGNUM 17
-
-/*
- * Following macro translates i386 opcode register numbers to Symmetry
- * register numbers. This is used by i386_frame_find_saved_regs.
- *
- * %eax %ecx %edx %ebx %esp %ebp %esi %edi
- * i386 0 1 2 3 4 5 6 7
- * Symmetry 0 2 1 5 14 15 6 7
- *
- */
-#define I386_REGNO_TO_SYMMETRY(n) \
-((n)==0?0 :(n)==1?2 :(n)==2?1 :(n)==3?5 :(n)==4?14 :(n)==5?15 :(n))
-
-/* The magic numbers below are offsets into u_ar0 in the user struct.
- * They live in <machine/reg.h>. Gdb calls this macro with blockend
- * holding u.u_ar0 - KERNEL_U_ADDR. Only the registers listed are
- * saved in the u area (along with a few others that aren't useful
- * here. See <machine/reg.h>).
- */
-
-#define REGISTER_U_ADDR(addr, blockend, regno) \
-{ struct user foo; /* needed for finding fpu regs */ \
-switch (regno) { \
- case 0: \
- addr = blockend + EAX * sizeof(int); break; \
- case 1: \
- addr = blockend + EDX * sizeof(int); break; \
- case 2: \
- addr = blockend + ECX * sizeof(int); break; \
- case 3: /* st(0) */ \
- addr = ((int)&foo.u_fpusave.fpu_stack[0][0] - (int)&foo); \
- break; \
- case 4: /* st(1) */ \
- addr = ((int) &foo.u_fpusave.fpu_stack[1][0] - (int)&foo); \
- break; \
- case 5: \
- addr = blockend + EBX * sizeof(int); break; \
- case 6: \
- addr = blockend + ESI * sizeof(int); break; \
- case 7: \
- addr = blockend + EDI * sizeof(int); break; \
- case 8: /* st(2) */ \
- addr = ((int) &foo.u_fpusave.fpu_stack[2][0] - (int)&foo); \
- break; \
- case 9: /* st(3) */ \
- addr = ((int) &foo.u_fpusave.fpu_stack[3][0] - (int)&foo); \
- break; \
- case 10: /* st(4) */ \
- addr = ((int) &foo.u_fpusave.fpu_stack[4][0] - (int)&foo); \
- break; \
- case 11: /* st(5) */ \
- addr = ((int) &foo.u_fpusave.fpu_stack[5][0] - (int)&foo); \
- break; \
- case 12: /* st(6) */ \
- addr = ((int) &foo.u_fpusave.fpu_stack[6][0] - (int)&foo); \
- break; \
- case 13: /* st(7) */ \
- addr = ((int) &foo.u_fpusave.fpu_stack[7][0] - (int)&foo); \
- break; \
- case 14: \
- addr = blockend + ESP * sizeof(int); break; \
- case 15: \
- addr = blockend + EBP * sizeof(int); break; \
- case 16: \
- addr = blockend + EIP * sizeof(int); break; \
- case 17: \
- addr = blockend + FLAGS * sizeof(int); break; \
- case 18: /* fp1 */ \
- case 19: /* fp2 */ \
- case 20: /* fp3 */ \
- case 21: /* fp4 */ \
- case 22: /* fp5 */ \
- case 23: /* fp6 */ \
- case 24: /* fp7 */ \
- case 25: /* fp8 */ \
- case 26: /* fp9 */ \
- case 27: /* fp10 */ \
- case 28: /* fp11 */ \
- case 29: /* fp12 */ \
- case 30: /* fp13 */ \
- case 31: /* fp14 */ \
- case 32: /* fp15 */ \
- case 33: /* fp16 */ \
- case 34: /* fp17 */ \
- case 35: /* fp18 */ \
- case 36: /* fp19 */ \
- case 37: /* fp20 */ \
- case 38: /* fp21 */ \
- case 39: /* fp22 */ \
- case 40: /* fp23 */ \
- case 41: /* fp24 */ \
- case 42: /* fp25 */ \
- case 43: /* fp26 */ \
- case 44: /* fp27 */ \
- case 45: /* fp28 */ \
- case 46: /* fp29 */ \
- case 47: /* fp30 */ \
- case 48: /* fp31 */ \
- addr = ((int) &foo.u_fpasave.fpa_regs[(regno)-18] - (int)&foo); \
- } \
-}
-
-/* Total amount of space needed to store our copies of the machine's
- register state, the array `registers'. 10 i*86 registers, 8 i387
- registers, and 31 Weitek 1167 registers */
-
-#undef REGISTER_BYTES
-#define REGISTER_BYTES ((10 * 4) + (8 * 10) + (31 * 4))
-
-/* Nonzero if register N requires conversion
- from raw format to virtual format. */
-
-#undef REGISTER_CONVERTIBLE
-#define REGISTER_CONVERTIBLE(N) \
-(((N) < 3) ? 0 : \
-((N) < 5) ? 1 : \
-((N) < 8) ? 0 : \
-((N) < 14) ? 1 : \
- 0)
-
-#include "floatformat.h"
-
-/* Convert data from raw format for register REGNUM in buffer FROM
- to virtual format with type TYPE in buffer TO. */
-
-#undef REGISTER_CONVERT_TO_VIRTUAL
-#define REGISTER_CONVERT_TO_VIRTUAL(REGNUM,TYPE,FROM,TO) \
-{ \
- DOUBLEST val; \
- floatformat_to_doublest (&floatformat_i387_ext, (FROM), &val); \
- store_floating ((TO), TYPE_LENGTH (TYPE), val); \
-}
-
-/* Convert data from virtual format with type TYPE in buffer FROM
- to raw format for register REGNUM in buffer TO. */
-
-#undef REGISTER_CONVERT_TO_RAW
-#define REGISTER_CONVERT_TO_RAW(TYPE,REGNUM,FROM,TO) \
-{ \
- DOUBLEST val = extract_floating ((FROM), TYPE_LENGTH (TYPE)); \
- floatformat_from_doublest (&floatformat_i387_ext, &val, (TO)); \
-}
-
-/* Return the GDB type object for the "standard" data type
- of data in register N. */
-
-#undef REGISTER_VIRTUAL_TYPE
-#define REGISTER_VIRTUAL_TYPE(N) \
-((N < 3) ? builtin_type_int : \
-(N < 5) ? builtin_type_double : \
-(N < 8) ? builtin_type_int : \
-(N < 14) ? builtin_type_double : \
- builtin_type_int)
-
-/* Store the address of the place in which to copy the structure the
- subroutine will return. This is called from call_function.
- Native cc passes the address in eax, gcc (up to version 2.5.8)
- passes it on the stack. gcc should be fixed in future versions to
- adopt native cc conventions. */
-
-#undef PUSH_ARGUMENTS
-#undef STORE_STRUCT_RETURN
-#define STORE_STRUCT_RETURN(ADDR, SP) write_register(0, (ADDR))
-
-/* Extract from an array REGBUF containing the (raw) register state
- a function return value of type TYPE, and copy that, in virtual format,
- into VALBUF. */
-
-#undef DEPRECATED_EXTRACT_RETURN_VALUE
-#define DEPRECATED_EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
- symmetry_extract_return_value(TYPE, REGBUF, VALBUF)
-
-/* The following redefines make backtracing through sigtramp work.
- They manufacture a fake sigtramp frame and obtain the saved pc in sigtramp
- from the sigcontext structure which is pushed by the kernel on the
- user stack, along with a pointer to it. */
-
-#define IN_SIGTRAMP(pc, name) ((name) && STREQ ("_sigcode", name))
-
-/* Offset to saved PC in sigcontext, from <signal.h>. */
-#define SIGCONTEXT_PC_OFFSET 16
-
-#endif /* ifndef TM_SYMMETRY_H */
+// OBSOLETE /* Target machine definitions for GDB on a Sequent Symmetry under dynix 3.0,
+// OBSOLETE with Weitek 1167 and i387 support.
+// OBSOLETE
+// OBSOLETE Copyright 1986, 1987, 1989, 1991, 1992, 1993, 1994, 1995, 2003 Free
+// OBSOLETE Software Foundation, Inc.
+// OBSOLETE
+// OBSOLETE Symmetry version by Jay Vosburgh (fubar@sequent.com).
+// OBSOLETE
+// OBSOLETE This file is part of GDB.
+// OBSOLETE
+// OBSOLETE This program is free software; you can redistribute it and/or modify
+// OBSOLETE it under the terms of the GNU General Public License as published by
+// OBSOLETE the Free Software Foundation; either version 2 of the License, or
+// OBSOLETE (at your option) any later version.
+// OBSOLETE
+// OBSOLETE This program is distributed in the hope that it will be useful,
+// OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of
+// OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// OBSOLETE GNU General Public License for more details.
+// OBSOLETE
+// OBSOLETE You should have received a copy of the GNU General Public License
+// OBSOLETE along with this program; if not, write to the Free Software
+// OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330,
+// OBSOLETE Boston, MA 02111-1307, USA. */
+// OBSOLETE
+// OBSOLETE #ifndef TM_SYMMETRY_H
+// OBSOLETE #define TM_SYMMETRY_H 1
+// OBSOLETE
+// OBSOLETE #include "regcache.h"
+// OBSOLETE #include "doublest.h"
+// OBSOLETE
+// OBSOLETE /* I don't know if this will work for cross-debugging, even if you do get
+// OBSOLETE a copy of the right include file. */
+// OBSOLETE #include <machine/reg.h>
+// OBSOLETE
+// OBSOLETE #include "i386/tm-i386.h"
+// OBSOLETE
+// OBSOLETE /* Amount PC must be decremented by after a breakpoint. This is often the
+// OBSOLETE number of bytes in BREAKPOINT but not always (such as now). */
+// OBSOLETE
+// OBSOLETE #undef DECR_PC_AFTER_BREAK
+// OBSOLETE #define DECR_PC_AFTER_BREAK 0
+// OBSOLETE
+// OBSOLETE /* Number of machine registers */
+// OBSOLETE
+// OBSOLETE #undef NUM_REGS
+// OBSOLETE #define NUM_REGS 49
+// OBSOLETE
+// OBSOLETE /* Initializer for an array of names of registers.
+// OBSOLETE There should be NUM_REGS strings in this initializer. */
+// OBSOLETE
+// OBSOLETE /* Initializer for an array of names of registers. There should be at least
+// OBSOLETE NUM_REGS strings in this initializer. Any excess ones are simply ignored.
+// OBSOLETE Symmetry registers are in this weird order to match the register numbers
+// OBSOLETE in the symbol table entries. If you change the order, things will probably
+// OBSOLETE break mysteriously for no apparent reason. Also note that the st(0)...
+// OBSOLETE st(7) 387 registers are represented as st0...st7. */
+// OBSOLETE
+// OBSOLETE #undef REGISTER_NAME
+// OBSOLETE #define REGISTER_NAMES { "eax", "edx", "ecx", "st0", "st1", \
+// OBSOLETE "ebx", "esi", "edi", "st2", "st3", \
+// OBSOLETE "st4", "st5", "st6", "st7", "esp", \
+// OBSOLETE "ebp", "eip", "eflags","fp1", "fp2", \
+// OBSOLETE "fp3", "fp4", "fp5", "fp6", "fp7", \
+// OBSOLETE "fp8", "fp9", "fp10", "fp11", "fp12", \
+// OBSOLETE "fp13", "fp14", "fp15", "fp16", "fp17", \
+// OBSOLETE "fp18", "fp19", "fp20", "fp21", "fp22", \
+// OBSOLETE "fp23", "fp24", "fp25", "fp26", "fp27", \
+// OBSOLETE "fp28", "fp29", "fp30", "fp31" }
+// OBSOLETE
+// OBSOLETE /* Register numbers of various important registers.
+// OBSOLETE Note that some of these values are "real" register numbers,
+// OBSOLETE and correspond to the general registers of the machine,
+// OBSOLETE and some are "phony" register numbers which are too large
+// OBSOLETE to be actual register numbers as far as the user is concerned
+// OBSOLETE but do serve to get the desired values when passed to read_register. */
+// OBSOLETE
+// OBSOLETE #define EAX_REGNUM 0
+// OBSOLETE #define EDX_REGNUM 1
+// OBSOLETE #define ECX_REGNUM 2
+// OBSOLETE #define ST0_REGNUM 3
+// OBSOLETE #define ST1_REGNUM 4
+// OBSOLETE #define EBX_REGNUM 5
+// OBSOLETE #define ESI_REGNUM 6
+// OBSOLETE #define EDI_REGNUM 7
+// OBSOLETE #define ST2_REGNUM 8
+// OBSOLETE #define ST3_REGNUM 9
+// OBSOLETE
+// OBSOLETE #define ST4_REGNUM 10
+// OBSOLETE #define ST5_REGNUM 11
+// OBSOLETE #define ST6_REGNUM 12
+// OBSOLETE #define ST7_REGNUM 13
+// OBSOLETE
+// OBSOLETE #define FP1_REGNUM 18 /* first 1167 register */
+// OBSOLETE /* Get %fp2 - %fp31 by addition, since they are contiguous */
+// OBSOLETE
+// OBSOLETE #undef SP_REGNUM
+// OBSOLETE #define SP_REGNUM 14 /* (usp) Contains address of top of stack */
+// OBSOLETE #define ESP_REGNUM 14
+// OBSOLETE #undef FP_REGNUM
+// OBSOLETE #define FP_REGNUM 15 /* (ebp) Contains address of executing stack frame */
+// OBSOLETE #define EBP_REGNUM 15
+// OBSOLETE #undef PC_REGNUM
+// OBSOLETE #define PC_REGNUM 16 /* (eip) Contains program counter */
+// OBSOLETE #define EIP_REGNUM 16
+// OBSOLETE #undef PS_REGNUM
+// OBSOLETE #define PS_REGNUM 17 /* (ps) Contains processor status */
+// OBSOLETE #define EFLAGS_REGNUM 17
+// OBSOLETE
+// OBSOLETE /*
+// OBSOLETE * Following macro translates i386 opcode register numbers to Symmetry
+// OBSOLETE * register numbers. This is used by i386_frame_find_saved_regs.
+// OBSOLETE *
+// OBSOLETE * %eax %ecx %edx %ebx %esp %ebp %esi %edi
+// OBSOLETE * i386 0 1 2 3 4 5 6 7
+// OBSOLETE * Symmetry 0 2 1 5 14 15 6 7
+// OBSOLETE *
+// OBSOLETE */
+// OBSOLETE #define I386_REGNO_TO_SYMMETRY(n) \
+// OBSOLETE ((n)==0?0 :(n)==1?2 :(n)==2?1 :(n)==3?5 :(n)==4?14 :(n)==5?15 :(n))
+// OBSOLETE
+// OBSOLETE /* The magic numbers below are offsets into u_ar0 in the user struct.
+// OBSOLETE * They live in <machine/reg.h>. Gdb calls this macro with blockend
+// OBSOLETE * holding u.u_ar0 - KERNEL_U_ADDR. Only the registers listed are
+// OBSOLETE * saved in the u area (along with a few others that aren't useful
+// OBSOLETE * here. See <machine/reg.h>).
+// OBSOLETE */
+// OBSOLETE
+// OBSOLETE #define REGISTER_U_ADDR(addr, blockend, regno) \
+// OBSOLETE { struct user foo; /* needed for finding fpu regs */ \
+// OBSOLETE switch (regno) { \
+// OBSOLETE case 0: \
+// OBSOLETE addr = blockend + EAX * sizeof(int); break; \
+// OBSOLETE case 1: \
+// OBSOLETE addr = blockend + EDX * sizeof(int); break; \
+// OBSOLETE case 2: \
+// OBSOLETE addr = blockend + ECX * sizeof(int); break; \
+// OBSOLETE case 3: /* st(0) */ \
+// OBSOLETE addr = ((int)&foo.u_fpusave.fpu_stack[0][0] - (int)&foo); \
+// OBSOLETE break; \
+// OBSOLETE case 4: /* st(1) */ \
+// OBSOLETE addr = ((int) &foo.u_fpusave.fpu_stack[1][0] - (int)&foo); \
+// OBSOLETE break; \
+// OBSOLETE case 5: \
+// OBSOLETE addr = blockend + EBX * sizeof(int); break; \
+// OBSOLETE case 6: \
+// OBSOLETE addr = blockend + ESI * sizeof(int); break; \
+// OBSOLETE case 7: \
+// OBSOLETE addr = blockend + EDI * sizeof(int); break; \
+// OBSOLETE case 8: /* st(2) */ \
+// OBSOLETE addr = ((int) &foo.u_fpusave.fpu_stack[2][0] - (int)&foo); \
+// OBSOLETE break; \
+// OBSOLETE case 9: /* st(3) */ \
+// OBSOLETE addr = ((int) &foo.u_fpusave.fpu_stack[3][0] - (int)&foo); \
+// OBSOLETE break; \
+// OBSOLETE case 10: /* st(4) */ \
+// OBSOLETE addr = ((int) &foo.u_fpusave.fpu_stack[4][0] - (int)&foo); \
+// OBSOLETE break; \
+// OBSOLETE case 11: /* st(5) */ \
+// OBSOLETE addr = ((int) &foo.u_fpusave.fpu_stack[5][0] - (int)&foo); \
+// OBSOLETE break; \
+// OBSOLETE case 12: /* st(6) */ \
+// OBSOLETE addr = ((int) &foo.u_fpusave.fpu_stack[6][0] - (int)&foo); \
+// OBSOLETE break; \
+// OBSOLETE case 13: /* st(7) */ \
+// OBSOLETE addr = ((int) &foo.u_fpusave.fpu_stack[7][0] - (int)&foo); \
+// OBSOLETE break; \
+// OBSOLETE case 14: \
+// OBSOLETE addr = blockend + ESP * sizeof(int); break; \
+// OBSOLETE case 15: \
+// OBSOLETE addr = blockend + EBP * sizeof(int); break; \
+// OBSOLETE case 16: \
+// OBSOLETE addr = blockend + EIP * sizeof(int); break; \
+// OBSOLETE case 17: \
+// OBSOLETE addr = blockend + FLAGS * sizeof(int); break; \
+// OBSOLETE case 18: /* fp1 */ \
+// OBSOLETE case 19: /* fp2 */ \
+// OBSOLETE case 20: /* fp3 */ \
+// OBSOLETE case 21: /* fp4 */ \
+// OBSOLETE case 22: /* fp5 */ \
+// OBSOLETE case 23: /* fp6 */ \
+// OBSOLETE case 24: /* fp7 */ \
+// OBSOLETE case 25: /* fp8 */ \
+// OBSOLETE case 26: /* fp9 */ \
+// OBSOLETE case 27: /* fp10 */ \
+// OBSOLETE case 28: /* fp11 */ \
+// OBSOLETE case 29: /* fp12 */ \
+// OBSOLETE case 30: /* fp13 */ \
+// OBSOLETE case 31: /* fp14 */ \
+// OBSOLETE case 32: /* fp15 */ \
+// OBSOLETE case 33: /* fp16 */ \
+// OBSOLETE case 34: /* fp17 */ \
+// OBSOLETE case 35: /* fp18 */ \
+// OBSOLETE case 36: /* fp19 */ \
+// OBSOLETE case 37: /* fp20 */ \
+// OBSOLETE case 38: /* fp21 */ \
+// OBSOLETE case 39: /* fp22 */ \
+// OBSOLETE case 40: /* fp23 */ \
+// OBSOLETE case 41: /* fp24 */ \
+// OBSOLETE case 42: /* fp25 */ \
+// OBSOLETE case 43: /* fp26 */ \
+// OBSOLETE case 44: /* fp27 */ \
+// OBSOLETE case 45: /* fp28 */ \
+// OBSOLETE case 46: /* fp29 */ \
+// OBSOLETE case 47: /* fp30 */ \
+// OBSOLETE case 48: /* fp31 */ \
+// OBSOLETE addr = ((int) &foo.u_fpasave.fpa_regs[(regno)-18] - (int)&foo); \
+// OBSOLETE } \
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE /* Total amount of space needed to store our copies of the machine's
+// OBSOLETE register state, the array `registers'. 10 i*86 registers, 8 i387
+// OBSOLETE registers, and 31 Weitek 1167 registers */
+// OBSOLETE
+// OBSOLETE #undef REGISTER_BYTES
+// OBSOLETE #define REGISTER_BYTES ((10 * 4) + (8 * 10) + (31 * 4))
+// OBSOLETE
+// OBSOLETE /* Nonzero if register N requires conversion
+// OBSOLETE from raw format to virtual format. */
+// OBSOLETE
+// OBSOLETE #undef REGISTER_CONVERTIBLE
+// OBSOLETE #define REGISTER_CONVERTIBLE(N) \
+// OBSOLETE (((N) < 3) ? 0 : \
+// OBSOLETE ((N) < 5) ? 1 : \
+// OBSOLETE ((N) < 8) ? 0 : \
+// OBSOLETE ((N) < 14) ? 1 : \
+// OBSOLETE 0)
+// OBSOLETE
+// OBSOLETE #include "floatformat.h"
+// OBSOLETE
+// OBSOLETE /* Convert data from raw format for register REGNUM in buffer FROM
+// OBSOLETE to virtual format with type TYPE in buffer TO. */
+// OBSOLETE
+// OBSOLETE #undef REGISTER_CONVERT_TO_VIRTUAL
+// OBSOLETE #define REGISTER_CONVERT_TO_VIRTUAL(REGNUM,TYPE,FROM,TO) \
+// OBSOLETE { \
+// OBSOLETE DOUBLEST val; \
+// OBSOLETE floatformat_to_doublest (&floatformat_i387_ext, (FROM), &val); \
+// OBSOLETE deprecated_store_floating ((TO), TYPE_LENGTH (TYPE), val); \
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE /* Convert data from virtual format with type TYPE in buffer FROM
+// OBSOLETE to raw format for register REGNUM in buffer TO. */
+// OBSOLETE
+// OBSOLETE #undef REGISTER_CONVERT_TO_RAW
+// OBSOLETE #define REGISTER_CONVERT_TO_RAW(TYPE,REGNUM,FROM,TO) \
+// OBSOLETE { \
+// OBSOLETE DOUBLEST val = deprecated_extract_floating ((FROM), TYPE_LENGTH (TYPE)); \
+// OBSOLETE floatformat_from_doublest (&floatformat_i387_ext, &val, (TO)); \
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE /* Return the GDB type object for the "standard" data type
+// OBSOLETE of data in register N. */
+// OBSOLETE
+// OBSOLETE #undef REGISTER_VIRTUAL_TYPE
+// OBSOLETE #define REGISTER_VIRTUAL_TYPE(N) \
+// OBSOLETE ((N < 3) ? builtin_type_int : \
+// OBSOLETE (N < 5) ? builtin_type_double : \
+// OBSOLETE (N < 8) ? builtin_type_int : \
+// OBSOLETE (N < 14) ? builtin_type_double : \
+// OBSOLETE builtin_type_int)
+// OBSOLETE
+// OBSOLETE /* Store the address of the place in which to copy the structure the
+// OBSOLETE subroutine will return. This is called from call_function.
+// OBSOLETE Native cc passes the address in eax, gcc (up to version 2.5.8)
+// OBSOLETE passes it on the stack. gcc should be fixed in future versions to
+// OBSOLETE adopt native cc conventions. */
+// OBSOLETE
+// OBSOLETE #undef DEPRECATED_PUSH_ARGUMENTS
+// OBSOLETE #undef STORE_STRUCT_RETURN
+// OBSOLETE #define STORE_STRUCT_RETURN(ADDR, SP) write_register(0, (ADDR))
+// OBSOLETE
+// OBSOLETE /* Extract from an array REGBUF containing the (raw) register state
+// OBSOLETE a function return value of type TYPE, and copy that, in virtual format,
+// OBSOLETE into VALBUF. */
+// OBSOLETE
+// OBSOLETE #undef DEPRECATED_EXTRACT_RETURN_VALUE
+// OBSOLETE #define DEPRECATED_EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
+// OBSOLETE symmetry_extract_return_value(TYPE, REGBUF, VALBUF)
+// OBSOLETE
+// OBSOLETE /* The following redefines make backtracing through sigtramp work.
+// OBSOLETE They manufacture a fake sigtramp frame and obtain the saved pc in sigtramp
+// OBSOLETE from the sigcontext structure which is pushed by the kernel on the
+// OBSOLETE user stack, along with a pointer to it. */
+// OBSOLETE
+// OBSOLETE #define IN_SIGTRAMP(pc, name) ((name) && STREQ ("_sigcode", name))
+// OBSOLETE
+// OBSOLETE /* Offset to saved PC in sigcontext, from <signal.h>. */
+// OBSOLETE #define SIGCONTEXT_PC_OFFSET 16
+// OBSOLETE
+// OBSOLETE #endif /* ifndef TM_SYMMETRY_H */
diff --git a/gdb/config/i386/xm-ptx.h b/gdb/config/i386/xm-ptx.h
index 8987f29..1ecae0c 100644
--- a/gdb/config/i386/xm-ptx.h
+++ b/gdb/config/i386/xm-ptx.h
@@ -1,38 +1,38 @@
-/* Definitions to make GDB run on a Sequent Symmetry under ptx, with
- Weitek 1167 and i387 support.
- Copyright 1986, 1987, 1989, 1992, 1993, 1994, 1995
- Free Software Foundation, Inc.
-
- This file is part of GDB.
-
- 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.
-
- 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.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-
-/* Symmetry version by Jay Vosburgh (fubar@sequent.com) */
-
-#ifdef _SEQUENT_PTX4_
-#include "config/xm-sysv4.h"
-#endif /* _SEQUENT_PTX4_ */
-
-/* This machine doesn't have the siginterrupt call. */
-#define NO_SIGINTERRUPT
-
-#define HAVE_WAIT_STRUCT
-
-#undef HAVE_TERMIO
-#define HAVE_TERMIOS
-#define USG
-
-#define USE_O_NOCTTY
+// OBSOLETE /* Definitions to make GDB run on a Sequent Symmetry under ptx, with
+// OBSOLETE Weitek 1167 and i387 support.
+// OBSOLETE Copyright 1986, 1987, 1989, 1992, 1993, 1994, 1995
+// OBSOLETE Free Software Foundation, Inc.
+// OBSOLETE
+// OBSOLETE This file is part of GDB.
+// OBSOLETE
+// OBSOLETE This program is free software; you can redistribute it and/or modify
+// OBSOLETE it under the terms of the GNU General Public License as published by
+// OBSOLETE the Free Software Foundation; either version 2 of the License, or
+// OBSOLETE (at your option) any later version.
+// OBSOLETE
+// OBSOLETE This program is distributed in the hope that it will be useful,
+// OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of
+// OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// OBSOLETE GNU General Public License for more details.
+// OBSOLETE
+// OBSOLETE You should have received a copy of the GNU General Public License
+// OBSOLETE along with this program; if not, write to the Free Software
+// OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330,
+// OBSOLETE Boston, MA 02111-1307, USA. */
+// OBSOLETE
+// OBSOLETE /* Symmetry version by Jay Vosburgh (fubar@sequent.com) */
+// OBSOLETE
+// OBSOLETE #ifdef _SEQUENT_PTX4_
+// OBSOLETE #include "config/xm-sysv4.h"
+// OBSOLETE #endif /* _SEQUENT_PTX4_ */
+// OBSOLETE
+// OBSOLETE /* This machine doesn't have the siginterrupt call. */
+// OBSOLETE #define NO_SIGINTERRUPT
+// OBSOLETE
+// OBSOLETE #define HAVE_WAIT_STRUCT
+// OBSOLETE
+// OBSOLETE #undef HAVE_TERMIO
+// OBSOLETE #define HAVE_TERMIOS
+// OBSOLETE #define USG
+// OBSOLETE
+// OBSOLETE #define USE_O_NOCTTY
diff --git a/gdb/config/i386/xm-ptx4.h b/gdb/config/i386/xm-ptx4.h
index 6059413..7f0605d 100644
--- a/gdb/config/i386/xm-ptx4.h
+++ b/gdb/config/i386/xm-ptx4.h
@@ -1,27 +1,27 @@
-/* Definitions to make GDB run on a Sequent Symmetry under ptx, with
- Weitek 1167 and i387 support.
- Copyright 1986, 1987, 1989, 1992, 1993, 1994
- Free Software Foundation, Inc.
-
- This file is part of GDB.
-
- 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.
-
- 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.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-
-/* Symmetry version by Jay Vosburgh (fubar@sequent.com) */
-
-#include "config/xm-sysv4.h"
-
-#include "i386/xm-ptx.h"
+// OBSOLETE /* Definitions to make GDB run on a Sequent Symmetry under ptx, with
+// OBSOLETE Weitek 1167 and i387 support.
+// OBSOLETE Copyright 1986, 1987, 1989, 1992, 1993, 1994
+// OBSOLETE Free Software Foundation, Inc.
+// OBSOLETE
+// OBSOLETE This file is part of GDB.
+// OBSOLETE
+// OBSOLETE This program is free software; you can redistribute it and/or modify
+// OBSOLETE it under the terms of the GNU General Public License as published by
+// OBSOLETE the Free Software Foundation; either version 2 of the License, or
+// OBSOLETE (at your option) any later version.
+// OBSOLETE
+// OBSOLETE This program is distributed in the hope that it will be useful,
+// OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of
+// OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// OBSOLETE GNU General Public License for more details.
+// OBSOLETE
+// OBSOLETE You should have received a copy of the GNU General Public License
+// OBSOLETE along with this program; if not, write to the Free Software
+// OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330,
+// OBSOLETE Boston, MA 02111-1307, USA. */
+// OBSOLETE
+// OBSOLETE /* Symmetry version by Jay Vosburgh (fubar@sequent.com) */
+// OBSOLETE
+// OBSOLETE #include "config/xm-sysv4.h"
+// OBSOLETE
+// OBSOLETE #include "i386/xm-ptx.h"
diff --git a/gdb/config/i386/xm-symmetry.h b/gdb/config/i386/xm-symmetry.h
index 781a343..27711f2 100644
--- a/gdb/config/i386/xm-symmetry.h
+++ b/gdb/config/i386/xm-symmetry.h
@@ -1,28 +1,28 @@
-/* Definitions to make GDB run on a Sequent Symmetry under
- dynix 3.1, with Weitek 1167 and i387 support.
- Copyright 1986, 1987, 1989, 1992, 1993, 1994
- Free Software Foundation, Inc.
-
- This file is part of GDB.
-
- 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.
-
- 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.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-
-/* Symmetry version by Jay Vosburgh (fubar@sequent.com) */
-
-/* This machine doesn't have the siginterrupt call. */
-#define NO_SIGINTERRUPT
-
-#define HAVE_WAIT_STRUCT
+// OBSOLETE /* Definitions to make GDB run on a Sequent Symmetry under
+// OBSOLETE dynix 3.1, with Weitek 1167 and i387 support.
+// OBSOLETE Copyright 1986, 1987, 1989, 1992, 1993, 1994
+// OBSOLETE Free Software Foundation, Inc.
+// OBSOLETE
+// OBSOLETE This file is part of GDB.
+// OBSOLETE
+// OBSOLETE This program is free software; you can redistribute it and/or modify
+// OBSOLETE it under the terms of the GNU General Public License as published by
+// OBSOLETE the Free Software Foundation; either version 2 of the License, or
+// OBSOLETE (at your option) any later version.
+// OBSOLETE
+// OBSOLETE This program is distributed in the hope that it will be useful,
+// OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of
+// OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// OBSOLETE GNU General Public License for more details.
+// OBSOLETE
+// OBSOLETE You should have received a copy of the GNU General Public License
+// OBSOLETE along with this program; if not, write to the Free Software
+// OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330,
+// OBSOLETE Boston, MA 02111-1307, USA. */
+// OBSOLETE
+// OBSOLETE /* Symmetry version by Jay Vosburgh (fubar@sequent.com) */
+// OBSOLETE
+// OBSOLETE /* This machine doesn't have the siginterrupt call. */
+// OBSOLETE #define NO_SIGINTERRUPT
+// OBSOLETE
+// OBSOLETE #define HAVE_WAIT_STRUCT
diff --git a/gdb/config/m68k/tm-delta68.h b/gdb/config/m68k/tm-delta68.h
index a1abc0e..03172b0 100644
--- a/gdb/config/m68k/tm-delta68.h
+++ b/gdb/config/m68k/tm-delta68.h
@@ -18,6 +18,8 @@
Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
+struct frame_info;
+
#include "regcache.h"
/* Define BPT_VECTOR if it is different than the default.
@@ -99,8 +101,8 @@ extern int delta68_in_sigtramp (CORE_ADDR pc, char *name);
#define IN_SIGTRAMP(pc,name) delta68_in_sigtramp (pc, name)
extern CORE_ADDR delta68_frame_saved_pc (struct frame_info *fi);
-#undef FRAME_SAVED_PC
-#define FRAME_SAVED_PC(fi) delta68_frame_saved_pc (fi)
+#undef DEPRECATED_FRAME_SAVED_PC
+#define DEPRECATED_FRAME_SAVED_PC(fi) delta68_frame_saved_pc (fi)
extern CORE_ADDR delta68_frame_args_address (struct frame_info *fi);
#undef FRAME_ARGS_ADDRESS
diff --git a/gdb/config/m68k/tm-linux.h b/gdb/config/m68k/tm-linux.h
index 4990bb0..cc20c62 100644
--- a/gdb/config/m68k/tm-linux.h
+++ b/gdb/config/m68k/tm-linux.h
@@ -100,8 +100,8 @@
#define GET_LONGJMP_TARGET(ADDR) m68k_get_longjmp_target(ADDR)
-#undef FRAME_SAVED_PC
-#define FRAME_SAVED_PC(frame) m68k_linux_frame_saved_pc (frame)
+#undef DEPRECATED_FRAME_SAVED_PC
+#define DEPRECATED_FRAME_SAVED_PC(frame) m68k_linux_frame_saved_pc (frame)
extern CORE_ADDR m68k_linux_frame_saved_pc (struct frame_info *);
#define IN_SIGTRAMP(pc,name) m68k_linux_in_sigtramp (pc)
diff --git a/gdb/config/m68k/tm-os68k.h b/gdb/config/m68k/tm-os68k.h
index 2954570..815efff 100644
--- a/gdb/config/m68k/tm-os68k.h
+++ b/gdb/config/m68k/tm-os68k.h
@@ -35,5 +35,5 @@
If our current frame pointer is zero, we're at the top; else read out
the saved FP from memory pointed to by the current FP. */
-#undef FRAME_CHAIN
-#define FRAME_CHAIN(thisframe) ((thisframe)->frame? read_memory_integer ((thisframe)->frame, 4): 0)
+#undef DEPRECATED_FRAME_CHAIN
+#define DEPRECATED_FRAME_CHAIN(thisframe) ((thisframe)->frame? read_memory_integer ((thisframe)->frame, 4): 0)
diff --git a/gdb/config/m68k/tm-sun3.h b/gdb/config/m68k/tm-sun3.h
index 253fd53..aafba6a 100644
--- a/gdb/config/m68k/tm-sun3.h
+++ b/gdb/config/m68k/tm-sun3.h
@@ -86,17 +86,18 @@
/* The code which tries to deal with this bug is never harmful on a sun3. */
#define SUN_FIXED_LBRAC_BUG (0)
-/* On the sun3 the kernel pushes a sigcontext on the user stack and then
- `calls' _sigtramp in user code. _sigtramp saves the floating point status
- on the stack and calls the signal handler function. The stack does not
- contain enough information to allow a normal backtrace, but sigcontext
- contains the saved user pc/sp. FRAME_CHAIN and friends in tm-m68k.h and
- m68k_find_saved_regs deal with this situation by manufacturing a fake frame
- for _sigtramp.
- SIG_PC_FP_OFFSET is the offset from the signal handler frame to the
- saved pc in sigcontext.
- SIG_SP_FP_OFFSET is the offset from the signal handler frame to the end
- of sigcontext which is identical to the saved sp at SIG_PC_FP_OFFSET - 4.
+/* On the sun3 the kernel pushes a sigcontext on the user stack and
+ then `calls' _sigtramp in user code. _sigtramp saves the floating
+ point status on the stack and calls the signal handler
+ function. The stack does not contain enough information to allow a
+ normal backtrace, but sigcontext contains the saved user
+ pc/sp. DEPRECATED_FRAME_CHAIN and friends in tm-m68k.h and
+ m68k_find_saved_regs deal with this situation by manufacturing a
+ fake frame for _sigtramp. SIG_PC_FP_OFFSET is the offset from the
+ signal handler frame to the saved pc in sigcontext.
+ SIG_SP_FP_OFFSET is the offset from the signal handler frame to the
+ end of sigcontext which is identical to the saved sp at
+ SIG_PC_FP_OFFSET - 4.
Please note that it is impossible to correctly backtrace from a breakpoint
in _sigtramp as _sigtramp modifies the stack pointer a few times. */
diff --git a/gdb/config/m68k/tm-vx68.h b/gdb/config/m68k/tm-vx68.h
index 76ac6fd..f7e8fca 100644
--- a/gdb/config/m68k/tm-vx68.h
+++ b/gdb/config/m68k/tm-vx68.h
@@ -39,8 +39,8 @@
If our current frame pointer is zero, we're at the top; else read out
the saved FP from memory pointed to by the current FP. */
-#undef FRAME_CHAIN
-#define FRAME_CHAIN(thisframe) ((thisframe)->frame? read_memory_integer ((thisframe)->frame, 4): 0)
+#undef DEPRECATED_FRAME_CHAIN
+#define DEPRECATED_FRAME_CHAIN(thisframe) ((thisframe)->frame? read_memory_integer ((thisframe)->frame, 4): 0)
/* FIXME, Longjmp information stolen from Sun-3 config. Dunno if right. */
/* Offsets (in target ints) into jmp_buf. Not defined by Sun, but at least
diff --git a/gdb/config/mips/mipsm3.mh b/gdb/config/mips/mipsm3.mh
index 864ad57..fc9f37c 100644
--- a/gdb/config/mips/mipsm3.mh
+++ b/gdb/config/mips/mipsm3.mh
@@ -1,6 +1,6 @@
-# Host: Little endian MIPS machine such as pmax
-# running Mach 3.0 operating system
-
-NATDEPFILES= mipsm3-nat.o m3-nat.o core-aout.o
-XM_FILE= xm-mipsm3.h
-NAT_FILE= ../nm-m3.h
+# OBSOLETE # Host: Little endian MIPS machine such as pmax
+# OBSOLETE # running Mach 3.0 operating system
+# OBSOLETE
+# OBSOLETE NATDEPFILES= mipsm3-nat.o m3-nat.o core-aout.o
+# OBSOLETE XM_FILE= xm-mipsm3.h
+# OBSOLETE NAT_FILE= ../nm-m3.h
diff --git a/gdb/config/mips/mipsm3.mt b/gdb/config/mips/mipsm3.mt
index 66856d1..837b27e 100644
--- a/gdb/config/mips/mipsm3.mt
+++ b/gdb/config/mips/mipsm3.mt
@@ -1,4 +1,4 @@
-# Target: Little-endian MIPS machine such as pmax
-# running Mach 3.0 operating system
-TDEPFILES= mips-tdep.o
-TM_FILE= tm-mipsm3.h
+# OBSOLETE # Target: Little-endian MIPS machine such as pmax
+# OBSOLETE # running Mach 3.0 operating system
+# OBSOLETE TDEPFILES= mips-tdep.o
+# OBSOLETE TM_FILE= tm-mipsm3.h
diff --git a/gdb/config/mips/tm-irix3.h b/gdb/config/mips/tm-irix3.h
index 8875f79..03c66bd 100644
--- a/gdb/config/mips/tm-irix3.h
+++ b/gdb/config/mips/tm-irix3.h
@@ -33,15 +33,11 @@
#undef FCRCS_REGNUM
#undef FCRIR_REGNUM
-/* Initializer for an array of names of registers.
- There should be NUM_REGS strings in this initializer. */
+/* Initializer for an array of names for registers 32 and above.
+ There should be NUM_REGS-32 strings in this initializer. */
#define MIPS_REGISTER_NAMES \
- { "zero", "at", "v0", "v1", "a0", "a1", "a2", "a3", \
- "t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7", \
- "s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7", \
- "t8", "t9", "k0", "k1", "gp", "sp", "fp", "ra", \
- "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", \
+ { "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", \
"f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15", \
"f16", "f17", "f18", "f19", "f20", "f21", "f22", "f23",\
"f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31",\
diff --git a/gdb/config/mips/tm-irix6.h b/gdb/config/mips/tm-irix6.h
index 26813ba..59d3c58 100644
--- a/gdb/config/mips/tm-irix6.h
+++ b/gdb/config/mips/tm-irix6.h
@@ -34,15 +34,11 @@
#undef FCRCS_REGNUM
#undef FCRIR_REGNUM
-/* Initializer for an array of names of registers.
- There should be NUM_REGS strings in this initializer. */
+/* Initializer for an array of names for registers 32 and above.
+ There should be NUM_REGS-32 strings in this initializer. */
#define MIPS_REGISTER_NAMES \
- { "zero", "at", "v0", "v1", "a0", "a1", "a2", "a3", \
- "a4", "a5", "a6", "a7", "t0", "t1", "t2", "t3", \
- "s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7", \
- "t8", "t9", "k0", "k1", "gp", "sp", "s8", "ra", \
- "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", \
+ { "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", \
"f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15", \
"f16", "f17", "f18", "f19", "f20", "f21", "f22", "f23",\
"f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31",\
diff --git a/gdb/config/mips/tm-mips.h b/gdb/config/mips/tm-mips.h
index e092d4a..dada615 100644
--- a/gdb/config/mips/tm-mips.h
+++ b/gdb/config/mips/tm-mips.h
@@ -59,16 +59,12 @@ extern int mips_step_skips_delay (CORE_ADDR);
#define MIPS_REGSIZE 4
#endif
-/* Initializer for an array of names of registers.
- There should be NUM_REGS strings in this initializer. */
+/* Initializer for an array of names for registers 32 and above.
+ There should be NUM_REGS-32 strings in this initializer. */
#ifndef MIPS_REGISTER_NAMES
#define MIPS_REGISTER_NAMES \
- { "zero", "at", "v0", "v1", "a0", "a1", "a2", "a3", \
- "t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7", \
- "s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7", \
- "t8", "t9", "k0", "k1", "gp", "sp", "s8", "ra", \
- "sr", "lo", "hi", "bad", "cause","pc", \
+ { "sr", "lo", "hi", "bad", "cause","pc", \
"f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", \
"f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15", \
"f16", "f17", "f18", "f19", "f20", "f21", "f22", "f23",\
diff --git a/gdb/config/mips/tm-mipsm3.h b/gdb/config/mips/tm-mipsm3.h
index 9e2f490..dbc10d7 100644
--- a/gdb/config/mips/tm-mipsm3.h
+++ b/gdb/config/mips/tm-mipsm3.h
@@ -1,67 +1,67 @@
-/* Definitions to make GDB run on a mips box under Mach 3.0
- Copyright 1992, 1993, 1998 Free Software Foundation, Inc.
-
- This file is part of GDB.
-
- 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.
-
- 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.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-
-/* Mach specific definitions for little endian mips (e.g. pmax)
- * running Mach 3.0
- *
- * Author: Jukka Virtanen <jtv@hut.fi>
- */
-
-/* Include common definitions for Mach3 systems */
-#include "config/nm-m3.h"
-
-/* Define offsets to access CPROC stack when it does not have
- * a kernel thread.
- */
-
-/* From mk/user/threads/mips/csw.s */
-#define SAVED_FP (12*4)
-#define SAVED_PC (13*4)
-#define SAVED_BYTES (14*4)
-
-/* Using these, define our offsets to items strored in
- * cproc_switch in csw.s
- */
-#define MACHINE_CPROC_SP_OFFSET SAVED_BYTES
-#define MACHINE_CPROC_PC_OFFSET SAVED_PC
-#define MACHINE_CPROC_FP_OFFSET SAVED_FP
-
-/* Thread flavors used in setting the Trace state.
-
- * In <mach/machine/thread_status.h>
- */
-#define TRACE_FLAVOR MIPS_EXC_STATE
-#define TRACE_FLAVOR_SIZE MIPS_EXC_STATE_COUNT
-#define TRACE_SET(x,state) ((struct mips_exc_state *)state)->cause = EXC_SST;
-#define TRACE_CLEAR(x,state) 0
-
-/* Mach supports attach/detach */
-#define ATTACH_DETACH 1
-
-#include "mips/tm-mips.h"
-
-/* Address of end of user stack space.
- * for MACH, see <machine/vmparam.h>
- */
-#undef STACK_END_ADDR
-#define STACK_END_ADDR USRSTACK
-
-/* Output registers in tabular format */
-#define TABULAR_REGISTER_OUTPUT
+// OBSOLETE /* Definitions to make GDB run on a mips box under Mach 3.0
+// OBSOLETE Copyright 1992, 1993, 1998 Free Software Foundation, Inc.
+// OBSOLETE
+// OBSOLETE This file is part of GDB.
+// OBSOLETE
+// OBSOLETE This program is free software; you can redistribute it and/or modify
+// OBSOLETE it under the terms of the GNU General Public License as published by
+// OBSOLETE the Free Software Foundation; either version 2 of the License, or
+// OBSOLETE (at your option) any later version.
+// OBSOLETE
+// OBSOLETE This program is distributed in the hope that it will be useful,
+// OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of
+// OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// OBSOLETE GNU General Public License for more details.
+// OBSOLETE
+// OBSOLETE You should have received a copy of the GNU General Public License
+// OBSOLETE along with this program; if not, write to the Free Software
+// OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330,
+// OBSOLETE Boston, MA 02111-1307, USA. */
+// OBSOLETE
+// OBSOLETE /* Mach specific definitions for little endian mips (e.g. pmax)
+// OBSOLETE * running Mach 3.0
+// OBSOLETE *
+// OBSOLETE * Author: Jukka Virtanen <jtv@hut.fi>
+// OBSOLETE */
+// OBSOLETE
+// OBSOLETE /* Include common definitions for Mach3 systems */
+// OBSOLETE #include "config/nm-m3.h"
+// OBSOLETE
+// OBSOLETE /* Define offsets to access CPROC stack when it does not have
+// OBSOLETE * a kernel thread.
+// OBSOLETE */
+// OBSOLETE
+// OBSOLETE /* From mk/user/threads/mips/csw.s */
+// OBSOLETE #define SAVED_FP (12*4)
+// OBSOLETE #define SAVED_PC (13*4)
+// OBSOLETE #define SAVED_BYTES (14*4)
+// OBSOLETE
+// OBSOLETE /* Using these, define our offsets to items strored in
+// OBSOLETE * cproc_switch in csw.s
+// OBSOLETE */
+// OBSOLETE #define MACHINE_CPROC_SP_OFFSET SAVED_BYTES
+// OBSOLETE #define MACHINE_CPROC_PC_OFFSET SAVED_PC
+// OBSOLETE #define MACHINE_CPROC_FP_OFFSET SAVED_FP
+// OBSOLETE
+// OBSOLETE /* Thread flavors used in setting the Trace state.
+// OBSOLETE
+// OBSOLETE * In <mach/machine/thread_status.h>
+// OBSOLETE */
+// OBSOLETE #define TRACE_FLAVOR MIPS_EXC_STATE
+// OBSOLETE #define TRACE_FLAVOR_SIZE MIPS_EXC_STATE_COUNT
+// OBSOLETE #define TRACE_SET(x,state) ((struct mips_exc_state *)state)->cause = EXC_SST;
+// OBSOLETE #define TRACE_CLEAR(x,state) 0
+// OBSOLETE
+// OBSOLETE /* Mach supports attach/detach */
+// OBSOLETE #define ATTACH_DETACH 1
+// OBSOLETE
+// OBSOLETE #include "mips/tm-mips.h"
+// OBSOLETE
+// OBSOLETE /* Address of end of user stack space.
+// OBSOLETE * for MACH, see <machine/vmparam.h>
+// OBSOLETE */
+// OBSOLETE #undef STACK_END_ADDR
+// OBSOLETE #define STACK_END_ADDR USRSTACK
+// OBSOLETE
+// OBSOLETE /* Output registers in tabular format */
+// OBSOLETE #define TABULAR_REGISTER_OUTPUT
diff --git a/gdb/config/mips/tm-tx39.h b/gdb/config/mips/tm-tx39.h
index d6fbd29..d095db0 100644
--- a/gdb/config/mips/tm-tx39.h
+++ b/gdb/config/mips/tm-tx39.h
@@ -21,11 +21,7 @@
#undef MIPS_REGISTER_NAMES
#define MIPS_REGISTER_NAMES \
- { "zero", "at", "v0", "v1", "a0", "a1", "a2", "a3", \
- "t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7", \
- "s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7", \
- "t8", "t9", "k0", "k1", "gp", "sp", "s8", "ra", \
- "sr", "lo", "hi", "bad", "cause","pc", \
+ { "sr", "lo", "hi", "bad", "cause","pc", \
"", "", "", "", "", "", "", "", \
"", "", "", "", "", "", "", "", \
"", "", "", "", "", "", "", "", \
diff --git a/gdb/config/mips/tm-tx39l.h b/gdb/config/mips/tm-tx39l.h
index 0c6d32b..81f3b6d 100644
--- a/gdb/config/mips/tm-tx39l.h
+++ b/gdb/config/mips/tm-tx39l.h
@@ -21,11 +21,7 @@
#undef MIPS_REGISTER_NAMES
#define MIPS_REGISTER_NAMES \
- { "zero", "at", "v0", "v1", "a0", "a1", "a2", "a3", \
- "t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7", \
- "s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7", \
- "t8", "t9", "k0", "k1", "gp", "sp", "s8", "ra", \
- "sr", "lo", "hi", "bad", "cause","pc", \
+ { "sr", "lo", "hi", "bad", "cause","pc", \
"", "", "", "", "", "", "", "", \
"", "", "", "", "", "", "", "", \
"", "", "", "", "", "", "", "", \
diff --git a/gdb/config/mips/xm-mipsm3.h b/gdb/config/mips/xm-mipsm3.h
index b2e9f4d..2207d3a 100644
--- a/gdb/config/mips/xm-mipsm3.h
+++ b/gdb/config/mips/xm-mipsm3.h
@@ -1,29 +1,29 @@
-/* Definitions to make GDB run on a mips box under 4.3bsd.
- Copyright 1986, 1987, 1989, 1993 Free Software Foundation, Inc.
- Contributed by Per Bothner(bothner@cs.wisc.edu) at U.Wisconsin
- and by Alessandro Forin(af@cs.cmu.edu) at CMU
-
- This file is part of GDB.
-
- 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.
-
- 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.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-
-#define KERNEL_U_ADDR 0 /* Not needed. */
-
-/* Only used for core files on DECstations. */
-
-#define REGISTER_U_ADDR(addr, blockend, regno) \
- if (regno < 38) addr = (NBPG*UPAGES) + (regno - 38)*sizeof(int);\
- else addr = 0; /* ..somewhere in the pcb */
+// OBSOLETE /* Definitions to make GDB run on a mips box under 4.3bsd.
+// OBSOLETE Copyright 1986, 1987, 1989, 1993 Free Software Foundation, Inc.
+// OBSOLETE Contributed by Per Bothner(bothner@cs.wisc.edu) at U.Wisconsin
+// OBSOLETE and by Alessandro Forin(af@cs.cmu.edu) at CMU
+// OBSOLETE
+// OBSOLETE This file is part of GDB.
+// OBSOLETE
+// OBSOLETE This program is free software; you can redistribute it and/or modify
+// OBSOLETE it under the terms of the GNU General Public License as published by
+// OBSOLETE the Free Software Foundation; either version 2 of the License, or
+// OBSOLETE (at your option) any later version.
+// OBSOLETE
+// OBSOLETE This program is distributed in the hope that it will be useful,
+// OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of
+// OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// OBSOLETE GNU General Public License for more details.
+// OBSOLETE
+// OBSOLETE You should have received a copy of the GNU General Public License
+// OBSOLETE along with this program; if not, write to the Free Software
+// OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330,
+// OBSOLETE Boston, MA 02111-1307, USA. */
+// OBSOLETE
+// OBSOLETE #define KERNEL_U_ADDR 0 /* Not needed. */
+// OBSOLETE
+// OBSOLETE /* Only used for core files on DECstations. */
+// OBSOLETE
+// OBSOLETE #define REGISTER_U_ADDR(addr, blockend, regno) \
+// OBSOLETE if (regno < 38) addr = (NBPG*UPAGES) + (regno - 38)*sizeof(int);\
+// OBSOLETE else addr = 0; /* ..somewhere in the pcb */
diff --git a/gdb/config/nm-linux.h b/gdb/config/nm-linux.h
index 114acd8..0fb5627 100644
--- a/gdb/config/nm-linux.h
+++ b/gdb/config/nm-linux.h
@@ -19,6 +19,8 @@
Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
+struct target_ops;
+
/* GNU/Linux is SVR4-ish but its /proc file system isn't. */
#undef USE_PROC_FS
diff --git a/gdb/config/nm-lynx.h b/gdb/config/nm-lynx.h
index 1fb0eb6..4a55a13 100644
--- a/gdb/config/nm-lynx.h
+++ b/gdb/config/nm-lynx.h
@@ -23,6 +23,8 @@
#ifndef NM_LYNX_H
#define NM_LYNX_H
+struct target_waitstatus;
+
#include <sys/conf.h>
#include <sys/kernel.h>
/* sys/kernel.h should define this, but doesn't always, sigh. */
diff --git a/gdb/config/nm-m3.h b/gdb/config/nm-m3.h
index 07bc26a..0cc84e3 100644
--- a/gdb/config/nm-m3.h
+++ b/gdb/config/nm-m3.h
@@ -1,126 +1,126 @@
-/* Mach 3.0 common definitions and global vars.
-
- Copyright 1992, 1993, 1994, 1996 Free Software Foundation, Inc.
-
- This file is part of GDB.
-
- 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.
-
- 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.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-
-#ifndef NM_M3_H
-#define NM_M3_H
-
-#include <mach.h>
-#include "regcache.h"
-
-/* Mach3 doesn't declare errno in <errno.h>. */
-extern int errno;
-
-/* Task port of our debugged inferior. */
-
-extern task_t inferior_task;
-
-/* Thread port of the current thread in the inferior. */
-
-extern thread_t current_thread;
-
-/* If nonzero, we must suspend/abort && resume threads
- * when setting or getting the state.
- */
-extern int must_suspend_thread;
-
-#define PREPARE_TO_PROCEED(select_it) mach3_prepare_to_proceed(select_it)
-
-/* Try to get the privileged host port for authentication to machid
-
- * If you can get this, you may debug anything on this host.
- *
- * If you can't, gdb gives it's own task port as the
- * authentication port
- */
-#define mach_privileged_host_port() task_by_pid(-1)
-
-/*
- * This is the MIG ID number of the emulator/server bsd_execve() RPC call.
- *
- * It SHOULD never change, but if it does, gdb `run'
- * command won't work until you fix this define.
- *
- */
-#define MIG_EXEC_SYSCALL_ID 101000
-
-/* If our_message_port gets a msg with this ID,
- * GDB suspends it's inferior and enters command level.
- * (Useful at least if ^C does not work)
- */
-#define GDB_MESSAGE_ID_STOP 0x41151
-
-/* wait3 WNOHANG is defined in <sys/wait.h> but
- * for some reason gdb does not want to include
- * that file.
- *
- * If your system defines WNOHANG differently, this has to be changed.
- */
-#define WNOHANG 1
-
-/* Before storing, we need to read all the registers. */
-
-#define CHILD_PREPARE_TO_STORE() deprecated_read_register_bytes (0, NULL, REGISTER_BYTES)
-
-/* Check if the inferior exists */
-#define MACH_ERROR_NO_INFERIOR \
- do if (!MACH_PORT_VALID (inferior_task)) \
- error ("Inferior task does not exist."); while(0)
-
-/* Error handler for mach calls */
-#define CHK(str,ret) \
- do if (ret != KERN_SUCCESS) \
- error ("Gdb %s [%d] %s : %s\n",__FILE__,__LINE__,str, \
- mach_error_string(ret)); while(0)
-
-/* This is from POE9 emulator/emul_stack.h
- */
-/*
- * Top of emulator stack holds link and reply port.
- */
-struct emul_stack_top
- {
- struct emul_stack_top *link;
- mach_port_t reply_port;
- };
-
-#define EMULATOR_STACK_SIZE (4096*4)
-
-#define THREAD_ALLOWED_TO_BREAK(mid) mach_thread_for_breakpoint (mid)
-
-#define THREAD_PARSE_ID(arg) mach_thread_parse_id (arg)
-
-#define THREAD_OUTPUT_ID(mid) mach_thread_output_id (mid)
-
-#define ATTACH_TO_THREAD attach_to_thread
-
-/* Don't do wait_for_inferior on attach. */
-#define ATTACH_NO_WAIT
-
-/* Do Mach 3 dependent operations when ^C or a STOP is requested */
-#define DO_QUIT() mach3_quit ()
-
-#if 0
-/* This is bogus. It is NOT OK to quit out of target_wait. */
-/* If in mach_msg() and ^C is typed set immediate_quit */
-#define REQUEST_QUIT() mach3_request_quit ()
-#endif
-
-#endif /* NM_M3_H */
+// OBSOLETE /* Mach 3.0 common definitions and global vars.
+// OBSOLETE
+// OBSOLETE Copyright 1992, 1993, 1994, 1996 Free Software Foundation, Inc.
+// OBSOLETE
+// OBSOLETE This file is part of GDB.
+// OBSOLETE
+// OBSOLETE This program is free software; you can redistribute it and/or modify
+// OBSOLETE it under the terms of the GNU General Public License as published by
+// OBSOLETE the Free Software Foundation; either version 2 of the License, or
+// OBSOLETE (at your option) any later version.
+// OBSOLETE
+// OBSOLETE This program is distributed in the hope that it will be useful,
+// OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of
+// OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// OBSOLETE GNU General Public License for more details.
+// OBSOLETE
+// OBSOLETE You should have received a copy of the GNU General Public License
+// OBSOLETE along with this program; if not, write to the Free Software
+// OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330,
+// OBSOLETE Boston, MA 02111-1307, USA. */
+// OBSOLETE
+// OBSOLETE #ifndef NM_M3_H
+// OBSOLETE #define NM_M3_H
+// OBSOLETE
+// OBSOLETE #include <mach.h>
+// OBSOLETE #include "regcache.h"
+// OBSOLETE
+// OBSOLETE /* Mach3 doesn't declare errno in <errno.h>. */
+// OBSOLETE extern int errno;
+// OBSOLETE
+// OBSOLETE /* Task port of our debugged inferior. */
+// OBSOLETE
+// OBSOLETE extern task_t inferior_task;
+// OBSOLETE
+// OBSOLETE /* Thread port of the current thread in the inferior. */
+// OBSOLETE
+// OBSOLETE extern thread_t current_thread;
+// OBSOLETE
+// OBSOLETE /* If nonzero, we must suspend/abort && resume threads
+// OBSOLETE * when setting or getting the state.
+// OBSOLETE */
+// OBSOLETE extern int must_suspend_thread;
+// OBSOLETE
+// OBSOLETE #define PREPARE_TO_PROCEED(select_it) mach3_prepare_to_proceed(select_it)
+// OBSOLETE
+// OBSOLETE /* Try to get the privileged host port for authentication to machid
+// OBSOLETE
+// OBSOLETE * If you can get this, you may debug anything on this host.
+// OBSOLETE *
+// OBSOLETE * If you can't, gdb gives it's own task port as the
+// OBSOLETE * authentication port
+// OBSOLETE */
+// OBSOLETE #define mach_privileged_host_port() task_by_pid(-1)
+// OBSOLETE
+// OBSOLETE /*
+// OBSOLETE * This is the MIG ID number of the emulator/server bsd_execve() RPC call.
+// OBSOLETE *
+// OBSOLETE * It SHOULD never change, but if it does, gdb `run'
+// OBSOLETE * command won't work until you fix this define.
+// OBSOLETE *
+// OBSOLETE */
+// OBSOLETE #define MIG_EXEC_SYSCALL_ID 101000
+// OBSOLETE
+// OBSOLETE /* If our_message_port gets a msg with this ID,
+// OBSOLETE * GDB suspends it's inferior and enters command level.
+// OBSOLETE * (Useful at least if ^C does not work)
+// OBSOLETE */
+// OBSOLETE #define GDB_MESSAGE_ID_STOP 0x41151
+// OBSOLETE
+// OBSOLETE /* wait3 WNOHANG is defined in <sys/wait.h> but
+// OBSOLETE * for some reason gdb does not want to include
+// OBSOLETE * that file.
+// OBSOLETE *
+// OBSOLETE * If your system defines WNOHANG differently, this has to be changed.
+// OBSOLETE */
+// OBSOLETE #define WNOHANG 1
+// OBSOLETE
+// OBSOLETE /* Before storing, we need to read all the registers. */
+// OBSOLETE
+// OBSOLETE #define CHILD_PREPARE_TO_STORE() deprecated_read_register_bytes (0, NULL, REGISTER_BYTES)
+// OBSOLETE
+// OBSOLETE /* Check if the inferior exists */
+// OBSOLETE #define MACH_ERROR_NO_INFERIOR \
+// OBSOLETE do if (!MACH_PORT_VALID (inferior_task)) \
+// OBSOLETE error ("Inferior task does not exist."); while(0)
+// OBSOLETE
+// OBSOLETE /* Error handler for mach calls */
+// OBSOLETE #define CHK(str,ret) \
+// OBSOLETE do if (ret != KERN_SUCCESS) \
+// OBSOLETE error ("Gdb %s [%d] %s : %s\n",__FILE__,__LINE__,str, \
+// OBSOLETE mach_error_string(ret)); while(0)
+// OBSOLETE
+// OBSOLETE /* This is from POE9 emulator/emul_stack.h
+// OBSOLETE */
+// OBSOLETE /*
+// OBSOLETE * Top of emulator stack holds link and reply port.
+// OBSOLETE */
+// OBSOLETE struct emul_stack_top
+// OBSOLETE {
+// OBSOLETE struct emul_stack_top *link;
+// OBSOLETE mach_port_t reply_port;
+// OBSOLETE };
+// OBSOLETE
+// OBSOLETE #define EMULATOR_STACK_SIZE (4096*4)
+// OBSOLETE
+// OBSOLETE #define THREAD_ALLOWED_TO_BREAK(mid) mach_thread_for_breakpoint (mid)
+// OBSOLETE
+// OBSOLETE #define THREAD_PARSE_ID(arg) mach_thread_parse_id (arg)
+// OBSOLETE
+// OBSOLETE #define THREAD_OUTPUT_ID(mid) mach_thread_output_id (mid)
+// OBSOLETE
+// OBSOLETE #define ATTACH_TO_THREAD attach_to_thread
+// OBSOLETE
+// OBSOLETE /* Don't do wait_for_inferior on attach. */
+// OBSOLETE #define ATTACH_NO_WAIT
+// OBSOLETE
+// OBSOLETE /* Do Mach 3 dependent operations when ^C or a STOP is requested */
+// OBSOLETE #define DO_QUIT() mach3_quit ()
+// OBSOLETE
+// OBSOLETE #if 0
+// OBSOLETE /* This is bogus. It is NOT OK to quit out of target_wait. */
+// OBSOLETE /* If in mach_msg() and ^C is typed set immediate_quit */
+// OBSOLETE #define REQUEST_QUIT() mach3_request_quit ()
+// OBSOLETE #endif
+// OBSOLETE
+// OBSOLETE #endif /* NM_M3_H */
diff --git a/gdb/config/pa/hppabsd.mh b/gdb/config/pa/hppabsd.mh
index d4a152d..e4d0215 100644
--- a/gdb/config/pa/hppabsd.mh
+++ b/gdb/config/pa/hppabsd.mh
@@ -1,4 +1,4 @@
-# Host: Hewlett-Packard PA-RISC machine, running BSD
-XM_FILE= xm-hppab.h
-NAT_FILE= nm-hppab.h
-NATDEPFILES= hppab-nat.o corelow.o core-aout.o inftarg.o fork-child.o somread.o infptrace.o hpread.o somsolib.o
+# OBSOLETE # Host: Hewlett-Packard PA-RISC machine, running BSD
+# OBSOLETE XM_FILE= xm-hppab.h
+# OBSOLETE NAT_FILE= nm-hppab.h
+# OBSOLETE NATDEPFILES= hppab-nat.o corelow.o core-aout.o inftarg.o fork-child.o somread.o infptrace.o hpread.o somsolib.o
diff --git a/gdb/config/pa/hppabsd.mt b/gdb/config/pa/hppabsd.mt
index 0fc0380..e63f9b8 100644
--- a/gdb/config/pa/hppabsd.mt
+++ b/gdb/config/pa/hppabsd.mt
@@ -1,3 +1,3 @@
-# Target: HP PA-RISC running bsd
-TDEPFILES= hppa-tdep.o
-TM_FILE= tm-hppab.h
+# OBSOLETE # Target: HP PA-RISC running bsd
+# OBSOLETE TDEPFILES= hppa-tdep.o
+# OBSOLETE TM_FILE= tm-hppab.h
diff --git a/gdb/config/pa/hppaosf.mh b/gdb/config/pa/hppaosf.mh
index d6dd282..0e82dc1 100644
--- a/gdb/config/pa/hppaosf.mh
+++ b/gdb/config/pa/hppaosf.mh
@@ -1,5 +1,5 @@
-# Host: Hewlett-Packard PA-RISC machine, running BSD
-XM_FILE= xm-hppab.h
-NAT_FILE= nm-hppao.h
-NATDEPFILES= fork-child.o m3-nat.o hppam3-nat.o somread.o hpread.o somsolib.o
-NAT_CLIBS= -lmachid -lnetname -lmach
+# OBSOLETE # Host: Hewlett-Packard PA-RISC machine, running BSD
+# OBSOLETE XM_FILE= xm-hppab.h
+# OBSOLETE NAT_FILE= nm-hppao.h
+# OBSOLETE NATDEPFILES= fork-child.o m3-nat.o hppam3-nat.o somread.o hpread.o somsolib.o
+# OBSOLETE NAT_CLIBS= -lmachid -lnetname -lmach
diff --git a/gdb/config/pa/hppaosf.mt b/gdb/config/pa/hppaosf.mt
index 6754023..4a54c79 100644
--- a/gdb/config/pa/hppaosf.mt
+++ b/gdb/config/pa/hppaosf.mt
@@ -1,3 +1,3 @@
-# Target: HP PA-RISC running OSF1
-TDEPFILES= hppa-tdep.o
-TM_FILE= tm-hppao.h
+# OBSOLETE # Target: HP PA-RISC running OSF1
+# OBSOLETE TDEPFILES= hppa-tdep.o
+# OBSOLETE TM_FILE= tm-hppao.h
diff --git a/gdb/config/pa/hppapro.mt b/gdb/config/pa/hppapro.mt
index 4851b18..cfd9969 100644
--- a/gdb/config/pa/hppapro.mt
+++ b/gdb/config/pa/hppapro.mt
@@ -1,3 +1,3 @@
-# Target: PA based debug monitor
-TDEPFILES= hppa-tdep.o op50-rom.o w89k-rom.o monitor.o xmodem.o dsrec.o
-TM_FILE= tm-pro.h
+# OBSOLETE # Target: PA based debug monitor
+# OBSOLETE TDEPFILES= hppa-tdep.o op50-rom.o w89k-rom.o monitor.o xmodem.o dsrec.o
+# OBSOLETE TM_FILE= tm-pro.h
diff --git a/gdb/config/pa/nm-hppab.h b/gdb/config/pa/nm-hppab.h
index d9827dc..96dea6e 100644
--- a/gdb/config/pa/nm-hppab.h
+++ b/gdb/config/pa/nm-hppab.h
@@ -1,123 +1,123 @@
-/* HPPA PA-RISC machine native support for BSD, for GDB.
- Copyright 1991, 1992, 1993, 1994, 1995, 2002 Free Software Foundation, Inc.
-
- This file is part of GDB.
-
- 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.
-
- 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.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-
-#include "somsolib.h"
-#include "regcache.h"
-
-#define U_REGS_OFFSET 0
-
-#define KERNEL_U_ADDR 0
-
-/* What a coincidence! */
-#define REGISTER_U_ADDR(addr, blockend, regno) \
-{ addr = (int)(blockend) + REGISTER_BYTE (regno);}
-
-/* 3rd argument to ptrace is supposed to be a caddr_t. */
-
-#define PTRACE_ARG3_TYPE caddr_t
-
-/* HPUX 8.0, in its infinite wisdom, has chosen to prototype ptrace
- with five arguments, so programs written for normal ptrace lose. */
-#define FIVE_ARG_PTRACE
-
-
-/* fetch_inferior_registers is in hppab-nat.c. */
-#define FETCH_INFERIOR_REGISTERS
-
-/* attach/detach works to some extent under BSD and HPUX. So long
- as the process you're attaching to isn't blocked waiting on io,
- blocked waiting on a signal, or in a system call things work
- fine. (The problems in those cases are related to the fact that
- the kernel can't provide complete register information for the
- target process... Which really pisses off GDB.) */
-
-#define ATTACH_DETACH
-
-/* The PA-BSD kernel has support for using the data memory break bit
- to implement fast watchpoints.
-
- Watchpoints on the PA act much like traditional page protection
- schemes, but with some notable differences.
-
- First, a special bit in the page table entry is used to cause
- a trap when a specific page is written to. This avoids having
- to overload watchpoints on the page protection bits. This makes
- it possible for the kernel to easily decide if a trap was caused
- by a watchpoint or by the user writing to protected memory and can
- signal the user program differently in each case.
-
- Second, the PA has a bit in the processor status word which causes
- data memory breakpoints (aka watchpoints) to be disabled for a single
- instruction. This bit can be used to avoid the overhead of unprotecting
- and reprotecting pages when it becomes necessary to step over a watchpoint.
-
-
- When the kernel receives a trap indicating a write to a page which
- is being watched, the kernel performs a couple of simple actions. First
- is sets the magic "disable memory breakpoint" bit in the processor
- status word, it then sends a SIGTRAP to the process which caused the
- trap.
-
- GDB will take control and catch the signal for the inferior. GDB then
- examines the PSW-X bit to determine if the SIGTRAP was caused by a
- watchpoint firing. If so GDB single steps the inferior over the
- instruction which caused the watchpoint to trigger (note because the
- kernel disabled the data memory break bit for one instruction no trap
- will be taken!). GDB will then determines the appropriate action to
- take. (this may include restarting the inferior if the watchpoint
- fired because of a write to an address on the same page as a watchpoint,
- but no write to the watched address occured). */
-
-#define TARGET_HAS_HARDWARE_WATCHPOINTS /* Enable the code in procfs.c */
-
-/* The PA can watch any number of locations, there's no need for it to reject
- anything (generic routines already check that all intermediates are
- in memory). */
-#define TARGET_CAN_USE_HARDWARE_WATCHPOINT(type, cnt, ot) \
- ((type) == bp_hardware_watchpoint)
-
-/* When a hardware watchpoint fires off the PC will be left at the
- instruction which caused the watchpoint. It will be necessary for
- GDB to step over the watchpoint.
-
- On a PA running BSD, it is trivial to identify when it will be
- necessary to step over a hardware watchpoint as we can examine
- the PSW-X bit. If the bit is on, then we trapped because of a
- watchpoint, else we trapped for some other reason. */
-#define STOPPED_BY_WATCHPOINT(W) \
- ((W).kind == TARGET_WAITKIND_STOPPED \
- && (W).value.sig == TARGET_SIGNAL_TRAP \
- && ((int) read_register (IPSW_REGNUM) & 0x00100000))
-
-/* The PA can single step over a watchpoint if the kernel has set the
- "X" bit in the processor status word (disable data memory breakpoint
- for one instruction).
-
- The kernel will always set this bit before notifying the inferior
- that it hit a watchpoint. Thus, the inferior can single step over
- the instruction which caused the watchpoint to fire. This avoids
- the traditional need to disable the watchpoint, step the inferior,
- then enable the watchpoint again. */
-#define HAVE_STEPPABLE_WATCHPOINT
-
-/* Use these macros for watchpoint insertion/deletion. */
-/* type can be 0: write watch, 1: read watch, 2: access watch (read/write) */
-#define target_insert_watchpoint(addr, len, type) hppa_set_watchpoint (addr, len, 1)
-#define target_remove_watchpoint(addr, len, type) hppa_set_watchpoint (addr, len, 0)
+// OBSOLETE /* HPPA PA-RISC machine native support for BSD, for GDB.
+// OBSOLETE Copyright 1991, 1992, 1993, 1994, 1995, 2002 Free Software Foundation, Inc.
+// OBSOLETE
+// OBSOLETE This file is part of GDB.
+// OBSOLETE
+// OBSOLETE This program is free software; you can redistribute it and/or modify
+// OBSOLETE it under the terms of the GNU General Public License as published by
+// OBSOLETE the Free Software Foundation; either version 2 of the License, or
+// OBSOLETE (at your option) any later version.
+// OBSOLETE
+// OBSOLETE This program is distributed in the hope that it will be useful,
+// OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of
+// OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// OBSOLETE GNU General Public License for more details.
+// OBSOLETE
+// OBSOLETE You should have received a copy of the GNU General Public License
+// OBSOLETE along with this program; if not, write to the Free Software
+// OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330,
+// OBSOLETE Boston, MA 02111-1307, USA. */
+// OBSOLETE
+// OBSOLETE #include "somsolib.h"
+// OBSOLETE #include "regcache.h"
+// OBSOLETE
+// OBSOLETE #define U_REGS_OFFSET 0
+// OBSOLETE
+// OBSOLETE #define KERNEL_U_ADDR 0
+// OBSOLETE
+// OBSOLETE /* What a coincidence! */
+// OBSOLETE #define REGISTER_U_ADDR(addr, blockend, regno) \
+// OBSOLETE { addr = (int)(blockend) + REGISTER_BYTE (regno);}
+// OBSOLETE
+// OBSOLETE /* 3rd argument to ptrace is supposed to be a caddr_t. */
+// OBSOLETE
+// OBSOLETE #define PTRACE_ARG3_TYPE caddr_t
+// OBSOLETE
+// OBSOLETE /* HPUX 8.0, in its infinite wisdom, has chosen to prototype ptrace
+// OBSOLETE with five arguments, so programs written for normal ptrace lose. */
+// OBSOLETE #define FIVE_ARG_PTRACE
+// OBSOLETE
+// OBSOLETE
+// OBSOLETE /* fetch_inferior_registers is in hppab-nat.c. */
+// OBSOLETE #define FETCH_INFERIOR_REGISTERS
+// OBSOLETE
+// OBSOLETE /* attach/detach works to some extent under BSD and HPUX. So long
+// OBSOLETE as the process you're attaching to isn't blocked waiting on io,
+// OBSOLETE blocked waiting on a signal, or in a system call things work
+// OBSOLETE fine. (The problems in those cases are related to the fact that
+// OBSOLETE the kernel can't provide complete register information for the
+// OBSOLETE target process... Which really pisses off GDB.) */
+// OBSOLETE
+// OBSOLETE #define ATTACH_DETACH
+// OBSOLETE
+// OBSOLETE /* The PA-BSD kernel has support for using the data memory break bit
+// OBSOLETE to implement fast watchpoints.
+// OBSOLETE
+// OBSOLETE Watchpoints on the PA act much like traditional page protection
+// OBSOLETE schemes, but with some notable differences.
+// OBSOLETE
+// OBSOLETE First, a special bit in the page table entry is used to cause
+// OBSOLETE a trap when a specific page is written to. This avoids having
+// OBSOLETE to overload watchpoints on the page protection bits. This makes
+// OBSOLETE it possible for the kernel to easily decide if a trap was caused
+// OBSOLETE by a watchpoint or by the user writing to protected memory and can
+// OBSOLETE signal the user program differently in each case.
+// OBSOLETE
+// OBSOLETE Second, the PA has a bit in the processor status word which causes
+// OBSOLETE data memory breakpoints (aka watchpoints) to be disabled for a single
+// OBSOLETE instruction. This bit can be used to avoid the overhead of unprotecting
+// OBSOLETE and reprotecting pages when it becomes necessary to step over a watchpoint.
+// OBSOLETE
+// OBSOLETE
+// OBSOLETE When the kernel receives a trap indicating a write to a page which
+// OBSOLETE is being watched, the kernel performs a couple of simple actions. First
+// OBSOLETE is sets the magic "disable memory breakpoint" bit in the processor
+// OBSOLETE status word, it then sends a SIGTRAP to the process which caused the
+// OBSOLETE trap.
+// OBSOLETE
+// OBSOLETE GDB will take control and catch the signal for the inferior. GDB then
+// OBSOLETE examines the PSW-X bit to determine if the SIGTRAP was caused by a
+// OBSOLETE watchpoint firing. If so GDB single steps the inferior over the
+// OBSOLETE instruction which caused the watchpoint to trigger (note because the
+// OBSOLETE kernel disabled the data memory break bit for one instruction no trap
+// OBSOLETE will be taken!). GDB will then determines the appropriate action to
+// OBSOLETE take. (this may include restarting the inferior if the watchpoint
+// OBSOLETE fired because of a write to an address on the same page as a watchpoint,
+// OBSOLETE but no write to the watched address occured). */
+// OBSOLETE
+// OBSOLETE #define TARGET_HAS_HARDWARE_WATCHPOINTS /* Enable the code in procfs.c */
+// OBSOLETE
+// OBSOLETE /* The PA can watch any number of locations, there's no need for it to reject
+// OBSOLETE anything (generic routines already check that all intermediates are
+// OBSOLETE in memory). */
+// OBSOLETE #define TARGET_CAN_USE_HARDWARE_WATCHPOINT(type, cnt, ot) \
+// OBSOLETE ((type) == bp_hardware_watchpoint)
+// OBSOLETE
+// OBSOLETE /* When a hardware watchpoint fires off the PC will be left at the
+// OBSOLETE instruction which caused the watchpoint. It will be necessary for
+// OBSOLETE GDB to step over the watchpoint.
+// OBSOLETE
+// OBSOLETE On a PA running BSD, it is trivial to identify when it will be
+// OBSOLETE necessary to step over a hardware watchpoint as we can examine
+// OBSOLETE the PSW-X bit. If the bit is on, then we trapped because of a
+// OBSOLETE watchpoint, else we trapped for some other reason. */
+// OBSOLETE #define STOPPED_BY_WATCHPOINT(W) \
+// OBSOLETE ((W).kind == TARGET_WAITKIND_STOPPED \
+// OBSOLETE && (W).value.sig == TARGET_SIGNAL_TRAP \
+// OBSOLETE && ((int) read_register (IPSW_REGNUM) & 0x00100000))
+// OBSOLETE
+// OBSOLETE /* The PA can single step over a watchpoint if the kernel has set the
+// OBSOLETE "X" bit in the processor status word (disable data memory breakpoint
+// OBSOLETE for one instruction).
+// OBSOLETE
+// OBSOLETE The kernel will always set this bit before notifying the inferior
+// OBSOLETE that it hit a watchpoint. Thus, the inferior can single step over
+// OBSOLETE the instruction which caused the watchpoint to fire. This avoids
+// OBSOLETE the traditional need to disable the watchpoint, step the inferior,
+// OBSOLETE then enable the watchpoint again. */
+// OBSOLETE #define HAVE_STEPPABLE_WATCHPOINT
+// OBSOLETE
+// OBSOLETE /* Use these macros for watchpoint insertion/deletion. */
+// OBSOLETE /* type can be 0: write watch, 1: read watch, 2: access watch (read/write) */
+// OBSOLETE #define target_insert_watchpoint(addr, len, type) hppa_set_watchpoint (addr, len, 1)
+// OBSOLETE #define target_remove_watchpoint(addr, len, type) hppa_set_watchpoint (addr, len, 0)
diff --git a/gdb/config/pa/nm-hppah.h b/gdb/config/pa/nm-hppah.h
index 8387115..2cc1e30 100644
--- a/gdb/config/pa/nm-hppah.h
+++ b/gdb/config/pa/nm-hppah.h
@@ -117,6 +117,7 @@ extern int hppa_require_detach (int, int);
/* The PA can watch any number of locations (generic routines already check
that all intermediates are in watchable memory locations). */
+extern int hppa_can_use_hw_watchpoint (int type, int cnt, int ot);
#define TARGET_CAN_USE_HARDWARE_WATCHPOINT(type, cnt, ot) \
hppa_can_use_hw_watchpoint(type, cnt, ot)
@@ -198,9 +199,13 @@ extern void hppa_enable_page_protection_events (int);
extern void hppa_disable_page_protection_events (int);
/* Use these macros for watchpoint insertion/deletion. */
+extern int hppa_insert_hw_watchpoint (int pid, CORE_ADDR start, LONGEST len,
+ int type);
#define target_insert_watchpoint(addr, len, type) \
hppa_insert_hw_watchpoint (PIDGET (inferior_ptid), addr, (LONGEST)(len), type)
+extern int hppa_remove_hw_watchpoint (int pid, CORE_ADDR start, LONGEST len,
+ int type);
#define target_remove_watchpoint(addr, len, type) \
hppa_remove_hw_watchpoint (PIDGET (inferior_ptid), addr, (LONGEST)(len), type)
@@ -265,3 +270,5 @@ extern int hppa_resume_execd_vforking_child_to_get_parent_vfork (void);
#define MAY_FOLLOW_EXEC (1)
#define USE_THREAD_STEP_NEEDED (1)
+
+#include "infttrace.h" /* For parent_attach_all. */
diff --git a/gdb/config/pa/nm-hppao.h b/gdb/config/pa/nm-hppao.h
index 6389b2c..0a6b810 100644
--- a/gdb/config/pa/nm-hppao.h
+++ b/gdb/config/pa/nm-hppao.h
@@ -1,43 +1,43 @@
-/* HPPA PA-RISC machine native support for Lites, for GDB.
- Copyright 1995, 2002 Free Software Foundation, Inc.
-
- This file is part of GDB.
-
- 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.
-
- 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.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-
-#include "config/nm-m3.h"
-#define U_REGS_OFFSET 0
-
-#define KERNEL_U_ADDR 0
-
-/* What a coincidence! */
-#define REGISTER_U_ADDR(addr, blockend, regno) \
-{ addr = (int)(blockend) + REGISTER_BYTE (regno);}
-
-/* fetch_inferior_registers is in hppab-nat.c. */
-#define FETCH_INFERIOR_REGISTERS
-
-/* attach/detach works to some extent under BSD and HPUX. So long
- as the process you're attaching to isn't blocked waiting on io,
- blocked waiting on a signal, or in a system call things work
- fine. (The problems in those cases are related to the fact that
- the kernel can't provide complete register information for the
- target process... Which really pisses off GDB.) */
-
-#define ATTACH_DETACH
-
-#define EMULATOR_BASE 0x90100000
-#define EMULATOR_END 0x90200000
+// OBSOLETE /* HPPA PA-RISC machine native support for Lites, for GDB.
+// OBSOLETE Copyright 1995, 2002 Free Software Foundation, Inc.
+// OBSOLETE
+// OBSOLETE This file is part of GDB.
+// OBSOLETE
+// OBSOLETE This program is free software; you can redistribute it and/or modify
+// OBSOLETE it under the terms of the GNU General Public License as published by
+// OBSOLETE the Free Software Foundation; either version 2 of the License, or
+// OBSOLETE (at your option) any later version.
+// OBSOLETE
+// OBSOLETE This program is distributed in the hope that it will be useful,
+// OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of
+// OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// OBSOLETE GNU General Public License for more details.
+// OBSOLETE
+// OBSOLETE You should have received a copy of the GNU General Public License
+// OBSOLETE along with this program; if not, write to the Free Software
+// OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330,
+// OBSOLETE Boston, MA 02111-1307, USA. */
+// OBSOLETE
+// OBSOLETE #include "config/nm-m3.h"
+// OBSOLETE #define U_REGS_OFFSET 0
+// OBSOLETE
+// OBSOLETE #define KERNEL_U_ADDR 0
+// OBSOLETE
+// OBSOLETE /* What a coincidence! */
+// OBSOLETE #define REGISTER_U_ADDR(addr, blockend, regno) \
+// OBSOLETE { addr = (int)(blockend) + REGISTER_BYTE (regno);}
+// OBSOLETE
+// OBSOLETE /* fetch_inferior_registers is in hppab-nat.c. */
+// OBSOLETE #define FETCH_INFERIOR_REGISTERS
+// OBSOLETE
+// OBSOLETE /* attach/detach works to some extent under BSD and HPUX. So long
+// OBSOLETE as the process you're attaching to isn't blocked waiting on io,
+// OBSOLETE blocked waiting on a signal, or in a system call things work
+// OBSOLETE fine. (The problems in those cases are related to the fact that
+// OBSOLETE the kernel can't provide complete register information for the
+// OBSOLETE target process... Which really pisses off GDB.) */
+// OBSOLETE
+// OBSOLETE #define ATTACH_DETACH
+// OBSOLETE
+// OBSOLETE #define EMULATOR_BASE 0x90100000
+// OBSOLETE #define EMULATOR_END 0x90200000
diff --git a/gdb/config/pa/tm-hppa.h b/gdb/config/pa/tm-hppa.h
index dc23a63..c0b3e26 100644
--- a/gdb/config/pa/tm-hppa.h
+++ b/gdb/config/pa/tm-hppa.h
@@ -24,6 +24,9 @@
#include "regcache.h"
+/* Wonder if this is correct? Should be using push_dummy_call(). */
+#define DEPRECATED_DUMMY_WRITE_SP(SP) generic_target_write_sp (SP)
+
#define GDB_MULTI_ARCH 0
/* NOTE: cagney/2002-11-24: This is a guess. */
@@ -101,8 +104,8 @@ extern int hppa_in_solib_return_trampoline (CORE_ADDR, char *);
#endif
#if !GDB_MULTI_ARCH
-#undef SAVED_PC_AFTER_CALL
-#define SAVED_PC_AFTER_CALL(frame) hppa_saved_pc_after_call (frame)
+#undef DEPRECATED_SAVED_PC_AFTER_CALL
+#define DEPRECATED_SAVED_PC_AFTER_CALL(frame) hppa_saved_pc_after_call (frame)
extern CORE_ADDR hppa_saved_pc_after_call (struct frame_info *);
#endif
@@ -116,10 +119,6 @@ extern CORE_ADDR hppa_stack_align (CORE_ADDR sp);
#define STACK_ALIGN(sp) hppa_stack_align (sp)
#endif
-#if !GDB_MULTI_ARCH
-#define EXTRA_STACK_ALIGNMENT_NEEDED 0
-#endif
-
/* Sequence of bytes for breakpoint instruction. */
#define BREAKPOINT {0x00, 0x01, 0x00, 0x04}
@@ -390,21 +389,21 @@ extern void hppa_init_extra_frame_info (int, struct frame_info *);
/* Describe the pointer in each stack frame to the previous stack frame
(its caller). */
-/* FRAME_CHAIN takes a frame's nominal address and produces the
- frame's chain-pointer. */
+/* DEPRECATED_FRAME_CHAIN takes a frame's nominal address and produces
+ the frame's chain-pointer. */
/* In the case of the PA-RISC, the frame's nominal address
is the address of a 4-byte word containing the calling frame's
address (previous FP). */
#if !GDB_MULTI_ARCH
-#define FRAME_CHAIN(thisframe) hppa_frame_chain (thisframe)
+#define DEPRECATED_FRAME_CHAIN(thisframe) hppa_frame_chain (thisframe)
extern CORE_ADDR hppa_frame_chain (struct frame_info *);
#endif
#if !GDB_MULTI_ARCH
extern int hppa_frame_chain_valid (CORE_ADDR, struct frame_info *);
-#define FRAME_CHAIN_VALID(chain, thisframe) hppa_frame_chain_valid (chain, thisframe)
+#define DEPRECATED_FRAME_CHAIN_VALID(chain, thisframe) hppa_frame_chain_valid (chain, thisframe)
#endif
/* Define other aspects of the stack frame. */
@@ -420,7 +419,7 @@ extern int hppa_frameless_function_invocation (struct frame_info *);
#if !GDB_MULTI_ARCH
extern CORE_ADDR hppa_frame_saved_pc (struct frame_info *frame);
-#define FRAME_SAVED_PC(FRAME) hppa_frame_saved_pc (FRAME)
+#define DEPRECATED_FRAME_SAVED_PC(FRAME) hppa_frame_saved_pc (FRAME)
#endif
#if !GDB_MULTI_ARCH
@@ -442,28 +441,21 @@ extern int hppa_frame_num_args (struct frame_info *frame);
#define FRAME_ARGS_SKIP 0
#endif
-#define FRAME_FIND_SAVED_REGS(frame_info, frame_saved_regs) \
- hppa_frame_find_saved_regs (frame_info, &frame_saved_regs)
-extern void hppa_frame_find_saved_regs (struct frame_info *,
- struct frame_saved_regs *);
-
+extern void hppa_frame_init_saved_regs (struct frame_info *);
+#define DEPRECATED_FRAME_INIT_SAVED_REGS(FI) \
+ hppa_frame_init_saved_regs (FI)
/* Things needed for making the inferior call functions. */
-/* Push an empty stack frame, to record the current PC, etc. */
-
-/* FIXME: brobecker 2002-12-26. This macro definition takes advantage
- of the fact that DEPRECATED_PUSH_DUMMY_FRAME is called within a
- function where a variable inf_status of type struct inferior_status
- * is defined. Ugh! Until this is fixed, we will not be able to
- move to multiarch partial. */
-#define DEPRECATED_PUSH_DUMMY_FRAME hppa_push_dummy_frame (inf_status)
-extern void hppa_push_dummy_frame (struct inferior_status *);
+#if !GDB_MULTI_ARCH
+#define DEPRECATED_PUSH_DUMMY_FRAME hppa_push_dummy_frame ()
+extern void hppa_push_dummy_frame (void);
+#endif
/* Discard from the stack the innermost frame,
restoring all saved registers. */
#if !GDB_MULTI_ARCH
-#define POP_FRAME hppa_pop_frame ()
+#define DEPRECATED_POP_FRAME hppa_pop_frame ()
extern void hppa_pop_frame (void);
#endif
@@ -623,7 +615,7 @@ extern CORE_ADDR hppa_fix_call_dummy (char *, CORE_ADDR, CORE_ADDR, int,
struct value **, struct type *, int);
#if !GDB_MULTI_ARCH
-#define PUSH_ARGUMENTS(nargs, args, sp, struct_return, struct_addr) \
+#define DEPRECATED_PUSH_ARGUMENTS(nargs, args, sp, struct_return, struct_addr) \
(hppa_push_arguments((nargs), (args), (sp), (struct_return), (struct_addr)))
extern CORE_ADDR hppa_push_arguments (int, struct value **, CORE_ADDR, int,
CORE_ADDR);
diff --git a/gdb/config/pa/tm-hppa64.h b/gdb/config/pa/tm-hppa64.h
index e6177b0..503e426 100644
--- a/gdb/config/pa/tm-hppa64.h
+++ b/gdb/config/pa/tm-hppa64.h
@@ -122,20 +122,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define SR5_REGNUM 48
-#undef FRAME_ARGS_ADDRESS
-#define FRAME_ARGS_ADDRESS(fi) ((fi)->ap)
-
/* We access locals from SP. This may not work for frames which call
alloca; for those, we may need to consult unwind tables.
jimb: FIXME. */
#undef FRAME_LOCALS_ADDRESS
#define FRAME_LOCALS_ADDRESS(fi) ((fi)->frame)
-#define INIT_FRAME_AP init_frame_ap
-
-#define EXTRA_FRAME_INFO \
- CORE_ADDR ap;
-
/* For a number of horrible reasons we may have to adjust the location
of variables on the stack. Ugh. jimb: why? */
#define HPREAD_ADJUST_STACK_ADDRESS(ADDR) hpread_adjust_stack_address(ADDR)
@@ -191,7 +183,6 @@ call_dummy
0xe820f0000fb110d3LL, 0x0001000400151820LL,\
0xe6c0000008000240LL}
-#define CALL_DUMMY_BREAKPOINT_OFFSET_P 1
#define CALL_DUMMY_BREAKPOINT_OFFSET 22 * 4
/* CALL_DUMMY_LENGTH is computed based on the size of a word on the target
@@ -321,11 +312,11 @@ call_dummy
for (i = 0; i < NUM_REGS; i++) \
{ \
if (i == SP_REGNUM) \
- (FSR)->regs[SP_REGNUM] = read_memory_integer (TMP1 + SP_REGNUM * 8, 8); \
+ (FSR)[SP_REGNUM] = read_memory_integer (TMP1 + SP_REGNUM * 8, 8); \
else if (i >= FP0_REGNUM) \
- (FSR)->regs[i] = TMP2 + (i - FP0_REGNUM) * 8; \
+ (FSR)[i] = TMP2 + (i - FP0_REGNUM) * 8; \
else \
- (FSR)->regs[i] = TMP1 + i * 8; \
+ (FSR)[i] = TMP1 + i * 8; \
} \
}
diff --git a/gdb/config/pa/tm-hppab.h b/gdb/config/pa/tm-hppab.h
index 1cd438d..edacdbf 100644
--- a/gdb/config/pa/tm-hppab.h
+++ b/gdb/config/pa/tm-hppab.h
@@ -1,47 +1,47 @@
-/* Parameters for execution on an HP PA-RISC machine running BSD, for GDB.
- Contributed by the Center for Software Science at the
- University of Utah (pa-gdb-bugs@cs.utah.edu). */
-
-/* For BSD:
-
- The signal context structure pointer is always saved at the base
- of the frame + 0x4.
-
- We get the PC & SP directly from the sigcontext structure itself.
- For other registers we have to dive in a little deeper:
-
- The hardware save state pointer is at offset 0x10 within the
- signal context structure.
-
- Within the hardware save state, registers are found in the same order
- as the register numbers in GDB. */
-
-#define FRAME_SAVED_PC_IN_SIGTRAMP(FRAME, TMP) \
-{ \
- *(TMP) = read_memory_integer ((FRAME)->frame + 0x4, 4); \
- *(TMP) = read_memory_integer (*(TMP) + 0x18, 4); \
-}
-
-#define FRAME_BASE_BEFORE_SIGTRAMP(FRAME, TMP) \
-{ \
- *(TMP) = read_memory_integer ((FRAME)->frame + 0x4, 4); \
- *(TMP) = read_memory_integer (*(TMP) + 0x8, 4); \
-}
-
-#define FRAME_FIND_SAVED_REGS_IN_SIGTRAMP(FRAME, FSR) \
-{ \
- int i; \
- CORE_ADDR TMP; \
- TMP = read_memory_integer ((FRAME)->frame + 0x4, 4); \
- TMP = read_memory_integer (TMP + 0x10, 4); \
- for (i = 0; i < NUM_REGS; i++) \
- { \
- if (i == SP_REGNUM) \
- (FSR)->regs[SP_REGNUM] = read_memory_integer (TMP + SP_REGNUM * 4, 4); \
- else \
- (FSR)->regs[i] = TMP + i * 4; \
- } \
-}
-
-/* It's mostly just the common stuff. */
-#include "pa/tm-hppa.h"
+// OBSOLETE /* Parameters for execution on an HP PA-RISC machine running BSD, for GDB.
+// OBSOLETE Contributed by the Center for Software Science at the
+// OBSOLETE University of Utah (pa-gdb-bugs@cs.utah.edu). */
+// OBSOLETE
+// OBSOLETE /* For BSD:
+// OBSOLETE
+// OBSOLETE The signal context structure pointer is always saved at the base
+// OBSOLETE of the frame + 0x4.
+// OBSOLETE
+// OBSOLETE We get the PC & SP directly from the sigcontext structure itself.
+// OBSOLETE For other registers we have to dive in a little deeper:
+// OBSOLETE
+// OBSOLETE The hardware save state pointer is at offset 0x10 within the
+// OBSOLETE signal context structure.
+// OBSOLETE
+// OBSOLETE Within the hardware save state, registers are found in the same order
+// OBSOLETE as the register numbers in GDB. */
+// OBSOLETE
+// OBSOLETE #define FRAME_SAVED_PC_IN_SIGTRAMP(FRAME, TMP) \
+// OBSOLETE { \
+// OBSOLETE *(TMP) = read_memory_integer ((FRAME)->frame + 0x4, 4); \
+// OBSOLETE *(TMP) = read_memory_integer (*(TMP) + 0x18, 4); \
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE #define FRAME_BASE_BEFORE_SIGTRAMP(FRAME, TMP) \
+// OBSOLETE { \
+// OBSOLETE *(TMP) = read_memory_integer ((FRAME)->frame + 0x4, 4); \
+// OBSOLETE *(TMP) = read_memory_integer (*(TMP) + 0x8, 4); \
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE #define FRAME_FIND_SAVED_REGS_IN_SIGTRAMP(FRAME, FSR) \
+// OBSOLETE { \
+// OBSOLETE int i; \
+// OBSOLETE CORE_ADDR TMP; \
+// OBSOLETE TMP = read_memory_integer ((FRAME)->frame + 0x4, 4); \
+// OBSOLETE TMP = read_memory_integer (TMP + 0x10, 4); \
+// OBSOLETE for (i = 0; i < NUM_REGS; i++) \
+// OBSOLETE { \
+// OBSOLETE if (i == SP_REGNUM) \
+// OBSOLETE (FSR)->regs[SP_REGNUM] = read_memory_integer (TMP + SP_REGNUM * 4, 4); \
+// OBSOLETE else \
+// OBSOLETE (FSR)->regs[i] = TMP + i * 4; \
+// OBSOLETE } \
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE /* It's mostly just the common stuff. */
+// OBSOLETE #include "pa/tm-hppa.h"
diff --git a/gdb/config/pa/tm-hppah.h b/gdb/config/pa/tm-hppah.h
index 4e68de9..070c83c 100644
--- a/gdb/config/pa/tm-hppah.h
+++ b/gdb/config/pa/tm-hppah.h
@@ -21,6 +21,8 @@
Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
+struct frame_info;
+
/* The solib hooks are not really designed to have a list of hook
and handler routines. So until we clean up those interfaces you
either get SOM shared libraries or HP's unusual PA64 ELF shared
@@ -46,9 +48,8 @@ extern void hppa_hpux_frame_base_before_sigtramp (struct frame_info *fi,
#define FRAME_BASE_BEFORE_SIGTRAMP(FRAME, TMP) \
hppa_hpux_frame_base_before_sigtramp (FRAME, TMP)
-struct frame_saved_regs;
extern void hppa_hpux_frame_find_saved_regs_in_sigtramp
- (struct frame_info *fi, struct frame_saved_regs *fsr);
+ (struct frame_info *fi, CORE_ADDR *fsr);
#define FRAME_FIND_SAVED_REGS_IN_SIGTRAMP(FRAME, FSR) \
hppa_hpux_frame_find_saved_regs_in_sigtramp (FRAME, FSR)
diff --git a/gdb/config/pa/tm-hppao.h b/gdb/config/pa/tm-hppao.h
index e6fae89..a466287 100644
--- a/gdb/config/pa/tm-hppao.h
+++ b/gdb/config/pa/tm-hppao.h
@@ -1,98 +1,98 @@
-/* Parameters for execution on an HP PA-RISC machine running OSF1, for GDB.
- Contributed by the Center for Software Science at the
- University of Utah (pa-gdb-bugs@cs.utah.edu). */
-
-#include "regcache.h"
-
-/* Define offsets to access CPROC stack when it does not have
- * a kernel thread.
- */
-#define MACHINE_CPROC_SP_OFFSET 20
-#define MACHINE_CPROC_PC_OFFSET 16
-#define MACHINE_CPROC_FP_OFFSET 12
-
-/*
- * Software defined PSW masks.
- */
-#define PSW_SS 0x10000000 /* Kernel managed single step */
-
-/* Thread flavors used in re-setting the T bit.
- * @@ this is also bad for cross debugging.
- */
-#define TRACE_FLAVOR HP800_THREAD_STATE
-#define TRACE_FLAVOR_SIZE HP800_THREAD_STATE_COUNT
-#define TRACE_SET(x,state) \
- ((struct hp800_thread_state *)state)->cr22 |= PSW_SS
-#define TRACE_CLEAR(x,state) \
- ((((struct hp800_thread_state *)state)->cr22 &= ~PSW_SS), 1)
-
-/* For OSF1 (Should be close if not identical to BSD, but I haven't
- tested it yet):
-
- The signal context structure pointer is always saved at the base
- of the frame + 0x4.
-
- We get the PC & SP directly from the sigcontext structure itself.
- For other registers we have to dive in a little deeper:
-
- The hardware save state pointer is at offset 0x10 within the
- signal context structure.
-
- Within the hardware save state, registers are found in the same order
- as the register numbers in GDB. */
-
-#define FRAME_SAVED_PC_IN_SIGTRAMP(FRAME, TMP) \
-{ \
- *(TMP) = read_memory_integer ((FRAME)->frame + 0x4, 4); \
- *(TMP) = read_memory_integer (*(TMP) + 0x18, 4); \
-}
-
-#define FRAME_BASE_BEFORE_SIGTRAMP(FRAME, TMP) \
-{ \
- *(TMP) = read_memory_integer ((FRAME)->frame + 0x4, 4); \
- *(TMP) = read_memory_integer (*(TMP) + 0x8, 4); \
-}
-
-#define FRAME_FIND_SAVED_REGS_IN_SIGTRAMP(FRAME, FSR) \
-{ \
- int i; \
- CORE_ADDR TMP; \
- TMP = read_memory_integer ((FRAME)->frame + 0x4, 4); \
- TMP = read_memory_integer (TMP + 0x10, 4); \
- for (i = 0; i < NUM_REGS; i++) \
- { \
- if (i == SP_REGNUM) \
- (FSR)->regs[SP_REGNUM] = read_memory_integer (TMP + SP_REGNUM * 4, 4); \
- else \
- (FSR)->regs[i] = TMP + i * 4; \
- } \
-}
-
-/* OSF1 does not need the pc space queue restored. */
-#define NO_PC_SPACE_QUEUE_RESTORE
-
-/* The mach kernel uses the recovery counter to implement single
- stepping. While this greatly simplifies the kernel support
- necessary for single stepping, it unfortunately does the wrong
- thing in the presense of a nullified instruction (gives control
- back two insns after the nullifed insn). This is an artifact
- of the HP architecture (recovery counter doesn't tick for
- nullified insns).
-
- Do our best to avoid losing in such situations. */
-#define INSTRUCTION_NULLIFIED \
-(({ \
- int ipsw = (int)read_register(IPSW_REGNUM); \
- if (ipsw & PSW_N) \
- { \
- int pcoqt = (int)read_register(PCOQ_TAIL_REGNUM); \
- write_register(PCOQ_HEAD_REGNUM, pcoqt); \
- write_register(PCOQ_TAIL_REGNUM, pcoqt + 0x4); \
- write_register(IPSW_REGNUM, ipsw & ~(PSW_N | PSW_B | PSW_X)); \
- stop_pc = pcoqt; \
- } \
- }), 0)
-
-/* It's mostly just the common stuff. */
-
-#include "pa/tm-hppa.h"
+// OBSOLETE /* Parameters for execution on an HP PA-RISC machine running OSF1, for GDB.
+// OBSOLETE Contributed by the Center for Software Science at the
+// OBSOLETE University of Utah (pa-gdb-bugs@cs.utah.edu). */
+// OBSOLETE
+// OBSOLETE #include "regcache.h"
+// OBSOLETE
+// OBSOLETE /* Define offsets to access CPROC stack when it does not have
+// OBSOLETE * a kernel thread.
+// OBSOLETE */
+// OBSOLETE #define MACHINE_CPROC_SP_OFFSET 20
+// OBSOLETE #define MACHINE_CPROC_PC_OFFSET 16
+// OBSOLETE #define MACHINE_CPROC_FP_OFFSET 12
+// OBSOLETE
+// OBSOLETE /*
+// OBSOLETE * Software defined PSW masks.
+// OBSOLETE */
+// OBSOLETE #define PSW_SS 0x10000000 /* Kernel managed single step */
+// OBSOLETE
+// OBSOLETE /* Thread flavors used in re-setting the T bit.
+// OBSOLETE * @@ this is also bad for cross debugging.
+// OBSOLETE */
+// OBSOLETE #define TRACE_FLAVOR HP800_THREAD_STATE
+// OBSOLETE #define TRACE_FLAVOR_SIZE HP800_THREAD_STATE_COUNT
+// OBSOLETE #define TRACE_SET(x,state) \
+// OBSOLETE ((struct hp800_thread_state *)state)->cr22 |= PSW_SS
+// OBSOLETE #define TRACE_CLEAR(x,state) \
+// OBSOLETE ((((struct hp800_thread_state *)state)->cr22 &= ~PSW_SS), 1)
+// OBSOLETE
+// OBSOLETE /* For OSF1 (Should be close if not identical to BSD, but I haven't
+// OBSOLETE tested it yet):
+// OBSOLETE
+// OBSOLETE The signal context structure pointer is always saved at the base
+// OBSOLETE of the frame + 0x4.
+// OBSOLETE
+// OBSOLETE We get the PC & SP directly from the sigcontext structure itself.
+// OBSOLETE For other registers we have to dive in a little deeper:
+// OBSOLETE
+// OBSOLETE The hardware save state pointer is at offset 0x10 within the
+// OBSOLETE signal context structure.
+// OBSOLETE
+// OBSOLETE Within the hardware save state, registers are found in the same order
+// OBSOLETE as the register numbers in GDB. */
+// OBSOLETE
+// OBSOLETE #define FRAME_SAVED_PC_IN_SIGTRAMP(FRAME, TMP) \
+// OBSOLETE { \
+// OBSOLETE *(TMP) = read_memory_integer ((FRAME)->frame + 0x4, 4); \
+// OBSOLETE *(TMP) = read_memory_integer (*(TMP) + 0x18, 4); \
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE #define FRAME_BASE_BEFORE_SIGTRAMP(FRAME, TMP) \
+// OBSOLETE { \
+// OBSOLETE *(TMP) = read_memory_integer ((FRAME)->frame + 0x4, 4); \
+// OBSOLETE *(TMP) = read_memory_integer (*(TMP) + 0x8, 4); \
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE #define FRAME_FIND_SAVED_REGS_IN_SIGTRAMP(FRAME, FSR) \
+// OBSOLETE { \
+// OBSOLETE int i; \
+// OBSOLETE CORE_ADDR TMP; \
+// OBSOLETE TMP = read_memory_integer ((FRAME)->frame + 0x4, 4); \
+// OBSOLETE TMP = read_memory_integer (TMP + 0x10, 4); \
+// OBSOLETE for (i = 0; i < NUM_REGS; i++) \
+// OBSOLETE { \
+// OBSOLETE if (i == SP_REGNUM) \
+// OBSOLETE (FSR)->regs[SP_REGNUM] = read_memory_integer (TMP + SP_REGNUM * 4, 4); \
+// OBSOLETE else \
+// OBSOLETE (FSR)->regs[i] = TMP + i * 4; \
+// OBSOLETE } \
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE /* OSF1 does not need the pc space queue restored. */
+// OBSOLETE #define NO_PC_SPACE_QUEUE_RESTORE
+// OBSOLETE
+// OBSOLETE /* The mach kernel uses the recovery counter to implement single
+// OBSOLETE stepping. While this greatly simplifies the kernel support
+// OBSOLETE necessary for single stepping, it unfortunately does the wrong
+// OBSOLETE thing in the presense of a nullified instruction (gives control
+// OBSOLETE back two insns after the nullifed insn). This is an artifact
+// OBSOLETE of the HP architecture (recovery counter doesn't tick for
+// OBSOLETE nullified insns).
+// OBSOLETE
+// OBSOLETE Do our best to avoid losing in such situations. */
+// OBSOLETE #define INSTRUCTION_NULLIFIED \
+// OBSOLETE (({ \
+// OBSOLETE int ipsw = (int)read_register(IPSW_REGNUM); \
+// OBSOLETE if (ipsw & PSW_N) \
+// OBSOLETE { \
+// OBSOLETE int pcoqt = (int)read_register(PCOQ_TAIL_REGNUM); \
+// OBSOLETE write_register(PCOQ_HEAD_REGNUM, pcoqt); \
+// OBSOLETE write_register(PCOQ_TAIL_REGNUM, pcoqt + 0x4); \
+// OBSOLETE write_register(IPSW_REGNUM, ipsw & ~(PSW_N | PSW_B | PSW_X)); \
+// OBSOLETE stop_pc = pcoqt; \
+// OBSOLETE } \
+// OBSOLETE }), 0)
+// OBSOLETE
+// OBSOLETE /* It's mostly just the common stuff. */
+// OBSOLETE
+// OBSOLETE #include "pa/tm-hppa.h"
diff --git a/gdb/config/pa/tm-pro.h b/gdb/config/pa/tm-pro.h
index 05ecb62..c4f2b77 100644
--- a/gdb/config/pa/tm-pro.h
+++ b/gdb/config/pa/tm-pro.h
@@ -1,14 +1,14 @@
-/* Parameters for execution on an HP PA-RISC level 0 embedded system.
- This is based on tm-hppab.h.
- Contributed by the Center for Software Science at the
- University of Utah (pa-gdb-bugs@cs.utah.edu). */
-
-#define PA_LEVEL_0 /* Disables touching space regs and fp */
-
-/* All the PRO targets use software floating point at the moment. */
-#define SOFT_FLOAT 1
-
-/* It's mostly just the common stuff. */
-#include "pa/tm-hppa.h"
-
-#define GDB_TARGET_IS_PA_ELF
+// OBSOLETE /* Parameters for execution on an HP PA-RISC level 0 embedded system.
+// OBSOLETE This is based on tm-hppab.h.
+// OBSOLETE Contributed by the Center for Software Science at the
+// OBSOLETE University of Utah (pa-gdb-bugs@cs.utah.edu). */
+// OBSOLETE
+// OBSOLETE #define PA_LEVEL_0 /* Disables touching space regs and fp */
+// OBSOLETE
+// OBSOLETE /* All the PRO targets use software floating point at the moment. */
+// OBSOLETE #define SOFT_FLOAT 1
+// OBSOLETE
+// OBSOLETE /* It's mostly just the common stuff. */
+// OBSOLETE #include "pa/tm-hppa.h"
+// OBSOLETE
+// OBSOLETE #define GDB_TARGET_IS_PA_ELF
diff --git a/gdb/config/pa/xm-hppab.h b/gdb/config/pa/xm-hppab.h
index d2561df..d46e5ad 100644
--- a/gdb/config/pa/xm-hppab.h
+++ b/gdb/config/pa/xm-hppab.h
@@ -1,24 +1,24 @@
-/* Parameters for hosting on an HPPA PA-RISC machine, running BSD, for GDB.
- Copyright 1991, 1992, 1993, 1996, 1998 Free Software Foundation, Inc.
-
- Contributed by the Center for Software Science at the
- University of Utah (pa-gdb-bugs@cs.utah.edu).
-
- This file is part of GDB.
-
- 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.
-
- 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.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-
-#include "pa/xm-pa.h"
+// OBSOLETE /* Parameters for hosting on an HPPA PA-RISC machine, running BSD, for GDB.
+// OBSOLETE Copyright 1991, 1992, 1993, 1996, 1998 Free Software Foundation, Inc.
+// OBSOLETE
+// OBSOLETE Contributed by the Center for Software Science at the
+// OBSOLETE University of Utah (pa-gdb-bugs@cs.utah.edu).
+// OBSOLETE
+// OBSOLETE This file is part of GDB.
+// OBSOLETE
+// OBSOLETE This program is free software; you can redistribute it and/or modify
+// OBSOLETE it under the terms of the GNU General Public License as published by
+// OBSOLETE the Free Software Foundation; either version 2 of the License, or
+// OBSOLETE (at your option) any later version.
+// OBSOLETE
+// OBSOLETE This program is distributed in the hope that it will be useful,
+// OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of
+// OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// OBSOLETE GNU General Public License for more details.
+// OBSOLETE
+// OBSOLETE You should have received a copy of the GNU General Public License
+// OBSOLETE along with this program; if not, write to the Free Software
+// OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330,
+// OBSOLETE Boston, MA 02111-1307, USA. */
+// OBSOLETE
+// OBSOLETE #include "pa/xm-pa.h"
diff --git a/gdb/config/pa/xm-hppah.h b/gdb/config/pa/xm-hppah.h
index b1c26dd..a2ed9ba 100644
--- a/gdb/config/pa/xm-hppah.h
+++ b/gdb/config/pa/xm-hppah.h
@@ -22,8 +22,6 @@
Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-#include "pa/xm-pa.h"
-
#define USG
#define HAVE_TERMIOS
diff --git a/gdb/config/pa/xm-pa.h b/gdb/config/pa/xm-pa.h
index 979609d..0095003 100644
--- a/gdb/config/pa/xm-pa.h
+++ b/gdb/config/pa/xm-pa.h
@@ -1,5 +1,5 @@
-/* Definitions for all PA machines. */
-
-/* This was created for "makeva", which is obsolete. This file can
- probably go away (unless someone can think of some other host thing
- which is common to various pa machines). */
+// OBSOLETE /* Definitions for all PA machines. */
+// OBSOLETE
+// OBSOLETE /* This was created for "makeva", which is obsolete. This file can
+// OBSOLETE probably go away (unless someone can think of some other host thing
+// OBSOLETE which is common to various pa machines). */
diff --git a/gdb/config/rs6000/tm-rs6000.h b/gdb/config/rs6000/tm-rs6000.h
index 1bdd9eb..c736589 100644
--- a/gdb/config/rs6000/tm-rs6000.h
+++ b/gdb/config/rs6000/tm-rs6000.h
@@ -21,6 +21,8 @@
Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
+struct frame_info;
+
#define GDB_MULTI_ARCH 1
/* Minimum possible text address in AIX */
@@ -79,8 +81,8 @@ extern void aix_process_linenos (void);
/* Define other aspects of the stack frame. */
#define DEPRECATED_INIT_FRAME_PC_FIRST(fromleaf, prev) \
- (fromleaf ? SAVED_PC_AFTER_CALL (prev->next) : \
- prev->next ? FRAME_SAVED_PC (prev->next) : read_pc ())
+ (fromleaf ? DEPRECATED_SAVED_PC_AFTER_CALL (prev->next) : \
+ prev->next ? DEPRECATED_FRAME_SAVED_PC (prev->next) : read_pc ())
/* NOTE: cagney/2002-12-08: Add local declaration of
init_frame_pc_noop() because it isn't possible to include
"arch-utils.h" here. Not too bad as this entire file is going away
diff --git a/gdb/config/sparc/sparclet.mt b/gdb/config/sparc/sparclet.mt
index f08cfd7..5dde41b 100644
--- a/gdb/config/sparc/sparclet.mt
+++ b/gdb/config/sparc/sparclet.mt
@@ -1,3 +1,3 @@
-# Target: SPARC embedded Sparclet monitor
-TDEPFILES= sparc-tdep.o monitor.o sparclet-rom.o dsrec.o
-TM_FILE= tm-sparclet.h
+# OBSOLETE # Target: SPARC embedded Sparclet monitor
+# OBSOLETE TDEPFILES= sparc-tdep.o monitor.o sparclet-rom.o dsrec.o
+# OBSOLETE TM_FILE= tm-sparclet.h
diff --git a/gdb/config/sparc/sparclite.mt b/gdb/config/sparc/sparclite.mt
index 43cb38c..7ae1008 100644
--- a/gdb/config/sparc/sparclite.mt
+++ b/gdb/config/sparc/sparclite.mt
@@ -1,5 +1,5 @@
-# Target: Fujitsu SPARClite processor
-TDEPFILES= sparc-tdep.o sparcl-tdep.o
-TM_FILE= tm-sparclite.h
-SIM_OBS = remote-sim.o
-SIM = ../sim/erc32/libsim.a
+# OBSOLETE # Target: Fujitsu SPARClite processor
+# OBSOLETE TDEPFILES= sparc-tdep.o sparcl-tdep.o
+# OBSOLETE TM_FILE= tm-sparclite.h
+# OBSOLETE SIM_OBS = remote-sim.o
+# OBSOLETE SIM = ../sim/erc32/libsim.a
diff --git a/gdb/config/sparc/tm-sp64.h b/gdb/config/sparc/tm-sp64.h
index 691e38f..2d2193d 100644
--- a/gdb/config/sparc/tm-sp64.h
+++ b/gdb/config/sparc/tm-sp64.h
@@ -23,6 +23,8 @@
Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
+struct type;
+
#define GDB_MULTI_ARCH GDB_MULTI_ARCH_PARTIAL
#ifndef GDB_TARGET_IS_SPARC64
@@ -96,22 +98,20 @@
#define CALL_DUMMY_START_OFFSET 0
#undef CALL_DUMMY_BREAKPOINT_OFFSET
#define CALL_DUMMY_BREAKPOINT_OFFSET 0
-#undef CALL_DUMMY_BREAKPOINT_OFFSET_P
-#define CALL_DUMMY_BREAKPOINT_OFFSET_P 1
#undef CALL_DUMMY_LOCATION
#define CALL_DUMMY_LOCATION AT_ENTRY_POINT
#undef DEPRECATED_PC_IN_CALL_DUMMY
#define DEPRECATED_PC_IN_CALL_DUMMY(pc, sp, frame_address) deprecated_pc_in_call_dummy_at_entry_point (pc, sp, frame_address)
-#undef CALL_DUMMY_STACK_ADJUST
-#define CALL_DUMMY_STACK_ADJUST 128
+#undef DEPRECATED_CALL_DUMMY_STACK_ADJUST
+#define DEPRECATED_CALL_DUMMY_STACK_ADJUST 128
#undef SIZEOF_CALL_DUMMY_WORDS
#define SIZEOF_CALL_DUMMY_WORDS 0
#undef CALL_DUMMY_ADDRESS
#define CALL_DUMMY_ADDRESS() entry_point_address()
#undef FIX_CALL_DUMMY
#define FIX_CALL_DUMMY(DUMMYNAME, PC, FUN, NARGS, ARGS, TYPE, GCC_P)
-#undef PUSH_RETURN_ADDRESS
-#define PUSH_RETURN_ADDRESS(PC, SP) sparc_at_entry_push_return_address (PC, SP)
+#undef DEPRECATED_PUSH_RETURN_ADDRESS
+#define DEPRECATED_PUSH_RETURN_ADDRESS(PC, SP) sparc_at_entry_push_return_address (PC, SP)
extern CORE_ADDR sparc_at_entry_push_return_address (CORE_ADDR pc,
CORE_ADDR sp);
@@ -143,8 +143,8 @@ extern void sparc_at_entry_store_struct_return (CORE_ADDR addr, CORE_ADDR sp);
/* 128 is to reserve space to write the %i/%l registers that will be restored
when we resume. */
-#undef CALL_DUMMY_STACK_ADJUST
-#define CALL_DUMMY_STACK_ADJUST 128
+#undef DEPRECATED_CALL_DUMMY_STACK_ADJUST
+#define DEPRECATED_CALL_DUMMY_STACK_ADJUST 128
/* Size of the call dummy in bytes. */
#undef CALL_DUMMY_LENGTH
@@ -162,10 +162,6 @@ extern void sparc_at_entry_store_struct_return (CORE_ADDR addr, CORE_ADDR sp);
#undef CALL_DUMMY_BREAKPOINT_OFFSET
#define CALL_DUMMY_BREAKPOINT_OFFSET (CALL_DUMMY_START_OFFSET + (8 * 4))
-/* Let's GDB know that it can make a call_dummy breakpoint. */
-#undef CALL_DUMMY_BREAKPOINT_OFFSET_P
-#define CALL_DUMMY_BREAKPOINT_OFFSET_P 1
-
/* Call dummy will be located on the stack. */
#undef CALL_DUMMY_LOCATION
#define CALL_DUMMY_LOCATION ON_STACK
@@ -182,7 +178,7 @@ void sparc_fix_call_dummy (char *dummy, CORE_ADDR pc, CORE_ADDR fun,
/* The remainder of these will accept the default definition. */
#undef SIZEOF_CALL_DUMMY_WORDS
-#undef PUSH_RETURN_ADDRESS
+#undef DEPRECATED_PUSH_RETURN_ADDRESS
#undef CALL_DUMMY_ADDRESS
#undef STORE_STRUCT_RETURN
@@ -208,8 +204,8 @@ void sparc_fix_call_dummy (char *dummy, CORE_ADDR pc, CORE_ADDR fun,
CORE_ADDR sparc64_push_arguments (int,
struct value **, CORE_ADDR, int, CORE_ADDR);
-#undef PUSH_ARGUMENTS
-#define PUSH_ARGUMENTS(A,B,C,D,E) \
+#undef DEPRECATED_PUSH_ARGUMENTS
+#define DEPRECATED_PUSH_ARGUMENTS(A,B,C,D,E) \
(sparc64_push_arguments ((A), (B), (C), (D), (E)))
/* Store the address of the place in which to copy the structure the
@@ -274,7 +270,7 @@ extern void sparc64_write_sp (CORE_ADDR);
#define TARGET_READ_SP() (sparc64_read_sp ())
#define TARGET_READ_FP() (sparc64_read_fp ())
-#define TARGET_WRITE_SP(X) (sparc64_write_sp (X))
+#define DEPRECATED_DUMMY_WRITE_SP(X) (sparc64_write_sp (X))
#undef DEPRECATED_EXTRACT_RETURN_VALUE
#define DEPRECATED_EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
diff --git a/gdb/config/sparc/tm-sparc.h b/gdb/config/sparc/tm-sparc.h
index 20d5b37..414b69e 100644
--- a/gdb/config/sparc/tm-sparc.h
+++ b/gdb/config/sparc/tm-sparc.h
@@ -199,10 +199,10 @@ extern int sparc_intreg_size (void);
stack rather than with the other registers, and this causes hair
and confusion in places like pop_frame. It might be better to
remove the ins and locals from `registers', make sure that
- get_saved_register can get them from the stack (even in the
- innermost frame), and make this the way to access them. For the
- frame pointer we would do that via TARGET_READ_FP. On the other
- hand, that is likely to be confusing or worse for flat frames. */
+ frame_register() can get them from the stack (even in the innermost
+ frame), and make this the way to access them. For the frame
+ pointer we would do that via TARGET_READ_FP. On the other hand,
+ that is likely to be confusing or worse for flat frames. */
#define REGISTER_BYTES (32*4+32*4+8*4)
@@ -258,7 +258,7 @@ extern CORE_ADDR sparc_skip_prologue (CORE_ADDR);
the new frame is not set up until the new function executes
some instructions. */
-#define SAVED_PC_AFTER_CALL(FRAME) PC_ADJUST (read_register (RP_REGNUM))
+#define DEPRECATED_SAVED_PC_AFTER_CALL(FRAME) PC_ADJUST (read_register (RP_REGNUM))
/* Stack grows downward. */
@@ -392,8 +392,8 @@ extern CORE_ADDR sparc_pc_adjust (CORE_ADDR);
#define CANNOT_STORE_REGISTER(regno) ((regno) == G0_REGNUM)
/*
- * FRAME_CHAIN and FRAME_INFO definitions, collected here for convenience.
- */
+ * DEPRECATED_FRAME_CHAIN and FRAME_INFO definitions, collected here
+ * for convenience. */
#if !defined (GDB_MULTI_ARCH) || (GDB_MULTI_ARCH == 0)
/*
@@ -403,58 +403,11 @@ extern CORE_ADDR sparc_pc_adjust (CORE_ADDR);
/* Describe the pointer in each stack frame to the previous stack frame
(its caller). */
-/* FRAME_CHAIN takes a frame's nominal address
- and produces the frame's chain-pointer. */
-
-/* In the case of the Sun 4, the frame-chain's nominal address
- is held in the frame pointer register.
-
- On the Sun4, the frame (in %fp) is %sp for the previous frame.
- From the previous frame's %sp, we can find the previous frame's
- %fp: it is in the save area just above the previous frame's %sp.
-
- If we are setting up an arbitrary frame, we'll need to know where
- it ends. Hence the following. This part of the frame cache
- structure should be checked before it is assumed that this frame's
- bottom is in the stack pointer.
-
- If there isn't a frame below this one, the bottom of this frame is
- in the stack pointer.
-
- If there is a frame below this one, and the frame pointers are
- identical, it's a leaf frame and the bottoms are the same also.
-
- Otherwise the bottom of this frame is the top of the next frame.
-
- The bottom field is misnamed, since it might imply that memory from
- bottom to frame contains this frame. That need not be true if
- stack frames are allocated in different segments (e.g. some on a
- stack, some on a heap in the data segment).
-
- GCC 2.6 and later can generate ``flat register window'' code that
- makes frames by explicitly saving those registers that need to be
- saved. %i7 is used as the frame pointer, and the frame is laid out
- so that flat and non-flat calls can be intermixed freely within a
- program. Unfortunately for GDB, this means it must detect and
- record the flatness of frames.
-
- Since the prologue in a flat frame also tells us where fp and pc
- have been stashed (the frame is of variable size, so their location
- is not fixed), it's convenient to record them in the frame info. */
-
-#define EXTRA_FRAME_INFO \
- CORE_ADDR bottom; \
- int in_prologue; \
- int flat; \
- /* Following fields only relevant for flat frames. */ \
- CORE_ADDR pc_addr; \
- CORE_ADDR fp_addr; \
- /* Add this to ->frame to get the value of the stack pointer at the */ \
- /* time of the register saves. */ \
- int sp_offset;
+/* DEPRECATED_FRAME_CHAIN takes a frame's nominal address and produces
+ the frame's chain-pointer. */
-/* We need to override GET_SAVED_REGISTER so that we can deal with the
- way outs change into ins in different frames. */
+/* We need to override DEPRECATED_GET_SAVED_REGISTER so that we can
+ deal with the way outs change into ins in different frames. */
void sparc_get_saved_register (char *raw_buffer,
int *optimized,
@@ -462,7 +415,7 @@ void sparc_get_saved_register (char *raw_buffer,
struct frame_info *frame,
int regnum, enum lval_type *lvalp);
-#define GET_SAVED_REGISTER(RAW_BUFFER, OPTIMIZED, ADDRP, FRAME, REGNUM, LVAL) \
+#define DEPRECATED_GET_SAVED_REGISTER(RAW_BUFFER, OPTIMIZED, ADDRP, FRAME, REGNUM, LVAL) \
sparc_get_saved_register (RAW_BUFFER, OPTIMIZED, ADDRP, \
FRAME, REGNUM, LVAL)
@@ -472,7 +425,7 @@ void sparc_get_saved_register (char *raw_buffer,
sparc_init_extra_frame_info (FROMLEAF, FCI)
extern void sparc_init_extra_frame_info (int, struct frame_info *);
-#define FRAME_CHAIN(THISFRAME) (sparc_frame_chain (THISFRAME))
+#define DEPRECATED_FRAME_CHAIN(THISFRAME) (sparc_frame_chain (THISFRAME))
extern CORE_ADDR sparc_frame_chain (struct frame_info *);
/* A macro that tells us whether the function invocation represented
@@ -484,7 +437,7 @@ extern CORE_ADDR sparc_frame_chain (struct frame_info *);
/* Where is the PC for a specific frame */
-#define FRAME_SAVED_PC(FRAME) sparc_frame_saved_pc (FRAME)
+#define DEPRECATED_FRAME_SAVED_PC(FRAME) sparc_frame_saved_pc (FRAME)
extern CORE_ADDR sparc_frame_saved_pc (struct frame_info *);
/* If the argument is on the stack, it will be here. */
@@ -518,8 +471,8 @@ extern void sparc_print_extra_frame_info (struct frame_info *);
extern CORE_ADDR init_frame_pc_noop (int fromleaf, struct frame_info *prev);
#define DEPRECATED_INIT_FRAME_PC(FROMLEAF, PREV) (init_frame_pc_noop (FROMLEAF, PREV))
#define DEPRECATED_INIT_FRAME_PC_FIRST(FROMLEAF, PREV) \
- ((FROMLEAF) ? SAVED_PC_AFTER_CALL ((PREV)->next) : \
- (PREV)->next ? FRAME_SAVED_PC ((PREV)->next) : read_pc ())
+ ((FROMLEAF) ? DEPRECATED_SAVED_PC_AFTER_CALL ((PREV)->next) : \
+ (PREV)->next ? DEPRECATED_FRAME_SAVED_PC ((PREV)->next) : read_pc ())
/* Define other aspects of the stack frame. */
@@ -649,7 +602,7 @@ extern CORE_ADDR init_frame_pc_noop (int fromleaf, struct frame_info *prev);
#define CALL_DUMMY_BREAKPOINT_OFFSET (CALL_DUMMY_START_OFFSET + 0x30)
-#define CALL_DUMMY_STACK_ADJUST 68
+#define DEPRECATED_CALL_DUMMY_STACK_ADJUST 68
/* Call dummy method (eg. on stack, at entry point, etc.) */
@@ -683,12 +636,12 @@ void sparc_fix_call_dummy (char *dummy, CORE_ADDR pc, CORE_ADDR fun,
/* Push an empty stack frame, to record the current PC, etc. */
#define DEPRECATED_PUSH_DUMMY_FRAME sparc_push_dummy_frame ()
-#define POP_FRAME sparc_pop_frame ()
+#define DEPRECATED_POP_FRAME sparc_pop_frame ()
void sparc_push_dummy_frame (void);
void sparc_pop_frame (void);
-#define PUSH_ARGUMENTS(NARGS, ARGS, SP, STRUCT_RETURN, STRUCT_ADDR) \
+#define DEPRECATED_PUSH_ARGUMENTS(NARGS, ARGS, SP, STRUCT_RETURN, STRUCT_ADDR) \
sparc32_push_arguments (NARGS, ARGS, SP, STRUCT_RETURN, STRUCT_ADDR)
extern CORE_ADDR sparc32_push_arguments (int, struct value **, CORE_ADDR, int,
@@ -756,3 +709,4 @@ extern int deferred_stores;
#define TM_PRINT_INSN_MACH bfd_mach_sparc
+#define DEPRECATED_EXTRA_STACK_ALIGNMENT_NEEDED 1
diff --git a/gdb/config/sparc/tm-sparclet.h b/gdb/config/sparc/tm-sparclet.h
index 6aad71d..95bdeea 100644
--- a/gdb/config/sparc/tm-sparclet.h
+++ b/gdb/config/sparc/tm-sparclet.h
@@ -1,158 +1,158 @@
-/* Target machine definitions for GDB for an embedded SPARC.
- Copyright 1996, 1997, 2000 Free Software Foundation, Inc.
-
- This file is part of GDB.
-
- 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.
-
- 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.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-
-#include "regcache.h"
-
-#define TARGET_SPARCLET 1 /* Still needed for non-multi-arch case */
-
-#include "sparc/tm-sparc.h"
-
-/* Note: we are not defining GDB_MULTI_ARCH for the sparclet target
- at this time, because we have not figured out how to detect the
- sparclet target from the bfd structure. */
-
-/* Sparclet regs, for debugging purposes. */
-
-enum {
- CCSR_REGNUM = 72,
- CCPR_REGNUM = 73,
- CCCRCR_REGNUM = 74,
- CCOR_REGNUM = 75,
- CCOBR_REGNUM = 76,
- CCIBR_REGNUM = 77,
- CCIR_REGNUM = 78
-};
-
-/* Select the sparclet disassembler. Slightly different instruction set from
- the V8 sparc. */
-
-#undef TM_PRINT_INSN_MACH
-#define TM_PRINT_INSN_MACH bfd_mach_sparc_sparclet
-
-/* overrides of tm-sparc.h */
-
-#undef TARGET_BYTE_ORDER
-
-/* Sequence of bytes for breakpoint instruction (ta 1). */
-#undef BREAKPOINT
-#define BIG_BREAKPOINT {0x91, 0xd0, 0x20, 0x01}
-#define LITTLE_BREAKPOINT {0x01, 0x20, 0xd0, 0x91}
-
-#if !defined (GDB_MULTI_ARCH) || (GDB_MULTI_ARCH == 0)
-/*
- * The following defines must go away for MULTI_ARCH.
- */
-
-#undef NUM_REGS /* formerly "72" */
-/* WIN FP CPU CCP ASR AWR APSR */
-#define NUM_REGS (32 + 32 + 8 + 8 + 8/*+ 32 + 1*/)
-
-#undef REGISTER_BYTES /* formerly "(32*4 + 32*4 + 8*4)" */
-#define REGISTER_BYTES (32*4 + 32*4 + 8*4 + 8*4 + 8*4/* + 32*4 + 1*4*/)
-
-/* Initializer for an array of names of registers.
- There should be NUM_REGS strings in this initializer. */
-/* Sparclet has no fp! */
-/* Compiler maps types for floats by number, so can't
- change the numbers here. */
-
-#undef REGISTER_NAMES
-#define REGISTER_NAMES \
-{ "g0", "g1", "g2", "g3", "g4", "g5", "g6", "g7", \
- "o0", "o1", "o2", "o3", "o4", "o5", "o6", "o7", \
- "l0", "l1", "l2", "l3", "l4", "l5", "l6", "l7", \
- "i0", "i1", "i2", "i3", "i4", "i5", "i6", "i7", \
- \
- "", "", "", "", "", "", "", "", /* no FPU regs */ \
- "", "", "", "", "", "", "", "", \
- "", "", "", "", "", "", "", "", \
- "", "", "", "", "", "", "", "", \
- /* no CPSR, FPSR */ \
- "y", "psr", "wim", "tbr", "pc", "npc", "", "", \
- \
- "ccsr", "ccpr", "cccrcr", "ccor", "ccobr", "ccibr", "ccir", "", \
- \
- /* ASR15 ASR19 (don't display them) */ \
- "asr1", "", "asr17", "asr18", "", "asr20", "asr21", "asr22", \
-/* \
- "awr0", "awr1", "awr2", "awr3", "awr4", "awr5", "awr6", "awr7", \
- "awr8", "awr9", "awr10", "awr11", "awr12", "awr13", "awr14", "awr15", \
- "awr16", "awr17", "awr18", "awr19", "awr20", "awr21", "awr22", "awr23", \
- "awr24", "awr25", "awr26", "awr27", "awr28", "awr29", "awr30", "awr31", \
- "apsr", \
- */ \
-}
-
-/* Remove FP dependant code which was defined in tm-sparc.h */
-#undef FP0_REGNUM /* Floating point register 0 */
-#undef FPS_REGNUM /* Floating point status register */
-#undef CPS_REGNUM /* Coprocessor status register */
-
-/* sparclet register numbers */
-#define CCSR_REGNUM 72
-
-#undef DEPRECATED_EXTRACT_RETURN_VALUE
-#define DEPRECATED_EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
- { \
- memcpy ((VALBUF), \
- (char *)(REGBUF) + REGISTER_RAW_SIZE (O0_REGNUM) * 8 + \
- (TYPE_LENGTH(TYPE) >= REGISTER_RAW_SIZE (O0_REGNUM) \
- ? 0 : REGISTER_RAW_SIZE (O0_REGNUM) - TYPE_LENGTH(TYPE)), \
- TYPE_LENGTH(TYPE)); \
- }
-#undef DEPRECATED_STORE_RETURN_VALUE
-#define DEPRECATED_STORE_RETURN_VALUE(TYPE,VALBUF) \
- { \
- /* Other values are returned in register %o0. */ \
- deprecated_write_register_bytes (REGISTER_BYTE (O0_REGNUM), (VALBUF), \
- TYPE_LENGTH (TYPE)); \
- }
-
-#endif /* GDB_MULTI_ARCH */
-
-extern void sparclet_do_registers_info (int regnum, int all);
-#undef DEPRECATED_DO_REGISTERS_INFO
-#define DEPRECATED_DO_REGISTERS_INFO(REGNUM,ALL) sparclet_do_registers_info (REGNUM, ALL)
-
-
-/* Offsets into jmp_buf. Not defined by Sun, but at least documented in a
- comment in <machine/setjmp.h>! */
-
-#define JB_ELEMENT_SIZE 4 /* Size of each element in jmp_buf */
-
-#define JB_ONSSTACK 0
-#define JB_SIGMASK 1
-#define JB_SP 2
-#define JB_PC 3
-#define JB_NPC 4
-#define JB_PSR 5
-#define JB_G1 6
-#define JB_O0 7
-#define JB_WBCNT 8
-
-/* Figure out where the longjmp will land. We expect that we have just entered
- longjmp and haven't yet setup the stack frame, so the args are still in the
- output regs. %o0 (O0_REGNUM) points at the jmp_buf structure from which we
- extract the pc (JB_PC) that we will land at. The pc is copied into ADDR.
- This routine returns true on success */
-
-extern int get_longjmp_target (CORE_ADDR *);
-
-#define GET_LONGJMP_TARGET(ADDR) get_longjmp_target(ADDR)
+// OBSOLETE /* Target machine definitions for GDB for an embedded SPARC.
+// OBSOLETE Copyright 1996, 1997, 2000 Free Software Foundation, Inc.
+// OBSOLETE
+// OBSOLETE This file is part of GDB.
+// OBSOLETE
+// OBSOLETE This program is free software; you can redistribute it and/or modify
+// OBSOLETE it under the terms of the GNU General Public License as published by
+// OBSOLETE the Free Software Foundation; either version 2 of the License, or
+// OBSOLETE (at your option) any later version.
+// OBSOLETE
+// OBSOLETE This program is distributed in the hope that it will be useful,
+// OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of
+// OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// OBSOLETE GNU General Public License for more details.
+// OBSOLETE
+// OBSOLETE You should have received a copy of the GNU General Public License
+// OBSOLETE along with this program; if not, write to the Free Software
+// OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330,
+// OBSOLETE Boston, MA 02111-1307, USA. */
+// OBSOLETE
+// OBSOLETE #include "regcache.h"
+// OBSOLETE
+// OBSOLETE #define TARGET_SPARCLET 1 /* Still needed for non-multi-arch case */
+// OBSOLETE
+// OBSOLETE #include "sparc/tm-sparc.h"
+// OBSOLETE
+// OBSOLETE /* Note: we are not defining GDB_MULTI_ARCH for the sparclet target
+// OBSOLETE at this time, because we have not figured out how to detect the
+// OBSOLETE sparclet target from the bfd structure. */
+// OBSOLETE
+// OBSOLETE /* Sparclet regs, for debugging purposes. */
+// OBSOLETE
+// OBSOLETE enum {
+// OBSOLETE CCSR_REGNUM = 72,
+// OBSOLETE CCPR_REGNUM = 73,
+// OBSOLETE CCCRCR_REGNUM = 74,
+// OBSOLETE CCOR_REGNUM = 75,
+// OBSOLETE CCOBR_REGNUM = 76,
+// OBSOLETE CCIBR_REGNUM = 77,
+// OBSOLETE CCIR_REGNUM = 78
+// OBSOLETE };
+// OBSOLETE
+// OBSOLETE /* Select the sparclet disassembler. Slightly different instruction set from
+// OBSOLETE the V8 sparc. */
+// OBSOLETE
+// OBSOLETE #undef TM_PRINT_INSN_MACH
+// OBSOLETE #define TM_PRINT_INSN_MACH bfd_mach_sparc_sparclet
+// OBSOLETE
+// OBSOLETE /* overrides of tm-sparc.h */
+// OBSOLETE
+// OBSOLETE #undef TARGET_BYTE_ORDER
+// OBSOLETE
+// OBSOLETE /* Sequence of bytes for breakpoint instruction (ta 1). */
+// OBSOLETE #undef BREAKPOINT
+// OBSOLETE #define BIG_BREAKPOINT {0x91, 0xd0, 0x20, 0x01}
+// OBSOLETE #define LITTLE_BREAKPOINT {0x01, 0x20, 0xd0, 0x91}
+// OBSOLETE
+// OBSOLETE #if !defined (GDB_MULTI_ARCH) || (GDB_MULTI_ARCH == 0)
+// OBSOLETE /*
+// OBSOLETE * The following defines must go away for MULTI_ARCH.
+// OBSOLETE */
+// OBSOLETE
+// OBSOLETE #undef NUM_REGS /* formerly "72" */
+// OBSOLETE /* WIN FP CPU CCP ASR AWR APSR */
+// OBSOLETE #define NUM_REGS (32 + 32 + 8 + 8 + 8/*+ 32 + 1*/)
+// OBSOLETE
+// OBSOLETE #undef REGISTER_BYTES /* formerly "(32*4 + 32*4 + 8*4)" */
+// OBSOLETE #define REGISTER_BYTES (32*4 + 32*4 + 8*4 + 8*4 + 8*4/* + 32*4 + 1*4*/)
+// OBSOLETE
+// OBSOLETE /* Initializer for an array of names of registers.
+// OBSOLETE There should be NUM_REGS strings in this initializer. */
+// OBSOLETE /* Sparclet has no fp! */
+// OBSOLETE /* Compiler maps types for floats by number, so can't
+// OBSOLETE change the numbers here. */
+// OBSOLETE
+// OBSOLETE #undef REGISTER_NAMES
+// OBSOLETE #define REGISTER_NAMES \
+// OBSOLETE { "g0", "g1", "g2", "g3", "g4", "g5", "g6", "g7", \
+// OBSOLETE "o0", "o1", "o2", "o3", "o4", "o5", "o6", "o7", \
+// OBSOLETE "l0", "l1", "l2", "l3", "l4", "l5", "l6", "l7", \
+// OBSOLETE "i0", "i1", "i2", "i3", "i4", "i5", "i6", "i7", \
+// OBSOLETE \
+// OBSOLETE "", "", "", "", "", "", "", "", /* no FPU regs */ \
+// OBSOLETE "", "", "", "", "", "", "", "", \
+// OBSOLETE "", "", "", "", "", "", "", "", \
+// OBSOLETE "", "", "", "", "", "", "", "", \
+// OBSOLETE /* no CPSR, FPSR */ \
+// OBSOLETE "y", "psr", "wim", "tbr", "pc", "npc", "", "", \
+// OBSOLETE \
+// OBSOLETE "ccsr", "ccpr", "cccrcr", "ccor", "ccobr", "ccibr", "ccir", "", \
+// OBSOLETE \
+// OBSOLETE /* ASR15 ASR19 (don't display them) */ \
+// OBSOLETE "asr1", "", "asr17", "asr18", "", "asr20", "asr21", "asr22", \
+// OBSOLETE /* \
+// OBSOLETE "awr0", "awr1", "awr2", "awr3", "awr4", "awr5", "awr6", "awr7", \
+// OBSOLETE "awr8", "awr9", "awr10", "awr11", "awr12", "awr13", "awr14", "awr15", \
+// OBSOLETE "awr16", "awr17", "awr18", "awr19", "awr20", "awr21", "awr22", "awr23", \
+// OBSOLETE "awr24", "awr25", "awr26", "awr27", "awr28", "awr29", "awr30", "awr31", \
+// OBSOLETE "apsr", \
+// OBSOLETE */ \
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE /* Remove FP dependant code which was defined in tm-sparc.h */
+// OBSOLETE #undef FP0_REGNUM /* Floating point register 0 */
+// OBSOLETE #undef FPS_REGNUM /* Floating point status register */
+// OBSOLETE #undef CPS_REGNUM /* Coprocessor status register */
+// OBSOLETE
+// OBSOLETE /* sparclet register numbers */
+// OBSOLETE #define CCSR_REGNUM 72
+// OBSOLETE
+// OBSOLETE #undef DEPRECATED_EXTRACT_RETURN_VALUE
+// OBSOLETE #define DEPRECATED_EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
+// OBSOLETE { \
+// OBSOLETE memcpy ((VALBUF), \
+// OBSOLETE (char *)(REGBUF) + REGISTER_RAW_SIZE (O0_REGNUM) * 8 + \
+// OBSOLETE (TYPE_LENGTH(TYPE) >= REGISTER_RAW_SIZE (O0_REGNUM) \
+// OBSOLETE ? 0 : REGISTER_RAW_SIZE (O0_REGNUM) - TYPE_LENGTH(TYPE)), \
+// OBSOLETE TYPE_LENGTH(TYPE)); \
+// OBSOLETE }
+// OBSOLETE #undef DEPRECATED_STORE_RETURN_VALUE
+// OBSOLETE #define DEPRECATED_STORE_RETURN_VALUE(TYPE,VALBUF) \
+// OBSOLETE { \
+// OBSOLETE /* Other values are returned in register %o0. */ \
+// OBSOLETE deprecated_write_register_bytes (REGISTER_BYTE (O0_REGNUM), (VALBUF), \
+// OBSOLETE TYPE_LENGTH (TYPE)); \
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE #endif /* GDB_MULTI_ARCH */
+// OBSOLETE
+// OBSOLETE extern void sparclet_do_registers_info (int regnum, int all);
+// OBSOLETE #undef DEPRECATED_DO_REGISTERS_INFO
+// OBSOLETE #define DEPRECATED_DO_REGISTERS_INFO(REGNUM,ALL) sparclet_do_registers_info (REGNUM, ALL)
+// OBSOLETE
+// OBSOLETE
+// OBSOLETE /* Offsets into jmp_buf. Not defined by Sun, but at least documented in a
+// OBSOLETE comment in <machine/setjmp.h>! */
+// OBSOLETE
+// OBSOLETE #define JB_ELEMENT_SIZE 4 /* Size of each element in jmp_buf */
+// OBSOLETE
+// OBSOLETE #define JB_ONSSTACK 0
+// OBSOLETE #define JB_SIGMASK 1
+// OBSOLETE #define JB_SP 2
+// OBSOLETE #define JB_PC 3
+// OBSOLETE #define JB_NPC 4
+// OBSOLETE #define JB_PSR 5
+// OBSOLETE #define JB_G1 6
+// OBSOLETE #define JB_O0 7
+// OBSOLETE #define JB_WBCNT 8
+// OBSOLETE
+// OBSOLETE /* Figure out where the longjmp will land. We expect that we have just entered
+// OBSOLETE longjmp and haven't yet setup the stack frame, so the args are still in the
+// OBSOLETE output regs. %o0 (O0_REGNUM) points at the jmp_buf structure from which we
+// OBSOLETE extract the pc (JB_PC) that we will land at. The pc is copied into ADDR.
+// OBSOLETE This routine returns true on success */
+// OBSOLETE
+// OBSOLETE extern int get_longjmp_target (CORE_ADDR *);
+// OBSOLETE
+// OBSOLETE #define GET_LONGJMP_TARGET(ADDR) get_longjmp_target(ADDR)
diff --git a/gdb/config/sparc/tm-sparclite.h b/gdb/config/sparc/tm-sparclite.h
index fb8b6d5..bd8996b 100644
--- a/gdb/config/sparc/tm-sparclite.h
+++ b/gdb/config/sparc/tm-sparclite.h
@@ -1,123 +1,123 @@
-/* Macro definitions for GDB for a Fujitsu SPARClite.
- Copyright 1993, 1994, 1995, 1998, 1999, 2000, 2001, 2002, 2003
- Free Software Foundation, Inc.
-
- This file is part of GDB.
-
- 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.
-
- 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.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-
-#include "regcache.h"
-
-#define TARGET_SPARCLITE 1 /* Still needed for non-multi-arch case */
-
-#include "sparc/tm-sparc.h"
-
-/* Note: we are not defining GDB_MULTI_ARCH for the sparclet target
- at this time, because we have not figured out how to detect the
- sparclet target from the bfd structure. */
-
-/* Sparclite regs, for debugging purposes */
-
-enum {
- DIA1_REGNUM = 72, /* debug instr address register 1 */
- DIA2_REGNUM = 73, /* debug instr address register 2 */
- DDA1_REGNUM = 74, /* debug data address register 1 */
- DDA2_REGNUM = 75, /* debug data address register 2 */
- DDV1_REGNUM = 76, /* debug data value register 1 */
- DDV2_REGNUM = 77, /* debug data value register 2 */
- DCR_REGNUM = 78, /* debug control register */
- DSR_REGNUM = 79 /* debug status regsiter */
-};
-
-/* overrides of tm-sparc.h */
-
-#undef TARGET_BYTE_ORDER
-
-/* Select the sparclite disassembler. Slightly different instruction set from
- the V8 sparc. */
-
-#undef TM_PRINT_INSN_MACH
-#define TM_PRINT_INSN_MACH bfd_mach_sparc_sparclite
-
-/* Amount PC must be decremented by after a hardware instruction breakpoint.
- This is often the number of bytes in BREAKPOINT
- but not always. */
-
-#define DECR_PC_AFTER_HW_BREAK 4
-
-#if !defined (GDB_MULTI_ARCH) || (GDB_MULTI_ARCH == 0)
-/*
- * The following defines must go away for MULTI_ARCH.
- */
-
-#undef NUM_REGS
-#define NUM_REGS 80
-
-#undef REGISTER_BYTES
-#define REGISTER_BYTES (32*4+32*4+8*4+8*4)
-
-#undef REGISTER_NAMES
-#define REGISTER_NAMES \
-{ "g0", "g1", "g2", "g3", "g4", "g5", "g6", "g7", \
- "o0", "o1", "o2", "o3", "o4", "o5", "sp", "o7", \
- "l0", "l1", "l2", "l3", "l4", "l5", "l6", "l7", \
- "i0", "i1", "i2", "i3", "i4", "i5", "fp", "i7", \
- \
- "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", \
- "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15", \
- "f16", "f17", "f18", "f19", "f20", "f21", "f22", "f23", \
- "f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31", \
- \
- "y", "psr", "wim", "tbr", "pc", "npc", "fpsr", "cpsr", \
- "dia1", "dia2", "dda1", "dda2", "ddv1", "ddv2", "dcr", "dsr" }
-
-#define DIA1_REGNUM 72 /* debug instr address register 1 */
-#define DIA2_REGNUM 73 /* debug instr address register 2 */
-#define DDA1_REGNUM 74 /* debug data address register 1 */
-#define DDA2_REGNUM 75 /* debug data address register 2 */
-#define DDV1_REGNUM 76 /* debug data value register 1 */
-#define DDV2_REGNUM 77 /* debug data value register 2 */
-#define DCR_REGNUM 78 /* debug control register */
-#define DSR_REGNUM 79 /* debug status regsiter */
-
-#endif /* GDB_MULTI_ARCH */
-
-#define TARGET_HW_BREAK_LIMIT 2
-#define TARGET_HW_WATCH_LIMIT 2
-
-/* Enable watchpoint macro's */
-
-#define TARGET_HAS_HARDWARE_WATCHPOINTS
-
-#define TARGET_CAN_USE_HARDWARE_WATCHPOINT(type, cnt, ot) \
- sparclite_check_watch_resources (type, cnt, ot)
-
-/* When a hardware watchpoint fires off the PC will be left at the
- instruction which caused the watchpoint. It will be necessary for
- GDB to step over the watchpoint. ***
-
- #define STOPPED_BY_WATCHPOINT(W) \
- ((W).kind == TARGET_WAITKIND_STOPPED \
- && (W).value.sig == TARGET_SIGNAL_TRAP \
- && ((int) read_register (IPSW_REGNUM) & 0x00100000))
- */
-
-/* Use these macros for watchpoint insertion/deletion. */
-#define target_insert_watchpoint(addr, len, type) sparclite_insert_watchpoint (addr, len, type)
-#define target_remove_watchpoint(addr, len, type) sparclite_remove_watchpoint (addr, len, type)
-#define target_insert_hw_breakpoint(addr, len) sparclite_insert_hw_breakpoint (addr, len)
-#define target_remove_hw_breakpoint(addr, len) sparclite_remove_hw_breakpoint (addr, len)
-#define target_stopped_data_address() sparclite_stopped_data_address()
+// OBSOLETE /* Macro definitions for GDB for a Fujitsu SPARClite.
+// OBSOLETE Copyright 1993, 1994, 1995, 1998, 1999, 2000, 2001, 2002, 2003
+// OBSOLETE Free Software Foundation, Inc.
+// OBSOLETE
+// OBSOLETE This file is part of GDB.
+// OBSOLETE
+// OBSOLETE This program is free software; you can redistribute it and/or modify
+// OBSOLETE it under the terms of the GNU General Public License as published by
+// OBSOLETE the Free Software Foundation; either version 2 of the License, or
+// OBSOLETE (at your option) any later version.
+// OBSOLETE
+// OBSOLETE This program is distributed in the hope that it will be useful,
+// OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of
+// OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// OBSOLETE GNU General Public License for more details.
+// OBSOLETE
+// OBSOLETE You should have received a copy of the GNU General Public License
+// OBSOLETE along with this program; if not, write to the Free Software
+// OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330,
+// OBSOLETE Boston, MA 02111-1307, USA. */
+// OBSOLETE
+// OBSOLETE #include "regcache.h"
+// OBSOLETE
+// OBSOLETE #define TARGET_SPARCLITE 1 /* Still needed for non-multi-arch case */
+// OBSOLETE
+// OBSOLETE #include "sparc/tm-sparc.h"
+// OBSOLETE
+// OBSOLETE /* Note: we are not defining GDB_MULTI_ARCH for the sparclet target
+// OBSOLETE at this time, because we have not figured out how to detect the
+// OBSOLETE sparclet target from the bfd structure. */
+// OBSOLETE
+// OBSOLETE /* Sparclite regs, for debugging purposes */
+// OBSOLETE
+// OBSOLETE enum {
+// OBSOLETE DIA1_REGNUM = 72, /* debug instr address register 1 */
+// OBSOLETE DIA2_REGNUM = 73, /* debug instr address register 2 */
+// OBSOLETE DDA1_REGNUM = 74, /* debug data address register 1 */
+// OBSOLETE DDA2_REGNUM = 75, /* debug data address register 2 */
+// OBSOLETE DDV1_REGNUM = 76, /* debug data value register 1 */
+// OBSOLETE DDV2_REGNUM = 77, /* debug data value register 2 */
+// OBSOLETE DCR_REGNUM = 78, /* debug control register */
+// OBSOLETE DSR_REGNUM = 79 /* debug status regsiter */
+// OBSOLETE };
+// OBSOLETE
+// OBSOLETE /* overrides of tm-sparc.h */
+// OBSOLETE
+// OBSOLETE #undef TARGET_BYTE_ORDER
+// OBSOLETE
+// OBSOLETE /* Select the sparclite disassembler. Slightly different instruction set from
+// OBSOLETE the V8 sparc. */
+// OBSOLETE
+// OBSOLETE #undef TM_PRINT_INSN_MACH
+// OBSOLETE #define TM_PRINT_INSN_MACH bfd_mach_sparc_sparclite
+// OBSOLETE
+// OBSOLETE /* Amount PC must be decremented by after a hardware instruction breakpoint.
+// OBSOLETE This is often the number of bytes in BREAKPOINT
+// OBSOLETE but not always. */
+// OBSOLETE
+// OBSOLETE #define DECR_PC_AFTER_HW_BREAK 4
+// OBSOLETE
+// OBSOLETE #if !defined (GDB_MULTI_ARCH) || (GDB_MULTI_ARCH == 0)
+// OBSOLETE /*
+// OBSOLETE * The following defines must go away for MULTI_ARCH.
+// OBSOLETE */
+// OBSOLETE
+// OBSOLETE #undef NUM_REGS
+// OBSOLETE #define NUM_REGS 80
+// OBSOLETE
+// OBSOLETE #undef REGISTER_BYTES
+// OBSOLETE #define REGISTER_BYTES (32*4+32*4+8*4+8*4)
+// OBSOLETE
+// OBSOLETE #undef REGISTER_NAMES
+// OBSOLETE #define REGISTER_NAMES \
+// OBSOLETE { "g0", "g1", "g2", "g3", "g4", "g5", "g6", "g7", \
+// OBSOLETE "o0", "o1", "o2", "o3", "o4", "o5", "sp", "o7", \
+// OBSOLETE "l0", "l1", "l2", "l3", "l4", "l5", "l6", "l7", \
+// OBSOLETE "i0", "i1", "i2", "i3", "i4", "i5", "fp", "i7", \
+// OBSOLETE \
+// OBSOLETE "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", \
+// OBSOLETE "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15", \
+// OBSOLETE "f16", "f17", "f18", "f19", "f20", "f21", "f22", "f23", \
+// OBSOLETE "f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31", \
+// OBSOLETE \
+// OBSOLETE "y", "psr", "wim", "tbr", "pc", "npc", "fpsr", "cpsr", \
+// OBSOLETE "dia1", "dia2", "dda1", "dda2", "ddv1", "ddv2", "dcr", "dsr" }
+// OBSOLETE
+// OBSOLETE #define DIA1_REGNUM 72 /* debug instr address register 1 */
+// OBSOLETE #define DIA2_REGNUM 73 /* debug instr address register 2 */
+// OBSOLETE #define DDA1_REGNUM 74 /* debug data address register 1 */
+// OBSOLETE #define DDA2_REGNUM 75 /* debug data address register 2 */
+// OBSOLETE #define DDV1_REGNUM 76 /* debug data value register 1 */
+// OBSOLETE #define DDV2_REGNUM 77 /* debug data value register 2 */
+// OBSOLETE #define DCR_REGNUM 78 /* debug control register */
+// OBSOLETE #define DSR_REGNUM 79 /* debug status regsiter */
+// OBSOLETE
+// OBSOLETE #endif /* GDB_MULTI_ARCH */
+// OBSOLETE
+// OBSOLETE #define TARGET_HW_BREAK_LIMIT 2
+// OBSOLETE #define TARGET_HW_WATCH_LIMIT 2
+// OBSOLETE
+// OBSOLETE /* Enable watchpoint macro's */
+// OBSOLETE
+// OBSOLETE #define TARGET_HAS_HARDWARE_WATCHPOINTS
+// OBSOLETE
+// OBSOLETE #define TARGET_CAN_USE_HARDWARE_WATCHPOINT(type, cnt, ot) \
+// OBSOLETE sparclite_check_watch_resources (type, cnt, ot)
+// OBSOLETE
+// OBSOLETE /* When a hardware watchpoint fires off the PC will be left at the
+// OBSOLETE instruction which caused the watchpoint. It will be necessary for
+// OBSOLETE GDB to step over the watchpoint. ***
+// OBSOLETE
+// OBSOLETE #define STOPPED_BY_WATCHPOINT(W) \
+// OBSOLETE ((W).kind == TARGET_WAITKIND_STOPPED \
+// OBSOLETE && (W).value.sig == TARGET_SIGNAL_TRAP \
+// OBSOLETE && ((int) read_register (IPSW_REGNUM) & 0x00100000))
+// OBSOLETE */
+// OBSOLETE
+// OBSOLETE /* Use these macros for watchpoint insertion/deletion. */
+// OBSOLETE #define target_insert_watchpoint(addr, len, type) sparclite_insert_watchpoint (addr, len, type)
+// OBSOLETE #define target_remove_watchpoint(addr, len, type) sparclite_remove_watchpoint (addr, len, type)
+// OBSOLETE #define target_insert_hw_breakpoint(addr, len) sparclite_insert_hw_breakpoint (addr, len)
+// OBSOLETE #define target_remove_hw_breakpoint(addr, len) sparclite_remove_hw_breakpoint (addr, len)
+// OBSOLETE #define target_stopped_data_address() sparclite_stopped_data_address()
diff --git a/gdb/configure.host b/gdb/configure.host
index b309a33..8f96b0a 100644
--- a/gdb/configure.host
+++ b/gdb/configure.host
@@ -40,18 +40,18 @@ arm*-*-linux*) gdb_host=linux ;;
arm*-*-netbsdelf*) gdb_host=nbsdelf ;;
arm*-*-netbsd*) gdb_host=nbsdaout ;;
-hppa*-*-bsd*) gdb_host=hppabsd ;;
+# OBSOLETE hppa*-*-bsd*) gdb_host=hppabsd ;;
hppa*-*-hiux*) gdb_host=hppahpux ;;
hppa*-*-hpux10.20) gdb_host=hpux1020 ;;
hppa*64*-*-hpux11*) gdb_host=hpux11w ;;
hppa*-*-hpux11*) gdb_host=hpux11 ;;
hppa*-*-hpux*) gdb_host=hppahpux ;;
-hppa*-*-osf*) gdb_host=hppaosf ;;
+# OBSOLETE hppa*-*-osf*) gdb_host=hppaosf ;;
i[3456]86-ncr-*) gdb_host=ncr3000 ;;
-i[3456]86-sequent-bsd*) gdb_host=symmetry ;; # dynix
-i[3456]86-sequent-sysv4*) gdb_host=ptx4 ;;
-i[3456]86-sequent-sysv*) gdb_host=ptx ;;
+# OBSOLETE i[3456]86-sequent-bsd*) gdb_host=symmetry ;; # dynix
+# OBSOLETE i[3456]86-sequent-sysv4*) gdb_host=ptx4 ;;
+# OBSOLETE i[3456]86-sequent-sysv*) gdb_host=ptx ;;
i[3456]86-*-bsd*) gdb_host=i386bsd ;;
i[3456]86-*-dgux*) gdb_host=i386v4 ;;
i[3456]86-*-freebsd*) gdb_host=fbsd ;;
@@ -94,7 +94,7 @@ m68*-sun-sunos3*) gdb_host=sun3os3 ;;
m68*-sun-sunos4*) gdb_host=sun3os4 ;;
m68*-sun-*) gdb_host=sun3os4 ;;
-mips-dec-mach3*) gdb_host=mipsm3 ;;
+# OBSOLETE mips-dec-mach3*) gdb_host=mipsm3 ;;
mips-dec-*) gdb_host=decstation ;;
mips-little-*) gdb_host=littlemips ;;
mips-sgi-irix3*) gdb_host=irix3 ;;
diff --git a/gdb/configure.tgt b/gdb/configure.tgt
index 17ac70f..aeb9e271 100644
--- a/gdb/configure.tgt
+++ b/gdb/configure.tgt
@@ -73,17 +73,17 @@ h8300-*-*) gdb_target=h8300 ;;
frv-*-*) gdb_target=frv ;;
-hppa*-*-bsd*) gdb_target=hppabsd ;;
-hppa*-*-pro*) gdb_target=hppapro ;;
+# OBSOLETE hppa*-*-bsd*) gdb_target=hppabsd ;;
+# OBSOLETE hppa*-*-pro*) gdb_target=hppapro ;;
hppa*64*-*-hpux11*) gdb_target=hppa64 ;;
hppa*-*-hpux*) gdb_target=hppahpux ;;
hppa*-*-hiux*) gdb_target=hppahpux ;;
-hppa*-*-osf*) gdb_target=hppaosf ;;
+# OBSOLETE hppa*-*-osf*) gdb_target=hppaosf ;;
hppa*-*-*) gdb_target=hppa ;;
-i[3456]86-sequent-bsd*) gdb_target=symmetry ;;
-i[3456]86-sequent-sysv4*) gdb_target=ptx4 ;;
-i[3456]86-sequent-sysv*) gdb_target=ptx ;;
+# OBSOLETE i[3456]86-sequent-bsd*) gdb_target=symmetry ;;
+# OBSOLETE i[3456]86-sequent-sysv4*) gdb_target=ptx4 ;;
+# OBSOLETE i[3456]86-sequent-sysv*) gdb_target=ptx ;;
i[3456]86-ncr-*) gdb_target=ncr3000 ;;
i[3456]86-*-bsd*) gdb_target=i386bsd ;;
i[3456]86-*-netbsd*) gdb_target=nbsd ;;
@@ -172,7 +172,7 @@ mips*-*-linux*) gdb_target=linux
build_gdbserver=yes
;;
mips*-*-netbsd*) gdb_target=nbsd ;;
-mips*-*-mach3*) gdb_target=mipsm3 ;;
+# OBSOLETE mips*-*-mach3*) gdb_target=mipsm3 ;;
mips*-*-sysv4*) gdb_target=mipsv4 ;;
mips*-*-sysv*) gdb_target=bigmips ;;
mips*-*-riscos*) gdb_target=bigmips ;;
@@ -229,9 +229,9 @@ sparc-*-sunos4*) gdb_target=sun4os4 ;;
sparc-*-sunos5*) gdb_target=sun4sol2 ;;
sparc-*-vxworks*) gdb_target=vxsparc ;;
sparc-*-*) gdb_target=sun4os4 ;;
-sparclet-*-*) gdb_target=sparclet;;
-sparclite-*-*) gdb_target=sparclite ;;
-sparc86x-*-*) gdb_target=sparclite ;;
+# OBSOLETE sparclet-*-*) gdb_target=sparclet;;
+# OBSOLETE sparclite-*-*) gdb_target=sparclite ;;
+# OBSOLETE sparc86x-*-*) gdb_target=sparclite ;;
# It's not clear what the right solution for "v8plus" systems is yet.
# For now, stick with sparc-sun-solaris2 since that's what config.guess
# should return. Work is still needed to get gdb to print the 64 bit
diff --git a/gdb/cp-abi.h b/gdb/cp-abi.h
index e119514..0413aba 100644
--- a/gdb/cp-abi.h
+++ b/gdb/cp-abi.h
@@ -25,6 +25,8 @@
#ifndef CP_ABI_H_
#define CP_ABI_H_ 1
+struct fn_field;
+struct type;
struct value;
/* The functions here that attempt to determine what sort of thing a
diff --git a/gdb/cp-namespace.c b/gdb/cp-namespace.c
index 7205cf7..24741c3 100644
--- a/gdb/cp-namespace.c
+++ b/gdb/cp-namespace.c
@@ -38,7 +38,7 @@ unsigned char processing_has_namespace_info;
contain the name of the current namespace. The string is
temporary; copy it if you need it. */
-const char *processing_current_namespace;
+const char *processing_current_prefix;
/* List of using directives that are active in the current file. */
@@ -175,8 +175,8 @@ cp_set_block_scope (const struct symbol *symbol,
if (processing_has_namespace_info)
{
block_set_scope
- (block, obsavestring (processing_current_namespace,
- strlen (processing_current_namespace),
+ (block, obsavestring (processing_current_prefix,
+ strlen (processing_current_prefix),
obstack),
obstack);
}
diff --git a/gdb/cp-support.c b/gdb/cp-support.c
index 07c1928..784826b 100644
--- a/gdb/cp-support.c
+++ b/gdb/cp-support.c
@@ -21,6 +21,7 @@
Boston, MA 02111-1307, USA. */
#include "defs.h"
+#include <ctype.h>
#include "cp-support.h"
#include "gdb_string.h"
#include "demangle.h"
@@ -34,7 +35,14 @@
#include "dictionary.h"
#include "gdbcmd.h"
-static char *xstrndup (const char *string, size_t len);
+/* The list of "maint cplus" commands. */
+
+static struct cmd_list_element *maint_cplus_cmd_list = NULL;
+
+/* The actual commands. */
+
+static void maint_cplus_command (char *arg, int from_tty);
+static void first_component_command (char *arg, int from_tty);
static const char *find_last_component (const char *name);
@@ -92,14 +100,15 @@ static void maintenance_print_namespace (char *args, int from_tty);
fairly restrictive set of locations (in particular, they have be
at depth 0, don't they?). */
-/* NOTE: carlton/2002-10-25: Daniel Jacobowitz came up with an example
+/* NOTE: carlton/2003-02-21: Daniel Jacobowitz came up with an example
where operator names don't occur at depth 0. Sigh. (It involved a
template argument that was a pointer: I hadn't realized that was
possible.) Handling such edge cases does not seem like a
high-priority problem to me. */
-/* FIXME: carlton/2002-10-09: Do all the functions here handle all the
- above considerations correctly? */
+/* FIXME: carlton/2003-03-13: We have several functions here with
+ overlapping functionality; can we combine them? Also, do they
+ handle all the above considerations correctly? */
/* Find the last component of the demangled C++ name NAME. NAME
must be a method name including arguments, in order to correctly
@@ -226,6 +235,11 @@ method_name_from_physname (const char *physname)
the recursion easier, it also stops if it reaches an unexpected ')'
or '>'. */
+/* NOTE: carlton/2003-03-13: This function is currently only intended
+ for internal use: it's probably not entirely safe when called on
+ user-generated input, because some of the 'index += 2' lines might
+ go past the end of malformed input. */
+
/* Let's optimize away calls to strlen("operator"). */
#define LENGTH_OF_OPERATOR 8
@@ -242,6 +256,8 @@ cp_find_first_component (const char *name)
if (strncmp (name, "operator", LENGTH_OF_OPERATOR) == 0)
{
index += LENGTH_OF_OPERATOR;
+ while (isspace(name[index]))
+ ++index;
switch (name[index])
{
case '<':
@@ -312,7 +328,8 @@ cp_find_first_component (const char *name)
name. Given 'A::foo', it returns 1, given 'A::B::foo', it returns
4, given 'foo', it returns 0. */
-unsigned int cp_entire_prefix_len (const char *name)
+unsigned int
+cp_entire_prefix_len (const char *name)
{
unsigned int current_len = cp_find_first_component (name);
unsigned int previous_len = 0;
@@ -329,61 +346,6 @@ unsigned int cp_entire_prefix_len (const char *name)
return previous_len;
}
-/* Create a new struct using direct whose inner namespace is the
- initial substring of NAME of leng INNER_LEN and whose outer
- namespace is the initial substring of NAME of length OUTER_LENGTH.
- Set its next member in the linked list to NEXT; allocate all memory
- using xmalloc. It copies the strings, so NAME can be a temporary
- string. */
-
-struct using_direct *
-cp_add_using (const char *name,
- unsigned int inner_len,
- unsigned int outer_len,
- struct using_direct *next)
-{
- struct using_direct *retval;
-
- gdb_assert (outer_len < inner_len);
-
- retval = xmalloc (sizeof (struct using_direct));
- retval->inner = xstrndup (name, inner_len);
- retval->outer = xstrndup (name, outer_len);
- retval->next = next;
-
- return retval;
-}
-
-/* Make a copy of the using directives in the list pointed to by
- USING, using OBSTACK to allocate memory. Free all memory pointed
- to by USING via xfree. */
-
-extern struct using_direct *
-cp_copy_usings (struct using_direct *using,
- struct obstack *obstack)
-{
- if (using == NULL)
- {
- return NULL;
- }
- else
- {
- struct using_direct *retval
- = obstack_alloc (obstack, sizeof (struct using_direct));
- retval->inner = obsavestring (using->inner, strlen (using->inner),
- obstack);
- retval->outer = obsavestring (using->outer, strlen (using->outer),
- obstack);
- retval->next = cp_copy_usings (using->next, obstack);
-
- xfree (using->inner);
- xfree (using->outer);
- xfree (using);
-
- return retval;
- }
-}
-
/* Allocate everything necessary for namespace_block and
possible_namespace_block. */
@@ -646,35 +608,6 @@ maintenance_print_namespace (char *args, int from_tty)
}
}
-/* Test whether or not NAMESPACE looks like it mentions an anonymous
- namespace; return 1 if it mentions "(anonymous namespace)", 2 if it
- mentions "{anonymous}", and 0 otherwise. */
-
-int
-cp_is_anonymous (const char *namespace)
-{
- if (strstr (namespace, "(anonymous namespace)") != NULL)
- return 1;
- else if (strstr (namespace, "{anonymous}") != NULL)
- return 2;
- else
- return 0;
-}
-
-/* Create a copy of the initial substring of STRING of length LEN.
- Allocate memory via xmalloc. */
-
-static char *
-xstrndup (const char *string, size_t len)
-{
- char *retval = xmalloc (len + 1);
-
- strncpy (retval, string, len);
- retval[len] = '\0';
-
- return retval;
-}
-
/* If FULL_NAME is the demangled name of a C++ function (including an
arg list, possibly including namespace/class qualifications),
return a new string containing only the function name (without the
@@ -703,9 +636,42 @@ cp_func_name (const char *full_name)
return remove_params (previous_component);
}
+/* Don't allow just "maintenance cplus". */
+
+static void
+maint_cplus_command (char *arg, int from_tty)
+{
+ printf_unfiltered ("\"maintenance cplus\" must be followed by the name of a command.\n");
+ help_list (maint_cplus_cmd_list, "maintenance cplus ", -1, gdb_stdout);
+}
+
+/* This is a front end for cp_find_first_component, for unit testing.
+ Be careful when using it: see the NOTE above
+ cp_find_first_component. */
+
+static void
+first_component_command (char *arg, int from_tty)
+{
+ int len = cp_find_first_component (arg);
+ char *prefix = alloca (len + 1);
+
+ memcpy (prefix, arg, len);
+ prefix[len] = '\0';
+
+ printf_unfiltered ("%s\n", prefix);
+}
+
void
_initialize_cp_support (void)
{
+ add_prefix_cmd ("cplus", class_maintenance, maint_cplus_command,
+ "C++ maintenance commands.", &maint_cplus_cmd_list,
+ "maintenance cplus ", 0, &maintenancelist);
+ add_alias_cmd ("cp", "cplus", class_maintenance, 1, &maintenancelist);
+
+ add_cmd ("first_component", class_maintenance, first_component_command,
+ "Print the first class/namespace component of NAME.",
+ &maint_cplus_cmd_list);
add_cmd ("namespace", class_maintenance, maintenance_print_namespace,
"Print the list of current known C++ namespaces.",
&maintenanceprintlist);
diff --git a/gdb/cp-support.h b/gdb/cp-support.h
index 7aca377..1bf1c72 100644
--- a/gdb/cp-support.h
+++ b/gdb/cp-support.h
@@ -1,7 +1,8 @@
/* Helper routines for C++ support in GDB.
Copyright 2002, 2003 Free Software Foundation, Inc.
- Contributed by MontaVista Software and Stanford University.
+ Contributed by MontaVista Software.
+ Namespace support contributed by David Carlton.
This file is part of GDB.
@@ -26,6 +27,7 @@
/* Opaque declarations. */
struct obstack;
+struct block;
struct symbol;
/* This struct is designed to store data from using directives. It
@@ -41,6 +43,9 @@ struct using_direct
struct using_direct *next;
};
+
+/* Functions from cp-support.c. */
+
extern char *class_name_from_physname (const char *physname);
extern char *method_name_from_physname (const char *physname);
@@ -49,14 +54,6 @@ extern unsigned int cp_find_first_component (const char *name);
extern unsigned int cp_entire_prefix_len (const char *name);
-extern struct using_direct *cp_add_using (const char *name,
- unsigned int inner_len,
- unsigned int outer_len,
- struct using_direct *next);
-
-extern struct using_direct *cp_copy_usings (struct using_direct *using,
- struct obstack *obstack);
-
extern struct symbol *cp_check_namespace_symbol (const char *name, int len);
extern struct symbol *cp_lookup_namespace_symbol (const char *name);
@@ -65,8 +62,30 @@ extern void cp_check_possible_namespace_symbols (const char *name);
extern struct symbol *cp_lookup_possible_namespace_symbol (const char *name);
+extern char *cp_func_name (const char *full_name);
+
+
+/* Functions/variables from cp-namespace.c. */
+
+extern unsigned char processing_has_namespace_info;
+
+extern const char *processing_current_prefix;
+
extern int cp_is_anonymous (const char *namespace);
-extern char *cp_func_name (const char *full_name);
+extern void cp_add_using_directive (const char *name,
+ unsigned int outer_length,
+ unsigned int inner_length);
+
+extern void cp_initialize_namespace ();
+
+extern void cp_finalize_namespace (struct block *static_block,
+ struct obstack *obstack);
+
+extern void cp_set_block_scope (const struct symbol *symbol,
+ struct block *block,
+ struct obstack *obstack);
+
+extern void cp_scan_for_anonymous_namespaces (const struct symbol *symbol);
#endif /* CP_SUPPORT_H */
diff --git a/gdb/cp-valprint.c b/gdb/cp-valprint.c
index f1f64f8..3cb1653 100644
--- a/gdb/cp-valprint.c
+++ b/gdb/cp-valprint.c
@@ -87,7 +87,7 @@ cp_print_class_method (char *valaddr,
fprintf_filtered (stream, "<unknown>");
return;
}
- addr = unpack_pointer (lookup_pointer_type (builtin_type_void), valaddr);
+ addr = unpack_pointer (type, valaddr);
if (METHOD_PTR_IS_VIRTUAL (addr))
{
offset = METHOD_PTR_TO_VOFFSET (addr);
diff --git a/gdb/cris-tdep.c b/gdb/cris-tdep.c
index a51f98c..f03cd14 100644
--- a/gdb/cris-tdep.c
+++ b/gdb/cris-tdep.c
@@ -1178,7 +1178,7 @@ cris_frame_init_saved_regs (struct frame_info *fi)
}
else
{
- ip = get_pc_function_start (get_frame_pc (fi));
+ ip = get_frame_func (fi);
sal = find_pc_line (ip, 0);
/* If there is no symbol information then sal.end == 0, and we end up
@@ -1204,7 +1204,7 @@ cris_init_extra_frame_info (int fromleaf, struct frame_info *fi)
if (get_next_frame (fi))
{
/* Called from get_prev_frame. */
- deprecated_update_frame_pc_hack (fi, FRAME_SAVED_PC (get_next_frame (fi)));
+ deprecated_update_frame_pc_hack (fi, DEPRECATED_FRAME_SAVED_PC (get_next_frame (fi)));
}
frame_extra_info_zalloc (fi, sizeof (struct frame_extra_info));
@@ -4154,7 +4154,7 @@ cris_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
if (tdep->cris_abi == CRIS_ABI_ORIGINAL)
{
set_gdbarch_double_bit (gdbarch, 32);
- set_gdbarch_push_arguments (gdbarch, cris_abi_original_push_arguments);
+ set_gdbarch_deprecated_push_arguments (gdbarch, cris_abi_original_push_arguments);
set_gdbarch_deprecated_store_return_value (gdbarch,
cris_abi_original_store_return_value);
set_gdbarch_deprecated_extract_return_value
@@ -4165,7 +4165,7 @@ cris_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
else if (tdep->cris_abi == CRIS_ABI_V2)
{
set_gdbarch_double_bit (gdbarch, 64);
- set_gdbarch_push_arguments (gdbarch, cris_abi_v2_push_arguments);
+ set_gdbarch_deprecated_push_arguments (gdbarch, cris_abi_v2_push_arguments);
set_gdbarch_deprecated_store_return_value (gdbarch, cris_abi_v2_store_return_value);
set_gdbarch_deprecated_extract_return_value
(gdbarch, cris_abi_v2_extract_return_value);
@@ -4255,39 +4255,23 @@ cris_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
/* Use generic dummy frames. */
- /* Where to execute the call in the memory segments. */
- set_gdbarch_call_dummy_address (gdbarch, entry_point_address);
-
- /* Start execution at the beginning of dummy. */
- set_gdbarch_call_dummy_start_offset (gdbarch, 0);
- set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 0);
-
- /* Set to 1 since call_dummy_breakpoint_offset was defined. */
- set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 1);
-
/* Read all about dummy frames in blockframe.c. */
- set_gdbarch_call_dummy_length (gdbarch, 0);
set_gdbarch_deprecated_pc_in_call_dummy (gdbarch, deprecated_pc_in_call_dummy_at_entry_point);
/* Defined to 1 to indicate that the target supports inferior function
calls. */
- set_gdbarch_call_dummy_p (gdbarch, 1);
set_gdbarch_call_dummy_words (gdbarch, 0);
set_gdbarch_sizeof_call_dummy_words (gdbarch, 0);
- /* No stack adjustment needed when peforming an inferior function call. */
- set_gdbarch_call_dummy_stack_adjust_p (gdbarch, 0);
- set_gdbarch_fix_call_dummy (gdbarch, generic_fix_call_dummy);
-
- set_gdbarch_get_saved_register (gdbarch, deprecated_generic_get_saved_register);
+ set_gdbarch_deprecated_get_saved_register (gdbarch, deprecated_generic_get_saved_register);
/* No register requires conversion from raw format to virtual format. */
set_gdbarch_register_convertible (gdbarch, generic_register_convertible_not);
- set_gdbarch_push_return_address (gdbarch, cris_push_return_address);
- set_gdbarch_pop_frame (gdbarch, cris_pop_frame);
+ set_gdbarch_deprecated_push_return_address (gdbarch, cris_push_return_address);
+ set_gdbarch_deprecated_pop_frame (gdbarch, cris_pop_frame);
- set_gdbarch_store_struct_return (gdbarch, cris_store_struct_return);
+ set_gdbarch_deprecated_store_struct_return (gdbarch, cris_store_struct_return);
set_gdbarch_deprecated_extract_struct_value_address
(gdbarch, cris_extract_struct_value_address);
set_gdbarch_use_struct_convention (gdbarch, cris_use_struct_convention);
@@ -4314,19 +4298,19 @@ cris_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_frame_args_skip (gdbarch, 0);
set_gdbarch_frameless_function_invocation
(gdbarch, cris_frameless_function_invocation);
- set_gdbarch_frame_chain (gdbarch, cris_frame_chain);
+ set_gdbarch_deprecated_frame_chain (gdbarch, cris_frame_chain);
- set_gdbarch_frame_saved_pc (gdbarch, cris_frame_saved_pc);
- set_gdbarch_saved_pc_after_call (gdbarch, cris_saved_pc_after_call);
+ set_gdbarch_deprecated_frame_saved_pc (gdbarch, cris_frame_saved_pc);
+ set_gdbarch_deprecated_saved_pc_after_call (gdbarch, cris_saved_pc_after_call);
set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown);
- /* No extra stack alignment needed. Set to 1 by default. */
- set_gdbarch_extra_stack_alignment_needed (gdbarch, 0);
-
/* Helpful for backtracing and returning in a call dummy. */
set_gdbarch_save_dummy_frame_tos (gdbarch, generic_save_dummy_frame_tos);
+ /* Should be using push_dummy_call. */
+ set_gdbarch_deprecated_dummy_write_sp (gdbarch, generic_target_write_sp);
+
/* Use target_specific function to define link map offsets. */
set_solib_svr4_fetch_link_map_offsets
(gdbarch, cris_linux_svr4_fetch_link_map_offsets);
diff --git a/gdb/d10v-tdep.c b/gdb/d10v-tdep.c
index f37f191..45ac682 100644
--- a/gdb/d10v-tdep.c
+++ b/gdb/d10v-tdep.c
@@ -25,6 +25,7 @@
#include "defs.h"
#include "frame.h"
#include "frame-unwind.h"
+#include "frame-base.h"
#include "symtab.h"
#include "gdbtypes.h"
#include "gdbcmd.h"
@@ -38,7 +39,7 @@
#include "language.h"
#include "arch-utils.h"
#include "regcache.h"
-
+#include "remote.h"
#include "floatformat.h"
#include "gdb/sim-d10v.h"
#include "sim-regno.h"
@@ -68,7 +69,7 @@ enum
{
R0_REGNUM = 0,
R3_REGNUM = 3,
- _FP_REGNUM = 11,
+ D10V_FP_REGNUM = 11,
LR_REGNUM = 13,
_SP_REGNUM = 15,
PSW_REGNUM = 16,
@@ -276,8 +277,8 @@ d10v_imap_register (int reg_nr)
static int
d10v_ts2_register_sim_regno (int nr)
{
- if (legacy_register_sim_regno (nr) < 0)
- return legacy_register_sim_regno (nr);
+ /* Only makes sense to supply raw registers. */
+ gdb_assert (nr >= 0 && nr < NUM_REGS);
if (nr >= TS2_IMAP0_REGNUM
&& nr < TS2_IMAP0_REGNUM + NR_IMAP_REGS)
return nr - TS2_IMAP0_REGNUM + SIM_D10V_IMAP0_REGNUM;
@@ -292,8 +293,8 @@ d10v_ts2_register_sim_regno (int nr)
static int
d10v_ts3_register_sim_regno (int nr)
{
- if (legacy_register_sim_regno (nr) < 0)
- return legacy_register_sim_regno (nr);
+ /* Only makes sense to supply raw registers. */
+ gdb_assert (nr >= 0 && nr < NUM_REGS);
if (nr >= TS3_IMAP0_REGNUM
&& nr < TS3_IMAP0_REGNUM + NR_IMAP_REGS)
return nr - TS3_IMAP0_REGNUM + SIM_D10V_IMAP0_REGNUM;
@@ -345,7 +346,7 @@ d10v_register_type (struct gdbarch *gdbarch, int reg_nr)
{
if (reg_nr == PC_REGNUM)
return builtin_type_void_func_ptr;
- if (reg_nr == _SP_REGNUM || reg_nr == _FP_REGNUM)
+ if (reg_nr == _SP_REGNUM || reg_nr == D10V_FP_REGNUM)
return builtin_type_void_data_ptr;
else if (reg_nr >= A0_REGNUM
&& reg_nr < (A0_REGNUM + NR_A_REGS))
@@ -437,18 +438,6 @@ d10v_integer_to_address (struct type *type, void *buf)
return val;
}
-/* Store the address of the place in which to copy the structure the
- subroutine will return. This is called from call_function.
-
- We store structs through a pointer passed in the first Argument
- register. */
-
-static void
-d10v_store_struct_return (CORE_ADDR addr, CORE_ADDR sp)
-{
- write_register (ARG1_REGNUM, (addr));
-}
-
/* Write into appropriate registers a function return value
of type TYPE, given in virtual format.
@@ -499,17 +488,6 @@ d10v_extract_struct_value_address (struct regcache *regcache)
return (addr | DMEM_START);
}
-/* Immediately after a function call, return the saved pc. We can't
- use frame->return_pc beause that is determined by reading R13 off
- the stack and that may not be written yet. */
-
-static CORE_ADDR
-d10v_saved_pc_after_call (struct frame_info *frame)
-{
- return ((read_register (LR_REGNUM) << 2)
- | IMEM_START);
-}
-
static int
check_prologue (unsigned short op)
{
@@ -610,6 +588,11 @@ d10v_skip_prologue (CORE_ADDR pc)
struct d10v_unwind_cache
{
CORE_ADDR return_pc;
+ /* The previous frame's inner most stack address. Used as this
+ frame ID's stack_addr. */
+ CORE_ADDR prev_sp;
+ /* The frame's base, optionally used by the high-level debug info. */
+ CORE_ADDR base;
int size;
CORE_ADDR *saved_regs;
/* How far the SP and r11 (FP) have been offset from the start of
@@ -703,32 +686,32 @@ prologue_find_regs (struct d10v_unwind_cache *info, unsigned short op,
for it IS the sp for the next frame. */
struct d10v_unwind_cache *
-d10v_frame_unwind_cache (struct frame_info *fi,
- void **cache)
+d10v_frame_unwind_cache (struct frame_info *next_frame,
+ void **this_prologue_cache)
{
- CORE_ADDR fp, pc;
+ CORE_ADDR pc;
+ ULONGEST prev_sp;
+ ULONGEST this_base;
unsigned long op;
unsigned short op1, op2;
int i;
struct d10v_unwind_cache *info;
- if ((*cache))
- return (*cache);
+ if ((*this_prologue_cache))
+ return (*this_prologue_cache);
info = FRAME_OBSTACK_ZALLOC (struct d10v_unwind_cache);
- (*cache) = info;
+ (*this_prologue_cache) = info;
info->saved_regs = frame_obstack_zalloc (SIZEOF_FRAME_SAVED_REGS);
info->size = 0;
info->return_pc = 0;
-
- fp = get_frame_base (fi);
info->sp_offset = 0;
- pc = get_pc_function_start (get_frame_pc (fi));
-
info->uses_frame = 0;
- while (1)
+ for (pc = frame_func_unwind (next_frame);
+ pc > 0 && pc < frame_pc_unwind (next_frame);
+ pc += 4)
{
op = (unsigned long) read_memory_integer (pc, 4);
if ((op & 0xC0000000) == 0xC0000000)
@@ -775,18 +758,47 @@ d10v_frame_unwind_cache (struct frame_info *fi,
|| !prologue_find_regs (info, op2, pc))
break;
}
- pc += 4;
}
info->size = -info->sp_offset;
- if (!(fp & 0xffff))
- fp = d10v_read_sp ();
+ /* Compute the frame's base, and the previous frame's SP. */
+ if (info->uses_frame)
+ {
+ /* The SP was moved to the FP. This indicates that a new frame
+ was created. Get THIS frame's FP value by unwinding it from
+ the next frame. */
+ frame_unwind_unsigned_register (next_frame, D10V_FP_REGNUM, &this_base);
+ /* The FP points at the last saved register. Adjust the FP back
+ to before the first saved register giving the SP. */
+ prev_sp = this_base + info->size;
+ }
+ else if (info->saved_regs[SP_REGNUM])
+ {
+ /* The SP was saved (which is very unusual), the frame base is
+ just the PREV's frame's TOP-OF-STACK. */
+ this_base = read_memory_unsigned_integer (info->saved_regs[SP_REGNUM],
+ register_size (current_gdbarch,
+ SP_REGNUM));
+ prev_sp = this_base;
+ }
+ else
+ {
+ /* Assume that the FP is this frame's SP but with that pushed
+ stack space added back. */
+ frame_unwind_unsigned_register (next_frame, SP_REGNUM, &this_base);
+ prev_sp = this_base + info->size;
+ }
+
+ info->base = d10v_make_daddr (this_base);
+ info->prev_sp = d10v_make_daddr (prev_sp);
+ /* Adjust all the saved registers so that they contain addresses and
+ not offsets. */
for (i = 0; i < NUM_REGS - 1; i++)
if (info->saved_regs[i])
{
- info->saved_regs[i] = fp - (info->sp_offset - info->saved_regs[i]);
+ info->saved_regs[i] = (info->prev_sp + info->saved_regs[i]);
}
if (info->saved_regs[LR_REGNUM])
@@ -799,24 +811,13 @@ d10v_frame_unwind_cache (struct frame_info *fi,
else
{
ULONGEST return_pc;
- frame_read_unsigned_register (fi, LR_REGNUM, &return_pc);
+ frame_unwind_unsigned_register (next_frame, LR_REGNUM, &return_pc);
info->return_pc = d10v_make_iaddr (return_pc);
}
- /* The SP is not normally (ever?) saved, but check anyway */
- if (!info->saved_regs[SP_REGNUM])
- {
- /* if the FP was saved, that means the current FP is valid, */
- /* otherwise, it isn't being used, so we use the SP instead */
- if (info->uses_frame)
- info->saved_regs[SP_REGNUM]
- = d10v_read_fp () + info->size;
- else
- {
- info->saved_regs[SP_REGNUM] = fp + info->size;
- info->saved_regs[FP_REGNUM] = 0;
- }
- }
+ /* The SP_REGNUM is special. Instead of the address of the SP, the
+ previous frame's SP value is saved. */
+ info->saved_regs[SP_REGNUM] = info->prev_sp;
return info;
}
@@ -940,30 +941,12 @@ d10v_read_sp (void)
return (d10v_make_daddr (read_register (SP_REGNUM)));
}
-static void
-d10v_write_sp (CORE_ADDR val)
-{
- write_register (SP_REGNUM, d10v_convert_daddr_to_raw (val));
-}
-
static CORE_ADDR
d10v_read_fp (void)
{
- return (d10v_make_daddr (read_register (FP_REGNUM)));
+ return (d10v_make_daddr (read_register (D10V_FP_REGNUM)));
}
-/* Function: push_return_address (pc)
- Set up the return address for the inferior function call.
- Needed for targets where we don't actually execute a JSR/BSR instruction */
-
-static CORE_ADDR
-d10v_push_return_address (CORE_ADDR pc, CORE_ADDR sp)
-{
- write_register (LR_REGNUM, d10v_convert_iaddr_to_raw (CALL_DUMMY_ADDRESS ()));
- return sp;
-}
-
-
/* When arguments must be pushed onto the stack, they go on in reverse
order. The below implements a FILO (stack) to do this. */
@@ -1001,21 +984,28 @@ pop_stack_item (struct stack_item *si)
static CORE_ADDR
-d10v_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
- int struct_return, CORE_ADDR struct_addr)
+d10v_push_dummy_call (struct gdbarch *gdbarch, struct regcache *regcache,
+ CORE_ADDR dummy_addr, int nargs, struct value **args,
+ CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr)
{
int i;
int regnum = ARG1_REGNUM;
struct stack_item *si = NULL;
long val;
- /* If struct_return is true, then the struct return address will
- consume one argument-passing register. No need to actually
- write the value to the register -- that's done by
- d10v_store_struct_return(). */
+ /* Set the return address. For the d10v, the return breakpoint is
+ always at DUMMY_ADDR. */
+ regcache_cooked_write_unsigned (regcache, LR_REGNUM,
+ d10v_convert_iaddr_to_raw (dummy_addr));
+ /* If STRUCT_RETURN is true, then the struct return address (in
+ STRUCT_ADDR) will consume the first argument-passing register.
+ Both adjust the register count and store that value. */
if (struct_return)
- regnum++;
+ {
+ regcache_cooked_write_unsigned (regcache, regnum, struct_addr);
+ regnum++;
+ }
/* Fill in registers and arg lists */
for (i = 0; i < nargs; i++)
@@ -1031,7 +1021,7 @@ d10v_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
/* fits in a single register, do not align */
{
val = extract_unsigned_integer (contents, len);
- write_register (regnum++, val);
+ regcache_cooked_write_unsigned (regcache, regnum++, val);
}
else if (len <= (ARGN_REGNUM - aligned_regnum + 1) * 2)
/* value fits in remaining registers, store keeping left
@@ -1042,12 +1032,12 @@ d10v_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
for (b = 0; b < (len & ~1); b += 2)
{
val = extract_unsigned_integer (&contents[b], 2);
- write_register (regnum++, val);
+ regcache_cooked_write_unsigned (regcache, regnum++, val);
}
if (b < len)
{
val = extract_unsigned_integer (&contents[b], 1);
- write_register (regnum++, (val << 8));
+ regcache_cooked_write_unsigned (regcache, regnum++, (val << 8));
}
}
else
@@ -1065,6 +1055,10 @@ d10v_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
si = pop_stack_item (si);
}
+ /* Finally, update the SP register. */
+ regcache_cooked_write_unsigned (regcache, SP_REGNUM,
+ d10v_convert_daddr_to_raw (sp));
+
return sp;
}
@@ -1337,26 +1331,29 @@ tdisassemble_command (char *arg, int from_tty)
{
int i, count;
CORE_ADDR low, high;
- char *space_index;
if (!arg)
{
low = 0;
high = trace_data.size;
}
- else if (!(space_index = (char *) strchr (arg, ' ')))
- {
- low = parse_and_eval_address (arg);
- high = low + 5;
- }
else
- {
- /* Two arguments. */
- *space_index = '\0';
- low = parse_and_eval_address (arg);
- high = parse_and_eval_address (space_index + 1);
- if (high < low)
- high = low;
+ {
+ char *space_index = strchr (arg, ' ');
+ if (space_index == NULL)
+ {
+ low = parse_and_eval_address (arg);
+ high = low + 5;
+ }
+ else
+ {
+ /* Two arguments. */
+ *space_index = '\0';
+ low = parse_and_eval_address (arg);
+ high = parse_and_eval_address (space_index + 1);
+ if (high < low)
+ high = low;
+ }
}
printf_filtered ("Dump of trace from %s to %s:\n", paddr_u (low), paddr_u (high));
@@ -1424,71 +1421,65 @@ display_trace (int low, int high)
}
}
-
static CORE_ADDR
-d10v_frame_pc_unwind (struct frame_info *frame,
- void **cache)
+d10v_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
{
- struct d10v_unwind_cache *info = d10v_frame_unwind_cache (frame, cache);
- return info->return_pc;
+ ULONGEST pc;
+ frame_unwind_unsigned_register (next_frame, PC_REGNUM, &pc);
+ return d10v_make_iaddr (pc);
}
/* Given a GDB frame, determine the address of the calling function's
frame. This will be used to create a new GDB frame struct. */
static void
-d10v_frame_id_unwind (struct frame_info *frame,
- void **cache,
- struct frame_id *id)
-{
- struct d10v_unwind_cache *info = d10v_frame_unwind_cache (frame, cache);
- CORE_ADDR addr;
-
- /* Start with a NULL frame ID. */
- (*id) = null_frame_id;
-
- if (info->return_pc == IMEM_START
- || info->return_pc <= IMEM_START
- || inside_entry_file (info->return_pc))
- {
- /* This is meant to halt the backtrace at "_start".
- Make sure we don't halt it at a generic dummy frame. */
- return;
- }
+d10v_frame_this_id (struct frame_info *next_frame,
+ void **this_prologue_cache,
+ struct frame_id *this_id)
+{
+ struct d10v_unwind_cache *info
+ = d10v_frame_unwind_cache (next_frame, this_prologue_cache);
+ CORE_ADDR base;
+ CORE_ADDR func;
+ struct frame_id id;
+
+ /* The FUNC is easy. */
+ func = frame_func_unwind (next_frame);
+
+ /* This is meant to halt the backtrace at "_start". Make sure we
+ don't halt it at a generic dummy frame. */
+ if (func <= IMEM_START || inside_entry_file (func))
+ return;
- if (!info->saved_regs[FP_REGNUM])
- {
- if (!info->saved_regs[SP_REGNUM]
- || info->saved_regs[SP_REGNUM] == STACK_START)
- return;
+ /* Hopefully the prologue analysis either correctly determined the
+ frame's base (which is the SP from the previous frame), or set
+ that base to "NULL". */
+ base = info->prev_sp;
+ if (base == STACK_START || base == 0)
+ return;
- id->base = info->saved_regs[SP_REGNUM];
- id->pc = info->return_pc;
- }
+ id = frame_id_build (base, func);
- addr = read_memory_unsigned_integer (info->saved_regs[FP_REGNUM],
- register_size (current_gdbarch, FP_REGNUM));
- if (addr == 0)
+ /* Check that we're not going round in circles with the same frame
+ ID (but avoid applying the test to sentinel frames which do go
+ round in circles). Can't use frame_id_eq() as that doesn't yet
+ compare the frame's PC value. */
+ if (frame_relative_level (next_frame) >= 0
+ && get_frame_type (next_frame) != DUMMY_FRAME
+ && frame_id_eq (get_frame_id (next_frame), id))
return;
- id->base = d10v_make_daddr (addr);
- id->pc = info->return_pc;
+ (*this_id) = id;
}
static void
-saved_regs_unwinder (struct frame_info *frame,
- CORE_ADDR *saved_regs,
+saved_regs_unwinder (struct frame_info *next_frame,
+ CORE_ADDR *this_saved_regs,
int regnum, int *optimizedp,
enum lval_type *lvalp, CORE_ADDR *addrp,
int *realnump, void *bufferp)
{
- /* If we're using generic dummy frames, we'd better not be in a call
- dummy. (generic_call_dummy_register_unwind ought to have been called
- instead.) */
- gdb_assert (!(DEPRECATED_USE_GENERIC_DUMMY_FRAMES
- && (get_frame_type (frame) == DUMMY_FRAME)));
-
- if (saved_regs[regnum] != 0)
+ if (this_saved_regs[regnum] != 0)
{
if (regnum == SP_REGNUM)
{
@@ -1499,7 +1490,7 @@ saved_regs_unwinder (struct frame_info *frame,
*realnump = -1;
if (bufferp != NULL)
store_address (bufferp, register_size (current_gdbarch, regnum),
- saved_regs[regnum]);
+ this_saved_regs[regnum]);
}
else
{
@@ -1507,12 +1498,12 @@ saved_regs_unwinder (struct frame_info *frame,
a local copy of its value. */
*optimizedp = 0;
*lvalp = lval_memory;
- *addrp = saved_regs[regnum];
+ *addrp = this_saved_regs[regnum];
*realnump = -1;
if (bufferp != NULL)
{
/* Read the value in from memory. */
- read_memory (saved_regs[regnum], bufferp,
+ read_memory (this_saved_regs[regnum], bufferp,
register_size (current_gdbarch, regnum));
}
}
@@ -1523,66 +1514,39 @@ saved_regs_unwinder (struct frame_info *frame,
value. If a value is needed, pass the request on down the chain;
otherwise just return an indication that the value is in the same
register as the next frame. */
- frame_register (frame, regnum, optimizedp, lvalp, addrp,
- realnump, bufferp);
-}
-
-
-static void
-d10v_frame_register_unwind (struct frame_info *frame,
- void **cache,
- int regnum, int *optimizedp,
- enum lval_type *lvalp, CORE_ADDR *addrp,
- int *realnump, void *bufferp)
-{
- struct d10v_unwind_cache *info = d10v_frame_unwind_cache (frame, cache);
- saved_regs_unwinder (frame, info->saved_regs, regnum, optimizedp,
- lvalp, addrp, realnump, bufferp);
+ frame_register_unwind (next_frame, regnum, optimizedp, lvalp, addrp,
+ realnump, bufferp);
}
static void
-d10v_frame_pop (struct frame_info *fi, void **unwind_cache,
- struct regcache *regcache)
-{
- struct d10v_unwind_cache *info = d10v_frame_unwind_cache (fi, unwind_cache);
- CORE_ADDR fp;
- int regnum;
- char raw_buffer[8];
-
- fp = get_frame_base (fi);
-
- /* now update the current registers with the old values */
- for (regnum = A0_REGNUM; regnum < A0_REGNUM + NR_A_REGS; regnum++)
+d10v_frame_prev_register (struct frame_info *next_frame,
+ void **this_prologue_cache,
+ int regnum, int *optimizedp,
+ enum lval_type *lvalp, CORE_ADDR *addrp,
+ int *realnump, void *bufferp)
+{
+ struct d10v_unwind_cache *info
+ = d10v_frame_unwind_cache (next_frame, this_prologue_cache);
+ if (regnum == PC_REGNUM)
{
- frame_unwind_register (fi, regnum, raw_buffer);
- regcache_cooked_write (regcache, regnum, raw_buffer);
+ /* The call instruction saves the caller's PC in LR. The
+ function prologue of the callee may then save the LR on the
+ stack. Find that possibly saved LR value and return it. */
+ saved_regs_unwinder (next_frame, info->saved_regs, LR_REGNUM, optimizedp,
+ lvalp, addrp, realnump, bufferp);
}
- for (regnum = 0; regnum < SP_REGNUM; regnum++)
+ else
{
- frame_unwind_register (fi, regnum, raw_buffer);
- regcache_cooked_write (regcache, regnum, raw_buffer);
+ saved_regs_unwinder (next_frame, info->saved_regs, regnum, optimizedp,
+ lvalp, addrp, realnump, bufferp);
}
- frame_unwind_register (fi, PSW_REGNUM, raw_buffer);
- regcache_cooked_write (regcache, PSW_REGNUM, raw_buffer);
-
- frame_unwind_register (fi, LR_REGNUM, raw_buffer);
- regcache_cooked_write (regcache, PC_REGNUM, raw_buffer);
-
- store_unsigned_integer (raw_buffer,
- register_size (current_gdbarch, SP_REGNUM),
- fp + info->size);
- regcache_cooked_write (regcache, SP_REGNUM, raw_buffer);
-
- target_store_registers (-1);
- flush_cached_frames ();
}
-static struct frame_unwind d10v_frame_unwind = {
- d10v_frame_pop,
- d10v_frame_pc_unwind,
- d10v_frame_id_unwind,
- d10v_frame_register_unwind
+static const struct frame_unwind d10v_frame_unwind = {
+ NORMAL_FRAME,
+ d10v_frame_this_id,
+ d10v_frame_prev_register
};
const struct frame_unwind *
@@ -1591,13 +1555,39 @@ d10v_frame_p (CORE_ADDR pc)
return &d10v_frame_unwind;
}
+static CORE_ADDR
+d10v_frame_base_address (struct frame_info *next_frame, void **this_cache)
+{
+ struct d10v_unwind_cache *info
+ = d10v_frame_unwind_cache (next_frame, this_cache);
+ return info->base;
+}
+
+static const struct frame_base d10v_frame_base = {
+ &d10v_frame_unwind,
+ d10v_frame_base_address,
+ d10v_frame_base_address,
+ d10v_frame_base_address
+};
+
+/* Assuming NEXT_FRAME->prev is a dummy, return the frame ID of that
+ dummy frame. The frame ID's base needs to match the TOS value
+ saved by save_dummy_frame_tos(), and the PC match the dummy frame's
+ breakpoint. */
+
+static struct frame_id
+d10v_unwind_dummy_id (struct gdbarch *gdbarch, struct frame_info *next_frame)
+{
+ ULONGEST base;
+ frame_unwind_unsigned_register (next_frame, SP_REGNUM, &base);
+ return frame_id_build (d10v_make_daddr (base), frame_pc_unwind (next_frame));
+}
+
static gdbarch_init_ftype d10v_gdbarch_init;
static struct gdbarch *
d10v_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
{
- static LONGEST d10v_call_dummy_words[] =
- {0};
struct gdbarch *gdbarch;
int d10v_num_regs;
struct gdbarch_tdep *tdep;
@@ -1641,11 +1631,9 @@ d10v_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_write_pc (gdbarch, d10v_write_pc);
set_gdbarch_read_fp (gdbarch, d10v_read_fp);
set_gdbarch_read_sp (gdbarch, d10v_read_sp);
- set_gdbarch_write_sp (gdbarch, d10v_write_sp);
set_gdbarch_num_regs (gdbarch, d10v_num_regs);
set_gdbarch_sp_regnum (gdbarch, 15);
- set_gdbarch_fp_regnum (gdbarch, 11);
set_gdbarch_pc_regnum (gdbarch, 18);
set_gdbarch_register_name (gdbarch, d10v_register_name);
set_gdbarch_register_size (gdbarch, 2);
@@ -1686,22 +1674,8 @@ d10v_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
"d10v_gdbarch_init: bad byte order for float format");
}
- set_gdbarch_call_dummy_length (gdbarch, 0);
- set_gdbarch_call_dummy_address (gdbarch, entry_point_address);
- set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 1);
- set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 0);
- set_gdbarch_call_dummy_start_offset (gdbarch, 0);
- set_gdbarch_call_dummy_words (gdbarch, d10v_call_dummy_words);
- set_gdbarch_sizeof_call_dummy_words (gdbarch, sizeof (d10v_call_dummy_words));
- set_gdbarch_call_dummy_p (gdbarch, 1);
- set_gdbarch_call_dummy_stack_adjust_p (gdbarch, 0);
- set_gdbarch_fix_call_dummy (gdbarch, generic_fix_call_dummy);
-
set_gdbarch_extract_return_value (gdbarch, d10v_extract_return_value);
- set_gdbarch_push_arguments (gdbarch, d10v_push_arguments);
- set_gdbarch_push_return_address (gdbarch, d10v_push_return_address);
-
- set_gdbarch_store_struct_return (gdbarch, d10v_store_struct_return);
+ set_gdbarch_push_dummy_call (gdbarch, d10v_push_dummy_call);
set_gdbarch_store_return_value (gdbarch, d10v_store_return_value);
set_gdbarch_extract_struct_value_address (gdbarch, d10v_extract_struct_value_address);
set_gdbarch_use_struct_convention (gdbarch, d10v_use_struct_convention);
@@ -1717,23 +1691,25 @@ d10v_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_frame_args_skip (gdbarch, 0);
set_gdbarch_frameless_function_invocation (gdbarch, frameless_look_for_prologue);
- set_gdbarch_saved_pc_after_call (gdbarch, d10v_saved_pc_after_call);
set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown);
set_gdbarch_stack_align (gdbarch, d10v_stack_align);
set_gdbarch_register_sim_regno (gdbarch, d10v_register_sim_regno);
- set_gdbarch_extra_stack_alignment_needed (gdbarch, 0);
set_gdbarch_print_registers_info (gdbarch, d10v_print_registers_info);
frame_unwind_append_predicate (gdbarch, d10v_frame_p);
+ frame_base_set_default (gdbarch, &d10v_frame_base);
- return gdbarch;
-}
+ /* Methods for saving / extracting a dummy frame's ID. */
+ set_gdbarch_unwind_dummy_id (gdbarch, d10v_unwind_dummy_id);
+ set_gdbarch_save_dummy_frame_tos (gdbarch, generic_save_dummy_frame_tos);
+ /* Return the unwound PC value. */
+ set_gdbarch_unwind_pc (gdbarch, d10v_unwind_pc);
-extern void (*target_resume_hook) (void);
-extern void (*target_wait_loop_hook) (void);
+ return gdbarch;
+}
void
_initialize_d10v_tdep (void)
diff --git a/gdb/defs.h b/gdb/defs.h
index 5b97dbe..9d41c62 100644
--- a/gdb/defs.h
+++ b/gdb/defs.h
@@ -1012,6 +1012,8 @@ enum gdb_osabi
GDB_OSABI_ARM_APCS,
GDB_OSABI_QNXNTO,
+ GDB_OSABI_CYGWIN,
+
GDB_OSABI_INVALID /* keep this last */
};
diff --git a/gdb/disasm.c b/gdb/disasm.c
index 75d1783..511855b 100644
--- a/gdb/disasm.c
+++ b/gdb/disasm.c
@@ -93,14 +93,15 @@ dump_insns (struct ui_out *uiout, disassemble_info * di,
/* parts of the symbolic representation of the address */
int unmapped;
- char *filename = NULL;
- char *name = NULL;
int offset;
int line;
struct cleanup *ui_out_chain;
for (pc = low; pc < high;)
{
+ char *filename = NULL;
+ char *name = NULL;
+
QUIT;
if (how_many >= 0)
{
@@ -338,11 +339,8 @@ gdb_disassembly (struct ui_out *uiout,
di_initialized = 1;
}
- di.mach = TARGET_PRINT_INSN_INFO->mach;
- if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
- di.endian = BFD_ENDIAN_BIG;
- else
- di.endian = BFD_ENDIAN_LITTLE;
+ di.mach = gdbarch_bfd_arch_info (current_gdbarch)->mach;
+ di.endian = gdbarch_byte_order (current_gdbarch);
/* If gdb_disassemble_from_exec == -1, then we use the following heuristic to
determine whether or not to do disassembly from target memory or from the
@@ -361,7 +359,8 @@ gdb_disassembly (struct ui_out *uiout,
if (strcmp (target_shortname, "child") == 0
|| strcmp (target_shortname, "procfs") == 0
|| strcmp (target_shortname, "vxprocess") == 0
- || strstr (target_shortname, "-threads") != NULL)
+ || strcmp (target_shortname, "core") == 0
+ || strstr (target_shortname, "-thread") != NULL)
gdb_disassemble_from_exec = 0; /* It's a child process, read inferior mem */
else
gdb_disassemble_from_exec = 1; /* It's remote, read the exec file */
diff --git a/gdb/disasm.h b/gdb/disasm.h
index beaaf4a..6a6df7e 100644
--- a/gdb/disasm.h
+++ b/gdb/disasm.h
@@ -21,6 +21,8 @@
#ifndef DISASM_H
#define DISASM_H
+struct ui_out;
+
extern void gdb_disassembly (struct ui_out *uiout,
char *file_string,
int line_num,
diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog
index dbdd1ba..473eb15 100644
--- a/gdb/doc/ChangeLog
+++ b/gdb/doc/ChangeLog
@@ -1,3 +1,120 @@
+2003-04-09 Jim Blandy <jimb@redhat.com>
+
+ * gdb.texinfo (Symbols): Document 'maint list symtabs' and 'maint
+ list psymtabs'.
+
+2003-04-08 Andrew Cagney <cagney@redhat.com>
+
+ * gdbint.texinfo (Target Architecture Definition): Delete
+ references to EXTRA_FRAME_INFO.
+
+2003-04-08 Andrew Cagney <cagney@redhat.com>
+
+ * gdbint.texinfo (Target Architecture Definition): Delete
+ PRINT_TYPELESS_INTEGER.
+
+2003-04-02 J. Brobecker <brobecker@gnat.com>
+
+ * observer.texi (GDB Observers): Adjust the documentation for the
+ normal_stop notification to better describe reality. Fix a couple
+ of minor typos.
+
+2003-04-02 Bob Rossi <bob_rossi@cox.net>
+
+ * gdb.texinfo (GDB/MI Program Control): Add
+ '-file-list-exec-source-file'
+
+2003-03-31 Andrew Cagney <cagney@redhat.com>
+
+ * gdbint.texinfo (Target Architecture Definition): Delete
+ references to CALL_DUMMY_P.
+
+2003-03-30 Andrew Cagney <cagney@redhat.com>
+
+ * gdbint.texinfo (Target Architecture Definition): Remove
+ reference to TARGET_WRITE_SP.
+
+2003-03-27 Andrew Cagney <cagney@redhat.com>
+
+ * gdbint.texinfo (Target Architecture Definition): Remove
+ references to write_sp.
+
+2003-03-27 Andrew Cagney <cagney@redhat.com>
+
+ * gdb.texinfo (GDB/MI Variable Objects): Replace @include with
+ chapter body. Use @smallexample instead of @example.
+ (Annotations): Ditto.
+ * Makefile.in (GDB_DOC_SOURCE_INCLUDES): Remove gdbmi.texinfo and
+ annotate.texi.
+
+2003-03-26 Andrew Cagney <cagney@redhat.com>
+
+ * gdbint.texinfo (Target Architecture Definition): Replace
+ PUSH_ARGUMENTS with push_dummy_call, add gdbarch, regcache and
+ dummy_addr parameters.
+
+2003-03-25 Andrew Cagney <cagney@redhat.com>
+
+ * gdbint.texinfo (Target Architecture Definition): Delete
+ reference to CALL_DUMMY_STACK_ADJUST_P. Rename
+ CALL_DUMMY_STACK_ADJUST to DEPRECATED_CALL_DUMMY_STACK_ADJUST.
+ Add reference to PUSH_ARGUMENTS.
+
+2003-03-23 Andrew Cagney <cagney@redhat.com>
+
+ * gdbint.texinfo (Algorithms, Target Architecture Definition):
+ Deprecate FRAME_CHAIN and FRAME_CHAIN_VALID.
+
+2003-03-18 J. Brobecker <brobecker@gnat.com>
+
+ * gdbint.texinfo (Algorithms): Add new section describing the
+ Observer paradigm.
+ (Top): Add menu entry to new observer appendix.
+ * observer.texi: New file.
+ * Makefile.in (GDBINT_DOC_SOURCE_INCLUDES): Add dependency on
+ new observer.texi file.
+
+2003-03-17 Andrew Cagney <cagney@redhat.com>
+
+ * gdb.texinfo (DATE): Delete. Remove date from titles. Mention
+ that GNU Press update the manual version number.
+
+2003-03-12 Andrew Cagney <cagney@redhat.com>
+
+ * gdbint.texinfo (Target Architecture Definition): Delete
+ references to get_saved_register. Rename GET_SAVED_REGISTER to
+ DEPRECATED_GET_SAVED_REGISTER.
+
+2003-03-13 Andrew Cagney <cagney@redhat.com>
+
+ * gdbint.texinfo (Target Architecture Definition): Replace
+ POP_FRAME with DEPRECATED_POP_FRAME. Update description.
+
+2003-03-12 Andrew Cagney <cagney@redhat.com>
+
+ * gdbint.texinfo (Target Architecture Definition): Rename
+ FRAME_SAVED_PC to DEPRECATED_FRAME_SAVED_PC.
+
+2003-03-10 Corinna Vinschen <vinschen@redhat.com>
+
+ * gdb.texinfo: Add File-I/O documentation.
+
+2003-03-10 Andrew Cagney <cagney@redhat.com>
+
+ * gdbint.texinfo (Target Architecture Definition): Cross reference
+ FRAME_SAVED_PC to unwind_pc. Document unwind_pc.
+
+2003-03-07 Andrew Cagney <cagney@redhat.com>
+
+ * gdb.texinfo (Debugging Output): Mention the "set/show debug
+ frame" command.
+
+2003-03-05 Andrew Cagney <cagney@redhat.com>
+
+ * gdbint.texinfo (Target Architecture Definition): Document
+ unwind_dummy_id. Cross reference unwind_dummy_id and
+ SAVE_DUMMY_FRAME_TOS.
+
2003-03-05 James Ingham <jingham@apple.com>
Daniel Jacobowitz <drow@mvista.com>
diff --git a/gdb/doc/Makefile.in b/gdb/doc/Makefile.in
index 1d5ad3e..5221314 100644
--- a/gdb/doc/Makefile.in
+++ b/gdb/doc/Makefile.in
@@ -98,10 +98,8 @@ DVIPS = dvips
# Main GDB manual
GDB_DOC_SOURCE_INCLUDES = \
- $(srcdir)/annotate.texi \
$(srcdir)/fdl.texi \
$(srcdir)/gpl.texi \
- $(GDBMI_DIR)/gdbmi.texinfo \
$(READLINE_DIR)/rluser.texinfo \
$(READLINE_DIR)/inc-hist.texinfo
GDB_DOC_BUILD_INCLUDES = \
@@ -114,7 +112,8 @@ GDB_DOC_FILES = \
# Internals Manual
GDBINT_DOC_SOURCE_INCLUDES = \
- $(srcdir)/fdl.texi
+ $(srcdir)/fdl.texi \
+ $(srcdir)/observer.texi
GDBINT_DOC_BUILD_INCLUDES = \
gdb-cfg.texi \
GDBvn.texi
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 25c0a93..00a4ac7 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -28,11 +28,9 @@
@syncodeindex fn cp
@c !!set GDB manual's edition---not the same as GDB version!
+@c This is updated by GNU Press.
@set EDITION Ninth
-@c !!set GDB manual's revision date
-@set DATE June 2002
-
@c !!set GDB edit command default editor
@set EDITOR /bin/ex
@@ -49,9 +47,9 @@
This file documents the @sc{gnu} debugger @value{GDBN}.
-This is the @value{EDITION} Edition, @value{DATE},
-of @cite{Debugging with @value{GDBN}: the @sc{gnu} Source-Level Debugger}
-for @value{GDBN} Version @value{GDBVN}.
+This is the @value{EDITION} Edition, of @cite{Debugging with
+@value{GDBN}: the @sc{gnu} Source-Level Debugger} for @value{GDBN}
+Version @value{GDBVN}.
Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998,@*
1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
@@ -74,7 +72,6 @@ development.''
@subtitle The @sc{gnu} Source-Level Debugger
@sp 1
@subtitle @value{EDITION} Edition, for @value{GDBN} version @value{GDBVN}
-@subtitle @value{DATE}
@author Richard Stallman, Roland Pesch, Stan Shebs, et al.
@page
@tex
@@ -115,7 +112,7 @@ development.''
This file describes @value{GDBN}, the @sc{gnu} symbolic debugger.
-This is the @value{EDITION} Edition, @value{DATE}, for @value{GDBN} Version
+This is the @value{EDITION} Edition, for @value{GDBN} Version
@value{GDBVN}.
Copyright (C) 1988-2003 Free Software Foundation, Inc.
@@ -9036,8 +9033,66 @@ files that @value{GDBN} has skimmed, but not yet read completely. Finally,
required for each object file from which @value{GDBN} has read some symbols.
@xref{Files, ,Commands to specify files}, for a discussion of how
@value{GDBN} reads symbols (in the description of @code{symbol-file}).
+
+@kindex maint list symtabs
+@kindex maint list psymtabs
+@cindex listing @value{GDBN}'s internal symbol tables
+@cindex symbol tables, listing @value{GDBN}'s internal
+@cindex full symbol tables, listing @value{GDBN}'s internal
+@cindex partial symbol tables, listing @value{GDBN}'s internal
+@item maint list symtabs @r{[} @var{regexp} @r{]}
+@itemx maint list psymtabs @r{[} @var{regexp} @r{]}
+
+List the @code{struct symtab} or @code{struct partial_symtab}
+structures whose names match @var{regexp}. If @var{regexp} is not
+given, list them all. The output includes expressions which you can
+copy into a @value{GDBN} debugging this one to examine a particular
+structure in more detail. For example:
+
+@smallexample
+(@value{GDBP}) maint list psymtabs dwarf2read
+@{ objfile /home/gnu/build/gdb/gdb
+ ((struct objfile *) 0x82e69d0)
+ @{ psymtab /home/gnu/src/gdb/dwarf2read.c
+ ((struct partial_symtab *) 0x8474b10)
+ readin no
+ fullname (null)
+ text addresses 0x814d3c8 -- 0x8158074
+ globals (* (struct partial_symbol **) 0x8507a08 @@ 9)
+ statics (* (struct partial_symbol **) 0x40e95b78 @@ 2882)
+ dependencies (none)
+ @}
+@}
+(@value{GDBP}) maint list symtabs
+(@value{GDBP})
+@end smallexample
+@noindent
+We see that there is one partial symbol table whose filename contains
+the string @samp{dwarf2read}, belonging to the @samp{gdb} executable;
+and we see that @value{GDBN} has not read in any symtabs yet at all.
+If we set a breakpoint on a function, that will cause @value{GDBN} to
+read the symtab for the compilation unit containing that function:
+
+@smallexample
+(@value{GDBP}) break dwarf2_psymtab_to_symtab
+Breakpoint 1 at 0x814e5da: file /home/gnu/src/gdb/dwarf2read.c,
+line 1574.
+(@value{GDBP}) maint list symtabs
+@{ objfile /home/gnu/build/gdb/gdb
+ ((struct objfile *) 0x82e69d0)
+ @{ symtab /home/gnu/src/gdb/dwarf2read.c
+ ((struct symtab *) 0x86c1f38)
+ dirname (null)
+ fullname (null)
+ blockvector ((struct blockvector *) 0x86c1bd0) (primary)
+ debugformat DWARF 2
+ @}
+@}
+(@value{GDBP})
+@end smallexample
@end table
+
@node Altering
@chapter Altering Execution
@@ -12973,6 +13028,14 @@ default is off.
@item show debug expression
Displays the current state of displaying @value{GDBN} expression
debugging info.
+@kindex set debug frame
+@item set debug frame
+Turns on or off display of @value{GDBN} frame debugging info. The
+default is off.
+@kindex show debug frame
+@item show debug frame
+Displays the current state of displaying @value{GDBN} frame debugging
+info.
@kindex set debug overload
@item set debug overload
Turns on or off display of @value{GDBN} C@t{++} overload debugging
@@ -14040,8 +14103,4570 @@ environment. Users of this environment can use a new command,
each value is printed in its own window.
@end ignore
-@include annotate.texi
-@include gdbmi.texinfo
+
+@node GDB/MI
+@chapter The @sc{gdb/mi} Interface
+
+@unnumberedsec Function and Purpose
+
+@cindex @sc{gdb/mi}, its purpose
+@sc{gdb/mi} is a line based machine oriented text interface to @value{GDBN}. It is
+specifically intended to support the development of systems which use
+the debugger as just one small component of a larger system.
+
+This chapter is a specification of the @sc{gdb/mi} interface. It is written
+in the form of a reference manual.
+
+Note that @sc{gdb/mi} is still under construction, so some of the
+features described below are incomplete and subject to change.
+
+@unnumberedsec Notation and Terminology
+
+@cindex notational conventions, for @sc{gdb/mi}
+This chapter uses the following notation:
+
+@itemize @bullet
+@item
+@code{|} separates two alternatives.
+
+@item
+@code{[ @var{something} ]} indicates that @var{something} is optional:
+it may or may not be given.
+
+@item
+@code{( @var{group} )*} means that @var{group} inside the parentheses
+may repeat zero or more times.
+
+@item
+@code{( @var{group} )+} means that @var{group} inside the parentheses
+may repeat one or more times.
+
+@item
+@code{"@var{string}"} means a literal @var{string}.
+@end itemize
+
+@ignore
+@heading Dependencies
+@end ignore
+
+@heading Acknowledgments
+
+In alphabetic order: Andrew Cagney, Fernando Nasser, Stan Shebs and
+Elena Zannoni.
+
+@menu
+* GDB/MI Command Syntax::
+* GDB/MI Compatibility with CLI::
+* GDB/MI Output Records::
+* GDB/MI Command Description Format::
+* GDB/MI Breakpoint Table Commands::
+* GDB/MI Data Manipulation::
+* GDB/MI Program Control::
+* GDB/MI Miscellaneous Commands::
+@ignore
+* GDB/MI Kod Commands::
+* GDB/MI Memory Overlay Commands::
+* GDB/MI Signal Handling Commands::
+@end ignore
+* GDB/MI Stack Manipulation::
+* GDB/MI Symbol Query::
+* GDB/MI Target Manipulation::
+* GDB/MI Thread Commands::
+* GDB/MI Tracepoint Commands::
+* GDB/MI Variable Objects::
+@end menu
+
+@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+@node GDB/MI Command Syntax
+@section @sc{gdb/mi} Command Syntax
+
+@menu
+* GDB/MI Input Syntax::
+* GDB/MI Output Syntax::
+* GDB/MI Simple Examples::
+@end menu
+
+@node GDB/MI Input Syntax
+@subsection @sc{gdb/mi} Input Syntax
+
+@cindex input syntax for @sc{gdb/mi}
+@cindex @sc{gdb/mi}, input syntax
+@table @code
+@item @var{command} @expansion{}
+@code{@var{cli-command} | @var{mi-command}}
+
+@item @var{cli-command} @expansion{}
+@code{[ @var{token} ] @var{cli-command} @var{nl}}, where
+@var{cli-command} is any existing @value{GDBN} CLI command.
+
+@item @var{mi-command} @expansion{}
+@code{[ @var{token} ] "-" @var{operation} ( " " @var{option} )*
+@code{[} " --" @code{]} ( " " @var{parameter} )* @var{nl}}
+
+@item @var{token} @expansion{}
+"any sequence of digits"
+
+@item @var{option} @expansion{}
+@code{"-" @var{parameter} [ " " @var{parameter} ]}
+
+@item @var{parameter} @expansion{}
+@code{@var{non-blank-sequence} | @var{c-string}}
+
+@item @var{operation} @expansion{}
+@emph{any of the operations described in this chapter}
+
+@item @var{non-blank-sequence} @expansion{}
+@emph{anything, provided it doesn't contain special characters such as
+"-", @var{nl}, """ and of course " "}
+
+@item @var{c-string} @expansion{}
+@code{""" @var{seven-bit-iso-c-string-content} """}
+
+@item @var{nl} @expansion{}
+@code{CR | CR-LF}
+@end table
+
+@noindent
+Notes:
+
+@itemize @bullet
+@item
+The CLI commands are still handled by the @sc{mi} interpreter; their
+output is described below.
+
+@item
+The @code{@var{token}}, when present, is passed back when the command
+finishes.
+
+@item
+Some @sc{mi} commands accept optional arguments as part of the parameter
+list. Each option is identified by a leading @samp{-} (dash) and may be
+followed by an optional argument parameter. Options occur first in the
+parameter list and can be delimited from normal parameters using
+@samp{--} (this is useful when some parameters begin with a dash).
+@end itemize
+
+Pragmatics:
+
+@itemize @bullet
+@item
+We want easy access to the existing CLI syntax (for debugging).
+
+@item
+We want it to be easy to spot a @sc{mi} operation.
+@end itemize
+
+@node GDB/MI Output Syntax
+@subsection @sc{gdb/mi} Output Syntax
+
+@cindex output syntax of @sc{gdb/mi}
+@cindex @sc{gdb/mi}, output syntax
+The output from @sc{gdb/mi} consists of zero or more out-of-band records
+followed, optionally, by a single result record. This result record
+is for the most recent command. The sequence of output records is
+terminated by @samp{(@value{GDBP})}.
+
+If an input command was prefixed with a @code{@var{token}} then the
+corresponding output for that command will also be prefixed by that same
+@var{token}.
+
+@table @code
+@item @var{output} @expansion{}
+@code{( @var{out-of-band-record} )* [ @var{result-record} ] "(gdb)" @var{nl}}
+
+@item @var{result-record} @expansion{}
+@code{ [ @var{token} ] "^" @var{result-class} ( "," @var{result} )* @var{nl}}
+
+@item @var{out-of-band-record} @expansion{}
+@code{@var{async-record} | @var{stream-record}}
+
+@item @var{async-record} @expansion{}
+@code{@var{exec-async-output} | @var{status-async-output} | @var{notify-async-output}}
+
+@item @var{exec-async-output} @expansion{}
+@code{[ @var{token} ] "*" @var{async-output}}
+
+@item @var{status-async-output} @expansion{}
+@code{[ @var{token} ] "+" @var{async-output}}
+
+@item @var{notify-async-output} @expansion{}
+@code{[ @var{token} ] "=" @var{async-output}}
+
+@item @var{async-output} @expansion{}
+@code{@var{async-class} ( "," @var{result} )* @var{nl}}
+
+@item @var{result-class} @expansion{}
+@code{"done" | "running" | "connected" | "error" | "exit"}
+
+@item @var{async-class} @expansion{}
+@code{"stopped" | @var{others}} (where @var{others} will be added
+depending on the needs---this is still in development).
+
+@item @var{result} @expansion{}
+@code{ @var{variable} "=" @var{value}}
+
+@item @var{variable} @expansion{}
+@code{ @var{string} }
+
+@item @var{value} @expansion{}
+@code{ @var{const} | @var{tuple} | @var{list} }
+
+@item @var{const} @expansion{}
+@code{@var{c-string}}
+
+@item @var{tuple} @expansion{}
+@code{ "@{@}" | "@{" @var{result} ( "," @var{result} )* "@}" }
+
+@item @var{list} @expansion{}
+@code{ "[]" | "[" @var{value} ( "," @var{value} )* "]" | "["
+@var{result} ( "," @var{result} )* "]" }
+
+@item @var{stream-record} @expansion{}
+@code{@var{console-stream-output} | @var{target-stream-output} | @var{log-stream-output}}
+
+@item @var{console-stream-output} @expansion{}
+@code{"~" @var{c-string}}
+
+@item @var{target-stream-output} @expansion{}
+@code{"@@" @var{c-string}}
+
+@item @var{log-stream-output} @expansion{}
+@code{"&" @var{c-string}}
+
+@item @var{nl} @expansion{}
+@code{CR | CR-LF}
+
+@item @var{token} @expansion{}
+@emph{any sequence of digits}.
+@end table
+
+@noindent
+Notes:
+
+@itemize @bullet
+@item
+All output sequences end in a single line containing a period.
+
+@item
+The @code{@var{token}} is from the corresponding request. If an execution
+command is interrupted by the @samp{-exec-interrupt} command, the
+@var{token} associated with the @samp{*stopped} message is the one of the
+original execution command, not the one of the interrupt command.
+
+@item
+@cindex status output in @sc{gdb/mi}
+@var{status-async-output} contains on-going status information about the
+progress of a slow operation. It can be discarded. All status output is
+prefixed by @samp{+}.
+
+@item
+@cindex async output in @sc{gdb/mi}
+@var{exec-async-output} contains asynchronous state change on the target
+(stopped, started, disappeared). All async output is prefixed by
+@samp{*}.
+
+@item
+@cindex notify output in @sc{gdb/mi}
+@var{notify-async-output} contains supplementary information that the
+client should handle (e.g., a new breakpoint information). All notify
+output is prefixed by @samp{=}.
+
+@item
+@cindex console output in @sc{gdb/mi}
+@var{console-stream-output} is output that should be displayed as is in the
+console. It is the textual response to a CLI command. All the console
+output is prefixed by @samp{~}.
+
+@item
+@cindex target output in @sc{gdb/mi}
+@var{target-stream-output} is the output produced by the target program.
+All the target output is prefixed by @samp{@@}.
+
+@item
+@cindex log output in @sc{gdb/mi}
+@var{log-stream-output} is output text coming from @value{GDBN}'s internals, for
+instance messages that should be displayed as part of an error log. All
+the log output is prefixed by @samp{&}.
+
+@item
+@cindex list output in @sc{gdb/mi}
+New @sc{gdb/mi} commands should only output @var{lists} containing
+@var{values}.
+
+
+@end itemize
+
+@xref{GDB/MI Stream Records, , @sc{gdb/mi} Stream Records}, for more
+details about the various output records.
+
+@node GDB/MI Simple Examples
+@subsection Simple Examples of @sc{gdb/mi} Interaction
+@cindex @sc{gdb/mi}, simple examples
+
+This subsection presents several simple examples of interaction using
+the @sc{gdb/mi} interface. In these examples, @samp{->} means that the
+following line is passed to @sc{gdb/mi} as input, while @samp{<-} means
+the output received from @sc{gdb/mi}.
+
+@subsubheading Target Stop
+@c Ummm... There is no "-stop" command. This assumes async, no?
+Here's an example of stopping the inferior process:
+
+@smallexample
+-> -stop
+<- (@value{GDBP})
+@end smallexample
+
+@noindent
+and later:
+
+@smallexample
+<- *stop,reason="stop",address="0x123",source="a.c:123"
+<- (@value{GDBP})
+@end smallexample
+
+@subsubheading Simple CLI Command
+
+Here's an example of a simple CLI command being passed through
+@sc{gdb/mi} and on to the CLI.
+
+@smallexample
+-> print 1+2
+<- &"print 1+2\n"
+<- ~"$1 = 3\n"
+<- ^done
+<- (@value{GDBP})
+@end smallexample
+
+@subsubheading Command With Side Effects
+
+@smallexample
+-> -symbol-file xyz.exe
+<- *breakpoint,nr="3",address="0x123",source="a.c:123"
+<- (@value{GDBP})
+@end smallexample
+
+@subsubheading A Bad Command
+
+Here's what happens if you pass a non-existent command:
+
+@smallexample
+-> -rubbish
+<- ^error,msg="Undefined MI command: rubbish"
+<- (@value{GDBP})
+@end smallexample
+
+@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+@node GDB/MI Compatibility with CLI
+@section @sc{gdb/mi} Compatibility with CLI
+
+@cindex compatibility, @sc{gdb/mi} and CLI
+@cindex @sc{gdb/mi}, compatibility with CLI
+To help users familiar with @value{GDBN}'s existing CLI interface, @sc{gdb/mi}
+accepts existing CLI commands. As specified by the syntax, such
+commands can be directly entered into the @sc{gdb/mi} interface and @value{GDBN} will
+respond.
+
+This mechanism is provided as an aid to developers of @sc{gdb/mi}
+clients and not as a reliable interface into the CLI. Since the command
+is being interpreteted in an environment that assumes @sc{gdb/mi}
+behaviour, the exact output of such commands is likely to end up being
+an un-supported hybrid of @sc{gdb/mi} and CLI output.
+
+@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+@node GDB/MI Output Records
+@section @sc{gdb/mi} Output Records
+
+@menu
+* GDB/MI Result Records::
+* GDB/MI Stream Records::
+* GDB/MI Out-of-band Records::
+@end menu
+
+@node GDB/MI Result Records
+@subsection @sc{gdb/mi} Result Records
+
+@cindex result records in @sc{gdb/mi}
+@cindex @sc{gdb/mi}, result records
+In addition to a number of out-of-band notifications, the response to a
+@sc{gdb/mi} command includes one of the following result indications:
+
+@table @code
+@findex ^done
+@item "^done" [ "," @var{results} ]
+The synchronous operation was successful, @code{@var{results}} are the return
+values.
+
+@item "^running"
+@findex ^running
+@c Is this one correct? Should it be an out-of-band notification?
+The asynchronous operation was successfully started. The target is
+running.
+
+@item "^error" "," @var{c-string}
+@findex ^error
+The operation failed. The @code{@var{c-string}} contains the corresponding
+error message.
+@end table
+
+@node GDB/MI Stream Records
+@subsection @sc{gdb/mi} Stream Records
+
+@cindex @sc{gdb/mi}, stream records
+@cindex stream records in @sc{gdb/mi}
+@value{GDBN} internally maintains a number of output streams: the console, the
+target, and the log. The output intended for each of these streams is
+funneled through the @sc{gdb/mi} interface using @dfn{stream records}.
+
+Each stream record begins with a unique @dfn{prefix character} which
+identifies its stream (@pxref{GDB/MI Output Syntax, , @sc{gdb/mi} Output
+Syntax}). In addition to the prefix, each stream record contains a
+@code{@var{string-output}}. This is either raw text (with an implicit new
+line) or a quoted C string (which does not contain an implicit newline).
+
+@table @code
+@item "~" @var{string-output}
+The console output stream contains text that should be displayed in the
+CLI console window. It contains the textual responses to CLI commands.
+
+@item "@@" @var{string-output}
+The target output stream contains any textual output from the running
+target.
+
+@item "&" @var{string-output}
+The log stream contains debugging messages being produced by @value{GDBN}'s
+internals.
+@end table
+
+@node GDB/MI Out-of-band Records
+@subsection @sc{gdb/mi} Out-of-band Records
+
+@cindex out-of-band records in @sc{gdb/mi}
+@cindex @sc{gdb/mi}, out-of-band records
+@dfn{Out-of-band} records are used to notify the @sc{gdb/mi} client of
+additional changes that have occurred. Those changes can either be a
+consequence of @sc{gdb/mi} (e.g., a breakpoint modified) or a result of
+target activity (e.g., target stopped).
+
+The following is a preliminary list of possible out-of-band records.
+
+@table @code
+@item "*" "stop"
+@end table
+
+
+@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+@node GDB/MI Command Description Format
+@section @sc{gdb/mi} Command Description Format
+
+The remaining sections describe blocks of commands. Each block of
+commands is laid out in a fashion similar to this section.
+
+Note the the line breaks shown in the examples are here only for
+readability. They don't appear in the real output.
+Also note that the commands with a non-available example (N.A.@:) are
+not yet implemented.
+
+@subheading Motivation
+
+The motivation for this collection of commands.
+
+@subheading Introduction
+
+A brief introduction to this collection of commands as a whole.
+
+@subheading Commands
+
+For each command in the block, the following is described:
+
+@subsubheading Synopsis
+
+@smallexample
+ -command @var{args}@dots{}
+@end smallexample
+
+@subsubheading @value{GDBN} Command
+
+The corresponding @value{GDBN} CLI command.
+
+@subsubheading Result
+
+@subsubheading Out-of-band
+
+@subsubheading Notes
+
+@subsubheading Example
+
+
+@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+@node GDB/MI Breakpoint Table Commands
+@section @sc{gdb/mi} Breakpoint table commands
+
+@cindex breakpoint commands for @sc{gdb/mi}
+@cindex @sc{gdb/mi}, breakpoint commands
+This section documents @sc{gdb/mi} commands for manipulating
+breakpoints.
+
+@subheading The @code{-break-after} Command
+@findex -break-after
+
+@subsubheading Synopsis
+
+@smallexample
+ -break-after @var{number} @var{count}
+@end smallexample
+
+The breakpoint number @var{number} is not in effect until it has been
+hit @var{count} times. To see how this is reflected in the output of
+the @samp{-break-list} command, see the description of the
+@samp{-break-list} command below.
+
+@subsubheading @value{GDBN} Command
+
+The corresponding @value{GDBN} command is @samp{ignore}.
+
+@subsubheading Example
+
+@smallexample
+(@value{GDBP})
+-break-insert main
+^done,bkpt=@{number="1",addr="0x000100d0",file="hello.c",line="5"@}
+(@value{GDBP})
+-break-after 1 3
+~
+^done
+(@value{GDBP})
+-break-list
+^done,BreakpointTable=@{nr_rows="1",nr_cols="6",
+hdr=[@{width="3",alignment="-1",col_name="number",colhdr="Num"@},
+@{width="14",alignment="-1",col_name="type",colhdr="Type"@},
+@{width="4",alignment="-1",col_name="disp",colhdr="Disp"@},
+@{width="3",alignment="-1",col_name="enabled",colhdr="Enb"@},
+@{width="10",alignment="-1",col_name="addr",colhdr="Address"@},
+@{width="40",alignment="2",col_name="what",colhdr="What"@}],
+body=[bkpt=@{number="1",type="breakpoint",disp="keep",enabled="y",
+addr="0x000100d0",func="main",file="hello.c",line="5",times="0",
+ignore="3"@}]@}
+(@value{GDBP})
+@end smallexample
+
+@ignore
+@subheading The @code{-break-catch} Command
+@findex -break-catch
+
+@subheading The @code{-break-commands} Command
+@findex -break-commands
+@end ignore
+
+
+@subheading The @code{-break-condition} Command
+@findex -break-condition
+
+@subsubheading Synopsis
+
+@smallexample
+ -break-condition @var{number} @var{expr}
+@end smallexample
+
+Breakpoint @var{number} will stop the program only if the condition in
+@var{expr} is true. The condition becomes part of the
+@samp{-break-list} output (see the description of the @samp{-break-list}
+command below).
+
+@subsubheading @value{GDBN} Command
+
+The corresponding @value{GDBN} command is @samp{condition}.
+
+@subsubheading Example
+
+@smallexample
+(@value{GDBP})
+-break-condition 1 1
+^done
+(@value{GDBP})
+-break-list
+^done,BreakpointTable=@{nr_rows="1",nr_cols="6",
+hdr=[@{width="3",alignment="-1",col_name="number",colhdr="Num"@},
+@{width="14",alignment="-1",col_name="type",colhdr="Type"@},
+@{width="4",alignment="-1",col_name="disp",colhdr="Disp"@},
+@{width="3",alignment="-1",col_name="enabled",colhdr="Enb"@},
+@{width="10",alignment="-1",col_name="addr",colhdr="Address"@},
+@{width="40",alignment="2",col_name="what",colhdr="What"@}],
+body=[bkpt=@{number="1",type="breakpoint",disp="keep",enabled="y",
+addr="0x000100d0",func="main",file="hello.c",line="5",cond="1",
+times="0",ignore="3"@}]@}
+(@value{GDBP})
+@end smallexample
+
+@subheading The @code{-break-delete} Command
+@findex -break-delete
+
+@subsubheading Synopsis
+
+@smallexample
+ -break-delete ( @var{breakpoint} )+
+@end smallexample
+
+Delete the breakpoint(s) whose number(s) are specified in the argument
+list. This is obviously reflected in the breakpoint list.
+
+@subsubheading @value{GDBN} command
+
+The corresponding @value{GDBN} command is @samp{delete}.
+
+@subsubheading Example
+
+@smallexample
+(@value{GDBP})
+-break-delete 1
+^done
+(@value{GDBP})
+-break-list
+^done,BreakpointTable=@{nr_rows="0",nr_cols="6",
+hdr=[@{width="3",alignment="-1",col_name="number",colhdr="Num"@},
+@{width="14",alignment="-1",col_name="type",colhdr="Type"@},
+@{width="4",alignment="-1",col_name="disp",colhdr="Disp"@},
+@{width="3",alignment="-1",col_name="enabled",colhdr="Enb"@},
+@{width="10",alignment="-1",col_name="addr",colhdr="Address"@},
+@{width="40",alignment="2",col_name="what",colhdr="What"@}],
+body=[]@}
+(@value{GDBP})
+@end smallexample
+
+@subheading The @code{-break-disable} Command
+@findex -break-disable
+
+@subsubheading Synopsis
+
+@smallexample
+ -break-disable ( @var{breakpoint} )+
+@end smallexample
+
+Disable the named @var{breakpoint}(s). The field @samp{enabled} in the
+break list is now set to @samp{n} for the named @var{breakpoint}(s).
+
+@subsubheading @value{GDBN} Command
+
+The corresponding @value{GDBN} command is @samp{disable}.
+
+@subsubheading Example
+
+@smallexample
+(@value{GDBP})
+-break-disable 2
+^done
+(@value{GDBP})
+-break-list
+^done,BreakpointTable=@{nr_rows="1",nr_cols="6",
+hdr=[@{width="3",alignment="-1",col_name="number",colhdr="Num"@},
+@{width="14",alignment="-1",col_name="type",colhdr="Type"@},
+@{width="4",alignment="-1",col_name="disp",colhdr="Disp"@},
+@{width="3",alignment="-1",col_name="enabled",colhdr="Enb"@},
+@{width="10",alignment="-1",col_name="addr",colhdr="Address"@},
+@{width="40",alignment="2",col_name="what",colhdr="What"@}],
+body=[bkpt=@{number="2",type="breakpoint",disp="keep",enabled="n",
+addr="0x000100d0",func="main",file="hello.c",line="5",times="0"@}]@}
+(@value{GDBP})
+@end smallexample
+
+@subheading The @code{-break-enable} Command
+@findex -break-enable
+
+@subsubheading Synopsis
+
+@smallexample
+ -break-enable ( @var{breakpoint} )+
+@end smallexample
+
+Enable (previously disabled) @var{breakpoint}(s).
+
+@subsubheading @value{GDBN} Command
+
+The corresponding @value{GDBN} command is @samp{enable}.
+
+@subsubheading Example
+
+@smallexample
+(@value{GDBP})
+-break-enable 2
+^done
+(@value{GDBP})
+-break-list
+^done,BreakpointTable=@{nr_rows="1",nr_cols="6",
+hdr=[@{width="3",alignment="-1",col_name="number",colhdr="Num"@},
+@{width="14",alignment="-1",col_name="type",colhdr="Type"@},
+@{width="4",alignment="-1",col_name="disp",colhdr="Disp"@},
+@{width="3",alignment="-1",col_name="enabled",colhdr="Enb"@},
+@{width="10",alignment="-1",col_name="addr",colhdr="Address"@},
+@{width="40",alignment="2",col_name="what",colhdr="What"@}],
+body=[bkpt=@{number="2",type="breakpoint",disp="keep",enabled="y",
+addr="0x000100d0",func="main",file="hello.c",line="5",times="0"@}]@}
+(@value{GDBP})
+@end smallexample
+
+@subheading The @code{-break-info} Command
+@findex -break-info
+
+@subsubheading Synopsis
+
+@smallexample
+ -break-info @var{breakpoint}
+@end smallexample
+
+@c REDUNDANT???
+Get information about a single breakpoint.
+
+@subsubheading @value{GDBN} command
+
+The corresponding @value{GDBN} command is @samp{info break @var{breakpoint}}.
+
+@subsubheading Example
+N.A.
+
+@subheading The @code{-break-insert} Command
+@findex -break-insert
+
+@subsubheading Synopsis
+
+@smallexample
+ -break-insert [ -t ] [ -h ] [ -r ]
+ [ -c @var{condition} ] [ -i @var{ignore-count} ]
+ [ -p @var{thread} ] [ @var{line} | @var{addr} ]
+@end smallexample
+
+@noindent
+If specified, @var{line}, can be one of:
+
+@itemize @bullet
+@item function
+@c @item +offset
+@c @item -offset
+@c @item linenum
+@item filename:linenum
+@item filename:function
+@item *address
+@end itemize
+
+The possible optional parameters of this command are:
+
+@table @samp
+@item -t
+Insert a tempoary breakpoint.
+@item -h
+Insert a hardware breakpoint.
+@item -c @var{condition}
+Make the breakpoint conditional on @var{condition}.
+@item -i @var{ignore-count}
+Initialize the @var{ignore-count}.
+@item -r
+Insert a regular breakpoint in all the functions whose names match the
+given regular expression. Other flags are not applicable to regular
+expresson.
+@end table
+
+@subsubheading Result
+
+The result is in the form:
+
+@smallexample
+ ^done,bkptno="@var{number}",func="@var{funcname}",
+ file="@var{filename}",line="@var{lineno}"
+@end smallexample
+
+@noindent
+where @var{number} is the @value{GDBN} number for this breakpoint, @var{funcname}
+is the name of the function where the breakpoint was inserted,
+@var{filename} is the name of the source file which contains this
+function, and @var{lineno} is the source line number within that file.
+
+Note: this format is open to change.
+@c An out-of-band breakpoint instead of part of the result?
+
+@subsubheading @value{GDBN} Command
+
+The corresponding @value{GDBN} commands are @samp{break}, @samp{tbreak},
+@samp{hbreak}, @samp{thbreak}, and @samp{rbreak}.
+
+@subsubheading Example
+
+@smallexample
+(@value{GDBP})
+-break-insert main
+^done,bkpt=@{number="1",addr="0x0001072c",file="recursive2.c",line="4"@}
+(@value{GDBP})
+-break-insert -t foo
+^done,bkpt=@{number="2",addr="0x00010774",file="recursive2.c",line="11"@}
+(@value{GDBP})
+-break-list
+^done,BreakpointTable=@{nr_rows="2",nr_cols="6",
+hdr=[@{width="3",alignment="-1",col_name="number",colhdr="Num"@},
+@{width="14",alignment="-1",col_name="type",colhdr="Type"@},
+@{width="4",alignment="-1",col_name="disp",colhdr="Disp"@},
+@{width="3",alignment="-1",col_name="enabled",colhdr="Enb"@},
+@{width="10",alignment="-1",col_name="addr",colhdr="Address"@},
+@{width="40",alignment="2",col_name="what",colhdr="What"@}],
+body=[bkpt=@{number="1",type="breakpoint",disp="keep",enabled="y",
+addr="0x0001072c", func="main",file="recursive2.c",line="4",times="0"@},
+bkpt=@{number="2",type="breakpoint",disp="del",enabled="y",
+addr="0x00010774",func="foo",file="recursive2.c",line="11",times="0"@}]@}
+(@value{GDBP})
+-break-insert -r foo.*
+~int foo(int, int);
+^done,bkpt=@{number="3",addr="0x00010774",file="recursive2.c",line="11"@}
+(@value{GDBP})
+@end smallexample
+
+@subheading The @code{-break-list} Command
+@findex -break-list
+
+@subsubheading Synopsis
+
+@smallexample
+ -break-list
+@end smallexample
+
+Displays the list of inserted breakpoints, showing the following fields:
+
+@table @samp
+@item Number
+number of the breakpoint
+@item Type
+type of the breakpoint: @samp{breakpoint} or @samp{watchpoint}
+@item Disposition
+should the breakpoint be deleted or disabled when it is hit: @samp{keep}
+or @samp{nokeep}
+@item Enabled
+is the breakpoint enabled or no: @samp{y} or @samp{n}
+@item Address
+memory location at which the breakpoint is set
+@item What
+logical location of the breakpoint, expressed by function name, file
+name, line number
+@item Times
+number of times the breakpoint has been hit
+@end table
+
+If there are no breakpoints or watchpoints, the @code{BreakpointTable}
+@code{body} field is an empty list.
+
+@subsubheading @value{GDBN} Command
+
+The corresponding @value{GDBN} command is @samp{info break}.
+
+@subsubheading Example
+
+@smallexample
+(@value{GDBP})
+-break-list
+^done,BreakpointTable=@{nr_rows="2",nr_cols="6",
+hdr=[@{width="3",alignment="-1",col_name="number",colhdr="Num"@},
+@{width="14",alignment="-1",col_name="type",colhdr="Type"@},
+@{width="4",alignment="-1",col_name="disp",colhdr="Disp"@},
+@{width="3",alignment="-1",col_name="enabled",colhdr="Enb"@},
+@{width="10",alignment="-1",col_name="addr",colhdr="Address"@},
+@{width="40",alignment="2",col_name="what",colhdr="What"@}],
+body=[bkpt=@{number="1",type="breakpoint",disp="keep",enabled="y",
+addr="0x000100d0",func="main",file="hello.c",line="5",times="0"@},
+bkpt=@{number="2",type="breakpoint",disp="keep",enabled="y",
+addr="0x00010114",func="foo",file="hello.c",line="13",times="0"@}]@}
+(@value{GDBP})
+@end smallexample
+
+Here's an example of the result when there are no breakpoints:
+
+@smallexample
+(@value{GDBP})
+-break-list
+^done,BreakpointTable=@{nr_rows="0",nr_cols="6",
+hdr=[@{width="3",alignment="-1",col_name="number",colhdr="Num"@},
+@{width="14",alignment="-1",col_name="type",colhdr="Type"@},
+@{width="4",alignment="-1",col_name="disp",colhdr="Disp"@},
+@{width="3",alignment="-1",col_name="enabled",colhdr="Enb"@},
+@{width="10",alignment="-1",col_name="addr",colhdr="Address"@},
+@{width="40",alignment="2",col_name="what",colhdr="What"@}],
+body=[]@}
+(@value{GDBP})
+@end smallexample
+
+@subheading The @code{-break-watch} Command
+@findex -break-watch
+
+@subsubheading Synopsis
+
+@smallexample
+ -break-watch [ -a | -r ]
+@end smallexample
+
+Create a watchpoint. With the @samp{-a} option it will create an
+@dfn{access} watchpoint, i.e. a watchpoint that triggers either on a
+read from or on a write to the memory location. With the @samp{-r}
+option, the watchpoint created is a @dfn{read} watchpoint, i.e. it will
+trigger only when the memory location is accessed for reading. Without
+either of the options, the watchpoint created is a regular watchpoint,
+i.e. it will trigger when the memory location is accessed for writing.
+@xref{Set Watchpoints, , Setting watchpoints}.
+
+Note that @samp{-break-list} will report a single list of watchpoints and
+breakpoints inserted.
+
+@subsubheading @value{GDBN} Command
+
+The corresponding @value{GDBN} commands are @samp{watch}, @samp{awatch}, and
+@samp{rwatch}.
+
+@subsubheading Example
+
+Setting a watchpoint on a variable in the @code{main} function:
+
+@smallexample
+(@value{GDBP})
+-break-watch x
+^done,wpt=@{number="2",exp="x"@}
+(@value{GDBP})
+-exec-continue
+^running
+^done,reason="watchpoint-trigger",wpt=@{number="2",exp="x"@},
+value=@{old="-268439212",new="55"@},
+frame=@{func="main",args=[],file="recursive2.c",line="5"@}
+(@value{GDBP})
+@end smallexample
+
+Setting a watchpoint on a variable local to a function. @value{GDBN} will stop
+the program execution twice: first for the variable changing value, then
+for the watchpoint going out of scope.
+
+@smallexample
+(@value{GDBP})
+-break-watch C
+^done,wpt=@{number="5",exp="C"@}
+(@value{GDBP})
+-exec-continue
+^running
+^done,reason="watchpoint-trigger",
+wpt=@{number="5",exp="C"@},value=@{old="-276895068",new="3"@},
+frame=@{func="callee4",args=[],
+file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="13"@}
+(@value{GDBP})
+-exec-continue
+^running
+^done,reason="watchpoint-scope",wpnum="5",
+frame=@{func="callee3",args=[@{name="strarg",
+value="0x11940 \"A string argument.\""@}],
+file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="18"@}
+(@value{GDBP})
+@end smallexample
+
+Listing breakpoints and watchpoints, at different points in the program
+execution. Note that once the watchpoint goes out of scope, it is
+deleted.
+
+@smallexample
+(@value{GDBP})
+-break-watch C
+^done,wpt=@{number="2",exp="C"@}
+(@value{GDBP})
+-break-list
+^done,BreakpointTable=@{nr_rows="2",nr_cols="6",
+hdr=[@{width="3",alignment="-1",col_name="number",colhdr="Num"@},
+@{width="14",alignment="-1",col_name="type",colhdr="Type"@},
+@{width="4",alignment="-1",col_name="disp",colhdr="Disp"@},
+@{width="3",alignment="-1",col_name="enabled",colhdr="Enb"@},
+@{width="10",alignment="-1",col_name="addr",colhdr="Address"@},
+@{width="40",alignment="2",col_name="what",colhdr="What"@}],
+body=[bkpt=@{number="1",type="breakpoint",disp="keep",enabled="y",
+addr="0x00010734",func="callee4",
+file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="8",times="1"@},
+bkpt=@{number="2",type="watchpoint",disp="keep",
+enabled="y",addr="",what="C",times="0"@}]@}
+(@value{GDBP})
+-exec-continue
+^running
+^done,reason="watchpoint-trigger",wpt=@{number="2",exp="C"@},
+value=@{old="-276895068",new="3"@},
+frame=@{func="callee4",args=[],
+file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="13"@}
+(@value{GDBP})
+-break-list
+^done,BreakpointTable=@{nr_rows="2",nr_cols="6",
+hdr=[@{width="3",alignment="-1",col_name="number",colhdr="Num"@},
+@{width="14",alignment="-1",col_name="type",colhdr="Type"@},
+@{width="4",alignment="-1",col_name="disp",colhdr="Disp"@},
+@{width="3",alignment="-1",col_name="enabled",colhdr="Enb"@},
+@{width="10",alignment="-1",col_name="addr",colhdr="Address"@},
+@{width="40",alignment="2",col_name="what",colhdr="What"@}],
+body=[bkpt=@{number="1",type="breakpoint",disp="keep",enabled="y",
+addr="0x00010734",func="callee4",
+file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="8",times="1"@},
+bkpt=@{number="2",type="watchpoint",disp="keep",
+enabled="y",addr="",what="C",times="-5"@}]@}
+(@value{GDBP})
+-exec-continue
+^running
+^done,reason="watchpoint-scope",wpnum="2",
+frame=@{func="callee3",args=[@{name="strarg",
+value="0x11940 \"A string argument.\""@}],
+file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="18"@}
+(@value{GDBP})
+-break-list
+^done,BreakpointTable=@{nr_rows="1",nr_cols="6",
+hdr=[@{width="3",alignment="-1",col_name="number",colhdr="Num"@},
+@{width="14",alignment="-1",col_name="type",colhdr="Type"@},
+@{width="4",alignment="-1",col_name="disp",colhdr="Disp"@},
+@{width="3",alignment="-1",col_name="enabled",colhdr="Enb"@},
+@{width="10",alignment="-1",col_name="addr",colhdr="Address"@},
+@{width="40",alignment="2",col_name="what",colhdr="What"@}],
+body=[bkpt=@{number="1",type="breakpoint",disp="keep",enabled="y",
+addr="0x00010734",func="callee4",
+file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="8",times="1"@}]@}
+(@value{GDBP})
+@end smallexample
+
+@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+@node GDB/MI Data Manipulation
+@section @sc{gdb/mi} Data Manipulation
+
+@cindex data manipulation, in @sc{gdb/mi}
+@cindex @sc{gdb/mi}, data manipulation
+This section describes the @sc{gdb/mi} commands that manipulate data:
+examine memory and registers, evaluate expressions, etc.
+
+@c REMOVED FROM THE INTERFACE.
+@c @subheading -data-assign
+@c Change the value of a program variable. Plenty of side effects.
+@c @subsubheading GDB command
+@c set variable
+@c @subsubheading Example
+@c N.A.
+
+@subheading The @code{-data-disassemble} Command
+@findex -data-disassemble
+
+@subsubheading Synopsis
+
+@smallexample
+ -data-disassemble
+ [ -s @var{start-addr} -e @var{end-addr} ]
+ | [ -f @var{filename} -l @var{linenum} [ -n @var{lines} ] ]
+ -- @var{mode}
+@end smallexample
+
+@noindent
+Where:
+
+@table @samp
+@item @var{start-addr}
+is the beginning address (or @code{$pc})
+@item @var{end-addr}
+is the end address
+@item @var{filename}
+is the name of the file to disassemble
+@item @var{linenum}
+is the line number to disassemble around
+@item @var{lines}
+is the the number of disassembly lines to be produced. If it is -1,
+the whole function will be disassembled, in case no @var{end-addr} is
+specified. If @var{end-addr} is specified as a non-zero value, and
+@var{lines} is lower than the number of disassembly lines between
+@var{start-addr} and @var{end-addr}, only @var{lines} lines are
+displayed; if @var{lines} is higher than the number of lines between
+@var{start-addr} and @var{end-addr}, only the lines up to @var{end-addr}
+are displayed.
+@item @var{mode}
+is either 0 (meaning only disassembly) or 1 (meaning mixed source and
+disassembly).
+@end table
+
+@subsubheading Result
+
+The output for each instruction is composed of four fields:
+
+@itemize @bullet
+@item Address
+@item Func-name
+@item Offset
+@item Instruction
+@end itemize
+
+Note that whatever included in the instruction field, is not manipulated
+directely by @sc{gdb/mi}, i.e. it is not possible to adjust its format.
+
+@subsubheading @value{GDBN} Command
+
+There's no direct mapping from this command to the CLI.
+
+@subsubheading Example
+
+Disassemble from the current value of @code{$pc} to @code{$pc + 20}:
+
+@smallexample
+(@value{GDBP})
+-data-disassemble -s $pc -e "$pc + 20" -- 0
+^done,
+asm_insns=[
+@{address="0x000107c0",func-name="main",offset="4",
+inst="mov 2, %o0"@},
+@{address="0x000107c4",func-name="main",offset="8",
+inst="sethi %hi(0x11800), %o2"@},
+@{address="0x000107c8",func-name="main",offset="12",
+inst="or %o2, 0x140, %o1\t! 0x11940 <_lib_version+8>"@},
+@{address="0x000107cc",func-name="main",offset="16",
+inst="sethi %hi(0x11800), %o2"@},
+@{address="0x000107d0",func-name="main",offset="20",
+inst="or %o2, 0x168, %o4\t! 0x11968 <_lib_version+48>"@}]
+(@value{GDBP})
+@end smallexample
+
+Disassemble the whole @code{main} function. Line 32 is part of
+@code{main}.
+
+@smallexample
+-data-disassemble -f basics.c -l 32 -- 0
+^done,asm_insns=[
+@{address="0x000107bc",func-name="main",offset="0",
+inst="save %sp, -112, %sp"@},
+@{address="0x000107c0",func-name="main",offset="4",
+inst="mov 2, %o0"@},
+@{address="0x000107c4",func-name="main",offset="8",
+inst="sethi %hi(0x11800), %o2"@},
+[@dots{}]
+@{address="0x0001081c",func-name="main",offset="96",inst="ret "@},
+@{address="0x00010820",func-name="main",offset="100",inst="restore "@}]
+(@value{GDBP})
+@end smallexample
+
+Disassemble 3 instructions from the start of @code{main}:
+
+@smallexample
+(@value{GDBP})
+-data-disassemble -f basics.c -l 32 -n 3 -- 0
+^done,asm_insns=[
+@{address="0x000107bc",func-name="main",offset="0",
+inst="save %sp, -112, %sp"@},
+@{address="0x000107c0",func-name="main",offset="4",
+inst="mov 2, %o0"@},
+@{address="0x000107c4",func-name="main",offset="8",
+inst="sethi %hi(0x11800), %o2"@}]
+(@value{GDBP})
+@end smallexample
+
+Disassemble 3 instructions from the start of @code{main} in mixed mode:
+
+@smallexample
+(@value{GDBP})
+-data-disassemble -f basics.c -l 32 -n 3 -- 1
+^done,asm_insns=[
+src_and_asm_line=@{line="31",
+file="/kwikemart/marge/ezannoni/flathead-dev/devo/gdb/ \
+ testsuite/gdb.mi/basics.c",line_asm_insn=[
+@{address="0x000107bc",func-name="main",offset="0",
+inst="save %sp, -112, %sp"@}]@},
+src_and_asm_line=@{line="32",
+file="/kwikemart/marge/ezannoni/flathead-dev/devo/gdb/ \
+ testsuite/gdb.mi/basics.c",line_asm_insn=[
+@{address="0x000107c0",func-name="main",offset="4",
+inst="mov 2, %o0"@},
+@{address="0x000107c4",func-name="main",offset="8",
+inst="sethi %hi(0x11800), %o2"@}]@}]
+(@value{GDBP})
+@end smallexample
+
+
+@subheading The @code{-data-evaluate-expression} Command
+@findex -data-evaluate-expression
+
+@subsubheading Synopsis
+
+@smallexample
+ -data-evaluate-expression @var{expr}
+@end smallexample
+
+Evaluate @var{expr} as an expression. The expression could contain an
+inferior function call. The function call will execute synchronously.
+If the expression contains spaces, it must be enclosed in double quotes.
+
+@subsubheading @value{GDBN} Command
+
+The corresponding @value{GDBN} commands are @samp{print}, @samp{output}, and
+@samp{call}. In @code{gdbtk} only, there's a corresponding
+@samp{gdb_eval} command.
+
+@subsubheading Example
+
+In the following example, the numbers that precede the commands are the
+@dfn{tokens} described in @ref{GDB/MI Command Syntax, ,@sc{gdb/mi}
+Command Syntax}. Notice how @sc{gdb/mi} returns the same tokens in its
+output.
+
+@smallexample
+211-data-evaluate-expression A
+211^done,value="1"
+(@value{GDBP})
+311-data-evaluate-expression &A
+311^done,value="0xefffeb7c"
+(@value{GDBP})
+411-data-evaluate-expression A+3
+411^done,value="4"
+(@value{GDBP})
+511-data-evaluate-expression "A + 3"
+511^done,value="4"
+(@value{GDBP})
+@end smallexample
+
+
+@subheading The @code{-data-list-changed-registers} Command
+@findex -data-list-changed-registers
+
+@subsubheading Synopsis
+
+@smallexample
+ -data-list-changed-registers
+@end smallexample
+
+Display a list of the registers that have changed.
+
+@subsubheading @value{GDBN} Command
+
+@value{GDBN} doesn't have a direct analog for this command; @code{gdbtk}
+has the corresponding command @samp{gdb_changed_register_list}.
+
+@subsubheading Example
+
+On a PPC MBX board:
+
+@smallexample
+(@value{GDBP})
+-exec-continue
+^running
+
+(@value{GDBP})
+*stopped,reason="breakpoint-hit",bkptno="1",frame=@{func="main",
+args=[],file="try.c",line="5"@}
+(@value{GDBP})
+-data-list-changed-registers
+^done,changed-registers=["0","1","2","4","5","6","7","8","9",
+"10","11","13","14","15","16","17","18","19","20","21","22","23",
+"24","25","26","27","28","30","31","64","65","66","67","69"]
+(@value{GDBP})
+@end smallexample
+
+
+@subheading The @code{-data-list-register-names} Command
+@findex -data-list-register-names
+
+@subsubheading Synopsis
+
+@smallexample
+ -data-list-register-names [ ( @var{regno} )+ ]
+@end smallexample
+
+Show a list of register names for the current target. If no arguments
+are given, it shows a list of the names of all the registers. If
+integer numbers are given as arguments, it will print a list of the
+names of the registers corresponding to the arguments. To ensure
+consistency between a register name and its number, the output list may
+include empty register names.
+
+@subsubheading @value{GDBN} Command
+
+@value{GDBN} does not have a command which corresponds to
+@samp{-data-list-register-names}. In @code{gdbtk} there is a
+corresponding command @samp{gdb_regnames}.
+
+@subsubheading Example
+
+For the PPC MBX board:
+@smallexample
+(@value{GDBP})
+-data-list-register-names
+^done,register-names=["r0","r1","r2","r3","r4","r5","r6","r7",
+"r8","r9","r10","r11","r12","r13","r14","r15","r16","r17","r18",
+"r19","r20","r21","r22","r23","r24","r25","r26","r27","r28","r29",
+"r30","r31","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9",
+"f10","f11","f12","f13","f14","f15","f16","f17","f18","f19","f20",
+"f21","f22","f23","f24","f25","f26","f27","f28","f29","f30","f31",
+"", "pc","ps","cr","lr","ctr","xer"]
+(@value{GDBP})
+-data-list-register-names 1 2 3
+^done,register-names=["r1","r2","r3"]
+(@value{GDBP})
+@end smallexample
+
+@subheading The @code{-data-list-register-values} Command
+@findex -data-list-register-values
+
+@subsubheading Synopsis
+
+@smallexample
+ -data-list-register-values @var{fmt} [ ( @var{regno} )*]
+@end smallexample
+
+Display the registers' contents. @var{fmt} is the format according to
+which the registers' contents are to be returned, followed by an optional
+list of numbers specifying the registers to display. A missing list of
+numbers indicates that the contents of all the registers must be returned.
+
+Allowed formats for @var{fmt} are:
+
+@table @code
+@item x
+Hexadecimal
+@item o
+Octal
+@item t
+Binary
+@item d
+Decimal
+@item r
+Raw
+@item N
+Natural
+@end table
+
+@subsubheading @value{GDBN} Command
+
+The corresponding @value{GDBN} commands are @samp{info reg}, @samp{info
+all-reg}, and (in @code{gdbtk}) @samp{gdb_fetch_registers}.
+
+@subsubheading Example
+
+For a PPC MBX board (note: line breaks are for readability only, they
+don't appear in the actual output):
+
+@smallexample
+(@value{GDBP})
+-data-list-register-values r 64 65
+^done,register-values=[@{number="64",value="0xfe00a300"@},
+@{number="65",value="0x00029002"@}]
+(@value{GDBP})
+-data-list-register-values x
+^done,register-values=[@{number="0",value="0xfe0043c8"@},
+@{number="1",value="0x3fff88"@},@{number="2",value="0xfffffffe"@},
+@{number="3",value="0x0"@},@{number="4",value="0xa"@},
+@{number="5",value="0x3fff68"@},@{number="6",value="0x3fff58"@},
+@{number="7",value="0xfe011e98"@},@{number="8",value="0x2"@},
+@{number="9",value="0xfa202820"@},@{number="10",value="0xfa202808"@},
+@{number="11",value="0x1"@},@{number="12",value="0x0"@},
+@{number="13",value="0x4544"@},@{number="14",value="0xffdfffff"@},
+@{number="15",value="0xffffffff"@},@{number="16",value="0xfffffeff"@},
+@{number="17",value="0xefffffed"@},@{number="18",value="0xfffffffe"@},
+@{number="19",value="0xffffffff"@},@{number="20",value="0xffffffff"@},
+@{number="21",value="0xffffffff"@},@{number="22",value="0xfffffff7"@},
+@{number="23",value="0xffffffff"@},@{number="24",value="0xffffffff"@},
+@{number="25",value="0xffffffff"@},@{number="26",value="0xfffffffb"@},
+@{number="27",value="0xffffffff"@},@{number="28",value="0xf7bfffff"@},
+@{number="29",value="0x0"@},@{number="30",value="0xfe010000"@},
+@{number="31",value="0x0"@},@{number="32",value="0x0"@},
+@{number="33",value="0x0"@},@{number="34",value="0x0"@},
+@{number="35",value="0x0"@},@{number="36",value="0x0"@},
+@{number="37",value="0x0"@},@{number="38",value="0x0"@},
+@{number="39",value="0x0"@},@{number="40",value="0x0"@},
+@{number="41",value="0x0"@},@{number="42",value="0x0"@},
+@{number="43",value="0x0"@},@{number="44",value="0x0"@},
+@{number="45",value="0x0"@},@{number="46",value="0x0"@},
+@{number="47",value="0x0"@},@{number="48",value="0x0"@},
+@{number="49",value="0x0"@},@{number="50",value="0x0"@},
+@{number="51",value="0x0"@},@{number="52",value="0x0"@},
+@{number="53",value="0x0"@},@{number="54",value="0x0"@},
+@{number="55",value="0x0"@},@{number="56",value="0x0"@},
+@{number="57",value="0x0"@},@{number="58",value="0x0"@},
+@{number="59",value="0x0"@},@{number="60",value="0x0"@},
+@{number="61",value="0x0"@},@{number="62",value="0x0"@},
+@{number="63",value="0x0"@},@{number="64",value="0xfe00a300"@},
+@{number="65",value="0x29002"@},@{number="66",value="0x202f04b5"@},
+@{number="67",value="0xfe0043b0"@},@{number="68",value="0xfe00b3e4"@},
+@{number="69",value="0x20002b03"@}]
+(@value{GDBP})
+@end smallexample
+
+
+@subheading The @code{-data-read-memory} Command
+@findex -data-read-memory
+
+@subsubheading Synopsis
+
+@smallexample
+ -data-read-memory [ -o @var{byte-offset} ]
+ @var{address} @var{word-format} @var{word-size}
+ @var{nr-rows} @var{nr-cols} [ @var{aschar} ]
+@end smallexample
+
+@noindent
+where:
+
+@table @samp
+@item @var{address}
+An expression specifying the address of the first memory word to be
+read. Complex expressions containing embedded white space should be
+quoted using the C convention.
+
+@item @var{word-format}
+The format to be used to print the memory words. The notation is the
+same as for @value{GDBN}'s @code{print} command (@pxref{Output Formats,
+,Output formats}).
+
+@item @var{word-size}
+The size of each memory word in bytes.
+
+@item @var{nr-rows}
+The number of rows in the output table.
+
+@item @var{nr-cols}
+The number of columns in the output table.
+
+@item @var{aschar}
+If present, indicates that each row should include an @sc{ascii} dump. The
+value of @var{aschar} is used as a padding character when a byte is not a
+member of the printable @sc{ascii} character set (printable @sc{ascii}
+characters are those whose code is between 32 and 126, inclusively).
+
+@item @var{byte-offset}
+An offset to add to the @var{address} before fetching memory.
+@end table
+
+This command displays memory contents as a table of @var{nr-rows} by
+@var{nr-cols} words, each word being @var{word-size} bytes. In total,
+@code{@var{nr-rows} * @var{nr-cols} * @var{word-size}} bytes are read
+(returned as @samp{total-bytes}). Should less than the requested number
+of bytes be returned by the target, the missing words are identified
+using @samp{N/A}. The number of bytes read from the target is returned
+in @samp{nr-bytes} and the starting address used to read memory in
+@samp{addr}.
+
+The address of the next/previous row or page is available in
+@samp{next-row} and @samp{prev-row}, @samp{next-page} and
+@samp{prev-page}.
+
+@subsubheading @value{GDBN} Command
+
+The corresponding @value{GDBN} command is @samp{x}. @code{gdbtk} has
+@samp{gdb_get_mem} memory read command.
+
+@subsubheading Example
+
+Read six bytes of memory starting at @code{bytes+6} but then offset by
+@code{-6} bytes. Format as three rows of two columns. One byte per
+word. Display each word in hex.
+
+@smallexample
+(@value{GDBP})
+9-data-read-memory -o -6 -- bytes+6 x 1 3 2
+9^done,addr="0x00001390",nr-bytes="6",total-bytes="6",
+next-row="0x00001396",prev-row="0x0000138e",next-page="0x00001396",
+prev-page="0x0000138a",memory=[
+@{addr="0x00001390",data=["0x00","0x01"]@},
+@{addr="0x00001392",data=["0x02","0x03"]@},
+@{addr="0x00001394",data=["0x04","0x05"]@}]
+(@value{GDBP})
+@end smallexample
+
+Read two bytes of memory starting at address @code{shorts + 64} and
+display as a single word formatted in decimal.
+
+@smallexample
+(@value{GDBP})
+5-data-read-memory shorts+64 d 2 1 1
+5^done,addr="0x00001510",nr-bytes="2",total-bytes="2",
+next-row="0x00001512",prev-row="0x0000150e",
+next-page="0x00001512",prev-page="0x0000150e",memory=[
+@{addr="0x00001510",data=["128"]@}]
+(@value{GDBP})
+@end smallexample
+
+Read thirty two bytes of memory starting at @code{bytes+16} and format
+as eight rows of four columns. Include a string encoding with @samp{x}
+used as the non-printable character.
+
+@smallexample
+(@value{GDBP})
+4-data-read-memory bytes+16 x 1 8 4 x
+4^done,addr="0x000013a0",nr-bytes="32",total-bytes="32",
+next-row="0x000013c0",prev-row="0x0000139c",
+next-page="0x000013c0",prev-page="0x00001380",memory=[
+@{addr="0x000013a0",data=["0x10","0x11","0x12","0x13"],ascii="xxxx"@},
+@{addr="0x000013a4",data=["0x14","0x15","0x16","0x17"],ascii="xxxx"@},
+@{addr="0x000013a8",data=["0x18","0x19","0x1a","0x1b"],ascii="xxxx"@},
+@{addr="0x000013ac",data=["0x1c","0x1d","0x1e","0x1f"],ascii="xxxx"@},
+@{addr="0x000013b0",data=["0x20","0x21","0x22","0x23"],ascii=" !\"#"@},
+@{addr="0x000013b4",data=["0x24","0x25","0x26","0x27"],ascii="$%&'"@},
+@{addr="0x000013b8",data=["0x28","0x29","0x2a","0x2b"],ascii="()*+"@},
+@{addr="0x000013bc",data=["0x2c","0x2d","0x2e","0x2f"],ascii=",-./"@}]
+(@value{GDBP})
+@end smallexample
+
+@subheading The @code{-display-delete} Command
+@findex -display-delete
+
+@subsubheading Synopsis
+
+@smallexample
+ -display-delete @var{number}
+@end smallexample
+
+Delete the display @var{number}.
+
+@subsubheading @value{GDBN} Command
+
+The corresponding @value{GDBN} command is @samp{delete display}.
+
+@subsubheading Example
+N.A.
+
+
+@subheading The @code{-display-disable} Command
+@findex -display-disable
+
+@subsubheading Synopsis
+
+@smallexample
+ -display-disable @var{number}
+@end smallexample
+
+Disable display @var{number}.
+
+@subsubheading @value{GDBN} Command
+
+The corresponding @value{GDBN} command is @samp{disable display}.
+
+@subsubheading Example
+N.A.
+
+
+@subheading The @code{-display-enable} Command
+@findex -display-enable
+
+@subsubheading Synopsis
+
+@smallexample
+ -display-enable @var{number}
+@end smallexample
+
+Enable display @var{number}.
+
+@subsubheading @value{GDBN} Command
+
+The corresponding @value{GDBN} command is @samp{enable display}.
+
+@subsubheading Example
+N.A.
+
+
+@subheading The @code{-display-insert} Command
+@findex -display-insert
+
+@subsubheading Synopsis
+
+@smallexample
+ -display-insert @var{expression}
+@end smallexample
+
+Display @var{expression} every time the program stops.
+
+@subsubheading @value{GDBN} Command
+
+The corresponding @value{GDBN} command is @samp{display}.
+
+@subsubheading Example
+N.A.
+
+
+@subheading The @code{-display-list} Command
+@findex -display-list
+
+@subsubheading Synopsis
+
+@smallexample
+ -display-list
+@end smallexample
+
+List the displays. Do not show the current values.
+
+@subsubheading @value{GDBN} Command
+
+The corresponding @value{GDBN} command is @samp{info display}.
+
+@subsubheading Example
+N.A.
+
+
+@subheading The @code{-environment-cd} Command
+@findex -environment-cd
+
+@subsubheading Synopsis
+
+@smallexample
+ -environment-cd @var{pathdir}
+@end smallexample
+
+Set @value{GDBN}'s working directory.
+
+@subsubheading @value{GDBN} Command
+
+The corresponding @value{GDBN} command is @samp{cd}.
+
+@subsubheading Example
+
+@smallexample
+(@value{GDBP})
+-environment-cd /kwikemart/marge/ezannoni/flathead-dev/devo/gdb
+^done
+(@value{GDBP})
+@end smallexample
+
+
+@subheading The @code{-environment-directory} Command
+@findex -environment-directory
+
+@subsubheading Synopsis
+
+@smallexample
+ -environment-directory [ -r ] [ @var{pathdir} ]+
+@end smallexample
+
+Add directories @var{pathdir} to beginning of search path for source files.
+If the @samp{-r} option is used, the search path is reset to the default
+search path. If directories @var{pathdir} are supplied in addition to the
+@samp{-r} option, the search path is first reset and then addition
+occurs as normal.
+Multiple directories may be specified, separated by blanks. Specifying
+multiple directories in a single command
+results in the directories added to the beginning of the
+search path in the same order they were presented in the command.
+If blanks are needed as
+part of a directory name, double-quotes should be used around
+the name. In the command output, the path will show up separated
+by the system directory-separator character. The directory-seperator
+character must not be used
+in any directory name.
+If no directories are specified, the current search path is displayed.
+
+@subsubheading @value{GDBN} Command
+
+The corresponding @value{GDBN} command is @samp{dir}.
+
+@subsubheading Example
+
+@smallexample
+(@value{GDBP})
+-environment-directory /kwikemart/marge/ezannoni/flathead-dev/devo/gdb
+^done,source-path="/kwikemart/marge/ezannoni/flathead-dev/devo/gdb:$cdir:$cwd"
+(@value{GDBP})
+-environment-directory ""
+^done,source-path="/kwikemart/marge/ezannoni/flathead-dev/devo/gdb:$cdir:$cwd"
+(@value{GDBP})
+-environment-directory -r /home/jjohnstn/src/gdb /usr/src
+^done,source-path="/home/jjohnstn/src/gdb:/usr/src:$cdir:$cwd"
+(@value{GDBP})
+-environment-directory -r
+^done,source-path="$cdir:$cwd"
+(@value{GDBP})
+@end smallexample
+
+
+@subheading The @code{-environment-path} Command
+@findex -environment-path
+
+@subsubheading Synopsis
+
+@smallexample
+ -environment-path [ -r ] [ @var{pathdir} ]+
+@end smallexample
+
+Add directories @var{pathdir} to beginning of search path for object files.
+If the @samp{-r} option is used, the search path is reset to the original
+search path that existed at gdb start-up. If directories @var{pathdir} are
+supplied in addition to the
+@samp{-r} option, the search path is first reset and then addition
+occurs as normal.
+Multiple directories may be specified, separated by blanks. Specifying
+multiple directories in a single command
+results in the directories added to the beginning of the
+search path in the same order they were presented in the command.
+If blanks are needed as
+part of a directory name, double-quotes should be used around
+the name. In the command output, the path will show up separated
+by the system directory-separator character. The directory-seperator
+character must not be used
+in any directory name.
+If no directories are specified, the current path is displayed.
+
+
+@subsubheading @value{GDBN} Command
+
+The corresponding @value{GDBN} command is @samp{path}.
+
+@subsubheading Example
+
+@smallexample
+(@value{GDBP})
+-environment-path
+^done,path="/usr/bin"
+(@value{GDBP})
+-environment-path /kwikemart/marge/ezannoni/flathead-dev/ppc-eabi/gdb /bin
+^done,path="/kwikemart/marge/ezannoni/flathead-dev/ppc-eabi/gdb:/bin:/usr/bin"
+(@value{GDBP})
+-environment-path -r /usr/local/bin
+^done,path="/usr/local/bin:/usr/bin"
+(@value{GDBP})
+@end smallexample
+
+
+@subheading The @code{-environment-pwd} Command
+@findex -environment-pwd
+
+@subsubheading Synopsis
+
+@smallexample
+ -environment-pwd
+@end smallexample
+
+Show the current working directory.
+
+@subsubheading @value{GDBN} command
+
+The corresponding @value{GDBN} command is @samp{pwd}.
+
+@subsubheading Example
+
+@smallexample
+(@value{GDBP})
+-environment-pwd
+^done,cwd="/kwikemart/marge/ezannoni/flathead-dev/devo/gdb"
+(@value{GDBP})
+@end smallexample
+
+@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+@node GDB/MI Program Control
+@section @sc{gdb/mi} Program control
+
+@subsubheading Program termination
+
+As a result of execution, the inferior program can run to completion, if
+it doesn't encounter any breakpoints. In this case the output will
+include an exit code, if the program has exited exceptionally.
+
+@subsubheading Examples
+
+@noindent
+Program exited normally:
+
+@smallexample
+(@value{GDBP})
+-exec-run
+^running
+(@value{GDBP})
+x = 55
+*stopped,reason="exited-normally"
+(@value{GDBP})
+@end smallexample
+
+@noindent
+Program exited exceptionally:
+
+@smallexample
+(@value{GDBP})
+-exec-run
+^running
+(@value{GDBP})
+x = 55
+*stopped,reason="exited",exit-code="01"
+(@value{GDBP})
+@end smallexample
+
+Another way the program can terminate is if it receives a signal such as
+@code{SIGINT}. In this case, @sc{gdb/mi} displays this:
+
+@smallexample
+(@value{GDBP})
+*stopped,reason="exited-signalled",signal-name="SIGINT",
+signal-meaning="Interrupt"
+@end smallexample
+
+
+@subheading The @code{-exec-abort} Command
+@findex -exec-abort
+
+@subsubheading Synopsis
+
+@smallexample
+ -exec-abort
+@end smallexample
+
+Kill the inferior running program.
+
+@subsubheading @value{GDBN} Command
+
+The corresponding @value{GDBN} command is @samp{kill}.
+
+@subsubheading Example
+N.A.
+
+
+@subheading The @code{-exec-arguments} Command
+@findex -exec-arguments
+
+@subsubheading Synopsis
+
+@smallexample
+ -exec-arguments @var{args}
+@end smallexample
+
+Set the inferior program arguments, to be used in the next
+@samp{-exec-run}.
+
+@subsubheading @value{GDBN} Command
+
+The corresponding @value{GDBN} command is @samp{set args}.
+
+@subsubheading Example
+
+@c FIXME!
+Don't have one around.
+
+
+@subheading The @code{-exec-continue} Command
+@findex -exec-continue
+
+@subsubheading Synopsis
+
+@smallexample
+ -exec-continue
+@end smallexample
+
+Asynchronous command. Resumes the execution of the inferior program
+until a breakpoint is encountered, or until the inferior exits.
+
+@subsubheading @value{GDBN} Command
+
+The corresponding @value{GDBN} corresponding is @samp{continue}.
+
+@subsubheading Example
+
+@smallexample
+-exec-continue
+^running
+(@value{GDBP})
+@@Hello world
+*stopped,reason="breakpoint-hit",bkptno="2",frame=@{func="foo",args=[],
+file="hello.c",line="13"@}
+(@value{GDBP})
+@end smallexample
+
+
+@subheading The @code{-exec-finish} Command
+@findex -exec-finish
+
+@subsubheading Synopsis
+
+@smallexample
+ -exec-finish
+@end smallexample
+
+Asynchronous command. Resumes the execution of the inferior program
+until the current function is exited. Displays the results returned by
+the function.
+
+@subsubheading @value{GDBN} Command
+
+The corresponding @value{GDBN} command is @samp{finish}.
+
+@subsubheading Example
+
+Function returning @code{void}.
+
+@smallexample
+-exec-finish
+^running
+(@value{GDBP})
+@@hello from foo
+*stopped,reason="function-finished",frame=@{func="main",args=[],
+file="hello.c",line="7"@}
+(@value{GDBP})
+@end smallexample
+
+Function returning other than @code{void}. The name of the internal
+@value{GDBN} variable storing the result is printed, together with the
+value itself.
+
+@smallexample
+-exec-finish
+^running
+(@value{GDBP})
+*stopped,reason="function-finished",frame=@{addr="0x000107b0",func="foo",
+args=[@{name="a",value="1"],@{name="b",value="9"@}@},
+file="recursive2.c",line="14"@},
+gdb-result-var="$1",return-value="0"
+(@value{GDBP})
+@end smallexample
+
+
+@subheading The @code{-exec-interrupt} Command
+@findex -exec-interrupt
+
+@subsubheading Synopsis
+
+@smallexample
+ -exec-interrupt
+@end smallexample
+
+Asynchronous command. Interrupts the background execution of the target.
+Note how the token associated with the stop message is the one for the
+execution command that has been interrupted. The token for the interrupt
+itself only appears in the @samp{^done} output. If the user is trying to
+interrupt a non-running program, an error message will be printed.
+
+@subsubheading @value{GDBN} Command
+
+The corresponding @value{GDBN} command is @samp{interrupt}.
+
+@subsubheading Example
+
+@smallexample
+(@value{GDBP})
+111-exec-continue
+111^running
+
+(@value{GDBP})
+222-exec-interrupt
+222^done
+(@value{GDBP})
+111*stopped,signal-name="SIGINT",signal-meaning="Interrupt",
+frame=@{addr="0x00010140",func="foo",args=[],file="try.c",line="13"@}
+(@value{GDBP})
+
+(@value{GDBP})
+-exec-interrupt
+^error,msg="mi_cmd_exec_interrupt: Inferior not executing."
+(@value{GDBP})
+@end smallexample
+
+
+@subheading The @code{-exec-next} Command
+@findex -exec-next
+
+@subsubheading Synopsis
+
+@smallexample
+ -exec-next
+@end smallexample
+
+Asynchronous command. Resumes execution of the inferior program, stopping
+when the beginning of the next source line is reached.
+
+@subsubheading @value{GDBN} Command
+
+The corresponding @value{GDBN} command is @samp{next}.
+
+@subsubheading Example
+
+@smallexample
+-exec-next
+^running
+(@value{GDBP})
+*stopped,reason="end-stepping-range",line="8",file="hello.c"
+(@value{GDBP})
+@end smallexample
+
+
+@subheading The @code{-exec-next-instruction} Command
+@findex -exec-next-instruction
+
+@subsubheading Synopsis
+
+@smallexample
+ -exec-next-instruction
+@end smallexample
+
+Asynchronous command. Executes one machine instruction. If the
+instruction is a function call continues until the function returns. If
+the program stops at an instruction in the middle of a source line, the
+address will be printed as well.
+
+@subsubheading @value{GDBN} Command
+
+The corresponding @value{GDBN} command is @samp{nexti}.
+
+@subsubheading Example
+
+@smallexample
+(@value{GDBP})
+-exec-next-instruction
+^running
+
+(@value{GDBP})
+*stopped,reason="end-stepping-range",
+addr="0x000100d4",line="5",file="hello.c"
+(@value{GDBP})
+@end smallexample
+
+
+@subheading The @code{-exec-return} Command
+@findex -exec-return
+
+@subsubheading Synopsis
+
+@smallexample
+ -exec-return
+@end smallexample
+
+Makes current function return immediately. Doesn't execute the inferior.
+Displays the new current frame.
+
+@subsubheading @value{GDBN} Command
+
+The corresponding @value{GDBN} command is @samp{return}.
+
+@subsubheading Example
+
+@smallexample
+(@value{GDBP})
+200-break-insert callee4
+200^done,bkpt=@{number="1",addr="0x00010734",
+file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="8"@}
+(@value{GDBP})
+000-exec-run
+000^running
+(@value{GDBP})
+000*stopped,reason="breakpoint-hit",bkptno="1",
+frame=@{func="callee4",args=[],
+file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="8"@}
+(@value{GDBP})
+205-break-delete
+205^done
+(@value{GDBP})
+111-exec-return
+111^done,frame=@{level="0",func="callee3",
+args=[@{name="strarg",
+value="0x11940 \"A string argument.\""@}],
+file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="18"@}
+(@value{GDBP})
+@end smallexample
+
+
+@subheading The @code{-exec-run} Command
+@findex -exec-run
+
+@subsubheading Synopsis
+
+@smallexample
+ -exec-run
+@end smallexample
+
+Asynchronous command. Starts execution of the inferior from the
+beginning. The inferior executes until either a breakpoint is
+encountered or the program exits.
+
+@subsubheading @value{GDBN} Command
+
+The corresponding @value{GDBN} command is @samp{run}.
+
+@subsubheading Example
+
+@smallexample
+(@value{GDBP})
+-break-insert main
+^done,bkpt=@{number="1",addr="0x0001072c",file="recursive2.c",line="4"@}
+(@value{GDBP})
+-exec-run
+^running
+(@value{GDBP})
+*stopped,reason="breakpoint-hit",bkptno="1",
+frame=@{func="main",args=[],file="recursive2.c",line="4"@}
+(@value{GDBP})
+@end smallexample
+
+
+@subheading The @code{-exec-show-arguments} Command
+@findex -exec-show-arguments
+
+@subsubheading Synopsis
+
+@smallexample
+ -exec-show-arguments
+@end smallexample
+
+Print the arguments of the program.
+
+@subsubheading @value{GDBN} Command
+
+The corresponding @value{GDBN} command is @samp{show args}.
+
+@subsubheading Example
+N.A.
+
+@c @subheading -exec-signal
+
+@subheading The @code{-exec-step} Command
+@findex -exec-step
+
+@subsubheading Synopsis
+
+@smallexample
+ -exec-step
+@end smallexample
+
+Asynchronous command. Resumes execution of the inferior program, stopping
+when the beginning of the next source line is reached, if the next
+source line is not a function call. If it is, stop at the first
+instruction of the called function.
+
+@subsubheading @value{GDBN} Command
+
+The corresponding @value{GDBN} command is @samp{step}.
+
+@subsubheading Example
+
+Stepping into a function:
+
+@smallexample
+-exec-step
+^running
+(@value{GDBP})
+*stopped,reason="end-stepping-range",
+frame=@{func="foo",args=[@{name="a",value="10"@},
+@{name="b",value="0"@}],file="recursive2.c",line="11"@}
+(@value{GDBP})
+@end smallexample
+
+Regular stepping:
+
+@smallexample
+-exec-step
+^running
+(@value{GDBP})
+*stopped,reason="end-stepping-range",line="14",file="recursive2.c"
+(@value{GDBP})
+@end smallexample
+
+
+@subheading The @code{-exec-step-instruction} Command
+@findex -exec-step-instruction
+
+@subsubheading Synopsis
+
+@smallexample
+ -exec-step-instruction
+@end smallexample
+
+Asynchronous command. Resumes the inferior which executes one machine
+instruction. The output, once @value{GDBN} has stopped, will vary depending on
+whether we have stopped in the middle of a source line or not. In the
+former case, the address at which the program stopped will be printed as
+well.
+
+@subsubheading @value{GDBN} Command
+
+The corresponding @value{GDBN} command is @samp{stepi}.
+
+@subsubheading Example
+
+@smallexample
+(@value{GDBP})
+-exec-step-instruction
+^running
+
+(@value{GDBP})
+*stopped,reason="end-stepping-range",
+frame=@{func="foo",args=[],file="try.c",line="10"@}
+(@value{GDBP})
+-exec-step-instruction
+^running
+
+(@value{GDBP})
+*stopped,reason="end-stepping-range",
+frame=@{addr="0x000100f4",func="foo",args=[],file="try.c",line="10"@}
+(@value{GDBP})
+@end smallexample
+
+
+@subheading The @code{-exec-until} Command
+@findex -exec-until
+
+@subsubheading Synopsis
+
+@smallexample
+ -exec-until [ @var{location} ]
+@end smallexample
+
+Asynchronous command. Executes the inferior until the @var{location}
+specified in the argument is reached. If there is no argument, the inferior
+executes until a source line greater than the current one is reached.
+The reason for stopping in this case will be @samp{location-reached}.
+
+@subsubheading @value{GDBN} Command
+
+The corresponding @value{GDBN} command is @samp{until}.
+
+@subsubheading Example
+
+@smallexample
+(@value{GDBP})
+-exec-until recursive2.c:6
+^running
+(@value{GDBP})
+x = 55
+*stopped,reason="location-reached",frame=@{func="main",args=[],
+file="recursive2.c",line="6"@}
+(@value{GDBP})
+@end smallexample
+
+@ignore
+@subheading -file-clear
+Is this going away????
+@end ignore
+
+
+@subheading The @code{-file-exec-and-symbols} Command
+@findex -file-exec-and-symbols
+
+@subsubheading Synopsis
+
+@smallexample
+ -file-exec-and-symbols @var{file}
+@end smallexample
+
+Specify the executable file to be debugged. This file is the one from
+which the symbol table is also read. If no file is specified, the
+command clears the executable and symbol information. If breakpoints
+are set when using this command with no arguments, @value{GDBN} will produce
+error messages. Otherwise, no output is produced, except a completion
+notification.
+
+@subsubheading @value{GDBN} Command
+
+The corresponding @value{GDBN} command is @samp{file}.
+
+@subsubheading Example
+
+@smallexample
+(@value{GDBP})
+-file-exec-and-symbols /kwikemart/marge/ezannoni/TRUNK/mbx/hello.mbx
+^done
+(@value{GDBP})
+@end smallexample
+
+
+@subheading The @code{-file-exec-file} Command
+@findex -file-exec-file
+
+@subsubheading Synopsis
+
+@smallexample
+ -file-exec-file @var{file}
+@end smallexample
+
+Specify the executable file to be debugged. Unlike
+@samp{-file-exec-and-symbols}, the symbol table is @emph{not} read
+from this file. If used without argument, @value{GDBN} clears the information
+about the executable file. No output is produced, except a completion
+notification.
+
+@subsubheading @value{GDBN} Command
+
+The corresponding @value{GDBN} command is @samp{exec-file}.
+
+@subsubheading Example
+
+@smallexample
+(@value{GDBP})
+-file-exec-file /kwikemart/marge/ezannoni/TRUNK/mbx/hello.mbx
+^done
+(@value{GDBP})
+@end smallexample
+
+
+@subheading The @code{-file-list-exec-sections} Command
+@findex -file-list-exec-sections
+
+@subsubheading Synopsis
+
+@smallexample
+ -file-list-exec-sections
+@end smallexample
+
+List the sections of the current executable file.
+
+@subsubheading @value{GDBN} Command
+
+The @value{GDBN} command @samp{info file} shows, among the rest, the same
+information as this command. @code{gdbtk} has a corresponding command
+@samp{gdb_load_info}.
+
+@subsubheading Example
+N.A.
+
+
+@subheading The @code{-file-list-exec-source-file} Command
+@findex -file-list-exec-source-file
+
+@subsubheading Synopsis
+
+@smallexample
+ -file-list-exec-source-file
+@end smallexample
+
+List the line number, the current source file, and the absolute path
+to the current source file for the current executable.
+
+@subsubheading @value{GDBN} Command
+
+There's no @value{GDBN} command which directly corresponds to this one.
+
+@subsubheading Example
+
+@smallexample
+(@value{GDBP})
+123-file-list-exec-source-file
+123^done,line="1",file="foo.c",fullname="/home/bar/foo.c"
+(@value{GDBP})
+@end smallexample
+
+
+@subheading The @code{-file-list-exec-source-files} Command
+@findex -file-list-exec-source-files
+
+@subsubheading Synopsis
+
+@smallexample
+ -file-list-exec-source-files
+@end smallexample
+
+List the source files for the current executable.
+
+@subsubheading @value{GDBN} Command
+
+There's no @value{GDBN} command which directly corresponds to this one.
+@code{gdbtk} has an analogous command @samp{gdb_listfiles}.
+
+@subsubheading Example
+N.A.
+
+
+@subheading The @code{-file-list-shared-libraries} Command
+@findex -file-list-shared-libraries
+
+@subsubheading Synopsis
+
+@smallexample
+ -file-list-shared-libraries
+@end smallexample
+
+List the shared libraries in the program.
+
+@subsubheading @value{GDBN} Command
+
+The corresponding @value{GDBN} command is @samp{info shared}.
+
+@subsubheading Example
+N.A.
+
+
+@subheading The @code{-file-list-symbol-files} Command
+@findex -file-list-symbol-files
+
+@subsubheading Synopsis
+
+@smallexample
+ -file-list-symbol-files
+@end smallexample
+
+List symbol files.
+
+@subsubheading @value{GDBN} Command
+
+The corresponding @value{GDBN} command is @samp{info file} (part of it).
+
+@subsubheading Example
+N.A.
+
+
+@subheading The @code{-file-symbol-file} Command
+@findex -file-symbol-file
+
+@subsubheading Synopsis
+
+@smallexample
+ -file-symbol-file @var{file}
+@end smallexample
+
+Read symbol table info from the specified @var{file} argument. When
+used without arguments, clears @value{GDBN}'s symbol table info. No output is
+produced, except for a completion notification.
+
+@subsubheading @value{GDBN} Command
+
+The corresponding @value{GDBN} command is @samp{symbol-file}.
+
+@subsubheading Example
+
+@smallexample
+(@value{GDBP})
+-file-symbol-file /kwikemart/marge/ezannoni/TRUNK/mbx/hello.mbx
+^done
+(@value{GDBP})
+@end smallexample
+
+@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+@node GDB/MI Miscellaneous Commands
+@section Miscellaneous @value{GDBN} commands in @sc{gdb/mi}
+
+@c @subheading -gdb-complete
+
+@subheading The @code{-gdb-exit} Command
+@findex -gdb-exit
+
+@subsubheading Synopsis
+
+@smallexample
+ -gdb-exit
+@end smallexample
+
+Exit @value{GDBN} immediately.
+
+@subsubheading @value{GDBN} Command
+
+Approximately corresponds to @samp{quit}.
+
+@subsubheading Example
+
+@smallexample
+(@value{GDBP})
+-gdb-exit
+@end smallexample
+
+@subheading The @code{-gdb-set} Command
+@findex -gdb-set
+
+@subsubheading Synopsis
+
+@smallexample
+ -gdb-set
+@end smallexample
+
+Set an internal @value{GDBN} variable.
+@c IS THIS A DOLLAR VARIABLE? OR SOMETHING LIKE ANNOTATE ?????
+
+@subsubheading @value{GDBN} Command
+
+The corresponding @value{GDBN} command is @samp{set}.
+
+@subsubheading Example
+
+@smallexample
+(@value{GDBP})
+-gdb-set $foo=3
+^done
+(@value{GDBP})
+@end smallexample
+
+
+@subheading The @code{-gdb-show} Command
+@findex -gdb-show
+
+@subsubheading Synopsis
+
+@smallexample
+ -gdb-show
+@end smallexample
+
+Show the current value of a @value{GDBN} variable.
+
+@subsubheading @value{GDBN} command
+
+The corresponding @value{GDBN} command is @samp{show}.
+
+@subsubheading Example
+
+@smallexample
+(@value{GDBP})
+-gdb-show annotate
+^done,value="0"
+(@value{GDBP})
+@end smallexample
+
+@c @subheading -gdb-source
+
+
+@subheading The @code{-gdb-version} Command
+@findex -gdb-version
+
+@subsubheading Synopsis
+
+@smallexample
+ -gdb-version
+@end smallexample
+
+Show version information for @value{GDBN}. Used mostly in testing.
+
+@subsubheading @value{GDBN} Command
+
+There's no equivalent @value{GDBN} command. @value{GDBN} by default shows this
+information when you start an interactive session.
+
+@subsubheading Example
+
+@c This example modifies the actual output from GDB to avoid overfull
+@c box in TeX.
+@smallexample
+(@value{GDBP})
+-gdb-version
+~GNU gdb 5.2.1
+~Copyright 2000 Free Software Foundation, Inc.
+~GDB is free software, covered by the GNU General Public License, and
+~you are welcome to change it and/or distribute copies of it under
+~ certain conditions.
+~Type "show copying" to see the conditions.
+~There is absolutely no warranty for GDB. Type "show warranty" for
+~ details.
+~This GDB was configured as
+ "--host=sparc-sun-solaris2.5.1 --target=ppc-eabi".
+^done
+(@value{GDBP})
+@end smallexample
+
+@subheading The @code{-interpreter-exec} Command
+@findex -interpreter-exec
+
+@subheading Synopsis
+
+@smallexample
+-interpreter-exec @var{interpreter} @var{command}
+@end smallexample
+
+Execute the specified @var{command} in the given @var{interpreter}.
+
+@subheading @value{GDBN} Command
+
+The corresponding @value{GDBN} command is @samp{interpreter-exec}.
+
+@subheading Example
+
+@smallexample
+(@value{GDBP})
+-interpreter-exec console "break main"
+&"During symbol reading, couldn't parse type; debugger out of date?.\n"
+&"During symbol reading, bad structure-type format.\n"
+~"Breakpoint 1 at 0x8074fc6: file ../../src/gdb/main.c, line 743.\n"
+^done
+(@value{GDBP})
+@end smallexample
+
+@ignore
+@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+@node GDB/MI Kod Commands
+@section @sc{gdb/mi} Kod Commands
+
+The Kod commands are not implemented.
+
+@c @subheading -kod-info
+
+@c @subheading -kod-list
+
+@c @subheading -kod-list-object-types
+
+@c @subheading -kod-show
+
+@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+@node GDB/MI Memory Overlay Commands
+@section @sc{gdb/mi} Memory Overlay Commands
+
+The memory overlay commands are not implemented.
+
+@c @subheading -overlay-auto
+
+@c @subheading -overlay-list-mapping-state
+
+@c @subheading -overlay-list-overlays
+
+@c @subheading -overlay-map
+
+@c @subheading -overlay-off
+
+@c @subheading -overlay-on
+
+@c @subheading -overlay-unmap
+
+@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+@node GDB/MI Signal Handling Commands
+@section @sc{gdb/mi} Signal Handling Commands
+
+Signal handling commands are not implemented.
+
+@c @subheading -signal-handle
+
+@c @subheading -signal-list-handle-actions
+
+@c @subheading -signal-list-signal-types
+@end ignore
+
+
+@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+@node GDB/MI Stack Manipulation
+@section @sc{gdb/mi} Stack Manipulation Commands
+
+
+@subheading The @code{-stack-info-frame} Command
+@findex -stack-info-frame
+
+@subsubheading Synopsis
+
+@smallexample
+ -stack-info-frame
+@end smallexample
+
+Get info on the current frame.
+
+@subsubheading @value{GDBN} Command
+
+The corresponding @value{GDBN} command is @samp{info frame} or @samp{frame}
+(without arguments).
+
+@subsubheading Example
+N.A.
+
+@subheading The @code{-stack-info-depth} Command
+@findex -stack-info-depth
+
+@subsubheading Synopsis
+
+@smallexample
+ -stack-info-depth [ @var{max-depth} ]
+@end smallexample
+
+Return the depth of the stack. If the integer argument @var{max-depth}
+is specified, do not count beyond @var{max-depth} frames.
+
+@subsubheading @value{GDBN} Command
+
+There's no equivalent @value{GDBN} command.
+
+@subsubheading Example
+
+For a stack with frame levels 0 through 11:
+
+@smallexample
+(@value{GDBP})
+-stack-info-depth
+^done,depth="12"
+(@value{GDBP})
+-stack-info-depth 4
+^done,depth="4"
+(@value{GDBP})
+-stack-info-depth 12
+^done,depth="12"
+(@value{GDBP})
+-stack-info-depth 11
+^done,depth="11"
+(@value{GDBP})
+-stack-info-depth 13
+^done,depth="12"
+(@value{GDBP})
+@end smallexample
+
+@subheading The @code{-stack-list-arguments} Command
+@findex -stack-list-arguments
+
+@subsubheading Synopsis
+
+@smallexample
+ -stack-list-arguments @var{show-values}
+ [ @var{low-frame} @var{high-frame} ]
+@end smallexample
+
+Display a list of the arguments for the frames between @var{low-frame}
+and @var{high-frame} (inclusive). If @var{low-frame} and
+@var{high-frame} are not provided, list the arguments for the whole call
+stack.
+
+The @var{show-values} argument must have a value of 0 or 1. A value of
+0 means that only the names of the arguments are listed, a value of 1
+means that both names and values of the arguments are printed.
+
+@subsubheading @value{GDBN} Command
+
+@value{GDBN} does not have an equivalent command. @code{gdbtk} has a
+@samp{gdb_get_args} command which partially overlaps with the
+functionality of @samp{-stack-list-arguments}.
+
+@subsubheading Example
+
+@smallexample
+(@value{GDBP})
+-stack-list-frames
+^done,
+stack=[
+frame=@{level="0",addr="0x00010734",func="callee4",
+file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="8"@},
+frame=@{level="1",addr="0x0001076c",func="callee3",
+file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="17"@},
+frame=@{level="2",addr="0x0001078c",func="callee2",
+file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="22"@},
+frame=@{level="3",addr="0x000107b4",func="callee1",
+file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="27"@},
+frame=@{level="4",addr="0x000107e0",func="main",
+file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="32"@}]
+(@value{GDBP})
+-stack-list-arguments 0
+^done,
+stack-args=[
+frame=@{level="0",args=[]@},
+frame=@{level="1",args=[name="strarg"]@},
+frame=@{level="2",args=[name="intarg",name="strarg"]@},
+frame=@{level="3",args=[name="intarg",name="strarg",name="fltarg"]@},
+frame=@{level="4",args=[]@}]
+(@value{GDBP})
+-stack-list-arguments 1
+^done,
+stack-args=[
+frame=@{level="0",args=[]@},
+frame=@{level="1",
+ args=[@{name="strarg",value="0x11940 \"A string argument.\""@}]@},
+frame=@{level="2",args=[
+@{name="intarg",value="2"@},
+@{name="strarg",value="0x11940 \"A string argument.\""@}]@},
+@{frame=@{level="3",args=[
+@{name="intarg",value="2"@},
+@{name="strarg",value="0x11940 \"A string argument.\""@},
+@{name="fltarg",value="3.5"@}]@},
+frame=@{level="4",args=[]@}]
+(@value{GDBP})
+-stack-list-arguments 0 2 2
+^done,stack-args=[frame=@{level="2",args=[name="intarg",name="strarg"]@}]
+(@value{GDBP})
+-stack-list-arguments 1 2 2
+^done,stack-args=[frame=@{level="2",
+args=[@{name="intarg",value="2"@},
+@{name="strarg",value="0x11940 \"A string argument.\""@}]@}]
+(@value{GDBP})
+@end smallexample
+
+@c @subheading -stack-list-exception-handlers
+
+
+@subheading The @code{-stack-list-frames} Command
+@findex -stack-list-frames
+
+@subsubheading Synopsis
+
+@smallexample
+ -stack-list-frames [ @var{low-frame} @var{high-frame} ]
+@end smallexample
+
+List the frames currently on the stack. For each frame it displays the
+following info:
+
+@table @samp
+@item @var{level}
+The frame number, 0 being the topmost frame, i.e. the innermost function.
+@item @var{addr}
+The @code{$pc} value for that frame.
+@item @var{func}
+Function name.
+@item @var{file}
+File name of the source file where the function lives.
+@item @var{line}
+Line number corresponding to the @code{$pc}.
+@end table
+
+If invoked without arguments, this command prints a backtrace for the
+whole stack. If given two integer arguments, it shows the frames whose
+levels are between the two arguments (inclusive). If the two arguments
+are equal, it shows the single frame at the corresponding level.
+
+@subsubheading @value{GDBN} Command
+
+The corresponding @value{GDBN} commands are @samp{backtrace} and @samp{where}.
+
+@subsubheading Example
+
+Full stack backtrace:
+
+@smallexample
+(@value{GDBP})
+-stack-list-frames
+^done,stack=
+[frame=@{level="0",addr="0x0001076c",func="foo",
+ file="recursive2.c",line="11"@},
+frame=@{level="1",addr="0x000107a4",func="foo",
+ file="recursive2.c",line="14"@},
+frame=@{level="2",addr="0x000107a4",func="foo",
+ file="recursive2.c",line="14"@},
+frame=@{level="3",addr="0x000107a4",func="foo",
+ file="recursive2.c",line="14"@},
+frame=@{level="4",addr="0x000107a4",func="foo",
+ file="recursive2.c",line="14"@},
+frame=@{level="5",addr="0x000107a4",func="foo",
+ file="recursive2.c",line="14"@},
+frame=@{level="6",addr="0x000107a4",func="foo",
+ file="recursive2.c",line="14"@},
+frame=@{level="7",addr="0x000107a4",func="foo",
+ file="recursive2.c",line="14"@},
+frame=@{level="8",addr="0x000107a4",func="foo",
+ file="recursive2.c",line="14"@},
+frame=@{level="9",addr="0x000107a4",func="foo",
+ file="recursive2.c",line="14"@},
+frame=@{level="10",addr="0x000107a4",func="foo",
+ file="recursive2.c",line="14"@},
+frame=@{level="11",addr="0x00010738",func="main",
+ file="recursive2.c",line="4"@}]
+(@value{GDBP})
+@end smallexample
+
+Show frames between @var{low_frame} and @var{high_frame}:
+
+@smallexample
+(@value{GDBP})
+-stack-list-frames 3 5
+^done,stack=
+[frame=@{level="3",addr="0x000107a4",func="foo",
+ file="recursive2.c",line="14"@},
+frame=@{level="4",addr="0x000107a4",func="foo",
+ file="recursive2.c",line="14"@},
+frame=@{level="5",addr="0x000107a4",func="foo",
+ file="recursive2.c",line="14"@}]
+(@value{GDBP})
+@end smallexample
+
+Show a single frame:
+
+@smallexample
+(@value{GDBP})
+-stack-list-frames 3 3
+^done,stack=
+[frame=@{level="3",addr="0x000107a4",func="foo",
+ file="recursive2.c",line="14"@}]
+(@value{GDBP})
+@end smallexample
+
+
+@subheading The @code{-stack-list-locals} Command
+@findex -stack-list-locals
+
+@subsubheading Synopsis
+
+@smallexample
+ -stack-list-locals @var{print-values}
+@end smallexample
+
+Display the local variable names for the current frame. With an
+argument of 0 prints only the names of the variables, with argument of 1
+prints also their values.
+
+@subsubheading @value{GDBN} Command
+
+@samp{info locals} in @value{GDBN}, @samp{gdb_get_locals} in @code{gdbtk}.
+
+@subsubheading Example
+
+@smallexample
+(@value{GDBP})
+-stack-list-locals 0
+^done,locals=[name="A",name="B",name="C"]
+(@value{GDBP})
+-stack-list-locals 1
+^done,locals=[@{name="A",value="1"@},@{name="B",value="2"@},
+ @{name="C",value="3"@}]
+(@value{GDBP})
+@end smallexample
+
+
+@subheading The @code{-stack-select-frame} Command
+@findex -stack-select-frame
+
+@subsubheading Synopsis
+
+@smallexample
+ -stack-select-frame @var{framenum}
+@end smallexample
+
+Change the current frame. Select a different frame @var{framenum} on
+the stack.
+
+@subsubheading @value{GDBN} Command
+
+The corresponding @value{GDBN} commands are @samp{frame}, @samp{up},
+@samp{down}, @samp{select-frame}, @samp{up-silent}, and @samp{down-silent}.
+
+@subsubheading Example
+
+@smallexample
+(@value{GDBP})
+-stack-select-frame 2
+^done
+(@value{GDBP})
+@end smallexample
+
+@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+@node GDB/MI Symbol Query
+@section @sc{gdb/mi} Symbol Query Commands
+
+
+@subheading The @code{-symbol-info-address} Command
+@findex -symbol-info-address
+
+@subsubheading Synopsis
+
+@smallexample
+ -symbol-info-address @var{symbol}
+@end smallexample
+
+Describe where @var{symbol} is stored.
+
+@subsubheading @value{GDBN} Command
+
+The corresponding @value{GDBN} command is @samp{info address}.
+
+@subsubheading Example
+N.A.
+
+
+@subheading The @code{-symbol-info-file} Command
+@findex -symbol-info-file
+
+@subsubheading Synopsis
+
+@smallexample
+ -symbol-info-file
+@end smallexample
+
+Show the file for the symbol.
+
+@subsubheading @value{GDBN} Command
+
+There's no equivalent @value{GDBN} command. @code{gdbtk} has
+@samp{gdb_find_file}.
+
+@subsubheading Example
+N.A.
+
+
+@subheading The @code{-symbol-info-function} Command
+@findex -symbol-info-function
+
+@subsubheading Synopsis
+
+@smallexample
+ -symbol-info-function
+@end smallexample
+
+Show which function the symbol lives in.
+
+@subsubheading @value{GDBN} Command
+
+@samp{gdb_get_function} in @code{gdbtk}.
+
+@subsubheading Example
+N.A.
+
+
+@subheading The @code{-symbol-info-line} Command
+@findex -symbol-info-line
+
+@subsubheading Synopsis
+
+@smallexample
+ -symbol-info-line
+@end smallexample
+
+Show the core addresses of the code for a source line.
+
+@subsubheading @value{GDBN} Command
+
+The corresponding @value{GDBN} comamnd is @samp{info line}.
+@code{gdbtk} has the @samp{gdb_get_line} and @samp{gdb_get_file} commands.
+
+@subsubheading Example
+N.A.
+
+
+@subheading The @code{-symbol-info-symbol} Command
+@findex -symbol-info-symbol
+
+@subsubheading Synopsis
+
+@smallexample
+ -symbol-info-symbol @var{addr}
+@end smallexample
+
+Describe what symbol is at location @var{addr}.
+
+@subsubheading @value{GDBN} Command
+
+The corresponding @value{GDBN} command is @samp{info symbol}.
+
+@subsubheading Example
+N.A.
+
+
+@subheading The @code{-symbol-list-functions} Command
+@findex -symbol-list-functions
+
+@subsubheading Synopsis
+
+@smallexample
+ -symbol-list-functions
+@end smallexample
+
+List the functions in the executable.
+
+@subsubheading @value{GDBN} Command
+
+@samp{info functions} in @value{GDBN}, @samp{gdb_listfunc} and
+@samp{gdb_search} in @code{gdbtk}.
+
+@subsubheading Example
+N.A.
+
+
+@subheading The @code{-symbol-list-types} Command
+@findex -symbol-list-types
+
+@subsubheading Synopsis
+
+@smallexample
+ -symbol-list-types
+@end smallexample
+
+List all the type names.
+
+@subsubheading @value{GDBN} Command
+
+The corresponding commands are @samp{info types} in @value{GDBN},
+@samp{gdb_search} in @code{gdbtk}.
+
+@subsubheading Example
+N.A.
+
+
+@subheading The @code{-symbol-list-variables} Command
+@findex -symbol-list-variables
+
+@subsubheading Synopsis
+
+@smallexample
+ -symbol-list-variables
+@end smallexample
+
+List all the global and static variable names.
+
+@subsubheading @value{GDBN} Command
+
+@samp{info variables} in @value{GDBN}, @samp{gdb_search} in @code{gdbtk}.
+
+@subsubheading Example
+N.A.
+
+
+@subheading The @code{-symbol-locate} Command
+@findex -symbol-locate
+
+@subsubheading Synopsis
+
+@smallexample
+ -symbol-locate
+@end smallexample
+
+@subsubheading @value{GDBN} Command
+
+@samp{gdb_loc} in @code{gdbtk}.
+
+@subsubheading Example
+N.A.
+
+
+@subheading The @code{-symbol-type} Command
+@findex -symbol-type
+
+@subsubheading Synopsis
+
+@smallexample
+ -symbol-type @var{variable}
+@end smallexample
+
+Show type of @var{variable}.
+
+@subsubheading @value{GDBN} Command
+
+The corresponding @value{GDBN} command is @samp{ptype}, @code{gdbtk} has
+@samp{gdb_obj_variable}.
+
+@subsubheading Example
+N.A.
+
+
+@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+@node GDB/MI Target Manipulation
+@section @sc{gdb/mi} Target Manipulation Commands
+
+
+@subheading The @code{-target-attach} Command
+@findex -target-attach
+
+@subsubheading Synopsis
+
+@smallexample
+ -target-attach @var{pid} | @var{file}
+@end smallexample
+
+Attach to a process @var{pid} or a file @var{file} outside of @value{GDBN}.
+
+@subsubheading @value{GDBN} command
+
+The corresponding @value{GDBN} command is @samp{attach}.
+
+@subsubheading Example
+N.A.
+
+
+@subheading The @code{-target-compare-sections} Command
+@findex -target-compare-sections
+
+@subsubheading Synopsis
+
+@smallexample
+ -target-compare-sections [ @var{section} ]
+@end smallexample
+
+Compare data of section @var{section} on target to the exec file.
+Without the argument, all sections are compared.
+
+@subsubheading @value{GDBN} Command
+
+The @value{GDBN} equivalent is @samp{compare-sections}.
+
+@subsubheading Example
+N.A.
+
+
+@subheading The @code{-target-detach} Command
+@findex -target-detach
+
+@subsubheading Synopsis
+
+@smallexample
+ -target-detach
+@end smallexample
+
+Disconnect from the remote target. There's no output.
+
+@subsubheading @value{GDBN} command
+
+The corresponding @value{GDBN} command is @samp{detach}.
+
+@subsubheading Example
+
+@smallexample
+(@value{GDBP})
+-target-detach
+^done
+(@value{GDBP})
+@end smallexample
+
+
+@subheading The @code{-target-download} Command
+@findex -target-download
+
+@subsubheading Synopsis
+
+@smallexample
+ -target-download
+@end smallexample
+
+Loads the executable onto the remote target.
+It prints out an update message every half second, which includes the fields:
+
+@table @samp
+@item section
+The name of the section.
+@item section-sent
+The size of what has been sent so far for that section.
+@item section-size
+The size of the section.
+@item total-sent
+The total size of what was sent so far (the current and the previous sections).
+@item total-size
+The size of the overall executable to download.
+@end table
+
+@noindent
+Each message is sent as status record (@pxref{GDB/MI Output Syntax, ,
+@sc{gdb/mi} Output Syntax}).
+
+In addition, it prints the name and size of the sections, as they are
+downloaded. These messages include the following fields:
+
+@table @samp
+@item section
+The name of the section.
+@item section-size
+The size of the section.
+@item total-size
+The size of the overall executable to download.
+@end table
+
+@noindent
+At the end, a summary is printed.
+
+@subsubheading @value{GDBN} Command
+
+The corresponding @value{GDBN} command is @samp{load}.
+
+@subsubheading Example
+
+Note: each status message appears on a single line. Here the messages
+have been broken down so that they can fit onto a page.
+
+@smallexample
+(@value{GDBP})
+-target-download
++download,@{section=".text",section-size="6668",total-size="9880"@}
++download,@{section=".text",section-sent="512",section-size="6668",
+total-sent="512",total-size="9880"@}
++download,@{section=".text",section-sent="1024",section-size="6668",
+total-sent="1024",total-size="9880"@}
++download,@{section=".text",section-sent="1536",section-size="6668",
+total-sent="1536",total-size="9880"@}
++download,@{section=".text",section-sent="2048",section-size="6668",
+total-sent="2048",total-size="9880"@}
++download,@{section=".text",section-sent="2560",section-size="6668",
+total-sent="2560",total-size="9880"@}
++download,@{section=".text",section-sent="3072",section-size="6668",
+total-sent="3072",total-size="9880"@}
++download,@{section=".text",section-sent="3584",section-size="6668",
+total-sent="3584",total-size="9880"@}
++download,@{section=".text",section-sent="4096",section-size="6668",
+total-sent="4096",total-size="9880"@}
++download,@{section=".text",section-sent="4608",section-size="6668",
+total-sent="4608",total-size="9880"@}
++download,@{section=".text",section-sent="5120",section-size="6668",
+total-sent="5120",total-size="9880"@}
++download,@{section=".text",section-sent="5632",section-size="6668",
+total-sent="5632",total-size="9880"@}
++download,@{section=".text",section-sent="6144",section-size="6668",
+total-sent="6144",total-size="9880"@}
++download,@{section=".text",section-sent="6656",section-size="6668",
+total-sent="6656",total-size="9880"@}
++download,@{section=".init",section-size="28",total-size="9880"@}
++download,@{section=".fini",section-size="28",total-size="9880"@}
++download,@{section=".data",section-size="3156",total-size="9880"@}
++download,@{section=".data",section-sent="512",section-size="3156",
+total-sent="7236",total-size="9880"@}
++download,@{section=".data",section-sent="1024",section-size="3156",
+total-sent="7748",total-size="9880"@}
++download,@{section=".data",section-sent="1536",section-size="3156",
+total-sent="8260",total-size="9880"@}
++download,@{section=".data",section-sent="2048",section-size="3156",
+total-sent="8772",total-size="9880"@}
++download,@{section=".data",section-sent="2560",section-size="3156",
+total-sent="9284",total-size="9880"@}
++download,@{section=".data",section-sent="3072",section-size="3156",
+total-sent="9796",total-size="9880"@}
+^done,address="0x10004",load-size="9880",transfer-rate="6586",
+write-rate="429"
+(@value{GDBP})
+@end smallexample
+
+
+@subheading The @code{-target-exec-status} Command
+@findex -target-exec-status
+
+@subsubheading Synopsis
+
+@smallexample
+ -target-exec-status
+@end smallexample
+
+Provide information on the state of the target (whether it is running or
+not, for instance).
+
+@subsubheading @value{GDBN} Command
+
+There's no equivalent @value{GDBN} command.
+
+@subsubheading Example
+N.A.
+
+
+@subheading The @code{-target-list-available-targets} Command
+@findex -target-list-available-targets
+
+@subsubheading Synopsis
+
+@smallexample
+ -target-list-available-targets
+@end smallexample
+
+List the possible targets to connect to.
+
+@subsubheading @value{GDBN} Command
+
+The corresponding @value{GDBN} command is @samp{help target}.
+
+@subsubheading Example
+N.A.
+
+
+@subheading The @code{-target-list-current-targets} Command
+@findex -target-list-current-targets
+
+@subsubheading Synopsis
+
+@smallexample
+ -target-list-current-targets
+@end smallexample
+
+Describe the current target.
+
+@subsubheading @value{GDBN} Command
+
+The corresponding information is printed by @samp{info file} (among
+other things).
+
+@subsubheading Example
+N.A.
+
+
+@subheading The @code{-target-list-parameters} Command
+@findex -target-list-parameters
+
+@subsubheading Synopsis
+
+@smallexample
+ -target-list-parameters
+@end smallexample
+
+@c ????
+
+@subsubheading @value{GDBN} Command
+
+No equivalent.
+
+@subsubheading Example
+N.A.
+
+
+@subheading The @code{-target-select} Command
+@findex -target-select
+
+@subsubheading Synopsis
+
+@smallexample
+ -target-select @var{type} @var{parameters @dots{}}
+@end smallexample
+
+Connect @value{GDBN} to the remote target. This command takes two args:
+
+@table @samp
+@item @var{type}
+The type of target, for instance @samp{async}, @samp{remote}, etc.
+@item @var{parameters}
+Device names, host names and the like. @xref{Target Commands, ,
+Commands for managing targets}, for more details.
+@end table
+
+The output is a connection notification, followed by the address at
+which the target program is, in the following form:
+
+@smallexample
+^connected,addr="@var{address}",func="@var{function name}",
+ args=[@var{arg list}]
+@end smallexample
+
+@subsubheading @value{GDBN} Command
+
+The corresponding @value{GDBN} command is @samp{target}.
+
+@subsubheading Example
+
+@smallexample
+(@value{GDBP})
+-target-select async /dev/ttya
+^connected,addr="0xfe00a300",func="??",args=[]
+(@value{GDBP})
+@end smallexample
+
+@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+@node GDB/MI Thread Commands
+@section @sc{gdb/mi} Thread Commands
+
+
+@subheading The @code{-thread-info} Command
+@findex -thread-info
+
+@subsubheading Synopsis
+
+@smallexample
+ -thread-info
+@end smallexample
+
+@subsubheading @value{GDBN} command
+
+No equivalent.
+
+@subsubheading Example
+N.A.
+
+
+@subheading The @code{-thread-list-all-threads} Command
+@findex -thread-list-all-threads
+
+@subsubheading Synopsis
+
+@smallexample
+ -thread-list-all-threads
+@end smallexample
+
+@subsubheading @value{GDBN} Command
+
+The equivalent @value{GDBN} command is @samp{info threads}.
+
+@subsubheading Example
+N.A.
+
+
+@subheading The @code{-thread-list-ids} Command
+@findex -thread-list-ids
+
+@subsubheading Synopsis
+
+@smallexample
+ -thread-list-ids
+@end smallexample
+
+Produces a list of the currently known @value{GDBN} thread ids. At the
+end of the list it also prints the total number of such threads.
+
+@subsubheading @value{GDBN} Command
+
+Part of @samp{info threads} supplies the same information.
+
+@subsubheading Example
+
+No threads present, besides the main process:
+
+@smallexample
+(@value{GDBP})
+-thread-list-ids
+^done,thread-ids=@{@},number-of-threads="0"
+(@value{GDBP})
+@end smallexample
+
+
+Several threads:
+
+@smallexample
+(@value{GDBP})
+-thread-list-ids
+^done,thread-ids=@{thread-id="3",thread-id="2",thread-id="1"@},
+number-of-threads="3"
+(@value{GDBP})
+@end smallexample
+
+
+@subheading The @code{-thread-select} Command
+@findex -thread-select
+
+@subsubheading Synopsis
+
+@smallexample
+ -thread-select @var{threadnum}
+@end smallexample
+
+Make @var{threadnum} the current thread. It prints the number of the new
+current thread, and the topmost frame for that thread.
+
+@subsubheading @value{GDBN} Command
+
+The corresponding @value{GDBN} command is @samp{thread}.
+
+@subsubheading Example
+
+@smallexample
+(@value{GDBP})
+-exec-next
+^running
+(@value{GDBP})
+*stopped,reason="end-stepping-range",thread-id="2",line="187",
+file="../../../devo/gdb/testsuite/gdb.threads/linux-dp.c"
+(@value{GDBP})
+-thread-list-ids
+^done,
+thread-ids=@{thread-id="3",thread-id="2",thread-id="1"@},
+number-of-threads="3"
+(@value{GDBP})
+-thread-select 3
+^done,new-thread-id="3",
+frame=@{level="0",func="vprintf",
+args=[@{name="format",value="0x8048e9c \"%*s%c %d %c\\n\""@},
+@{name="arg",value="0x2"@}],file="vprintf.c",line="31"@}
+(@value{GDBP})
+@end smallexample
+
+@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+@node GDB/MI Tracepoint Commands
+@section @sc{gdb/mi} Tracepoint Commands
+
+The tracepoint commands are not yet implemented.
+
+@c @subheading -trace-actions
+
+@c @subheading -trace-delete
+
+@c @subheading -trace-disable
+
+@c @subheading -trace-dump
+
+@c @subheading -trace-enable
+
+@c @subheading -trace-exists
+
+@c @subheading -trace-find
+
+@c @subheading -trace-frame-number
+
+@c @subheading -trace-info
+
+@c @subheading -trace-insert
+
+@c @subheading -trace-list
+
+@c @subheading -trace-pass-count
+
+@c @subheading -trace-save
+
+@c @subheading -trace-start
+
+@c @subheading -trace-stop
+
+
+@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+@node GDB/MI Variable Objects
+@section @sc{gdb/mi} Variable Objects
+
+
+@subheading Motivation for Variable Objects in @sc{gdb/mi}
+
+For the implementation of a variable debugger window (locals, watched
+expressions, etc.), we are proposing the adaptation of the existing code
+used by @code{Insight}.
+
+The two main reasons for that are:
+
+@enumerate 1
+@item
+It has been proven in practice (it is already on its second generation).
+
+@item
+It will shorten development time (needless to say how important it is
+now).
+@end enumerate
+
+The original interface was designed to be used by Tcl code, so it was
+slightly changed so it could be used through @sc{gdb/mi}. This section
+describes the @sc{gdb/mi} operations that will be available and gives some
+hints about their use.
+
+@emph{Note}: In addition to the set of operations described here, we
+expect the @sc{gui} implementation of a variable window to require, at
+least, the following operations:
+
+@itemize @bullet
+@item @code{-gdb-show} @code{output-radix}
+@item @code{-stack-list-arguments}
+@item @code{-stack-list-locals}
+@item @code{-stack-select-frame}
+@end itemize
+
+@subheading Introduction to Variable Objects in @sc{gdb/mi}
+
+@cindex variable objects in @sc{gdb/mi}
+The basic idea behind variable objects is the creation of a named object
+to represent a variable, an expression, a memory location or even a CPU
+register. For each object created, a set of operations is available for
+examining or changing its properties.
+
+Furthermore, complex data types, such as C structures, are represented
+in a tree format. For instance, the @code{struct} type variable is the
+root and the children will represent the struct members. If a child
+is itself of a complex type, it will also have children of its own.
+Appropriate language differences are handled for C, C@t{++} and Java.
+
+When returning the actual values of the objects, this facility allows
+for the individual selection of the display format used in the result
+creation. It can be chosen among: binary, decimal, hexadecimal, octal
+and natural. Natural refers to a default format automatically
+chosen based on the variable type (like decimal for an @code{int}, hex
+for pointers, etc.).
+
+The following is the complete set of @sc{gdb/mi} operations defined to
+access this functionality:
+
+@multitable @columnfractions .4 .6
+@item @strong{Operation}
+@tab @strong{Description}
+
+@item @code{-var-create}
+@tab create a variable object
+@item @code{-var-delete}
+@tab delete the variable object and its children
+@item @code{-var-set-format}
+@tab set the display format of this variable
+@item @code{-var-show-format}
+@tab show the display format of this variable
+@item @code{-var-info-num-children}
+@tab tells how many children this object has
+@item @code{-var-list-children}
+@tab return a list of the object's children
+@item @code{-var-info-type}
+@tab show the type of this variable object
+@item @code{-var-info-expression}
+@tab print what this variable object represents
+@item @code{-var-show-attributes}
+@tab is this variable editable? does it exist here?
+@item @code{-var-evaluate-expression}
+@tab get the value of this variable
+@item @code{-var-assign}
+@tab set the value of this variable
+@item @code{-var-update}
+@tab update the variable and its children
+@end multitable
+
+In the next subsection we describe each operation in detail and suggest
+how it can be used.
+
+@subheading Description And Use of Operations on Variable Objects
+
+@subheading The @code{-var-create} Command
+@findex -var-create
+
+@subsubheading Synopsis
+
+@smallexample
+ -var-create @{@var{name} | "-"@}
+ @{@var{frame-addr} | "*"@} @var{expression}
+@end smallexample
+
+This operation creates a variable object, which allows the monitoring of
+a variable, the result of an expression, a memory cell or a CPU
+register.
+
+The @var{name} parameter is the string by which the object can be
+referenced. It must be unique. If @samp{-} is specified, the varobj
+system will generate a string ``varNNNNNN'' automatically. It will be
+unique provided that one does not specify @var{name} on that format.
+The command fails if a duplicate name is found.
+
+The frame under which the expression should be evaluated can be
+specified by @var{frame-addr}. A @samp{*} indicates that the current
+frame should be used.
+
+@var{expression} is any expression valid on the current language set (must not
+begin with a @samp{*}), or one of the following:
+
+@itemize @bullet
+@item
+@samp{*@var{addr}}, where @var{addr} is the address of a memory cell
+
+@item
+@samp{*@var{addr}-@var{addr}} --- a memory address range (TBD)
+
+@item
+@samp{$@var{regname}} --- a CPU register name
+@end itemize
+
+@subsubheading Result
+
+This operation returns the name, number of children and the type of the
+object created. Type is returned as a string as the ones generated by
+the @value{GDBN} CLI:
+
+@smallexample
+ name="@var{name}",numchild="N",type="@var{type}"
+@end smallexample
+
+
+@subheading The @code{-var-delete} Command
+@findex -var-delete
+
+@subsubheading Synopsis
+
+@smallexample
+ -var-delete @var{name}
+@end smallexample
+
+Deletes a previously created variable object and all of its children.
+
+Returns an error if the object @var{name} is not found.
+
+
+@subheading The @code{-var-set-format} Command
+@findex -var-set-format
+
+@subsubheading Synopsis
+
+@smallexample
+ -var-set-format @var{name} @var{format-spec}
+@end smallexample
+
+Sets the output format for the value of the object @var{name} to be
+@var{format-spec}.
+
+The syntax for the @var{format-spec} is as follows:
+
+@smallexample
+ @var{format-spec} @expansion{}
+ @{binary | decimal | hexadecimal | octal | natural@}
+@end smallexample
+
+
+@subheading The @code{-var-show-format} Command
+@findex -var-show-format
+
+@subsubheading Synopsis
+
+@smallexample
+ -var-show-format @var{name}
+@end smallexample
+
+Returns the format used to display the value of the object @var{name}.
+
+@smallexample
+ @var{format} @expansion{}
+ @var{format-spec}
+@end smallexample
+
+
+@subheading The @code{-var-info-num-children} Command
+@findex -var-info-num-children
+
+@subsubheading Synopsis
+
+@smallexample
+ -var-info-num-children @var{name}
+@end smallexample
+
+Returns the number of children of a variable object @var{name}:
+
+@smallexample
+ numchild=@var{n}
+@end smallexample
+
+
+@subheading The @code{-var-list-children} Command
+@findex -var-list-children
+
+@subsubheading Synopsis
+
+@smallexample
+ -var-list-children @var{name}
+@end smallexample
+
+Returns a list of the children of the specified variable object:
+
+@smallexample
+ numchild=@var{n},children=[@{name=@var{name},
+ numchild=@var{n},type=@var{type}@},@r{(repeats N times)}]
+@end smallexample
+
+
+@subheading The @code{-var-info-type} Command
+@findex -var-info-type
+
+@subsubheading Synopsis
+
+@smallexample
+ -var-info-type @var{name}
+@end smallexample
+
+Returns the type of the specified variable @var{name}. The type is
+returned as a string in the same format as it is output by the
+@value{GDBN} CLI:
+
+@smallexample
+ type=@var{typename}
+@end smallexample
+
+
+@subheading The @code{-var-info-expression} Command
+@findex -var-info-expression
+
+@subsubheading Synopsis
+
+@smallexample
+ -var-info-expression @var{name}
+@end smallexample
+
+Returns what is represented by the variable object @var{name}:
+
+@smallexample
+ lang=@var{lang-spec},exp=@var{expression}
+@end smallexample
+
+@noindent
+where @var{lang-spec} is @code{@{"C" | "C++" | "Java"@}}.
+
+@subheading The @code{-var-show-attributes} Command
+@findex -var-show-attributes
+
+@subsubheading Synopsis
+
+@smallexample
+ -var-show-attributes @var{name}
+@end smallexample
+
+List attributes of the specified variable object @var{name}:
+
+@smallexample
+ status=@var{attr} [ ( ,@var{attr} )* ]
+@end smallexample
+
+@noindent
+where @var{attr} is @code{@{ @{ editable | noneditable @} | TBD @}}.
+
+@subheading The @code{-var-evaluate-expression} Command
+@findex -var-evaluate-expression
+
+@subsubheading Synopsis
+
+@smallexample
+ -var-evaluate-expression @var{name}
+@end smallexample
+
+Evaluates the expression that is represented by the specified variable
+object and returns its value as a string in the current format specified
+for the object:
+
+@smallexample
+ value=@var{value}
+@end smallexample
+
+Note that one must invoke @code{-var-list-children} for a variable
+before the value of a child variable can be evaluated.
+
+@subheading The @code{-var-assign} Command
+@findex -var-assign
+
+@subsubheading Synopsis
+
+@smallexample
+ -var-assign @var{name} @var{expression}
+@end smallexample
+
+Assigns the value of @var{expression} to the variable object specified
+by @var{name}. The object must be @samp{editable}. If the variable's
+value is altered by the assign, the variable will show up in any
+subsequent @code{-var-update} list.
+
+@subsubheading Example
+
+@smallexample
+(@value{GDBP})
+-var-assign var1 3
+^done,value="3"
+(@value{GDBP})
+-var-update *
+^done,changelist=[@{name="var1",in_scope="true",type_changed="false"@}]
+(@value{GDBP})
+@end smallexample
+
+@subheading The @code{-var-update} Command
+@findex -var-update
+
+@subsubheading Synopsis
+
+@smallexample
+ -var-update @{@var{name} | "*"@}
+@end smallexample
+
+Update the value of the variable object @var{name} by evaluating its
+expression after fetching all the new values from memory or registers.
+A @samp{*} causes all existing variable objects to be updated.
+
+
+@node Annotations
+@chapter @value{GDBN} Annotations
+
+This chapter describes annotations in @value{GDBN}. Annotations are
+designed to interface @value{GDBN} to graphical user interfaces or
+other similar programs which want to interact with @value{GDBN} at a
+relatively high level.
+
+@ignore
+This is Edition @value{EDITION}, @value{DATE}.
+@end ignore
+
+@menu
+* Annotations Overview:: What annotations are; the general syntax.
+* Server Prefix:: Issuing a command without affecting user state.
+* Value Annotations:: Values are marked as such.
+* Frame Annotations:: Stack frames are annotated.
+* Displays:: @value{GDBN} can be told to display something periodically.
+* Prompting:: Annotations marking @value{GDBN}'s need for input.
+* Errors:: Annotations for error messages.
+* Breakpoint Info:: Information on breakpoints.
+* Invalidation:: Some annotations describe things now invalid.
+* Annotations for Running::
+ Whether the program is running, how it stopped, etc.
+* Source Annotations:: Annotations describing source code.
+* TODO:: Annotations which might be added in the future.
+@end menu
+
+@node Annotations Overview
+@section What is an Annotation?
+@cindex annotations
+
+To produce annotations, start @value{GDBN} with the @code{--annotate=2} option.
+
+Annotations start with a newline character, two @samp{control-z}
+characters, and the name of the annotation. If there is no additional
+information associated with this annotation, the name of the annotation
+is followed immediately by a newline. If there is additional
+information, the name of the annotation is followed by a space, the
+additional information, and a newline. The additional information
+cannot contain newline characters.
+
+Any output not beginning with a newline and two @samp{control-z}
+characters denotes literal output from @value{GDBN}. Currently there is
+no need for @value{GDBN} to output a newline followed by two
+@samp{control-z} characters, but if there was such a need, the
+annotations could be extended with an @samp{escape} annotation which
+means those three characters as output.
+
+A simple example of starting up @value{GDBN} with annotations is:
+
+@smallexample
+$ gdb --annotate=2
+GNU GDB 5.0
+Copyright 2000 Free Software Foundation, Inc.
+GDB is free software, covered by the GNU General Public License,
+and you are welcome to change it and/or distribute copies of it
+under certain conditions.
+Type "show copying" to see the conditions.
+There is absolutely no warranty for GDB. Type "show warranty"
+for details.
+This GDB was configured as "sparc-sun-sunos4.1.3"
+
+^Z^Zpre-prompt
+(gdb)
+^Z^Zprompt
+quit
+
+^Z^Zpost-prompt
+$
+@end smallexample
+
+Here @samp{quit} is input to @value{GDBN}; the rest is output from
+@value{GDBN}. The three lines beginning @samp{^Z^Z} (where @samp{^Z}
+denotes a @samp{control-z} character) are annotations; the rest is
+output from @value{GDBN}.
+
+@node Server Prefix
+@section The Server Prefix
+@cindex server prefix for annotations
+
+To issue a command to @value{GDBN} without affecting certain aspects of
+the state which is seen by users, prefix it with @samp{server }. This
+means that this command will not affect the command history, nor will it
+affect @value{GDBN}'s notion of which command to repeat if @key{RET} is
+pressed on a line by itself.
+
+The server prefix does not affect the recording of values into the value
+history; to print a value without recording it into the value history,
+use the @code{output} command instead of the @code{print} command.
+
+@node Value Annotations
+@section Values
+
+@cindex annotations for values
+When a value is printed in various contexts, @value{GDBN} uses
+annotations to delimit the value from the surrounding text.
+
+@findex value-history-begin
+@findex value-history-value
+@findex value-history-end
+If a value is printed using @code{print} and added to the value history,
+the annotation looks like
+
+@smallexample
+^Z^Zvalue-history-begin @var{history-number} @var{value-flags}
+@var{history-string}
+^Z^Zvalue-history-value
+@var{the-value}
+^Z^Zvalue-history-end
+@end smallexample
+
+@noindent
+where @var{history-number} is the number it is getting in the value
+history, @var{history-string} is a string, such as @samp{$5 = }, which
+introduces the value to the user, @var{the-value} is the output
+corresponding to the value itself, and @var{value-flags} is @samp{*} for
+a value which can be dereferenced and @samp{-} for a value which cannot.
+
+@findex value-begin
+@findex value-end
+If the value is not added to the value history (it is an invalid float
+or it is printed with the @code{output} command), the annotation is similar:
+
+@smallexample
+^Z^Zvalue-begin @var{value-flags}
+@var{the-value}
+^Z^Zvalue-end
+@end smallexample
+
+@findex arg-begin
+@findex arg-name-end
+@findex arg-value
+@findex arg-end
+When @value{GDBN} prints an argument to a function (for example, in the output
+from the @code{backtrace} command), it annotates it as follows:
+
+@smallexample
+^Z^Zarg-begin
+@var{argument-name}
+^Z^Zarg-name-end
+@var{separator-string}
+^Z^Zarg-value @var{value-flags}
+@var{the-value}
+^Z^Zarg-end
+@end smallexample
+
+@noindent
+where @var{argument-name} is the name of the argument,
+@var{separator-string} is text which separates the name from the value
+for the user's benefit (such as @samp{=}), and @var{value-flags} and
+@var{the-value} have the same meanings as in a
+@code{value-history-begin} annotation.
+
+@findex field-begin
+@findex field-name-end
+@findex field-value
+@findex field-end
+When printing a structure, @value{GDBN} annotates it as follows:
+
+@smallexample
+^Z^Zfield-begin @var{value-flags}
+@var{field-name}
+^Z^Zfield-name-end
+@var{separator-string}
+^Z^Zfield-value
+@var{the-value}
+^Z^Zfield-end
+@end smallexample
+
+@noindent
+where @var{field-name} is the name of the field, @var{separator-string}
+is text which separates the name from the value for the user's benefit
+(such as @samp{=}), and @var{value-flags} and @var{the-value} have the
+same meanings as in a @code{value-history-begin} annotation.
+
+When printing an array, @value{GDBN} annotates it as follows:
+
+@smallexample
+^Z^Zarray-section-begin @var{array-index} @var{value-flags}
+@end smallexample
+
+@noindent
+where @var{array-index} is the index of the first element being
+annotated and @var{value-flags} has the same meaning as in a
+@code{value-history-begin} annotation. This is followed by any number
+of elements, where is element can be either a single element:
+
+@findex elt
+@smallexample
+@samp{,} @var{whitespace} ; @r{omitted for the first element}
+@var{the-value}
+^Z^Zelt
+@end smallexample
+
+or a repeated element
+
+@findex elt-rep
+@findex elt-rep-end
+@smallexample
+@samp{,} @var{whitespace} ; @r{omitted for the first element}
+@var{the-value}
+^Z^Zelt-rep @var{number-of-repetitions}
+@var{repetition-string}
+^Z^Zelt-rep-end
+@end smallexample
+
+In both cases, @var{the-value} is the output for the value of the
+element and @var{whitespace} can contain spaces, tabs, and newlines. In
+the repeated case, @var{number-of-repetitions} is the number of
+consecutive array elements which contain that value, and
+@var{repetition-string} is a string which is designed to convey to the
+user that repetition is being depicted.
+
+@findex array-section-end
+Once all the array elements have been output, the array annotation is
+ended with
+
+@smallexample
+^Z^Zarray-section-end
+@end smallexample
+
+@node Frame Annotations
+@section Frames
+
+@cindex annotations for frames
+Whenever @value{GDBN} prints a frame, it annotates it. For example, this applies
+to frames printed when @value{GDBN} stops, output from commands such as
+@code{backtrace} or @code{up}, etc.
+
+@findex frame-begin
+The frame annotation begins with
+
+@smallexample
+^Z^Zframe-begin @var{level} @var{address}
+@var{level-string}
+@end smallexample
+
+@noindent
+where @var{level} is the number of the frame (0 is the innermost frame,
+and other frames have positive numbers), @var{address} is the address of
+the code executing in that frame, and @var{level-string} is a string
+designed to convey the level to the user. @var{address} is in the form
+@samp{0x} followed by one or more lowercase hex digits (note that this
+does not depend on the language). The frame ends with
+
+@findex frame-end
+@smallexample
+^Z^Zframe-end
+@end smallexample
+
+Between these annotations is the main body of the frame, which can
+consist of
+
+@itemize @bullet
+@item
+@findex function-call
+@smallexample
+^Z^Zfunction-call
+@var{function-call-string}
+@end smallexample
+
+where @var{function-call-string} is text designed to convey to the user
+that this frame is associated with a function call made by @value{GDBN} to a
+function in the program being debugged.
+
+@item
+@findex signal-handler-caller
+@smallexample
+^Z^Zsignal-handler-caller
+@var{signal-handler-caller-string}
+@end smallexample
+
+where @var{signal-handler-caller-string} is text designed to convey to
+the user that this frame is associated with whatever mechanism is used
+by this operating system to call a signal handler (it is the frame which
+calls the signal handler, not the frame for the signal handler itself).
+
+@item
+A normal frame.
+
+@findex frame-address
+@findex frame-address-end
+This can optionally (depending on whether this is thought of as
+interesting information for the user to see) begin with
+
+@smallexample
+^Z^Zframe-address
+@var{address}
+^Z^Zframe-address-end
+@var{separator-string}
+@end smallexample
+
+where @var{address} is the address executing in the frame (the same
+address as in the @code{frame-begin} annotation, but printed in a form
+which is intended for user consumption---in particular, the syntax varies
+depending on the language), and @var{separator-string} is a string
+intended to separate this address from what follows for the user's
+benefit.
+
+@findex frame-function-name
+@findex frame-args
+Then comes
+
+@smallexample
+^Z^Zframe-function-name
+@var{function-name}
+^Z^Zframe-args
+@var{arguments}
+@end smallexample
+
+where @var{function-name} is the name of the function executing in the
+frame, or @samp{??} if not known, and @var{arguments} are the arguments
+to the frame, with parentheses around them (each argument is annotated
+individually as well, @pxref{Value Annotations}).
+
+@findex frame-source-begin
+@findex frame-source-file
+@findex frame-source-file-end
+@findex frame-source-line
+@findex frame-source-end
+If source information is available, a reference to it is then printed:
+
+@smallexample
+^Z^Zframe-source-begin
+@var{source-intro-string}
+^Z^Zframe-source-file
+@var{filename}
+^Z^Zframe-source-file-end
+:
+^Z^Zframe-source-line
+@var{line-number}
+^Z^Zframe-source-end
+@end smallexample
+
+where @var{source-intro-string} separates for the user's benefit the
+reference from the text which precedes it, @var{filename} is the name of
+the source file, and @var{line-number} is the line number within that
+file (the first line is line 1).
+
+@findex frame-where
+If @value{GDBN} prints some information about where the frame is from (which
+library, which load segment, etc.; currently only done on the RS/6000),
+it is annotated with
+
+@smallexample
+^Z^Zframe-where
+@var{information}
+@end smallexample
+
+Then, if source is to actually be displayed for this frame (for example,
+this is not true for output from the @code{backtrace} command), then a
+@code{source} annotation (@pxref{Source Annotations}) is displayed. Unlike
+most annotations, this is output instead of the normal text which would be
+output, not in addition.
+@end itemize
+
+@node Displays
+@section Displays
+
+@findex display-begin
+@findex display-number-end
+@findex display-format
+@findex display-expression
+@findex display-expression-end
+@findex display-value
+@findex display-end
+@cindex annotations for display
+When @value{GDBN} is told to display something using the @code{display} command,
+the results of the display are annotated:
+
+@smallexample
+^Z^Zdisplay-begin
+@var{number}
+^Z^Zdisplay-number-end
+@var{number-separator}
+^Z^Zdisplay-format
+@var{format}
+^Z^Zdisplay-expression
+@var{expression}
+^Z^Zdisplay-expression-end
+@var{expression-separator}
+^Z^Zdisplay-value
+@var{value}
+^Z^Zdisplay-end
+@end smallexample
+
+@noindent
+where @var{number} is the number of the display, @var{number-separator}
+is intended to separate the number from what follows for the user,
+@var{format} includes information such as the size, format, or other
+information about how the value is being displayed, @var{expression} is
+the expression being displayed, @var{expression-separator} is intended
+to separate the expression from the text that follows for the user,
+and @var{value} is the actual value being displayed.
+
+@node Prompting
+@section Annotation for @value{GDBN} Input
+
+@cindex annotations for prompts
+When @value{GDBN} prompts for input, it annotates this fact so it is possible
+to know when to send output, when the output from a given command is
+over, etc.
+
+Different kinds of input each have a different @dfn{input type}. Each
+input type has three annotations: a @code{pre-} annotation, which
+denotes the beginning of any prompt which is being output, a plain
+annotation, which denotes the end of the prompt, and then a @code{post-}
+annotation which denotes the end of any echo which may (or may not) be
+associated with the input. For example, the @code{prompt} input type
+features the following annotations:
+
+@smallexample
+^Z^Zpre-prompt
+^Z^Zprompt
+^Z^Zpost-prompt
+@end smallexample
+
+The input types are
+
+@table @code
+@findex pre-prompt
+@findex prompt
+@findex post-prompt
+@item prompt
+When @value{GDBN} is prompting for a command (the main @value{GDBN} prompt).
+
+@findex pre-commands
+@findex commands
+@findex post-commands
+@item commands
+When @value{GDBN} prompts for a set of commands, like in the @code{commands}
+command. The annotations are repeated for each command which is input.
+
+@findex pre-overload-choice
+@findex overload-choice
+@findex post-overload-choice
+@item overload-choice
+When @value{GDBN} wants the user to select between various overloaded functions.
+
+@findex pre-query
+@findex query
+@findex post-query
+@item query
+When @value{GDBN} wants the user to confirm a potentially dangerous operation.
+
+@findex pre-prompt-for-continue
+@findex prompt-for-continue
+@findex post-prompt-for-continue
+@item prompt-for-continue
+When @value{GDBN} is asking the user to press return to continue. Note: Don't
+expect this to work well; instead use @code{set height 0} to disable
+prompting. This is because the counting of lines is buggy in the
+presence of annotations.
+@end table
+
+@node Errors
+@section Errors
+@cindex annotations for errors, warnings and interrupts
+
+@findex quit
+@smallexample
+^Z^Zquit
+@end smallexample
+
+This annotation occurs right before @value{GDBN} responds to an interrupt.
+
+@findex error
+@smallexample
+^Z^Zerror
+@end smallexample
+
+This annotation occurs right before @value{GDBN} responds to an error.
+
+Quit and error annotations indicate that any annotations which @value{GDBN} was
+in the middle of may end abruptly. For example, if a
+@code{value-history-begin} annotation is followed by a @code{error}, one
+cannot expect to receive the matching @code{value-history-end}. One
+cannot expect not to receive it either, however; an error annotation
+does not necessarily mean that @value{GDBN} is immediately returning all the way
+to the top level.
+
+@findex error-begin
+A quit or error annotation may be preceded by
+
+@smallexample
+^Z^Zerror-begin
+@end smallexample
+
+Any output between that and the quit or error annotation is the error
+message.
+
+Warning messages are not yet annotated.
+@c If we want to change that, need to fix warning(), type_error(),
+@c range_error(), and possibly other places.
+
+@node Breakpoint Info
+@section Information on Breakpoints
+
+@cindex annotations for breakpoints
+The output from the @code{info breakpoints} command is annotated as follows:
+
+@findex breakpoints-headers
+@findex breakpoints-table
+@smallexample
+^Z^Zbreakpoints-headers
+@var{header-entry}
+^Z^Zbreakpoints-table
+@end smallexample
+
+@noindent
+where @var{header-entry} has the same syntax as an entry (see below) but
+instead of containing data, it contains strings which are intended to
+convey the meaning of each field to the user. This is followed by any
+number of entries. If a field does not apply for this entry, it is
+omitted. Fields may contain trailing whitespace. Each entry consists
+of:
+
+@findex record
+@findex field
+@smallexample
+^Z^Zrecord
+^Z^Zfield 0
+@var{number}
+^Z^Zfield 1
+@var{type}
+^Z^Zfield 2
+@var{disposition}
+^Z^Zfield 3
+@var{enable}
+^Z^Zfield 4
+@var{address}
+^Z^Zfield 5
+@var{what}
+^Z^Zfield 6
+@var{frame}
+^Z^Zfield 7
+@var{condition}
+^Z^Zfield 8
+@var{ignore-count}
+^Z^Zfield 9
+@var{commands}
+@end smallexample
+
+Note that @var{address} is intended for user consumption---the syntax
+varies depending on the language.
+
+The output ends with
+
+@findex breakpoints-table-end
+@smallexample
+^Z^Zbreakpoints-table-end
+@end smallexample
+
+@node Invalidation
+@section Invalidation Notices
+
+@cindex annotations for invalidation messages
+The following annotations say that certain pieces of state may have
+changed.
+
+@table @code
+@findex frames-invalid
+@item ^Z^Zframes-invalid
+
+The frames (for example, output from the @code{backtrace} command) may
+have changed.
+
+@findex breakpoints-invalid
+@item ^Z^Zbreakpoints-invalid
+
+The breakpoints may have changed. For example, the user just added or
+deleted a breakpoint.
+@end table
+
+@node Annotations for Running
+@section Running the Program
+@cindex annotations for running programs
+
+@findex starting
+@findex stopping
+When the program starts executing due to a @value{GDBN} command such as
+@code{step} or @code{continue},
+
+@smallexample
+^Z^Zstarting
+@end smallexample
+
+is output. When the program stops,
+
+@smallexample
+^Z^Zstopped
+@end smallexample
+
+is output. Before the @code{stopped} annotation, a variety of
+annotations describe how the program stopped.
+
+@table @code
+@findex exited
+@item ^Z^Zexited @var{exit-status}
+The program exited, and @var{exit-status} is the exit status (zero for
+successful exit, otherwise nonzero).
+
+@findex signalled
+@findex signal-name
+@findex signal-name-end
+@findex signal-string
+@findex signal-string-end
+@item ^Z^Zsignalled
+The program exited with a signal. After the @code{^Z^Zsignalled}, the
+annotation continues:
+
+@smallexample
+@var{intro-text}
+^Z^Zsignal-name
+@var{name}
+^Z^Zsignal-name-end
+@var{middle-text}
+^Z^Zsignal-string
+@var{string}
+^Z^Zsignal-string-end
+@var{end-text}
+@end smallexample
+
+@noindent
+where @var{name} is the name of the signal, such as @code{SIGILL} or
+@code{SIGSEGV}, and @var{string} is the explanation of the signal, such
+as @code{Illegal Instruction} or @code{Segmentation fault}.
+@var{intro-text}, @var{middle-text}, and @var{end-text} are for the
+user's benefit and have no particular format.
+
+@findex signal
+@item ^Z^Zsignal
+The syntax of this annotation is just like @code{signalled}, but @value{GDBN} is
+just saying that the program received the signal, not that it was
+terminated with it.
+
+@findex breakpoint
+@item ^Z^Zbreakpoint @var{number}
+The program hit breakpoint number @var{number}.
+
+@findex watchpoint
+@item ^Z^Zwatchpoint @var{number}
+The program hit watchpoint number @var{number}.
+@end table
+
+@node Source Annotations
+@section Displaying Source
+@cindex annotations for source display
+
+@findex source
+The following annotation is used instead of displaying source code:
+
+@smallexample
+^Z^Zsource @var{filename}:@var{line}:@var{character}:@var{middle}:@var{addr}
+@end smallexample
+
+where @var{filename} is an absolute file name indicating which source
+file, @var{line} is the line number within that file (where 1 is the
+first line in the file), @var{character} is the character position
+within the file (where 0 is the first character in the file) (for most
+debug formats this will necessarily point to the beginning of a line),
+@var{middle} is @samp{middle} if @var{addr} is in the middle of the
+line, or @samp{beg} if @var{addr} is at the beginning of the line, and
+@var{addr} is the address in the target program associated with the
+source which is being displayed. @var{addr} is in the form @samp{0x}
+followed by one or more lowercase hex digits (note that this does not
+depend on the language).
+
+@node TODO
+@section Annotations We Might Want in the Future
+
+@format
+ - target-invalid
+ the target might have changed (registers, heap contents, or
+ execution status). For performance, we might eventually want
+ to hit `registers-invalid' and `all-registers-invalid' with
+ greater precision
+
+ - systematic annotation for set/show parameters (including
+ invalidation notices).
+
+ - similarly, `info' returns a list of candidates for invalidation
+ notices.
+@end format
@node GDB Bugs
@chapter Reporting Bugs in @value{GDBN}
@@ -14793,6 +19418,7 @@ compiled with the @samp{-pg} compiler option.
* General Query Packets::
* Register Packet Format::
* Examples::
+* File-I/O remote protocol extension::
@end menu
@node Overview
@@ -15017,9 +19643,12 @@ Reserved for future use.
Reserved for future use.
-@item @code{F} --- reserved
+@item @code{F}@var{RC}@code{,}@var{EE}@code{,}@var{CF}@code{;}@var{XX} --- Reply to target's F packet.
+@cindex @code{F} packet
-Reserved for future use.
+This packet is send by @value{GDBN} as reply to a @code{F} request packet
+sent by the target. This is part of the File-I/O protocol extension.
+@xref{File-I/O remote protocol extension}, for the specification.
@item @code{g} --- read registers
@anchor{read registers packet}
@@ -15518,6 +20147,24 @@ is a query initiated by the host debugger.}
any time while the program is running and the debugger should continue
to wait for @samp{W}, @samp{T}, etc.
+@item F@var{call-id}@code{,}@var{parameter@dots{}}
+
+@var{call-id} is the identifier which says which host system call should
+be called. This is just the name of the function. Translation into the
+correct system call is only applicable as it's defined in @value{GDBN}.
+@xref{File-I/O remote protocol extension}, for a list of implemented
+system calls.
+
+@var{parameter@dots{}} is a list of parameters as defined for this very
+system call.
+
+The target replies with this packet when it expects @value{GDBN} to call
+a host system call on behalf of the target. @value{GDBN} replies with
+an appropriate @code{F} packet and keeps up waiting for the next reply
+packet from the target. The latest @samp{C}, @samp{c}, @samp{S} or
+@samp{s} action is expected to be continued.
+@xref{File-I/O remote protocol extension}, for more details.
+
@end table
@node General Query Packets
@@ -15760,6 +20407,1149 @@ Example sequence of a target being stepped by a single instruction:
-> @code{+}
@end smallexample
+@node File-I/O remote protocol extension
+@section File-I/O remote protocol extension
+@cindex File-I/O remote protocol extension
+
+@menu
+* File-I/O Overview::
+* Protocol basics::
+* The `F' request packet::
+* The `F' reply packet::
+* Memory transfer::
+* The Ctrl-C message::
+* Console I/O::
+* The isatty call::
+* The system call::
+* List of supported calls::
+* Protocol specific representation of datatypes::
+* Constants::
+* File-I/O Examples::
+@end menu
+
+@node File-I/O Overview
+@subsection File-I/O Overview
+@cindex file-i/o overview
+
+The File I/O remote protocol extension (short: File-I/O) allows the
+target to use the hosts file system and console I/O when calling various
+system calls. System calls on the target system are translated into a
+remote protocol packet to the host system which then performs the needed
+actions and returns with an adequate response packet to the target system.
+This simulates file system operations even on targets that lack file systems.
+
+The protocol is defined host- and target-system independent. It uses
+it's own independent representation of datatypes and values. Both,
+@value{GDBN} and the target's @value{GDBN} stub are responsible for
+translating the system dependent values into the unified protocol values
+when data is transmitted.
+
+The communication is synchronous. A system call is possible only
+when GDB is waiting for the @samp{C}, @samp{c}, @samp{S} or @samp{s}
+packets. While @value{GDBN} handles the request for a system call,
+the target is stopped to allow deterministic access to the target's
+memory. Therefore File-I/O is not interuptible by target signals. It
+is possible to interrupt File-I/O by a user interrupt (Ctrl-C), though.
+
+The target's request to perform a host system call does not finish
+the latest @samp{C}, @samp{c}, @samp{S} or @samp{s} action. That means,
+after finishing the system call, the target returns to continuing the
+previous activity (continue, step). No additional continue or step
+request from @value{GDBN} is required.
+
+@smallexample
+(gdb) continue
+ <- target requests 'system call X'
+ target is stopped, @value{GDBN} executes system call
+ -> GDB returns result
+ ... target continues, GDB returns to wait for the target
+ <- target hits breakpoint and sends a Txx packet
+@end smallexample
+
+The protocol is only used for files on the host file system and
+for I/O on the console. Character or block special devices, pipes,
+named pipes or sockets or any other communication method on the host
+system are not supported by this protocol.
+
+@node Protocol basics
+@subsection Protocol basics
+@cindex protocol basics, file-i/o
+
+The File-I/O protocol uses the @code{F} packet, as request as well
+as as reply packet. Since a File-I/O system call can only occur when
+@value{GDBN} is waiting for the continuing or stepping target, the
+File-I/O request is a reply that @value{GDBN} has to expect as a result
+of a former @samp{C}, @samp{c}, @samp{S} or @samp{s} packet.
+This @code{F} packet contains all information needed to allow @value{GDBN}
+to call the appropriate host system call:
+
+@itemize @bullet
+@item
+A unique identifier for the requested system call.
+
+@item
+All parameters to the system call. Pointers are given as addresses
+in the target memory address space. Pointers to strings are given as
+pointer/length pair. Numerical values are given as they are.
+Numerical control values are given in a protocol specific representation.
+
+@end itemize
+
+At that point @value{GDBN} has to perform the following actions.
+
+@itemize @bullet
+@item
+If parameter pointer values are given, which point to data needed as input
+to a system call, @value{GDBN} requests this data from the target with a
+standard @code{m} packet request. This additional communication has to be
+expected by the target implementation and is handled as any other @code{m}
+packet.
+
+@item
+@value{GDBN} translates all value from protocol representation to host
+representation as needed. Datatypes are coerced into the host types.
+
+@item
+@value{GDBN} calls the system call
+
+@item
+It then coerces datatypes back to protocol representation.
+
+@item
+If pointer parameters in the request packet point to buffer space in which
+a system call is expected to copy data to, the data is transmitted to the
+target using a @code{M} or @code{X} packet. This packet has to be expected
+by the target implementation and is handled as any other @code{M} or @code{X}
+packet.
+
+@end itemize
+
+Eventually @value{GDBN} replies with another @code{F} packet which contains all
+necessary information for the target to continue. This at least contains
+
+@itemize @bullet
+@item
+Return value.
+
+@item
+@code{errno}, if has been changed by the system call.
+
+@item
+``Ctrl-C'' flag.
+
+@end itemize
+
+After having done the needed type and value coercion, the target continues
+the latest continue or step action.
+
+@node The `F' request packet
+@subsection The @code{F} request packet
+@cindex file-i/o request packet
+@cindex @code{F} request packet
+
+The @code{F} request packet has the following format:
+
+@table @samp
+
+@smallexample
+@code{F}@var{call-id}@code{,}@var{parameter@dots{}}
+@end smallexample
+
+@var{call-id} is the identifier to indicate the host system call to be called.
+This is just the name of the function.
+
+@var{parameter@dots{}} are the parameters to the system call.
+
+@end table
+
+Parameters are hexadecimal integer values, either the real values in case
+of scalar datatypes, as pointers to target buffer space in case of compound
+datatypes and unspecified memory areas or as pointer/length pairs in case
+of string parameters. These are appended to the call-id, each separated
+from its predecessor by a comma. All values are transmitted in ASCII
+string representation, pointer/length pairs separated by a slash.
+
+@node The `F' reply packet
+@subsection The @code{F} reply packet
+@cindex file-i/o reply packet
+@cindex @code{F} reply packet
+
+The @code{F} reply packet has the following format:
+
+@table @samp
+
+@smallexample
+@code{F}@var{retcode}@code{,}@var{errno}@code{,}@var{Ctrl-C flag}@code{;}@var{call specific attachment}
+@end smallexample
+
+@var{retcode} is the return code of the system call as hexadecimal value.
+
+@var{errno} is the errno set by the call, in protocol specific representation.
+This parameter can be omitted if the call was successful.
+
+@var{Ctrl-C flag} is only send if the user requested a break. In this
+case, @var{errno} must be send as well, even if the call was successful.
+The @var{Ctrl-C flag} itself consists of the character 'C':
+
+@smallexample
+F0,0,C
+@end smallexample
+
+@noindent
+or, if the call was interupted before the host call has been performed:
+
+@smallexample
+F-1,4,C
+@end smallexample
+
+@noindent
+assuming 4 is the protocol specific representation of @code{EINTR}.
+
+@end table
+
+@node Memory transfer
+@subsection Memory transfer
+@cindex memory transfer, in file-i/o protocol
+
+Structured data which is transferred using a memory read or write as e.g.@:
+a @code{struct stat} is expected to be in a protocol specific format with
+all scalar multibyte datatypes being big endian. This should be done by
+the target before the @code{F} packet is sent resp.@: by @value{GDBN} before
+it transfers memory to the target. Transferred pointers to structured
+data should point to the already coerced data at any time.
+
+@node The Ctrl-C message
+@subsection The Ctrl-C message
+@cindex ctrl-c message, in file-i/o protocol
+
+A special case is, if the @var{Ctrl-C flag} is set in the @value{GDBN}
+reply packet. In this case the target should behave, as if it had
+gotten a break message. The meaning for the target is ``system call
+interupted by @code{SIGINT}''. Consequentially, the target should actually stop
+(as with a break message) and return to @value{GDBN} with a @code{T02}
+packet. In this case, it's important for the target to know, in which
+state the system call was interrupted. Since this action is by design
+not an atomic operation, we have to differ between two cases:
+
+@itemize @bullet
+@item
+The system call hasn't been performed on the host yet.
+
+@item
+The system call on the host has been finished.
+
+@end itemize
+
+These two states can be distinguished by the target by the value of the
+returned @code{errno}. If it's the protocol representation of @code{EINTR}, the system
+call hasn't been performed. This is equivalent to the @code{EINTR} handling
+on POSIX systems. In any other case, the target may presume that the
+system call has been finished --- successful or not --- and should behave
+as if the break message arrived right after the system call.
+
+@value{GDBN} must behave reliable. If the system call has not been called
+yet, @value{GDBN} may send the @code{F} reply immediately, setting @code{EINTR} as
+@code{errno} in the packet. If the system call on the host has been finished
+before the user requests a break, the full action must be finshed by
+@value{GDBN}. This requires sending @code{M} or @code{X} packets as they fit.
+The @code{F} packet may only be send when either nothing has happened
+or the full action has been completed.
+
+@node Console I/O
+@subsection Console I/O
+@cindex console i/o as part of file-i/o
+
+By default and if not explicitely closed by the target system, the file
+descriptors 0, 1 and 2 are connected to the @value{GDBN} console. Output
+on the @value{GDBN} console is handled as any other file output operation
+(@code{write(1, @dots{})} or @code{write(2, @dots{})}). Console input is handled
+by @value{GDBN} so that after the target read request from file descriptor
+0 all following typing is buffered until either one of the following
+conditions is met:
+
+@itemize @bullet
+@item
+The user presses @kbd{Ctrl-C}. The behaviour is as explained above, the
+@code{read}
+system call is treated as finished.
+
+@item
+The user presses @kbd{Enter}. This is treated as end of input with a trailing
+line feed.
+
+@item
+The user presses @kbd{Ctrl-D}. This is treated as end of input. No trailing
+character, especially no Ctrl-D is appended to the input.
+
+@end itemize
+
+If the user has typed more characters as fit in the buffer given to
+the read call, the trailing characters are buffered in @value{GDBN} until
+either another @code{read(0, @dots{})} is requested by the target or debugging
+is stopped on users request.
+
+@node The isatty call
+@subsection The isatty(3) call
+@cindex isatty call, file-i/o protocol
+
+A special case in this protocol is the library call @code{isatty} which
+is implemented as it's own call inside of this protocol. It returns
+1 to the target if the file descriptor given as parameter is attached
+to the @value{GDBN} console, 0 otherwise. Implementing through system calls
+would require implementing @code{ioctl} and would be more complex than
+needed.
+
+@node The system call
+@subsection The system(3) call
+@cindex system call, file-i/o protocol
+
+The other special case in this protocol is the @code{system} call which
+is implemented as it's own call, too. @value{GDBN} is taking over the full
+task of calling the necessary host calls to perform the @code{system}
+call. The return value of @code{system} is simplified before it's returned
+to the target. Basically, the only signal transmitted back is @code{EINTR}
+in case the user pressed @kbd{Ctrl-C}. Otherwise the return value consists
+entirely of the exit status of the called command.
+
+Due to security concerns, the @code{system} call is refused to be called
+by @value{GDBN} by default. The user has to allow this call explicitly by
+entering
+
+@table @samp
+@kindex set remote system-call-allowed 1
+@item @code{set remote system-call-allowed 1}
+@end table
+
+Disabling the @code{system} call is done by
+
+@table @samp
+@kindex set remote system-call-allowed 0
+@item @code{set remote system-call-allowed 0}
+@end table
+
+The current setting is shown by typing
+
+@table @samp
+@kindex show remote system-call-allowed
+@item @code{show remote system-call-allowed}
+@end table
+
+@node List of supported calls
+@subsection List of supported calls
+@cindex list of supported file-i/o calls
+
+@menu
+* open::
+* close::
+* read::
+* write::
+* lseek::
+* rename::
+* unlink::
+* stat/fstat::
+* gettimeofday::
+* isatty::
+* system::
+@end menu
+
+@node open
+@unnumberedsubsubsec open
+@cindex open, file-i/o system call
+
+@smallexample
+@exdent Synopsis:
+int open(const char *pathname, int flags);
+int open(const char *pathname, int flags, mode_t mode);
+
+@exdent Request:
+Fopen,pathptr/len,flags,mode
+@end smallexample
+
+@noindent
+@code{flags} is the bitwise or of the following values:
+
+@table @code
+@item O_CREAT
+If the file does not exist it will be created. The host
+rules apply as far as file ownership and time stamps
+are concerned.
+
+@item O_EXCL
+When used with O_CREAT, if the file already exists it is
+an error and open() fails.
+
+@item O_TRUNC
+If the file already exists and the open mode allows
+writing (O_RDWR or O_WRONLY is given) it will be
+truncated to length 0.
+
+@item O_APPEND
+The file is opened in append mode.
+
+@item O_RDONLY
+The file is opened for reading only.
+
+@item O_WRONLY
+The file is opened for writing only.
+
+@item O_RDWR
+The file is opened for reading and writing.
+
+@noindent
+Each other bit is silently ignored.
+
+@end table
+
+@noindent
+@code{mode} is the bitwise or of the following values:
+
+@table @code
+@item S_IRUSR
+User has read permission.
+
+@item S_IWUSR
+User has write permission.
+
+@item S_IRGRP
+Group has read permission.
+
+@item S_IWGRP
+Group has write permission.
+
+@item S_IROTH
+Others have read permission.
+
+@item S_IWOTH
+Others have write permission.
+
+@noindent
+Each other bit is silently ignored.
+
+@end table
+
+@smallexample
+@exdent Return value:
+open returns the new file descriptor or -1 if an error
+occured.
+
+@exdent Errors:
+@end smallexample
+
+@table @code
+@item EEXIST
+pathname already exists and O_CREAT and O_EXCL were used.
+
+@item EISDIR
+pathname refers to a directory.
+
+@item EACCES
+The requested access is not allowed.
+
+@item ENAMETOOLONG
+pathname was too long.
+
+@item ENOENT
+A directory component in pathname does not exist.
+
+@item ENODEV
+pathname refers to a device, pipe, named pipe or socket.
+
+@item EROFS
+pathname refers to a file on a read-only filesystem and
+write access was requested.
+
+@item EFAULT
+pathname is an invalid pointer value.
+
+@item ENOSPC
+No space on device to create the file.
+
+@item EMFILE
+The process already has the maximum number of files open.
+
+@item ENFILE
+The limit on the total number of files open on the system
+has been reached.
+
+@item EINTR
+The call was interrupted by the user.
+@end table
+
+@node close
+@unnumberedsubsubsec close
+@cindex close, file-i/o system call
+
+@smallexample
+@exdent Synopsis:
+int close(int fd);
+
+@exdent Request:
+Fclose,fd
+
+@exdent Return value:
+close returns zero on success, or -1 if an error occurred.
+
+@exdent Errors:
+@end smallexample
+
+@table @code
+@item EBADF
+fd isn't a valid open file descriptor.
+
+@item EINTR
+The call was interrupted by the user.
+@end table
+
+@node read
+@unnumberedsubsubsec read
+@cindex read, file-i/o system call
+
+@smallexample
+@exdent Synopsis:
+int read(int fd, void *buf, unsigned int count);
+
+@exdent Request:
+Fread,fd,bufptr,count
+
+@exdent Return value:
+On success, the number of bytes read is returned.
+Zero indicates end of file. If count is zero, read
+returns zero as well. On error, -1 is returned.
+
+@exdent Errors:
+@end smallexample
+
+@table @code
+@item EBADF
+fd is not a valid file descriptor or is not open for
+reading.
+
+@item EFAULT
+buf is an invalid pointer value.
+
+@item EINTR
+The call was interrupted by the user.
+@end table
+
+@node write
+@unnumberedsubsubsec write
+@cindex write, file-i/o system call
+
+@smallexample
+@exdent Synopsis:
+int write(int fd, const void *buf, unsigned int count);
+
+@exdent Request:
+Fwrite,fd,bufptr,count
+
+@exdent Return value:
+On success, the number of bytes written are returned.
+Zero indicates nothing was written. On error, -1
+is returned.
+
+@exdent Errors:
+@end smallexample
+
+@table @code
+@item EBADF
+fd is not a valid file descriptor or is not open for
+writing.
+
+@item EFAULT
+buf is an invalid pointer value.
+
+@item EFBIG
+An attempt was made to write a file that exceeds the
+host specific maximum file size allowed.
+
+@item ENOSPC
+No space on device to write the data.
+
+@item EINTR
+The call was interrupted by the user.
+@end table
+
+@node lseek
+@unnumberedsubsubsec lseek
+@cindex lseek, file-i/o system call
+
+@smallexample
+@exdent Synopsis:
+long lseek (int fd, long offset, int flag);
+
+@exdent Request:
+Flseek,fd,offset,flag
+@end smallexample
+
+@code{flag} is one of:
+
+@table @code
+@item SEEK_SET
+The offset is set to offset bytes.
+
+@item SEEK_CUR
+The offset is set to its current location plus offset
+bytes.
+
+@item SEEK_END
+The offset is set to the size of the file plus offset
+bytes.
+@end table
+
+@smallexample
+@exdent Return value:
+On success, the resulting unsigned offset in bytes from
+the beginning of the file is returned. Otherwise, a
+value of -1 is returned.
+
+@exdent Errors:
+@end smallexample
+
+@table @code
+@item EBADF
+fd is not a valid open file descriptor.
+
+@item ESPIPE
+fd is associated with the @value{GDBN} console.
+
+@item EINVAL
+flag is not a proper value.
+
+@item EINTR
+The call was interrupted by the user.
+@end table
+
+@node rename
+@unnumberedsubsubsec rename
+@cindex rename, file-i/o system call
+
+@smallexample
+@exdent Synopsis:
+int rename(const char *oldpath, const char *newpath);
+
+@exdent Request:
+Frename,oldpathptr/len,newpathptr/len
+
+@exdent Return value:
+On success, zero is returned. On error, -1 is returned.
+
+@exdent Errors:
+@end smallexample
+
+@table @code
+@item EISDIR
+newpath is an existing directory, but oldpath is not a
+directory.
+
+@item EEXIST
+newpath is a non-empty directory.
+
+@item EBUSY
+oldpath or newpath is a directory that is in use by some
+process.
+
+@item EINVAL
+An attempt was made to make a directory a subdirectory
+of itself.
+
+@item ENOTDIR
+A component used as a directory in oldpath or new
+path is not a directory. Or oldpath is a directory
+and newpath exists but is not a directory.
+
+@item EFAULT
+oldpathptr or newpathptr are invalid pointer values.
+
+@item EACCES
+No access to the file or the path of the file.
+
+@item ENAMETOOLONG
+
+oldpath or newpath was too long.
+
+@item ENOENT
+A directory component in oldpath or newpath does not exist.
+
+@item EROFS
+The file is on a read-only filesystem.
+
+@item ENOSPC
+The device containing the file has no room for the new
+directory entry.
+
+@item EINTR
+The call was interrupted by the user.
+@end table
+
+@node unlink
+@unnumberedsubsubsec unlink
+@cindex unlink, file-i/o system call
+
+@smallexample
+@exdent Synopsis:
+int unlink(const char *pathname);
+
+@exdent Request:
+Funlink,pathnameptr/len
+
+@exdent Return value:
+On success, zero is returned. On error, -1 is returned.
+
+@exdent Errors:
+@end smallexample
+
+@table @code
+@item EACCES
+No access to the file or the path of the file.
+
+@item EPERM
+The system does not allow unlinking of directories.
+
+@item EBUSY
+The file pathname cannot be unlinked because it's
+being used by another process.
+
+@item EFAULT
+pathnameptr is an invalid pointer value.
+
+@item ENAMETOOLONG
+pathname was too long.
+
+@item ENOENT
+A directory component in pathname does not exist.
+
+@item ENOTDIR
+A component of the path is not a directory.
+
+@item EROFS
+The file is on a read-only filesystem.
+
+@item EINTR
+The call was interrupted by the user.
+@end table
+
+@node stat/fstat
+@unnumberedsubsubsec stat/fstat
+@cindex fstat, file-i/o system call
+@cindex stat, file-i/o system call
+
+@smallexample
+@exdent Synopsis:
+int stat(const char *pathname, struct stat *buf);
+int fstat(int fd, struct stat *buf);
+
+@exdent Request:
+Fstat,pathnameptr/len,bufptr
+Ffstat,fd,bufptr
+
+@exdent Return value:
+On success, zero is returned. On error, -1 is returned.
+
+@exdent Errors:
+@end smallexample
+
+@table @code
+@item EBADF
+fd is not a valid open file.
+
+@item ENOENT
+A directory component in pathname does not exist or the
+path is an empty string.
+
+@item ENOTDIR
+A component of the path is not a directory.
+
+@item EFAULT
+pathnameptr is an invalid pointer value.
+
+@item EACCES
+No access to the file or the path of the file.
+
+@item ENAMETOOLONG
+pathname was too long.
+
+@item EINTR
+The call was interrupted by the user.
+@end table
+
+@node gettimeofday
+@unnumberedsubsubsec gettimeofday
+@cindex gettimeofday, file-i/o system call
+
+@smallexample
+@exdent Synopsis:
+int gettimeofday(struct timeval *tv, void *tz);
+
+@exdent Request:
+Fgettimeofday,tvptr,tzptr
+
+@exdent Return value:
+On success, 0 is returned, -1 otherwise.
+
+@exdent Errors:
+@end smallexample
+
+@table @code
+@item EINVAL
+tz is a non-NULL pointer.
+
+@item EFAULT
+tvptr and/or tzptr is an invalid pointer value.
+@end table
+
+@node isatty
+@unnumberedsubsubsec isatty
+@cindex isatty, file-i/o system call
+
+@smallexample
+@exdent Synopsis:
+int isatty(int fd);
+
+@exdent Request:
+Fisatty,fd
+
+@exdent Return value:
+Returns 1 if fd refers to the @value{GDBN} console, 0 otherwise.
+
+@exdent Errors:
+@end smallexample
+
+@table @code
+@item EINTR
+The call was interrupted by the user.
+@end table
+
+@node system
+@unnumberedsubsubsec system
+@cindex system, file-i/o system call
+
+@smallexample
+@exdent Synopsis:
+int system(const char *command);
+
+@exdent Request:
+Fsystem,commandptr/len
+
+@exdent Return value:
+The value returned is -1 on error and the return status
+of the command otherwise. Only the exit status of the
+command is returned, which is extracted from the hosts
+system return value by calling WEXITSTATUS(retval).
+In case /bin/sh could not be executed, 127 is returned.
+
+@exdent Errors:
+@end smallexample
+
+@table @code
+@item EINTR
+The call was interrupted by the user.
+@end table
+
+@node Protocol specific representation of datatypes
+@subsection Protocol specific representation of datatypes
+@cindex protocol specific representation of datatypes, in file-i/o protocol
+
+@menu
+* Integral datatypes::
+* Pointer values::
+* struct stat::
+* struct timeval::
+@end menu
+
+@node Integral datatypes
+@unnumberedsubsubsec Integral datatypes
+@cindex integral datatypes, in file-i/o protocol
+
+The integral datatypes used in the system calls are
+
+@smallexample
+int@r{,} unsigned int@r{,} long@r{,} unsigned long@r{,} mode_t @r{and} time_t
+@end smallexample
+
+@code{Int}, @code{unsigned int}, @code{mode_t} and @code{time_t} are
+implemented as 32 bit values in this protocol.
+
+@code{Long} and @code{unsigned long} are implemented as 64 bit types.
+
+@xref{Limits}, for corresponding MIN and MAX values (similar to those
+in @file{limits.h}) to allow range checking on host and target.
+
+@code{time_t} datatypes are defined as seconds since the Epoch.
+
+All integral datatypes transferred as part of a memory read or write of a
+structured datatype e.g.@: a @code{struct stat} have to be given in big endian
+byte order.
+
+@node Pointer values
+@unnumberedsubsubsec Pointer values
+@cindex pointer values, in file-i/o protocol
+
+Pointers to target data are transmitted as they are. An exception
+is made for pointers to buffers for which the length isn't
+transmitted as part of the function call, namely strings. Strings
+are transmitted as a pointer/length pair, both as hex values, e.g.@:
+
+@smallexample
+@code{1aaf/12}
+@end smallexample
+
+@noindent
+which is a pointer to data of length 18 bytes at position 0x1aaf.
+The length is defined as the full string length in bytes, including
+the trailing null byte. Example:
+
+@smallexample
+``hello, world'' at address 0x123456
+@end smallexample
+
+@noindent
+is transmitted as
+
+@smallexample
+@code{123456/d}
+@end smallexample
+
+@node struct stat
+@unnumberedsubsubsec struct stat
+@cindex struct stat, in file-i/o protocol
+
+The buffer of type struct stat used by the target and @value{GDBN} is defined
+as follows:
+
+@smallexample
+struct stat @{
+ unsigned int st_dev; /* device */
+ unsigned int st_ino; /* inode */
+ mode_t st_mode; /* protection */
+ unsigned int st_nlink; /* number of hard links */
+ unsigned int st_uid; /* user ID of owner */
+ unsigned int st_gid; /* group ID of owner */
+ unsigned int st_rdev; /* device type (if inode device) */
+ unsigned long st_size; /* total size, in bytes */
+ unsigned long st_blksize; /* blocksize for filesystem I/O */
+ unsigned long st_blocks; /* number of blocks allocated */
+ time_t st_atime; /* time of last access */
+ time_t st_mtime; /* time of last modification */
+ time_t st_ctime; /* time of last change */
+@};
+@end smallexample
+
+The integral datatypes are conforming to the definitions given in the
+approriate section (see @ref{Integral datatypes}, for details) so this
+structure is of size 64 bytes.
+
+The values of several fields have a restricted meaning and/or
+range of values.
+
+@smallexample
+st_dev: 0 file
+ 1 console
+
+st_ino: No valid meaning for the target. Transmitted unchanged.
+
+st_mode: Valid mode bits are described in Appendix C. Any other
+ bits have currently no meaning for the target.
+
+st_uid: No valid meaning for the target. Transmitted unchanged.
+
+st_gid: No valid meaning for the target. Transmitted unchanged.
+
+st_rdev: No valid meaning for the target. Transmitted unchanged.
+
+st_atime, st_mtime, st_ctime:
+ These values have a host and file system dependent
+ accuracy. Especially on Windows hosts the file systems
+ don't support exact timing values.
+@end smallexample
+
+The target gets a struct stat of the above representation and is
+responsible to coerce it to the target representation before
+continuing.
+
+Note that due to size differences between the host and target
+representation of stat members, these members could eventually
+get truncated on the target.
+
+@node struct timeval
+@unnumberedsubsubsec struct timeval
+@cindex struct timeval, in file-i/o protocol
+
+The buffer of type struct timeval used by the target and @value{GDBN}
+is defined as follows:
+
+@smallexample
+struct timeval @{
+ time_t tv_sec; /* second */
+ long tv_usec; /* microsecond */
+@};
+@end smallexample
+
+The integral datatypes are conforming to the definitions given in the
+approriate section (see @ref{Integral datatypes}, for details) so this
+structure is of size 8 bytes.
+
+@node Constants
+@subsection Constants
+@cindex constants, in file-i/o protocol
+
+The following values are used for the constants inside of the
+protocol. @value{GDBN} and target are resposible to translate these
+values before and after the call as needed.
+
+@menu
+* Open flags::
+* mode_t values::
+* Errno values::
+* Lseek flags::
+* Limits::
+@end menu
+
+@node Open flags
+@unnumberedsubsubsec Open flags
+@cindex open flags, in file-i/o protocol
+
+All values are given in hexadecimal representation.
+
+@smallexample
+ O_RDONLY 0x0
+ O_WRONLY 0x1
+ O_RDWR 0x2
+ O_APPEND 0x8
+ O_CREAT 0x200
+ O_TRUNC 0x400
+ O_EXCL 0x800
+@end smallexample
+
+@node mode_t values
+@unnumberedsubsubsec mode_t values
+@cindex mode_t values, in file-i/o protocol
+
+All values are given in octal representation.
+
+@smallexample
+ S_IFREG 0100000
+ S_IFDIR 040000
+ S_IRUSR 0400
+ S_IWUSR 0200
+ S_IXUSR 0100
+ S_IRGRP 040
+ S_IWGRP 020
+ S_IXGRP 010
+ S_IROTH 04
+ S_IWOTH 02
+ S_IXOTH 01
+@end smallexample
+
+@node Errno values
+@unnumberedsubsubsec Errno values
+@cindex errno values, in file-i/o protocol
+
+All values are given in decimal representation.
+
+@smallexample
+ EPERM 1
+ ENOENT 2
+ EINTR 4
+ EBADF 9
+ EACCES 13
+ EFAULT 14
+ EBUSY 16
+ EEXIST 17
+ ENODEV 19
+ ENOTDIR 20
+ EISDIR 21
+ EINVAL 22
+ ENFILE 23
+ EMFILE 24
+ EFBIG 27
+ ENOSPC 28
+ ESPIPE 29
+ EROFS 30
+ ENAMETOOLONG 91
+ EUNKNOWN 9999
+@end smallexample
+
+ EUNKNOWN is used as a fallback error value if a host system returns
+ any error value not in the list of supported error numbers.
+
+@node Lseek flags
+@unnumberedsubsubsec Lseek flags
+@cindex lseek flags, in file-i/o protocol
+
+@smallexample
+ SEEK_SET 0
+ SEEK_CUR 1
+ SEEK_END 2
+@end smallexample
+
+@node Limits
+@unnumberedsubsubsec Limits
+@cindex limits, in file-i/o protocol
+
+All values are given in decimal representation.
+
+@smallexample
+ INT_MIN -2147483648
+ INT_MAX 2147483647
+ UINT_MAX 4294967295
+ LONG_MIN -9223372036854775808
+ LONG_MAX 9223372036854775807
+ ULONG_MAX 18446744073709551615
+@end smallexample
+
+@node File-I/O Examples
+@subsection File-I/O Examples
+@cindex file-i/o examples
+
+Example sequence of a write call, file descriptor 3, buffer is at target
+address 0x1234, 6 bytes should be written:
+
+@smallexample
+<- @code{Fwrite,3,1234,6}
+@emph{request memory read from target}
+-> @code{m1234,6}
+<- XXXXXX
+@emph{return "6 bytes written"}
+-> @code{F6}
+@end smallexample
+
+Example sequence of a read call, file descriptor 3, buffer is at target
+address 0x1234, 6 bytes should be read:
+
+@smallexample
+<- @code{Fread,3,1234,6}
+@emph{request memory write to target}
+-> @code{X1234,6:XXXXXX}
+@emph{return "6 bytes read"}
+-> @code{F6}
+@end smallexample
+
+Example sequence of a read call, call fails on the host due to invalid
+file descriptor (EBADF):
+
+@smallexample
+<- @code{Fread,3,1234,6}
+-> @code{F-1,9}
+@end smallexample
+
+Example sequence of a read call, user presses Ctrl-C before syscall on
+host is called:
+
+@smallexample
+<- @code{Fread,3,1234,6}
+-> @code{F-1,4,C}
+<- @code{T02}
+@end smallexample
+
+Example sequence of a read call, user presses Ctrl-C after syscall on
+host is called:
+
+@smallexample
+<- @code{Fread,3,1234,6}
+-> @code{X1234,6:XXXXXX}
+<- @code{T02}
+@end smallexample
+
@include gpl.texi
@include fdl.texi
diff --git a/gdb/doc/gdbint.texinfo b/gdb/doc/gdbint.texinfo
index 9776a35..4ca81f6 100644
--- a/gdb/doc/gdbint.texinfo
+++ b/gdb/doc/gdbint.texinfo
@@ -94,6 +94,7 @@ as the mechanisms that adapt @value{GDBN} to specific hosts and targets.
* Testsuite::
* Hints::
+* GDB Observers:: @value{GDBN} Currently available observers
* GNU Free Documentation License:: The license for this documentation
* Index::
@end menu
@@ -252,9 +253,9 @@ if it is defined; that is where you should use the @code{FP_REGNUM}
value, if your frames are nonstandard.)
@cindex frame chain
-Given a @value{GDBN} frame, define @code{FRAME_CHAIN} to determine the
-address of the calling function's frame. This will be used to create a
-new @value{GDBN} frame struct, and then
+Given a @value{GDBN} frame, define @code{DEPRECATED_FRAME_CHAIN} to
+determine the address of the calling function's frame. This will be
+used to create a new @value{GDBN} frame struct, and then
@code{DEPRECATED_INIT_EXTRA_FRAME_INFO} and
@code{DEPRECATED_INIT_FRAME_PC} will be called for the new frame.
@@ -696,6 +697,29 @@ watchpoints might interfere with the underlying OS and are probably
unavailable in many platforms.
@end enumerate
+@section Observing changes in @value{GDBN} internals
+@cindex observer pattern interface
+@cindex notifications about changes in internals
+
+In order to function properly, several modules need to be notified when
+some changes occur in the @value{GDBN} internals. Traditionally, these
+modules have relied on several paradigms, the most common ones being
+hooks and gdb-events. Unfortunately, none of these paradigms was
+versatile enough to become the standard notification mechanism in
+@value{GDBN}. The fact that they only supported one ``client'' was also
+a strong limitation.
+
+A new paradigm, based on the Observer pattern of the @cite{Design
+Patterns} book, has therefore been implemented. The goal was to provide
+a new interface overcoming the issues with the notification mechanisms
+previously available. This new interface needed to be strongly typed,
+easy to extend, and versatile enough to be used as the standard
+interface when adding new notifications.
+
+See @ref{GDB Observers} for a brief description of the observers
+currently implemented in GDB. The rationale for the current
+implementation is also briefly discussed.
+
@node User Interface
@chapter User Interface
@@ -3060,11 +3084,6 @@ custom breakpoint insertion and removal routines if
@code{BREAKPOINT_FROM_PC} needs to read the target's memory for some
reason.
-@item CALL_DUMMY_P
-@findex CALL_DUMMY_P
-A C expression that is non-zero when the target supports inferior function
-calls.
-
@item CALL_DUMMY_WORDS
@findex CALL_DUMMY_WORDS
Pointer to an array of @code{LONGEST} words of data containing
@@ -3077,8 +3096,8 @@ data.
@item SIZEOF_CALL_DUMMY_WORDS
@findex SIZEOF_CALL_DUMMY_WORDS
-The size of @code{CALL_DUMMY_WORDS}. When @code{CALL_DUMMY_P} this must
-return a positive value. See also @code{CALL_DUMMY_LENGTH}.
+The size of @code{CALL_DUMMY_WORDS}. This must return a positive value.
+See also @code{CALL_DUMMY_LENGTH}.
@item CALL_DUMMY
@findex CALL_DUMMY
@@ -3088,17 +3107,11 @@ A static initializer for @code{CALL_DUMMY_WORDS}. Deprecated.
@findex CALL_DUMMY_LOCATION
See the file @file{inferior.h}.
-@item CALL_DUMMY_STACK_ADJUST
-@findex CALL_DUMMY_STACK_ADJUST
-Stack adjustment needed when performing an inferior function call.
-
-Should be deprecated in favor of something like @code{STACK_ALIGN}.
-
-@item CALL_DUMMY_STACK_ADJUST_P
-@findex CALL_DUMMY_STACK_ADJUST_P
-Predicate for use of @code{CALL_DUMMY_STACK_ADJUST}.
-
-Should be deprecated in favor of something like @code{STACK_ALIGN}.
+@item DEPRECATED_CALL_DUMMY_STACK_ADJUST
+@findex DEPRECATED_CALL_DUMMY_STACK_ADJUST
+Stack adjustment needed when performing an inferior function call. This
+function is no longer needed. @xref{push_dummy_call}, which can handle
+all alignment directly.
@item CANNOT_FETCH_REGISTER (@var{regno})
@findex CANNOT_FETCH_REGISTER
@@ -3239,12 +3252,12 @@ By default, no frame based stack alignment is performed.
@findex FRAME_ARGS_ADDRESS_CORRECT
See @file{stack.c}.
-@item FRAME_CHAIN(@var{frame})
-@findex FRAME_CHAIN
+@item DEPRECATED_FRAME_CHAIN(@var{frame})
+@findex DEPRECATED_FRAME_CHAIN
Given @var{frame}, return a pointer to the calling frame.
-@item FRAME_CHAIN_VALID(@var{chain}, @var{thisframe})
-@findex FRAME_CHAIN_VALID
+@item DEPRECATED_FRAME_CHAIN_VALID(@var{chain}, @var{thisframe})
+@findex DEPRECATED_FRAME_CHAIN_VALID
Define this to be an expression that returns zero if the given frame is an
outermost frame, with no caller, and nonzero otherwise. Most normal
situations can be handled without defining this macro, including @code{NULL}
@@ -3260,7 +3273,7 @@ current stack frame storing each in @code{frame->saved_regs}. Space for
@code{DEPRECATED_FRAME_INIT_SAVED_REGS} using
@code{frame_saved_regs_zalloc}.
-@code{FRAME_FIND_SAVED_REGS} and @code{EXTRA_FRAME_INFO} are deprecated.
+@code{FRAME_FIND_SAVED_REGS} is deprecated.
@item FRAME_NUM_ARGS (@var{fi})
@findex FRAME_NUM_ARGS
@@ -3268,10 +3281,30 @@ For the frame described by @var{fi} return the number of arguments that
are being passed. If the number of arguments is not known, return
@code{-1}.
-@item FRAME_SAVED_PC(@var{frame})
-@findex FRAME_SAVED_PC
-Given @var{frame}, return the pc saved there. This is the return
-address.
+@item DEPRECATED_FRAME_SAVED_PC(@var{frame})
+@findex DEPRECATED_FRAME_SAVED_PC
+@anchor{DEPRECATED_FRAME_SAVED_PC} Given @var{frame}, return the pc
+saved there. This is the return address.
+
+This method is deprecated. @xref{unwind_pc}.
+
+@item CORE_ADDR unwind_pc (struct frame_info *@var{this_frame})
+@findex unwind_pc
+@anchor{unwind_pc} Return the instruction address, in @var{this_frame}'s
+caller, at which execution will resume after @var{this_frame} returns.
+This is commonly refered to as the return address.
+
+The implementation, which must be frame agnostic (work with any frame),
+is typically no more than:
+
+@smallexample
+ULONGEST pc;
+frame_unwind_unsigned_register (this_frame, D10V_PC_REGNUM, &pc);
+return d10v_make_iaddr (pc);
+@end smallexample
+
+@noindent
+@xref{DEPRECATED_FRAME_SAVED_PC}, which this method replaces.
@item FUNCTION_EPILOGUE_SIZE
@findex FUNCTION_EPILOGUE_SIZE
@@ -3332,11 +3365,10 @@ assuming that we have just stopped at a @code{longjmp} breakpoint. It takes a
@code{CORE_ADDR *} as argument, and stores the target PC value through this
pointer. It examines the current state of the machine as needed.
-@item GET_SAVED_REGISTER
-@findex GET_SAVED_REGISTER
-@findex get_saved_register
+@item DEPRECATED_GET_SAVED_REGISTER
+@findex DEPRECATED_GET_SAVED_REGISTER
Define this if you need to supply your own definition for the function
-@code{get_saved_register}.
+@code{DEPRECATED_GET_SAVED_REGISTER}.
@item IBM6000_TARGET
@findex IBM6000_TARGET
@@ -3642,11 +3674,6 @@ The number of the ``next program counter'' register, if defined.
If non-zero, round arguments to a boundary of this many bits before
pushing them on the stack.
-@item PRINT_TYPELESS_INTEGER
-@findex PRINT_TYPELESS_INTEGER
-This is an obscure substitute for @code{print_longest} that seems to
-have been defined for the Convex target.
-
@item PROCESS_LINENUMBER_HOOK
@findex PROCESS_LINENUMBER_HOOK
A hook defined for XCOFF reading.
@@ -3660,20 +3687,27 @@ A hook defined for XCOFF reading.
If defined, this is the number of the processor status register. (This
definition is only used in generic code when parsing "$ps".)
-@item POP_FRAME
-@findex POP_FRAME
-@findex call_function_by_hand
-@findex return_command
-Used in @samp{call_function_by_hand} to remove an artificial stack
-frame and in @samp{return_command} to remove a real stack frame.
+@item DEPRECATED_POP_FRAME
+@findex DEPRECATED_POP_FRAME
+@findex frame_pop
+If defined, used by @code{frame_pop} to remove a stack frame. This
+method has been superseeded by generic code.
-@item PUSH_ARGUMENTS (@var{nargs}, @var{args}, @var{sp}, @var{struct_return}, @var{struct_addr})
-@findex PUSH_ARGUMENTS
-Define this to push arguments onto the stack for inferior function
-call. Returns the updated stack pointer value.
+@item push_dummy_call (@var{gdbarch}, @var{regcache}, @var{dummy_addr}, @var{nargs}, @var{args}, @var{sp}, @var{struct_return}, @var{struct_addr})
+@findex push_dummy_call
+@findex DEPRECATED_PUSH_ARGUMENTS.
+@anchor{push_dummy_call}
+Define this to push the dummy frame's call to the inferior function onto
+the stack. In addition to pushing @var{nargs}, the code should push
+@var{struct_addr} (when @var{struct_return}), and the return value (in
+the call dummy at @var{dummy_addr}).
-@item PUSH_DUMMY_FRAME
-@findex PUSH_DUMMY_FRAME
+Returns the updated top-of-stack pointer.
+
+This method replaces @code{DEPRECATED_PUSH_ARGUMENTS}.
+
+@item DEPRECATED_PUSH_DUMMY_FRAME
+@findex DEPRECATED_PUSH_DUMMY_FRAME
Used in @samp{call_function_by_hand} to create an artificial stack frame.
@item REGISTER_BYTES
@@ -3697,10 +3731,11 @@ rather than directly.
@item SAVE_DUMMY_FRAME_TOS (@var{sp})
@findex SAVE_DUMMY_FRAME_TOS
-Used in @samp{call_function_by_hand} to notify the target dependent code
-of the top-of-stack value that will be passed to the the inferior code.
-This is the value of the @code{SP} after both the dummy frame and space
-for parameters/results have been allocated on the stack.
+@anchor{SAVE_DUMMY_FRAME_TOS} Used in @samp{call_function_by_hand} to
+notify the target dependent code of the top-of-stack value that will be
+passed to the the inferior code. This is the value of the @code{SP}
+after both the dummy frame and space for parameters/results have been
+allocated on the stack. @xref{unwind_dummy_id}.
@item SDB_REG_TO_REGNUM
@findex SDB_REG_TO_REGNUM
@@ -3732,10 +3767,8 @@ that is at the start of the real function.
@item SP_REGNUM
@findex SP_REGNUM
If the stack-pointer is kept in a register, then define this macro to be
-the number (greater than or equal to zero) of that register.
-
-This should only need to be defined if @code{TARGET_WRITE_SP} and
-@code{TARGET_WRITE_SP} are not defined.
+the number (greater than or equal to zero) of that register, or -1 if
+there is no such register.
@item STAB_REG_TO_REGNUM
@findex STAB_REG_TO_REGNUM
@@ -3842,19 +3875,16 @@ Number of bits in a short integer; defaults to @code{2 * TARGET_CHAR_BIT}.
@findex TARGET_WRITE_PC
@itemx TARGET_READ_SP
@findex TARGET_READ_SP
-@itemx TARGET_WRITE_SP
-@findex TARGET_WRITE_SP
@itemx TARGET_READ_FP
@findex TARGET_READ_FP
@findex read_pc
@findex write_pc
@findex read_sp
-@findex write_sp
@findex read_fp
These change the behavior of @code{read_pc}, @code{write_pc},
-@code{read_sp}, @code{write_sp} and @code{read_fp}. For most targets,
-these may be left undefined. @value{GDBN} will call the read and write
-register functions with the relevant @code{_REGNUM} argument.
+@code{read_sp} and @code{read_fp}. For most targets, these may be left
+undefined. @value{GDBN} will call the read and write register functions
+with the relevant @code{_REGNUM} argument.
These macros are useful when a target keeps one of these registers in a
hard to get at place; for example, part in a segment register and part
@@ -3884,6 +3914,14 @@ Libraries, ,Opcodes}). @var{info} is a structure (of type
@code{disassemble_info}) defined in @file{include/dis-asm.h} used to
pass information to the instruction decoding routine.
+@item struct frame_id unwind_dummy_id (struct frame_info *@var{frame})
+@findex unwind_dummy_id
+@anchor{unwind_dummy_id} Given @var{frame} return a @code{struct
+frame_id} that uniquely identifies an inferior function call's dummy
+frame. The value returned must match the dummy frame stack value
+previously saved using @code{SAVE_DUMMY_FRAME_TOS}.
+@xref{SAVE_DUMMY_FRAME_TOS}.
+
@item USE_STRUCT_CONVENTION (@var{gcc_p}, @var{type})
@findex USE_STRUCT_CONVENTION
If defined, this must be an expression that is nonzero if a value of the
@@ -4100,8 +4138,6 @@ Add the macro @code{GDB_MULTI_ARCH}, defined as 0 (zero), to the file@*
Some mechanisms do not work with multi-arch. They include:
@table @code
-@item EXTRA_FRAME_INFO
-Delete.
@item FRAME_FIND_SAVED_REGS
Replaced with @code{DEPRECATED_FRAME_INIT_SAVED_REGS}
@end table
@@ -6568,6 +6604,7 @@ is so old that it has never been converted to use BFD. Now that's old!
@end table
+@include observer.texi
@include fdl.texi
@node Index
diff --git a/gdb/doublest.c b/gdb/doublest.c
index e601a4d..101240b 100644
--- a/gdb/doublest.c
+++ b/gdb/doublest.c
@@ -1,7 +1,8 @@
/* Floating point routines for GDB, the GNU debugger.
- Copyright 1986, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996,
- 1997, 1998, 1999, 2000, 2001
- Free Software Foundation, Inc.
+
+ Copyright 1986, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995,
+ 1996, 1997, 1998, 1999, 2000, 2001, 2003 Free Software Foundation,
+ Inc.
This file is part of GDB.
@@ -633,6 +634,14 @@ floatformat_from_length (int len)
return TARGET_DOUBLE_FORMAT;
else if (len * TARGET_CHAR_BIT == TARGET_LONG_DOUBLE_BIT)
return TARGET_LONG_DOUBLE_FORMAT;
+ /* On i386 the 'long double' type takes 96 bits,
+ while the real number of used bits is only 80,
+ both in processor and in memory.
+ The code below accepts the real bit size. */
+ else if ((TARGET_LONG_DOUBLE_FORMAT != NULL)
+ && (len * TARGET_CHAR_BIT ==
+ TARGET_LONG_DOUBLE_FORMAT->totalsize))
+ return TARGET_LONG_DOUBLE_FORMAT;
return NULL;
}
@@ -655,8 +664,8 @@ floatformat_from_type (const struct type *type)
/* Extract a floating-point number of length LEN from a target-order
byte-stream at ADDR. Returns the value as type DOUBLEST. */
-DOUBLEST
-extract_floating (const void *addr, int len)
+static DOUBLEST
+extract_floating_by_length (const void *addr, int len)
{
const struct floatformat *fmt = floatformat_from_length (len);
DOUBLEST val;
@@ -671,11 +680,17 @@ extract_floating (const void *addr, int len)
return val;
}
+DOUBLEST
+deprecated_extract_floating (const void *addr, int len)
+{
+ return extract_floating_by_length (addr, len);
+}
+
/* Store VAL as a floating-point number of length LEN to a
target-order byte-stream at ADDR. */
-void
-store_floating (void *addr, int len, DOUBLEST val)
+static void
+store_floating_by_length (void *addr, int len, DOUBLEST val)
{
const struct floatformat *fmt = floatformat_from_length (len);
@@ -689,6 +704,12 @@ store_floating (void *addr, int len, DOUBLEST val)
floatformat_from_doublest (fmt, &val, addr);
}
+void
+deprecated_store_floating (void *addr, int len, DOUBLEST val)
+{
+ store_floating_by_length (addr, len, val);
+}
+
/* Extract a floating-point number of type TYPE from a target-order
byte-stream at ADDR. Returns the value as type DOUBLEST. */
@@ -700,7 +721,9 @@ extract_typed_floating (const void *addr, const struct type *type)
gdb_assert (TYPE_CODE (type) == TYPE_CODE_FLT);
if (TYPE_FLOATFORMAT (type) == NULL)
- return extract_floating (addr, TYPE_LENGTH (type));
+ /* Not all code remembers to set the FLOATFORMAT (language
+ specific code? stabs?) so handle that here as a special case. */
+ return extract_floating_by_length (addr, TYPE_LENGTH (type));
floatformat_to_doublest (TYPE_FLOATFORMAT (type), addr, &retval);
return retval;
@@ -735,7 +758,9 @@ store_typed_floating (void *addr, const struct type *type, DOUBLEST val)
memset (addr, 0, TYPE_LENGTH (type));
if (TYPE_FLOATFORMAT (type) == NULL)
- store_floating (addr, TYPE_LENGTH (type), val);
+ /* Not all code remembers to set the FLOATFORMAT (language
+ specific code? stabs?) so handle that here as a special case. */
+ store_floating_by_length (addr, TYPE_LENGTH (type), val);
else
floatformat_from_doublest (TYPE_FLOATFORMAT (type), &val, addr);
}
diff --git a/gdb/doublest.h b/gdb/doublest.h
index 920d702..668efa7 100644
--- a/gdb/doublest.h
+++ b/gdb/doublest.h
@@ -1,7 +1,8 @@
/* Floating point definitions for GDB.
- Copyright 1986, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996,
- 1997, 1998, 1999, 2000, 2001
- Free Software Foundation, Inc.
+
+ Copyright 1986, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995,
+ 1996, 1997, 1998, 1999, 2000, 2001, 2003 Free Software Foundation,
+ Inc.
This file is part of GDB.
@@ -23,6 +24,8 @@
#ifndef DOUBLEST_H
#define DOUBLEST_H
+struct type;
+
/* Setup definitions for host and target floating point formats. We need to
consider the format for `float', `double', and `long double' for both target
and host. We need to do this so that we know what kind of conversions need
@@ -59,12 +62,16 @@ extern int floatformat_is_negative (const struct floatformat *, char *);
extern int floatformat_is_nan (const struct floatformat *, char *);
extern char *floatformat_mantissa (const struct floatformat *, char *);
-/* These two functions are deprecated in favour of
- extract_typed_floating and store_typed_floating. See comments in
- 'doublest.c' for details. */
+/* These functions have been replaced by extract_typed_floating and
+ store_typed_floating.
+
+ Most calls are passing in TYPE_LENGTH (TYPE) so can be changed to
+ just pass the TYPE. The remainder pass in the length of a
+ register, those calls should instead pass in the floating point
+ type that corresponds to that length. */
-extern DOUBLEST extract_floating (const void *addr, int len);
-extern void store_floating (void *addr, int len, DOUBLEST val);
+extern DOUBLEST deprecated_extract_floating (const void *addr, int len);
+extern void deprecated_store_floating (void *addr, int len, DOUBLEST val);
/* Given TYPE, return its floatformat. TYPE_FLOATFORMAT() may return
NULL. type_floatformat() detects that and returns a floatformat
diff --git a/gdb/dummy-frame.c b/gdb/dummy-frame.c
index 5b63830..a320b7d 100644
--- a/gdb/dummy-frame.c
+++ b/gdb/dummy-frame.c
@@ -30,6 +30,10 @@
#include "gdb_assert.h"
#include "frame-unwind.h"
+static void dummy_frame_this_id (struct frame_info *next_frame,
+ void **this_prologue_cache,
+ struct frame_id *this_id);
+
/* Dummy frame. This saves the processor state just prior to setting
up the inferior function call. Older targets save the registers
on the target stack (but that really slows down function calls). */
@@ -104,14 +108,6 @@ find_dummy_frame (CORE_ADDR pc, CORE_ADDR fp)
return NULL;
}
-struct dummy_frame *
-cached_find_dummy_frame (struct frame_info *frame, void **cache)
-{
- if ((*cache) == NULL)
- (*cache) = find_dummy_frame (get_frame_pc (frame), get_frame_base (frame));
- return (*cache);
-}
-
struct regcache *
generic_find_dummy_frame (CORE_ADDR pc, CORE_ADDR fp)
{
@@ -282,37 +278,6 @@ discard_innermost_dummy (struct dummy_frame **stack)
xfree (tbd);
}
-/* Function: dummy_frame_pop. Restore the machine state from a saved
- dummy stack frame. */
-
-static void
-dummy_frame_pop (struct frame_info *fi, void **cache,
- struct regcache *regcache)
-{
- struct dummy_frame *dummy = cached_find_dummy_frame (fi, cache);
-
- /* If it isn't, what are we even doing here? */
- gdb_assert (get_frame_type (fi) == DUMMY_FRAME);
-
- if (dummy == NULL)
- error ("Can't pop dummy frame!");
-
- /* Discard all dummy frames up-to but not including this one. */
- while (dummy_frame_stack != dummy)
- discard_innermost_dummy (&dummy_frame_stack);
-
- /* Restore this one. */
- regcache_cpy (regcache, dummy->regcache);
- flush_cached_frames ();
-
- /* Now discard it. */
- discard_innermost_dummy (&dummy_frame_stack);
-
- /* Note: target changed would be better. Registers, memory and
- frame are all invalid. */
- flush_cached_frames ();
-}
-
void
generic_pop_dummy_frame (void)
{
@@ -329,27 +294,23 @@ generic_pop_dummy_frame (void)
discard_innermost_dummy (&dummy_frame_stack);
}
-/* Function: fix_call_dummy
- Stub function. Generic dummy frames typically do not need to fix
- the frame being created */
-
-void
-generic_fix_call_dummy (char *dummy, CORE_ADDR pc, CORE_ADDR fun, int nargs,
- struct value **args, struct type *type, int gcc_p)
-{
- return;
-}
-
/* Given a call-dummy dummy-frame, return the registers. Here the
register value is taken from the local copy of the register buffer. */
static void
-dummy_frame_register_unwind (struct frame_info *frame, void **cache,
- int regnum, int *optimized,
- enum lval_type *lvalp, CORE_ADDR *addrp,
- int *realnum, void *bufferp)
+dummy_frame_prev_register (struct frame_info *next_frame,
+ void **this_prologue_cache,
+ int regnum, int *optimized,
+ enum lval_type *lvalp, CORE_ADDR *addrp,
+ int *realnum, void *bufferp)
{
- struct dummy_frame *dummy = cached_find_dummy_frame (frame, cache);
+ struct dummy_frame *dummy;
+ struct frame_id id;
+
+ /* Call the ID method which, if at all possible, will set the
+ prologue cache. */
+ dummy_frame_this_id (next_frame, this_prologue_cache, &id);
+ dummy = (*this_prologue_cache);
gdb_assert (dummy != NULL);
/* Describe the register's location. Generic dummy frames always
@@ -370,47 +331,81 @@ dummy_frame_register_unwind (struct frame_info *frame, void **cache,
}
}
-/* Assuming that FRAME is a dummy, return the resume address for the
- previous frame. */
-
-static CORE_ADDR
-dummy_frame_pc_unwind (struct frame_info *frame,
- void **cache)
-{
- struct dummy_frame *dummy = cached_find_dummy_frame (frame, cache);
- /* Oops! In a dummy-frame but can't find the stack dummy. Pretend
- that the frame doesn't unwind. Should this function instead
- return a has-no-caller indication? */
- if (dummy == NULL)
- return 0;
- return dummy->pc;
-}
-
-
-/* Assuming that FRAME is a dummy, return the ID of the calling frame
- (the frame that the dummy has the saved state of). */
+/* Assuming that THIS frame is a dummy (remember, the NEXT and not
+ THIS frame is passed in), return the ID of THIS frame. That ID is
+ determined by examining the NEXT frame's unwound registers using
+ the method unwind_dummy_id(). As a side effect, THIS dummy frame's
+ dummy cache is located and and saved in THIS_PROLOGUE_CACHE. */
static void
-dummy_frame_id_unwind (struct frame_info *frame,
- void **cache,
- struct frame_id *id)
+dummy_frame_this_id (struct frame_info *next_frame,
+ void **this_prologue_cache,
+ struct frame_id *this_id)
{
- struct dummy_frame *dummy = cached_find_dummy_frame (frame, cache);
- /* Oops! In a dummy-frame but can't find the stack dummy. Pretend
- that the frame doesn't unwind. Should this function instead
- return a has-no-caller indication? */
- if (dummy == NULL)
- (*id) = null_frame_id;
+ struct dummy_frame *dummy = (*this_prologue_cache);
+ if (dummy != NULL)
+ {
+ (*this_id) = dummy->id;
+ return;
+ }
+ /* When unwinding a normal frame, the stack structure is determined
+ by analyzing the frame's function's code (be it using brute force
+ prologue analysis, or the dwarf2 CFI). In the case of a dummy
+ frame, that simply isn't possible. The The PC is either the
+ program entry point, or some random address on the stack. Trying
+ to use that PC to apply standard frame ID unwind techniques is
+ just asking for trouble. */
+ if (gdbarch_unwind_dummy_id_p (current_gdbarch))
+ {
+ /* Assume call_function_by_hand(), via SAVE_DUMMY_FRAME_TOS,
+ previously saved the dummy frame's ID. Things only work if
+ the two return the same value. */
+ gdb_assert (SAVE_DUMMY_FRAME_TOS_P ());
+ /* Use an architecture specific method to extract the prev's
+ dummy ID from the next frame. Note that this method uses
+ frame_register_unwind to obtain the register values needed to
+ determine the dummy frame's ID. */
+ (*this_id) = gdbarch_unwind_dummy_id (current_gdbarch, next_frame);
+ }
+ else if (frame_relative_level (next_frame) < 0)
+ {
+ /* We're unwinding a sentinel frame, the PC of which is pointing
+ at a stack dummy. Fake up the dummy frame's ID using the
+ same sequence as is found a traditional unwinder. Once all
+ architectures supply the unwind_dummy_id method, this code
+ can go away. */
+ (*this_id) = frame_id_build (read_fp (), read_pc ());
+ }
+ else if (legacy_frame_p (current_gdbarch)
+ && get_prev_frame (next_frame))
+ {
+ /* Things are looking seriously grim! Assume that the legacy
+ get_prev_frame code has already created THIS frame and linked
+ it in to the frame chain (a pretty bold assumption), extract
+ the ID from THIS base / pc. */
+ (*this_id) = frame_id_build (get_frame_base (get_prev_frame (next_frame)),
+ get_frame_pc (get_prev_frame (next_frame)));
+ }
else
- (*id) = dummy->id;
+ {
+ /* Outch! We're not trying to find the innermost frame's ID yet
+ we're trying to unwind to a dummy. The architecture must
+ provide the unwind_dummy_id() method. Abandon the unwind
+ process but only after first warning the user. */
+ internal_warning (__FILE__, __LINE__,
+ "Missing unwind_dummy_id architecture method");
+ (*this_id) = null_frame_id;
+ return;
+ }
+ (*this_prologue_cache) = find_dummy_frame ((*this_id).code_addr,
+ (*this_id).stack_addr);
}
static struct frame_unwind dummy_frame_unwind =
{
- dummy_frame_pop,
- dummy_frame_pc_unwind,
- dummy_frame_id_unwind,
- dummy_frame_register_unwind
+ DUMMY_FRAME,
+ dummy_frame_this_id,
+ dummy_frame_prev_register
};
const struct frame_unwind *
diff --git a/gdb/dummy-frame.h b/gdb/dummy-frame.h
index 2d03421..bb41e8d 100644
--- a/gdb/dummy-frame.h
+++ b/gdb/dummy-frame.h
@@ -40,9 +40,9 @@ struct frame_id;
is probably to define CALL_DUMMY to be empty, CALL_DUMMY_LENGTH to
zero, and CALL_DUMMY_LOCATION to AT_ENTRY. Then you must remember
to define PUSH_RETURN_ADDRESS, because no call instruction will be
- being executed by the target. Also FRAME_CHAIN_VALID as
- generic_{file,func}_frame_chain_valid and FIX_CALL_DUMMY as
- generic_fix_call_dummy. */
+ being executed by the target. Also DEPRECATED_FRAME_CHAIN_VALID as
+ generic_{file,func}_frame_chain_valid and do not set
+ FIX_CALL_DUMMY. */
/* If the PC falls in a dummy frame, return a dummy frame
unwinder. */
diff --git a/gdb/dwarf2cfi.c b/gdb/dwarf2cfi.c
index 6bedddb..81fa207 100644
--- a/gdb/dwarf2cfi.c
+++ b/gdb/dwarf2cfi.c
@@ -345,7 +345,7 @@ read_2u (bfd *abfd, char **p)
unsigned ret;
ret = bfd_get_16 (abfd, (bfd_byte *) * p);
- (*p)++;
+ (*p) += 2;
return ret;
}
diff --git a/gdb/dwarf2cfi.h b/gdb/dwarf2cfi.h
index 2c8be97..28a329d 100644
--- a/gdb/dwarf2cfi.h
+++ b/gdb/dwarf2cfi.h
@@ -22,6 +22,8 @@
#ifndef DWARF2CFI_H
#define DWARF2CFI_H
+struct frame_info;
+
struct context_reg
{
union
diff --git a/gdb/dwarf2expr.c b/gdb/dwarf2expr.c
index 7456979..35e76f3 100644
--- a/gdb/dwarf2expr.c
+++ b/gdb/dwarf2expr.c
@@ -170,13 +170,13 @@ read_sleb128 (unsigned char *buf, unsigned char *buf_end, LONGEST * r)
BUF_END. The address is returned, and *BYTES_READ is set to the
number of bytes read from BUF. */
-static CORE_ADDR
-read_address (unsigned char *buf, unsigned char *buf_end, int *bytes_read)
+CORE_ADDR
+dwarf2_read_address (unsigned char *buf, unsigned char *buf_end, int *bytes_read)
{
CORE_ADDR result;
if (buf_end - buf < TARGET_ADDR_BIT / TARGET_CHAR_BIT)
- error ("read_address: Corrupted DWARF expression.");
+ error ("dwarf2_read_address: Corrupted DWARF expression.");
*bytes_read = TARGET_ADDR_BIT / TARGET_CHAR_BIT;
result = extract_address (buf, TARGET_ADDR_BIT / TARGET_CHAR_BIT);
@@ -231,11 +231,10 @@ execute_stack_op (struct dwarf_expr_context *ctx, unsigned char *op_ptr,
while (op_ptr < op_end)
{
enum dwarf_location_atom op = *op_ptr++;
- CORE_ADDR result, memaddr;
+ CORE_ADDR result;
ULONGEST uoffset, reg;
LONGEST offset;
int bytes_read;
- enum lval_type expr_lval;
ctx->in_reg = 0;
@@ -277,7 +276,7 @@ execute_stack_op (struct dwarf_expr_context *ctx, unsigned char *op_ptr,
break;
case DW_OP_addr:
- result = read_address (op_ptr, op_end, &bytes_read);
+ result = dwarf2_read_address (op_ptr, op_end, &bytes_read);
op_ptr += bytes_read;
break;
@@ -361,19 +360,8 @@ execute_stack_op (struct dwarf_expr_context *ctx, unsigned char *op_ptr,
error ("DWARF-2 expression error: DW_OP_reg operations must be "
"used alone.");
- /* FIXME drow/2003-02-21: This call to read_reg could be pushed
- into the evaluator's caller by changing the semantics for in_reg.
- Then we wouldn't need to return an lval_type and a memaddr. */
- result = (ctx->read_reg) (ctx->baton, op - DW_OP_reg0, &expr_lval,
- &memaddr);
-
- if (expr_lval == lval_register)
- {
- ctx->regnum = op - DW_OP_reg0;
- ctx->in_reg = 1;
- }
- else
- result = memaddr;
+ result = op - DW_OP_reg0;
+ ctx->in_reg = 1;
break;
@@ -383,16 +371,8 @@ execute_stack_op (struct dwarf_expr_context *ctx, unsigned char *op_ptr,
error ("DWARF-2 expression error: DW_OP_reg operations must be "
"used alone.");
- result = (ctx->read_reg) (ctx->baton, reg, &expr_lval, &memaddr);
-
- if (expr_lval == lval_register)
- {
- ctx->regnum = reg;
- ctx->in_reg = 1;
- }
- else
- result = memaddr;
-
+ result = reg;
+ ctx->in_reg = 1;
break;
case DW_OP_breg0:
@@ -429,8 +409,7 @@ execute_stack_op (struct dwarf_expr_context *ctx, unsigned char *op_ptr,
case DW_OP_breg31:
{
op_ptr = read_sleb128 (op_ptr, op_end, &offset);
- result = (ctx->read_reg) (ctx->baton, op - DW_OP_breg0,
- &expr_lval, &memaddr);
+ result = (ctx->read_reg) (ctx->baton, op - DW_OP_breg0);
result += offset;
}
break;
@@ -438,7 +417,7 @@ execute_stack_op (struct dwarf_expr_context *ctx, unsigned char *op_ptr,
{
op_ptr = read_uleb128 (op_ptr, op_end, &reg);
op_ptr = read_sleb128 (op_ptr, op_end, &offset);
- result = (ctx->read_reg) (ctx->baton, reg, &expr_lval, &memaddr);
+ result = (ctx->read_reg) (ctx->baton, reg);
result += offset;
}
break;
@@ -454,19 +433,25 @@ execute_stack_op (struct dwarf_expr_context *ctx, unsigned char *op_ptr,
afterwards, effectively erasing whatever the recursive
call put there. */
before_stack_len = ctx->stack_len;
+ /* FIXME: cagney/2003-03-26: This code should be using
+ get_frame_base_address(), and then implement a dwarf2
+ specific this_base method. */
(ctx->get_frame_base) (ctx->baton, &datastart, &datalen);
dwarf_expr_eval (ctx, datastart, datalen);
result = dwarf_expr_fetch (ctx, 0);
- if (! ctx->in_reg)
+ if (ctx->in_reg)
+ result = (ctx->read_reg) (ctx->baton, result);
+ else
{
char *buf = alloca (TARGET_ADDR_BIT / TARGET_CHAR_BIT);
int bytes_read;
(ctx->read_mem) (ctx->baton, buf, result,
TARGET_ADDR_BIT / TARGET_CHAR_BIT);
- result = read_address (buf,
- buf + TARGET_ADDR_BIT / TARGET_CHAR_BIT,
- &bytes_read);
+ result = dwarf2_read_address (buf,
+ buf + (TARGET_ADDR_BIT
+ / TARGET_CHAR_BIT),
+ &bytes_read);
}
result = result + offset;
ctx->stack_len = before_stack_len;
@@ -525,9 +510,10 @@ execute_stack_op (struct dwarf_expr_context *ctx, unsigned char *op_ptr,
(ctx->read_mem) (ctx->baton, buf, result,
TARGET_ADDR_BIT / TARGET_CHAR_BIT);
- result = read_address (buf,
- buf + TARGET_ADDR_BIT / TARGET_CHAR_BIT,
- &bytes_read);
+ result = dwarf2_read_address (buf,
+ buf + (TARGET_ADDR_BIT
+ / TARGET_CHAR_BIT),
+ &bytes_read);
}
break;
@@ -537,9 +523,10 @@ execute_stack_op (struct dwarf_expr_context *ctx, unsigned char *op_ptr,
int bytes_read;
(ctx->read_mem) (ctx->baton, buf, result, *op_ptr++);
- result = read_address (buf,
- buf + TARGET_ADDR_BIT / TARGET_CHAR_BIT,
- &bytes_read);
+ result = dwarf2_read_address (buf,
+ buf + (TARGET_ADDR_BIT
+ / TARGET_CHAR_BIT),
+ &bytes_read);
}
break;
diff --git a/gdb/dwarf2expr.h b/gdb/dwarf2expr.h
index 3d0fcb3..9e6fe80 100644
--- a/gdb/dwarf2expr.h
+++ b/gdb/dwarf2expr.h
@@ -36,13 +36,8 @@ struct dwarf_expr_context
to all of the callback functions. */
void *baton;
- /* Return the value of register number REGNUM. LVALP will be set
- to the kind of lval this register is (generally lval_register
- for the current frame's registers or lval_memory for a register
- saved to the stack). For lval_memory ADDRP will be set to the
- saved location of the register. */
- CORE_ADDR (*read_reg) (void *baton, int regnum, enum lval_type *lvalp,
- CORE_ADDR *addrp);
+ /* Return the value of register number REGNUM. */
+ CORE_ADDR (*read_reg) (void *baton, int regnum);
/* Read LENGTH bytes at ADDR into BUF. */
void (*read_mem) (void *baton, char *buf, CORE_ADDR addr,
@@ -77,12 +72,8 @@ struct dwarf_expr_context
int recursion_depth, max_recursion_depth;
/* Non-zero if the result is in a register. The register number
- will be in REGNUM, and the result will be the contents of the
- register. */
+ will be on the expression stack. */
int in_reg;
-
- /* If the result is in a register, the register number. */
- int regnum;
};
struct dwarf_expr_context *new_dwarf_expr_context ();
@@ -99,5 +90,7 @@ unsigned char *read_uleb128 (unsigned char *buf, unsigned char *buf_end,
ULONGEST * r);
unsigned char *read_sleb128 (unsigned char *buf, unsigned char *buf_end,
LONGEST * r);
+CORE_ADDR dwarf2_read_address (unsigned char *buf, unsigned char *buf_end,
+ int *bytes_read);
#endif
diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c
index 4180e05..78e75f3 100644
--- a/gdb/dwarf2loc.c
+++ b/gdb/dwarf2loc.c
@@ -40,6 +40,62 @@
#define DWARF2_REG_TO_REGNUM(REG) (REG)
#endif
+/* A helper function for dealing with location lists. Given a
+ symbol baton (BATON) and a pc value (PC), find the appropriate
+ location expression, set *LOCEXPR_LENGTH, and return a pointer
+ to the beginning of the expression. Returns NULL on failure.
+
+ For now, only return the first matching location expression; there
+ can be more than one in the list. */
+
+static char *
+find_location_expression (struct dwarf2_loclist_baton *baton,
+ int *locexpr_length, CORE_ADDR pc)
+{
+ CORE_ADDR base_address = baton->base_address;
+ CORE_ADDR low, high;
+ char *loc_ptr, *buf_end;
+ unsigned int addr_size = TARGET_ADDR_BIT / TARGET_CHAR_BIT, length;
+ CORE_ADDR base_mask = ~(~(CORE_ADDR)1 << (addr_size * 8 - 1));
+
+ loc_ptr = baton->data;
+ buf_end = baton->data + baton->size;
+
+ while (1)
+ {
+ low = dwarf2_read_address (loc_ptr, buf_end, &length);
+ loc_ptr += length;
+ high = dwarf2_read_address (loc_ptr, buf_end, &length);
+ loc_ptr += length;
+
+ /* An end-of-list entry. */
+ if (low == 0 && high == 0)
+ return NULL;
+
+ /* A base-address-selection entry. */
+ if ((low & base_mask) == base_mask)
+ {
+ base_address = high;
+ continue;
+ }
+
+ /* Otherwise, a location expression entry. */
+ low += base_address;
+ high += base_address;
+
+ length = extract_unsigned_integer (loc_ptr, 2);
+ loc_ptr += 2;
+
+ if (pc >= low && pc < high)
+ {
+ *locexpr_length = length;
+ return loc_ptr;
+ }
+
+ loc_ptr += length;
+ }
+}
+
/* This is the baton used when performing dwarf2 expression
evaluation. */
struct dwarf_expr_baton
@@ -54,11 +110,11 @@ struct dwarf_expr_baton
type will be returned in LVALP, and for lval_memory the register
save address will be returned in ADDRP. */
static CORE_ADDR
-dwarf_expr_read_reg (void *baton, int dwarf_regnum, enum lval_type *lvalp,
- CORE_ADDR *addrp)
+dwarf_expr_read_reg (void *baton, int dwarf_regnum)
{
struct dwarf_expr_baton *debaton = (struct dwarf_expr_baton *) baton;
- CORE_ADDR result;
+ CORE_ADDR result, save_addr;
+ enum lval_type lval_type;
char *buf;
int optimized, regnum, realnum, regsize;
@@ -66,8 +122,8 @@ dwarf_expr_read_reg (void *baton, int dwarf_regnum, enum lval_type *lvalp,
regsize = register_size (current_gdbarch, regnum);
buf = (char *) alloca (regsize);
- frame_register (debaton->frame, regnum, &optimized, lvalp, addrp, &realnum,
- buf);
+ frame_register (debaton->frame, regnum, &optimized, &lval_type, &save_addr,
+ &realnum, buf);
result = extract_address (buf, regsize);
return result;
@@ -87,13 +143,32 @@ dwarf_expr_read_mem (void *baton, char *buf, CORE_ADDR addr, size_t len)
static void
dwarf_expr_frame_base (void *baton, unsigned char **start, size_t * length)
{
+ /* FIXME: cagney/2003-03-26: This code should be using
+ get_frame_base_address(), and then implement a dwarf2 specific
+ this_base method. */
struct symbol *framefunc;
- struct dwarf2_locexpr_baton *symbaton;
struct dwarf_expr_baton *debaton = (struct dwarf_expr_baton *) baton;
+
framefunc = get_frame_function (debaton->frame);
- symbaton = SYMBOL_LOCATION_BATON (framefunc);
- *start = symbaton->data;
- *length = symbaton->size;
+
+ if (SYMBOL_LOCATION_FUNCS (framefunc) == &dwarf2_loclist_funcs)
+ {
+ struct dwarf2_loclist_baton *symbaton;
+ symbaton = SYMBOL_LOCATION_BATON (framefunc);
+ *start = find_location_expression (symbaton, length,
+ get_frame_pc (debaton->frame));
+ }
+ else
+ {
+ struct dwarf2_locexpr_baton *symbaton;
+ symbaton = SYMBOL_LOCATION_BATON (framefunc);
+ *length = symbaton->size;
+ *start = symbaton->data;
+ }
+
+ if (*start == NULL)
+ error ("Could not find the frame base for \"%s\".",
+ SYMBOL_NATURAL_NAME (framefunc));
}
/* Using the objfile specified in BATON, find the address for the
@@ -127,6 +202,13 @@ dwarf2_evaluate_loc_desc (const struct symbol *var, struct frame_info *frame,
struct dwarf_expr_baton baton;
struct dwarf_expr_context *ctx;
+ if (size == 0)
+ {
+ retval = allocate_value (SYMBOL_TYPE (var));
+ VALUE_LVAL (retval) = not_lval;
+ VALUE_OPTIMIZED_OUT (retval) = 1;
+ }
+
baton.frame = frame;
baton.objfile = objfile;
@@ -138,21 +220,15 @@ dwarf2_evaluate_loc_desc (const struct symbol *var, struct frame_info *frame,
ctx->get_tls_address = dwarf_expr_tls_address;
dwarf_expr_eval (ctx, data, size);
-
- retval = allocate_value (SYMBOL_TYPE (var));
- VALUE_BFD_SECTION (retval) = SYMBOL_BFD_SECTION (var);
+ result = dwarf_expr_fetch (ctx, 0);
if (ctx->in_reg)
- {
- store_unsigned_integer (VALUE_CONTENTS_RAW (retval),
- TYPE_LENGTH (SYMBOL_TYPE (var)),
- dwarf_expr_fetch (ctx, 0));
- VALUE_LVAL (retval) = lval_register;
- VALUE_REGNO (retval) = ctx->regnum;
- }
+ retval = value_from_register (SYMBOL_TYPE (var), result, frame);
else
{
- result = dwarf_expr_fetch (ctx, 0);
+ retval = allocate_value (SYMBOL_TYPE (var));
+ VALUE_BFD_SECTION (retval) = SYMBOL_BFD_SECTION (var);
+
VALUE_LVAL (retval) = lval_memory;
VALUE_LAZY (retval) = 1;
VALUE_ADDRESS (retval) = result;
@@ -176,8 +252,7 @@ struct needs_frame_baton
/* Reads from registers do require a frame. */
static CORE_ADDR
-needs_frame_read_reg (void *baton, int regnum, enum lval_type *lvalp,
- CORE_ADDR *addrp)
+needs_frame_read_reg (void *baton, int regnum)
{
struct needs_frame_baton *nf_baton = baton;
nf_baton->needs_frame = 1;
@@ -238,8 +313,56 @@ dwarf2_loc_desc_needs_frame (unsigned char *data, unsigned short size)
return baton.needs_frame;
}
+static void
+dwarf2_tracepoint_var_ref (const struct symbol * symbol,
+ struct agent_expr * ax,
+ struct axs_value * value, unsigned char *data,
+ int size)
+{
+ if (size == 0)
+ error ("Symbol \"%s\" has been optimized out.",
+ SYMBOL_PRINT_NAME (symbol));
+ if (size == 1
+ && data[0] >= DW_OP_reg0
+ && data[0] <= DW_OP_reg31)
+ {
+ value->kind = axs_lvalue_register;
+ value->u.reg = data[0] - DW_OP_reg0;
+ }
+ else if (data[0] == DW_OP_regx)
+ {
+ ULONGEST reg;
+ read_uleb128 (data + 1, data + size, &reg);
+ value->kind = axs_lvalue_register;
+ value->u.reg = reg;
+ }
+ else if (data[0] == DW_OP_fbreg)
+ {
+ /* And this is worse than just minimal; we should honor the frame base
+ as above. */
+ int frame_reg;
+ LONGEST frame_offset;
+ unsigned char *buf_end;
+
+ buf_end = read_sleb128 (data + 1, data + size, &frame_offset);
+ if (buf_end != data + size)
+ error ("Unexpected opcode after DW_OP_fbreg for symbol \"%s\".",
+ SYMBOL_PRINT_NAME (symbol));
+
+ TARGET_VIRTUAL_FRAME_POINTER (ax->scope, &frame_reg, &frame_offset);
+ ax_reg (ax, frame_reg);
+ ax_const_l (ax, frame_offset);
+ ax_simple (ax, aop_add);
+ ax_const_l (ax, frame_offset);
+ ax_simple (ax, aop_add);
+ value->kind = axs_lvalue_memory;
+ }
+ else
+ error ("Unsupported DWARF opcode in the location of \"%s\".",
+ SYMBOL_PRINT_NAME (symbol));
+}
/* Return the value of SYMBOL in FRAME using the DWARF-2 expression
evaluator to calculate the location. */
@@ -293,58 +416,14 @@ locexpr_describe_location (const struct symbol *symbol, struct ui_file *stream)
publicly available stub with tracepoint support for me to test
against. When there is one this function should be revisited. */
-void
+static void
locexpr_tracepoint_var_ref (const struct symbol * symbol,
struct agent_expr * ax,
struct axs_value * value)
{
struct dwarf2_locexpr_baton *dlbaton = SYMBOL_LOCATION_BATON (symbol);
- if (dlbaton->size == 0)
- error ("Symbol \"%s\" has been optimized out.",
- SYMBOL_PRINT_NAME (symbol));
-
- if (dlbaton->size == 1
- && dlbaton->data[0] >= DW_OP_reg0
- && dlbaton->data[0] <= DW_OP_reg31)
- {
- value->kind = axs_lvalue_register;
- value->u.reg = dlbaton->data[0] - DW_OP_reg0;
- }
- else if (dlbaton->data[0] == DW_OP_regx)
- {
- ULONGEST reg;
- read_uleb128 (dlbaton->data + 1, dlbaton->data + dlbaton->size,
- &reg);
- value->kind = axs_lvalue_register;
- value->u.reg = reg;
- }
- else if (dlbaton->data[0] == DW_OP_fbreg)
- {
- /* And this is worse than just minimal; we should honor the frame base
- as above. */
- int frame_reg;
- LONGEST frame_offset;
- unsigned char *buf_end;
-
- buf_end = read_sleb128 (dlbaton->data + 1, dlbaton->data + dlbaton->size,
- &frame_offset);
- if (buf_end != dlbaton->data + dlbaton->size)
- error ("Unexpected opcode after DW_OP_fbreg for symbol \"%s\".",
- SYMBOL_PRINT_NAME (symbol));
-
- TARGET_VIRTUAL_FRAME_POINTER (ax->scope, &frame_reg, &frame_offset);
- ax_reg (ax, frame_reg);
- ax_const_l (ax, frame_offset);
- ax_simple (ax, aop_add);
-
- ax_const_l (ax, frame_offset);
- ax_simple (ax, aop_add);
- value->kind = axs_lvalue_memory;
- }
- else
- error ("Unsupported DWARF opcode in the location of \"%s\".",
- SYMBOL_PRINT_NAME (symbol));
+ dwarf2_tracepoint_var_ref (symbol, ax, value, dlbaton->data, dlbaton->size);
}
/* The set of location functions used with the DWARF-2 expression
@@ -355,3 +434,76 @@ struct location_funcs dwarf2_locexpr_funcs = {
locexpr_describe_location,
locexpr_tracepoint_var_ref
};
+
+
+/* Wrapper functions for location lists. These generally find
+ the appropriate location expression and call something above. */
+
+/* Return the value of SYMBOL in FRAME using the DWARF-2 expression
+ evaluator to calculate the location. */
+static struct value *
+loclist_read_variable (const struct symbol *symbol, struct frame_info *frame)
+{
+ struct dwarf2_loclist_baton *dlbaton = SYMBOL_LOCATION_BATON (symbol);
+ struct value *val;
+ unsigned char *data;
+ int size;
+
+ data = find_location_expression (dlbaton, &size,
+ frame ? get_frame_pc (frame) : 0);
+ if (data == NULL)
+ error ("Variable \"%s\" is not available.", SYMBOL_NATURAL_NAME (symbol));
+
+ val = dwarf2_evaluate_loc_desc (symbol, frame, data, size, dlbaton->objfile);
+
+ return val;
+}
+
+/* Return non-zero iff we need a frame to evaluate SYMBOL. */
+static int
+loclist_read_needs_frame (const struct symbol *symbol)
+{
+ /* If there's a location list, then assume we need to have a frame
+ to choose the appropriate location expression. With tracking of
+ global variables this is not necessarily true, but such tracking
+ is disabled in GCC at the moment until we figure out how to
+ represent it. */
+
+ return 1;
+}
+
+/* Print a natural-language description of SYMBOL to STREAM. */
+static int
+loclist_describe_location (const struct symbol *symbol, struct ui_file *stream)
+{
+ /* FIXME: Could print the entire list of locations. */
+ fprintf_filtered (stream, "a variable with multiple locations");
+ return 1;
+}
+
+/* Describe the location of SYMBOL as an agent value in VALUE, generating
+ any necessary bytecode in AX. */
+static void
+loclist_tracepoint_var_ref (const struct symbol * symbol,
+ struct agent_expr * ax,
+ struct axs_value * value)
+{
+ struct dwarf2_loclist_baton *dlbaton = SYMBOL_LOCATION_BATON (symbol);
+ unsigned char *data;
+ int size;
+
+ data = find_location_expression (dlbaton, &size, ax->scope);
+ if (data == NULL)
+ error ("Variable \"%s\" is not available.", SYMBOL_NATURAL_NAME (symbol));
+
+ dwarf2_tracepoint_var_ref (symbol, ax, value, data, size);
+}
+
+/* The set of location functions used with the DWARF-2 expression
+ evaluator and location lists. */
+struct location_funcs dwarf2_loclist_funcs = {
+ loclist_read_variable,
+ loclist_read_needs_frame,
+ loclist_describe_location,
+ loclist_tracepoint_var_ref
+};
diff --git a/gdb/dwarf2loc.h b/gdb/dwarf2loc.h
index fde1329..b6b4d33 100644
--- a/gdb/dwarf2loc.h
+++ b/gdb/dwarf2loc.h
@@ -24,16 +24,41 @@
/* This header is private to the DWARF-2 reader. It is shared between
dwarf2read.c and dwarf2loc.c. */
-/* The symbol location baton type used by the DWARF-2 reader (i.e.
- SYMBOL_LOCATION_BATON for a LOC_COMPUTED symbol). */
+/* The symbol location baton types used by the DWARF-2 reader (i.e.
+ SYMBOL_LOCATION_BATON for a LOC_COMPUTED symbol). "struct
+ dwarf2_locexpr_baton" is for a symbol with a single location
+ expression; "struct dwarf2_loclist_baton" is for a symbol with a
+ location list. */
struct dwarf2_locexpr_baton
{
+ /* Pointer to the start of the location expression. */
unsigned char *data;
+
+ /* Length of the location expression. */
unsigned short size;
+
+ /* The objfile containing the symbol whose location we're computing. */
+ struct objfile *objfile;
+};
+
+struct dwarf2_loclist_baton
+{
+ /* The initial base address for the location list, based on the compilation
+ unit. */
+ CORE_ADDR base_address;
+
+ /* Pointer to the start of the location list. */
+ unsigned char *data;
+
+ /* Length of the location list. */
+ unsigned short size;
+
+ /* The objfile containing the symbol whose location we're computing. */
struct objfile *objfile;
};
extern struct location_funcs dwarf2_locexpr_funcs;
+extern struct location_funcs dwarf2_loclist_funcs;
#endif
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 63e0c7a..55c2412 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -43,6 +43,7 @@
#include "bcache.h"
#include "dwarf2expr.h"
#include "dwarf2loc.h"
+#include "cp-support.h"
#include <fcntl.h>
#include "gdb_string.h"
@@ -221,9 +222,13 @@ struct comp_unit_head
struct abbrev_info *dwarf2_abbrevs[ABBREV_HASH_SIZE];
- /* Pointer to the DIE associated with the compilation unit. */
+ /* Base address of this compilation unit. */
+
+ CORE_ADDR base_address;
- struct die_info *die;
+ /* Non-zero if base_address has been set. */
+
+ int base_known;
};
/* The line number information for a compilation unit (found in the
@@ -396,6 +401,7 @@ static char *dwarf_line_buffer;
static char *dwarf_str_buffer;
static char *dwarf_macinfo_buffer;
static char *dwarf_ranges_buffer;
+static char *dwarf_loc_buffer;
/* A zeroed version of a partial die for initialization purposes. */
static struct partial_die_info zeroed_partial_die;
@@ -512,6 +518,13 @@ struct dwarf2_pinfo
unsigned int dwarf_ranges_size;
+ /* Pointer to start of dwarf locations buffer for the objfile. */
+
+ char *dwarf_loc_buffer;
+
+ /* Size of dwarf locations buffer for the objfile. */
+
+ unsigned int dwarf_loc_size;
};
#define PST_PRIVATE(p) ((struct dwarf2_pinfo *)(p)->read_symtab_private)
@@ -527,6 +540,8 @@ struct dwarf2_pinfo
#define DWARF_MACINFO_SIZE(p) (PST_PRIVATE(p)->dwarf_macinfo_size)
#define DWARF_RANGES_BUFFER(p) (PST_PRIVATE(p)->dwarf_ranges_buffer)
#define DWARF_RANGES_SIZE(p) (PST_PRIVATE(p)->dwarf_ranges_size)
+#define DWARF_LOC_BUFFER(p) (PST_PRIVATE(p)->dwarf_loc_buffer)
+#define DWARF_LOC_SIZE(p) (PST_PRIVATE(p)->dwarf_loc_size)
/* Maintain an array of referenced fundamental types for the current
compilation unit being read. For DWARF version 1, we have to construct
@@ -959,6 +974,7 @@ dwarf2_has_info (bfd *abfd)
dwarf_frame_offset = 0;
dwarf_eh_frame_offset = 0;
dwarf_ranges_offset = 0;
+ dwarf_loc_offset = 0;
bfd_map_over_sections (abfd, dwarf2_locate_sections, NULL);
if (dwarf_info_offset && dwarf_abbrev_offset)
@@ -1095,6 +1111,14 @@ dwarf2_build_psymtabs (struct objfile *objfile, int mainline)
else
dwarf_ranges_buffer = NULL;
+ if (dwarf_loc_offset)
+ dwarf_loc_buffer = dwarf2_read_section (objfile,
+ dwarf_loc_offset,
+ dwarf_loc_size,
+ dwarf_loc_section);
+ else
+ dwarf_loc_buffer = NULL;
+
if (mainline
|| (objfile->global_psymbols.size == 0
&& objfile->static_psymbols.size == 0))
@@ -1316,6 +1340,8 @@ dwarf2_build_psymtabs_hard (struct objfile *objfile, int mainline)
DWARF_MACINFO_SIZE (pst) = dwarf_macinfo_size;
DWARF_RANGES_BUFFER (pst) = dwarf_ranges_buffer;
DWARF_RANGES_SIZE (pst) = dwarf_ranges_size;
+ DWARF_LOC_BUFFER (pst) = dwarf_loc_buffer;
+ DWARF_LOC_SIZE (pst) = dwarf_loc_size;
baseaddr = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
/* Store the function that reads in the rest of the symbol table */
@@ -1838,6 +1864,7 @@ psymtab_to_symtab_1 (struct partial_symtab *pst)
char *info_ptr;
struct symtab *symtab;
struct cleanup *back_to;
+ struct attribute *attr;
/* Set local variables from the partial symbol table info. */
offset = DWARF_INFO_OFFSET (pst);
@@ -1852,6 +1879,8 @@ psymtab_to_symtab_1 (struct partial_symtab *pst)
dwarf_macinfo_size = DWARF_MACINFO_SIZE (pst);
dwarf_ranges_buffer = DWARF_RANGES_BUFFER (pst);
dwarf_ranges_size = DWARF_RANGES_SIZE (pst);
+ dwarf_loc_buffer = DWARF_LOC_BUFFER (pst);
+ dwarf_loc_size = DWARF_LOC_SIZE (pst);
baseaddr = ANOFFSET (pst->section_offsets, SECT_OFF_TEXT (objfile));
cu_header_offset = offset;
info_ptr = dwarf_info_buffer + offset;
@@ -1876,8 +1905,32 @@ psymtab_to_symtab_1 (struct partial_symtab *pst)
make_cleanup_free_die_list (dies);
+ /* Find the base address of the compilation unit for range lists and
+ location lists. It will normally be specified by DW_AT_low_pc.
+ In DWARF-3 draft 4, the base address could be overridden by
+ DW_AT_entry_pc. It's been removed, but GCC still uses this for
+ compilation units with discontinuous ranges. */
+
+ cu_header.base_known = 0;
+ cu_header.base_address = 0;
+
+ attr = dwarf_attr (dies, DW_AT_entry_pc);
+ if (attr)
+ {
+ cu_header.base_address = DW_ADDR (attr);
+ cu_header.base_known = 1;
+ }
+ else
+ {
+ attr = dwarf_attr (dies, DW_AT_low_pc);
+ if (attr)
+ {
+ cu_header.base_address = DW_ADDR (attr);
+ cu_header.base_known = 1;
+ }
+ }
+
/* Do line number decoding in read_file_scope () */
- cu_header.die = dies;
process_die (dies, objfile, &cu_header);
if (!dwarf2_get_pc_bounds (dies, &lowpc, &highpc, objfile, &cu_header))
@@ -2355,40 +2408,18 @@ dwarf2_get_pc_bounds (struct die_info *die, CORE_ADDR *lowpc,
.debug_renges section. */
unsigned int offset = DW_UNSND (attr);
/* Base address selection entry. */
- CORE_ADDR base = 0;
- int found_base = 0;
+ CORE_ADDR base;
+ int found_base;
int dummy;
unsigned int i;
char *buffer;
CORE_ADDR marker;
int low_set;
- /* The applicable base address is determined by (1) the closest
- preceding base address selection entry in the range list or
- (2) the DW_AT_low_pc of the compilation unit. */
-
- /* ??? Was in dwarf3 draft4, and has since been removed.
- GCC still uses it though. */
- attr = dwarf_attr (cu_header->die, DW_AT_entry_pc);
- if (attr)
- {
- base = DW_ADDR (attr);
- found_base = 1;
- }
-
- if (!found_base)
- {
- attr = dwarf_attr (cu_header->die, DW_AT_low_pc);
- if (attr)
- {
- base = DW_ADDR (attr);
- found_base = 1;
- }
- }
-
+ found_base = cu_header->base_known;
+ base = cu_header->base_address;
buffer = dwarf_ranges_buffer + offset;
-
/* Read in the largest possible address. */
marker = read_address (obfd, buffer, cu_header, &dummy);
if ((marker & mask) == mask)
@@ -3490,7 +3521,7 @@ read_namespace (struct die_info *die, struct objfile *objfile,
}
else
{
- /* We need temp_name around because processing_current_namespace
+ /* We need temp_name around because processing_current_prefix
is a const char *. */
char *temp_name = alloca (strlen (previous_prefix)
+ 2 + strlen(name) + 1);
@@ -3505,9 +3536,9 @@ read_namespace (struct die_info *die, struct objfile *objfile,
time, add a using directive. */
if (is_anonymous && dwarf_attr (die, DW_AT_extension) == NULL)
- add_using_directive (processing_current_prefix,
- strlen (previous_prefix),
- strlen (processing_current_prefix));
+ cp_add_using_directive (processing_current_prefix,
+ strlen (previous_prefix),
+ strlen (processing_current_prefix));
if (die->has_children)
{
@@ -7778,26 +7809,53 @@ dwarf2_symbol_mark_computed (struct attribute *attr, struct symbol *sym,
const struct comp_unit_head *cu_header,
struct objfile *objfile)
{
- struct dwarf2_locexpr_baton *baton;
-
- /* When support for location lists is added, this will go away. */
- if (!attr_form_is_block (attr))
+ if (attr->form == DW_FORM_data4 || attr->form == DW_FORM_data8)
{
- dwarf2_complex_location_expr_complaint ();
- return;
- }
+ struct dwarf2_loclist_baton *baton;
- baton = obstack_alloc (&objfile->symbol_obstack,
- sizeof (struct dwarf2_locexpr_baton));
- baton->objfile = objfile;
+ baton = obstack_alloc (&objfile->symbol_obstack,
+ sizeof (struct dwarf2_loclist_baton));
+ baton->objfile = objfile;
- /* Note that we're just copying the block's data pointer here, not
- the actual data. We're still pointing into the dwarf_info_buffer
- for SYM's objfile; right now we never release that buffer, but
- when we do clean up properly this may need to change. */
- baton->size = DW_BLOCK (attr)->size;
- baton->data = DW_BLOCK (attr)->data;
+ /* We don't know how long the location list is, but make sure we
+ don't run off the edge of the section. */
+ baton->size = dwarf_loc_size - DW_UNSND (attr);
+ baton->data = dwarf_loc_buffer + DW_UNSND (attr);
+ baton->base_address = cu_header->base_address;
+ if (cu_header->base_known == 0)
+ complaint (&symfile_complaints,
+ "Location list used without specifying the CU base address.");
- SYMBOL_LOCATION_FUNCS (sym) = &dwarf2_locexpr_funcs;
- SYMBOL_LOCATION_BATON (sym) = baton;
+ SYMBOL_LOCATION_FUNCS (sym) = &dwarf2_loclist_funcs;
+ SYMBOL_LOCATION_BATON (sym) = baton;
+ }
+ else
+ {
+ struct dwarf2_locexpr_baton *baton;
+
+ baton = obstack_alloc (&objfile->symbol_obstack,
+ sizeof (struct dwarf2_locexpr_baton));
+ baton->objfile = objfile;
+
+ if (attr_form_is_block (attr))
+ {
+ /* Note that we're just copying the block's data pointer
+ here, not the actual data. We're still pointing into the
+ dwarf_info_buffer for SYM's objfile; right now we never
+ release that buffer, but when we do clean up properly
+ this may need to change. */
+ baton->size = DW_BLOCK (attr)->size;
+ baton->data = DW_BLOCK (attr)->data;
+ }
+ else
+ {
+ dwarf2_invalid_attrib_class_complaint ("location description",
+ SYMBOL_NATURAL_NAME (sym));
+ baton->size = 0;
+ baton->data = NULL;
+ }
+
+ SYMBOL_LOCATION_FUNCS (sym) = &dwarf2_locexpr_funcs;
+ SYMBOL_LOCATION_BATON (sym) = baton;
+ }
}
diff --git a/gdb/eval.c b/gdb/eval.c
index 649c340..fef4e9a 100644
--- a/gdb/eval.c
+++ b/gdb/eval.c
@@ -446,7 +446,7 @@ evaluate_subexp_standard (struct type *expect_type,
case OP_REGISTER:
{
int regno = longest_to_int (exp->elts[pc + 1].longconst);
- struct value *val = value_of_register (regno, deprecated_selected_frame);
+ struct value *val = value_of_register (regno, get_selected_frame ());
(*pos) += 2;
if (val == NULL)
error ("Value of register %s not available.",
diff --git a/gdb/event-top.h b/gdb/event-top.h
index 4c06083..7e48a6c 100644
--- a/gdb/event-top.h
+++ b/gdb/event-top.h
@@ -24,6 +24,8 @@
#ifndef EVENT_TOP_H
#define EVENT_TOP_H
+struct cmd_list_element;
+
/* Stack for prompts. Each prompt is composed as a prefix, a prompt
and a suffix. The prompt to be displayed at any given time is the
one on top of the stack. A stack is necessary because of cases in
diff --git a/gdb/expression.h b/gdb/expression.h
index e8bc90c..6d7a490 100644
--- a/gdb/expression.h
+++ b/gdb/expression.h
@@ -327,7 +327,7 @@ enum exp_opcode
OP_EXPRSTRING,
/* An Objective C Foundation Class NSString constant */
- OP_OBJC_NSSTRING,
+ OP_OBJC_NSSTRING
};
union exp_element
diff --git a/gdb/f-lang.c b/gdb/f-lang.c
index 84e3d81..2a4eac3 100644
--- a/gdb/f-lang.c
+++ b/gdb/f-lang.c
@@ -472,6 +472,8 @@ const struct language_defn f_language_defn =
f_print_type, /* Print a type using appropriate syntax */
f_val_print, /* Print a value using appropriate syntax */
c_value_print, /* FIXME */
+ NULL, /* Language specific skip_trampoline */
+ NULL, /* Language specific symbol demangler */
{"", "", "", ""}, /* Binary format info */
{"0%o", "0", "o", ""}, /* Octal format info */
{"%d", "", "d", ""}, /* Decimal format info */
diff --git a/gdb/findvar.c b/gdb/findvar.c
index 2283d4d..bb1d3a5 100644
--- a/gdb/findvar.c
+++ b/gdb/findvar.c
@@ -299,16 +299,16 @@ value_of_register (int regnum, struct frame_info *frame)
CORE_ADDR addr;
int optim;
struct value *reg_val;
+ int realnum;
char *raw_buffer = (char*) alloca (MAX_REGISTER_RAW_SIZE);
enum lval_type lval;
/* Builtin registers lie completly outside of the range of normal
registers. Catch them early so that the target never sees them. */
if (regnum >= NUM_REGS + NUM_PSEUDO_REGS)
- return value_of_builtin_reg (regnum, deprecated_selected_frame);
+ return value_of_builtin_reg (regnum, frame);
- get_saved_register (raw_buffer, &optim, &addr,
- frame, regnum, &lval);
+ frame_register (frame, regnum, &optim, &lval, &addr, &realnum, raw_buffer);
/* FIXME: cagney/2002-05-15: This test is just bogus.
@@ -508,7 +508,7 @@ addresses have not been bound by the dynamic loader. Try again when executable i
case LOC_ARG:
if (frame == NULL)
return 0;
- addr = FRAME_ARGS_ADDRESS (frame);
+ addr = get_frame_args_address (frame);
if (!addr)
return 0;
addr += SYMBOL_VALUE (var);
@@ -520,7 +520,7 @@ addresses have not been bound by the dynamic loader. Try again when executable i
CORE_ADDR argref;
if (frame == NULL)
return 0;
- argref = FRAME_ARGS_ADDRESS (frame);
+ argref = get_frame_args_address (frame);
if (!argref)
return 0;
argref += SYMBOL_VALUE (var);
@@ -533,7 +533,7 @@ addresses have not been bound by the dynamic loader. Try again when executable i
case LOC_LOCAL_ARG:
if (frame == NULL)
return 0;
- addr = FRAME_LOCALS_ADDRESS (frame);
+ addr = get_frame_locals_address (frame);
addr += SYMBOL_VALUE (var);
break;
@@ -780,12 +780,9 @@ value_from_register (struct type *type, int regnum, struct frame_info *frame)
(value_bytes_copied += REGISTER_RAW_SIZE (local_regnum),
++local_regnum))
{
- get_saved_register (value_bytes + value_bytes_copied,
- &optim,
- &addr,
- frame,
- local_regnum,
- &lval);
+ int realnum;
+ frame_register (frame, local_regnum, &optim, &lval, &addr,
+ &realnum, value_bytes + value_bytes_copied);
if (register_cached (local_regnum) == -1)
return NULL; /* register value not available */
@@ -851,7 +848,10 @@ value_from_register (struct type *type, int regnum, struct frame_info *frame)
register's contents in a real register or in core;
read the data in raw format. */
- get_saved_register (raw_buffer, &optim, &addr, frame, regnum, &lval);
+ {
+ int realnum;
+ frame_register (frame, regnum, &optim, &lval, &addr, &realnum, raw_buffer);
+ }
if (register_cached (regnum) == -1)
return NULL; /* register value not available */
diff --git a/gdb/fork-child.c b/gdb/fork-child.c
index 0b14a94..1dc28e8 100644
--- a/gdb/fork-child.c
+++ b/gdb/fork-child.c
@@ -409,7 +409,8 @@ startup_inferior (int ntraps)
#else
while (1)
{
- stop_soon_quietly = 1; /* Make wait_for_inferior be quiet */
+ /* Make wait_for_inferior be quiet */
+ stop_soon = STOP_QUIETLY;
wait_for_inferior ();
if (stop_signal != TARGET_SIGNAL_TRAP)
{
@@ -444,5 +445,5 @@ startup_inferior (int ntraps)
}
}
#endif /* STARTUP_INFERIOR */
- stop_soon_quietly = 0;
+ stop_soon = NO_STOP_QUIETLY;
}
diff --git a/gdb/frame-unwind.c b/gdb/frame-unwind.c
index a889f95..c72d24a 100644
--- a/gdb/frame-unwind.c
+++ b/gdb/frame-unwind.c
@@ -83,16 +83,19 @@ frame_unwind_find_by_pc (struct gdbarch *gdbarch, CORE_ADDR pc)
int i;
struct frame_unwind_table *table =
gdbarch_data (gdbarch, frame_unwind_data);
- /* Seriously old code. Don't even try to use this new mechanism. */
if (!DEPRECATED_USE_GENERIC_DUMMY_FRAMES)
- return trad_frame_unwind;
+ /* Seriously old code. Don't even try to use this new mechanism.
+ (Note: The variable USE_GENERIC_DUMMY_FRAMES is deprecated, not
+ the dummy frame mechanism. All architectures should be using
+ generic dummy frames). */
+ return legacy_saved_regs_unwind;
for (i = 0; i < table->nr; i++)
{
const struct frame_unwind *desc = table->p[i] (pc);
if (desc != NULL)
return desc;
}
- return trad_frame_unwind;
+ return legacy_saved_regs_unwind;
}
void
diff --git a/gdb/frame-unwind.h b/gdb/frame-unwind.h
index 2c67c96..ad1efdf 100644
--- a/gdb/frame-unwind.h
+++ b/gdb/frame-unwind.h
@@ -28,6 +28,8 @@ struct frame_unwind;
struct gdbarch;
struct regcache;
+#include "frame.h" /* For enum frame_type. */
+
/* Return the frame unwind methods for the function that contains PC,
or NULL if this this unwinder can't handle this frame. */
@@ -47,65 +49,94 @@ extern const struct frame_unwind *frame_unwind_find_by_pc (struct gdbarch
*gdbarch,
CORE_ADDR pc);
-/* Return the location (and possibly value) of REGNUM for the previous
- (older, up) frame. All parameters except VALUEP can be assumed to
- be non NULL. When VALUEP is NULL, just the location of the
- register should be returned.
-
- UNWIND_CACHE is provided as mechanism for implementing a per-frame
- local cache. It's initial value being NULL. Memory for that cache
- should be allocated using frame_obstack_zalloc().
-
- Register window architectures (eg SPARC) should note that REGNUM
- identifies the register for the previous frame. For instance, a
- request for the value of "o1" for the previous frame would be found
- in the register "i1" in this FRAME. */
-
-typedef void (frame_unwind_reg_ftype) (struct frame_info * frame,
- void **unwind_cache,
- int regnum,
- int *optimized,
- enum lval_type * lvalp,
- CORE_ADDR *addrp,
- int *realnump, void *valuep);
-
-/* Same as for registers above, but return the address at which the
- calling frame would resume. */
-
-typedef CORE_ADDR (frame_unwind_pc_ftype) (struct frame_info * frame,
- void **unwind_cache);
-
-/* Same as for registers above, but return the ID of the frame that
- called this one. */
-
-typedef void (frame_unwind_id_ftype) (struct frame_info * frame,
- void **unwind_cache,
- struct frame_id * id);
-
-/* Discard the frame by restoring the registers (in regcache) back to
- that of the caller. */
-/* NOTE: cagney/2003-01-19: While at present the callers all pop each
- frame in turn, the implementor should try to code things so that
- any frame can be popped directly. */
-/* FIXME: cagney/2003-01-19: Since both FRAME and REGCACHE refer to a
- common register cache, care must be taken when restoring the
- registers. The `correct fix' is to first first save the registers
- in a scratch cache, and second write that scratch cache back to to
- the real register cache. */
-
-typedef void (frame_unwind_pop_ftype) (struct frame_info *frame,
- void **unwind_cache,
- struct regcache *regcache);
+/* The following unwind functions assume a chain of frames forming the
+ sequence: (outer) prev <-> this <-> next (inner). All the
+ functions are called with called with the next frame's `struct
+ frame_info' and and this frame's prologue cache.
+
+ THIS frame's register values can be obtained by unwinding NEXT
+ frame's registers (a recursive operation).
+
+ THIS frame's prologue cache can be used to cache information such
+ as where this frame's prologue stores the previous frame's
+ registers. */
+
+/* Assuming the frame chain: (outer) prev <-> this <-> next (inner);
+ use the NEXT frame, and its register unwind method, to determine
+ the frame ID of THIS frame.
+
+ A frame ID provides an invariant that can be used to re-identify an
+ instance of a frame. It is a combination of the frame's `base' and
+ the frame's function's code address.
+
+ Traditionally, THIS frame's ID was determined by examining THIS
+ frame's function's prologue, and identifying the register/offset
+ used as THIS frame's base.
+
+ Example: An examination of THIS frame's prologue reveals that, on
+ entry, it saves the PC(+12), SP(+8), and R1(+4) registers
+ (decrementing the SP by 12). Consequently, the frame ID's base can
+ be determined by adding 12 to the THIS frame's stack-pointer, and
+ the value of THIS frame's SP can be obtained by unwinding the NEXT
+ frame's SP.
+
+ THIS_PROLOGUE_CACHE can be used to share any prolog analysis data
+ with the other unwind methods. Memory for that cache should be
+ allocated using frame_obstack_zalloc(). */
+
+typedef void (frame_this_id_ftype) (struct frame_info *next_frame,
+ void **this_prologue_cache,
+ struct frame_id *this_id);
+
+/* Assuming the frame chain: (outer) prev <-> this <-> next (inner);
+ use the NEXT frame, and its register unwind method, to unwind THIS
+ frame's registers (returning the value of the specified register
+ REGNUM in the previous frame).
+
+ Traditionally, THIS frame's registers were unwound by examining
+ THIS frame's function's prologue and identifying which registers
+ that prolog code saved on the stack.
+
+ Example: An examination of THIS frame's prologue reveals that, on
+ entry, it saves the PC(+12), SP(+8), and R1(+4) registers
+ (decrementing the SP by 12). Consequently, the value of the PC
+ register in the previous frame is found in memory at SP+12, and
+ THIS frame's SP can be obtained by unwinding the NEXT frame's SP.
+
+ Why not pass in THIS_FRAME? By passing in NEXT frame and THIS
+ cache, the supplied parameters are consistent with the sibling
+ function THIS_ID.
+
+ Can the code call ``frame_register (get_prev_frame (NEXT_FRAME))''?
+ Won't the call frame_register (THIS_FRAME) be faster? Well,
+ ignoring the possability that the previous frame does not yet
+ exist, the ``frame_register (FRAME)'' function is expanded to
+ ``frame_register_unwind (get_next_frame (FRAME)'' and hence that
+ call will expand to ``frame_register_unwind (get_next_frame
+ (get_prev_frame (NEXT_FRAME)))''. Might as well call
+ ``frame_register_unwind (NEXT_FRAME)'' directly.
+
+ THIS_PROLOGUE_CACHE can be used to share any prolog analysis data
+ with the other unwind methods. Memory for that cache should be
+ allocated using frame_obstack_zalloc(). */
+
+typedef void (frame_prev_register_ftype) (struct frame_info *next_frame,
+ void **this_prologue_cache,
+ int prev_regnum,
+ int *optimized,
+ enum lval_type * lvalp,
+ CORE_ADDR *addrp,
+ int *realnump, void *valuep);
struct frame_unwind
{
- /* Should the frame's type go here? */
+ /* The frame's type. Should this instead be a collection of
+ predicates that test the frame for various attributes? */
+ enum frame_type type;
/* Should an attribute indicating the frame's address-in-block go
here? */
- frame_unwind_pop_ftype *pop;
- frame_unwind_pc_ftype *pc;
- frame_unwind_id_ftype *id;
- frame_unwind_reg_ftype *reg;
+ frame_this_id_ftype *this_id;
+ frame_prev_register_ftype *prev_register;
};
#endif
diff --git a/gdb/frame.c b/gdb/frame.c
index 5d220c9..3871aa1 100644
--- a/gdb/frame.c
+++ b/gdb/frame.c
@@ -36,9 +36,101 @@
#include "annotate.h"
#include "language.h"
#include "frame-unwind.h"
+#include "frame-base.h"
#include "command.h"
#include "gdbcmd.h"
+/* We keep a cache of stack frames, each of which is a "struct
+ frame_info". The innermost one gets allocated (in
+ wait_for_inferior) each time the inferior stops; current_frame
+ points to it. Additional frames get allocated (in get_prev_frame)
+ as needed, and are chained through the next and prev fields. Any
+ time that the frame cache becomes invalid (most notably when we
+ execute something, but also if we change how we interpret the
+ frames (e.g. "set heuristic-fence-post" in mips-tdep.c, or anything
+ which reads new symbols)), we should call reinit_frame_cache. */
+
+struct frame_info
+{
+ /* Level of this frame. The inner-most (youngest) frame is at level
+ 0. As you move towards the outer-most (oldest) frame, the level
+ increases. This is a cached value. It could just as easily be
+ computed by counting back from the selected frame to the inner
+ most frame. */
+ /* NOTE: cagney/2002-04-05: Perhaphs a level of ``-1'' should be
+ reserved to indicate a bogus frame - one that has been created
+ just to keep GDB happy (GDB always needs a frame). For the
+ moment leave this as speculation. */
+ int level;
+
+ /* The frame's type. */
+ /* FIXME: cagney/2003-04-02: Should instead be returning
+ ->unwind->type. Unfortunatly, legacy code is still explicitly
+ setting the type using the method deprecated_set_frame_type.
+ Eliminate that method and this field can be eliminated. */
+ enum frame_type type;
+
+ /* For each register, address of where it was saved on entry to the
+ frame, or zero if it was not saved on entry to this frame. This
+ includes special registers such as pc and fp saved in special
+ ways in the stack frame. The SP_REGNUM is even more special, the
+ address here is the sp for the previous frame, not the address
+ where the sp was saved. */
+ /* Allocated by frame_saved_regs_zalloc () which is called /
+ initialized by DEPRECATED_FRAME_INIT_SAVED_REGS(). */
+ CORE_ADDR *saved_regs; /*NUM_REGS + NUM_PSEUDO_REGS*/
+
+ /* Anything extra for this structure that may have been defined in
+ the machine dependent files. */
+ /* Allocated by frame_extra_info_zalloc () which is called /
+ initialized by DEPRECATED_INIT_EXTRA_FRAME_INFO */
+ struct frame_extra_info *extra_info;
+
+ /* If dwarf2 unwind frame informations is used, this structure holds
+ all related unwind data. */
+ struct context *context;
+
+ /* The frame's low-level unwinder and corresponding cache. The
+ low-level unwinder is responsible for unwinding register values
+ for the previous frame. The low-level unwind methods are
+ selected based on the presence, or otherwize, of register unwind
+ information such as CFI. */
+ void *prologue_cache;
+ const struct frame_unwind *unwind;
+
+ /* Cached copy of the previous frame's resume address. */
+ struct {
+ int p;
+ CORE_ADDR value;
+ } prev_pc;
+
+ /* Cached copy of the previous frame's function address. */
+ struct
+ {
+ CORE_ADDR addr;
+ int p;
+ } prev_func;
+
+ /* This frame's ID. */
+ struct
+ {
+ int p;
+ struct frame_id value;
+ } this_id;
+
+ /* The frame's high-level base methods, and corresponding cache.
+ The high level base methods are selected based on the frame's
+ debug info. */
+ const struct frame_base *base;
+ void *base_cache;
+
+ /* Pointers to the next (down, inner, younger) and previous (up,
+ outer, older) frame_info's in the frame cache. */
+ struct frame_info *next; /* down, inner, younger */
+ int prev_p;
+ struct frame_info *prev; /* up, outer, older */
+};
+
/* Flag to control debugging. */
static int frame_debug;
@@ -47,6 +139,77 @@ static int frame_debug;
static int backtrace_below_main;
+static void
+fprint_frame_id (struct ui_file *file, struct frame_id id)
+{
+ fprintf_unfiltered (file, "{stack=0x%s,code=0x%s}",
+ paddr_nz (id.stack_addr),
+ paddr_nz (id.code_addr));
+}
+
+static void
+fprint_frame_type (struct ui_file *file, enum frame_type type)
+{
+ switch (type)
+ {
+ case UNKNOWN_FRAME:
+ fprintf_unfiltered (file, "UNKNOWN_FRAME");
+ return;
+ case NORMAL_FRAME:
+ fprintf_unfiltered (file, "NORMAL_FRAME");
+ return;
+ case DUMMY_FRAME:
+ fprintf_unfiltered (file, "DUMMY_FRAME");
+ return;
+ case SIGTRAMP_FRAME:
+ fprintf_unfiltered (file, "SIGTRAMP_FRAME");
+ return;
+ default:
+ fprintf_unfiltered (file, "<unknown type>");
+ return;
+ };
+}
+
+static void
+fprint_frame (struct ui_file *file, struct frame_info *fi)
+{
+ if (fi == NULL)
+ {
+ fprintf_unfiltered (file, "<NULL frame>");
+ return;
+ }
+ fprintf_unfiltered (file, "{");
+ fprintf_unfiltered (file, "level=%d", fi->level);
+ fprintf_unfiltered (file, ",");
+ fprintf_unfiltered (file, "type=");
+ fprint_frame_type (file, fi->type);
+ fprintf_unfiltered (file, ",");
+ fprintf_unfiltered (file, "unwind=");
+ if (fi->unwind != NULL)
+ gdb_print_host_address (fi->unwind, file);
+ else
+ fprintf_unfiltered (file, "<unknown>");
+ fprintf_unfiltered (file, ",");
+ fprintf_unfiltered (file, "pc=");
+ if (fi->next != NULL && fi->next->prev_pc.p)
+ fprintf_unfiltered (file, "0x%s", paddr_nz (fi->next->prev_pc.value));
+ else
+ fprintf_unfiltered (file, "<unknown>");
+ fprintf_unfiltered (file, ",");
+ fprintf_unfiltered (file, "id=");
+ if (fi->this_id.p)
+ fprint_frame_id (file, fi->this_id.value);
+ else
+ fprintf_unfiltered (file, "<unknown>");
+ fprintf_unfiltered (file, ",");
+ fprintf_unfiltered (file, "func=");
+ if (fi->next != NULL && fi->next->prev_func.p)
+ fprintf_unfiltered (file, "0x%s", paddr_nz (fi->next->prev_func.addr));
+ else
+ fprintf_unfiltered (file, "<unknown>");
+ fprintf_unfiltered (file, "}");
+}
+
/* Return a frame uniq ID that can be used to, later, re-find the
frame. */
@@ -57,52 +220,118 @@ get_frame_id (struct frame_info *fi)
{
return null_frame_id;
}
- else
+ if (!fi->this_id.p)
{
- struct frame_id id;
- id.base = fi->frame;
- id.pc = fi->pc;
- return id;
+ gdb_assert (!legacy_frame_p (current_gdbarch));
+ if (frame_debug)
+ fprintf_unfiltered (gdb_stdlog, "{ get_frame_id (fi=%d) ",
+ fi->level);
+ /* Find the unwinder. */
+ if (fi->unwind == NULL)
+ {
+ fi->unwind = frame_unwind_find_by_pc (current_gdbarch,
+ get_frame_pc (fi));
+ /* FIXME: cagney/2003-04-02: Rather than storing the frame's
+ type in the frame, the unwinder's type should be returned
+ directly. Unfortunatly, legacy code, called by
+ legacy_get_prev_frame, explicitly set the frames type
+ using the method deprecated_set_frame_type(). */
+ gdb_assert (fi->unwind->type != UNKNOWN_FRAME);
+ fi->type = fi->unwind->type;
+ }
+ /* Find THIS frame's ID. */
+ fi->unwind->this_id (fi->next, &fi->prologue_cache, &fi->this_id.value);
+ fi->this_id.p = 1;
+ if (frame_debug)
+ {
+ fprintf_unfiltered (gdb_stdlog, "-> ");
+ fprint_frame_id (gdb_stdlog, fi->this_id.value);
+ fprintf_unfiltered (gdb_stdlog, " }\n");
+ }
}
+ return fi->this_id.value;
}
const struct frame_id null_frame_id; /* All zeros. */
struct frame_id
-frame_id_build (CORE_ADDR base, CORE_ADDR func_or_pc)
+frame_id_build (CORE_ADDR stack_addr, CORE_ADDR code_addr)
{
struct frame_id id;
- id.base = base;
- id.pc = func_or_pc;
+ id.stack_addr = stack_addr;
+ id.code_addr = code_addr;
return id;
}
int
frame_id_p (struct frame_id l)
{
- /* The .func can be NULL but the .base cannot. */
- return (l.base != 0);
+ int p;
+ /* The .code can be NULL but the .stack cannot. */
+ p = (l.stack_addr != 0);
+ if (frame_debug)
+ {
+ fprintf_unfiltered (gdb_stdlog, "{ frame_id_p (l=");
+ fprint_frame_id (gdb_stdlog, l);
+ fprintf_unfiltered (gdb_stdlog, ") -> %d }\n", p);
+ }
+ return p;
}
int
frame_id_eq (struct frame_id l, struct frame_id r)
{
- /* If .base is different, the frames are different. */
- if (l.base != r.base)
- return 0;
- /* Add a test to check that the frame ID's are for the same function
- here. */
- return 1;
+ int eq;
+ if (l.stack_addr == 0 || r.stack_addr == 0)
+ /* Like a NaN, if either ID is invalid, the result is false. */
+ eq = 0;
+ else if (l.stack_addr != r.stack_addr)
+ /* If .stack addresses are different, the frames are different. */
+ eq = 0;
+ else if (l.code_addr == 0 || r.code_addr == 0)
+ /* A zero code addr is a wild card, always succeed. */
+ eq = 1;
+ else if (l.code_addr == r.code_addr)
+ /* The .stack and .code are identical, the ID's are identical. */
+ eq = 1;
+ else
+ /* FIXME: cagney/2003-04-06: This should be zero. Can't yet do
+ this because most frame ID's are not being initialized
+ correctly. */
+ eq = 1;
+ if (frame_debug)
+ {
+ fprintf_unfiltered (gdb_stdlog, "{ frame_id_eq (l=");
+ fprint_frame_id (gdb_stdlog, l);
+ fprintf_unfiltered (gdb_stdlog, ",r=");
+ fprint_frame_id (gdb_stdlog, r);
+ fprintf_unfiltered (gdb_stdlog, ") -> %d }\n", eq);
+ }
+ return eq;
}
int
frame_id_inner (struct frame_id l, struct frame_id r)
{
- /* Only return non-zero when strictly inner than. Note that, per
- comment in "frame.h", there is some fuzz here. Frameless
- functions are not strictly inner than (same .base but different
- .func). */
- return INNER_THAN (l.base, r.base);
+ int inner;
+ if (l.stack_addr == 0 || r.stack_addr == 0)
+ /* Like NaN, any operation involving an invalid ID always fails. */
+ inner = 0;
+ else
+ /* Only return non-zero when strictly inner than. Note that, per
+ comment in "frame.h", there is some fuzz here. Frameless
+ functions are not strictly inner than (same .stack but
+ different .code). */
+ inner = INNER_THAN (l.stack_addr, r.stack_addr);
+ if (frame_debug)
+ {
+ fprintf_unfiltered (gdb_stdlog, "{ frame_id_inner (l=");
+ fprint_frame_id (gdb_stdlog, l);
+ fprintf_unfiltered (gdb_stdlog, ",r=");
+ fprint_frame_id (gdb_stdlog, r);
+ fprintf_unfiltered (gdb_stdlog, ") -> %d }\n", inner);
+ }
+ return inner;
}
struct frame_info *
@@ -135,26 +364,127 @@ frame_find_by_id (struct frame_id id)
}
CORE_ADDR
-frame_pc_unwind (struct frame_info *frame)
+frame_pc_unwind (struct frame_info *this_frame)
+{
+ if (!this_frame->prev_pc.p)
+ {
+ CORE_ADDR pc;
+ if (gdbarch_unwind_pc_p (current_gdbarch))
+ {
+ /* The right way. The `pure' way. The one true way. This
+ method depends solely on the register-unwind code to
+ determine the value of registers in THIS frame, and hence
+ the value of this frame's PC (resume address). A typical
+ implementation is no more than:
+
+ frame_unwind_register (this_frame, ISA_PC_REGNUM, buf);
+ return extract_address (buf, size of ISA_PC_REGNUM);
+
+ Note: this method is very heavily dependent on a correct
+ register-unwind implementation, it pays to fix that
+ method first; this method is frame type agnostic, since
+ it only deals with register values, it works with any
+ frame. This is all in stark contrast to the old
+ FRAME_SAVED_PC which would try to directly handle all the
+ different ways that a PC could be unwound. */
+ pc = gdbarch_unwind_pc (current_gdbarch, this_frame);
+ }
+ else if (this_frame->level < 0)
+ {
+ /* FIXME: cagney/2003-03-06: Old code and and a sentinel
+ frame. Do like was always done. Fetch the PC's value
+ direct from the global registers array (via read_pc).
+ This assumes that this frame belongs to the current
+ global register cache. The assumption is dangerous. */
+ pc = read_pc ();
+ }
+ else if (DEPRECATED_FRAME_SAVED_PC_P ())
+ {
+ /* FIXME: cagney/2003-03-06: Old code, but not a sentinel
+ frame. Do like was always done. Note that this method,
+ unlike unwind_pc(), tries to handle all the different
+ frame cases directly. It fails. */
+ pc = DEPRECATED_FRAME_SAVED_PC (this_frame);
+ }
+ else
+ internal_error (__FILE__, __LINE__, "No gdbarch_unwind_pc method");
+ this_frame->prev_pc.value = pc;
+ this_frame->prev_pc.p = 1;
+ if (frame_debug)
+ fprintf_unfiltered (gdb_stdlog,
+ "{ frame_pc_unwind (this_frame=%d) -> 0x%s }\n",
+ this_frame->level,
+ paddr_nz (this_frame->prev_pc.value));
+ }
+ return this_frame->prev_pc.value;
+}
+
+CORE_ADDR
+frame_func_unwind (struct frame_info *fi)
{
- if (!frame->pc_unwind_cache_p)
+ if (!fi->prev_func.p)
{
- frame->pc_unwind_cache = frame->unwind->pc (frame, &frame->unwind_cache);
- frame->pc_unwind_cache_p = 1;
+ fi->prev_func.p = 1;
+ fi->prev_func.addr = get_pc_function_start (frame_pc_unwind (fi));
+ if (frame_debug)
+ fprintf_unfiltered (gdb_stdlog,
+ "{ frame_func_unwind (fi=%d) -> 0x%s }\n",
+ fi->level, paddr_nz (fi->prev_func.addr));
}
- return frame->pc_unwind_cache;
+ return fi->prev_func.addr;
+}
+
+CORE_ADDR
+get_frame_func (struct frame_info *fi)
+{
+ return frame_func_unwind (fi->next);
+}
+
+static int
+do_frame_unwind_register (void *src, int regnum, void *buf)
+{
+ frame_unwind_register (src, regnum, buf);
+ return 1;
}
void
-frame_pop (struct frame_info *frame)
-{
- /* FIXME: cagney/2003-01-18: There is probably a chicken-egg problem
- with passing in current_regcache. The pop function needs to be
- written carefully so as to not overwrite registers whose [old]
- values are needed to restore other registers. Instead, this code
- should pass in a scratch cache and, as a second step, restore the
- registers using that. */
- frame->unwind->pop (frame, &frame->unwind_cache, current_regcache);
+frame_pop (struct frame_info *this_frame)
+{
+ struct regcache *scratch_regcache;
+ struct cleanup *cleanups;
+
+ if (DEPRECATED_POP_FRAME_P ())
+ {
+ /* A legacy architecture that has implemented a custom pop
+ function. All new architectures should instead be using the
+ generic code below. */
+ DEPRECATED_POP_FRAME;
+ }
+ else
+ {
+ /* Make a copy of all the register values unwound from this
+ frame. Save them in a scratch buffer so that there isn't a
+ race betweening trying to extract the old values from the
+ current_regcache while, at the same time writing new values
+ into that same cache. */
+ struct regcache *scratch = regcache_xmalloc (current_gdbarch);
+ struct cleanup *cleanups = make_cleanup_regcache_xfree (scratch);
+ regcache_save (scratch, do_frame_unwind_register, this_frame);
+ /* FIXME: cagney/2003-03-16: It should be possible to tell the
+ target's register cache that it is about to be hit with a
+ burst register transfer and that the sequence of register
+ writes should be batched. The pair target_prepare_to_store()
+ and target_store_registers() kind of suggest this
+ functionality. Unfortunatly, they don't implement it. Their
+ lack of a formal definition can lead to targets writing back
+ bogus values (arguably a bug in the target code mind). */
+ /* Now copy those saved registers into the current regcache.
+ Here, regcache_cpy() calls regcache_restore(). */
+ regcache_cpy (current_regcache, scratch);
+ do_cleanups (cleanups);
+ }
+ /* We've made right mess of GDB's local state, just discard
+ everything. */
flush_cached_frames ();
}
@@ -165,6 +495,13 @@ frame_register_unwind (struct frame_info *frame, int regnum,
{
struct frame_unwind_cache *cache;
+ if (frame_debug)
+ {
+ fprintf_unfiltered (gdb_stdlog,
+ "{ frame_register_unwind (frame=%d,regnum=\"%s\",...) ",
+ frame->level, frame_map_regnum_to_name (regnum));
+ }
+
/* Require all but BUFFERP to be valid. A NULL BUFFERP indicates
that the value proper does not need to be fetched. */
gdb_assert (optimizedp != NULL);
@@ -179,9 +516,46 @@ frame_register_unwind (struct frame_info *frame, int regnum,
detected the problem before calling here. */
gdb_assert (frame != NULL);
- /* Ask this frame to unwind its register. */
- frame->unwind->reg (frame, &frame->unwind_cache, regnum,
- optimizedp, lvalp, addrp, realnump, bufferp);
+ /* Find the unwinder. */
+ if (frame->unwind == NULL)
+ {
+ frame->unwind = frame_unwind_find_by_pc (current_gdbarch,
+ get_frame_pc (frame));
+ /* FIXME: cagney/2003-04-02: Rather than storing the frame's
+ type in the frame, the unwinder's type should be returned
+ directly. Unfortunatly, legacy code, called by
+ legacy_get_prev_frame, explicitly set the frames type using
+ the method deprecated_set_frame_type(). */
+ gdb_assert (frame->unwind->type != UNKNOWN_FRAME);
+ frame->type = frame->unwind->type;
+ }
+
+ /* Ask this frame to unwind its register. See comment in
+ "frame-unwind.h" for why NEXT frame and this unwind cace are
+ passed in. */
+ frame->unwind->prev_register (frame->next, &frame->prologue_cache, regnum,
+ optimizedp, lvalp, addrp, realnump, bufferp);
+
+ if (frame_debug)
+ {
+ fprintf_unfiltered (gdb_stdlog, "->");
+ fprintf_unfiltered (gdb_stdlog, " *optimizedp=%d", (*optimizedp));
+ fprintf_unfiltered (gdb_stdlog, " *lvalp=%d", (int) (*lvalp));
+ fprintf_unfiltered (gdb_stdlog, " *addrp=0x%s", paddr_nz ((*addrp)));
+ fprintf_unfiltered (gdb_stdlog, " *bufferp=");
+ if (bufferp == NULL)
+ fprintf_unfiltered (gdb_stdlog, "<NULL>");
+ else
+ {
+ int i;
+ const char *buf = bufferp;
+ fprintf_unfiltered (gdb_stdlog, "[");
+ for (i = 0; i < register_size (current_gdbarch, regnum); i++)
+ fprintf_unfiltered (gdb_stdlog, "%02x", buf[i]);
+ fprintf_unfiltered (gdb_stdlog, "]");
+ }
+ fprintf_unfiltered (gdb_stdlog, " }\n");
+ }
}
void
@@ -200,9 +574,10 @@ frame_register (struct frame_info *frame, int regnum,
/* Ulgh! Old code that, for lval_register, sets ADDRP to the offset
of the register in the register cache. It should instead return
the REGNUM corresponding to that register. Translate the . */
- if (GET_SAVED_REGISTER_P ())
+ if (DEPRECATED_GET_SAVED_REGISTER_P ())
{
- GET_SAVED_REGISTER (bufferp, optimizedp, addrp, frame, regnum, lvalp);
+ DEPRECATED_GET_SAVED_REGISTER (bufferp, optimizedp, addrp, frame,
+ regnum, lvalp);
/* Compute the REALNUM if the caller wants it. */
if (*lvalp == lval_register)
{
@@ -330,23 +705,6 @@ generic_unwind_get_saved_register (char *raw_buffer,
&realnumx, raw_buffer);
}
-void
-get_saved_register (char *raw_buffer,
- int *optimized,
- CORE_ADDR *addrp,
- struct frame_info *frame,
- int regnum,
- enum lval_type *lval)
-{
- if (GET_SAVED_REGISTER_P ())
- {
- GET_SAVED_REGISTER (raw_buffer, optimized, addrp, frame, regnum, lval);
- return;
- }
- generic_unwind_get_saved_register (raw_buffer, optimized, addrp, frame,
- regnum, lval);
-}
-
/* frame_register_read ()
Find and return the value of REGNUM for the specified stack frame.
@@ -431,18 +789,22 @@ create_sentinel_frame (struct regcache *regcache)
/* Explicitly initialize the sentinel frame's cache. Provide it
with the underlying regcache. In the future additional
information, such as the frame's thread will be added. */
- frame->unwind_cache = sentinel_frame_cache (regcache);
+ frame->prologue_cache = sentinel_frame_cache (regcache);
/* For the moment there is only one sentinel frame implementation. */
frame->unwind = sentinel_frame_unwind;
/* Link this frame back to itself. The frame is self referential
(the unwound PC is the same as the pc), so make it so. */
frame->next = frame;
- /* Always unwind the PC as part of creating this frame. This
- ensures that the frame's PC points at something valid. */
- /* FIXME: cagney/2003-01-10: Problem here. Unwinding a sentinel
- frame's PC may require information such as the frame's thread's
- stop reason. Is it possible to get to that? */
- frame->pc = frame_pc_unwind (frame);
+ /* Make the sentinel frame's ID valid, but invalid. That way all
+ comparisons with it should fail. */
+ frame->this_id.p = 1;
+ frame->this_id.value = null_frame_id;
+ if (frame_debug)
+ {
+ fprintf_unfiltered (gdb_stdlog, "{ create_sentinel_frame (...) -> ");
+ fprint_frame (gdb_stdlog, frame);
+ fprintf_unfiltered (gdb_stdlog, " }\n");
+ }
return frame;
}
@@ -498,10 +860,15 @@ unwind_to_current_frame (struct ui_out *ui_out, void *args)
struct frame_info *
get_current_frame (void)
{
- if (!target_has_stack)
- error ("No stack.");
+ /* First check, and report, the lack of registers. Having GDB
+ report "No stack!" or "No memory" when the target doesn't even
+ have registers is very confusing. Besides, "printcmd.exp"
+ explicitly checks that ``print $pc'' with no registers prints "No
+ registers". */
if (!target_has_registers)
error ("No registers.");
+ if (!target_has_stack)
+ error ("No stack.");
if (!target_has_memory)
error ("No memory.");
if (current_frame == NULL)
@@ -567,7 +934,7 @@ select_frame (struct frame_info *fi)
source language of this frame, and switch to it if desired. */
if (fi)
{
- s = find_pc_symtab (fi->pc);
+ s = find_pc_symtab (get_frame_pc (fi));
if (s
&& s->language != current_language->la_language
&& s->language != language_unknown
@@ -583,19 +950,20 @@ select_frame (struct frame_info *fi)
most frame. */
static void
-frame_saved_regs_register_unwind (struct frame_info *frame, void **cache,
- int regnum, int *optimizedp,
- enum lval_type *lvalp, CORE_ADDR *addrp,
- int *realnump, void *bufferp)
+legacy_saved_regs_prev_register (struct frame_info *next_frame,
+ void **this_prologue_cache,
+ int regnum, int *optimizedp,
+ enum lval_type *lvalp, CORE_ADDR *addrp,
+ int *realnump, void *bufferp)
{
- /* There is always a frame at this point. And THIS is the frame
- we're interested in. */
+ /* HACK: New code is passed the next frame and this cache.
+ Unfortunatly, old code expects this frame. Since this is a
+ backward compatibility hack, cheat by walking one level along the
+ prologue chain to the frame the old code expects.
+
+ Do not try this at home. Professional driver, closed course. */
+ struct frame_info *frame = next_frame->prev;
gdb_assert (frame != NULL);
- /* If we're using generic dummy frames, we'd better not be in a call
- dummy. (generic_call_dummy_register_unwind ought to have been called
- instead.) */
- gdb_assert (!(DEPRECATED_USE_GENERIC_DUMMY_FRAMES
- && (get_frame_type (frame) == DUMMY_FRAME)));
/* Only (older) architectures that implement the
DEPRECATED_FRAME_INIT_SAVED_REGS method should be using this
@@ -633,13 +1001,13 @@ frame_saved_regs_register_unwind (struct frame_info *frame, void **cache,
#if 1
/* Save each register value, as it is read in, in a
frame based cache. */
- void **regs = (*cache);
+ void **regs = (*this_prologue_cache);
if (regs == NULL)
{
int sizeof_cache = ((NUM_REGS + NUM_PSEUDO_REGS)
* sizeof (void *));
regs = frame_obstack_zalloc (sizeof_cache);
- (*cache) = regs;
+ (*this_prologue_cache) = regs;
}
if (regs[regnum] == NULL)
{
@@ -659,102 +1027,35 @@ frame_saved_regs_register_unwind (struct frame_info *frame, void **cache,
return;
}
- /* No luck, assume this and the next frame have the same register
- value. Pass the request down the frame chain to the next frame.
- Hopefully that will find the register's location, either in a
- register or in memory. */
- frame_register (frame, regnum, optimizedp, lvalp, addrp, realnump,
- bufferp);
+ /* No luck. Assume this and the next frame have the same register
+ value. Pass the unwind request down the frame chain to the next
+ frame. Hopefully that frame will find the register's location. */
+ frame_register_unwind (next_frame, regnum, optimizedp, lvalp, addrp,
+ realnump, bufferp);
}
-static CORE_ADDR
-frame_saved_regs_pc_unwind (struct frame_info *frame, void **cache)
-{
- gdb_assert (FRAME_SAVED_PC_P ());
- return FRAME_SAVED_PC (frame);
-}
-
static void
-frame_saved_regs_id_unwind (struct frame_info *next_frame, void **cache,
- struct frame_id *id)
+legacy_saved_regs_this_id (struct frame_info *next_frame,
+ void **this_prologue_cache,
+ struct frame_id *id)
{
- int fromleaf;
- CORE_ADDR base;
- CORE_ADDR pc;
-
- /* Start out by assuming it's NULL. */
- (*id) = null_frame_id;
-
- if (frame_relative_level (next_frame) <= 0)
- /* FIXME: 2002-11-09: Frameless functions can occure anywhere in
- the frame chain, not just the inner most frame! The generic,
- per-architecture, frame code should handle this and the below
- should simply be removed. */
- fromleaf = FRAMELESS_FUNCTION_INVOCATION (next_frame);
- else
- fromleaf = 0;
-
- if (fromleaf)
- /* A frameless inner-most frame. The `FP' (which isn't an
- architecture frame-pointer register!) of the caller is the same
- as the callee. */
- /* FIXME: 2002-11-09: There isn't any reason to special case this
- edge condition. Instead the per-architecture code should hande
- it locally. */
- base = get_frame_base (next_frame);
- else
- {
- /* Two macros defined in tm.h specify the machine-dependent
- actions to be performed here.
-
- First, get the frame's chain-pointer.
-
- If that is zero, the frame is the outermost frame or a leaf
- called by the outermost frame. This means that if start
- calls main without a frame, we'll return 0 (which is fine
- anyway).
-
- Nope; there's a problem. This also returns when the current
- routine is a leaf of main. This is unacceptable. We move
- this to after the ffi test; I'd rather have backtraces from
- start go curfluy than have an abort called from main not show
- main. */
- gdb_assert (FRAME_CHAIN_P ());
- base = FRAME_CHAIN (next_frame);
-
- if (!frame_chain_valid (base, next_frame))
- return;
- }
- if (base == 0)
- return;
-
- /* FIXME: cagney/2002-06-08: This should probably return the frame's
- function and not the PC (a.k.a. resume address). */
- pc = frame_pc_unwind (next_frame);
- id->pc = pc;
- id->base = base;
+ /* legacy_get_prev_frame() always sets ->this_id.p, hence this is
+ never needed. */
+ internal_error (__FILE__, __LINE__, "legacy_saved_regs_this_id() called");
}
-static void
-frame_saved_regs_pop (struct frame_info *fi, void **cache,
- struct regcache *regcache)
-{
- gdb_assert (POP_FRAME_P ());
- POP_FRAME;
-}
-
-const struct frame_unwind trad_frame_unwinder = {
- frame_saved_regs_pop,
- frame_saved_regs_pc_unwind,
- frame_saved_regs_id_unwind,
- frame_saved_regs_register_unwind
+const struct frame_unwind legacy_saved_regs_unwinder = {
+ /* Not really. It gets overridden by legacy_get_prev_frame. */
+ UNKNOWN_FRAME,
+ legacy_saved_regs_this_id,
+ legacy_saved_regs_prev_register
};
-const struct frame_unwind *trad_frame_unwind = &trad_frame_unwinder;
+const struct frame_unwind *legacy_saved_regs_unwind = &legacy_saved_regs_unwinder;
-/* Function: get_saved_register
+/* Function: deprecated_generic_get_saved_register
Find register number REGNUM relative to FRAME and put its (raw,
- target format) contents in *RAW_BUFFER.
+ target format) contents in *RAW_BUFFER.
Set *OPTIMIZED if the variable was optimized out (and thus can't be
fetched). Note that this is never set to anything other than zero
@@ -770,10 +1071,6 @@ const struct frame_unwind *trad_frame_unwind = &trad_frame_unwinder;
offset into the registers array. If the value is stored in a dummy
frame, set *ADDRP to zero.
- To use this implementation, define a function called
- "get_saved_register" in your target code, which simply passes all
- of its arguments to this function.
-
The argument RAW_BUFFER must point to aligned memory. */
void
@@ -888,31 +1185,51 @@ create_new_frame (CORE_ADDR addr, CORE_ADDR pc)
{
struct frame_info *fi;
+ if (frame_debug)
+ {
+ fprintf_unfiltered (gdb_stdlog,
+ "{ create_new_frame (addr=0x%s, pc=0x%s) ",
+ paddr_nz (addr), paddr_nz (pc));
+ }
+
fi = frame_obstack_zalloc (sizeof (struct frame_info));
- fi->frame = addr;
- fi->pc = pc;
fi->next = create_sentinel_frame (current_regcache);
- fi->type = frame_type_from_pc (pc);
+
+ /* Select/initialize both the unwind function and the frame's type
+ based on the PC. */
+ fi->unwind = frame_unwind_find_by_pc (current_gdbarch, pc);
+ if (fi->unwind->type != UNKNOWN_FRAME)
+ fi->type = fi->unwind->type;
+ else
+ fi->type = frame_type_from_pc (pc);
+
+ fi->this_id.p = 1;
+ deprecated_update_frame_base_hack (fi, addr);
+ deprecated_update_frame_pc_hack (fi, pc);
if (DEPRECATED_INIT_EXTRA_FRAME_INFO_P ())
DEPRECATED_INIT_EXTRA_FRAME_INFO (0, fi);
- /* Select/initialize an unwind function. */
- fi->unwind = frame_unwind_find_by_pc (current_gdbarch, fi->pc);
+ if (frame_debug)
+ {
+ fprintf_unfiltered (gdb_stdlog, "-> ");
+ fprint_frame (gdb_stdlog, fi);
+ fprintf_unfiltered (gdb_stdlog, " }\n");
+ }
return fi;
}
-/* Return the frame that FRAME calls (NULL if FRAME is the innermost
- frame). Be careful to not fall off the bottom of the frame chain
- and onto the sentinel frame. */
+/* Return the frame that THIS_FRAME calls (NULL if THIS_FRAME is the
+ innermost frame). Be careful to not fall off the bottom of the
+ frame chain and onto the sentinel frame. */
struct frame_info *
-get_next_frame (struct frame_info *frame)
+get_next_frame (struct frame_info *this_frame)
{
- if (frame->level > 0)
- return frame->next;
+ if (this_frame->level > 0)
+ return this_frame->next;
else
return NULL;
}
@@ -929,6 +1246,8 @@ flush_cached_frames (void)
current_frame = NULL; /* Invalidate cache */
select_frame (NULL);
annotate_frames_invalid ();
+ if (frame_debug)
+ fprintf_unfiltered (gdb_stdlog, "{ flush_cached_frames () }\n");
}
/* Flush the frame cache, and start a new one if necessary. */
@@ -949,15 +1268,183 @@ reinit_frame_cache (void)
INIT_EXTRA_INFO, INIT_FRAME_PC and INIT_FRAME_PC_FIRST. */
static struct frame_info *
-legacy_get_prev_frame (struct frame_info *next_frame)
+legacy_get_prev_frame (struct frame_info *this_frame)
{
CORE_ADDR address = 0;
struct frame_info *prev;
int fromleaf;
+ /* Don't frame_debug print legacy_get_prev_frame() here, just
+ confuses the output. */
+
+ /* Allocate the new frame.
+
+ There is no reason to worry about memory leaks, should the
+ remainder of the function fail. The allocated memory will be
+ quickly reclaimed when the frame cache is flushed, and the `we've
+ been here before' check, in get_prev_frame will stop repeated
+ memory allocation calls. */
+ prev = FRAME_OBSTACK_ZALLOC (struct frame_info);
+ prev->level = this_frame->level + 1;
+
+ /* Do not completly wire it in to the frame chain. Some (bad) code
+ in INIT_FRAME_EXTRA_INFO tries to look along frame->prev to pull
+ some fancy tricks (of course such code is, by definition,
+ recursive).
+
+ On the other hand, methods, such as get_frame_pc() and
+ get_frame_base() rely on being able to walk along the frame
+ chain. Make certain that at least they work by providing that
+ link. Of course things manipulating prev can't go back. */
+ prev->next = this_frame;
+
+ /* NOTE: cagney/2002-11-18: Should have been correctly setting the
+ frame's type here, before anything else, and not last, at the
+ bottom of this function. The various
+ DEPRECATED_INIT_EXTRA_FRAME_INFO, DEPRECATED_INIT_FRAME_PC,
+ DEPRECATED_INIT_FRAME_PC_FIRST and
+ DEPRECATED_FRAME_INIT_SAVED_REGS methods are full of work-arounds
+ that handle the frame not being correctly set from the start.
+ Unfortunatly those same work-arounds rely on the type defaulting
+ to NORMAL_FRAME. Ulgh! The new frame code does not have this
+ problem. */
+ prev->type = UNKNOWN_FRAME;
+
+ /* A legacy frame's ID is always computed here. Mark it as valid. */
+ prev->this_id.p = 1;
+
+ /* Handle sentinel frame unwind as a special case. */
+ if (this_frame->level < 0)
+ {
+ /* Try to unwind the PC. If that doesn't work, assume we've reached
+ the oldest frame and simply return. Is there a better sentinal
+ value? The unwound PC value is then used to initialize the new
+ previous frame's type.
+
+ Note that the pc-unwind is intentionally performed before the
+ frame chain. This is ok since, for old targets, both
+ frame_pc_unwind (nee, DEPRECATED_FRAME_SAVED_PC) and
+ DEPRECATED_FRAME_CHAIN()) assume THIS_FRAME's data structures
+ have already been initialized (using
+ DEPRECATED_INIT_EXTRA_FRAME_INFO) and hence the call order
+ doesn't matter.
+
+ By unwinding the PC first, it becomes possible to, in the case of
+ a dummy frame, avoid also unwinding the frame ID. This is
+ because (well ignoring the PPC) a dummy frame can be located
+ using THIS_FRAME's frame ID. */
+
+ deprecated_update_frame_pc_hack (prev, frame_pc_unwind (this_frame));
+ if (get_frame_pc (prev) == 0)
+ {
+ /* The allocated PREV_FRAME will be reclaimed when the frame
+ obstack is next purged. */
+ if (frame_debug)
+ {
+ fprintf_unfiltered (gdb_stdlog, "-> ");
+ fprint_frame (gdb_stdlog, NULL);
+ fprintf_unfiltered (gdb_stdlog,
+ " // unwound legacy PC zero }\n");
+ }
+ return NULL;
+ }
+
+ /* Set the unwind functions based on that identified PC. Ditto
+ for the "type" but strongly prefer the unwinder's frame type. */
+ prev->unwind = frame_unwind_find_by_pc (current_gdbarch,
+ get_frame_pc (prev));
+ if (prev->unwind->type == UNKNOWN_FRAME)
+ prev->type = frame_type_from_pc (get_frame_pc (prev));
+ else
+ prev->type = prev->unwind->type;
+
+ /* Find the prev's frame's ID. */
+ if (prev->type == DUMMY_FRAME
+ && gdbarch_unwind_dummy_id_p (current_gdbarch))
+ {
+ /* When unwinding a normal frame, the stack structure is
+ determined by analyzing the frame's function's code (be
+ it using brute force prologue analysis, or the dwarf2
+ CFI). In the case of a dummy frame, that simply isn't
+ possible. The The PC is either the program entry point,
+ or some random address on the stack. Trying to use that
+ PC to apply standard frame ID unwind techniques is just
+ asking for trouble. */
+ /* Assume call_function_by_hand(), via SAVE_DUMMY_FRAME_TOS,
+ previously saved the dummy frame's ID. Things only work
+ if the two return the same value. */
+ gdb_assert (SAVE_DUMMY_FRAME_TOS_P ());
+ /* Use an architecture specific method to extract the prev's
+ dummy ID from the next frame. Note that this method uses
+ frame_register_unwind to obtain the register values
+ needed to determine the dummy frame's ID. */
+ prev->this_id.value = gdbarch_unwind_dummy_id (current_gdbarch,
+ this_frame);
+ }
+ else
+ {
+ /* We're unwinding a sentinel frame, the PC of which is
+ pointing at a stack dummy. Fake up the dummy frame's ID
+ using the same sequence as is found a traditional
+ unwinder. Once all architectures supply the
+ unwind_dummy_id method, this code can go away. */
+ prev->this_id.value = frame_id_build (read_fp (), read_pc ());
+ }
+
+ /* Check that the unwound ID is valid. */
+ if (!frame_id_p (prev->this_id.value))
+ {
+ if (frame_debug)
+ {
+ fprintf_unfiltered (gdb_stdlog, "-> ");
+ fprint_frame (gdb_stdlog, NULL);
+ fprintf_unfiltered (gdb_stdlog,
+ " // unwound legacy ID invalid }\n");
+ }
+ return NULL;
+ }
+
+ /* Check that the new frame isn't inner to (younger, below,
+ next) the old frame. If that happens the frame unwind is
+ going backwards. */
+ /* FIXME: cagney/2003-02-25: Ignore the sentinel frame since
+ that doesn't have a valid frame ID. Should instead set the
+ sentinel frame's frame ID to a `sentinel'. Leave it until
+ after the switch to storing the frame ID, instead of the
+ frame base, in the frame object. */
+
+ /* Link it in. */
+ this_frame->prev = prev;
+
+ /* FIXME: cagney/2002-01-19: This call will go away. Instead of
+ initializing extra info, all frames will use the frame_cache
+ (passed to the unwind functions) to store additional frame
+ info. Unfortunatly legacy targets can't use
+ legacy_get_prev_frame() to unwind the sentinel frame and,
+ consequently, are forced to take this code path and rely on
+ the below call to DEPRECATED_INIT_EXTRA_FRAME_INFO to
+ initialize the inner-most frame. */
+ if (DEPRECATED_INIT_EXTRA_FRAME_INFO_P ())
+ {
+ DEPRECATED_INIT_EXTRA_FRAME_INFO (0, prev);
+ }
+
+ if (prev->type == NORMAL_FRAME)
+ prev->this_id.value.code_addr
+ = get_pc_function_start (prev->this_id.value.code_addr);
+
+ if (frame_debug)
+ {
+ fprintf_unfiltered (gdb_stdlog, "-> ");
+ fprint_frame (gdb_stdlog, prev);
+ fprintf_unfiltered (gdb_stdlog, " } // legacy innermost frame\n");
+ }
+ return prev;
+ }
+
/* This code only works on normal frames. A sentinel frame, where
the level is -1, should never reach this code. */
- gdb_assert (next_frame->level >= 0);
+ gdb_assert (this_frame->level >= 0);
/* On some machines it is possible to call a function without
setting up a stack frame for it. On these machines, we
@@ -966,14 +1453,14 @@ legacy_get_prev_frame (struct frame_info *next_frame)
or isn't leafless. */
/* Still don't want to worry about this except on the innermost
- frame. This macro will set FROMLEAF if NEXT_FRAME is a frameless
+ frame. This macro will set FROMLEAF if THIS_FRAME is a frameless
function invocation. */
- if (next_frame->level == 0)
+ if (this_frame->level == 0)
/* FIXME: 2002-11-09: Frameless functions can occure anywhere in
the frame chain, not just the inner most frame! The generic,
per-architecture, frame code should handle this and the below
should simply be removed. */
- fromleaf = FRAMELESS_FUNCTION_INVOCATION (next_frame);
+ fromleaf = FRAMELESS_FUNCTION_INVOCATION (this_frame);
else
fromleaf = 0;
@@ -984,7 +1471,7 @@ legacy_get_prev_frame (struct frame_info *next_frame)
/* FIXME: 2002-11-09: There isn't any reason to special case this
edge condition. Instead the per-architecture code should hande
it locally. */
- address = get_frame_base (next_frame);
+ address = get_frame_base (this_frame);
else
{
/* Two macros defined in tm.h specify the machine-dependent
@@ -1002,28 +1489,36 @@ legacy_get_prev_frame (struct frame_info *next_frame)
this to after the ffi test; I'd rather have backtraces from
start go curfluy than have an abort called from main not show
main. */
- gdb_assert (FRAME_CHAIN_P ());
- address = FRAME_CHAIN (next_frame);
+ gdb_assert (DEPRECATED_FRAME_CHAIN_P ());
+ address = DEPRECATED_FRAME_CHAIN (this_frame);
- if (!frame_chain_valid (address, next_frame))
- return 0;
+ if (!legacy_frame_chain_valid (address, this_frame))
+ {
+ if (frame_debug)
+ {
+ fprintf_unfiltered (gdb_stdlog, "-> ");
+ fprint_frame (gdb_stdlog, NULL);
+ fprintf_unfiltered (gdb_stdlog,
+ " // legacy frame chain invalid }\n");
+ }
+ return NULL;
+ }
}
if (address == 0)
- return 0;
-
- /* Create an initially zero previous frame. */
- prev = frame_obstack_zalloc (sizeof (struct frame_info));
+ {
+ if (frame_debug)
+ {
+ fprintf_unfiltered (gdb_stdlog, "-> ");
+ fprint_frame (gdb_stdlog, NULL);
+ fprintf_unfiltered (gdb_stdlog,
+ " // legacy frame chain NULL }\n");
+ }
+ return NULL;
+ }
- /* Link it in. */
- next_frame->prev = prev;
- prev->next = next_frame;
- prev->frame = address;
- prev->level = next_frame->level + 1;
- /* FIXME: cagney/2002-11-18: Should be setting the frame's type
- here, before anything else, and not last. Various INIT functions
- are full of work-arounds for the frames type not being set
- correctly from the word go. Ulgh! */
- prev->type = NORMAL_FRAME;
+ /* Link in the already allocated prev frame. */
+ this_frame->prev = prev;
+ deprecated_update_frame_base_hack (prev, address);
/* This change should not be needed, FIXME! We should determine
whether any targets *need* DEPRECATED_INIT_FRAME_PC to happen
@@ -1059,10 +1554,11 @@ legacy_get_prev_frame (struct frame_info *next_frame)
DEPRECATED_INIT_EXTRA_FRAME_INFO and DEPRECATED_INIT_FRAME_PC.
This should also return a flag saying whether to keep the new
frame, or whether to discard it, because on some machines (e.g.
- mips) it is really awkward to have FRAME_CHAIN_VALID called
- BEFORE DEPRECATED_INIT_EXTRA_FRAME_INFO (there is no good way to
- get information deduced in FRAME_CHAIN_VALID into the extra
- fields of the new frame). std_frame_pc(fromleaf, prev)
+ mips) it is really awkward to have DEPRECATED_FRAME_CHAIN_VALID
+ called BEFORE DEPRECATED_INIT_EXTRA_FRAME_INFO (there is no good
+ way to get information deduced in DEPRECATED_FRAME_CHAIN_VALID
+ into the extra fields of the new frame). std_frame_pc(fromleaf,
+ prev)
This is the default setting for INIT_PREV_FRAME. It just does
what the default DEPRECATED_INIT_FRAME_PC does. Some machines
@@ -1083,21 +1579,24 @@ legacy_get_prev_frame (struct frame_info *next_frame)
inner most and any other case.
Since there is always a frame to unwind from, there is always
- somewhere (NEXT_FRAME) to store all the info needed to construct
+ somewhere (THIS_FRAME) to store all the info needed to construct
a new (previous) frame without having to first create it. This
means that the convolution below - needing to carefully order a
frame's initialization - isn't needed.
- The irony here though, is that FRAME_CHAIN(), at least for a more
- up-to-date architecture, always calls FRAME_SAVED_PC(), and
- FRAME_SAVED_PC() computes the PC but without first needing the
- frame! Instead of the convolution below, we could have simply
- called FRAME_SAVED_PC() and been done with it! Note that
- FRAME_SAVED_PC() is being superseed by frame_pc_unwind() and that
- function does have somewhere to cache that PC value. */
+ The irony here though, is that DEPRECATED_FRAME_CHAIN(), at least
+ for a more up-to-date architecture, always calls
+ FRAME_SAVED_PC(), and FRAME_SAVED_PC() computes the PC but
+ without first needing the frame! Instead of the convolution
+ below, we could have simply called FRAME_SAVED_PC() and been done
+ with it! Note that FRAME_SAVED_PC() is being superseed by
+ frame_pc_unwind() and that function does have somewhere to cache
+ that PC value. */
if (DEPRECATED_INIT_FRAME_PC_FIRST_P ())
- prev->pc = (DEPRECATED_INIT_FRAME_PC_FIRST (fromleaf, prev));
+ deprecated_update_frame_pc_hack (prev,
+ DEPRECATED_INIT_FRAME_PC_FIRST (fromleaf,
+ prev));
if (DEPRECATED_INIT_EXTRA_FRAME_INFO_P ())
DEPRECATED_INIT_EXTRA_FRAME_INFO (fromleaf, prev);
@@ -1106,17 +1605,27 @@ legacy_get_prev_frame (struct frame_info *next_frame)
FRAME_SAVED_PC may use that queue to figure out its value (see
tm-sparc.h). We want the pc saved in the inferior frame. */
if (DEPRECATED_INIT_FRAME_PC_P ())
- prev->pc = DEPRECATED_INIT_FRAME_PC (fromleaf, prev);
+ deprecated_update_frame_pc_hack (prev,
+ DEPRECATED_INIT_FRAME_PC (fromleaf,
+ prev));
/* If ->frame and ->pc are unchanged, we are in the process of
getting ourselves into an infinite backtrace. Some architectures
- check this in FRAME_CHAIN or thereabouts, but it seems like there
- is no reason this can't be an architecture-independent check. */
- if (prev->frame == next_frame->frame
- && prev->pc == next_frame->pc)
+ check this in DEPRECATED_FRAME_CHAIN or thereabouts, but it seems
+ like there is no reason this can't be an architecture-independent
+ check. */
+ if (get_frame_base (prev) == get_frame_base (this_frame)
+ && get_frame_pc (prev) == get_frame_pc (this_frame))
{
- next_frame->prev = NULL;
+ this_frame->prev = NULL;
obstack_free (&frame_cache_obstack, prev);
+ if (frame_debug)
+ {
+ fprintf_unfiltered (gdb_stdlog, "-> ");
+ fprint_frame (gdb_stdlog, NULL);
+ fprintf_unfiltered (gdb_stdlog,
+ " // legacy this.id == prev.id }\n");
+ }
return NULL;
}
@@ -1124,7 +1633,25 @@ legacy_get_prev_frame (struct frame_info *next_frame)
(and probably other architectural information). The PC lets you
check things like the debug info at that point (dwarf2cfi?) and
use that to decide how the frame should be unwound. */
- prev->unwind = frame_unwind_find_by_pc (current_gdbarch, prev->pc);
+ prev->unwind = frame_unwind_find_by_pc (current_gdbarch,
+ get_frame_pc (prev));
+
+ /* If the unwinder provides a frame type, use it. Otherwize
+ continue on to that heuristic mess. */
+ if (prev->unwind->type != UNKNOWN_FRAME)
+ {
+ prev->type = prev->unwind->type;
+ if (prev->type == NORMAL_FRAME)
+ prev->this_id.value.code_addr
+ = get_pc_function_start (prev->this_id.value.code_addr);
+ if (frame_debug)
+ {
+ fprintf_unfiltered (gdb_stdlog, "-> ");
+ fprint_frame (gdb_stdlog, prev);
+ fprintf_unfiltered (gdb_stdlog, " } // legacy with unwound type\n");
+ }
+ return prev;
+ }
/* NOTE: cagney/2002-11-18: The code segments, found in
create_new_frame and get_prev_frame(), that initializes the
@@ -1136,8 +1663,8 @@ legacy_get_prev_frame (struct frame_info *next_frame)
before the INIT function has been called. */
if (DEPRECATED_USE_GENERIC_DUMMY_FRAMES
&& (DEPRECATED_PC_IN_CALL_DUMMY_P ()
- ? DEPRECATED_PC_IN_CALL_DUMMY (prev->pc, 0, 0)
- : pc_in_dummy_frame (prev->pc)))
+ ? DEPRECATED_PC_IN_CALL_DUMMY (get_frame_pc (prev), 0, 0)
+ : pc_in_dummy_frame (get_frame_pc (prev))))
prev->type = DUMMY_FRAME;
else
{
@@ -1148,8 +1675,8 @@ legacy_get_prev_frame (struct frame_info *next_frame)
Unforunatly, its the INIT code that sets the PC (Hmm, catch
22). */
char *name;
- find_pc_partial_function (prev->pc, &name, NULL, NULL);
- if (PC_IN_SIGTRAMP (prev->pc, name))
+ find_pc_partial_function (get_frame_pc (prev), &name, NULL, NULL);
+ if (PC_IN_SIGTRAMP (get_frame_pc (prev), name))
prev->type = SIGTRAMP_FRAME;
/* FIXME: cagney/2002-11-11: Leave prev->type alone. Some
architectures are forcing the frame's type in INIT so we
@@ -1159,18 +1686,39 @@ legacy_get_prev_frame (struct frame_info *next_frame)
go away. */
}
+ if (prev->type == NORMAL_FRAME)
+ prev->this_id.value.code_addr
+ = get_pc_function_start (prev->this_id.value.code_addr);
+
+ if (frame_debug)
+ {
+ fprintf_unfiltered (gdb_stdlog, "-> ");
+ fprint_frame (gdb_stdlog, prev);
+ fprintf_unfiltered (gdb_stdlog, " } // legacy with confused type\n");
+ }
+
return prev;
}
/* Return a structure containing various interesting information
- about the frame that called NEXT_FRAME. Returns NULL
+ about the frame that called THIS_FRAME. Returns NULL
if there is no such frame. */
struct frame_info *
-get_prev_frame (struct frame_info *next_frame)
+get_prev_frame (struct frame_info *this_frame)
{
struct frame_info *prev_frame;
+ if (frame_debug)
+ {
+ fprintf_unfiltered (gdb_stdlog, "{ get_prev_frame (this_frame=");
+ if (this_frame != NULL)
+ fprintf_unfiltered (gdb_stdlog, "%d", this_frame->level);
+ else
+ fprintf_unfiltered (gdb_stdlog, "<NULL>");
+ fprintf_unfiltered (gdb_stdlog, ") ");
+ }
+
/* Return the inner-most frame, when the caller passes in NULL. */
/* NOTE: cagney/2002-11-09: Not sure how this would happen. The
caller should have previously obtained a valid frame using
@@ -1189,7 +1737,7 @@ get_prev_frame (struct frame_info *next_frame)
that a frame isn't possible, rather than checking that the target
has state and then calling get_current_frame() and
get_prev_frame(). This is a guess mind. */
- if (next_frame == NULL)
+ if (this_frame == NULL)
{
/* NOTE: cagney/2002-11-09: There was a code segment here that
would error out when CURRENT_FRAME was NULL. The comment
@@ -1202,34 +1750,42 @@ get_prev_frame (struct frame_info *next_frame)
thing to do.''
Per the above, this code shouldn't even be called with a NULL
- NEXT_FRAME. */
+ THIS_FRAME. */
return current_frame;
}
/* There is always a frame. If this assertion fails, suspect that
something should be calling get_selected_frame() or
get_current_frame(). */
- gdb_assert (next_frame != NULL);
+ gdb_assert (this_frame != NULL);
- if (next_frame->level >= 0
+ if (this_frame->level >= 0
&& !backtrace_below_main
- && inside_main_func (get_frame_pc (next_frame)))
+ && inside_main_func (get_frame_pc (this_frame)))
/* Don't unwind past main(), bug always unwind the sentinel frame.
Note, this is done _before_ the frame has been marked as
previously unwound. That way if the user later decides to
allow unwinds past main(), that just happens. */
{
if (frame_debug)
- fprintf_unfiltered (gdb_stdlog,
- "Outermost frame - inside main func.\n");
+ fprintf_unfiltered (gdb_stdlog, "-> NULL // inside main func }\n");
return NULL;
}
/* Only try to do the unwind once. */
- if (next_frame->prev_p)
- return next_frame->prev;
- next_frame->prev_p = 1;
+ if (this_frame->prev_p)
+ {
+ if (frame_debug)
+ {
+ fprintf_unfiltered (gdb_stdlog, "-> ");
+ fprint_frame (gdb_stdlog, this_frame->prev);
+ fprintf_unfiltered (gdb_stdlog, " // cached \n");
+ }
+ return this_frame->prev;
+ }
+ this_frame->prev_p = 1;
+#if 0
/* If we're inside the entry file, it isn't valid. Don't apply this
test to a dummy frame - dummy frame PC's typically land in the
entry file. Don't apply this test to the sentinel frame.
@@ -1241,14 +1797,27 @@ get_prev_frame (struct frame_info *next_frame)
/* NOTE: cagney/2003-01-10: If there is a way of disabling this test
then it should probably be moved to before the ->prev_p test,
above. */
- if (next_frame->type != DUMMY_FRAME && next_frame->level >= 0
- && inside_entry_file (get_frame_pc (next_frame)))
+ /* NOTE: vinschen/2003-04-01: Disabled. It turns out that the call to
+ inside_entry_file destroys a meaningful backtrace under some
+ conditions. E. g. the backtrace tests in the asm-source testcase
+ are broken for some targets. In this test the functions are all
+ implemented as part of one file and the testcase is not necessarily
+ linked with a start file (depending on the target). What happens is,
+ that the first frame is printed normaly and following frames are
+ treated as being inside the enttry file then. This way, only the
+ #0 frame is printed in the backtrace output. */
+ if (this_frame->type != DUMMY_FRAME && this_frame->level >= 0
+ && inside_entry_file (get_frame_pc (this_frame)))
{
if (frame_debug)
- fprintf_unfiltered (gdb_stdlog,
- "Outermost frame - inside entry file\n");
+ {
+ fprintf_unfiltered (gdb_stdlog, "-> ");
+ fprint_frame (gdb_stdlog, NULL);
+ fprintf_unfiltered (gdb_stdlog, " // inside entry file }\n");
+ }
return NULL;
}
+#endif
/* If we're already inside the entry function for the main objfile,
then it isn't valid. Don't apply this test to a dummy frame -
@@ -1258,32 +1827,61 @@ get_prev_frame (struct frame_info *next_frame)
/* NOTE: cagney/2003-02-25: Don't enable until someone has found
hard evidence that this is needed. */
if (0
- && next_frame->type != DUMMY_FRAME && next_frame->level >= 0
- && inside_entry_func (get_frame_pc (next_frame)))
+ && this_frame->type != DUMMY_FRAME && this_frame->level >= 0
+ && inside_entry_func (get_frame_pc (this_frame)))
{
if (frame_debug)
- fprintf_unfiltered (gdb_stdlog,
- "Outermost frame - inside entry func\n");
+ {
+ fprintf_unfiltered (gdb_stdlog, "-> ");
+ fprint_frame (gdb_stdlog, NULL);
+ fprintf_unfiltered (gdb_stdlog, "// inside entry func }\n");
+ }
return NULL;
}
/* If any of the old frame initialization methods are around, use
- the legacy get_prev_frame method. Just don't try to unwind a
- sentinel frame using that method - it doesn't work. All sentinal
- frames use the new unwind code. */
- if ((DEPRECATED_INIT_FRAME_PC_P ()
- || DEPRECATED_INIT_FRAME_PC_FIRST_P ()
- || DEPRECATED_INIT_EXTRA_FRAME_INFO_P ()
- || FRAME_CHAIN_P ())
- && next_frame->level >= 0)
+ the legacy get_prev_frame method. */
+ if (legacy_frame_p (current_gdbarch))
{
- prev_frame = legacy_get_prev_frame (next_frame);
- if (frame_debug && prev_frame == NULL)
- fprintf_unfiltered (gdb_stdlog,
- "Outermost frame - legacy_get_prev_frame NULL.\n");
+ prev_frame = legacy_get_prev_frame (this_frame);
return prev_frame;
}
+ /* Check that this frame's ID was valid. If it wasn't, don't try to
+ unwind to the prev frame. Be careful to not apply this test to
+ the sentinel frame. */
+ if (this_frame->level >= 0 && !frame_id_p (get_frame_id (this_frame)))
+ {
+ if (frame_debug)
+ {
+ fprintf_unfiltered (gdb_stdlog, "-> ");
+ fprint_frame (gdb_stdlog, NULL);
+ fprintf_unfiltered (gdb_stdlog, " // this ID is NULL }\n");
+ }
+ return NULL;
+ }
+
+ /* Check that this frame's ID isn't inner to (younger, below, next)
+ the next frame. This happens when frame unwind goes backwards.
+ Since the sentinel frame isn't valid, don't apply this if this
+ frame is entier the inner-most or sentinel frame. */
+ if (this_frame->level > 0
+ && frame_id_inner (get_frame_id (this_frame),
+ get_frame_id (this_frame->next)))
+ error ("This frame inner-to next frame (corrupt stack?)");
+
+ /* Check that this and the next frame are different. If they are
+ not, there is most likely a stack cycle. As with the inner-than
+ test, avoid the inner-most and sentinel frames. */
+ /* FIXME: cagney/2003-03-17: Can't yet enable this this check. The
+ frame_id_eq() method doesn't yet use function addresses when
+ comparing frame IDs. */
+ if (0
+ && this_frame->level > 0
+ && frame_id_eq (get_frame_id (this_frame),
+ get_frame_id (this_frame->next)))
+ error ("This frame identical to next frame (corrupt stack?)");
+
/* Allocate the new frame but do not wire it in to the frame chain.
Some (bad) code in INIT_FRAME_EXTRA_INFO tries to look along
frame->next to pull some fancy tricks (of course such code is, by
@@ -1295,7 +1893,7 @@ get_prev_frame (struct frame_info *next_frame)
been here before' check above will stop repeated memory
allocation calls. */
prev_frame = FRAME_OBSTACK_ZALLOC (struct frame_info);
- prev_frame->level = next_frame->level + 1;
+ prev_frame->level = this_frame->level + 1;
/* Try to unwind the PC. If that doesn't work, assume we've reached
the oldest frame and simply return. Is there a better sentinal
@@ -1304,88 +1902,58 @@ get_prev_frame (struct frame_info *next_frame)
Note that the pc-unwind is intentionally performed before the
frame chain. This is ok since, for old targets, both
- frame_pc_unwind (nee, FRAME_SAVED_PC) and FRAME_CHAIN()) assume
- NEXT_FRAME's data structures have already been initialized (using
+ frame_pc_unwind (nee, FRAME_SAVED_PC) and
+ DEPRECATED_FRAME_CHAIN()) assume THIS_FRAME's data structures
+ have already been initialized (using
DEPRECATED_INIT_EXTRA_FRAME_INFO) and hence the call order
doesn't matter.
By unwinding the PC first, it becomes possible to, in the case of
a dummy frame, avoid also unwinding the frame ID. This is
because (well ignoring the PPC) a dummy frame can be located
- using NEXT_FRAME's frame ID. */
+ using THIS_FRAME's frame ID. */
- prev_frame->pc = frame_pc_unwind (next_frame);
- if (prev_frame->pc == 0)
+ if (frame_pc_unwind (this_frame) == 0)
{
/* The allocated PREV_FRAME will be reclaimed when the frame
obstack is next purged. */
if (frame_debug)
- fprintf_unfiltered (gdb_stdlog,
- "Outermost frame - unwound PC zero\n");
- return NULL;
- }
- prev_frame->type = frame_type_from_pc (prev_frame->pc);
-
- /* Set the unwind functions based on that identified PC. */
- prev_frame->unwind = frame_unwind_find_by_pc (current_gdbarch,
- prev_frame->pc);
-
- /* FIXME: cagney/2003-01-13: A dummy frame doesn't need to unwind
- the frame ID because the frame ID comes from the previous frame.
- The other frames do though. True? */
- /* FIXME: cagney/2003-03-04: The below call isn't right. It should
- instead be doing something like "prev_frame -> unwind -> id
- (next_frame, & prev_frame -> unwind_cache, & prev_frame -> id)"
- but that requires more extensive (pending) changes. */
- next_frame->unwind->id (next_frame, &next_frame->unwind_cache,
- &prev_frame->id);
- /* Check that the unwound ID is valid. As of 2003-02-24 the x86-64
- was returning an invalid frame ID when trying to do an unwind a
- sentinel frame that belonged to a frame dummy. */
- if (!frame_id_p (prev_frame->id))
- {
- if (frame_debug)
- fprintf_unfiltered (gdb_stdlog,
- "Outermost frame - unwound frame ID invalid\n");
+ {
+ fprintf_unfiltered (gdb_stdlog, "-> ");
+ fprint_frame (gdb_stdlog, NULL);
+ fprintf_unfiltered (gdb_stdlog, " // unwound PC zero }\n");
+ }
return NULL;
}
- /* Check that the new frame isn't inner to (younger, below, next)
- the old frame. If that happens the frame unwind is going
- backwards. */
- /* FIXME: cagney/2003-02-25: Ignore the sentinel frame since that
- doesn't have a valid frame ID. Should instead set the sentinel
- frame's frame ID to a `sentinel'. Leave it until after the
- switch to storing the frame ID, instead of the frame base, in the
- frame object. */
- if (next_frame->level >= 0
- && frame_id_inner (prev_frame->id, get_frame_id (next_frame)))
- error ("Unwound frame inner-to selected frame (corrupt stack?)");
- /* Note that, due to frameless functions, the stronger test of the
- new frame being outer to the old frame can't be used - frameless
- functions differ by only their PC value. */
-
- /* FIXME: cagney/2002-12-18: Instead of this hack, should only store
- the frame ID in PREV_FRAME. Unfortunatly, some architectures
- (HP/UX) still reply on EXTRA_FRAME_INFO and, hence, still poke at
- the "struct frame_info" object directly. */
- prev_frame->frame = prev_frame->id.base;
+
+ /* Don't yet compute ->unwind (and hence ->type). It is computed
+ on-demand in get_frame_type, frame_register_unwind, and
+ get_frame_id. */
+
+ /* Don't yet compute the frame's ID. It is computed on-demand by
+ get_frame_id(). */
+
+ /* The unwound frame ID is validate at the start of this function,
+ as part of the logic to decide if that frame should be further
+ unwound, and not here while the prev frame is being created.
+ Doing this makes it possible for the user to examine a frame that
+ has an invalid frame ID.
+
+ The very old VAX frame_args_address_correct() method noted: [...]
+ For the sake of argument, suppose that the stack is somewhat
+ trashed (which is one reason that "info frame" exists). So,
+ return 0 (indicating we don't know the address of the arglist) if
+ we don't know what frame this frame calls. */
/* Link it in. */
- next_frame->prev = prev_frame;
- prev_frame->next = next_frame;
-
- /* FIXME: cagney/2002-01-19: This call will go away. Instead of
- initializing extra info, all frames will use the frame_cache
- (passed to the unwind functions) to store additional frame info.
- Unfortunatly legacy targets can't use legacy_get_prev_frame() to
- unwind the sentinel frame and, consequently, are forced to take
- this code path and rely on the below call to
- DEPRECATED_INIT_EXTRA_FRAME_INFO to initialize the inner-most
- frame. */
- if (DEPRECATED_INIT_EXTRA_FRAME_INFO_P ())
+ this_frame->prev = prev_frame;
+ prev_frame->next = this_frame;
+
+ if (frame_debug)
{
- gdb_assert (prev_frame->level == 0);
- DEPRECATED_INIT_EXTRA_FRAME_INFO (0, prev_frame);
+ fprintf_unfiltered (gdb_stdlog, "-> ");
+ fprint_frame (gdb_stdlog, prev_frame);
+ fprintf_unfiltered (gdb_stdlog, " }\n");
}
return prev_frame;
@@ -1394,7 +1962,8 @@ get_prev_frame (struct frame_info *next_frame)
CORE_ADDR
get_frame_pc (struct frame_info *frame)
{
- return frame->pc;
+ gdb_assert (frame->next != NULL);
+ return frame_pc_unwind (frame->next);
}
static int
@@ -1417,7 +1986,7 @@ pc_notcurrent (struct frame_info *frame)
void
find_frame_sal (struct frame_info *frame, struct symtab_and_line *sal)
{
- (*sal) = find_pc_line (frame->pc, pc_notcurrent (frame));
+ (*sal) = find_pc_line (get_frame_pc (frame), pc_notcurrent (frame));
}
/* Per "frame.h", return the ``address'' of the frame. Code should
@@ -1425,7 +1994,59 @@ find_frame_sal (struct frame_info *frame, struct symtab_and_line *sal)
CORE_ADDR
get_frame_base (struct frame_info *fi)
{
- return fi->frame;
+ return get_frame_id (fi).stack_addr;
+}
+
+/* High-level offsets into the frame. Used by the debug info. */
+
+CORE_ADDR
+get_frame_base_address (struct frame_info *fi)
+{
+ if (get_frame_type (fi) != NORMAL_FRAME)
+ return 0;
+ if (fi->base == NULL)
+ fi->base = frame_base_find_by_pc (current_gdbarch, get_frame_pc (fi));
+ /* Sneaky: If the low-level unwind and high-level base code share a
+ common unwinder, let them share the prologue cache. */
+ if (fi->base->unwind == fi->unwind)
+ return fi->base->this_base (fi->next, &fi->prologue_cache);
+ return fi->base->this_base (fi->next, &fi->base_cache);
+}
+
+CORE_ADDR
+get_frame_locals_address (struct frame_info *fi)
+{
+ void **cache;
+ if (get_frame_type (fi) != NORMAL_FRAME)
+ return 0;
+ /* If there isn't a frame address method, find it. */
+ if (fi->base == NULL)
+ fi->base = frame_base_find_by_pc (current_gdbarch, get_frame_pc (fi));
+ /* Sneaky: If the low-level unwind and high-level base code share a
+ common unwinder, let them share the prologue cache. */
+ if (fi->base->unwind == fi->unwind)
+ cache = &fi->prologue_cache;
+ else
+ cache = &fi->base_cache;
+ return fi->base->this_locals (fi->next, cache);
+}
+
+CORE_ADDR
+get_frame_args_address (struct frame_info *fi)
+{
+ void **cache;
+ if (get_frame_type (fi) != NORMAL_FRAME)
+ return 0;
+ /* If there isn't a frame address method, find it. */
+ if (fi->base == NULL)
+ fi->base = frame_base_find_by_pc (current_gdbarch, get_frame_pc (fi));
+ /* Sneaky: If the low-level unwind and high-level base code share a
+ common unwinder, let them share the prologue cache. */
+ if (fi->base->unwind == fi->unwind)
+ cache = &fi->prologue_cache;
+ else
+ cache = &fi->base_cache;
+ return fi->base->this_args (fi->next, cache);
}
/* Level of the selected frame: 0 for innermost, 1 for its caller, ...
@@ -1448,7 +2069,24 @@ get_frame_type (struct frame_info *frame)
if (!DEPRECATED_USE_GENERIC_DUMMY_FRAMES
&& deprecated_frame_in_dummy (frame))
return DUMMY_FRAME;
- return frame->type;
+ if (frame->unwind == NULL)
+ {
+ /* Initialize the frame's unwinder because it is that which
+ provides the frame's type. */
+ frame->unwind = frame_unwind_find_by_pc (current_gdbarch,
+ get_frame_pc (frame));
+ /* FIXME: cagney/2003-04-02: Rather than storing the frame's
+ type in the frame, the unwinder's type should be returned
+ directly. Unfortunatly, legacy code, called by
+ legacy_get_prev_frame, explicitly set the frames type using
+ the method deprecated_set_frame_type(). */
+ gdb_assert (frame->unwind->type != UNKNOWN_FRAME);
+ frame->type = frame->unwind->type;
+ }
+ if (frame->type == UNKNOWN_FRAME)
+ return NORMAL_FRAME;
+ else
+ return frame->type;
}
void
@@ -1458,34 +2096,6 @@ deprecated_set_frame_type (struct frame_info *frame, enum frame_type type)
frame->type = type;
}
-#ifdef FRAME_FIND_SAVED_REGS
-/* XXX - deprecated. This is a compatibility function for targets
- that do not yet implement DEPRECATED_FRAME_INIT_SAVED_REGS. */
-/* Find the addresses in which registers are saved in FRAME. */
-
-void
-deprecated_get_frame_saved_regs (struct frame_info *frame,
- struct frame_saved_regs *saved_regs_addr)
-{
- if (frame->saved_regs == NULL)
- {
- frame->saved_regs = (CORE_ADDR *)
- frame_obstack_zalloc (SIZEOF_FRAME_SAVED_REGS);
- }
- if (saved_regs_addr == NULL)
- {
- struct frame_saved_regs saved_regs;
- FRAME_FIND_SAVED_REGS (frame, saved_regs);
- memcpy (frame->saved_regs, &saved_regs, SIZEOF_FRAME_SAVED_REGS);
- }
- else
- {
- FRAME_FIND_SAVED_REGS (frame, *saved_regs_addr);
- memcpy (frame->saved_regs, saved_regs_addr, SIZEOF_FRAME_SAVED_REGS);
- }
-}
-#endif
-
struct frame_extra_info *
get_frame_extra_info (struct frame_info *fi)
{
@@ -1502,21 +2112,33 @@ frame_extra_info_zalloc (struct frame_info *fi, long size)
void
deprecated_update_frame_pc_hack (struct frame_info *frame, CORE_ADDR pc)
{
- /* See comment in "frame.h". */
- frame->pc = pc;
- /* While we're at it, update this frame's cached PC value, found in
- the next frame. Oh, for the day when "struct frame_info" is
- opaque and this hack on hack can go. */
- gdb_assert (frame->next != NULL);
- frame->next->pc_unwind_cache = pc;
- frame->next->pc_unwind_cache_p = 1;
+ if (frame_debug)
+ fprintf_unfiltered (gdb_stdlog,
+ "{ deprecated_update_frame_pc_hack (frame=%d,pc=0x%s) }\n",
+ frame->level, paddr_nz (pc));
+ /* NOTE: cagney/2003-03-11: Some architectures (e.g., Arm) are
+ maintaining a locally allocated frame object. Since such frame's
+ are not in the frame chain, it isn't possible to assume that the
+ frame has a next. Sigh. */
+ if (frame->next != NULL)
+ {
+ /* While we're at it, update this frame's cached PC value, found
+ in the next frame. Oh for the day when "struct frame_info"
+ is opaque and this hack on hack can just go away. */
+ frame->next->prev_pc.value = pc;
+ frame->next->prev_pc.p = 1;
+ }
}
void
deprecated_update_frame_base_hack (struct frame_info *frame, CORE_ADDR base)
{
+ if (frame_debug)
+ fprintf_unfiltered (gdb_stdlog,
+ "{ deprecated_update_frame_base_hack (frame=%d,base=0x%s) }\n",
+ frame->level, paddr_nz (base));
/* See comment in "frame.h". */
- frame->frame = base;
+ frame->this_id.value.stack_addr = base;
}
void
@@ -1563,8 +2185,8 @@ deprecated_set_frame_context (struct frame_info *fi,
struct frame_info *
deprecated_frame_xmalloc (void)
{
- struct frame_info *frame = XMALLOC (struct frame_info);
- memset (frame, 0, sizeof (struct frame_info));
+ struct frame_info *frame = FRAME_OBSTACK_ZALLOC (struct frame_info);
+ frame->this_id.p = 1;
return frame;
}
@@ -1587,6 +2209,17 @@ deprecated_frame_xmalloc_with_cleanup (long sizeof_saved_regs,
return frame;
}
+int
+legacy_frame_p (struct gdbarch *current_gdbarch)
+{
+ return (DEPRECATED_INIT_FRAME_PC_P ()
+ || DEPRECATED_INIT_FRAME_PC_FIRST_P ()
+ || DEPRECATED_INIT_EXTRA_FRAME_INFO_P ()
+ || DEPRECATED_FRAME_CHAIN_P ()
+ || !gdbarch_unwind_dummy_id_p (current_gdbarch)
+ || !SAVE_DUMMY_FRAME_TOS_P ());
+}
+
void
_initialize_frame (void)
{
diff --git a/gdb/frame.h b/gdb/frame.h
index 77db6ba..a39f1ad 100644
--- a/gdb/frame.h
+++ b/gdb/frame.h
@@ -25,10 +25,13 @@
struct symtab_and_line;
struct frame_unwind;
+struct frame_base;
struct block;
+struct gdbarch;
-/* The traditional frame unwinder. */
-extern const struct frame_unwind *trad_frame_unwind;
+/* A legacy unwinder to prop up architectures using the old style
+ saved regs array. */
+extern const struct frame_unwind *legacy_saved_regs_unwind;
/* The frame object. */
@@ -41,15 +44,24 @@ struct frame_info;
struct frame_id
{
- /* The frame's address. This should be constant through out the
- lifetime of a frame. */
+ /* The frame's stack address. This shall be constant through out
+ the lifetime of a frame. Note that this requirement applies to
+ not just the function body, but also the prologue and (in theory
+ at least) the epilogue. Since that value needs to fall either on
+ the boundary, or within the frame's address range, the frame's
+ outer-most address (the inner-most address of the previous frame)
+ is used. Watch out for all the legacy targets that still use the
+ function pointer register or stack pointer register. They are
+ wrong. */
/* NOTE: cagney/2002-11-16: The ia64 has two stacks and hence two
frame bases. This will need to be expanded to accomodate that. */
- CORE_ADDR base;
- /* The frame's current PC. While the PC within the function may
- change, the function that contains the PC does not. Should this
- instead be the frame's function? */
- CORE_ADDR pc;
+ CORE_ADDR stack_addr;
+ /* The frame's code address. This shall be constant through out the
+ lifetime of the frame. While the PC (a.k.a. resume address)
+ changes as the function is executed, this code address cannot.
+ Typically, it is set to the address of the entry point of the
+ frame's function (as returned by frame_func_unwind(). */
+ CORE_ADDR code_addr;
};
/* Methods for constructing and comparing Frame IDs.
@@ -63,12 +75,12 @@ struct frame_id
/* For convenience. All fields are zero. */
extern const struct frame_id null_frame_id;
-/* Construct a frame ID. The second parameter isn't yet well defined.
- It might be the containing function, or the resume PC (see comment
- above in `struct frame_id')? A func/pc of zero indicates a
- wildcard (i.e., do not use func in frame ID comparisons). */
-extern struct frame_id frame_id_build (CORE_ADDR base,
- CORE_ADDR func_or_pc);
+/* Construct a frame ID. The first parameter is the frame's constant
+ stack address (typically the outer-bound), and the second the
+ frame's constant code address (typically the entry point) (or zero,
+ to indicate a wild card). */
+extern struct frame_id frame_id_build (CORE_ADDR stack_addr,
+ CORE_ADDR code_addr);
/* Returns non-zero when L is a valid frame (a valid frame has a
non-zero .base). */
@@ -144,9 +156,17 @@ extern struct frame_info *frame_find_by_id (struct frame_id id);
/* Base attributes of a frame: */
/* The frame's `resume' address. Where the program will resume in
- this frame. */
+ this frame.
+
+ This replaced: frame->pc; */
extern CORE_ADDR get_frame_pc (struct frame_info *);
+/* Following on from the `resume' address. Return the entry point
+ address of the function containing that resume address, or zero if
+ that function isn't known. */
+extern CORE_ADDR frame_func_unwind (struct frame_info *fi);
+extern CORE_ADDR get_frame_func (struct frame_info *fi);
+
/* Closely related to the resume address, various symbol table
attributes that are determined by the PC. Note that for a normal
frame, the PC refers to the resume address after the return, and
@@ -168,47 +188,27 @@ extern CORE_ADDR get_frame_pc (struct frame_info *);
extern void find_frame_sal (struct frame_info *frame,
struct symtab_and_line *sal);
-/* Return the frame address from FI. Except in the machine-dependent
- *FRAME* macros, a frame address has no defined meaning other than
- as a magic cookie which identifies a frame over calls to the
- inferior (um, SEE NOTE BELOW). The only known exception is
- inferior.h (DEPRECATED_PC_IN_CALL_DUMMY) [ON_STACK]; see comments
- there. You cannot assume that a frame address contains enough
- information to reconstruct the frame; if you want more than just to
- identify the frame (e.g. be able to fetch variables relative to
- that frame), then save the whole struct frame_info (and the next
- struct frame_info, since the latter is used for fetching variables
- on some machines) (um, again SEE NOTE BELOW).
-
- NOTE: cagney/2002-11-18: Actually, the frame address isn't
- sufficient for identifying a frame, and the counter examples are
- wrong!
-
- Code that needs to (re)identify a frame must use get_frame_id() and
- frame_find_by_id() (and in the future, a frame_compare() function
- instead of INNER_THAN()). Two reasons: an architecture (e.g.,
- ia64) can have more than one frame address (due to multiple stack
- pointers) (frame ID is going to be expanded to accomodate this);
- successive frameless function calls can only be differientated by
- comparing both the frame's base and the frame's enclosing function
- (frame_find_by_id() is going to be modified to perform this test).
-
- The generic dummy frame version of DEPRECATED_PC_IN_CALL_DUMMY() is
- able to identify a dummy frame using only the PC value. So the
- frame address is not needed. In fact, most
- DEPRECATED_PC_IN_CALL_DUMMY() calls now pass zero as the frame/sp
- values as the caller knows that those values won't be used. Once
- all architectures are using generic dummy frames,
- DEPRECATED_PC_IN_CALL_DUMMY() can drop the sp/frame parameters.
- When it comes to finding a dummy frame, the next frame's frame ID
- (with out duing an unwind) can be used (ok, could if it wasn't for
- the need to change the way the PPC defined frame base in a strange
- way).
-
- Modern architectures should be using something like dwarf2's
- location expression to describe where a variable lives. Such
- expressions specify their own debug info centric frame address.
- Consequently, a generic frame address is pretty meaningless. */
+/* Return the frame base (what ever that is) (DEPRECATED).
+
+ Old code was trying to use this single method for two conflicting
+ purposes. Such code needs to be updated to use either of:
+
+ get_frame_id: A low level frame unique identifier, that consists of
+ both a stack and a function address, that can be used to uniquely
+ identify a frame. This value is determined by the frame's
+ low-level unwinder, the stack part [typically] being the
+ top-of-stack of the previous frame, and the function part being the
+ function's start address. Since the correct identification of a
+ frameless function requires both the a stack and function address,
+ the old get_frame_base method was not sufficient.
+
+ get_frame_base_address: get_frame_locals_address:
+ get_frame_args_address: A set of high-level debug-info dependant
+ addresses that fall within the frame. These addresses almost
+ certainly will not match the stack address part of a frame ID (as
+ returned by get_frame_base).
+
+ This replaced: frame->frame; */
extern CORE_ADDR get_frame_base (struct frame_info *);
@@ -217,6 +217,25 @@ extern CORE_ADDR get_frame_base (struct frame_info *);
FI is NULL, return the null_frame_id. */
extern struct frame_id get_frame_id (struct frame_info *fi);
+/* Assuming that a frame is `normal', return its base-address, or 0 if
+ the information isn't available. NOTE: This address is really only
+ meaningful to the frame's high-level debug info. */
+extern CORE_ADDR get_frame_base_address (struct frame_info *);
+
+/* Assuming that a frame is `normal', return the base-address of the
+ local variables, or 0 if the information isn't available. NOTE:
+ This address is really only meaningful to the frame's high-level
+ debug info. Typically, the argument and locals share a single
+ base-address. */
+extern CORE_ADDR get_frame_locals_address (struct frame_info *);
+
+/* Assuming that a frame is `normal', return the base-address of the
+ parameter list, or 0 if that information isn't available. NOTE:
+ This address is really only meaningful to the frame's high-level
+ debug info. Typically, the argument and locals share a single
+ base-address. */
+extern CORE_ADDR get_frame_args_address (struct frame_info *);
+
/* The frame's level: 0 for innermost, 1 for its caller, ...; or -1
for an invalid frame). */
extern int frame_relative_level (struct frame_info *fi);
@@ -226,6 +245,11 @@ extern int frame_relative_level (struct frame_info *fi);
enum frame_type
{
+ /* The frame's type hasn't yet been defined. This is a catch-all
+ for legacy code that uses really strange technicques, such as
+ deprecated_set_frame_type, to set the frame's type. New code
+ should not use this value. */
+ UNKNOWN_FRAME,
/* A true stack frame, created by the target program during normal
execution. */
NORMAL_FRAME,
@@ -314,111 +338,6 @@ extern CORE_ADDR frame_pc_unwind (struct frame_info *frame);
of the caller. */
extern void frame_pop (struct frame_info *frame);
-/* Describe the saved registers of a frame. */
-
-#if defined (EXTRA_FRAME_INFO) || defined (FRAME_FIND_SAVED_REGS)
-/* XXXX - deprecated */
-struct frame_saved_regs
- {
- /* For each register R (except the SP), regs[R] is the address at
- which it was saved on entry to the frame, or zero if it was not
- saved on entry to this frame. This includes special registers
- such as pc and fp saved in special ways in the stack frame.
-
- regs[SP_REGNUM] is different. It holds the actual SP, not the
- address at which it was saved. */
-
- CORE_ADDR regs[NUM_REGS];
- };
-#endif
-
-/* We keep a cache of stack frames, each of which is a "struct
- frame_info". The innermost one gets allocated (in
- wait_for_inferior) each time the inferior stops; current_frame
- points to it. Additional frames get allocated (in
- get_prev_frame) as needed, and are chained through the next
- and prev fields. Any time that the frame cache becomes invalid
- (most notably when we execute something, but also if we change how
- we interpret the frames (e.g. "set heuristic-fence-post" in
- mips-tdep.c, or anything which reads new symbols)), we should call
- reinit_frame_cache. */
-
-struct frame_info
- {
- /* Nominal address of the frame described. See comments at
- get_frame_base() about what this means outside the *FRAME*
- macros; in the *FRAME* macros, it can mean whatever makes most
- sense for this machine. */
- CORE_ADDR frame;
-
- /* Address at which execution is occurring in this frame.
- For the innermost frame, it's the current pc.
- For other frames, it is a pc saved in the next frame. */
- CORE_ADDR pc;
-
- /* Level of this frame. The inner-most (youngest) frame is at
- level 0. As you move towards the outer-most (oldest) frame,
- the level increases. This is a cached value. It could just as
- easily be computed by counting back from the selected frame to
- the inner most frame. */
- /* NOTE: cagney/2002-04-05: Perhaphs a level of ``-1'' should be
- reserved to indicate a bogus frame - one that has been created
- just to keep GDB happy (GDB always needs a frame). For the
- moment leave this as speculation. */
- int level;
-
- /* The frame's type. */
- enum frame_type type;
-
- /* For each register, address of where it was saved on entry to
- the frame, or zero if it was not saved on entry to this frame.
- This includes special registers such as pc and fp saved in
- special ways in the stack frame. The SP_REGNUM is even more
- special, the address here is the sp for the previous frame, not
- the address where the sp was saved. */
- /* Allocated by frame_saved_regs_zalloc () which is called /
- initialized by DEPRECATED_FRAME_INIT_SAVED_REGS(). */
- CORE_ADDR *saved_regs; /*NUM_REGS + NUM_PSEUDO_REGS*/
-
-#ifdef EXTRA_FRAME_INFO
- /* XXXX - deprecated */
- /* Anything extra for this structure that may have been defined
- in the machine dependent files. */
- EXTRA_FRAME_INFO
-#endif
-
- /* Anything extra for this structure that may have been defined
- in the machine dependent files. */
- /* Allocated by frame_extra_info_zalloc () which is called /
- initialized by DEPRECATED_INIT_EXTRA_FRAME_INFO */
- struct frame_extra_info *extra_info;
-
- /* If dwarf2 unwind frame informations is used, this structure holds all
- related unwind data. */
- struct context *context;
-
- /* Unwind cache shared between the unwind functions - they had
- better all agree as to the contents. */
- void *unwind_cache;
-
- /* The frame's unwinder. */
- const struct frame_unwind *unwind;
-
- /* Cached copy of the previous frame's resume address. */
- int pc_unwind_cache_p;
- CORE_ADDR pc_unwind_cache;
-
- /* This frame's ID. Note that the frame's ID, base and PC contain
- redundant information. */
- struct frame_id id;
-
- /* Pointers to the next (down, inner, younger) and previous (up,
- outer, older) frame_info's in the frame cache. */
- struct frame_info *next; /* down, inner, younger */
- int prev_p;
- struct frame_info *prev; /* up, outer, older */
- };
-
/* Values for the source flag to be used in print_frame_info_base(). */
enum print_what
{
@@ -451,21 +370,17 @@ enum print_what
extern void *frame_obstack_zalloc (unsigned long size);
#define FRAME_OBSTACK_ZALLOC(TYPE) ((TYPE *) frame_obstack_zalloc (sizeof (TYPE)))
-/* If FRAME_CHAIN_VALID returns zero it means that the given frame
- is the outermost one and has no caller. */
+/* If legacy_frame_chain_valid() returns zero it means that the given
+ frame is the outermost one and has no caller.
-extern int frame_chain_valid (CORE_ADDR, struct frame_info *);
+ This method has been superseeded by the per-architecture
+ frame_unwind_pc() (returns 0 to indicate an invalid return address)
+ and per-frame this_id() (returns a NULL frame ID to indicate an
+ invalid frame). */
+extern int legacy_frame_chain_valid (CORE_ADDR, struct frame_info *);
extern void generic_save_dummy_frame_tos (CORE_ADDR sp);
-
-#ifdef FRAME_FIND_SAVED_REGS
-/* XXX - deprecated */
-#define DEPRECATED_FRAME_INIT_SAVED_REGS(FI) deprecated_get_frame_saved_regs (FI, NULL)
-extern void deprecated_get_frame_saved_regs (struct frame_info *,
- struct frame_saved_regs *);
-#endif
-
extern struct block *get_frame_block (struct frame_info *,
CORE_ADDR *addr_in_block);
@@ -538,14 +453,10 @@ extern int generic_pc_in_call_dummy (CORE_ADDR pc,
/* NOTE: cagney/2002-06-26: Targets should no longer use this
function. Instead, the contents of a dummy frames registers can be
obtained by applying: frame_register_unwind to the dummy frame; or
- get_saved_register to the next outer frame. */
+ frame_register_unwind() to the next outer frame. */
extern char *deprecated_generic_find_dummy_frame (CORE_ADDR pc, CORE_ADDR fp);
-extern void generic_fix_call_dummy (char *dummy, CORE_ADDR pc, CORE_ADDR fun,
- int nargs, struct value **args,
- struct type *type, int gcc_p);
-
void generic_unwind_get_saved_register (char *raw_buffer,
int *optimizedp,
CORE_ADDR *addrp,
@@ -554,21 +465,17 @@ void generic_unwind_get_saved_register (char *raw_buffer,
enum lval_type *lvalp);
/* The function generic_get_saved_register() has been made obsolete.
- GET_SAVED_REGISTER now defaults to the recursive equivalent -
- generic_unwind_get_saved_register() - so there is no need to even
- set GET_SAVED_REGISTER. Architectures that need to override the
- register unwind mechanism should modify frame->unwind(). */
+ DEPRECATED_GET_SAVED_REGISTER now defaults to the recursive
+ equivalent - generic_unwind_get_saved_register() - so there is no
+ need to even set DEPRECATED_GET_SAVED_REGISTER. Architectures that
+ need to override the register unwind mechanism should modify
+ frame->unwind(). */
extern void deprecated_generic_get_saved_register (char *, int *, CORE_ADDR *,
struct frame_info *, int,
enum lval_type *);
extern void generic_save_call_dummy_addr (CORE_ADDR lo, CORE_ADDR hi);
-extern void get_saved_register (char *raw_buffer, int *optimized,
- CORE_ADDR * addrp,
- struct frame_info *frame,
- int regnum, enum lval_type *lval);
-
/* FIXME: cagney/2003-02-02: Should be deprecated or replaced with a
function called frame_read_register_p(). This slightly weird (and
older) variant of frame_read_register() returns zero (indicating
@@ -641,7 +548,9 @@ extern CORE_ADDR *get_frame_saved_regs (struct frame_info *);
/* FIXME: cagney/2002-12-06: Has the PC in the current frame changed?
"infrun.c", Thanks to DECR_PC_AFTER_BREAK, can change the PC after
- the initial frame create. This puts things back in sync. */
+ the initial frame create. This puts things back in sync.
+
+ This replaced: frame->pc = ....; */
extern void deprecated_update_frame_pc_hack (struct frame_info *frame,
CORE_ADDR pc);
@@ -649,7 +558,9 @@ extern void deprecated_update_frame_pc_hack (struct frame_info *frame,
more exact, whas that initial guess at the frame's base as returned
by read_fp() wrong. If it was, fix it. This shouldn't be
necessary since the code should be getting the frame's base correct
- from the outset. */
+ from the outset.
+
+ This replaced: frame->frame = ....; */
extern void deprecated_update_frame_base_hack (struct frame_info *frame,
CORE_ADDR base);
@@ -701,4 +612,8 @@ extern struct context *deprecated_get_frame_context (struct frame_info *fi);
extern void deprecated_set_frame_context (struct frame_info *fi,
struct context *context);
+/* Return non-zero if the architecture is relying on legacy frame
+ code. */
+extern int legacy_frame_p (struct gdbarch *gdbarch);
+
#endif /* !defined (FRAME_H) */
diff --git a/gdb/frv-tdep.c b/gdb/frv-tdep.c
index d279707..bab3776 100644
--- a/gdb/frv-tdep.c
+++ b/gdb/frv-tdep.c
@@ -35,18 +35,13 @@ static gdbarch_register_virtual_size_ftype frv_register_virtual_size;
static gdbarch_register_virtual_type_ftype frv_register_virtual_type;
static gdbarch_register_byte_ftype frv_register_byte;
static gdbarch_breakpoint_from_pc_ftype frv_breakpoint_from_pc;
-static gdbarch_frame_chain_ftype frv_frame_chain;
-static gdbarch_frame_saved_pc_ftype frv_frame_saved_pc;
static gdbarch_skip_prologue_ftype frv_skip_prologue;
static gdbarch_deprecated_extract_return_value_ftype frv_extract_return_value;
static gdbarch_deprecated_extract_struct_value_address_ftype frv_extract_struct_value_address;
static gdbarch_use_struct_convention_ftype frv_use_struct_convention;
static gdbarch_frameless_function_invocation_ftype frv_frameless_function_invocation;
static gdbarch_init_extra_frame_info_ftype stupid_useless_init_extra_frame_info;
-static gdbarch_store_struct_return_ftype frv_store_struct_return;
static gdbarch_push_arguments_ftype frv_push_arguments;
-static gdbarch_push_return_address_ftype frv_push_return_address;
-static gdbarch_pop_frame_ftype frv_pop_frame;
static gdbarch_saved_pc_after_call_ftype frv_saved_pc_after_call;
static void frv_pop_frame_regular (struct frame_info *frame);
@@ -1078,30 +1073,27 @@ frv_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_frame_args_skip (gdbarch, 0);
set_gdbarch_frameless_function_invocation (gdbarch, frv_frameless_function_invocation);
- set_gdbarch_saved_pc_after_call (gdbarch, frv_saved_pc_after_call);
+ set_gdbarch_deprecated_saved_pc_after_call (gdbarch, frv_saved_pc_after_call);
- set_gdbarch_frame_chain (gdbarch, frv_frame_chain);
- set_gdbarch_frame_saved_pc (gdbarch, frv_frame_saved_pc);
+ set_gdbarch_deprecated_frame_chain (gdbarch, frv_frame_chain);
+ set_gdbarch_deprecated_frame_saved_pc (gdbarch, frv_frame_saved_pc);
set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, frv_frame_init_saved_regs);
set_gdbarch_use_struct_convention (gdbarch, frv_use_struct_convention);
set_gdbarch_deprecated_extract_return_value (gdbarch, frv_extract_return_value);
- set_gdbarch_store_struct_return (gdbarch, frv_store_struct_return);
+ set_gdbarch_deprecated_store_struct_return (gdbarch, frv_store_struct_return);
set_gdbarch_deprecated_store_return_value (gdbarch, frv_store_return_value);
set_gdbarch_deprecated_extract_struct_value_address (gdbarch, frv_extract_struct_value_address);
/* Settings for calling functions in the inferior. */
- set_gdbarch_call_dummy_length (gdbarch, 0);
- set_gdbarch_push_arguments (gdbarch, frv_push_arguments);
- set_gdbarch_push_return_address (gdbarch, frv_push_return_address);
- set_gdbarch_pop_frame (gdbarch, frv_pop_frame);
+ set_gdbarch_deprecated_push_arguments (gdbarch, frv_push_arguments);
+ set_gdbarch_deprecated_push_return_address (gdbarch, frv_push_return_address);
+ set_gdbarch_deprecated_pop_frame (gdbarch, frv_pop_frame);
- set_gdbarch_call_dummy_p (gdbarch, 1);
set_gdbarch_call_dummy_words (gdbarch, frv_call_dummy_words);
set_gdbarch_sizeof_call_dummy_words (gdbarch, sizeof (frv_call_dummy_words));
- set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 1);
set_gdbarch_deprecated_init_extra_frame_info (gdbarch, frv_init_extra_frame_info);
/* Settings that should be unnecessary. */
@@ -1111,14 +1103,9 @@ frv_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_write_pc (gdbarch, generic_target_write_pc);
set_gdbarch_read_fp (gdbarch, generic_target_read_fp);
set_gdbarch_read_sp (gdbarch, generic_target_read_sp);
- set_gdbarch_write_sp (gdbarch, generic_target_write_sp);
+ set_gdbarch_deprecated_dummy_write_sp (gdbarch, generic_target_write_sp);
- set_gdbarch_call_dummy_address (gdbarch, entry_point_address);
- set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 0);
- set_gdbarch_call_dummy_start_offset (gdbarch, 0);
set_gdbarch_deprecated_pc_in_call_dummy (gdbarch, deprecated_pc_in_call_dummy_at_entry_point);
- set_gdbarch_call_dummy_stack_adjust_p (gdbarch, 0);
- set_gdbarch_fix_call_dummy (gdbarch, generic_fix_call_dummy);
set_gdbarch_decr_pc_after_break (gdbarch, 0);
set_gdbarch_function_start_offset (gdbarch, 0);
diff --git a/gdb/gdb.h b/gdb/gdb.h
index 737ac82..6a2eaa0 100644
--- a/gdb/gdb.h
+++ b/gdb/gdb.h
@@ -22,6 +22,8 @@
#ifndef GDB_H
#define GDB_H
+struct ui_out;
+
/* Return-code (RC) from a gdb library call. (The abreviation RC is
taken from the sim/common directory.) */
diff --git a/gdb/gdb_indent.sh b/gdb/gdb_indent.sh
index ee0d0fb..555098c 100755
--- a/gdb/gdb_indent.sh
+++ b/gdb/gdb_indent.sh
@@ -73,8 +73,8 @@ esac
types="\
-T FILE \
--T bfd -T asection \
--T prgregset_t -T fpregset_t -T gregset_t \
+-T bfd -T asection -T pid_t \
+-T prgregset_t -T fpregset_t -T gregset_t -T sigset_t \
`cat *.h | sed -n \
-e 's/^.*[^a-z0-9_]\([a-z0-9_]*_ftype\).*$/-T \1/p' \
-e 's/^.*[^a-z0-9_]\([a-z0-9_]*_func\).*$/-T \1/p' \
diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c
index 68247d6..3b5a807 100644
--- a/gdb/gdbarch.c
+++ b/gdb/gdbarch.c
@@ -66,6 +66,7 @@
#include "gdb-events.h"
#include "reggroups.h"
#include "osabi.h"
+#include "symfile.h" /* For entry_point_address. */
/* Static function declarations */
@@ -148,7 +149,7 @@ struct gdbarch
gdbarch_write_pc_ftype *write_pc;
gdbarch_read_fp_ftype *read_fp;
gdbarch_read_sp_ftype *read_sp;
- gdbarch_write_sp_ftype *write_sp;
+ gdbarch_deprecated_dummy_write_sp_ftype *deprecated_dummy_write_sp;
gdbarch_virtual_frame_pointer_ftype *virtual_frame_pointer;
gdbarch_pseudo_register_read_ftype *pseudo_register_read;
gdbarch_pseudo_register_write_ftype *pseudo_register_write;
@@ -189,20 +190,17 @@ struct gdbarch
gdbarch_call_dummy_address_ftype *call_dummy_address;
CORE_ADDR call_dummy_start_offset;
CORE_ADDR call_dummy_breakpoint_offset;
- int call_dummy_breakpoint_offset_p;
int call_dummy_length;
gdbarch_deprecated_pc_in_call_dummy_ftype *deprecated_pc_in_call_dummy;
- int call_dummy_p;
LONGEST * call_dummy_words;
int sizeof_call_dummy_words;
- int call_dummy_stack_adjust_p;
- int call_dummy_stack_adjust;
+ int deprecated_call_dummy_stack_adjust;
gdbarch_fix_call_dummy_ftype *fix_call_dummy;
gdbarch_deprecated_init_frame_pc_first_ftype *deprecated_init_frame_pc_first;
gdbarch_deprecated_init_frame_pc_ftype *deprecated_init_frame_pc;
int believe_pcc_promotion;
int believe_pcc_promotion_type;
- gdbarch_get_saved_register_ftype *get_saved_register;
+ gdbarch_deprecated_get_saved_register_ftype *deprecated_get_saved_register;
gdbarch_register_convertible_ftype *register_convertible;
gdbarch_register_convert_to_virtual_ftype *register_convert_to_virtual;
gdbarch_register_convert_to_raw_ftype *register_convert_to_raw;
@@ -213,11 +211,12 @@ struct gdbarch
gdbarch_address_to_pointer_ftype *address_to_pointer;
gdbarch_integer_to_address_ftype *integer_to_address;
gdbarch_return_value_on_stack_ftype *return_value_on_stack;
- gdbarch_push_arguments_ftype *push_arguments;
+ gdbarch_deprecated_push_arguments_ftype *deprecated_push_arguments;
+ gdbarch_push_dummy_call_ftype *push_dummy_call;
gdbarch_deprecated_push_dummy_frame_ftype *deprecated_push_dummy_frame;
- gdbarch_push_return_address_ftype *push_return_address;
- gdbarch_pop_frame_ftype *pop_frame;
- gdbarch_store_struct_return_ftype *store_struct_return;
+ gdbarch_deprecated_push_return_address_ftype *deprecated_push_return_address;
+ gdbarch_deprecated_pop_frame_ftype *deprecated_pop_frame;
+ gdbarch_deprecated_store_struct_return_ftype *deprecated_store_struct_return;
gdbarch_extract_return_value_ftype *extract_return_value;
gdbarch_store_return_value_ftype *store_return_value;
gdbarch_deprecated_extract_return_value_ftype *deprecated_extract_return_value;
@@ -239,18 +238,20 @@ struct gdbarch
gdbarch_remote_translate_xfer_address_ftype *remote_translate_xfer_address;
CORE_ADDR frame_args_skip;
gdbarch_frameless_function_invocation_ftype *frameless_function_invocation;
- gdbarch_frame_chain_ftype *frame_chain;
- gdbarch_frame_chain_valid_ftype *frame_chain_valid;
- gdbarch_frame_saved_pc_ftype *frame_saved_pc;
+ gdbarch_deprecated_frame_chain_ftype *deprecated_frame_chain;
+ gdbarch_deprecated_frame_chain_valid_ftype *deprecated_frame_chain_valid;
+ gdbarch_deprecated_frame_saved_pc_ftype *deprecated_frame_saved_pc;
+ gdbarch_unwind_pc_ftype *unwind_pc;
gdbarch_frame_args_address_ftype *frame_args_address;
gdbarch_frame_locals_address_ftype *frame_locals_address;
- gdbarch_saved_pc_after_call_ftype *saved_pc_after_call;
+ gdbarch_deprecated_saved_pc_after_call_ftype *deprecated_saved_pc_after_call;
gdbarch_frame_num_args_ftype *frame_num_args;
gdbarch_stack_align_ftype *stack_align;
gdbarch_frame_align_ftype *frame_align;
- int extra_stack_alignment_needed;
+ int deprecated_extra_stack_alignment_needed;
gdbarch_reg_struct_has_addr_ftype *reg_struct_has_addr;
gdbarch_save_dummy_frame_tos_ftype *save_dummy_frame_tos;
+ gdbarch_unwind_dummy_id_ftype *unwind_dummy_id;
int parm_boundary;
const struct floatformat * float_format;
const struct floatformat * double_format;
@@ -355,7 +356,6 @@ struct gdbarch startup_gdbarch =
0,
0,
0,
- 0,
generic_pc_in_call_dummy,
0,
0,
@@ -431,6 +431,7 @@ struct gdbarch startup_gdbarch =
0,
0,
0,
+ 0,
generic_in_function_epilogue_p,
construct_inferior_arguments,
0,
@@ -500,7 +501,6 @@ gdbarch_alloc (const struct gdbarch_info *info,
current_gdbarch->write_pc = generic_target_write_pc;
current_gdbarch->read_fp = generic_target_read_fp;
current_gdbarch->read_sp = generic_target_read_sp;
- current_gdbarch->write_sp = generic_target_write_sp;
current_gdbarch->virtual_frame_pointer = legacy_virtual_frame_pointer;
current_gdbarch->num_regs = -1;
current_gdbarch->sp_regnum = -1;
@@ -526,15 +526,10 @@ gdbarch_alloc (const struct gdbarch_info *info,
current_gdbarch->cannot_store_register = cannot_register_not;
current_gdbarch->deprecated_use_generic_dummy_frames = 1;
current_gdbarch->call_dummy_location = AT_ENTRY_POINT;
- current_gdbarch->call_dummy_start_offset = -1;
- current_gdbarch->call_dummy_breakpoint_offset = -1;
- current_gdbarch->call_dummy_breakpoint_offset_p = -1;
- current_gdbarch->call_dummy_length = -1;
+ current_gdbarch->call_dummy_address = entry_point_address;
current_gdbarch->deprecated_pc_in_call_dummy = generic_pc_in_call_dummy;
- current_gdbarch->call_dummy_p = -1;
current_gdbarch->call_dummy_words = legacy_call_dummy_words;
current_gdbarch->sizeof_call_dummy_words = legacy_sizeof_call_dummy_words;
- current_gdbarch->call_dummy_stack_adjust_p = -1;
current_gdbarch->register_convertible = generic_register_convertible_not;
current_gdbarch->convert_register_p = legacy_convert_register_p;
current_gdbarch->register_to_value = legacy_register_to_value;
@@ -542,7 +537,6 @@ gdbarch_alloc (const struct gdbarch_info *info,
current_gdbarch->pointer_to_address = unsigned_pointer_to_address;
current_gdbarch->address_to_pointer = unsigned_address_to_pointer;
current_gdbarch->return_value_on_stack = generic_return_value_on_stack_not;
- current_gdbarch->push_arguments = default_push_arguments;
current_gdbarch->extract_return_value = legacy_extract_return_value;
current_gdbarch->store_return_value = legacy_store_return_value;
current_gdbarch->use_struct_convention = generic_use_struct_convention;
@@ -558,7 +552,6 @@ gdbarch_alloc (const struct gdbarch_info *info,
current_gdbarch->frameless_function_invocation = generic_frameless_function_invocation_not;
current_gdbarch->frame_args_address = get_frame_base;
current_gdbarch->frame_locals_address = get_frame_base;
- current_gdbarch->extra_stack_alignment_needed = 1;
current_gdbarch->convert_from_func_ptr_addr = core_addr_identity;
current_gdbarch->addr_bits_remove = core_addr_identity;
current_gdbarch->smash_text_address = core_addr_identity;
@@ -631,7 +624,7 @@ verify_gdbarch (struct gdbarch *gdbarch)
/* Skip verify of write_pc, invalid_p == 0 */
/* Skip verify of read_fp, invalid_p == 0 */
/* Skip verify of read_sp, invalid_p == 0 */
- /* Skip verify of write_sp, invalid_p == 0 */
+ /* Skip verify of deprecated_dummy_write_sp, has predicate */
/* Skip verify of virtual_frame_pointer, invalid_p == 0 */
/* Skip verify of pseudo_register_read, has predicate */
/* Skip verify of pseudo_register_write, has predicate */
@@ -675,39 +668,15 @@ verify_gdbarch (struct gdbarch *gdbarch)
/* Skip verify of get_longjmp_target, has predicate */
/* Skip verify of deprecated_use_generic_dummy_frames, invalid_p == 0 */
/* Skip verify of call_dummy_location, invalid_p == 0 */
- if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL)
- && (gdbarch->call_dummy_location == AT_ENTRY_POINT && gdbarch->call_dummy_address == 0))
- fprintf_unfiltered (log, "\n\tcall_dummy_address");
- if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL)
- && (gdbarch->call_dummy_start_offset == -1))
- fprintf_unfiltered (log, "\n\tcall_dummy_start_offset");
- if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL)
- && (gdbarch->call_dummy_breakpoint_offset_p && gdbarch->call_dummy_breakpoint_offset == -1))
- fprintf_unfiltered (log, "\n\tcall_dummy_breakpoint_offset");
- if ((GDB_MULTI_ARCH >= GDB_MULTI_ARCH_PARTIAL)
- && (gdbarch->call_dummy_breakpoint_offset_p == -1))
- fprintf_unfiltered (log, "\n\tcall_dummy_breakpoint_offset_p");
- if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL)
- && (gdbarch->call_dummy_length == -1))
- fprintf_unfiltered (log, "\n\tcall_dummy_length");
+ /* Skip verify of call_dummy_address, invalid_p == 0 */
/* Skip verify of deprecated_pc_in_call_dummy, has predicate */
- if ((GDB_MULTI_ARCH >= GDB_MULTI_ARCH_PARTIAL)
- && (gdbarch->call_dummy_p == -1))
- fprintf_unfiltered (log, "\n\tcall_dummy_p");
/* Skip verify of call_dummy_words, invalid_p == 0 */
/* Skip verify of sizeof_call_dummy_words, invalid_p == 0 */
- if ((GDB_MULTI_ARCH >= GDB_MULTI_ARCH_PARTIAL)
- && (gdbarch->call_dummy_stack_adjust_p == -1))
- fprintf_unfiltered (log, "\n\tcall_dummy_stack_adjust_p");
- if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL)
- && (gdbarch->call_dummy_stack_adjust_p && gdbarch->call_dummy_stack_adjust == 0))
- fprintf_unfiltered (log, "\n\tcall_dummy_stack_adjust");
- if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL)
- && (gdbarch->fix_call_dummy == 0))
- fprintf_unfiltered (log, "\n\tfix_call_dummy");
+ /* Skip verify of deprecated_call_dummy_stack_adjust, has predicate */
+ /* Skip verify of fix_call_dummy, has predicate */
/* Skip verify of deprecated_init_frame_pc_first, has predicate */
/* Skip verify of deprecated_init_frame_pc, has predicate */
- /* Skip verify of get_saved_register, has predicate */
+ /* Skip verify of deprecated_get_saved_register, has predicate */
/* Skip verify of register_convertible, invalid_p == 0 */
/* Skip verify of register_convert_to_virtual, invalid_p == 0 */
/* Skip verify of register_convert_to_raw, invalid_p == 0 */
@@ -718,13 +687,12 @@ verify_gdbarch (struct gdbarch *gdbarch)
/* Skip verify of address_to_pointer, invalid_p == 0 */
/* Skip verify of integer_to_address, has predicate */
/* Skip verify of return_value_on_stack, invalid_p == 0 */
- /* Skip verify of push_arguments, invalid_p == 0 */
+ /* Skip verify of deprecated_push_arguments, has predicate */
+ /* Skip verify of push_dummy_call, has predicate */
/* Skip verify of deprecated_push_dummy_frame, has predicate */
- /* Skip verify of push_return_address, has predicate */
- /* Skip verify of pop_frame, has predicate */
- if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL)
- && (gdbarch->store_struct_return == 0))
- fprintf_unfiltered (log, "\n\tstore_struct_return");
+ /* Skip verify of deprecated_push_return_address, has predicate */
+ /* Skip verify of deprecated_pop_frame, has predicate */
+ /* Skip verify of deprecated_store_struct_return, has predicate */
/* Skip verify of extract_return_value, invalid_p == 0 */
/* Skip verify of store_return_value, invalid_p == 0 */
/* Skip verify of extract_struct_value_address, has predicate */
@@ -754,22 +722,22 @@ verify_gdbarch (struct gdbarch *gdbarch)
&& (gdbarch->frame_args_skip == -1))
fprintf_unfiltered (log, "\n\tframe_args_skip");
/* Skip verify of frameless_function_invocation, invalid_p == 0 */
- /* Skip verify of frame_chain, has predicate */
- /* Skip verify of frame_chain_valid, has predicate */
- /* Skip verify of frame_saved_pc, has predicate */
+ /* Skip verify of deprecated_frame_chain, has predicate */
+ /* Skip verify of deprecated_frame_chain_valid, has predicate */
+ /* Skip verify of deprecated_frame_saved_pc, has predicate */
+ /* Skip verify of unwind_pc, has predicate */
/* Skip verify of frame_args_address, invalid_p == 0 */
/* Skip verify of frame_locals_address, invalid_p == 0 */
- if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL)
- && (gdbarch->saved_pc_after_call == 0))
- fprintf_unfiltered (log, "\n\tsaved_pc_after_call");
+ /* Skip verify of deprecated_saved_pc_after_call, has predicate */
if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL)
&& (gdbarch->frame_num_args == 0))
fprintf_unfiltered (log, "\n\tframe_num_args");
/* Skip verify of stack_align, has predicate */
/* Skip verify of frame_align, has predicate */
- /* Skip verify of extra_stack_alignment_needed, invalid_p == 0 */
+ /* Skip verify of deprecated_extra_stack_alignment_needed, invalid_p == 0 */
/* Skip verify of reg_struct_has_addr, has predicate */
/* Skip verify of save_dummy_frame_tos, has predicate */
+ /* Skip verify of unwind_dummy_id, has predicate */
if (gdbarch->float_format == 0)
gdbarch->float_format = default_float_format (gdbarch);
if (gdbarch->double_format == 0)
@@ -958,27 +926,17 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
fprintf_unfiltered (file,
"gdbarch_dump: CALL_DUMMY_BREAKPOINT_OFFSET # %s\n",
XSTRING (CALL_DUMMY_BREAKPOINT_OFFSET));
- if (CALL_DUMMY_BREAKPOINT_OFFSET_P)
- fprintf_unfiltered (file,
- "gdbarch_dump: CALL_DUMMY_BREAKPOINT_OFFSET = 0x%08lx\n",
- (long) CALL_DUMMY_BREAKPOINT_OFFSET);
-#endif
-#ifdef CALL_DUMMY_BREAKPOINT_OFFSET_P
- fprintf_unfiltered (file,
- "gdbarch_dump: CALL_DUMMY_BREAKPOINT_OFFSET_P # %s\n",
- XSTRING (CALL_DUMMY_BREAKPOINT_OFFSET_P));
fprintf_unfiltered (file,
- "gdbarch_dump: CALL_DUMMY_BREAKPOINT_OFFSET_P = %d\n",
- CALL_DUMMY_BREAKPOINT_OFFSET_P);
+ "gdbarch_dump: CALL_DUMMY_BREAKPOINT_OFFSET = %ld\n",
+ (long) CALL_DUMMY_BREAKPOINT_OFFSET);
#endif
#ifdef CALL_DUMMY_LENGTH
fprintf_unfiltered (file,
"gdbarch_dump: CALL_DUMMY_LENGTH # %s\n",
XSTRING (CALL_DUMMY_LENGTH));
- if (gdbarch->call_dummy_length >= 0)
- fprintf_unfiltered (file,
- "gdbarch_dump: CALL_DUMMY_LENGTH = %d\n",
- CALL_DUMMY_LENGTH);
+ fprintf_unfiltered (file,
+ "gdbarch_dump: CALL_DUMMY_LENGTH = %d\n",
+ CALL_DUMMY_LENGTH);
#endif
#ifdef CALL_DUMMY_LOCATION
fprintf_unfiltered (file,
@@ -988,37 +946,12 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
"gdbarch_dump: CALL_DUMMY_LOCATION = %d\n",
CALL_DUMMY_LOCATION);
#endif
-#ifdef CALL_DUMMY_P
- fprintf_unfiltered (file,
- "gdbarch_dump: CALL_DUMMY_P # %s\n",
- XSTRING (CALL_DUMMY_P));
- fprintf_unfiltered (file,
- "gdbarch_dump: CALL_DUMMY_P = %d\n",
- CALL_DUMMY_P);
-#endif
-#ifdef CALL_DUMMY_STACK_ADJUST
- fprintf_unfiltered (file,
- "gdbarch_dump: CALL_DUMMY_STACK_ADJUST # %s\n",
- XSTRING (CALL_DUMMY_STACK_ADJUST));
- if (CALL_DUMMY_STACK_ADJUST_P)
- fprintf_unfiltered (file,
- "gdbarch_dump: CALL_DUMMY_STACK_ADJUST = 0x%08lx\n",
- (long) CALL_DUMMY_STACK_ADJUST);
-#endif
-#ifdef CALL_DUMMY_STACK_ADJUST_P
- fprintf_unfiltered (file,
- "gdbarch_dump: CALL_DUMMY_STACK_ADJUST_P # %s\n",
- XSTRING (CALL_DUMMY_STACK_ADJUST_P));
- fprintf_unfiltered (file,
- "gdbarch_dump: CALL_DUMMY_STACK_ADJUST_P = 0x%08lx\n",
- (long) CALL_DUMMY_STACK_ADJUST_P);
-#endif
#ifdef CALL_DUMMY_START_OFFSET
fprintf_unfiltered (file,
"gdbarch_dump: CALL_DUMMY_START_OFFSET # %s\n",
XSTRING (CALL_DUMMY_START_OFFSET));
fprintf_unfiltered (file,
- "gdbarch_dump: CALL_DUMMY_START_OFFSET = 0x%08lx\n",
+ "gdbarch_dump: CALL_DUMMY_START_OFFSET = %ld\n",
(long) CALL_DUMMY_START_OFFSET);
#endif
#ifdef CALL_DUMMY_WORDS
@@ -1107,6 +1040,23 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
"gdbarch_dump: DECR_PC_AFTER_BREAK = %ld\n",
(long) DECR_PC_AFTER_BREAK);
#endif
+#ifdef DEPRECATED_CALL_DUMMY_STACK_ADJUST_P
+ fprintf_unfiltered (file,
+ "gdbarch_dump: %s # %s\n",
+ "DEPRECATED_CALL_DUMMY_STACK_ADJUST_P()",
+ XSTRING (DEPRECATED_CALL_DUMMY_STACK_ADJUST_P ()));
+ fprintf_unfiltered (file,
+ "gdbarch_dump: DEPRECATED_CALL_DUMMY_STACK_ADJUST_P() = %d\n",
+ DEPRECATED_CALL_DUMMY_STACK_ADJUST_P ());
+#endif
+#ifdef DEPRECATED_CALL_DUMMY_STACK_ADJUST
+ fprintf_unfiltered (file,
+ "gdbarch_dump: DEPRECATED_CALL_DUMMY_STACK_ADJUST # %s\n",
+ XSTRING (DEPRECATED_CALL_DUMMY_STACK_ADJUST));
+ fprintf_unfiltered (file,
+ "gdbarch_dump: DEPRECATED_CALL_DUMMY_STACK_ADJUST = %d\n",
+ DEPRECATED_CALL_DUMMY_STACK_ADJUST);
+#endif
#ifdef DEPRECATED_DO_REGISTERS_INFO_P
fprintf_unfiltered (file,
"gdbarch_dump: %s # %s\n",
@@ -1130,6 +1080,29 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
(long) current_gdbarch->deprecated_do_registers_info
/*DEPRECATED_DO_REGISTERS_INFO ()*/);
#endif
+#ifdef DEPRECATED_DUMMY_WRITE_SP_P
+ fprintf_unfiltered (file,
+ "gdbarch_dump: %s # %s\n",
+ "DEPRECATED_DUMMY_WRITE_SP_P()",
+ XSTRING (DEPRECATED_DUMMY_WRITE_SP_P ()));
+ fprintf_unfiltered (file,
+ "gdbarch_dump: DEPRECATED_DUMMY_WRITE_SP_P() = %d\n",
+ DEPRECATED_DUMMY_WRITE_SP_P ());
+#endif
+#ifdef DEPRECATED_DUMMY_WRITE_SP
+#if GDB_MULTI_ARCH
+ /* Macro might contain `[{}]' when not multi-arch */
+ fprintf_unfiltered (file,
+ "gdbarch_dump: %s # %s\n",
+ "DEPRECATED_DUMMY_WRITE_SP(val)",
+ XSTRING (DEPRECATED_DUMMY_WRITE_SP (val)));
+#endif
+ if (GDB_MULTI_ARCH)
+ fprintf_unfiltered (file,
+ "gdbarch_dump: DEPRECATED_DUMMY_WRITE_SP = <0x%08lx>\n",
+ (long) current_gdbarch->deprecated_dummy_write_sp
+ /*DEPRECATED_DUMMY_WRITE_SP ()*/);
+#endif
#ifdef DEPRECATED_EXTRACT_RETURN_VALUE
#if GDB_MULTI_ARCH
/* Macro might contain `[{}]' when not multi-arch */
@@ -1164,6 +1137,54 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
(long) current_gdbarch->deprecated_extract_struct_value_address
/*DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS ()*/);
#endif
+#ifdef DEPRECATED_EXTRA_STACK_ALIGNMENT_NEEDED
+ fprintf_unfiltered (file,
+ "gdbarch_dump: DEPRECATED_EXTRA_STACK_ALIGNMENT_NEEDED # %s\n",
+ XSTRING (DEPRECATED_EXTRA_STACK_ALIGNMENT_NEEDED));
+ fprintf_unfiltered (file,
+ "gdbarch_dump: DEPRECATED_EXTRA_STACK_ALIGNMENT_NEEDED = %d\n",
+ DEPRECATED_EXTRA_STACK_ALIGNMENT_NEEDED);
+#endif
+#ifdef DEPRECATED_FRAME_CHAIN_P
+ fprintf_unfiltered (file,
+ "gdbarch_dump: %s # %s\n",
+ "DEPRECATED_FRAME_CHAIN_P()",
+ XSTRING (DEPRECATED_FRAME_CHAIN_P ()));
+ fprintf_unfiltered (file,
+ "gdbarch_dump: DEPRECATED_FRAME_CHAIN_P() = %d\n",
+ DEPRECATED_FRAME_CHAIN_P ());
+#endif
+#ifdef DEPRECATED_FRAME_CHAIN
+ fprintf_unfiltered (file,
+ "gdbarch_dump: %s # %s\n",
+ "DEPRECATED_FRAME_CHAIN(frame)",
+ XSTRING (DEPRECATED_FRAME_CHAIN (frame)));
+ if (GDB_MULTI_ARCH)
+ fprintf_unfiltered (file,
+ "gdbarch_dump: DEPRECATED_FRAME_CHAIN = <0x%08lx>\n",
+ (long) current_gdbarch->deprecated_frame_chain
+ /*DEPRECATED_FRAME_CHAIN ()*/);
+#endif
+#ifdef DEPRECATED_FRAME_CHAIN_VALID_P
+ fprintf_unfiltered (file,
+ "gdbarch_dump: %s # %s\n",
+ "DEPRECATED_FRAME_CHAIN_VALID_P()",
+ XSTRING (DEPRECATED_FRAME_CHAIN_VALID_P ()));
+ fprintf_unfiltered (file,
+ "gdbarch_dump: DEPRECATED_FRAME_CHAIN_VALID_P() = %d\n",
+ DEPRECATED_FRAME_CHAIN_VALID_P ());
+#endif
+#ifdef DEPRECATED_FRAME_CHAIN_VALID
+ fprintf_unfiltered (file,
+ "gdbarch_dump: %s # %s\n",
+ "DEPRECATED_FRAME_CHAIN_VALID(chain, thisframe)",
+ XSTRING (DEPRECATED_FRAME_CHAIN_VALID (chain, thisframe)));
+ if (GDB_MULTI_ARCH)
+ fprintf_unfiltered (file,
+ "gdbarch_dump: DEPRECATED_FRAME_CHAIN_VALID = <0x%08lx>\n",
+ (long) current_gdbarch->deprecated_frame_chain_valid
+ /*DEPRECATED_FRAME_CHAIN_VALID ()*/);
+#endif
#ifdef DEPRECATED_FRAME_INIT_SAVED_REGS_P
fprintf_unfiltered (file,
"gdbarch_dump: %s # %s\n",
@@ -1187,6 +1208,49 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
(long) current_gdbarch->deprecated_frame_init_saved_regs
/*DEPRECATED_FRAME_INIT_SAVED_REGS ()*/);
#endif
+#ifdef DEPRECATED_FRAME_SAVED_PC_P
+ fprintf_unfiltered (file,
+ "gdbarch_dump: %s # %s\n",
+ "DEPRECATED_FRAME_SAVED_PC_P()",
+ XSTRING (DEPRECATED_FRAME_SAVED_PC_P ()));
+ fprintf_unfiltered (file,
+ "gdbarch_dump: DEPRECATED_FRAME_SAVED_PC_P() = %d\n",
+ DEPRECATED_FRAME_SAVED_PC_P ());
+#endif
+#ifdef DEPRECATED_FRAME_SAVED_PC
+ fprintf_unfiltered (file,
+ "gdbarch_dump: %s # %s\n",
+ "DEPRECATED_FRAME_SAVED_PC(fi)",
+ XSTRING (DEPRECATED_FRAME_SAVED_PC (fi)));
+ if (GDB_MULTI_ARCH)
+ fprintf_unfiltered (file,
+ "gdbarch_dump: DEPRECATED_FRAME_SAVED_PC = <0x%08lx>\n",
+ (long) current_gdbarch->deprecated_frame_saved_pc
+ /*DEPRECATED_FRAME_SAVED_PC ()*/);
+#endif
+#ifdef DEPRECATED_GET_SAVED_REGISTER_P
+ fprintf_unfiltered (file,
+ "gdbarch_dump: %s # %s\n",
+ "DEPRECATED_GET_SAVED_REGISTER_P()",
+ XSTRING (DEPRECATED_GET_SAVED_REGISTER_P ()));
+ fprintf_unfiltered (file,
+ "gdbarch_dump: DEPRECATED_GET_SAVED_REGISTER_P() = %d\n",
+ DEPRECATED_GET_SAVED_REGISTER_P ());
+#endif
+#ifdef DEPRECATED_GET_SAVED_REGISTER
+#if GDB_MULTI_ARCH
+ /* Macro might contain `[{}]' when not multi-arch */
+ fprintf_unfiltered (file,
+ "gdbarch_dump: %s # %s\n",
+ "DEPRECATED_GET_SAVED_REGISTER(raw_buffer, optimized, addrp, frame, regnum, lval)",
+ XSTRING (DEPRECATED_GET_SAVED_REGISTER (raw_buffer, optimized, addrp, frame, regnum, lval)));
+#endif
+ if (GDB_MULTI_ARCH)
+ fprintf_unfiltered (file,
+ "gdbarch_dump: DEPRECATED_GET_SAVED_REGISTER = <0x%08lx>\n",
+ (long) current_gdbarch->deprecated_get_saved_register
+ /*DEPRECATED_GET_SAVED_REGISTER ()*/);
+#endif
#ifdef DEPRECATED_INIT_EXTRA_FRAME_INFO_P
fprintf_unfiltered (file,
"gdbarch_dump: %s # %s\n",
@@ -1304,6 +1368,49 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
(long) current_gdbarch->deprecated_pc_in_call_dummy
/*DEPRECATED_PC_IN_CALL_DUMMY ()*/);
#endif
+#ifdef DEPRECATED_POP_FRAME_P
+ fprintf_unfiltered (file,
+ "gdbarch_dump: %s # %s\n",
+ "DEPRECATED_POP_FRAME_P()",
+ XSTRING (DEPRECATED_POP_FRAME_P ()));
+ fprintf_unfiltered (file,
+ "gdbarch_dump: DEPRECATED_POP_FRAME_P() = %d\n",
+ DEPRECATED_POP_FRAME_P ());
+#endif
+#ifdef DEPRECATED_POP_FRAME
+#if GDB_MULTI_ARCH
+ /* Macro might contain `[{}]' when not multi-arch */
+ fprintf_unfiltered (file,
+ "gdbarch_dump: %s # %s\n",
+ "DEPRECATED_POP_FRAME(-)",
+ XSTRING (DEPRECATED_POP_FRAME (-)));
+#endif
+ if (GDB_MULTI_ARCH)
+ fprintf_unfiltered (file,
+ "gdbarch_dump: DEPRECATED_POP_FRAME = <0x%08lx>\n",
+ (long) current_gdbarch->deprecated_pop_frame
+ /*DEPRECATED_POP_FRAME ()*/);
+#endif
+#ifdef DEPRECATED_PUSH_ARGUMENTS_P
+ fprintf_unfiltered (file,
+ "gdbarch_dump: %s # %s\n",
+ "DEPRECATED_PUSH_ARGUMENTS_P()",
+ XSTRING (DEPRECATED_PUSH_ARGUMENTS_P ()));
+ fprintf_unfiltered (file,
+ "gdbarch_dump: DEPRECATED_PUSH_ARGUMENTS_P() = %d\n",
+ DEPRECATED_PUSH_ARGUMENTS_P ());
+#endif
+#ifdef DEPRECATED_PUSH_ARGUMENTS
+ fprintf_unfiltered (file,
+ "gdbarch_dump: %s # %s\n",
+ "DEPRECATED_PUSH_ARGUMENTS(nargs, args, sp, struct_return, struct_addr)",
+ XSTRING (DEPRECATED_PUSH_ARGUMENTS (nargs, args, sp, struct_return, struct_addr)));
+ if (GDB_MULTI_ARCH)
+ fprintf_unfiltered (file,
+ "gdbarch_dump: DEPRECATED_PUSH_ARGUMENTS = <0x%08lx>\n",
+ (long) current_gdbarch->deprecated_push_arguments
+ /*DEPRECATED_PUSH_ARGUMENTS ()*/);
+#endif
#ifdef DEPRECATED_PUSH_DUMMY_FRAME_P
fprintf_unfiltered (file,
"gdbarch_dump: %s # %s\n",
@@ -1327,6 +1434,46 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
(long) current_gdbarch->deprecated_push_dummy_frame
/*DEPRECATED_PUSH_DUMMY_FRAME ()*/);
#endif
+#ifdef DEPRECATED_PUSH_RETURN_ADDRESS_P
+ fprintf_unfiltered (file,
+ "gdbarch_dump: %s # %s\n",
+ "DEPRECATED_PUSH_RETURN_ADDRESS_P()",
+ XSTRING (DEPRECATED_PUSH_RETURN_ADDRESS_P ()));
+ fprintf_unfiltered (file,
+ "gdbarch_dump: DEPRECATED_PUSH_RETURN_ADDRESS_P() = %d\n",
+ DEPRECATED_PUSH_RETURN_ADDRESS_P ());
+#endif
+#ifdef DEPRECATED_PUSH_RETURN_ADDRESS
+ fprintf_unfiltered (file,
+ "gdbarch_dump: %s # %s\n",
+ "DEPRECATED_PUSH_RETURN_ADDRESS(pc, sp)",
+ XSTRING (DEPRECATED_PUSH_RETURN_ADDRESS (pc, sp)));
+ if (GDB_MULTI_ARCH)
+ fprintf_unfiltered (file,
+ "gdbarch_dump: DEPRECATED_PUSH_RETURN_ADDRESS = <0x%08lx>\n",
+ (long) current_gdbarch->deprecated_push_return_address
+ /*DEPRECATED_PUSH_RETURN_ADDRESS ()*/);
+#endif
+#ifdef DEPRECATED_SAVED_PC_AFTER_CALL_P
+ fprintf_unfiltered (file,
+ "gdbarch_dump: %s # %s\n",
+ "DEPRECATED_SAVED_PC_AFTER_CALL_P()",
+ XSTRING (DEPRECATED_SAVED_PC_AFTER_CALL_P ()));
+ fprintf_unfiltered (file,
+ "gdbarch_dump: DEPRECATED_SAVED_PC_AFTER_CALL_P() = %d\n",
+ DEPRECATED_SAVED_PC_AFTER_CALL_P ());
+#endif
+#ifdef DEPRECATED_SAVED_PC_AFTER_CALL
+ fprintf_unfiltered (file,
+ "gdbarch_dump: %s # %s\n",
+ "DEPRECATED_SAVED_PC_AFTER_CALL(frame)",
+ XSTRING (DEPRECATED_SAVED_PC_AFTER_CALL (frame)));
+ if (GDB_MULTI_ARCH)
+ fprintf_unfiltered (file,
+ "gdbarch_dump: DEPRECATED_SAVED_PC_AFTER_CALL = <0x%08lx>\n",
+ (long) current_gdbarch->deprecated_saved_pc_after_call
+ /*DEPRECATED_SAVED_PC_AFTER_CALL ()*/);
+#endif
#ifdef DEPRECATED_STORE_RETURN_VALUE
#if GDB_MULTI_ARCH
/* Macro might contain `[{}]' when not multi-arch */
@@ -1341,6 +1488,29 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
(long) current_gdbarch->deprecated_store_return_value
/*DEPRECATED_STORE_RETURN_VALUE ()*/);
#endif
+#ifdef DEPRECATED_STORE_STRUCT_RETURN_P
+ fprintf_unfiltered (file,
+ "gdbarch_dump: %s # %s\n",
+ "DEPRECATED_STORE_STRUCT_RETURN_P()",
+ XSTRING (DEPRECATED_STORE_STRUCT_RETURN_P ()));
+ fprintf_unfiltered (file,
+ "gdbarch_dump: DEPRECATED_STORE_STRUCT_RETURN_P() = %d\n",
+ DEPRECATED_STORE_STRUCT_RETURN_P ());
+#endif
+#ifdef DEPRECATED_STORE_STRUCT_RETURN
+#if GDB_MULTI_ARCH
+ /* Macro might contain `[{}]' when not multi-arch */
+ fprintf_unfiltered (file,
+ "gdbarch_dump: %s # %s\n",
+ "DEPRECATED_STORE_STRUCT_RETURN(addr, sp)",
+ XSTRING (DEPRECATED_STORE_STRUCT_RETURN (addr, sp)));
+#endif
+ if (GDB_MULTI_ARCH)
+ fprintf_unfiltered (file,
+ "gdbarch_dump: DEPRECATED_STORE_STRUCT_RETURN = <0x%08lx>\n",
+ (long) current_gdbarch->deprecated_store_struct_return
+ /*DEPRECATED_STORE_STRUCT_RETURN ()*/);
+#endif
#ifdef DEPRECATED_USE_GENERIC_DUMMY_FRAMES
fprintf_unfiltered (file,
"gdbarch_dump: DEPRECATED_USE_GENERIC_DUMMY_FRAMES # %s\n",
@@ -1453,13 +1623,14 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
(long) current_gdbarch->extract_struct_value_address
/*EXTRACT_STRUCT_VALUE_ADDRESS ()*/);
#endif
-#ifdef EXTRA_STACK_ALIGNMENT_NEEDED
+#ifdef FIX_CALL_DUMMY_P
fprintf_unfiltered (file,
- "gdbarch_dump: EXTRA_STACK_ALIGNMENT_NEEDED # %s\n",
- XSTRING (EXTRA_STACK_ALIGNMENT_NEEDED));
+ "gdbarch_dump: %s # %s\n",
+ "FIX_CALL_DUMMY_P()",
+ XSTRING (FIX_CALL_DUMMY_P ()));
fprintf_unfiltered (file,
- "gdbarch_dump: EXTRA_STACK_ALIGNMENT_NEEDED = %d\n",
- EXTRA_STACK_ALIGNMENT_NEEDED);
+ "gdbarch_dump: FIX_CALL_DUMMY_P() = %d\n",
+ FIX_CALL_DUMMY_P ());
#endif
#ifdef FIX_CALL_DUMMY
#if GDB_MULTI_ARCH
@@ -1521,46 +1692,6 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
"gdbarch_dump: FRAME_ARGS_SKIP = %ld\n",
(long) FRAME_ARGS_SKIP);
#endif
-#ifdef FRAME_CHAIN_P
- fprintf_unfiltered (file,
- "gdbarch_dump: %s # %s\n",
- "FRAME_CHAIN_P()",
- XSTRING (FRAME_CHAIN_P ()));
- fprintf_unfiltered (file,
- "gdbarch_dump: FRAME_CHAIN_P() = %d\n",
- FRAME_CHAIN_P ());
-#endif
-#ifdef FRAME_CHAIN
- fprintf_unfiltered (file,
- "gdbarch_dump: %s # %s\n",
- "FRAME_CHAIN(frame)",
- XSTRING (FRAME_CHAIN (frame)));
- if (GDB_MULTI_ARCH)
- fprintf_unfiltered (file,
- "gdbarch_dump: FRAME_CHAIN = <0x%08lx>\n",
- (long) current_gdbarch->frame_chain
- /*FRAME_CHAIN ()*/);
-#endif
-#ifdef FRAME_CHAIN_VALID_P
- fprintf_unfiltered (file,
- "gdbarch_dump: %s # %s\n",
- "FRAME_CHAIN_VALID_P()",
- XSTRING (FRAME_CHAIN_VALID_P ()));
- fprintf_unfiltered (file,
- "gdbarch_dump: FRAME_CHAIN_VALID_P() = %d\n",
- FRAME_CHAIN_VALID_P ());
-#endif
-#ifdef FRAME_CHAIN_VALID
- fprintf_unfiltered (file,
- "gdbarch_dump: %s # %s\n",
- "FRAME_CHAIN_VALID(chain, thisframe)",
- XSTRING (FRAME_CHAIN_VALID (chain, thisframe)));
- if (GDB_MULTI_ARCH)
- fprintf_unfiltered (file,
- "gdbarch_dump: FRAME_CHAIN_VALID = <0x%08lx>\n",
- (long) current_gdbarch->frame_chain_valid
- /*FRAME_CHAIN_VALID ()*/);
-#endif
#ifdef FRAME_LOCALS_ADDRESS
fprintf_unfiltered (file,
"gdbarch_dump: %s # %s\n",
@@ -1583,26 +1714,6 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
(long) current_gdbarch->frame_num_args
/*FRAME_NUM_ARGS ()*/);
#endif
-#ifdef FRAME_SAVED_PC_P
- fprintf_unfiltered (file,
- "gdbarch_dump: %s # %s\n",
- "FRAME_SAVED_PC_P()",
- XSTRING (FRAME_SAVED_PC_P ()));
- fprintf_unfiltered (file,
- "gdbarch_dump: FRAME_SAVED_PC_P() = %d\n",
- FRAME_SAVED_PC_P ());
-#endif
-#ifdef FRAME_SAVED_PC
- fprintf_unfiltered (file,
- "gdbarch_dump: %s # %s\n",
- "FRAME_SAVED_PC(fi)",
- XSTRING (FRAME_SAVED_PC (fi)));
- if (GDB_MULTI_ARCH)
- fprintf_unfiltered (file,
- "gdbarch_dump: FRAME_SAVED_PC = <0x%08lx>\n",
- (long) current_gdbarch->frame_saved_pc
- /*FRAME_SAVED_PC ()*/);
-#endif
#ifdef FUNCTION_START_OFFSET
fprintf_unfiltered (file,
"gdbarch_dump: FUNCTION_START_OFFSET # %s\n",
@@ -1631,29 +1742,6 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
(long) current_gdbarch->get_longjmp_target
/*GET_LONGJMP_TARGET ()*/);
#endif
-#ifdef GET_SAVED_REGISTER_P
- fprintf_unfiltered (file,
- "gdbarch_dump: %s # %s\n",
- "GET_SAVED_REGISTER_P()",
- XSTRING (GET_SAVED_REGISTER_P ()));
- fprintf_unfiltered (file,
- "gdbarch_dump: GET_SAVED_REGISTER_P() = %d\n",
- GET_SAVED_REGISTER_P ());
-#endif
-#ifdef GET_SAVED_REGISTER
-#if GDB_MULTI_ARCH
- /* Macro might contain `[{}]' when not multi-arch */
- fprintf_unfiltered (file,
- "gdbarch_dump: %s # %s\n",
- "GET_SAVED_REGISTER(raw_buffer, optimized, addrp, frame, regnum, lval)",
- XSTRING (GET_SAVED_REGISTER (raw_buffer, optimized, addrp, frame, regnum, lval)));
-#endif
- if (GDB_MULTI_ARCH)
- fprintf_unfiltered (file,
- "gdbarch_dump: GET_SAVED_REGISTER = <0x%08lx>\n",
- (long) current_gdbarch->get_saved_register
- /*GET_SAVED_REGISTER ()*/);
-#endif
#ifdef HAVE_NONSTEPPABLE_WATCHPOINT
fprintf_unfiltered (file,
"gdbarch_dump: HAVE_NONSTEPPABLE_WATCHPOINT # %s\n",
@@ -1807,29 +1895,6 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
(long) current_gdbarch->pointer_to_address
/*POINTER_TO_ADDRESS ()*/);
#endif
-#ifdef POP_FRAME_P
- fprintf_unfiltered (file,
- "gdbarch_dump: %s # %s\n",
- "POP_FRAME_P()",
- XSTRING (POP_FRAME_P ()));
- fprintf_unfiltered (file,
- "gdbarch_dump: POP_FRAME_P() = %d\n",
- POP_FRAME_P ());
-#endif
-#ifdef POP_FRAME
-#if GDB_MULTI_ARCH
- /* Macro might contain `[{}]' when not multi-arch */
- fprintf_unfiltered (file,
- "gdbarch_dump: %s # %s\n",
- "POP_FRAME(-)",
- XSTRING (POP_FRAME (-)));
-#endif
- if (GDB_MULTI_ARCH)
- fprintf_unfiltered (file,
- "gdbarch_dump: POP_FRAME = <0x%08lx>\n",
- (long) current_gdbarch->pop_frame
- /*POP_FRAME ()*/);
-#endif
#ifdef PREPARE_TO_PROCEED
fprintf_unfiltered (file,
"gdbarch_dump: %s # %s\n",
@@ -1880,37 +1945,14 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
"gdbarch_dump: PS_REGNUM = %d\n",
PS_REGNUM);
#endif
-#ifdef PUSH_ARGUMENTS
- fprintf_unfiltered (file,
- "gdbarch_dump: %s # %s\n",
- "PUSH_ARGUMENTS(nargs, args, sp, struct_return, struct_addr)",
- XSTRING (PUSH_ARGUMENTS (nargs, args, sp, struct_return, struct_addr)));
if (GDB_MULTI_ARCH)
fprintf_unfiltered (file,
- "gdbarch_dump: PUSH_ARGUMENTS = <0x%08lx>\n",
- (long) current_gdbarch->push_arguments
- /*PUSH_ARGUMENTS ()*/);
-#endif
-#ifdef PUSH_RETURN_ADDRESS_P
- fprintf_unfiltered (file,
- "gdbarch_dump: %s # %s\n",
- "PUSH_RETURN_ADDRESS_P()",
- XSTRING (PUSH_RETURN_ADDRESS_P ()));
- fprintf_unfiltered (file,
- "gdbarch_dump: PUSH_RETURN_ADDRESS_P() = %d\n",
- PUSH_RETURN_ADDRESS_P ());
-#endif
-#ifdef PUSH_RETURN_ADDRESS
- fprintf_unfiltered (file,
- "gdbarch_dump: %s # %s\n",
- "PUSH_RETURN_ADDRESS(pc, sp)",
- XSTRING (PUSH_RETURN_ADDRESS (pc, sp)));
+ "gdbarch_dump: gdbarch_push_dummy_call_p() = %d\n",
+ gdbarch_push_dummy_call_p (current_gdbarch));
if (GDB_MULTI_ARCH)
fprintf_unfiltered (file,
- "gdbarch_dump: PUSH_RETURN_ADDRESS = <0x%08lx>\n",
- (long) current_gdbarch->push_return_address
- /*PUSH_RETURN_ADDRESS ()*/);
-#endif
+ "gdbarch_dump: push_dummy_call = 0x%08lx\n",
+ (long) current_gdbarch->push_dummy_call);
#ifdef REGISTER_BYTE
fprintf_unfiltered (file,
"gdbarch_dump: %s # %s\n",
@@ -2128,17 +2170,6 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
(long) current_gdbarch->return_value_on_stack
/*RETURN_VALUE_ON_STACK ()*/);
#endif
-#ifdef SAVED_PC_AFTER_CALL
- fprintf_unfiltered (file,
- "gdbarch_dump: %s # %s\n",
- "SAVED_PC_AFTER_CALL(frame)",
- XSTRING (SAVED_PC_AFTER_CALL (frame)));
- if (GDB_MULTI_ARCH)
- fprintf_unfiltered (file,
- "gdbarch_dump: SAVED_PC_AFTER_CALL = <0x%08lx>\n",
- (long) current_gdbarch->saved_pc_after_call
- /*SAVED_PC_AFTER_CALL ()*/);
-#endif
#ifdef SAVE_DUMMY_FRAME_TOS_P
fprintf_unfiltered (file,
"gdbarch_dump: %s # %s\n",
@@ -2218,8 +2249,8 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
"gdbarch_dump: SIZEOF_CALL_DUMMY_WORDS # %s\n",
XSTRING (SIZEOF_CALL_DUMMY_WORDS));
fprintf_unfiltered (file,
- "gdbarch_dump: SIZEOF_CALL_DUMMY_WORDS = 0x%08lx\n",
- (long) SIZEOF_CALL_DUMMY_WORDS);
+ "gdbarch_dump: SIZEOF_CALL_DUMMY_WORDS = %d\n",
+ SIZEOF_CALL_DUMMY_WORDS);
#endif
#ifdef SKIP_PROLOGUE
fprintf_unfiltered (file,
@@ -2330,20 +2361,6 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
(long) current_gdbarch->store_return_value
/*STORE_RETURN_VALUE ()*/);
#endif
-#ifdef STORE_STRUCT_RETURN
-#if GDB_MULTI_ARCH
- /* Macro might contain `[{}]' when not multi-arch */
- fprintf_unfiltered (file,
- "gdbarch_dump: %s # %s\n",
- "STORE_STRUCT_RETURN(addr, sp)",
- XSTRING (STORE_STRUCT_RETURN (addr, sp)));
-#endif
- if (GDB_MULTI_ARCH)
- fprintf_unfiltered (file,
- "gdbarch_dump: STORE_STRUCT_RETURN = <0x%08lx>\n",
- (long) current_gdbarch->store_struct_return
- /*STORE_STRUCT_RETURN ()*/);
-#endif
#ifdef TARGET_ADDR_BIT
fprintf_unfiltered (file,
"gdbarch_dump: TARGET_ADDR_BIT # %s\n",
@@ -2553,20 +2570,22 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
(long) current_gdbarch->write_pc
/*TARGET_WRITE_PC ()*/);
#endif
-#ifdef TARGET_WRITE_SP
-#if GDB_MULTI_ARCH
- /* Macro might contain `[{}]' when not multi-arch */
- fprintf_unfiltered (file,
- "gdbarch_dump: %s # %s\n",
- "TARGET_WRITE_SP(val)",
- XSTRING (TARGET_WRITE_SP (val)));
-#endif
if (GDB_MULTI_ARCH)
fprintf_unfiltered (file,
- "gdbarch_dump: TARGET_WRITE_SP = <0x%08lx>\n",
- (long) current_gdbarch->write_sp
- /*TARGET_WRITE_SP ()*/);
-#endif
+ "gdbarch_dump: gdbarch_unwind_dummy_id_p() = %d\n",
+ gdbarch_unwind_dummy_id_p (current_gdbarch));
+ if (GDB_MULTI_ARCH)
+ fprintf_unfiltered (file,
+ "gdbarch_dump: unwind_dummy_id = 0x%08lx\n",
+ (long) current_gdbarch->unwind_dummy_id);
+ if (GDB_MULTI_ARCH)
+ fprintf_unfiltered (file,
+ "gdbarch_dump: gdbarch_unwind_pc_p() = %d\n",
+ gdbarch_unwind_pc_p (current_gdbarch));
+ if (GDB_MULTI_ARCH)
+ fprintf_unfiltered (file,
+ "gdbarch_dump: unwind_pc = 0x%08lx\n",
+ (long) current_gdbarch->unwind_pc);
#ifdef USE_STRUCT_CONVENTION
fprintf_unfiltered (file,
"gdbarch_dump: %s # %s\n",
@@ -2899,23 +2918,30 @@ set_gdbarch_read_sp (struct gdbarch *gdbarch,
gdbarch->read_sp = read_sp;
}
+int
+gdbarch_deprecated_dummy_write_sp_p (struct gdbarch *gdbarch)
+{
+ gdb_assert (gdbarch != NULL);
+ return gdbarch->deprecated_dummy_write_sp != 0;
+}
+
void
-gdbarch_write_sp (struct gdbarch *gdbarch, CORE_ADDR val)
+gdbarch_deprecated_dummy_write_sp (struct gdbarch *gdbarch, CORE_ADDR val)
{
gdb_assert (gdbarch != NULL);
- if (gdbarch->write_sp == 0)
+ if (gdbarch->deprecated_dummy_write_sp == 0)
internal_error (__FILE__, __LINE__,
- "gdbarch: gdbarch_write_sp invalid");
+ "gdbarch: gdbarch_deprecated_dummy_write_sp invalid");
if (gdbarch_debug >= 2)
- fprintf_unfiltered (gdb_stdlog, "gdbarch_write_sp called\n");
- gdbarch->write_sp (val);
+ fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_dummy_write_sp called\n");
+ gdbarch->deprecated_dummy_write_sp (val);
}
void
-set_gdbarch_write_sp (struct gdbarch *gdbarch,
- gdbarch_write_sp_ftype write_sp)
+set_gdbarch_deprecated_dummy_write_sp (struct gdbarch *gdbarch,
+ gdbarch_deprecated_dummy_write_sp_ftype deprecated_dummy_write_sp)
{
- gdbarch->write_sp = write_sp;
+ gdbarch->deprecated_dummy_write_sp = deprecated_dummy_write_sp;
}
void
@@ -3697,9 +3723,6 @@ CORE_ADDR
gdbarch_call_dummy_start_offset (struct gdbarch *gdbarch)
{
gdb_assert (gdbarch != NULL);
- if (gdbarch->call_dummy_start_offset == -1)
- internal_error (__FILE__, __LINE__,
- "gdbarch: gdbarch_call_dummy_start_offset invalid");
if (gdbarch_debug >= 2)
fprintf_unfiltered (gdb_stdlog, "gdbarch_call_dummy_start_offset called\n");
return gdbarch->call_dummy_start_offset;
@@ -3716,9 +3739,6 @@ CORE_ADDR
gdbarch_call_dummy_breakpoint_offset (struct gdbarch *gdbarch)
{
gdb_assert (gdbarch != NULL);
- if (gdbarch->call_dummy_breakpoint_offset_p && gdbarch->call_dummy_breakpoint_offset == -1)
- internal_error (__FILE__, __LINE__,
- "gdbarch: gdbarch_call_dummy_breakpoint_offset invalid");
if (gdbarch_debug >= 2)
fprintf_unfiltered (gdb_stdlog, "gdbarch_call_dummy_breakpoint_offset called\n");
return gdbarch->call_dummy_breakpoint_offset;
@@ -3732,31 +3752,9 @@ set_gdbarch_call_dummy_breakpoint_offset (struct gdbarch *gdbarch,
}
int
-gdbarch_call_dummy_breakpoint_offset_p (struct gdbarch *gdbarch)
-{
- gdb_assert (gdbarch != NULL);
- if (gdbarch->call_dummy_breakpoint_offset_p == -1)
- internal_error (__FILE__, __LINE__,
- "gdbarch: gdbarch_call_dummy_breakpoint_offset_p invalid");
- if (gdbarch_debug >= 2)
- fprintf_unfiltered (gdb_stdlog, "gdbarch_call_dummy_breakpoint_offset_p called\n");
- return gdbarch->call_dummy_breakpoint_offset_p;
-}
-
-void
-set_gdbarch_call_dummy_breakpoint_offset_p (struct gdbarch *gdbarch,
- int call_dummy_breakpoint_offset_p)
-{
- gdbarch->call_dummy_breakpoint_offset_p = call_dummy_breakpoint_offset_p;
-}
-
-int
gdbarch_call_dummy_length (struct gdbarch *gdbarch)
{
gdb_assert (gdbarch != NULL);
- if (gdbarch->call_dummy_length == -1)
- internal_error (__FILE__, __LINE__,
- "gdbarch: gdbarch_call_dummy_length invalid");
if (gdbarch_debug >= 2)
fprintf_unfiltered (gdb_stdlog, "gdbarch_call_dummy_length called\n");
return gdbarch->call_dummy_length;
@@ -3796,25 +3794,6 @@ set_gdbarch_deprecated_pc_in_call_dummy (struct gdbarch *gdbarch,
gdbarch->deprecated_pc_in_call_dummy = deprecated_pc_in_call_dummy;
}
-int
-gdbarch_call_dummy_p (struct gdbarch *gdbarch)
-{
- gdb_assert (gdbarch != NULL);
- if (gdbarch->call_dummy_p == -1)
- internal_error (__FILE__, __LINE__,
- "gdbarch: gdbarch_call_dummy_p invalid");
- if (gdbarch_debug >= 2)
- fprintf_unfiltered (gdb_stdlog, "gdbarch_call_dummy_p called\n");
- return gdbarch->call_dummy_p;
-}
-
-void
-set_gdbarch_call_dummy_p (struct gdbarch *gdbarch,
- int call_dummy_p)
-{
- gdbarch->call_dummy_p = call_dummy_p;
-}
-
LONGEST *
gdbarch_call_dummy_words (struct gdbarch *gdbarch)
{
@@ -3850,41 +3829,33 @@ set_gdbarch_sizeof_call_dummy_words (struct gdbarch *gdbarch,
}
int
-gdbarch_call_dummy_stack_adjust_p (struct gdbarch *gdbarch)
+gdbarch_deprecated_call_dummy_stack_adjust_p (struct gdbarch *gdbarch)
{
gdb_assert (gdbarch != NULL);
- if (gdbarch->call_dummy_stack_adjust_p == -1)
- internal_error (__FILE__, __LINE__,
- "gdbarch: gdbarch_call_dummy_stack_adjust_p invalid");
- if (gdbarch_debug >= 2)
- fprintf_unfiltered (gdb_stdlog, "gdbarch_call_dummy_stack_adjust_p called\n");
- return gdbarch->call_dummy_stack_adjust_p;
-}
-
-void
-set_gdbarch_call_dummy_stack_adjust_p (struct gdbarch *gdbarch,
- int call_dummy_stack_adjust_p)
-{
- gdbarch->call_dummy_stack_adjust_p = call_dummy_stack_adjust_p;
+ return gdbarch->deprecated_call_dummy_stack_adjust != 0;
}
int
-gdbarch_call_dummy_stack_adjust (struct gdbarch *gdbarch)
+gdbarch_deprecated_call_dummy_stack_adjust (struct gdbarch *gdbarch)
{
gdb_assert (gdbarch != NULL);
- if (gdbarch->call_dummy_stack_adjust_p && gdbarch->call_dummy_stack_adjust == 0)
- internal_error (__FILE__, __LINE__,
- "gdbarch: gdbarch_call_dummy_stack_adjust invalid");
if (gdbarch_debug >= 2)
- fprintf_unfiltered (gdb_stdlog, "gdbarch_call_dummy_stack_adjust called\n");
- return gdbarch->call_dummy_stack_adjust;
+ fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_call_dummy_stack_adjust called\n");
+ return gdbarch->deprecated_call_dummy_stack_adjust;
}
void
-set_gdbarch_call_dummy_stack_adjust (struct gdbarch *gdbarch,
- int call_dummy_stack_adjust)
+set_gdbarch_deprecated_call_dummy_stack_adjust (struct gdbarch *gdbarch,
+ int deprecated_call_dummy_stack_adjust)
+{
+ gdbarch->deprecated_call_dummy_stack_adjust = deprecated_call_dummy_stack_adjust;
+}
+
+int
+gdbarch_fix_call_dummy_p (struct gdbarch *gdbarch)
{
- gdbarch->call_dummy_stack_adjust = call_dummy_stack_adjust;
+ gdb_assert (gdbarch != NULL);
+ return gdbarch->fix_call_dummy != 0;
}
void
@@ -3991,29 +3962,29 @@ set_gdbarch_believe_pcc_promotion_type (struct gdbarch *gdbarch,
}
int
-gdbarch_get_saved_register_p (struct gdbarch *gdbarch)
+gdbarch_deprecated_get_saved_register_p (struct gdbarch *gdbarch)
{
gdb_assert (gdbarch != NULL);
- return gdbarch->get_saved_register != 0;
+ return gdbarch->deprecated_get_saved_register != 0;
}
void
-gdbarch_get_saved_register (struct gdbarch *gdbarch, char *raw_buffer, int *optimized, CORE_ADDR *addrp, struct frame_info *frame, int regnum, enum lval_type *lval)
+gdbarch_deprecated_get_saved_register (struct gdbarch *gdbarch, char *raw_buffer, int *optimized, CORE_ADDR *addrp, struct frame_info *frame, int regnum, enum lval_type *lval)
{
gdb_assert (gdbarch != NULL);
- if (gdbarch->get_saved_register == 0)
+ if (gdbarch->deprecated_get_saved_register == 0)
internal_error (__FILE__, __LINE__,
- "gdbarch: gdbarch_get_saved_register invalid");
+ "gdbarch: gdbarch_deprecated_get_saved_register invalid");
if (gdbarch_debug >= 2)
- fprintf_unfiltered (gdb_stdlog, "gdbarch_get_saved_register called\n");
- gdbarch->get_saved_register (raw_buffer, optimized, addrp, frame, regnum, lval);
+ fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_get_saved_register called\n");
+ gdbarch->deprecated_get_saved_register (raw_buffer, optimized, addrp, frame, regnum, lval);
}
void
-set_gdbarch_get_saved_register (struct gdbarch *gdbarch,
- gdbarch_get_saved_register_ftype get_saved_register)
+set_gdbarch_deprecated_get_saved_register (struct gdbarch *gdbarch,
+ gdbarch_deprecated_get_saved_register_ftype deprecated_get_saved_register)
{
- gdbarch->get_saved_register = get_saved_register;
+ gdbarch->deprecated_get_saved_register = deprecated_get_saved_register;
}
int
@@ -4213,23 +4184,56 @@ set_gdbarch_return_value_on_stack (struct gdbarch *gdbarch,
gdbarch->return_value_on_stack = return_value_on_stack;
}
+int
+gdbarch_deprecated_push_arguments_p (struct gdbarch *gdbarch)
+{
+ gdb_assert (gdbarch != NULL);
+ return gdbarch->deprecated_push_arguments != 0;
+}
+
+CORE_ADDR
+gdbarch_deprecated_push_arguments (struct gdbarch *gdbarch, int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr)
+{
+ gdb_assert (gdbarch != NULL);
+ if (gdbarch->deprecated_push_arguments == 0)
+ internal_error (__FILE__, __LINE__,
+ "gdbarch: gdbarch_deprecated_push_arguments invalid");
+ if (gdbarch_debug >= 2)
+ fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_push_arguments called\n");
+ return gdbarch->deprecated_push_arguments (nargs, args, sp, struct_return, struct_addr);
+}
+
+void
+set_gdbarch_deprecated_push_arguments (struct gdbarch *gdbarch,
+ gdbarch_deprecated_push_arguments_ftype deprecated_push_arguments)
+{
+ gdbarch->deprecated_push_arguments = deprecated_push_arguments;
+}
+
+int
+gdbarch_push_dummy_call_p (struct gdbarch *gdbarch)
+{
+ gdb_assert (gdbarch != NULL);
+ return gdbarch->push_dummy_call != 0;
+}
+
CORE_ADDR
-gdbarch_push_arguments (struct gdbarch *gdbarch, int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr)
+gdbarch_push_dummy_call (struct gdbarch *gdbarch, struct regcache *regcache, CORE_ADDR dummy_addr, int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr)
{
gdb_assert (gdbarch != NULL);
- if (gdbarch->push_arguments == 0)
+ if (gdbarch->push_dummy_call == 0)
internal_error (__FILE__, __LINE__,
- "gdbarch: gdbarch_push_arguments invalid");
+ "gdbarch: gdbarch_push_dummy_call invalid");
if (gdbarch_debug >= 2)
- fprintf_unfiltered (gdb_stdlog, "gdbarch_push_arguments called\n");
- return gdbarch->push_arguments (nargs, args, sp, struct_return, struct_addr);
+ fprintf_unfiltered (gdb_stdlog, "gdbarch_push_dummy_call called\n");
+ return gdbarch->push_dummy_call (gdbarch, regcache, dummy_addr, nargs, args, sp, struct_return, struct_addr);
}
void
-set_gdbarch_push_arguments (struct gdbarch *gdbarch,
- gdbarch_push_arguments_ftype push_arguments)
+set_gdbarch_push_dummy_call (struct gdbarch *gdbarch,
+ gdbarch_push_dummy_call_ftype push_dummy_call)
{
- gdbarch->push_arguments = push_arguments;
+ gdbarch->push_dummy_call = push_dummy_call;
}
int
@@ -4259,74 +4263,81 @@ set_gdbarch_deprecated_push_dummy_frame (struct gdbarch *gdbarch,
}
int
-gdbarch_push_return_address_p (struct gdbarch *gdbarch)
+gdbarch_deprecated_push_return_address_p (struct gdbarch *gdbarch)
{
gdb_assert (gdbarch != NULL);
- return gdbarch->push_return_address != 0;
+ return gdbarch->deprecated_push_return_address != 0;
}
CORE_ADDR
-gdbarch_push_return_address (struct gdbarch *gdbarch, CORE_ADDR pc, CORE_ADDR sp)
+gdbarch_deprecated_push_return_address (struct gdbarch *gdbarch, CORE_ADDR pc, CORE_ADDR sp)
{
gdb_assert (gdbarch != NULL);
- if (gdbarch->push_return_address == 0)
+ if (gdbarch->deprecated_push_return_address == 0)
internal_error (__FILE__, __LINE__,
- "gdbarch: gdbarch_push_return_address invalid");
+ "gdbarch: gdbarch_deprecated_push_return_address invalid");
if (gdbarch_debug >= 2)
- fprintf_unfiltered (gdb_stdlog, "gdbarch_push_return_address called\n");
- return gdbarch->push_return_address (pc, sp);
+ fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_push_return_address called\n");
+ return gdbarch->deprecated_push_return_address (pc, sp);
}
void
-set_gdbarch_push_return_address (struct gdbarch *gdbarch,
- gdbarch_push_return_address_ftype push_return_address)
+set_gdbarch_deprecated_push_return_address (struct gdbarch *gdbarch,
+ gdbarch_deprecated_push_return_address_ftype deprecated_push_return_address)
{
- gdbarch->push_return_address = push_return_address;
+ gdbarch->deprecated_push_return_address = deprecated_push_return_address;
}
int
-gdbarch_pop_frame_p (struct gdbarch *gdbarch)
+gdbarch_deprecated_pop_frame_p (struct gdbarch *gdbarch)
{
gdb_assert (gdbarch != NULL);
- return gdbarch->pop_frame != 0;
+ return gdbarch->deprecated_pop_frame != 0;
}
void
-gdbarch_pop_frame (struct gdbarch *gdbarch)
+gdbarch_deprecated_pop_frame (struct gdbarch *gdbarch)
{
gdb_assert (gdbarch != NULL);
- if (gdbarch->pop_frame == 0)
+ if (gdbarch->deprecated_pop_frame == 0)
internal_error (__FILE__, __LINE__,
- "gdbarch: gdbarch_pop_frame invalid");
+ "gdbarch: gdbarch_deprecated_pop_frame invalid");
if (gdbarch_debug >= 2)
- fprintf_unfiltered (gdb_stdlog, "gdbarch_pop_frame called\n");
- gdbarch->pop_frame ();
+ fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_pop_frame called\n");
+ gdbarch->deprecated_pop_frame ();
}
void
-set_gdbarch_pop_frame (struct gdbarch *gdbarch,
- gdbarch_pop_frame_ftype pop_frame)
+set_gdbarch_deprecated_pop_frame (struct gdbarch *gdbarch,
+ gdbarch_deprecated_pop_frame_ftype deprecated_pop_frame)
{
- gdbarch->pop_frame = pop_frame;
+ gdbarch->deprecated_pop_frame = deprecated_pop_frame;
+}
+
+int
+gdbarch_deprecated_store_struct_return_p (struct gdbarch *gdbarch)
+{
+ gdb_assert (gdbarch != NULL);
+ return gdbarch->deprecated_store_struct_return != 0;
}
void
-gdbarch_store_struct_return (struct gdbarch *gdbarch, CORE_ADDR addr, CORE_ADDR sp)
+gdbarch_deprecated_store_struct_return (struct gdbarch *gdbarch, CORE_ADDR addr, CORE_ADDR sp)
{
gdb_assert (gdbarch != NULL);
- if (gdbarch->store_struct_return == 0)
+ if (gdbarch->deprecated_store_struct_return == 0)
internal_error (__FILE__, __LINE__,
- "gdbarch: gdbarch_store_struct_return invalid");
+ "gdbarch: gdbarch_deprecated_store_struct_return invalid");
if (gdbarch_debug >= 2)
- fprintf_unfiltered (gdb_stdlog, "gdbarch_store_struct_return called\n");
- gdbarch->store_struct_return (addr, sp);
+ fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_store_struct_return called\n");
+ gdbarch->deprecated_store_struct_return (addr, sp);
}
void
-set_gdbarch_store_struct_return (struct gdbarch *gdbarch,
- gdbarch_store_struct_return_ftype store_struct_return)
+set_gdbarch_deprecated_store_struct_return (struct gdbarch *gdbarch,
+ gdbarch_deprecated_store_struct_return_ftype deprecated_store_struct_return)
{
- gdbarch->store_struct_return = store_struct_return;
+ gdbarch->deprecated_store_struct_return = deprecated_store_struct_return;
}
void
@@ -4757,81 +4768,107 @@ set_gdbarch_frameless_function_invocation (struct gdbarch *gdbarch,
}
int
-gdbarch_frame_chain_p (struct gdbarch *gdbarch)
+gdbarch_deprecated_frame_chain_p (struct gdbarch *gdbarch)
{
gdb_assert (gdbarch != NULL);
- return gdbarch->frame_chain != 0;
+ return gdbarch->deprecated_frame_chain != 0;
}
CORE_ADDR
-gdbarch_frame_chain (struct gdbarch *gdbarch, struct frame_info *frame)
+gdbarch_deprecated_frame_chain (struct gdbarch *gdbarch, struct frame_info *frame)
{
gdb_assert (gdbarch != NULL);
- if (gdbarch->frame_chain == 0)
+ if (gdbarch->deprecated_frame_chain == 0)
internal_error (__FILE__, __LINE__,
- "gdbarch: gdbarch_frame_chain invalid");
+ "gdbarch: gdbarch_deprecated_frame_chain invalid");
if (gdbarch_debug >= 2)
- fprintf_unfiltered (gdb_stdlog, "gdbarch_frame_chain called\n");
- return gdbarch->frame_chain (frame);
+ fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_frame_chain called\n");
+ return gdbarch->deprecated_frame_chain (frame);
}
void
-set_gdbarch_frame_chain (struct gdbarch *gdbarch,
- gdbarch_frame_chain_ftype frame_chain)
+set_gdbarch_deprecated_frame_chain (struct gdbarch *gdbarch,
+ gdbarch_deprecated_frame_chain_ftype deprecated_frame_chain)
+{
+ gdbarch->deprecated_frame_chain = deprecated_frame_chain;
+}
+
+int
+gdbarch_deprecated_frame_chain_valid_p (struct gdbarch *gdbarch)
{
- gdbarch->frame_chain = frame_chain;
+ gdb_assert (gdbarch != NULL);
+ return gdbarch->deprecated_frame_chain_valid != 0;
}
int
-gdbarch_frame_chain_valid_p (struct gdbarch *gdbarch)
+gdbarch_deprecated_frame_chain_valid (struct gdbarch *gdbarch, CORE_ADDR chain, struct frame_info *thisframe)
{
gdb_assert (gdbarch != NULL);
- return gdbarch->frame_chain_valid != 0;
+ if (gdbarch->deprecated_frame_chain_valid == 0)
+ internal_error (__FILE__, __LINE__,
+ "gdbarch: gdbarch_deprecated_frame_chain_valid invalid");
+ if (gdbarch_debug >= 2)
+ fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_frame_chain_valid called\n");
+ return gdbarch->deprecated_frame_chain_valid (chain, thisframe);
+}
+
+void
+set_gdbarch_deprecated_frame_chain_valid (struct gdbarch *gdbarch,
+ gdbarch_deprecated_frame_chain_valid_ftype deprecated_frame_chain_valid)
+{
+ gdbarch->deprecated_frame_chain_valid = deprecated_frame_chain_valid;
}
int
-gdbarch_frame_chain_valid (struct gdbarch *gdbarch, CORE_ADDR chain, struct frame_info *thisframe)
+gdbarch_deprecated_frame_saved_pc_p (struct gdbarch *gdbarch)
+{
+ gdb_assert (gdbarch != NULL);
+ return gdbarch->deprecated_frame_saved_pc != 0;
+}
+
+CORE_ADDR
+gdbarch_deprecated_frame_saved_pc (struct gdbarch *gdbarch, struct frame_info *fi)
{
gdb_assert (gdbarch != NULL);
- if (gdbarch->frame_chain_valid == 0)
+ if (gdbarch->deprecated_frame_saved_pc == 0)
internal_error (__FILE__, __LINE__,
- "gdbarch: gdbarch_frame_chain_valid invalid");
+ "gdbarch: gdbarch_deprecated_frame_saved_pc invalid");
if (gdbarch_debug >= 2)
- fprintf_unfiltered (gdb_stdlog, "gdbarch_frame_chain_valid called\n");
- return gdbarch->frame_chain_valid (chain, thisframe);
+ fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_frame_saved_pc called\n");
+ return gdbarch->deprecated_frame_saved_pc (fi);
}
void
-set_gdbarch_frame_chain_valid (struct gdbarch *gdbarch,
- gdbarch_frame_chain_valid_ftype frame_chain_valid)
+set_gdbarch_deprecated_frame_saved_pc (struct gdbarch *gdbarch,
+ gdbarch_deprecated_frame_saved_pc_ftype deprecated_frame_saved_pc)
{
- gdbarch->frame_chain_valid = frame_chain_valid;
+ gdbarch->deprecated_frame_saved_pc = deprecated_frame_saved_pc;
}
int
-gdbarch_frame_saved_pc_p (struct gdbarch *gdbarch)
+gdbarch_unwind_pc_p (struct gdbarch *gdbarch)
{
gdb_assert (gdbarch != NULL);
- return gdbarch->frame_saved_pc != 0;
+ return gdbarch->unwind_pc != 0;
}
CORE_ADDR
-gdbarch_frame_saved_pc (struct gdbarch *gdbarch, struct frame_info *fi)
+gdbarch_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
{
gdb_assert (gdbarch != NULL);
- if (gdbarch->frame_saved_pc == 0)
+ if (gdbarch->unwind_pc == 0)
internal_error (__FILE__, __LINE__,
- "gdbarch: gdbarch_frame_saved_pc invalid");
+ "gdbarch: gdbarch_unwind_pc invalid");
if (gdbarch_debug >= 2)
- fprintf_unfiltered (gdb_stdlog, "gdbarch_frame_saved_pc called\n");
- return gdbarch->frame_saved_pc (fi);
+ fprintf_unfiltered (gdb_stdlog, "gdbarch_unwind_pc called\n");
+ return gdbarch->unwind_pc (gdbarch, next_frame);
}
void
-set_gdbarch_frame_saved_pc (struct gdbarch *gdbarch,
- gdbarch_frame_saved_pc_ftype frame_saved_pc)
+set_gdbarch_unwind_pc (struct gdbarch *gdbarch,
+ gdbarch_unwind_pc_ftype unwind_pc)
{
- gdbarch->frame_saved_pc = frame_saved_pc;
+ gdbarch->unwind_pc = unwind_pc;
}
CORE_ADDR
@@ -4872,23 +4909,30 @@ set_gdbarch_frame_locals_address (struct gdbarch *gdbarch,
gdbarch->frame_locals_address = frame_locals_address;
}
+int
+gdbarch_deprecated_saved_pc_after_call_p (struct gdbarch *gdbarch)
+{
+ gdb_assert (gdbarch != NULL);
+ return gdbarch->deprecated_saved_pc_after_call != 0;
+}
+
CORE_ADDR
-gdbarch_saved_pc_after_call (struct gdbarch *gdbarch, struct frame_info *frame)
+gdbarch_deprecated_saved_pc_after_call (struct gdbarch *gdbarch, struct frame_info *frame)
{
gdb_assert (gdbarch != NULL);
- if (gdbarch->saved_pc_after_call == 0)
+ if (gdbarch->deprecated_saved_pc_after_call == 0)
internal_error (__FILE__, __LINE__,
- "gdbarch: gdbarch_saved_pc_after_call invalid");
+ "gdbarch: gdbarch_deprecated_saved_pc_after_call invalid");
if (gdbarch_debug >= 2)
- fprintf_unfiltered (gdb_stdlog, "gdbarch_saved_pc_after_call called\n");
- return gdbarch->saved_pc_after_call (frame);
+ fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_saved_pc_after_call called\n");
+ return gdbarch->deprecated_saved_pc_after_call (frame);
}
void
-set_gdbarch_saved_pc_after_call (struct gdbarch *gdbarch,
- gdbarch_saved_pc_after_call_ftype saved_pc_after_call)
+set_gdbarch_deprecated_saved_pc_after_call (struct gdbarch *gdbarch,
+ gdbarch_deprecated_saved_pc_after_call_ftype deprecated_saved_pc_after_call)
{
- gdbarch->saved_pc_after_call = saved_pc_after_call;
+ gdbarch->deprecated_saved_pc_after_call = deprecated_saved_pc_after_call;
}
int
@@ -4963,20 +5007,20 @@ set_gdbarch_frame_align (struct gdbarch *gdbarch,
}
int
-gdbarch_extra_stack_alignment_needed (struct gdbarch *gdbarch)
+gdbarch_deprecated_extra_stack_alignment_needed (struct gdbarch *gdbarch)
{
gdb_assert (gdbarch != NULL);
- /* Skip verify of extra_stack_alignment_needed, invalid_p == 0 */
+ /* Skip verify of deprecated_extra_stack_alignment_needed, invalid_p == 0 */
if (gdbarch_debug >= 2)
- fprintf_unfiltered (gdb_stdlog, "gdbarch_extra_stack_alignment_needed called\n");
- return gdbarch->extra_stack_alignment_needed;
+ fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_extra_stack_alignment_needed called\n");
+ return gdbarch->deprecated_extra_stack_alignment_needed;
}
void
-set_gdbarch_extra_stack_alignment_needed (struct gdbarch *gdbarch,
- int extra_stack_alignment_needed)
+set_gdbarch_deprecated_extra_stack_alignment_needed (struct gdbarch *gdbarch,
+ int deprecated_extra_stack_alignment_needed)
{
- gdbarch->extra_stack_alignment_needed = extra_stack_alignment_needed;
+ gdbarch->deprecated_extra_stack_alignment_needed = deprecated_extra_stack_alignment_needed;
}
int
@@ -5032,6 +5076,32 @@ set_gdbarch_save_dummy_frame_tos (struct gdbarch *gdbarch,
}
int
+gdbarch_unwind_dummy_id_p (struct gdbarch *gdbarch)
+{
+ gdb_assert (gdbarch != NULL);
+ return gdbarch->unwind_dummy_id != 0;
+}
+
+struct frame_id
+gdbarch_unwind_dummy_id (struct gdbarch *gdbarch, struct frame_info *info)
+{
+ gdb_assert (gdbarch != NULL);
+ if (gdbarch->unwind_dummy_id == 0)
+ internal_error (__FILE__, __LINE__,
+ "gdbarch: gdbarch_unwind_dummy_id invalid");
+ if (gdbarch_debug >= 2)
+ fprintf_unfiltered (gdb_stdlog, "gdbarch_unwind_dummy_id called\n");
+ return gdbarch->unwind_dummy_id (gdbarch, info);
+}
+
+void
+set_gdbarch_unwind_dummy_id (struct gdbarch *gdbarch,
+ gdbarch_unwind_dummy_id_ftype unwind_dummy_id)
+{
+ gdbarch->unwind_dummy_id = unwind_dummy_id;
+}
+
+int
gdbarch_parm_boundary (struct gdbarch *gdbarch)
{
gdb_assert (gdbarch != NULL);
diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h
index 59dd3d6..7b2641b 100644
--- a/gdb/gdbarch.h
+++ b/gdb/gdbarch.h
@@ -39,8 +39,11 @@
#if !GDB_MULTI_ARCH
/* Pull in function declarations refered to, indirectly, via macros. */
#include "inferior.h" /* For unsigned_address_to_pointer(). */
+#include "symfile.h" /* For entry_point_address(). */
#endif
+struct floatformat;
+struct ui_file;
struct frame_info;
struct value;
struct objfile;
@@ -54,18 +57,6 @@ extern struct gdbarch *current_gdbarch;
/* If any of the following are defined, the target wasn't correctly
converted. */
-#if GDB_MULTI_ARCH
-#if defined (EXTRA_FRAME_INFO)
-#error "EXTRA_FRAME_INFO: replaced by struct frame_extra_info"
-#endif
-#endif
-
-#if GDB_MULTI_ARCH
-#if defined (FRAME_FIND_SAVED_REGS)
-#error "FRAME_FIND_SAVED_REGS: replaced by DEPRECATED_FRAME_INIT_SAVED_REGS"
-#endif
-#endif
-
#if (GDB_MULTI_ARCH >= GDB_MULTI_ARCH_PURE) && defined (GDB_TM_FILE)
#error "GDB_TM_FILE: Pure multi-arch targets do not have a tm.h file."
#endif
@@ -388,20 +379,42 @@ extern void set_gdbarch_read_sp (struct gdbarch *gdbarch, gdbarch_read_sp_ftype
#endif
#endif
+/* The dummy call frame SP should be set by push_dummy_call. */
+
+#if defined (DEPRECATED_DUMMY_WRITE_SP)
+/* Legacy for systems yet to multi-arch DEPRECATED_DUMMY_WRITE_SP */
+#if !defined (DEPRECATED_DUMMY_WRITE_SP_P)
+#define DEPRECATED_DUMMY_WRITE_SP_P() (1)
+#endif
+#endif
+
+/* Default predicate for non- multi-arch targets. */
+#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_DUMMY_WRITE_SP_P)
+#define DEPRECATED_DUMMY_WRITE_SP_P() (0)
+#endif
+
+extern int gdbarch_deprecated_dummy_write_sp_p (struct gdbarch *gdbarch);
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_DUMMY_WRITE_SP_P)
+#error "Non multi-arch definition of DEPRECATED_DUMMY_WRITE_SP"
+#endif
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_DUMMY_WRITE_SP_P)
+#define DEPRECATED_DUMMY_WRITE_SP_P() (gdbarch_deprecated_dummy_write_sp_p (current_gdbarch))
+#endif
+
/* Default (function) for non- multi-arch platforms. */
-#if (!GDB_MULTI_ARCH) && !defined (TARGET_WRITE_SP)
-#define TARGET_WRITE_SP(val) (generic_target_write_sp (val))
+#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_DUMMY_WRITE_SP)
+#define DEPRECATED_DUMMY_WRITE_SP(val) (internal_error (__FILE__, __LINE__, "DEPRECATED_DUMMY_WRITE_SP"), 0)
#endif
-typedef void (gdbarch_write_sp_ftype) (CORE_ADDR val);
-extern void gdbarch_write_sp (struct gdbarch *gdbarch, CORE_ADDR val);
-extern void set_gdbarch_write_sp (struct gdbarch *gdbarch, gdbarch_write_sp_ftype *write_sp);
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (TARGET_WRITE_SP)
-#error "Non multi-arch definition of TARGET_WRITE_SP"
+typedef void (gdbarch_deprecated_dummy_write_sp_ftype) (CORE_ADDR val);
+extern void gdbarch_deprecated_dummy_write_sp (struct gdbarch *gdbarch, CORE_ADDR val);
+extern void set_gdbarch_deprecated_dummy_write_sp (struct gdbarch *gdbarch, gdbarch_deprecated_dummy_write_sp_ftype *deprecated_dummy_write_sp);
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_DUMMY_WRITE_SP)
+#error "Non multi-arch definition of DEPRECATED_DUMMY_WRITE_SP"
#endif
#if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (TARGET_WRITE_SP)
-#define TARGET_WRITE_SP(val) (gdbarch_write_sp (current_gdbarch, val))
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_DUMMY_WRITE_SP)
+#define DEPRECATED_DUMMY_WRITE_SP(val) (gdbarch_deprecated_dummy_write_sp (current_gdbarch, val))
#endif
#endif
@@ -1093,14 +1106,12 @@ extern void set_gdbarch_get_longjmp_target (struct gdbarch *gdbarch, gdbarch_get
extern int gdbarch_deprecated_use_generic_dummy_frames (struct gdbarch *gdbarch);
extern void set_gdbarch_deprecated_use_generic_dummy_frames (struct gdbarch *gdbarch, int deprecated_use_generic_dummy_frames);
-#if (GDB_MULTI_ARCH >= GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_USE_GENERIC_DUMMY_FRAMES)
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_USE_GENERIC_DUMMY_FRAMES)
#error "Non multi-arch definition of DEPRECATED_USE_GENERIC_DUMMY_FRAMES"
#endif
-#if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH >= GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_USE_GENERIC_DUMMY_FRAMES)
+#if !defined (DEPRECATED_USE_GENERIC_DUMMY_FRAMES)
#define DEPRECATED_USE_GENERIC_DUMMY_FRAMES (gdbarch_deprecated_use_generic_dummy_frames (current_gdbarch))
#endif
-#endif
/* Default (value) for non- multi-arch platforms. */
#if (!GDB_MULTI_ARCH) && !defined (CALL_DUMMY_LOCATION)
@@ -1109,13 +1120,16 @@ extern void set_gdbarch_deprecated_use_generic_dummy_frames (struct gdbarch *gdb
extern int gdbarch_call_dummy_location (struct gdbarch *gdbarch);
extern void set_gdbarch_call_dummy_location (struct gdbarch *gdbarch, int call_dummy_location);
-#if (GDB_MULTI_ARCH >= GDB_MULTI_ARCH_PARTIAL) && defined (CALL_DUMMY_LOCATION)
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (CALL_DUMMY_LOCATION)
#error "Non multi-arch definition of CALL_DUMMY_LOCATION"
#endif
-#if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH >= GDB_MULTI_ARCH_PARTIAL) || !defined (CALL_DUMMY_LOCATION)
+#if !defined (CALL_DUMMY_LOCATION)
#define CALL_DUMMY_LOCATION (gdbarch_call_dummy_location (current_gdbarch))
#endif
+
+/* Default (function) for non- multi-arch platforms. */
+#if (!GDB_MULTI_ARCH) && !defined (CALL_DUMMY_ADDRESS)
+#define CALL_DUMMY_ADDRESS() (entry_point_address ())
#endif
typedef CORE_ADDR (gdbarch_call_dummy_address_ftype) (void);
@@ -1135,44 +1149,27 @@ extern void set_gdbarch_call_dummy_start_offset (struct gdbarch *gdbarch, CORE_A
#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (CALL_DUMMY_START_OFFSET)
#error "Non multi-arch definition of CALL_DUMMY_START_OFFSET"
#endif
-#if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (CALL_DUMMY_START_OFFSET)
+#if !defined (CALL_DUMMY_START_OFFSET)
#define CALL_DUMMY_START_OFFSET (gdbarch_call_dummy_start_offset (current_gdbarch))
#endif
-#endif
extern CORE_ADDR gdbarch_call_dummy_breakpoint_offset (struct gdbarch *gdbarch);
extern void set_gdbarch_call_dummy_breakpoint_offset (struct gdbarch *gdbarch, CORE_ADDR call_dummy_breakpoint_offset);
#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (CALL_DUMMY_BREAKPOINT_OFFSET)
#error "Non multi-arch definition of CALL_DUMMY_BREAKPOINT_OFFSET"
#endif
-#if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (CALL_DUMMY_BREAKPOINT_OFFSET)
+#if !defined (CALL_DUMMY_BREAKPOINT_OFFSET)
#define CALL_DUMMY_BREAKPOINT_OFFSET (gdbarch_call_dummy_breakpoint_offset (current_gdbarch))
#endif
-#endif
-
-extern int gdbarch_call_dummy_breakpoint_offset_p (struct gdbarch *gdbarch);
-extern void set_gdbarch_call_dummy_breakpoint_offset_p (struct gdbarch *gdbarch, int call_dummy_breakpoint_offset_p);
-#if (GDB_MULTI_ARCH >= GDB_MULTI_ARCH_PARTIAL) && defined (CALL_DUMMY_BREAKPOINT_OFFSET_P)
-#error "Non multi-arch definition of CALL_DUMMY_BREAKPOINT_OFFSET_P"
-#endif
-#if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH >= GDB_MULTI_ARCH_PARTIAL) || !defined (CALL_DUMMY_BREAKPOINT_OFFSET_P)
-#define CALL_DUMMY_BREAKPOINT_OFFSET_P (gdbarch_call_dummy_breakpoint_offset_p (current_gdbarch))
-#endif
-#endif
extern int gdbarch_call_dummy_length (struct gdbarch *gdbarch);
extern void set_gdbarch_call_dummy_length (struct gdbarch *gdbarch, int call_dummy_length);
#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (CALL_DUMMY_LENGTH)
#error "Non multi-arch definition of CALL_DUMMY_LENGTH"
#endif
-#if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (CALL_DUMMY_LENGTH)
+#if !defined (CALL_DUMMY_LENGTH)
#define CALL_DUMMY_LENGTH (gdbarch_call_dummy_length (current_gdbarch))
#endif
-#endif
/* NOTE: cagney/2002-11-24: This function with predicate has a valid
(callable) initial value. As a consequence, even when the predicate
@@ -1193,10 +1190,10 @@ extern void set_gdbarch_call_dummy_length (struct gdbarch *gdbarch, int call_dum
#endif
extern int gdbarch_deprecated_pc_in_call_dummy_p (struct gdbarch *gdbarch);
-#if (GDB_MULTI_ARCH >= GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_PC_IN_CALL_DUMMY_P)
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_PC_IN_CALL_DUMMY_P)
#error "Non multi-arch definition of DEPRECATED_PC_IN_CALL_DUMMY"
#endif
-#if (GDB_MULTI_ARCH >= GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_PC_IN_CALL_DUMMY_P)
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_PC_IN_CALL_DUMMY_P)
#define DEPRECATED_PC_IN_CALL_DUMMY_P() (gdbarch_deprecated_pc_in_call_dummy_p (current_gdbarch))
#endif
@@ -1208,26 +1205,15 @@ extern int gdbarch_deprecated_pc_in_call_dummy_p (struct gdbarch *gdbarch);
typedef int (gdbarch_deprecated_pc_in_call_dummy_ftype) (CORE_ADDR pc, CORE_ADDR sp, CORE_ADDR frame_address);
extern int gdbarch_deprecated_pc_in_call_dummy (struct gdbarch *gdbarch, CORE_ADDR pc, CORE_ADDR sp, CORE_ADDR frame_address);
extern void set_gdbarch_deprecated_pc_in_call_dummy (struct gdbarch *gdbarch, gdbarch_deprecated_pc_in_call_dummy_ftype *deprecated_pc_in_call_dummy);
-#if (GDB_MULTI_ARCH >= GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_PC_IN_CALL_DUMMY)
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_PC_IN_CALL_DUMMY)
#error "Non multi-arch definition of DEPRECATED_PC_IN_CALL_DUMMY"
#endif
#if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH >= GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_PC_IN_CALL_DUMMY)
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_PC_IN_CALL_DUMMY)
#define DEPRECATED_PC_IN_CALL_DUMMY(pc, sp, frame_address) (gdbarch_deprecated_pc_in_call_dummy (current_gdbarch, pc, sp, frame_address))
#endif
#endif
-extern int gdbarch_call_dummy_p (struct gdbarch *gdbarch);
-extern void set_gdbarch_call_dummy_p (struct gdbarch *gdbarch, int call_dummy_p);
-#if (GDB_MULTI_ARCH >= GDB_MULTI_ARCH_PARTIAL) && defined (CALL_DUMMY_P)
-#error "Non multi-arch definition of CALL_DUMMY_P"
-#endif
-#if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH >= GDB_MULTI_ARCH_PARTIAL) || !defined (CALL_DUMMY_P)
-#define CALL_DUMMY_P (gdbarch_call_dummy_p (current_gdbarch))
-#endif
-#endif
-
/* Default (value) for non- multi-arch platforms. */
#if (!GDB_MULTI_ARCH) && !defined (CALL_DUMMY_WORDS)
#define CALL_DUMMY_WORDS (legacy_call_dummy_words)
@@ -1238,11 +1224,9 @@ extern void set_gdbarch_call_dummy_words (struct gdbarch *gdbarch, LONGEST * cal
#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (CALL_DUMMY_WORDS)
#error "Non multi-arch definition of CALL_DUMMY_WORDS"
#endif
-#if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (CALL_DUMMY_WORDS)
+#if !defined (CALL_DUMMY_WORDS)
#define CALL_DUMMY_WORDS (gdbarch_call_dummy_words (current_gdbarch))
#endif
-#endif
/* Default (value) for non- multi-arch platforms. */
#if (!GDB_MULTI_ARCH) && !defined (SIZEOF_CALL_DUMMY_WORDS)
@@ -1254,34 +1238,71 @@ extern void set_gdbarch_sizeof_call_dummy_words (struct gdbarch *gdbarch, int si
#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (SIZEOF_CALL_DUMMY_WORDS)
#error "Non multi-arch definition of SIZEOF_CALL_DUMMY_WORDS"
#endif
-#if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (SIZEOF_CALL_DUMMY_WORDS)
+#if !defined (SIZEOF_CALL_DUMMY_WORDS)
#define SIZEOF_CALL_DUMMY_WORDS (gdbarch_sizeof_call_dummy_words (current_gdbarch))
#endif
+
+#if defined (DEPRECATED_CALL_DUMMY_STACK_ADJUST)
+/* Legacy for systems yet to multi-arch DEPRECATED_CALL_DUMMY_STACK_ADJUST */
+#if !defined (DEPRECATED_CALL_DUMMY_STACK_ADJUST_P)
+#define DEPRECATED_CALL_DUMMY_STACK_ADJUST_P() (1)
+#endif
#endif
-extern int gdbarch_call_dummy_stack_adjust_p (struct gdbarch *gdbarch);
-extern void set_gdbarch_call_dummy_stack_adjust_p (struct gdbarch *gdbarch, int call_dummy_stack_adjust_p);
-#if (GDB_MULTI_ARCH >= GDB_MULTI_ARCH_PARTIAL) && defined (CALL_DUMMY_STACK_ADJUST_P)
-#error "Non multi-arch definition of CALL_DUMMY_STACK_ADJUST_P"
+/* Default predicate for non- multi-arch targets. */
+#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_CALL_DUMMY_STACK_ADJUST_P)
+#define DEPRECATED_CALL_DUMMY_STACK_ADJUST_P() (0)
#endif
-#if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH >= GDB_MULTI_ARCH_PARTIAL) || !defined (CALL_DUMMY_STACK_ADJUST_P)
-#define CALL_DUMMY_STACK_ADJUST_P (gdbarch_call_dummy_stack_adjust_p (current_gdbarch))
+
+extern int gdbarch_deprecated_call_dummy_stack_adjust_p (struct gdbarch *gdbarch);
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_CALL_DUMMY_STACK_ADJUST_P)
+#error "Non multi-arch definition of DEPRECATED_CALL_DUMMY_STACK_ADJUST"
#endif
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_CALL_DUMMY_STACK_ADJUST_P)
+#define DEPRECATED_CALL_DUMMY_STACK_ADJUST_P() (gdbarch_deprecated_call_dummy_stack_adjust_p (current_gdbarch))
#endif
-extern int gdbarch_call_dummy_stack_adjust (struct gdbarch *gdbarch);
-extern void set_gdbarch_call_dummy_stack_adjust (struct gdbarch *gdbarch, int call_dummy_stack_adjust);
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (CALL_DUMMY_STACK_ADJUST)
-#error "Non multi-arch definition of CALL_DUMMY_STACK_ADJUST"
+/* Default (value) for non- multi-arch platforms. */
+#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_CALL_DUMMY_STACK_ADJUST)
+#define DEPRECATED_CALL_DUMMY_STACK_ADJUST (0)
+#endif
+
+extern int gdbarch_deprecated_call_dummy_stack_adjust (struct gdbarch *gdbarch);
+extern void set_gdbarch_deprecated_call_dummy_stack_adjust (struct gdbarch *gdbarch, int deprecated_call_dummy_stack_adjust);
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_CALL_DUMMY_STACK_ADJUST)
+#error "Non multi-arch definition of DEPRECATED_CALL_DUMMY_STACK_ADJUST"
#endif
#if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (CALL_DUMMY_STACK_ADJUST)
-#define CALL_DUMMY_STACK_ADJUST (gdbarch_call_dummy_stack_adjust (current_gdbarch))
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_CALL_DUMMY_STACK_ADJUST)
+#define DEPRECATED_CALL_DUMMY_STACK_ADJUST (gdbarch_deprecated_call_dummy_stack_adjust (current_gdbarch))
+#endif
+#endif
+
+#if defined (FIX_CALL_DUMMY)
+/* Legacy for systems yet to multi-arch FIX_CALL_DUMMY */
+#if !defined (FIX_CALL_DUMMY_P)
+#define FIX_CALL_DUMMY_P() (1)
#endif
#endif
+/* Default predicate for non- multi-arch targets. */
+#if (!GDB_MULTI_ARCH) && !defined (FIX_CALL_DUMMY_P)
+#define FIX_CALL_DUMMY_P() (0)
+#endif
+
+extern int gdbarch_fix_call_dummy_p (struct gdbarch *gdbarch);
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (FIX_CALL_DUMMY_P)
+#error "Non multi-arch definition of FIX_CALL_DUMMY"
+#endif
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (FIX_CALL_DUMMY_P)
+#define FIX_CALL_DUMMY_P() (gdbarch_fix_call_dummy_p (current_gdbarch))
+#endif
+
+/* Default (function) for non- multi-arch platforms. */
+#if (!GDB_MULTI_ARCH) && !defined (FIX_CALL_DUMMY)
+#define FIX_CALL_DUMMY(dummy, pc, fun, nargs, args, type, gcc_p) (internal_error (__FILE__, __LINE__, "FIX_CALL_DUMMY"), 0)
+#endif
+
typedef void (gdbarch_fix_call_dummy_ftype) (char *dummy, CORE_ADDR pc, CORE_ADDR fun, int nargs, struct value **args, struct type *type, int gcc_p);
extern void gdbarch_fix_call_dummy (struct gdbarch *gdbarch, char *dummy, CORE_ADDR pc, CORE_ADDR fun, int nargs, struct value **args, struct type *type, int gcc_p);
extern void set_gdbarch_fix_call_dummy (struct gdbarch *gdbarch, gdbarch_fix_call_dummy_ftype *fix_call_dummy);
@@ -1388,40 +1409,40 @@ extern void set_gdbarch_believe_pcc_promotion_type (struct gdbarch *gdbarch, int
#define BELIEVE_PCC_PROMOTION_TYPE (gdbarch_believe_pcc_promotion_type (current_gdbarch))
#endif
-#if defined (GET_SAVED_REGISTER)
-/* Legacy for systems yet to multi-arch GET_SAVED_REGISTER */
-#if !defined (GET_SAVED_REGISTER_P)
-#define GET_SAVED_REGISTER_P() (1)
+#if defined (DEPRECATED_GET_SAVED_REGISTER)
+/* Legacy for systems yet to multi-arch DEPRECATED_GET_SAVED_REGISTER */
+#if !defined (DEPRECATED_GET_SAVED_REGISTER_P)
+#define DEPRECATED_GET_SAVED_REGISTER_P() (1)
#endif
#endif
/* Default predicate for non- multi-arch targets. */
-#if (!GDB_MULTI_ARCH) && !defined (GET_SAVED_REGISTER_P)
-#define GET_SAVED_REGISTER_P() (0)
+#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_GET_SAVED_REGISTER_P)
+#define DEPRECATED_GET_SAVED_REGISTER_P() (0)
#endif
-extern int gdbarch_get_saved_register_p (struct gdbarch *gdbarch);
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (GET_SAVED_REGISTER_P)
-#error "Non multi-arch definition of GET_SAVED_REGISTER"
+extern int gdbarch_deprecated_get_saved_register_p (struct gdbarch *gdbarch);
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_GET_SAVED_REGISTER_P)
+#error "Non multi-arch definition of DEPRECATED_GET_SAVED_REGISTER"
#endif
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (GET_SAVED_REGISTER_P)
-#define GET_SAVED_REGISTER_P() (gdbarch_get_saved_register_p (current_gdbarch))
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_GET_SAVED_REGISTER_P)
+#define DEPRECATED_GET_SAVED_REGISTER_P() (gdbarch_deprecated_get_saved_register_p (current_gdbarch))
#endif
/* Default (function) for non- multi-arch platforms. */
-#if (!GDB_MULTI_ARCH) && !defined (GET_SAVED_REGISTER)
-#define GET_SAVED_REGISTER(raw_buffer, optimized, addrp, frame, regnum, lval) (internal_error (__FILE__, __LINE__, "GET_SAVED_REGISTER"), 0)
+#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_GET_SAVED_REGISTER)
+#define DEPRECATED_GET_SAVED_REGISTER(raw_buffer, optimized, addrp, frame, regnum, lval) (internal_error (__FILE__, __LINE__, "DEPRECATED_GET_SAVED_REGISTER"), 0)
#endif
-typedef void (gdbarch_get_saved_register_ftype) (char *raw_buffer, int *optimized, CORE_ADDR *addrp, struct frame_info *frame, int regnum, enum lval_type *lval);
-extern void gdbarch_get_saved_register (struct gdbarch *gdbarch, char *raw_buffer, int *optimized, CORE_ADDR *addrp, struct frame_info *frame, int regnum, enum lval_type *lval);
-extern void set_gdbarch_get_saved_register (struct gdbarch *gdbarch, gdbarch_get_saved_register_ftype *get_saved_register);
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (GET_SAVED_REGISTER)
-#error "Non multi-arch definition of GET_SAVED_REGISTER"
+typedef void (gdbarch_deprecated_get_saved_register_ftype) (char *raw_buffer, int *optimized, CORE_ADDR *addrp, struct frame_info *frame, int regnum, enum lval_type *lval);
+extern void gdbarch_deprecated_get_saved_register (struct gdbarch *gdbarch, char *raw_buffer, int *optimized, CORE_ADDR *addrp, struct frame_info *frame, int regnum, enum lval_type *lval);
+extern void set_gdbarch_deprecated_get_saved_register (struct gdbarch *gdbarch, gdbarch_deprecated_get_saved_register_ftype *deprecated_get_saved_register);
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_GET_SAVED_REGISTER)
+#error "Non multi-arch definition of DEPRECATED_GET_SAVED_REGISTER"
#endif
#if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (GET_SAVED_REGISTER)
-#define GET_SAVED_REGISTER(raw_buffer, optimized, addrp, frame, regnum, lval) (gdbarch_get_saved_register (current_gdbarch, raw_buffer, optimized, addrp, frame, regnum, lval))
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_GET_SAVED_REGISTER)
+#define DEPRECATED_GET_SAVED_REGISTER(raw_buffer, optimized, addrp, frame, regnum, lval) (gdbarch_deprecated_get_saved_register (current_gdbarch, raw_buffer, optimized, addrp, frame, regnum, lval))
#endif
#endif
@@ -1615,23 +1636,51 @@ extern void set_gdbarch_return_value_on_stack (struct gdbarch *gdbarch, gdbarch_
#endif
#endif
+/* Replaced by PUSH_DUMMY_CALL */
+
+#if defined (DEPRECATED_PUSH_ARGUMENTS)
+/* Legacy for systems yet to multi-arch DEPRECATED_PUSH_ARGUMENTS */
+#if !defined (DEPRECATED_PUSH_ARGUMENTS_P)
+#define DEPRECATED_PUSH_ARGUMENTS_P() (1)
+#endif
+#endif
+
+/* Default predicate for non- multi-arch targets. */
+#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_PUSH_ARGUMENTS_P)
+#define DEPRECATED_PUSH_ARGUMENTS_P() (0)
+#endif
+
+extern int gdbarch_deprecated_push_arguments_p (struct gdbarch *gdbarch);
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_PUSH_ARGUMENTS_P)
+#error "Non multi-arch definition of DEPRECATED_PUSH_ARGUMENTS"
+#endif
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_PUSH_ARGUMENTS_P)
+#define DEPRECATED_PUSH_ARGUMENTS_P() (gdbarch_deprecated_push_arguments_p (current_gdbarch))
+#endif
+
/* Default (function) for non- multi-arch platforms. */
-#if (!GDB_MULTI_ARCH) && !defined (PUSH_ARGUMENTS)
-#define PUSH_ARGUMENTS(nargs, args, sp, struct_return, struct_addr) (default_push_arguments (nargs, args, sp, struct_return, struct_addr))
+#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_PUSH_ARGUMENTS)
+#define DEPRECATED_PUSH_ARGUMENTS(nargs, args, sp, struct_return, struct_addr) (internal_error (__FILE__, __LINE__, "DEPRECATED_PUSH_ARGUMENTS"), 0)
#endif
-typedef CORE_ADDR (gdbarch_push_arguments_ftype) (int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr);
-extern CORE_ADDR gdbarch_push_arguments (struct gdbarch *gdbarch, int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr);
-extern void set_gdbarch_push_arguments (struct gdbarch *gdbarch, gdbarch_push_arguments_ftype *push_arguments);
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (PUSH_ARGUMENTS)
-#error "Non multi-arch definition of PUSH_ARGUMENTS"
+typedef CORE_ADDR (gdbarch_deprecated_push_arguments_ftype) (int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr);
+extern CORE_ADDR gdbarch_deprecated_push_arguments (struct gdbarch *gdbarch, int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr);
+extern void set_gdbarch_deprecated_push_arguments (struct gdbarch *gdbarch, gdbarch_deprecated_push_arguments_ftype *deprecated_push_arguments);
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_PUSH_ARGUMENTS)
+#error "Non multi-arch definition of DEPRECATED_PUSH_ARGUMENTS"
#endif
#if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (PUSH_ARGUMENTS)
-#define PUSH_ARGUMENTS(nargs, args, sp, struct_return, struct_addr) (gdbarch_push_arguments (current_gdbarch, nargs, args, sp, struct_return, struct_addr))
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_PUSH_ARGUMENTS)
+#define DEPRECATED_PUSH_ARGUMENTS(nargs, args, sp, struct_return, struct_addr) (gdbarch_deprecated_push_arguments (current_gdbarch, nargs, args, sp, struct_return, struct_addr))
#endif
#endif
+extern int gdbarch_push_dummy_call_p (struct gdbarch *gdbarch);
+
+typedef CORE_ADDR (gdbarch_push_dummy_call_ftype) (struct gdbarch *gdbarch, struct regcache *regcache, CORE_ADDR dummy_addr, int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr);
+extern CORE_ADDR gdbarch_push_dummy_call (struct gdbarch *gdbarch, struct regcache *regcache, CORE_ADDR dummy_addr, int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr);
+extern void set_gdbarch_push_dummy_call (struct gdbarch *gdbarch, gdbarch_push_dummy_call_ftype *push_dummy_call);
+
#if defined (DEPRECATED_PUSH_DUMMY_FRAME)
/* Legacy for systems yet to multi-arch DEPRECATED_PUSH_DUMMY_FRAME */
#if !defined (DEPRECATED_PUSH_DUMMY_FRAME_P)
@@ -1655,7 +1704,6 @@ extern int gdbarch_deprecated_push_dummy_frame_p (struct gdbarch *gdbarch);
/* Default (function) for non- multi-arch platforms. */
#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_PUSH_DUMMY_FRAME)
#define DEPRECATED_PUSH_DUMMY_FRAME (internal_error (__FILE__, __LINE__, "DEPRECATED_PUSH_DUMMY_FRAME"), 0)
-#define DEPRECATED_PUSH_DUMMY_FRAME (gdbarch_deprecated_push_dummy_frame (current_gdbarch))
#endif
typedef void (gdbarch_deprecated_push_dummy_frame_ftype) (void);
@@ -1670,90 +1718,118 @@ extern void set_gdbarch_deprecated_push_dummy_frame (struct gdbarch *gdbarch, gd
#endif
#endif
-#if defined (PUSH_RETURN_ADDRESS)
-/* Legacy for systems yet to multi-arch PUSH_RETURN_ADDRESS */
-#if !defined (PUSH_RETURN_ADDRESS_P)
-#define PUSH_RETURN_ADDRESS_P() (1)
+/* NOTE: This can be handled directly in push_dummy_call. */
+
+#if defined (DEPRECATED_PUSH_RETURN_ADDRESS)
+/* Legacy for systems yet to multi-arch DEPRECATED_PUSH_RETURN_ADDRESS */
+#if !defined (DEPRECATED_PUSH_RETURN_ADDRESS_P)
+#define DEPRECATED_PUSH_RETURN_ADDRESS_P() (1)
#endif
#endif
/* Default predicate for non- multi-arch targets. */
-#if (!GDB_MULTI_ARCH) && !defined (PUSH_RETURN_ADDRESS_P)
-#define PUSH_RETURN_ADDRESS_P() (0)
+#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_PUSH_RETURN_ADDRESS_P)
+#define DEPRECATED_PUSH_RETURN_ADDRESS_P() (0)
#endif
-extern int gdbarch_push_return_address_p (struct gdbarch *gdbarch);
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (PUSH_RETURN_ADDRESS_P)
-#error "Non multi-arch definition of PUSH_RETURN_ADDRESS"
+extern int gdbarch_deprecated_push_return_address_p (struct gdbarch *gdbarch);
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_PUSH_RETURN_ADDRESS_P)
+#error "Non multi-arch definition of DEPRECATED_PUSH_RETURN_ADDRESS"
#endif
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (PUSH_RETURN_ADDRESS_P)
-#define PUSH_RETURN_ADDRESS_P() (gdbarch_push_return_address_p (current_gdbarch))
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_PUSH_RETURN_ADDRESS_P)
+#define DEPRECATED_PUSH_RETURN_ADDRESS_P() (gdbarch_deprecated_push_return_address_p (current_gdbarch))
#endif
/* Default (function) for non- multi-arch platforms. */
-#if (!GDB_MULTI_ARCH) && !defined (PUSH_RETURN_ADDRESS)
-#define PUSH_RETURN_ADDRESS(pc, sp) (internal_error (__FILE__, __LINE__, "PUSH_RETURN_ADDRESS"), 0)
+#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_PUSH_RETURN_ADDRESS)
+#define DEPRECATED_PUSH_RETURN_ADDRESS(pc, sp) (internal_error (__FILE__, __LINE__, "DEPRECATED_PUSH_RETURN_ADDRESS"), 0)
#endif
-typedef CORE_ADDR (gdbarch_push_return_address_ftype) (CORE_ADDR pc, CORE_ADDR sp);
-extern CORE_ADDR gdbarch_push_return_address (struct gdbarch *gdbarch, CORE_ADDR pc, CORE_ADDR sp);
-extern void set_gdbarch_push_return_address (struct gdbarch *gdbarch, gdbarch_push_return_address_ftype *push_return_address);
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (PUSH_RETURN_ADDRESS)
-#error "Non multi-arch definition of PUSH_RETURN_ADDRESS"
+typedef CORE_ADDR (gdbarch_deprecated_push_return_address_ftype) (CORE_ADDR pc, CORE_ADDR sp);
+extern CORE_ADDR gdbarch_deprecated_push_return_address (struct gdbarch *gdbarch, CORE_ADDR pc, CORE_ADDR sp);
+extern void set_gdbarch_deprecated_push_return_address (struct gdbarch *gdbarch, gdbarch_deprecated_push_return_address_ftype *deprecated_push_return_address);
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_PUSH_RETURN_ADDRESS)
+#error "Non multi-arch definition of DEPRECATED_PUSH_RETURN_ADDRESS"
#endif
#if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (PUSH_RETURN_ADDRESS)
-#define PUSH_RETURN_ADDRESS(pc, sp) (gdbarch_push_return_address (current_gdbarch, pc, sp))
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_PUSH_RETURN_ADDRESS)
+#define DEPRECATED_PUSH_RETURN_ADDRESS(pc, sp) (gdbarch_deprecated_push_return_address (current_gdbarch, pc, sp))
#endif
#endif
-#if defined (POP_FRAME)
-/* Legacy for systems yet to multi-arch POP_FRAME */
-#if !defined (POP_FRAME_P)
-#define POP_FRAME_P() (1)
+#if defined (DEPRECATED_POP_FRAME)
+/* Legacy for systems yet to multi-arch DEPRECATED_POP_FRAME */
+#if !defined (DEPRECATED_POP_FRAME_P)
+#define DEPRECATED_POP_FRAME_P() (1)
#endif
#endif
/* Default predicate for non- multi-arch targets. */
-#if (!GDB_MULTI_ARCH) && !defined (POP_FRAME_P)
-#define POP_FRAME_P() (0)
+#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_POP_FRAME_P)
+#define DEPRECATED_POP_FRAME_P() (0)
#endif
-extern int gdbarch_pop_frame_p (struct gdbarch *gdbarch);
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (POP_FRAME_P)
-#error "Non multi-arch definition of POP_FRAME"
+extern int gdbarch_deprecated_pop_frame_p (struct gdbarch *gdbarch);
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_POP_FRAME_P)
+#error "Non multi-arch definition of DEPRECATED_POP_FRAME"
#endif
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (POP_FRAME_P)
-#define POP_FRAME_P() (gdbarch_pop_frame_p (current_gdbarch))
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_POP_FRAME_P)
+#define DEPRECATED_POP_FRAME_P() (gdbarch_deprecated_pop_frame_p (current_gdbarch))
#endif
/* Default (function) for non- multi-arch platforms. */
-#if (!GDB_MULTI_ARCH) && !defined (POP_FRAME)
-#define POP_FRAME (internal_error (__FILE__, __LINE__, "POP_FRAME"), 0)
-#define POP_FRAME (gdbarch_pop_frame (current_gdbarch))
+#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_POP_FRAME)
+#define DEPRECATED_POP_FRAME (internal_error (__FILE__, __LINE__, "DEPRECATED_POP_FRAME"), 0)
#endif
-typedef void (gdbarch_pop_frame_ftype) (void);
-extern void gdbarch_pop_frame (struct gdbarch *gdbarch);
-extern void set_gdbarch_pop_frame (struct gdbarch *gdbarch, gdbarch_pop_frame_ftype *pop_frame);
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (POP_FRAME)
-#error "Non multi-arch definition of POP_FRAME"
+typedef void (gdbarch_deprecated_pop_frame_ftype) (void);
+extern void gdbarch_deprecated_pop_frame (struct gdbarch *gdbarch);
+extern void set_gdbarch_deprecated_pop_frame (struct gdbarch *gdbarch, gdbarch_deprecated_pop_frame_ftype *deprecated_pop_frame);
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_POP_FRAME)
+#error "Non multi-arch definition of DEPRECATED_POP_FRAME"
#endif
#if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (POP_FRAME)
-#define POP_FRAME (gdbarch_pop_frame (current_gdbarch))
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_POP_FRAME)
+#define DEPRECATED_POP_FRAME (gdbarch_deprecated_pop_frame (current_gdbarch))
+#endif
+#endif
+
+/* NOTE: cagney/2003-03-24: Replaced by PUSH_ARGUMENTS. */
+
+#if defined (DEPRECATED_STORE_STRUCT_RETURN)
+/* Legacy for systems yet to multi-arch DEPRECATED_STORE_STRUCT_RETURN */
+#if !defined (DEPRECATED_STORE_STRUCT_RETURN_P)
+#define DEPRECATED_STORE_STRUCT_RETURN_P() (1)
+#endif
#endif
+
+/* Default predicate for non- multi-arch targets. */
+#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_STORE_STRUCT_RETURN_P)
+#define DEPRECATED_STORE_STRUCT_RETURN_P() (0)
+#endif
+
+extern int gdbarch_deprecated_store_struct_return_p (struct gdbarch *gdbarch);
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_STORE_STRUCT_RETURN_P)
+#error "Non multi-arch definition of DEPRECATED_STORE_STRUCT_RETURN"
+#endif
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_STORE_STRUCT_RETURN_P)
+#define DEPRECATED_STORE_STRUCT_RETURN_P() (gdbarch_deprecated_store_struct_return_p (current_gdbarch))
+#endif
+
+/* Default (function) for non- multi-arch platforms. */
+#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_STORE_STRUCT_RETURN)
+#define DEPRECATED_STORE_STRUCT_RETURN(addr, sp) (internal_error (__FILE__, __LINE__, "DEPRECATED_STORE_STRUCT_RETURN"), 0)
#endif
-typedef void (gdbarch_store_struct_return_ftype) (CORE_ADDR addr, CORE_ADDR sp);
-extern void gdbarch_store_struct_return (struct gdbarch *gdbarch, CORE_ADDR addr, CORE_ADDR sp);
-extern void set_gdbarch_store_struct_return (struct gdbarch *gdbarch, gdbarch_store_struct_return_ftype *store_struct_return);
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (STORE_STRUCT_RETURN)
-#error "Non multi-arch definition of STORE_STRUCT_RETURN"
+typedef void (gdbarch_deprecated_store_struct_return_ftype) (CORE_ADDR addr, CORE_ADDR sp);
+extern void gdbarch_deprecated_store_struct_return (struct gdbarch *gdbarch, CORE_ADDR addr, CORE_ADDR sp);
+extern void set_gdbarch_deprecated_store_struct_return (struct gdbarch *gdbarch, gdbarch_deprecated_store_struct_return_ftype *deprecated_store_struct_return);
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_STORE_STRUCT_RETURN)
+#error "Non multi-arch definition of DEPRECATED_STORE_STRUCT_RETURN"
#endif
#if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (STORE_STRUCT_RETURN)
-#define STORE_STRUCT_RETURN(addr, sp) (gdbarch_store_struct_return (current_gdbarch, addr, sp))
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_STORE_STRUCT_RETURN)
+#define DEPRECATED_STORE_STRUCT_RETURN(addr, sp) (gdbarch_deprecated_store_struct_return (current_gdbarch, addr, sp))
#endif
#endif
@@ -2156,117 +2232,127 @@ extern void set_gdbarch_frameless_function_invocation (struct gdbarch *gdbarch,
#endif
#endif
-#if defined (FRAME_CHAIN)
-/* Legacy for systems yet to multi-arch FRAME_CHAIN */
-#if !defined (FRAME_CHAIN_P)
-#define FRAME_CHAIN_P() (1)
+#if defined (DEPRECATED_FRAME_CHAIN)
+/* Legacy for systems yet to multi-arch DEPRECATED_FRAME_CHAIN */
+#if !defined (DEPRECATED_FRAME_CHAIN_P)
+#define DEPRECATED_FRAME_CHAIN_P() (1)
#endif
#endif
/* Default predicate for non- multi-arch targets. */
-#if (!GDB_MULTI_ARCH) && !defined (FRAME_CHAIN_P)
-#define FRAME_CHAIN_P() (0)
+#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_FRAME_CHAIN_P)
+#define DEPRECATED_FRAME_CHAIN_P() (0)
#endif
-extern int gdbarch_frame_chain_p (struct gdbarch *gdbarch);
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (FRAME_CHAIN_P)
-#error "Non multi-arch definition of FRAME_CHAIN"
+extern int gdbarch_deprecated_frame_chain_p (struct gdbarch *gdbarch);
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_FRAME_CHAIN_P)
+#error "Non multi-arch definition of DEPRECATED_FRAME_CHAIN"
#endif
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (FRAME_CHAIN_P)
-#define FRAME_CHAIN_P() (gdbarch_frame_chain_p (current_gdbarch))
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_FRAME_CHAIN_P)
+#define DEPRECATED_FRAME_CHAIN_P() (gdbarch_deprecated_frame_chain_p (current_gdbarch))
#endif
/* Default (function) for non- multi-arch platforms. */
-#if (!GDB_MULTI_ARCH) && !defined (FRAME_CHAIN)
-#define FRAME_CHAIN(frame) (internal_error (__FILE__, __LINE__, "FRAME_CHAIN"), 0)
+#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_FRAME_CHAIN)
+#define DEPRECATED_FRAME_CHAIN(frame) (internal_error (__FILE__, __LINE__, "DEPRECATED_FRAME_CHAIN"), 0)
#endif
-typedef CORE_ADDR (gdbarch_frame_chain_ftype) (struct frame_info *frame);
-extern CORE_ADDR gdbarch_frame_chain (struct gdbarch *gdbarch, struct frame_info *frame);
-extern void set_gdbarch_frame_chain (struct gdbarch *gdbarch, gdbarch_frame_chain_ftype *frame_chain);
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (FRAME_CHAIN)
-#error "Non multi-arch definition of FRAME_CHAIN"
+typedef CORE_ADDR (gdbarch_deprecated_frame_chain_ftype) (struct frame_info *frame);
+extern CORE_ADDR gdbarch_deprecated_frame_chain (struct gdbarch *gdbarch, struct frame_info *frame);
+extern void set_gdbarch_deprecated_frame_chain (struct gdbarch *gdbarch, gdbarch_deprecated_frame_chain_ftype *deprecated_frame_chain);
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_FRAME_CHAIN)
+#error "Non multi-arch definition of DEPRECATED_FRAME_CHAIN"
#endif
#if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (FRAME_CHAIN)
-#define FRAME_CHAIN(frame) (gdbarch_frame_chain (current_gdbarch, frame))
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_FRAME_CHAIN)
+#define DEPRECATED_FRAME_CHAIN(frame) (gdbarch_deprecated_frame_chain (current_gdbarch, frame))
#endif
#endif
-#if defined (FRAME_CHAIN_VALID)
-/* Legacy for systems yet to multi-arch FRAME_CHAIN_VALID */
-#if !defined (FRAME_CHAIN_VALID_P)
-#define FRAME_CHAIN_VALID_P() (1)
+#if defined (DEPRECATED_FRAME_CHAIN_VALID)
+/* Legacy for systems yet to multi-arch DEPRECATED_FRAME_CHAIN_VALID */
+#if !defined (DEPRECATED_FRAME_CHAIN_VALID_P)
+#define DEPRECATED_FRAME_CHAIN_VALID_P() (1)
#endif
#endif
/* Default predicate for non- multi-arch targets. */
-#if (!GDB_MULTI_ARCH) && !defined (FRAME_CHAIN_VALID_P)
-#define FRAME_CHAIN_VALID_P() (0)
+#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_FRAME_CHAIN_VALID_P)
+#define DEPRECATED_FRAME_CHAIN_VALID_P() (0)
#endif
-extern int gdbarch_frame_chain_valid_p (struct gdbarch *gdbarch);
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (FRAME_CHAIN_VALID_P)
-#error "Non multi-arch definition of FRAME_CHAIN_VALID"
+extern int gdbarch_deprecated_frame_chain_valid_p (struct gdbarch *gdbarch);
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_FRAME_CHAIN_VALID_P)
+#error "Non multi-arch definition of DEPRECATED_FRAME_CHAIN_VALID"
#endif
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (FRAME_CHAIN_VALID_P)
-#define FRAME_CHAIN_VALID_P() (gdbarch_frame_chain_valid_p (current_gdbarch))
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_FRAME_CHAIN_VALID_P)
+#define DEPRECATED_FRAME_CHAIN_VALID_P() (gdbarch_deprecated_frame_chain_valid_p (current_gdbarch))
#endif
/* Default (function) for non- multi-arch platforms. */
-#if (!GDB_MULTI_ARCH) && !defined (FRAME_CHAIN_VALID)
-#define FRAME_CHAIN_VALID(chain, thisframe) (internal_error (__FILE__, __LINE__, "FRAME_CHAIN_VALID"), 0)
+#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_FRAME_CHAIN_VALID)
+#define DEPRECATED_FRAME_CHAIN_VALID(chain, thisframe) (internal_error (__FILE__, __LINE__, "DEPRECATED_FRAME_CHAIN_VALID"), 0)
#endif
-typedef int (gdbarch_frame_chain_valid_ftype) (CORE_ADDR chain, struct frame_info *thisframe);
-extern int gdbarch_frame_chain_valid (struct gdbarch *gdbarch, CORE_ADDR chain, struct frame_info *thisframe);
-extern void set_gdbarch_frame_chain_valid (struct gdbarch *gdbarch, gdbarch_frame_chain_valid_ftype *frame_chain_valid);
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (FRAME_CHAIN_VALID)
-#error "Non multi-arch definition of FRAME_CHAIN_VALID"
+typedef int (gdbarch_deprecated_frame_chain_valid_ftype) (CORE_ADDR chain, struct frame_info *thisframe);
+extern int gdbarch_deprecated_frame_chain_valid (struct gdbarch *gdbarch, CORE_ADDR chain, struct frame_info *thisframe);
+extern void set_gdbarch_deprecated_frame_chain_valid (struct gdbarch *gdbarch, gdbarch_deprecated_frame_chain_valid_ftype *deprecated_frame_chain_valid);
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_FRAME_CHAIN_VALID)
+#error "Non multi-arch definition of DEPRECATED_FRAME_CHAIN_VALID"
#endif
#if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (FRAME_CHAIN_VALID)
-#define FRAME_CHAIN_VALID(chain, thisframe) (gdbarch_frame_chain_valid (current_gdbarch, chain, thisframe))
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_FRAME_CHAIN_VALID)
+#define DEPRECATED_FRAME_CHAIN_VALID(chain, thisframe) (gdbarch_deprecated_frame_chain_valid (current_gdbarch, chain, thisframe))
#endif
#endif
-#if defined (FRAME_SAVED_PC)
-/* Legacy for systems yet to multi-arch FRAME_SAVED_PC */
-#if !defined (FRAME_SAVED_PC_P)
-#define FRAME_SAVED_PC_P() (1)
+/* DEPRECATED_FRAME_SAVED_PC has been replaced by UNWIND_PC. Please
+ note, per UNWIND_PC's doco, that while the two have similar
+ interfaces they have very different underlying implementations. */
+
+#if defined (DEPRECATED_FRAME_SAVED_PC)
+/* Legacy for systems yet to multi-arch DEPRECATED_FRAME_SAVED_PC */
+#if !defined (DEPRECATED_FRAME_SAVED_PC_P)
+#define DEPRECATED_FRAME_SAVED_PC_P() (1)
#endif
#endif
/* Default predicate for non- multi-arch targets. */
-#if (!GDB_MULTI_ARCH) && !defined (FRAME_SAVED_PC_P)
-#define FRAME_SAVED_PC_P() (0)
+#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_FRAME_SAVED_PC_P)
+#define DEPRECATED_FRAME_SAVED_PC_P() (0)
#endif
-extern int gdbarch_frame_saved_pc_p (struct gdbarch *gdbarch);
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (FRAME_SAVED_PC_P)
-#error "Non multi-arch definition of FRAME_SAVED_PC"
+extern int gdbarch_deprecated_frame_saved_pc_p (struct gdbarch *gdbarch);
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_FRAME_SAVED_PC_P)
+#error "Non multi-arch definition of DEPRECATED_FRAME_SAVED_PC"
#endif
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (FRAME_SAVED_PC_P)
-#define FRAME_SAVED_PC_P() (gdbarch_frame_saved_pc_p (current_gdbarch))
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_FRAME_SAVED_PC_P)
+#define DEPRECATED_FRAME_SAVED_PC_P() (gdbarch_deprecated_frame_saved_pc_p (current_gdbarch))
#endif
/* Default (function) for non- multi-arch platforms. */
-#if (!GDB_MULTI_ARCH) && !defined (FRAME_SAVED_PC)
-#define FRAME_SAVED_PC(fi) (internal_error (__FILE__, __LINE__, "FRAME_SAVED_PC"), 0)
+#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_FRAME_SAVED_PC)
+#define DEPRECATED_FRAME_SAVED_PC(fi) (internal_error (__FILE__, __LINE__, "DEPRECATED_FRAME_SAVED_PC"), 0)
#endif
-typedef CORE_ADDR (gdbarch_frame_saved_pc_ftype) (struct frame_info *fi);
-extern CORE_ADDR gdbarch_frame_saved_pc (struct gdbarch *gdbarch, struct frame_info *fi);
-extern void set_gdbarch_frame_saved_pc (struct gdbarch *gdbarch, gdbarch_frame_saved_pc_ftype *frame_saved_pc);
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (FRAME_SAVED_PC)
-#error "Non multi-arch definition of FRAME_SAVED_PC"
+typedef CORE_ADDR (gdbarch_deprecated_frame_saved_pc_ftype) (struct frame_info *fi);
+extern CORE_ADDR gdbarch_deprecated_frame_saved_pc (struct gdbarch *gdbarch, struct frame_info *fi);
+extern void set_gdbarch_deprecated_frame_saved_pc (struct gdbarch *gdbarch, gdbarch_deprecated_frame_saved_pc_ftype *deprecated_frame_saved_pc);
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_FRAME_SAVED_PC)
+#error "Non multi-arch definition of DEPRECATED_FRAME_SAVED_PC"
#endif
#if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (FRAME_SAVED_PC)
-#define FRAME_SAVED_PC(fi) (gdbarch_frame_saved_pc (current_gdbarch, fi))
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_FRAME_SAVED_PC)
+#define DEPRECATED_FRAME_SAVED_PC(fi) (gdbarch_deprecated_frame_saved_pc (current_gdbarch, fi))
#endif
#endif
+extern int gdbarch_unwind_pc_p (struct gdbarch *gdbarch);
+
+typedef CORE_ADDR (gdbarch_unwind_pc_ftype) (struct gdbarch *gdbarch, struct frame_info *next_frame);
+extern CORE_ADDR gdbarch_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame);
+extern void set_gdbarch_unwind_pc (struct gdbarch *gdbarch, gdbarch_unwind_pc_ftype *unwind_pc);
+
/* Default (function) for non- multi-arch platforms. */
#if (!GDB_MULTI_ARCH) && !defined (FRAME_ARGS_ADDRESS)
#define FRAME_ARGS_ADDRESS(fi) (get_frame_base (fi))
@@ -2301,15 +2387,40 @@ extern void set_gdbarch_frame_locals_address (struct gdbarch *gdbarch, gdbarch_f
#endif
#endif
-typedef CORE_ADDR (gdbarch_saved_pc_after_call_ftype) (struct frame_info *frame);
-extern CORE_ADDR gdbarch_saved_pc_after_call (struct gdbarch *gdbarch, struct frame_info *frame);
-extern void set_gdbarch_saved_pc_after_call (struct gdbarch *gdbarch, gdbarch_saved_pc_after_call_ftype *saved_pc_after_call);
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (SAVED_PC_AFTER_CALL)
-#error "Non multi-arch definition of SAVED_PC_AFTER_CALL"
+#if defined (DEPRECATED_SAVED_PC_AFTER_CALL)
+/* Legacy for systems yet to multi-arch DEPRECATED_SAVED_PC_AFTER_CALL */
+#if !defined (DEPRECATED_SAVED_PC_AFTER_CALL_P)
+#define DEPRECATED_SAVED_PC_AFTER_CALL_P() (1)
+#endif
+#endif
+
+/* Default predicate for non- multi-arch targets. */
+#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_SAVED_PC_AFTER_CALL_P)
+#define DEPRECATED_SAVED_PC_AFTER_CALL_P() (0)
+#endif
+
+extern int gdbarch_deprecated_saved_pc_after_call_p (struct gdbarch *gdbarch);
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_SAVED_PC_AFTER_CALL_P)
+#error "Non multi-arch definition of DEPRECATED_SAVED_PC_AFTER_CALL"
+#endif
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_SAVED_PC_AFTER_CALL_P)
+#define DEPRECATED_SAVED_PC_AFTER_CALL_P() (gdbarch_deprecated_saved_pc_after_call_p (current_gdbarch))
+#endif
+
+/* Default (function) for non- multi-arch platforms. */
+#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_SAVED_PC_AFTER_CALL)
+#define DEPRECATED_SAVED_PC_AFTER_CALL(frame) (internal_error (__FILE__, __LINE__, "DEPRECATED_SAVED_PC_AFTER_CALL"), 0)
+#endif
+
+typedef CORE_ADDR (gdbarch_deprecated_saved_pc_after_call_ftype) (struct frame_info *frame);
+extern CORE_ADDR gdbarch_deprecated_saved_pc_after_call (struct gdbarch *gdbarch, struct frame_info *frame);
+extern void set_gdbarch_deprecated_saved_pc_after_call (struct gdbarch *gdbarch, gdbarch_deprecated_saved_pc_after_call_ftype *deprecated_saved_pc_after_call);
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_SAVED_PC_AFTER_CALL)
+#error "Non multi-arch definition of DEPRECATED_SAVED_PC_AFTER_CALL"
#endif
#if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (SAVED_PC_AFTER_CALL)
-#define SAVED_PC_AFTER_CALL(frame) (gdbarch_saved_pc_after_call (current_gdbarch, frame))
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_SAVED_PC_AFTER_CALL)
+#define DEPRECATED_SAVED_PC_AFTER_CALL(frame) (gdbarch_deprecated_saved_pc_after_call (current_gdbarch, frame))
#endif
#endif
@@ -2368,19 +2479,21 @@ typedef CORE_ADDR (gdbarch_frame_align_ftype) (struct gdbarch *gdbarch, CORE_ADD
extern CORE_ADDR gdbarch_frame_align (struct gdbarch *gdbarch, CORE_ADDR address);
extern void set_gdbarch_frame_align (struct gdbarch *gdbarch, gdbarch_frame_align_ftype *frame_align);
+/* NOTE: cagney/2003-03-24: This is better handled by PUSH_ARGUMENTS. */
+
/* Default (value) for non- multi-arch platforms. */
-#if (!GDB_MULTI_ARCH) && !defined (EXTRA_STACK_ALIGNMENT_NEEDED)
-#define EXTRA_STACK_ALIGNMENT_NEEDED (1)
+#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_EXTRA_STACK_ALIGNMENT_NEEDED)
+#define DEPRECATED_EXTRA_STACK_ALIGNMENT_NEEDED (0)
#endif
-extern int gdbarch_extra_stack_alignment_needed (struct gdbarch *gdbarch);
-extern void set_gdbarch_extra_stack_alignment_needed (struct gdbarch *gdbarch, int extra_stack_alignment_needed);
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (EXTRA_STACK_ALIGNMENT_NEEDED)
-#error "Non multi-arch definition of EXTRA_STACK_ALIGNMENT_NEEDED"
+extern int gdbarch_deprecated_extra_stack_alignment_needed (struct gdbarch *gdbarch);
+extern void set_gdbarch_deprecated_extra_stack_alignment_needed (struct gdbarch *gdbarch, int deprecated_extra_stack_alignment_needed);
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_EXTRA_STACK_ALIGNMENT_NEEDED)
+#error "Non multi-arch definition of DEPRECATED_EXTRA_STACK_ALIGNMENT_NEEDED"
#endif
#if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (EXTRA_STACK_ALIGNMENT_NEEDED)
-#define EXTRA_STACK_ALIGNMENT_NEEDED (gdbarch_extra_stack_alignment_needed (current_gdbarch))
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_EXTRA_STACK_ALIGNMENT_NEEDED)
+#define DEPRECATED_EXTRA_STACK_ALIGNMENT_NEEDED (gdbarch_deprecated_extra_stack_alignment_needed (current_gdbarch))
#endif
#endif
@@ -2421,6 +2534,9 @@ extern void set_gdbarch_reg_struct_has_addr (struct gdbarch *gdbarch, gdbarch_re
#endif
#endif
+/* FIXME: kettenis/2003-03-08: This should be replaced by a function
+ parametrized with (at least) the regcache. */
+
#if defined (SAVE_DUMMY_FRAME_TOS)
/* Legacy for systems yet to multi-arch SAVE_DUMMY_FRAME_TOS */
#if !defined (SAVE_DUMMY_FRAME_TOS_P)
@@ -2458,6 +2574,12 @@ extern void set_gdbarch_save_dummy_frame_tos (struct gdbarch *gdbarch, gdbarch_s
#endif
#endif
+extern int gdbarch_unwind_dummy_id_p (struct gdbarch *gdbarch);
+
+typedef struct frame_id (gdbarch_unwind_dummy_id_ftype) (struct gdbarch *gdbarch, struct frame_info *info);
+extern struct frame_id gdbarch_unwind_dummy_id (struct gdbarch *gdbarch, struct frame_info *info);
+extern void set_gdbarch_unwind_dummy_id (struct gdbarch *gdbarch, gdbarch_unwind_dummy_id_ftype *unwind_dummy_id);
+
extern int gdbarch_parm_boundary (struct gdbarch *gdbarch);
extern void set_gdbarch_parm_boundary (struct gdbarch *gdbarch, int parm_boundary);
#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (PARM_BOUNDARY)
diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh
index 12953c2..7a17b63 100755
--- a/gdb/gdbarch.sh
+++ b/gdb/gdbarch.sh
@@ -430,7 +430,8 @@ f:2:TARGET_READ_PC:CORE_ADDR:read_pc:ptid_t ptid:ptid::0:generic_target_read_pc:
f:2:TARGET_WRITE_PC:void:write_pc:CORE_ADDR val, ptid_t ptid:val, ptid::0:generic_target_write_pc::0
f:2:TARGET_READ_FP:CORE_ADDR:read_fp:void:::0:generic_target_read_fp::0
f:2:TARGET_READ_SP:CORE_ADDR:read_sp:void:::0:generic_target_read_sp::0
-f:2:TARGET_WRITE_SP:void:write_sp:CORE_ADDR val:val::0:generic_target_write_sp::0
+# The dummy call frame SP should be set by push_dummy_call.
+F:2:DEPRECATED_DUMMY_WRITE_SP:void:deprecated_dummy_write_sp:CORE_ADDR val:val
# Function for getting target's idea of a frame pointer. FIXME: GDB's
# whole scheme for dealing with "frames" and "frame pointers" needs a
# serious shakedown.
@@ -517,31 +518,28 @@ F:2:GET_LONGJMP_TARGET:int:get_longjmp_target:CORE_ADDR *pc:pc::0:0
# behaviour here (and hence entrench it further) gdbarch simply
# reqires that these methods be set up from the word go. This also
# avoids any potential problems with moving beyond multi-arch partial.
-v:1:DEPRECATED_USE_GENERIC_DUMMY_FRAMES:int:deprecated_use_generic_dummy_frames:::::1::0
-v:1:CALL_DUMMY_LOCATION:int:call_dummy_location:::::AT_ENTRY_POINT::0
-f:2:CALL_DUMMY_ADDRESS:CORE_ADDR:call_dummy_address:void:::0:0::gdbarch->call_dummy_location == AT_ENTRY_POINT && gdbarch->call_dummy_address == 0
-v:2:CALL_DUMMY_START_OFFSET:CORE_ADDR:call_dummy_start_offset::::0:-1:::0x%08lx
-v:2:CALL_DUMMY_BREAKPOINT_OFFSET:CORE_ADDR:call_dummy_breakpoint_offset::::0:-1::gdbarch->call_dummy_breakpoint_offset_p && gdbarch->call_dummy_breakpoint_offset == -1:0x%08lx::CALL_DUMMY_BREAKPOINT_OFFSET_P
-v:1:CALL_DUMMY_BREAKPOINT_OFFSET_P:int:call_dummy_breakpoint_offset_p::::0:-1
-v:2:CALL_DUMMY_LENGTH:int:call_dummy_length::::0:-1:::::gdbarch->call_dummy_length >= 0
+v::DEPRECATED_USE_GENERIC_DUMMY_FRAMES:int:deprecated_use_generic_dummy_frames:::::1::0
+v::CALL_DUMMY_LOCATION:int:call_dummy_location:::::AT_ENTRY_POINT::0
+f::CALL_DUMMY_ADDRESS:CORE_ADDR:call_dummy_address:void::::entry_point_address::0
+v::CALL_DUMMY_START_OFFSET:CORE_ADDR:call_dummy_start_offset
+v::CALL_DUMMY_BREAKPOINT_OFFSET:CORE_ADDR:call_dummy_breakpoint_offset
+v::CALL_DUMMY_LENGTH:int:call_dummy_length
# NOTE: cagney/2002-11-24: This function with predicate has a valid
# (callable) initial value. As a consequence, even when the predicate
# is false, the corresponding function works. This simplifies the
# migration process - old code, calling DEPRECATED_PC_IN_CALL_DUMMY(),
# doesn't need to be modified.
-F:1:DEPRECATED_PC_IN_CALL_DUMMY:int:deprecated_pc_in_call_dummy:CORE_ADDR pc, CORE_ADDR sp, CORE_ADDR frame_address:pc, sp, frame_address::generic_pc_in_call_dummy:generic_pc_in_call_dummy
-v:1:CALL_DUMMY_P:int:call_dummy_p::::0:-1
-v:2:CALL_DUMMY_WORDS:LONGEST *:call_dummy_words::::0:legacy_call_dummy_words::0:0x%08lx
-v:2:SIZEOF_CALL_DUMMY_WORDS:int:sizeof_call_dummy_words::::0:legacy_sizeof_call_dummy_words::0:0x%08lx
-v:1:CALL_DUMMY_STACK_ADJUST_P:int:call_dummy_stack_adjust_p::::0:-1:::0x%08lx
-v:2:CALL_DUMMY_STACK_ADJUST:int:call_dummy_stack_adjust::::0:::gdbarch->call_dummy_stack_adjust_p && gdbarch->call_dummy_stack_adjust == 0:0x%08lx::CALL_DUMMY_STACK_ADJUST_P
-f:2:FIX_CALL_DUMMY:void:fix_call_dummy:char *dummy, CORE_ADDR pc, CORE_ADDR fun, int nargs, struct value **args, struct type *type, int gcc_p:dummy, pc, fun, nargs, args, type, gcc_p:::0
+F::DEPRECATED_PC_IN_CALL_DUMMY:int:deprecated_pc_in_call_dummy:CORE_ADDR pc, CORE_ADDR sp, CORE_ADDR frame_address:pc, sp, frame_address::generic_pc_in_call_dummy:generic_pc_in_call_dummy
+v::CALL_DUMMY_WORDS:LONGEST *:call_dummy_words::::0:legacy_call_dummy_words::0:0x%08lx
+v::SIZEOF_CALL_DUMMY_WORDS:int:sizeof_call_dummy_words::::0:legacy_sizeof_call_dummy_words::0
+V:2:DEPRECATED_CALL_DUMMY_STACK_ADJUST:int:deprecated_call_dummy_stack_adjust::::0
+F::FIX_CALL_DUMMY:void:fix_call_dummy:char *dummy, CORE_ADDR pc, CORE_ADDR fun, int nargs, struct value **args, struct type *type, int gcc_p:dummy, pc, fun, nargs, args, type, gcc_p
F:2:DEPRECATED_INIT_FRAME_PC_FIRST:CORE_ADDR:deprecated_init_frame_pc_first:int fromleaf, struct frame_info *prev:fromleaf, prev
F:2:DEPRECATED_INIT_FRAME_PC:CORE_ADDR:deprecated_init_frame_pc:int fromleaf, struct frame_info *prev:fromleaf, prev
#
v:2:BELIEVE_PCC_PROMOTION:int:believe_pcc_promotion:::::::
v::BELIEVE_PCC_PROMOTION_TYPE:int:believe_pcc_promotion_type:::::::
-F:2:GET_SAVED_REGISTER:void:get_saved_register:char *raw_buffer, int *optimized, CORE_ADDR *addrp, struct frame_info *frame, int regnum, enum lval_type *lval:raw_buffer, optimized, addrp, frame, regnum, lval
+F:2:DEPRECATED_GET_SAVED_REGISTER:void:deprecated_get_saved_register:char *raw_buffer, int *optimized, CORE_ADDR *addrp, struct frame_info *frame, int regnum, enum lval_type *lval:raw_buffer, optimized, addrp, frame, regnum, lval
#
f:2:REGISTER_CONVERTIBLE:int:register_convertible:int nr:nr:::generic_register_convertible_not::0
f:2:REGISTER_CONVERT_TO_VIRTUAL:void:register_convert_to_virtual:int regnum, struct type *type, char *from, char *to:regnum, type, from, to:::0::0
@@ -556,12 +554,15 @@ f:2:ADDRESS_TO_POINTER:void:address_to_pointer:struct type *type, void *buf, COR
F:2:INTEGER_TO_ADDRESS:CORE_ADDR:integer_to_address:struct type *type, void *buf:type, buf
#
f:2:RETURN_VALUE_ON_STACK:int:return_value_on_stack:struct type *type:type:::generic_return_value_on_stack_not::0
-f:2:PUSH_ARGUMENTS:CORE_ADDR:push_arguments:int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr:nargs, args, sp, struct_return, struct_addr:::default_push_arguments::0
+# Replaced by PUSH_DUMMY_CALL
+F:2:DEPRECATED_PUSH_ARGUMENTS:CORE_ADDR:deprecated_push_arguments:int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr:nargs, args, sp, struct_return, struct_addr
+M::PUSH_DUMMY_CALL:CORE_ADDR:push_dummy_call:struct regcache *regcache, CORE_ADDR dummy_addr, int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr:regcache, dummy_addr, nargs, args, sp, struct_return, struct_addr
F:2:DEPRECATED_PUSH_DUMMY_FRAME:void:deprecated_push_dummy_frame:void:-:::0
-F:2:PUSH_RETURN_ADDRESS:CORE_ADDR:push_return_address:CORE_ADDR pc, CORE_ADDR sp:pc, sp:::0
-F:2:POP_FRAME:void:pop_frame:void:-:::0
-#
-f:2:STORE_STRUCT_RETURN:void:store_struct_return:CORE_ADDR addr, CORE_ADDR sp:addr, sp:::0
+# NOTE: This can be handled directly in push_dummy_call.
+F:2:DEPRECATED_PUSH_RETURN_ADDRESS:CORE_ADDR:deprecated_push_return_address:CORE_ADDR pc, CORE_ADDR sp:pc, sp:::0
+F:2:DEPRECATED_POP_FRAME:void:deprecated_pop_frame:void:-:::0
+# NOTE: cagney/2003-03-24: Replaced by PUSH_ARGUMENTS.
+F:2:DEPRECATED_STORE_STRUCT_RETURN:void:deprecated_store_struct_return:CORE_ADDR addr, CORE_ADDR sp:addr, sp:::0
#
f:2:EXTRACT_RETURN_VALUE:void:extract_return_value:struct type *type, struct regcache *regcache, void *valbuf:type, regcache, valbuf:::legacy_extract_return_value::0
f:2:STORE_RETURN_VALUE:void:store_return_value:struct type *type, struct regcache *regcache, const void *valbuf:type, regcache, valbuf:::legacy_store_return_value::0
@@ -589,19 +590,27 @@ f:2:REMOTE_TRANSLATE_XFER_ADDRESS:void:remote_translate_xfer_address:CORE_ADDR g
#
v:2:FRAME_ARGS_SKIP:CORE_ADDR:frame_args_skip::::0:-1
f:2:FRAMELESS_FUNCTION_INVOCATION:int:frameless_function_invocation:struct frame_info *fi:fi:::generic_frameless_function_invocation_not::0
-F:2:FRAME_CHAIN:CORE_ADDR:frame_chain:struct frame_info *frame:frame::0:0
-F:2:FRAME_CHAIN_VALID:int:frame_chain_valid:CORE_ADDR chain, struct frame_info *thisframe:chain, thisframe::0:0
-F:2:FRAME_SAVED_PC:CORE_ADDR:frame_saved_pc:struct frame_info *fi:fi::0:0
+F:2:DEPRECATED_FRAME_CHAIN:CORE_ADDR:deprecated_frame_chain:struct frame_info *frame:frame::0:0
+F:2:DEPRECATED_FRAME_CHAIN_VALID:int:deprecated_frame_chain_valid:CORE_ADDR chain, struct frame_info *thisframe:chain, thisframe::0:0
+# DEPRECATED_FRAME_SAVED_PC has been replaced by UNWIND_PC. Please
+# note, per UNWIND_PC's doco, that while the two have similar
+# interfaces they have very different underlying implementations.
+F:2:DEPRECATED_FRAME_SAVED_PC:CORE_ADDR:deprecated_frame_saved_pc:struct frame_info *fi:fi::0:0
+M::UNWIND_PC:CORE_ADDR:unwind_pc:struct frame_info *next_frame:next_frame:
f:2:FRAME_ARGS_ADDRESS:CORE_ADDR:frame_args_address:struct frame_info *fi:fi::0:get_frame_base::0
f:2:FRAME_LOCALS_ADDRESS:CORE_ADDR:frame_locals_address:struct frame_info *fi:fi::0:get_frame_base::0
-f:2:SAVED_PC_AFTER_CALL:CORE_ADDR:saved_pc_after_call:struct frame_info *frame:frame::0:0
+F::DEPRECATED_SAVED_PC_AFTER_CALL:CORE_ADDR:deprecated_saved_pc_after_call:struct frame_info *frame:frame
f:2:FRAME_NUM_ARGS:int:frame_num_args:struct frame_info *frame:frame::0:0
#
F:2:STACK_ALIGN:CORE_ADDR:stack_align:CORE_ADDR sp:sp::0:0
M:::CORE_ADDR:frame_align:CORE_ADDR address:address
-v:2:EXTRA_STACK_ALIGNMENT_NEEDED:int:extra_stack_alignment_needed::::0:1::0:::
+# NOTE: cagney/2003-03-24: This is better handled by PUSH_ARGUMENTS.
+v:2:DEPRECATED_EXTRA_STACK_ALIGNMENT_NEEDED:int:deprecated_extra_stack_alignment_needed::::0:0::0:::
F:2:REG_STRUCT_HAS_ADDR:int:reg_struct_has_addr:int gcc_p, struct type *type:gcc_p, type::0:0
+# FIXME: kettenis/2003-03-08: This should be replaced by a function
+# parametrized with (at least) the regcache.
F:2:SAVE_DUMMY_FRAME_TOS:void:save_dummy_frame_tos:CORE_ADDR sp:sp::0:0
+M::UNWIND_DUMMY_ID:struct frame_id:unwind_dummy_id:struct frame_info *info:info::0:0
v:2:PARM_BOUNDARY:int:parm_boundary
#
v:2:TARGET_FLOAT_FORMAT:const struct floatformat *:float_format::::::default_float_format (gdbarch)::%s:(TARGET_FLOAT_FORMAT)->name
@@ -795,8 +804,11 @@ cat <<EOF
#if !GDB_MULTI_ARCH
/* Pull in function declarations refered to, indirectly, via macros. */
#include "inferior.h" /* For unsigned_address_to_pointer(). */
+#include "symfile.h" /* For entry_point_address(). */
#endif
+struct floatformat;
+struct ui_file;
struct frame_info;
struct value;
struct objfile;
@@ -810,18 +822,6 @@ extern struct gdbarch *current_gdbarch;
/* If any of the following are defined, the target wasn't correctly
converted. */
-#if GDB_MULTI_ARCH
-#if defined (EXTRA_FRAME_INFO)
-#error "EXTRA_FRAME_INFO: replaced by struct frame_extra_info"
-#endif
-#endif
-
-#if GDB_MULTI_ARCH
-#if defined (FRAME_FIND_SAVED_REGS)
-#error "FRAME_FIND_SAVED_REGS: replaced by DEPRECATED_FRAME_INIT_SAVED_REGS"
-#endif
-#endif
-
#if (GDB_MULTI_ARCH >= GDB_MULTI_ARCH_PURE) && defined (GDB_TM_FILE)
#error "GDB_TM_FILE: Pure multi-arch targets do not have a tm.h file."
#endif
@@ -938,7 +938,6 @@ do
if [ "x${actual}" = "x-" ]
then
printf "#define ${macro} (internal_error (__FILE__, __LINE__, \"${macro}\"), 0)\n"
- printf "#define ${macro} (gdbarch_${function} (current_gdbarch))\n"
else
printf "#define ${macro}(${actual}) (internal_error (__FILE__, __LINE__, \"${macro}\"), 0)\n"
fi
@@ -1296,6 +1295,7 @@ cat <<EOF
#include "gdb-events.h"
#include "reggroups.h"
#include "osabi.h"
+#include "symfile.h" /* For entry_point_address. */
/* Static function declarations */
diff --git a/gdb/gdbcmd.h b/gdb/gdbcmd.h
index 8c4490e..e626eb5 100644
--- a/gdb/gdbcmd.h
+++ b/gdb/gdbcmd.h
@@ -98,6 +98,10 @@ extern struct cmd_list_element *maintenanceinfolist;
extern struct cmd_list_element *maintenanceprintlist;
+/* Chain containing all defined "maintenance list" subcommands. */
+
+extern struct cmd_list_element *maintenancelistlist;
+
extern struct cmd_list_element *setprintlist;
extern struct cmd_list_element *showprintlist;
diff --git a/gdb/gdbcore.h b/gdb/gdbcore.h
index e359b3d..e03ebf4 100644
--- a/gdb/gdbcore.h
+++ b/gdb/gdbcore.h
@@ -24,6 +24,8 @@
#if !defined (GDBCORE_H)
#define GDBCORE_H 1
+struct type;
+
#include "bfd.h"
/* Return the name of the executable file as a string.
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
index 9a02977..63ec899 100644
--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -1,3 +1,14 @@
+2003-03-26 Daniel Jacobowitz <drow@mvista.com>
+
+ * linux-low.c (linux_create_inferior): Use __SIGRTMIN.
+ (linux_wait_for_event, linux_init_signals): Likewise.
+
+2003-03-17 Daniel Jacobowitz <drow@mvista.com>
+
+ * configure.in: Check for stdlib.h.
+ * configure: Regenerated.
+ * config.in: Regenerated.
+
2003-01-04 Andreas Schwab <schwab@suse.de>
* linux-m68k-low.c (m68k_num_regs): Define to 29 instead of 31.
diff --git a/gdb/gdbserver/config.in b/gdb/gdbserver/config.in
index e5cb0a7..5141263 100644
--- a/gdb/gdbserver/config.in
+++ b/gdb/gdbserver/config.in
@@ -25,6 +25,9 @@
/* Define if you have the <sgtty.h> header file. */
#undef HAVE_SGTTY_H
+/* Define if you have the <stdlib.h> header file. */
+#undef HAVE_STDLIB_H
+
/* Define if you have the <string.h> header file. */
#undef HAVE_STRING_H
diff --git a/gdb/gdbserver/configure b/gdb/gdbserver/configure
index f88f4ac..0b9bee4 100755
--- a/gdb/gdbserver/configure
+++ b/gdb/gdbserver/configure
@@ -1105,7 +1105,7 @@ EOF
fi
-for ac_hdr in sgtty.h termio.h termios.h sys/reg.h string.h proc_service.h sys/procfs.h thread_db.h linux/elf.h unistd.h
+for ac_hdr in sgtty.h termio.h termios.h sys/reg.h string.h proc_service.h sys/procfs.h thread_db.h linux/elf.h stdlib.h unistd.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
diff --git a/gdb/gdbserver/configure.in b/gdb/gdbserver/configure.in
index cb6feed..9c3106d 100644
--- a/gdb/gdbserver/configure.in
+++ b/gdb/gdbserver/configure.in
@@ -31,7 +31,8 @@ AC_PROG_INSTALL
AC_HEADER_STDC
AC_CHECK_HEADERS(sgtty.h termio.h termios.h sys/reg.h string.h dnl
- proc_service.h sys/procfs.h thread_db.h linux/elf.h unistd.h)
+ proc_service.h sys/procfs.h thread_db.h linux/elf.h dnl
+ stdlib.h unistd.h)
. ${srcdir}/configure.srv
diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c
index 2cb592a..95bf969 100644
--- a/gdb/gdbserver/linux-low.c
+++ b/gdb/gdbserver/linux-low.c
@@ -147,7 +147,7 @@ linux_create_inferior (char *program, char **allargs)
{
ptrace (PTRACE_TRACEME, 0, 0, 0);
- signal (SIGRTMIN + 1, SIG_DFL);
+ signal (__SIGRTMIN + 1, SIG_DFL);
setpgid (0, 0);
@@ -493,8 +493,8 @@ linux_wait_for_event (struct thread_info *child)
/* FIXME drow/2002-06-09: Get signal numbers from the inferior's
thread library? */
if (WIFSTOPPED (wstat)
- && (WSTOPSIG (wstat) == SIGRTMIN
- || WSTOPSIG (wstat) == SIGRTMIN + 1))
+ && (WSTOPSIG (wstat) == __SIGRTMIN
+ || WSTOPSIG (wstat) == __SIGRTMIN + 1))
{
if (debug_threads)
fprintf (stderr, "Ignored signal %d for %d (LWP %d).\n",
@@ -1248,7 +1248,7 @@ linux_init_signals ()
{
/* FIXME drow/2002-06-09: As above, we should check with LinuxThreads
to find what the cancel signal actually is. */
- signal (SIGRTMIN+1, SIG_IGN);
+ signal (__SIGRTMIN+1, SIG_IGN);
}
void
diff --git a/gdb/gdbthread.h b/gdb/gdbthread.h
index e3df58b..f336d91 100644
--- a/gdb/gdbthread.h
+++ b/gdb/gdbthread.h
@@ -25,6 +25,10 @@
#ifndef GDBTHREAD_H
#define GDBTHREAD_H
+struct breakpoint;
+struct frame_id;
+struct symtab;
+
/* For bpstat */
#include "breakpoint.h"
@@ -40,7 +44,6 @@ struct thread_info
int num; /* Convenient handle (GDB thread id) */
/* State from wait_for_inferior */
CORE_ADDR prev_pc;
- CORE_ADDR prev_func_start;
char *prev_func_name;
struct breakpoint *step_resume_breakpoint;
struct breakpoint *through_sigtramp_breakpoint;
@@ -114,7 +117,6 @@ extern struct thread_info *iterate_over_threads (thread_callback_func, void *);
/* infrun context switch: save the debugger state for the given thread. */
extern void save_infrun_state (ptid_t ptid,
CORE_ADDR prev_pc,
- CORE_ADDR prev_func_start,
char *prev_func_name,
int trap_expected,
struct breakpoint *step_resume_breakpoint,
@@ -135,7 +137,6 @@ extern void save_infrun_state (ptid_t ptid,
for the given thread. */
extern void load_infrun_state (ptid_t ptid,
CORE_ADDR *prev_pc,
- CORE_ADDR *prev_func_start,
char **prev_func_name,
int *trap_expected,
struct breakpoint **step_resume_breakpoint,
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
index fa5907e..56ca42d 100644
--- a/gdb/gdbtypes.h
+++ b/gdb/gdbtypes.h
@@ -26,6 +26,7 @@
#define GDBTYPES_H 1
/* Forward declarations for prototypes. */
+struct field;
struct block;
/* Codes for `fundamental types'. This is a monstrosity based on the
@@ -1251,7 +1252,7 @@ extern void recursive_dump_type (struct type *, int);
/* printcmd.c */
-extern void print_scalar_formatted (char *, struct type *, int, int,
+extern void print_scalar_formatted (void *, struct type *, int, int,
struct ui_file *);
extern int can_dereference (struct type *);
diff --git a/gdb/h8300-tdep.c b/gdb/h8300-tdep.c
index b90f6ed..2423a9a 100644
--- a/gdb/h8300-tdep.c
+++ b/gdb/h8300-tdep.c
@@ -1120,9 +1120,9 @@ h8300_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
*/
set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, h8300_frame_init_saved_regs);
set_gdbarch_deprecated_init_extra_frame_info (gdbarch, h8300_init_extra_frame_info);
- set_gdbarch_frame_chain (gdbarch, h8300_frame_chain);
- set_gdbarch_saved_pc_after_call (gdbarch, h8300_saved_pc_after_call);
- set_gdbarch_frame_saved_pc (gdbarch, h8300_frame_saved_pc);
+ set_gdbarch_deprecated_frame_chain (gdbarch, h8300_frame_chain);
+ set_gdbarch_deprecated_saved_pc_after_call (gdbarch, h8300_saved_pc_after_call);
+ set_gdbarch_deprecated_frame_saved_pc (gdbarch, h8300_frame_saved_pc);
set_gdbarch_skip_prologue (gdbarch, h8300_skip_prologue);
set_gdbarch_frame_args_address (gdbarch, h8300_frame_args_address);
set_gdbarch_frame_locals_address (gdbarch, h8300_frame_locals_address);
@@ -1148,25 +1148,16 @@ h8300_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
* Call Dummies
*
* These values and methods are used when gdb calls a target function. */
- set_gdbarch_push_return_address (gdbarch, h8300_push_return_address);
+ set_gdbarch_deprecated_push_return_address (gdbarch, h8300_push_return_address);
set_gdbarch_deprecated_extract_return_value (gdbarch, h8300_extract_return_value);
- set_gdbarch_push_arguments (gdbarch, h8300_push_arguments);
- set_gdbarch_pop_frame (gdbarch, h8300_pop_frame);
- set_gdbarch_store_struct_return (gdbarch, h8300_store_struct_return);
+ set_gdbarch_deprecated_push_arguments (gdbarch, h8300_push_arguments);
+ set_gdbarch_deprecated_pop_frame (gdbarch, h8300_pop_frame);
+ set_gdbarch_deprecated_store_struct_return (gdbarch, h8300_store_struct_return);
set_gdbarch_deprecated_store_return_value (gdbarch, h8300_store_return_value);
set_gdbarch_deprecated_extract_struct_value_address (gdbarch, h8300_extract_struct_value_address);
set_gdbarch_use_struct_convention (gdbarch, h8300_use_struct_convention);
- set_gdbarch_call_dummy_address (gdbarch, entry_point_address);
- set_gdbarch_call_dummy_start_offset (gdbarch, 0);
- set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 0);
- set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 1);
- set_gdbarch_call_dummy_length (gdbarch, 0);
- set_gdbarch_call_dummy_p (gdbarch, 1);
set_gdbarch_call_dummy_words (gdbarch, call_dummy_words);
set_gdbarch_sizeof_call_dummy_words (gdbarch, 0);
- set_gdbarch_call_dummy_stack_adjust_p (gdbarch, 0);
- /* set_gdbarch_call_dummy_stack_adjust */
- set_gdbarch_fix_call_dummy (gdbarch, generic_fix_call_dummy);
set_gdbarch_breakpoint_from_pc (gdbarch, h8300_breakpoint_from_pc);
set_gdbarch_int_bit (gdbarch, 2 * TARGET_CHAR_BIT);
@@ -1175,9 +1166,11 @@ h8300_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_addr_bit (gdbarch, BINWORD * TARGET_CHAR_BIT);
/* set_gdbarch_stack_align (gdbarch, SOME_stack_align); */
- set_gdbarch_extra_stack_alignment_needed (gdbarch, 0);
set_gdbarch_believe_pcc_promotion (gdbarch, 1);
+ /* Should be using push_dummy_call. */
+ set_gdbarch_deprecated_dummy_write_sp (gdbarch, generic_target_write_sp);
+
return gdbarch;
}
diff --git a/gdb/hppa-hpux-tdep.c b/gdb/hppa-hpux-tdep.c
index 66b7b61..cc50e02 100644
--- a/gdb/hppa-hpux-tdep.c
+++ b/gdb/hppa-hpux-tdep.c
@@ -1,5 +1,6 @@
/* Target-dependent code for HPUX running on PA-RISC, for GDB.
- Copyright 2002 Free Software Foundation, Inc.
+
+ Copyright 2002, 2003 Free Software Foundation, Inc.
This file is part of GDB.
@@ -21,6 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "arch-utils.h"
#include "gdbcore.h"
#include "osabi.h"
+#include "gdb_string.h"
/* Forward declarations. */
extern void _initialize_hppa_hpux_tdep (void);
@@ -34,7 +36,7 @@ void hppa_hpux_frame_saved_pc_in_sigtramp (struct frame_info *fi,
void hppa_hpux_frame_base_before_sigtramp (struct frame_info *fi,
CORE_ADDR *tmp);
void hppa_hpux_frame_find_saved_regs_in_sigtramp
- (struct frame_info *fi, struct frame_saved_regs *fsr);
+ (struct frame_info *fi, CORE_ADDR *fsr);
int
hppa_hpux_pc_in_sigtramp (CORE_ADDR pc, char *name)
@@ -66,29 +68,29 @@ hppa_hpux_pc_in_sigtramp (CORE_ADDR pc, char *name)
void
hppa_hpux_frame_saved_pc_in_sigtramp (struct frame_info *fi, CORE_ADDR *tmp)
{
- *tmp = read_memory_integer (fi->frame + (43 * 4), 4);
+ *tmp = read_memory_integer (get_frame_base (fi) + (43 * 4), 4);
}
void
hppa_hpux_frame_base_before_sigtramp (struct frame_info *fi,
CORE_ADDR *tmp)
{
- *tmp = read_memory_integer (fi->frame + (40 * 4), 4);
+ *tmp = read_memory_integer (get_frame_base (fi) + (40 * 4), 4);
}
void
hppa_hpux_frame_find_saved_regs_in_sigtramp (struct frame_info *fi,
- struct frame_saved_regs *fsr)
+ CORE_ADDR *fsr)
{
int i;
- const CORE_ADDR tmp = (fi)->frame + (10 * 4);
+ const CORE_ADDR tmp = get_frame_base (fi) + (10 * 4);
for (i = 0; i < NUM_REGS; i++)
{
if (i == SP_REGNUM)
- (fsr)->regs[SP_REGNUM] = read_memory_integer (tmp + SP_REGNUM * 4, 4);
+ fsr[SP_REGNUM] = read_memory_integer (tmp + SP_REGNUM * 4, 4);
else
- (fsr)->regs[i] = tmp + i * 4;
+ fsr[i] = tmp + i * 4;
}
}
diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c
index a03f850..4a094c1 100644
--- a/gdb/hppa-tdep.c
+++ b/gdb/hppa-tdep.c
@@ -32,7 +32,8 @@
#include "completer.h"
#include "language.h"
#include "osabi.h"
-
+#include "gdb_assert.h"
+#include "infttrace.h"
/* For argument passing to the inferior */
#include "symtab.h"
@@ -77,8 +78,7 @@ static unsigned extract_5R_store (unsigned int);
static unsigned extract_5r_store (unsigned int);
-static void find_dummy_frame_regs (struct frame_info *,
- struct frame_saved_regs *);
+static void find_dummy_frame_regs (struct frame_info *, CORE_ADDR *);
static int find_proc_framesize (CORE_ADDR);
@@ -102,7 +102,7 @@ static int low_sign_extend (unsigned int, unsigned int);
static int sign_extend (unsigned int, unsigned int);
-static int restore_pc_queue (struct frame_saved_regs *);
+static int restore_pc_queue (CORE_ADDR *);
static int hppa_alignof (struct type *);
@@ -164,7 +164,7 @@ CORE_ADDR hppa_frame_saved_pc (struct frame_info *frame);
CORE_ADDR hppa_frame_args_address (struct frame_info *fi);
CORE_ADDR hppa_frame_locals_address (struct frame_info *fi);
int hppa_frame_num_args (struct frame_info *frame);
-void hppa_push_dummy_frame (struct inferior_status *inf_status);
+void hppa_push_dummy_frame (void);
void hppa_pop_frame (void);
CORE_ADDR hppa_fix_call_dummy (char *dummy, CORE_ADDR pc, CORE_ADDR fun,
int nargs, struct value **args,
@@ -848,7 +848,7 @@ hppa_frameless_function_invocation (struct frame_info *frame)
{
struct unwind_table_entry *u;
- u = find_unwind_entry (frame->pc);
+ u = find_unwind_entry (get_frame_pc (frame));
if (u == 0)
return 0;
@@ -875,7 +875,7 @@ hppa_saved_pc_after_call (struct frame_info *frame)
the stub will return to out of the stack. */
u = find_unwind_entry (pc);
if (u && u->stub_unwind.stub_type != 0)
- return FRAME_SAVED_PC (frame);
+ return DEPRECATED_FRAME_SAVED_PC (frame);
else
return pc;
}
@@ -885,7 +885,7 @@ hppa_frame_saved_pc (struct frame_info *frame)
{
CORE_ADDR pc = get_frame_pc (frame);
struct unwind_table_entry *u;
- CORE_ADDR old_pc;
+ CORE_ADDR old_pc = 0;
int spun_around_loop = 0;
int rp_offset = 0;
@@ -894,26 +894,27 @@ hppa_frame_saved_pc (struct frame_info *frame)
are saved in the exact same order as GDB numbers registers. How
convienent. */
if (pc_in_interrupt_handler (pc))
- return read_memory_integer (frame->frame + PC_REGNUM * 4,
+ return read_memory_integer (get_frame_base (frame) + PC_REGNUM * 4,
TARGET_PTR_BIT / 8) & ~0x3;
- if ((frame->pc >= frame->frame
- && frame->pc <= (frame->frame
- /* A call dummy is sized in words, but it is
- actually a series of instructions. Account
- for that scaling factor. */
- + ((REGISTER_SIZE / INSTRUCTION_SIZE)
- * CALL_DUMMY_LENGTH)
- /* Similarly we have to account for 64bit
- wide register saves. */
- + (32 * REGISTER_SIZE)
- /* We always consider FP regs 8 bytes long. */
- + (NUM_REGS - FP0_REGNUM) * 8
- /* Similarly we have to account for 64bit
- wide register saves. */
- + (6 * REGISTER_SIZE))))
+ if ((get_frame_pc (frame) >= get_frame_base (frame)
+ && (get_frame_pc (frame)
+ <= (get_frame_base (frame)
+ /* A call dummy is sized in words, but it is actually a
+ series of instructions. Account for that scaling
+ factor. */
+ + ((REGISTER_SIZE / INSTRUCTION_SIZE)
+ * CALL_DUMMY_LENGTH)
+ /* Similarly we have to account for 64bit wide register
+ saves. */
+ + (32 * REGISTER_SIZE)
+ /* We always consider FP regs 8 bytes long. */
+ + (NUM_REGS - FP0_REGNUM) * 8
+ /* Similarly we have to account for 64bit wide register
+ saves. */
+ + (6 * REGISTER_SIZE)))))
{
- return read_memory_integer ((frame->frame
+ return read_memory_integer ((get_frame_base (frame)
+ (TARGET_PTR_BIT == 64 ? -16 : -20)),
TARGET_PTR_BIT / 8) & ~0x3;
}
@@ -938,29 +939,29 @@ hppa_frame_saved_pc (struct frame_info *frame)
handler caller, then we need to look in the saved
register area to get the return pointer (the values
in the registers may not correspond to anything useful). */
- if (frame->next
- && ((get_frame_type (frame->next) == SIGTRAMP_FRAME)
- || pc_in_interrupt_handler (frame->next->pc)))
+ if (get_next_frame (frame)
+ && ((get_frame_type (get_next_frame (frame)) == SIGTRAMP_FRAME)
+ || pc_in_interrupt_handler (get_frame_pc (get_next_frame (frame)))))
{
- struct frame_saved_regs saved_regs;
-
- deprecated_get_frame_saved_regs (frame->next, &saved_regs);
- if (read_memory_integer (saved_regs.regs[FLAGS_REGNUM],
+ CORE_ADDR *saved_regs;
+ hppa_frame_init_saved_regs (get_next_frame (frame));
+ saved_regs = get_frame_saved_regs (get_next_frame (frame));
+ if (read_memory_integer (saved_regs[FLAGS_REGNUM],
TARGET_PTR_BIT / 8) & 0x2)
{
- pc = read_memory_integer (saved_regs.regs[31],
+ pc = read_memory_integer (saved_regs[31],
TARGET_PTR_BIT / 8) & ~0x3;
/* Syscalls are really two frames. The syscall stub itself
with a return pointer in %rp and the kernel call with
a return pointer in %r31. We return the %rp variant
if %r31 is the same as frame->pc. */
- if (pc == frame->pc)
- pc = read_memory_integer (saved_regs.regs[RP_REGNUM],
+ if (pc == get_frame_pc (frame))
+ pc = read_memory_integer (saved_regs[RP_REGNUM],
TARGET_PTR_BIT / 8) & ~0x3;
}
else
- pc = read_memory_integer (saved_regs.regs[RP_REGNUM],
+ pc = read_memory_integer (saved_regs[RP_REGNUM],
TARGET_PTR_BIT / 8) & ~0x3;
}
else
@@ -978,29 +979,29 @@ hppa_frame_saved_pc (struct frame_info *frame)
frame is a signal or interrupt handler, then dig the right
information out of the saved register info. */
if (rp_offset == 0
- && frame->next
- && ((get_frame_type (frame->next) == SIGTRAMP_FRAME)
- || pc_in_interrupt_handler (frame->next->pc)))
+ && get_next_frame (frame)
+ && ((get_frame_type (get_next_frame (frame)) == SIGTRAMP_FRAME)
+ || pc_in_interrupt_handler (get_frame_pc (get_next_frame (frame)))))
{
- struct frame_saved_regs saved_regs;
-
- deprecated_get_frame_saved_regs (frame->next, &saved_regs);
- if (read_memory_integer (saved_regs.regs[FLAGS_REGNUM],
+ CORE_ADDR *saved_regs;
+ hppa_frame_init_saved_regs (get_next_frame (frame));
+ saved_regs = get_frame_saved_regs (get_next_frame (frame));
+ if (read_memory_integer (saved_regs[FLAGS_REGNUM],
TARGET_PTR_BIT / 8) & 0x2)
{
- pc = read_memory_integer (saved_regs.regs[31],
+ pc = read_memory_integer (saved_regs[31],
TARGET_PTR_BIT / 8) & ~0x3;
/* Syscalls are really two frames. The syscall stub itself
with a return pointer in %rp and the kernel call with
a return pointer in %r31. We return the %rp variant
if %r31 is the same as frame->pc. */
- if (pc == frame->pc)
- pc = read_memory_integer (saved_regs.regs[RP_REGNUM],
+ if (pc == get_frame_pc (frame))
+ pc = read_memory_integer (saved_regs[RP_REGNUM],
TARGET_PTR_BIT / 8) & ~0x3;
}
else
- pc = read_memory_integer (saved_regs.regs[RP_REGNUM],
+ pc = read_memory_integer (saved_regs[RP_REGNUM],
TARGET_PTR_BIT / 8) & ~0x3;
}
else if (rp_offset == 0)
@@ -1011,7 +1012,7 @@ hppa_frame_saved_pc (struct frame_info *frame)
else
{
old_pc = pc;
- pc = read_memory_integer (frame->frame + rp_offset,
+ pc = read_memory_integer (get_frame_base (frame) + rp_offset,
TARGET_PTR_BIT / 8) & ~0x3;
}
}
@@ -1065,32 +1066,33 @@ hppa_init_extra_frame_info (int fromleaf, struct frame_info *frame)
int flags;
int framesize;
- if (frame->next && !fromleaf)
+ if (get_next_frame (frame) && !fromleaf)
return;
- /* If the next frame represents a frameless function invocation
- then we have to do some adjustments that are normally done by
- FRAME_CHAIN. (FRAME_CHAIN is not called in this case.) */
+ /* If the next frame represents a frameless function invocation then
+ we have to do some adjustments that are normally done by
+ DEPRECATED_FRAME_CHAIN. (DEPRECATED_FRAME_CHAIN is not called in
+ this case.) */
if (fromleaf)
{
/* Find the framesize of *this* frame without peeking at the PC
in the current frame structure (it isn't set yet). */
- framesize = find_proc_framesize (FRAME_SAVED_PC (get_next_frame (frame)));
+ framesize = find_proc_framesize (DEPRECATED_FRAME_SAVED_PC (get_next_frame (frame)));
/* Now adjust our base frame accordingly. If we have a frame pointer
use it, else subtract the size of this frame from the current
frame. (we always want frame->frame to point at the lowest address
in the frame). */
if (framesize == -1)
- frame->frame = TARGET_READ_FP ();
+ deprecated_update_frame_base_hack (frame, TARGET_READ_FP ());
else
- frame->frame -= framesize;
+ deprecated_update_frame_base_hack (frame, get_frame_base (frame) - framesize);
return;
}
flags = read_register (FLAGS_REGNUM);
if (flags & 2) /* In system call? */
- frame->pc = read_register (31) & ~0x3;
+ deprecated_update_frame_pc_hack (frame, read_register (31) & ~0x3);
/* The outermost frame is always derived from PC-framesize
@@ -1101,11 +1103,11 @@ hppa_init_extra_frame_info (int fromleaf, struct frame_info *frame)
explain, but the parent *always* creates some stack space for
the child. So the child actually does have a frame of some
sorts, and its base is the high address in its parent's frame. */
- framesize = find_proc_framesize (frame->pc);
+ framesize = find_proc_framesize (get_frame_pc (frame));
if (framesize == -1)
- frame->frame = TARGET_READ_FP ();
+ deprecated_update_frame_base_hack (frame, TARGET_READ_FP ());
else
- frame->frame = read_register (SP_REGNUM) - framesize;
+ deprecated_update_frame_base_hack (frame, read_register (SP_REGNUM) - framesize);
}
/* Given a GDB frame, determine the address of the calling function's
@@ -1127,9 +1129,9 @@ hppa_frame_chain (struct frame_info *frame)
/* A frame in the current frame list, or zero. */
struct frame_info *saved_regs_frame = 0;
- /* Where the registers were saved in saved_regs_frame.
- If saved_regs_frame is zero, this is garbage. */
- struct frame_saved_regs saved_regs;
+ /* Where the registers were saved in saved_regs_frame. If
+ saved_regs_frame is zero, this is garbage. */
+ CORE_ADDR *saved_regs = NULL;
CORE_ADDR caller_pc;
@@ -1140,8 +1142,8 @@ hppa_frame_chain (struct frame_info *frame)
/* If this is a threaded application, and we see the
routine "__pthread_exit", treat it as the stack root
for this thread. */
- min_frame_symbol = lookup_minimal_symbol_by_pc (frame->pc);
- frame_symbol = find_pc_function (frame->pc);
+ min_frame_symbol = lookup_minimal_symbol_by_pc (get_frame_pc (frame));
+ frame_symbol = find_pc_function (get_frame_pc (frame));
if ((min_frame_symbol != 0) /* && (frame_symbol == 0) */ )
{
@@ -1170,8 +1172,8 @@ hppa_frame_chain (struct frame_info *frame)
are easy; at *sp we have a full save state strucutre which we can
pull the old stack pointer from. Also see frame_saved_pc for
code to dig a saved PC out of the save state structure. */
- if (pc_in_interrupt_handler (frame->pc))
- frame_base = read_memory_integer (frame->frame + SP_REGNUM * 4,
+ if (pc_in_interrupt_handler (get_frame_pc (frame)))
+ frame_base = read_memory_integer (get_frame_base (frame) + SP_REGNUM * 4,
TARGET_PTR_BIT / 8);
#ifdef FRAME_BASE_BEFORE_SIGTRAMP
else if ((get_frame_type (frame) == SIGTRAMP_FRAME))
@@ -1180,12 +1182,12 @@ hppa_frame_chain (struct frame_info *frame)
}
#endif
else
- frame_base = frame->frame;
+ frame_base = get_frame_base (frame);
/* Get frame sizes for the current frame and the frame of the
caller. */
- my_framesize = find_proc_framesize (frame->pc);
- caller_pc = FRAME_SAVED_PC (frame);
+ my_framesize = find_proc_framesize (get_frame_pc (frame));
+ caller_pc = DEPRECATED_FRAME_SAVED_PC (frame);
/* If we can't determine the caller's PC, then it's not likely we can
really determine anything meaningful about its frame. We'll consider
@@ -1193,7 +1195,7 @@ hppa_frame_chain (struct frame_info *frame)
if (caller_pc == (CORE_ADDR) 0)
return (CORE_ADDR) 0;
- caller_framesize = find_proc_framesize (FRAME_SAVED_PC (frame));
+ caller_framesize = find_proc_framesize (DEPRECATED_FRAME_SAVED_PC (frame));
/* If caller does not have a frame pointer, then its frame
can be found at current_frame - caller_framesize. */
@@ -1224,9 +1226,9 @@ hppa_frame_chain (struct frame_info *frame)
We use information from unwind descriptors to determine if %r3
is saved into the stack (Entry_GR field has this information). */
- for (tmp_frame = frame; tmp_frame; tmp_frame = tmp_frame->next)
+ for (tmp_frame = frame; tmp_frame; tmp_frame = get_next_frame (tmp_frame))
{
- u = find_unwind_entry (tmp_frame->pc);
+ u = find_unwind_entry (get_frame_pc (tmp_frame));
if (!u)
{
@@ -1239,14 +1241,14 @@ hppa_frame_chain (struct frame_info *frame)
the dynamic linker will give you a PC that has none. Thus, I've
disabled this warning. */
#if 0
- warning ("Unable to find unwind for PC 0x%x -- Help!", tmp_frame->pc);
+ warning ("Unable to find unwind for PC 0x%x -- Help!", get_frame_pc (tmp_frame));
#endif
return (CORE_ADDR) 0;
}
if (u->Save_SP
|| (get_frame_type (tmp_frame) == SIGTRAMP_FRAME)
- || pc_in_interrupt_handler (tmp_frame->pc))
+ || pc_in_interrupt_handler (get_frame_pc (tmp_frame)))
break;
/* Entry_GR specifies the number of callee-saved general registers
@@ -1256,11 +1258,12 @@ hppa_frame_chain (struct frame_info *frame)
/* The unwind entry claims that r3 is saved here. However,
in optimized code, GCC often doesn't actually save r3.
We'll discover this if we look at the prologue. */
- deprecated_get_frame_saved_regs (tmp_frame, &saved_regs);
+ hppa_frame_init_saved_regs (tmp_frame);
+ saved_regs = get_frame_saved_regs (tmp_frame);
saved_regs_frame = tmp_frame;
/* If we have an address for r3, that's good. */
- if (saved_regs.regs[FP_REGNUM])
+ if (saved_regs[FP_REGNUM])
break;
}
}
@@ -1271,9 +1274,9 @@ hppa_frame_chain (struct frame_info *frame)
pointer. */
if (u->Save_SP
&& !(get_frame_type (tmp_frame) == SIGTRAMP_FRAME)
- && !pc_in_interrupt_handler (tmp_frame->pc))
+ && !pc_in_interrupt_handler (get_frame_pc (tmp_frame)))
{
- return read_memory_integer (tmp_frame->frame, TARGET_PTR_BIT / 8);
+ return read_memory_integer (get_frame_base (tmp_frame), TARGET_PTR_BIT / 8);
}
/* %r3 was saved somewhere in the stack. Dig it out. */
else
@@ -1305,21 +1308,24 @@ hppa_frame_chain (struct frame_info *frame)
system call has a variable sized stack frame. */
if (tmp_frame != saved_regs_frame)
- deprecated_get_frame_saved_regs (tmp_frame, &saved_regs);
+ {
+ hppa_frame_init_saved_regs (tmp_frame);
+ saved_regs = get_frame_saved_regs (tmp_frame);
+ }
/* Abominable hack. */
if (current_target.to_has_execution == 0
- && ((saved_regs.regs[FLAGS_REGNUM]
- && (read_memory_integer (saved_regs.regs[FLAGS_REGNUM],
+ && ((saved_regs[FLAGS_REGNUM]
+ && (read_memory_integer (saved_regs[FLAGS_REGNUM],
TARGET_PTR_BIT / 8)
& 0x2))
- || (saved_regs.regs[FLAGS_REGNUM] == 0
+ || (saved_regs[FLAGS_REGNUM] == 0
&& read_register (FLAGS_REGNUM) & 0x2)))
{
- u = find_unwind_entry (FRAME_SAVED_PC (frame));
+ u = find_unwind_entry (DEPRECATED_FRAME_SAVED_PC (frame));
if (!u)
{
- return read_memory_integer (saved_regs.regs[FP_REGNUM],
+ return read_memory_integer (saved_regs[FP_REGNUM],
TARGET_PTR_BIT / 8);
}
else
@@ -1328,7 +1334,7 @@ hppa_frame_chain (struct frame_info *frame)
}
}
- return read_memory_integer (saved_regs.regs[FP_REGNUM],
+ return read_memory_integer (saved_regs[FP_REGNUM],
TARGET_PTR_BIT / 8);
}
}
@@ -1336,25 +1342,28 @@ hppa_frame_chain (struct frame_info *frame)
{
/* Get the innermost frame. */
tmp_frame = frame;
- while (tmp_frame->next != NULL)
- tmp_frame = tmp_frame->next;
+ while (get_next_frame (tmp_frame) != NULL)
+ tmp_frame = get_next_frame (tmp_frame);
if (tmp_frame != saved_regs_frame)
- deprecated_get_frame_saved_regs (tmp_frame, &saved_regs);
+ {
+ hppa_frame_init_saved_regs (tmp_frame);
+ saved_regs = get_frame_saved_regs (tmp_frame);
+ }
/* Abominable hack. See above. */
if (current_target.to_has_execution == 0
- && ((saved_regs.regs[FLAGS_REGNUM]
- && (read_memory_integer (saved_regs.regs[FLAGS_REGNUM],
+ && ((saved_regs[FLAGS_REGNUM]
+ && (read_memory_integer (saved_regs[FLAGS_REGNUM],
TARGET_PTR_BIT / 8)
& 0x2))
- || (saved_regs.regs[FLAGS_REGNUM] == 0
+ || (saved_regs[FLAGS_REGNUM] == 0
&& read_register (FLAGS_REGNUM) & 0x2)))
{
- u = find_unwind_entry (FRAME_SAVED_PC (frame));
+ u = find_unwind_entry (DEPRECATED_FRAME_SAVED_PC (frame));
if (!u)
{
- return read_memory_integer (saved_regs.regs[FP_REGNUM],
+ return read_memory_integer (saved_regs[FP_REGNUM],
TARGET_PTR_BIT / 8);
}
else
@@ -1381,7 +1390,7 @@ hppa_frame_chain_valid (CORE_ADDR chain, struct frame_info *thisframe)
struct unwind_table_entry *u, *next_u = NULL;
struct frame_info *next;
- u = find_unwind_entry (thisframe->pc);
+ u = find_unwind_entry (get_frame_pc (thisframe));
if (u == NULL)
return 1;
@@ -1392,7 +1401,7 @@ hppa_frame_chain_valid (CORE_ADDR chain, struct frame_info *thisframe)
indistinguishable (as nearly as I can tell) from the symbol for a function
which is (legitimately, since it is in the user's namespace)
named Ltext_end, so we can't just ignore it. */
- msym_us = lookup_minimal_symbol_by_pc (FRAME_SAVED_PC (thisframe));
+ msym_us = lookup_minimal_symbol_by_pc (DEPRECATED_FRAME_SAVED_PC (thisframe));
msym_start = lookup_minimal_symbol ("_start", NULL, NULL);
if (msym_us
&& msym_start
@@ -1409,61 +1418,44 @@ hppa_frame_chain_valid (CORE_ADDR chain, struct frame_info *thisframe)
next = get_next_frame (thisframe);
if (next)
- next_u = find_unwind_entry (next->pc);
+ next_u = find_unwind_entry (get_frame_pc (next));
/* If this frame does not save SP, has no stack, isn't a stub,
and doesn't "call" an interrupt routine or signal handler caller,
then its not valid. */
if (u->Save_SP || u->Total_frame_size || u->stub_unwind.stub_type != 0
- || (thisframe->next && (get_frame_type (thisframe->next) == SIGTRAMP_FRAME))
+ || (get_next_frame (thisframe) && (get_frame_type (get_next_frame (thisframe)) == SIGTRAMP_FRAME))
|| (next_u && next_u->HP_UX_interrupt_marker))
return 1;
- if (pc_in_linker_stub (thisframe->pc))
+ if (pc_in_linker_stub (get_frame_pc (thisframe)))
return 1;
return 0;
}
-/*
- These functions deal with saving and restoring register state
- around a function call in the inferior. They keep the stack
- double-word aligned; eventually, on an hp700, the stack will have
- to be aligned to a 64-byte boundary. */
+/* These functions deal with saving and restoring register state
+ around a function call in the inferior. They keep the stack
+ double-word aligned; eventually, on an hp700, the stack will have
+ to be aligned to a 64-byte boundary. */
void
-hppa_push_dummy_frame (struct inferior_status *inf_status)
+hppa_push_dummy_frame (void)
{
CORE_ADDR sp, pc, pcspace;
register int regnum;
CORE_ADDR int_buffer;
double freg_buffer;
- /* Oh, what a hack. If we're trying to perform an inferior call
- while the inferior is asleep, we have to make sure to clear
- the "in system call" bit in the flag register (the call will
- start after the syscall returns, so we're no longer in the system
- call!) This state is kept in "inf_status", change it there.
-
- We also need a number of horrid hacks to deal with lossage in the
- PC queue registers (apparently they're not valid when the in syscall
- bit is set). */
pc = hppa_target_read_pc (inferior_ptid);
int_buffer = read_register (FLAGS_REGNUM);
if (int_buffer & 0x2)
{
- unsigned int sid;
- int_buffer &= ~0x2;
- write_inferior_status_register (inf_status, 0, int_buffer);
- write_inferior_status_register (inf_status, PCOQ_HEAD_REGNUM, pc + 0);
- write_inferior_status_register (inf_status, PCOQ_TAIL_REGNUM, pc + 4);
- sid = (pc >> 30) & 0x3;
+ const unsigned int sid = (pc >> 30) & 0x3;
if (sid == 0)
pcspace = read_register (SR4_REGNUM);
else
pcspace = read_register (SR4_REGNUM + 4 + sid);
- write_inferior_status_register (inf_status, PCSQ_HEAD_REGNUM, pcspace);
- write_inferior_status_register (inf_status, PCSQ_TAIL_REGNUM, pcspace);
}
else
pcspace = read_register (PCSQ_HEAD_REGNUM);
@@ -1511,26 +1503,26 @@ hppa_push_dummy_frame (struct inferior_status *inf_status)
static void
find_dummy_frame_regs (struct frame_info *frame,
- struct frame_saved_regs *frame_saved_regs)
+ CORE_ADDR frame_saved_regs[])
{
- CORE_ADDR fp = frame->frame;
+ CORE_ADDR fp = get_frame_base (frame);
int i;
/* The 32bit and 64bit ABIs save RP into different locations. */
if (REGISTER_SIZE == 8)
- frame_saved_regs->regs[RP_REGNUM] = (fp - 16) & ~0x3;
+ frame_saved_regs[RP_REGNUM] = (fp - 16) & ~0x3;
else
- frame_saved_regs->regs[RP_REGNUM] = (fp - 20) & ~0x3;
+ frame_saved_regs[RP_REGNUM] = (fp - 20) & ~0x3;
- frame_saved_regs->regs[FP_REGNUM] = fp;
+ frame_saved_regs[FP_REGNUM] = fp;
- frame_saved_regs->regs[1] = fp + (2 * REGISTER_SIZE);
+ frame_saved_regs[1] = fp + (2 * REGISTER_SIZE);
for (fp += 3 * REGISTER_SIZE, i = 3; i < 32; i++)
{
if (i != FP_REGNUM)
{
- frame_saved_regs->regs[i] = fp;
+ frame_saved_regs[i] = fp;
fp += REGISTER_SIZE;
}
}
@@ -1540,14 +1532,14 @@ find_dummy_frame_regs (struct frame_info *frame,
fp += 4;
for (i = FP0_REGNUM; i < NUM_REGS; i++, fp += 8)
- frame_saved_regs->regs[i] = fp;
-
- frame_saved_regs->regs[IPSW_REGNUM] = fp;
- frame_saved_regs->regs[SAR_REGNUM] = fp + REGISTER_SIZE;
- frame_saved_regs->regs[PCOQ_HEAD_REGNUM] = fp + 2 * REGISTER_SIZE;
- frame_saved_regs->regs[PCSQ_HEAD_REGNUM] = fp + 3 * REGISTER_SIZE;
- frame_saved_regs->regs[PCOQ_TAIL_REGNUM] = fp + 4 * REGISTER_SIZE;
- frame_saved_regs->regs[PCSQ_TAIL_REGNUM] = fp + 5 * REGISTER_SIZE;
+ frame_saved_regs[i] = fp;
+
+ frame_saved_regs[IPSW_REGNUM] = fp;
+ frame_saved_regs[SAR_REGNUM] = fp + REGISTER_SIZE;
+ frame_saved_regs[PCOQ_HEAD_REGNUM] = fp + 2 * REGISTER_SIZE;
+ frame_saved_regs[PCSQ_HEAD_REGNUM] = fp + 3 * REGISTER_SIZE;
+ frame_saved_regs[PCOQ_TAIL_REGNUM] = fp + 4 * REGISTER_SIZE;
+ frame_saved_regs[PCSQ_TAIL_REGNUM] = fp + 5 * REGISTER_SIZE;
}
void
@@ -1556,44 +1548,45 @@ hppa_pop_frame (void)
register struct frame_info *frame = get_current_frame ();
register CORE_ADDR fp, npc, target_pc;
register int regnum;
- struct frame_saved_regs fsr;
+ CORE_ADDR *fsr;
double freg_buffer;
fp = get_frame_base (frame);
- deprecated_get_frame_saved_regs (frame, &fsr);
+ hppa_frame_init_saved_regs (frame);
+ fsr = get_frame_saved_regs (frame);
#ifndef NO_PC_SPACE_QUEUE_RESTORE
- if (fsr.regs[IPSW_REGNUM]) /* Restoring a call dummy frame */
- restore_pc_queue (&fsr);
+ if (fsr[IPSW_REGNUM]) /* Restoring a call dummy frame */
+ restore_pc_queue (fsr);
#endif
for (regnum = 31; regnum > 0; regnum--)
- if (fsr.regs[regnum])
- write_register (regnum, read_memory_integer (fsr.regs[regnum],
+ if (fsr[regnum])
+ write_register (regnum, read_memory_integer (fsr[regnum],
REGISTER_SIZE));
for (regnum = NUM_REGS - 1; regnum >= FP0_REGNUM; regnum--)
- if (fsr.regs[regnum])
+ if (fsr[regnum])
{
- read_memory (fsr.regs[regnum], (char *) &freg_buffer, 8);
+ read_memory (fsr[regnum], (char *) &freg_buffer, 8);
deprecated_write_register_bytes (REGISTER_BYTE (regnum),
(char *) &freg_buffer, 8);
}
- if (fsr.regs[IPSW_REGNUM])
+ if (fsr[IPSW_REGNUM])
write_register (IPSW_REGNUM,
- read_memory_integer (fsr.regs[IPSW_REGNUM],
+ read_memory_integer (fsr[IPSW_REGNUM],
REGISTER_SIZE));
- if (fsr.regs[SAR_REGNUM])
+ if (fsr[SAR_REGNUM])
write_register (SAR_REGNUM,
- read_memory_integer (fsr.regs[SAR_REGNUM],
+ read_memory_integer (fsr[SAR_REGNUM],
REGISTER_SIZE));
/* If the PC was explicitly saved, then just restore it. */
- if (fsr.regs[PCOQ_TAIL_REGNUM])
+ if (fsr[PCOQ_TAIL_REGNUM])
{
- npc = read_memory_integer (fsr.regs[PCOQ_TAIL_REGNUM],
+ npc = read_memory_integer (fsr[PCOQ_TAIL_REGNUM],
REGISTER_SIZE);
write_register (PCOQ_TAIL_REGNUM, npc);
}
@@ -1606,7 +1599,7 @@ hppa_pop_frame (void)
write_register (FP_REGNUM, read_memory_integer (fp, REGISTER_SIZE));
- if (fsr.regs[IPSW_REGNUM]) /* call dummy */
+ if (fsr[IPSW_REGNUM]) /* call dummy */
write_register (SP_REGNUM, fp - 48);
else
write_register (SP_REGNUM, fp);
@@ -1619,7 +1612,7 @@ hppa_pop_frame (void)
Don't skip through the trampoline if we're popping a dummy frame. */
target_pc = SKIP_TRAMPOLINE_CODE (npc & ~0x3) & ~0x3;
- if (target_pc && !fsr.regs[IPSW_REGNUM])
+ if (target_pc && !fsr[IPSW_REGNUM])
{
struct symtab_and_line sal;
struct breakpoint *breakpoint;
@@ -1650,10 +1643,10 @@ hppa_pop_frame (void)
queue space registers. */
static int
-restore_pc_queue (struct frame_saved_regs *fsr)
+restore_pc_queue (CORE_ADDR *fsr)
{
CORE_ADDR pc = read_pc ();
- CORE_ADDR new_pc = read_memory_integer (fsr->regs[PCOQ_HEAD_REGNUM],
+ CORE_ADDR new_pc = read_memory_integer (fsr[PCOQ_HEAD_REGNUM],
TARGET_PTR_BIT / 8);
struct target_waitstatus w;
int insn_count;
@@ -1672,7 +1665,7 @@ restore_pc_queue (struct frame_saved_regs *fsr)
So, load up the registers and single step until we are in the
right place. */
- write_register (21, read_memory_integer (fsr->regs[PCSQ_HEAD_REGNUM],
+ write_register (21, read_memory_integer (fsr[PCSQ_HEAD_REGNUM],
REGISTER_SIZE));
write_register (22, new_pc);
@@ -3856,15 +3849,15 @@ hppa_skip_prologue (CORE_ADDR pc)
return (skip_prologue_hard_way (pc));
}
-/* Put here the code to store, into a struct frame_saved_regs,
- the addresses of the saved registers of frame described by FRAME_INFO.
- This includes special registers such as pc and fp saved in special
- ways in the stack frame. sp is even more special:
- the address we return for it IS the sp for the next frame. */
+/* Put here the code to store, into the SAVED_REGS, the addresses of
+ the saved registers of frame described by FRAME_INFO. This
+ includes special registers such as pc and fp saved in special ways
+ in the stack frame. sp is even more special: the address we return
+ for it IS the sp for the next frame. */
void
hppa_frame_find_saved_regs (struct frame_info *frame_info,
- struct frame_saved_regs *frame_saved_regs)
+ CORE_ADDR frame_saved_regs[])
{
CORE_ADDR pc;
struct unwind_table_entry *u;
@@ -3875,42 +3868,43 @@ hppa_frame_find_saved_regs (struct frame_info *frame_info,
int final_iteration;
/* Zero out everything. */
- memset (frame_saved_regs, '\0', sizeof (struct frame_saved_regs));
+ memset (frame_saved_regs, '\0', SIZEOF_FRAME_SAVED_REGS);
/* Call dummy frames always look the same, so there's no need to
examine the dummy code to determine locations of saved registers;
instead, let find_dummy_frame_regs fill in the correct offsets
for the saved registers. */
- if ((frame_info->pc >= frame_info->frame
- && frame_info->pc <= (frame_info->frame
- /* A call dummy is sized in words, but it is
- actually a series of instructions. Account
- for that scaling factor. */
- + ((REGISTER_SIZE / INSTRUCTION_SIZE)
- * CALL_DUMMY_LENGTH)
- /* Similarly we have to account for 64bit
- wide register saves. */
- + (32 * REGISTER_SIZE)
- /* We always consider FP regs 8 bytes long. */
- + (NUM_REGS - FP0_REGNUM) * 8
- /* Similarly we have to account for 64bit
- wide register saves. */
- + (6 * REGISTER_SIZE))))
+ if ((get_frame_pc (frame_info) >= get_frame_base (frame_info)
+ && (get_frame_pc (frame_info)
+ <= (get_frame_base (frame_info)
+ /* A call dummy is sized in words, but it is actually a
+ series of instructions. Account for that scaling
+ factor. */
+ + ((REGISTER_SIZE / INSTRUCTION_SIZE)
+ * CALL_DUMMY_LENGTH)
+ /* Similarly we have to account for 64bit wide register
+ saves. */
+ + (32 * REGISTER_SIZE)
+ /* We always consider FP regs 8 bytes long. */
+ + (NUM_REGS - FP0_REGNUM) * 8
+ /* Similarly we have to account for 64bit wide register
+ saves. */
+ + (6 * REGISTER_SIZE)))))
find_dummy_frame_regs (frame_info, frame_saved_regs);
/* Interrupt handlers are special too. They lay out the register
state in the exact same order as the register numbers in GDB. */
- if (pc_in_interrupt_handler (frame_info->pc))
+ if (pc_in_interrupt_handler (get_frame_pc (frame_info)))
{
for (i = 0; i < NUM_REGS; i++)
{
/* SP is a little special. */
if (i == SP_REGNUM)
- frame_saved_regs->regs[SP_REGNUM]
- = read_memory_integer (frame_info->frame + SP_REGNUM * 4,
+ frame_saved_regs[SP_REGNUM]
+ = read_memory_integer (get_frame_base (frame_info) + SP_REGNUM * 4,
TARGET_PTR_BIT / 8);
else
- frame_saved_regs->regs[i] = frame_info->frame + i * 4;
+ frame_saved_regs[i] = get_frame_base (frame_info) + i * 4;
}
return;
}
@@ -3926,7 +3920,7 @@ hppa_frame_find_saved_regs (struct frame_info *frame_info,
/* Get the starting address of the function referred to by the PC
saved in frame. */
- pc = get_pc_function_start (frame_info->pc);
+ pc = get_frame_func (frame_info);
/* Yow! */
u = find_unwind_entry (pc);
@@ -3959,7 +3953,7 @@ hppa_frame_find_saved_regs (struct frame_info *frame_info,
/* The frame always represents the value of %sp at entry to the
current function (and is thus equivalent to the "saved" stack
pointer. */
- frame_saved_regs->regs[SP_REGNUM] = frame_info->frame;
+ frame_saved_regs[SP_REGNUM] = get_frame_base (frame_info);
/* Loop until we find everything of interest or hit a branch.
@@ -3977,7 +3971,7 @@ hppa_frame_find_saved_regs (struct frame_info *frame_info,
GCC code. */
final_iteration = 0;
while ((save_gr || save_fr || save_rp || save_sp || stack_remaining > 0)
- && pc <= frame_info->pc)
+ && pc <= get_frame_pc (frame_info))
{
status = target_read_memory (pc, buf, 4);
inst = extract_unsigned_integer (buf, 4);
@@ -3994,12 +3988,12 @@ hppa_frame_find_saved_regs (struct frame_info *frame_info,
if (inst == 0x6bc23fd9) /* stw rp,-0x14(sr0,sp) */
{
save_rp = 0;
- frame_saved_regs->regs[RP_REGNUM] = frame_info->frame - 20;
+ frame_saved_regs[RP_REGNUM] = get_frame_base (frame_info) - 20;
}
else if (inst == 0x0fc212c1) /* std rp,-0x10(sr0,sp) */
{
save_rp = 0;
- frame_saved_regs->regs[RP_REGNUM] = frame_info->frame - 16;
+ frame_saved_regs[RP_REGNUM] = get_frame_base (frame_info) - 16;
}
/* Note if we saved SP into the stack. This also happens to indicate
@@ -4007,7 +4001,7 @@ hppa_frame_find_saved_regs (struct frame_info *frame_info,
if ( (inst & 0xffffc000) == 0x6fc10000 /* stw,ma r1,N(sr0,sp) */
|| (inst & 0xffffc00c) == 0x73c10008) /* std,ma r1,N(sr0,sp) */
{
- frame_saved_regs->regs[FP_REGNUM] = frame_info->frame;
+ frame_saved_regs[FP_REGNUM] = get_frame_base (frame_info);
save_sp = 0;
}
@@ -4021,10 +4015,10 @@ hppa_frame_find_saved_regs (struct frame_info *frame_info,
/* stwm with a positive displacement is a *post modify*. */
if ((inst >> 26) == 0x1b
&& extract_14 (inst) >= 0)
- frame_saved_regs->regs[reg] = frame_info->frame;
+ frame_saved_regs[reg] = get_frame_base (frame_info);
/* A std has explicit post_modify forms. */
else if ((inst & 0xfc00000c0) == 0x70000008)
- frame_saved_regs->regs[reg] = frame_info->frame;
+ frame_saved_regs[reg] = get_frame_base (frame_info);
else
{
CORE_ADDR offset;
@@ -4038,11 +4032,11 @@ hppa_frame_find_saved_regs (struct frame_info *frame_info,
/* Handle code with and without frame pointers. */
if (u->Save_SP)
- frame_saved_regs->regs[reg]
- = frame_info->frame + offset;
+ frame_saved_regs[reg]
+ = get_frame_base (frame_info) + offset;
else
- frame_saved_regs->regs[reg]
- = (frame_info->frame + (u->Total_frame_size << 3)
+ frame_saved_regs[reg]
+ = (get_frame_base (frame_info) + (u->Total_frame_size << 3)
+ offset);
}
}
@@ -4074,13 +4068,13 @@ hppa_frame_find_saved_regs (struct frame_info *frame_info,
/* 1st HP CC FP register store. After this instruction
we've set enough state that the GCC and HPCC code are
both handled in the same manner. */
- frame_saved_regs->regs[reg + FP4_REGNUM + 4] = frame_info->frame;
+ frame_saved_regs[reg + FP4_REGNUM + 4] = get_frame_base (frame_info);
fp_loc = 8;
}
else
{
- frame_saved_regs->regs[reg + FP0_REGNUM + 4]
- = frame_info->frame + fp_loc;
+ frame_saved_regs[reg + FP0_REGNUM + 4]
+ = get_frame_base (frame_info) + fp_loc;
fp_loc += 8;
}
}
@@ -4099,6 +4093,17 @@ hppa_frame_find_saved_regs (struct frame_info *frame_info,
}
}
+/* XXX - deprecated. This is a compatibility function for targets
+ that do not yet implement DEPRECATED_FRAME_INIT_SAVED_REGS. */
+/* Find the addresses in which registers are saved in FRAME. */
+
+void
+hppa_frame_init_saved_regs (struct frame_info *frame)
+{
+ if (get_frame_saved_regs (frame) == NULL)
+ frame_saved_regs_zalloc (frame);
+ hppa_frame_find_saved_regs (frame, get_frame_saved_regs (frame));
+}
/* Exception handling support for the HP-UX ANSI C++ compiler.
The compiler (aCC) provides a callback for exception events;
@@ -4540,7 +4545,7 @@ child_get_current_exception_event (void)
return (struct exception_event_record *) NULL;
select_frame (fi);
- throw_addr = fi->pc;
+ throw_addr = get_frame_pc (fi);
/* Go back to original (top) frame */
select_frame (curr_frame);
@@ -4915,13 +4920,13 @@ hppa_cannot_store_register (int regnum)
CORE_ADDR
hppa_frame_args_address (struct frame_info *fi)
{
- return fi->frame;
+ return get_frame_base (fi);
}
CORE_ADDR
hppa_frame_locals_address (struct frame_info *fi)
{
- return fi->frame;
+ return get_frame_base (fi);
}
int
@@ -4976,10 +4981,9 @@ hppa_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_in_solib_call_trampoline (gdbarch, hppa_in_solib_call_trampoline);
set_gdbarch_in_solib_return_trampoline (gdbarch,
hppa_in_solib_return_trampoline);
- set_gdbarch_saved_pc_after_call (gdbarch, hppa_saved_pc_after_call);
+ set_gdbarch_deprecated_saved_pc_after_call (gdbarch, hppa_saved_pc_after_call);
set_gdbarch_inner_than (gdbarch, hppa_inner_than);
set_gdbarch_stack_align (gdbarch, hppa_stack_align);
- set_gdbarch_extra_stack_alignment_needed (gdbarch, 0);
set_gdbarch_decr_pc_after_break (gdbarch, 0);
set_gdbarch_register_size (gdbarch, 4);
set_gdbarch_num_regs (gdbarch, hppa_num_regs);
@@ -4995,7 +4999,7 @@ hppa_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_deprecated_max_register_raw_size (gdbarch, 4);
set_gdbarch_deprecated_max_register_virtual_size (gdbarch, 8);
set_gdbarch_register_virtual_type (gdbarch, hppa_register_virtual_type);
- set_gdbarch_store_struct_return (gdbarch, hppa_store_struct_return);
+ set_gdbarch_deprecated_store_struct_return (gdbarch, hppa_store_struct_return);
set_gdbarch_deprecated_extract_return_value (gdbarch,
hppa_extract_return_value);
set_gdbarch_use_struct_convention (gdbarch, hppa_use_struct_convention);
@@ -5004,21 +5008,20 @@ hppa_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
(gdbarch, hppa_extract_struct_value_address);
set_gdbarch_cannot_store_register (gdbarch, hppa_cannot_store_register);
set_gdbarch_deprecated_init_extra_frame_info (gdbarch, hppa_init_extra_frame_info);
- set_gdbarch_frame_chain (gdbarch, hppa_frame_chain);
- set_gdbarch_frame_chain_valid (gdbarch, hppa_frame_chain_valid);
+ set_gdbarch_deprecated_frame_chain (gdbarch, hppa_frame_chain);
+ set_gdbarch_deprecated_frame_chain_valid (gdbarch, hppa_frame_chain_valid);
set_gdbarch_frameless_function_invocation
(gdbarch, hppa_frameless_function_invocation);
- set_gdbarch_frame_saved_pc (gdbarch, hppa_frame_saved_pc);
+ set_gdbarch_deprecated_frame_saved_pc (gdbarch, hppa_frame_saved_pc);
set_gdbarch_frame_args_address (gdbarch, hppa_frame_args_address);
set_gdbarch_frame_locals_address (gdbarch, hppa_frame_locals_address);
set_gdbarch_frame_num_args (gdbarch, hppa_frame_num_args);
set_gdbarch_frame_args_skip (gdbarch, 0);
- /* set_gdbarch_deprecated_push_dummy_frame (gdbarch, hppa_push_dummy_frame); */
- set_gdbarch_pop_frame (gdbarch, hppa_pop_frame);
+ set_gdbarch_deprecated_push_dummy_frame (gdbarch, hppa_push_dummy_frame);
+ set_gdbarch_deprecated_pop_frame (gdbarch, hppa_pop_frame);
set_gdbarch_call_dummy_length (gdbarch, INSTRUCTION_SIZE * 28);
- set_gdbarch_call_dummy_start_offset (gdbarch, 0);
/* set_gdbarch_fix_call_dummy (gdbarch, hppa_fix_call_dummy); */
- set_gdbarch_push_arguments (gdbarch, hppa_push_arguments);
+ set_gdbarch_deprecated_push_arguments (gdbarch, hppa_push_arguments);
set_gdbarch_smash_text_address (gdbarch, hppa_smash_text_address);
set_gdbarch_believe_pcc_promotion (gdbarch, 1);
set_gdbarch_read_pc (gdbarch, hppa_target_read_pc);
diff --git a/gdb/hppah-nat.c b/gdb/hppah-nat.c
index 51b74fc..b953d25 100644
--- a/gdb/hppah-nat.c
+++ b/gdb/hppah-nat.c
@@ -31,6 +31,7 @@
#include "gdbcore.h"
#include "gdb_wait.h"
#include "regcache.h"
+#include "gdb_string.h"
#include <signal.h>
extern CORE_ADDR text_end;
@@ -785,8 +786,6 @@ startup_semaphore_t;
static startup_semaphore_t startup_semaphore;
-extern int parent_attach_all (int, PTRACE_ARG3_TYPE, int);
-
#ifdef PT_SETTRC
/* This function causes the caller's process to be traced by its
parent. This is intended to be called after GDB forks itself,
@@ -907,14 +906,13 @@ hppa_insert_hw_watchpoint (int pid, CORE_ADDR start, LONGEST len, int type)
}
int
-hppa_remove_hw_watchpoint (int pid, CORE_ADDR start, LONGEST len,
- enum bptype type)
+hppa_remove_hw_watchpoint (int pid, CORE_ADDR start, LONGEST len, int type)
{
error ("Hardware watchpoints not implemented on this platform.");
}
int
-hppa_can_use_hw_watchpoint (enum bptype type, int cnt, enum bptype ot)
+hppa_can_use_hw_watchpoint (int type, int cnt, int ot)
{
return 0;
}
diff --git a/gdb/hpread.c b/gdb/hpread.c
index 9ad2100..daa42c0 100644
--- a/gdb/hpread.c
+++ b/gdb/hpread.c
@@ -35,6 +35,8 @@
#include "gdb-stabs.h"
#include "gdbtypes.h"
#include "demangle.h"
+#include "somsolib.h"
+#include "gdb_assert.h"
/* Private information attached to an objfile which we use to find
and internalize the HP C debug symbols within that objfile. */
@@ -1024,7 +1026,7 @@ hpread_quick_traverse (struct objfile *objfile, char *gntt_bits,
while (VALID_CURR_FILE || VALID_CURR_MODULE)
{
- char *mod_name_string;
+ char *mod_name_string = NULL;
char *full_name_string;
/* First check for modules like "version.c", which have no code
@@ -2321,7 +2323,7 @@ static unsigned long
hpread_get_textlow (int global, int index, struct objfile *objfile,
int symcount)
{
- union dnttentry *dn_bufp;
+ union dnttentry *dn_bufp = NULL;
struct minimal_symbol *msymbol;
/* Look for a DNTT_TYPE_FUNCTION symbol. */
@@ -2340,6 +2342,11 @@ hpread_get_textlow (int global, int index, struct objfile *objfile,
&& index < symcount);
}
+ /* NOTE: cagney/2003-03-29: If !(index < symcount), dn_bufp is left
+ undefined and that means that the test below is using a garbage
+ pointer from the stack. */
+ gdb_assert (dn_bufp != NULL);
+
/* Avoid going past a DNTT_TYPE_END when looking for a DNTT_TYPE_FUNCTION. This
might happen when a sourcefile has no functions. */
if (dn_bufp->dblock.kind == DNTT_TYPE_END)
@@ -3358,10 +3365,10 @@ static struct type *
hpread_read_doc_function_type (dnttpointer hp_type, union dnttentry *dn_bufp,
struct objfile *objfile, int newblock)
{
- struct type *type, *type1;
struct pending *syms;
struct pending *local_list = NULL;
int nsyms = 0;
+ struct type *type;
dnttpointer param;
union dnttentry *paramp;
char *name;
@@ -3377,11 +3384,17 @@ hpread_read_doc_function_type (dnttpointer hp_type, union dnttentry *dn_bufp,
}
else
{
+ struct type *type1 = NULL;
/* Nope, so read it in and store it away. */
if (dn_bufp->dblock.kind == DNTT_TYPE_DOC_FUNCTION ||
dn_bufp->dblock.kind == DNTT_TYPE_DOC_MEMFUNC)
type1 = lookup_function_type (hpread_type_lookup (dn_bufp->ddocfunc.retval,
objfile));
+ /* NOTE: cagney/2003-03-29: Oh, no not again. TYPE1 is
+ potentially left undefined here. Assert it isn't and hope
+ the assert never fails ... */
+ gdb_assert (type1 != NULL);
+
replace_type (type, type1);
/* Mark it -- in the middle of processing */
diff --git a/gdb/i386-interix-tdep.c b/gdb/i386-interix-tdep.c
index b9ad2ff..7713863 100644
--- a/gdb/i386-interix-tdep.c
+++ b/gdb/i386-interix-tdep.c
@@ -149,7 +149,7 @@ i386_interix_back_one_frame (int fromleaf, struct frame_info *frame)
if (fromleaf)
{
- frame->pc = SAVED_PC_AFTER_CALL (frame->next);
+ frame->pc = DEPRECATED_SAVED_PC_AFTER_CALL (frame->next);
return;
}
@@ -162,7 +162,7 @@ i386_interix_back_one_frame (int fromleaf, struct frame_info *frame)
{
/* We know we're in a system call mini-frame; was it
NullApi or something else? */
- ra = SAVED_PC_AFTER_CALL (frame);
+ ra = DEPRECATED_SAVED_PC_AFTER_CALL (frame);
if (ra >= null_start && ra < null_end)
deprecated_set_frame_type (frame, SIGTRAMP_FRAME);
/* There might also be an indirect call to the mini-frame,
@@ -224,10 +224,10 @@ i386_interix_back_one_frame (int fromleaf, struct frame_info *frame)
/* No... We must be pointing at the frame that was called
by PdxSignalDeliverer; back up across the whole mess. */
- /* Extract the frame for PdxSignalDeliverer.
- Note: FRAME_CHAIN used the "old" frame pointer because we were
- a deliverer. Get the address of the context record that's on
- here frameless. */
+ /* Extract the frame for PdxSignalDeliverer. Note:
+ DEPRECATED_FRAME_CHAIN used the "old" frame pointer because
+ we were a deliverer. Get the address of the context record
+ that's on here frameless. */
context = read_memory_integer (frame->frame, 4); /* an Arg */
/* Now extract the frame pointer contained in the context. */
@@ -333,8 +333,8 @@ i386_interix_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
i386_interix_skip_trampoline_code);
set_gdbarch_deprecated_init_extra_frame_info (gdbarch, i386_interix_back_one_frame);
set_gdbarch_deprecated_init_frame_pc (gdbarch, init_frame_pc_noop);
- set_gdbarch_frame_chain_valid (gdbarch, i386_interix_frame_chain_valid);
- set_gdbarch_frame_saved_pc (gdbarch, i386_interix_frame_saved_pc);
+ set_gdbarch_deprecated_frame_chain_valid (gdbarch, i386_interix_frame_chain_valid);
+ set_gdbarch_deprecated_frame_saved_pc (gdbarch, i386_interix_frame_saved_pc);
set_gdbarch_name_of_malloc (gdbarch, "_malloc");
}
diff --git a/gdb/i386-linux-nat.c b/gdb/i386-linux-nat.c
index 5ea7802..3744124 100644
--- a/gdb/i386-linux-nat.c
+++ b/gdb/i386-linux-nat.c
@@ -107,10 +107,13 @@ static int regmap[] =
/* Which ptrace request retrieves which registers?
These apply to the corresponding SET requests as well. */
+
#define GETREGS_SUPPLIES(regno) \
((0 <= (regno) && (regno) <= 15) || (regno) == I386_LINUX_ORIG_EAX_REGNUM)
+
#define GETFPREGS_SUPPLIES(regno) \
(FP0_REGNUM <= (regno) && (regno) <= LAST_FPU_CTRL_REGNUM)
+
#define GETFPXREGS_SUPPLIES(regno) \
(FP0_REGNUM <= (regno) && (regno) <= MXCSR_REGNUM)
@@ -178,8 +181,9 @@ fetch_register (int regno)
}
/* GNU/Linux LWP ID's are process ID's. */
- if ((tid = TIDGET (inferior_ptid)) == 0)
- tid = PIDGET (inferior_ptid); /* Not a threaded program. */
+ tid = TIDGET (inferior_ptid);
+ if (tid == 0)
+ tid = PIDGET (inferior_ptid); /* Not a threaded program. */
errno = 0;
val = ptrace (PTRACE_PEEKUSER, tid, register_addr (regno, 0), 0);
@@ -203,14 +207,15 @@ store_register (int regno)
return;
/* GNU/Linux LWP ID's are process ID's. */
- if ((tid = TIDGET (inferior_ptid)) == 0)
- tid = PIDGET (inferior_ptid); /* Not a threaded program. */
+ tid = TIDGET (inferior_ptid);
+ if (tid == 0)
+ tid = PIDGET (inferior_ptid); /* Not a threaded program. */
errno = 0;
regcache_collect (regno, &val);
ptrace (PTRACE_POKEUSER, tid, register_addr (regno, 0), val);
if (errno != 0)
- error ("Couldn't read register %s (#%d): %s.", REGISTER_NAME (regno),
+ error ("Couldn't write register %s (#%d): %s.", REGISTER_NAME (regno),
regno, safe_strerror (errno));
}
@@ -522,8 +527,9 @@ fetch_inferior_registers (int regno)
}
/* GNU/Linux LWP ID's are process ID's. */
- if ((tid = TIDGET (inferior_ptid)) == 0)
- tid = PIDGET (inferior_ptid); /* Not a threaded program. */
+ tid = TIDGET (inferior_ptid);
+ if (tid == 0)
+ tid = PIDGET (inferior_ptid); /* Not a threaded program. */
/* Use the PTRACE_GETFPXREGS request whenever possible, since it
transfers more registers in one system call, and we'll cache the
@@ -593,8 +599,9 @@ store_inferior_registers (int regno)
}
/* GNU/Linux LWP ID's are process ID's. */
- if ((tid = TIDGET (inferior_ptid)) == 0)
- tid = PIDGET (inferior_ptid); /* Not a threaded program. */
+ tid = TIDGET (inferior_ptid);
+ if (tid == 0)
+ tid = PIDGET (inferior_ptid); /* Not a threaded program. */
/* Use the PTRACE_SETFPXREGS requests whenever possible, since it
transfers more registers in one system call. But remember that
diff --git a/gdb/i386-linux-tdep.c b/gdb/i386-linux-tdep.c
index f92f1ea..2fe4d04 100644
--- a/gdb/i386-linux-tdep.c
+++ b/gdb/i386-linux-tdep.c
@@ -374,7 +374,7 @@ skip_hurd_resolver (CORE_ADDR pc)
= lookup_minimal_symbol ("fixup", NULL, objfile);
if (fixup && SYMBOL_VALUE_ADDRESS (fixup) == pc)
- return (SAVED_PC_AFTER_CALL (get_current_frame ()));
+ return (DEPRECATED_SAVED_PC_AFTER_CALL (get_current_frame ()));
}
return 0;
diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
index 018f073..475f89c 100644
--- a/gdb/i386-tdep.c
+++ b/gdb/i386-tdep.c
@@ -502,7 +502,7 @@ i386_frameless_signal_p (struct frame_info *frame)
return (get_next_frame (frame)
&& get_frame_type (get_next_frame (frame)) == SIGTRAMP_FRAME
&& (frameless_look_for_prologue (frame)
- || get_frame_pc (frame) == get_pc_function_start (get_frame_pc (frame))));
+ || get_frame_pc (frame) == get_frame_func (frame)));
}
/* Return the chain-pointer for FRAME. In the case of the i386, the
@@ -636,10 +636,10 @@ i386_frame_num_args (struct frame_info *fi)
if (pfi == 0)
{
/* NOTE: This can happen if we are looking at the frame for
- main, because FRAME_CHAIN_VALID won't let us go into start.
- If we have debugging symbols, that's not really a big deal;
- it just means it will only show as many arguments to main as
- are declared. */
+ main, because DEPRECATED_FRAME_CHAIN_VALID won't let us go
+ into start. If we have debugging symbols, that's not really
+ a big deal; it just means it will only show as many arguments
+ to main as are declared. */
return -1;
}
else
@@ -714,7 +714,7 @@ i386_frame_init_saved_regs (struct frame_info *fip)
frame_saved_regs_zalloc (fip);
- pc = get_pc_function_start (get_frame_pc (fip));
+ pc = get_frame_func (fip);
if (pc != 0)
locals = i386_get_frame_setup (pc);
@@ -925,7 +925,7 @@ static CORE_ADDR
i386_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
int struct_return, CORE_ADDR struct_addr)
{
- sp = default_push_arguments (nargs, args, sp, struct_return, struct_addr);
+ sp = legacy_push_arguments (nargs, args, sp, struct_return, struct_addr);
if (struct_return)
{
@@ -939,12 +939,6 @@ i386_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
return sp;
}
-static void
-i386_store_struct_return (CORE_ADDR addr, CORE_ADDR sp)
-{
- /* Do nothing. Everything was already done by i386_push_arguments. */
-}
-
/* These registers are used for returning integers (and on some
targets also for returning `struct' and `union' values when their
size and alignment match an integer type). */
@@ -1129,7 +1123,7 @@ i386_use_struct_convention (int gcc_p, struct type *type)
potentially they could be used for things other than address. */
static struct type *
-i386_register_virtual_type (int regnum)
+i386_register_type (struct gdbarch *gdbarch, int regnum)
{
if (regnum == PC_REGNUM || regnum == FP_REGNUM || regnum == SP_REGNUM)
return lookup_pointer_type (builtin_type_void);
@@ -1558,25 +1552,15 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_register_name (gdbarch, i386_register_name);
set_gdbarch_register_size (gdbarch, 4);
set_gdbarch_register_bytes (gdbarch, I386_SIZEOF_GREGS + I386_SIZEOF_FREGS);
- set_gdbarch_deprecated_max_register_raw_size (gdbarch, I386_MAX_REGISTER_SIZE);
- set_gdbarch_deprecated_max_register_virtual_size (gdbarch, I386_MAX_REGISTER_SIZE);
- set_gdbarch_register_virtual_type (gdbarch, i386_register_virtual_type);
+ set_gdbarch_register_type (gdbarch, i386_register_type);
set_gdbarch_print_float_info (gdbarch, i387_print_float_info);
set_gdbarch_get_longjmp_target (gdbarch, i386_get_longjmp_target);
/* Call dummy code. */
- set_gdbarch_call_dummy_address (gdbarch, entry_point_address);
- set_gdbarch_call_dummy_start_offset (gdbarch, 0);
- set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 0);
- set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 1);
- set_gdbarch_call_dummy_length (gdbarch, 0);
- set_gdbarch_call_dummy_p (gdbarch, 1);
set_gdbarch_call_dummy_words (gdbarch, NULL);
set_gdbarch_sizeof_call_dummy_words (gdbarch, 0);
- set_gdbarch_call_dummy_stack_adjust_p (gdbarch, 0);
- set_gdbarch_fix_call_dummy (gdbarch, generic_fix_call_dummy);
set_gdbarch_register_convertible (gdbarch, i386_register_convertible);
set_gdbarch_register_convert_to_virtual (gdbarch,
@@ -1589,10 +1573,9 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_parm_boundary (gdbarch, 32);
set_gdbarch_extract_return_value (gdbarch, i386_extract_return_value);
- set_gdbarch_push_arguments (gdbarch, i386_push_arguments);
- set_gdbarch_push_return_address (gdbarch, i386_push_return_address);
- set_gdbarch_pop_frame (gdbarch, i386_pop_frame);
- set_gdbarch_store_struct_return (gdbarch, i386_store_struct_return);
+ set_gdbarch_deprecated_push_arguments (gdbarch, i386_push_arguments);
+ set_gdbarch_deprecated_push_return_address (gdbarch, i386_push_return_address);
+ set_gdbarch_deprecated_pop_frame (gdbarch, i386_pop_frame);
set_gdbarch_store_return_value (gdbarch, i386_store_return_value);
set_gdbarch_extract_struct_value_address (gdbarch,
i386_extract_struct_value_address);
@@ -1616,9 +1599,9 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_frame_args_skip (gdbarch, 8);
set_gdbarch_frameless_function_invocation (gdbarch,
i386_frameless_function_invocation);
- set_gdbarch_frame_chain (gdbarch, i386_frame_chain);
- set_gdbarch_frame_saved_pc (gdbarch, i386_frame_saved_pc);
- set_gdbarch_saved_pc_after_call (gdbarch, i386_saved_pc_after_call);
+ set_gdbarch_deprecated_frame_chain (gdbarch, i386_frame_chain);
+ set_gdbarch_deprecated_frame_saved_pc (gdbarch, i386_frame_saved_pc);
+ set_gdbarch_deprecated_saved_pc_after_call (gdbarch, i386_saved_pc_after_call);
set_gdbarch_frame_num_args (gdbarch, i386_frame_num_args);
set_gdbarch_pc_in_sigtramp (gdbarch, i386_pc_in_sigtramp);
@@ -1633,6 +1616,9 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
i386_add_reggroups (gdbarch);
set_gdbarch_register_reggroup_p (gdbarch, i386_register_reggroup_p);
+ /* Should be using push_dummy_call. */
+ set_gdbarch_deprecated_dummy_write_sp (gdbarch, generic_target_write_sp);
+
/* Hook in ABI-specific overrides, if they have been registered. */
gdbarch_init_osabi (info, gdbarch);
diff --git a/gdb/i386-tdep.h b/gdb/i386-tdep.h
index 25bf6b3..1e0b405 100644
--- a/gdb/i386-tdep.h
+++ b/gdb/i386-tdep.h
@@ -22,6 +22,10 @@
#ifndef I386_TDEP_H
#define I386_TDEP_H
+struct reggroup;
+struct gdbarch;
+struct frame_info;
+
/* GDB's i386 target supports both the 32-bit Intel Architecture
(IA-32) and the 64-bit AMD x86-64 architecture. Internally it uses
a similar register layout for both.
diff --git a/gdb/i386ly-tdep.c b/gdb/i386ly-tdep.c
index d0775b7..2374b71 100644
--- a/gdb/i386ly-tdep.c
+++ b/gdb/i386ly-tdep.c
@@ -53,7 +53,7 @@ i386lynx_saved_pc_after_call (struct frame_info *frame)
static void
i386lynx_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
- set_gdbarch_saved_pc_after_call (gdbarch, i386lynx_saved_pc_after_call);
+ set_gdbarch_deprecated_saved_pc_after_call (gdbarch, i386lynx_saved_pc_after_call);
}
diff --git a/gdb/i387-tdep.c b/gdb/i387-tdep.c
index 9b47e58..045357e 100644
--- a/gdb/i387-tdep.c
+++ b/gdb/i387-tdep.c
@@ -1,6 +1,7 @@
/* Intel 387 floating point stuff.
+
Copyright 1988, 1989, 1991, 1992, 1993, 1994, 1998, 1999, 2000,
- 2001, 2002 Free Software Foundation, Inc.
+ 2001, 2002, 2003 Free Software Foundation, Inc.
This file is part of GDB.
@@ -33,24 +34,6 @@
#include "i386-tdep.h"
-/* FIXME: Eliminate the next two functions when we have the time to
- change all the callers. */
-
-void i387_to_double (char *from, char *to);
-void double_to_i387 (char *from, char *to);
-
-void
-i387_to_double (char *from, char *to)
-{
- floatformat_to_double (&floatformat_i387_ext, from, (double *) to);
-}
-
-void
-double_to_i387 (char *from, char *to)
-{
- floatformat_from_double (&floatformat_i387_ext, (double *) from, to);
-}
-
/* FIXME: The functions on this page are used by the old `info float'
implementations that a few of the i386 targets provide. These
diff --git a/gdb/i387-tdep.h b/gdb/i387-tdep.h
index e29b198..7079310 100644
--- a/gdb/i387-tdep.h
+++ b/gdb/i387-tdep.h
@@ -21,6 +21,10 @@
#ifndef I387_TDEP_H
#define I387_TDEP_H
+struct gdbarch;
+struct ui_file;
+struct frame_info;
+
/* Print out the i387 floating point state. */
extern void i387_print_float_info (struct gdbarch *gdbarch,
diff --git a/gdb/ia64-tdep.c b/gdb/ia64-tdep.c
index 36036f2..86638fb 100644
--- a/gdb/ia64-tdep.c
+++ b/gdb/ia64-tdep.c
@@ -91,19 +91,12 @@ static gdbarch_register_virtual_size_ftype ia64_register_virtual_size;
static gdbarch_register_virtual_type_ftype ia64_register_virtual_type;
static gdbarch_register_byte_ftype ia64_register_byte;
static gdbarch_breakpoint_from_pc_ftype ia64_breakpoint_from_pc;
-static gdbarch_frame_chain_ftype ia64_frame_chain;
-static gdbarch_frame_saved_pc_ftype ia64_frame_saved_pc;
static gdbarch_skip_prologue_ftype ia64_skip_prologue;
-static gdbarch_get_saved_register_ftype ia64_get_saved_register;
static gdbarch_deprecated_extract_return_value_ftype ia64_extract_return_value;
static gdbarch_deprecated_extract_struct_value_address_ftype ia64_extract_struct_value_address;
static gdbarch_use_struct_convention_ftype ia64_use_struct_convention;
static gdbarch_frameless_function_invocation_ftype ia64_frameless_function_invocation;
-static gdbarch_store_struct_return_ftype ia64_store_struct_return;
-static gdbarch_push_arguments_ftype ia64_push_arguments;
-static gdbarch_push_return_address_ftype ia64_push_return_address;
-static gdbarch_pop_frame_ftype ia64_pop_frame;
-static gdbarch_saved_pc_after_call_ftype ia64_saved_pc_after_call;
+static gdbarch_deprecated_saved_pc_after_call_ftype ia64_saved_pc_after_call;
static void ia64_pop_frame_regular (struct frame_info *frame);
static struct type *is_float_or_hfa_type (struct type *t);
@@ -280,7 +273,7 @@ ia64_register_convert_to_virtual (int regnum, struct type *type,
{
DOUBLEST val;
floatformat_to_doublest (&floatformat_ia64_ext, from, &val);
- store_floating(to, TYPE_LENGTH(type), val);
+ deprecated_store_floating (to, TYPE_LENGTH(type), val);
}
else
error("ia64_register_convert_to_virtual called with non floating point register number");
@@ -292,7 +285,7 @@ ia64_register_convert_to_raw (struct type *type, int regnum,
{
if (regnum >= IA64_FR0_REGNUM && regnum <= IA64_FR127_REGNUM)
{
- DOUBLEST val = extract_floating (from, TYPE_LENGTH(type));
+ DOUBLEST val = deprecated_extract_floating (from, TYPE_LENGTH(type));
floatformat_from_doublest (&floatformat_ia64_ext, &val, to);
}
else
@@ -1212,7 +1205,7 @@ ia64_frame_init_saved_regs (struct frame_info *frame)
{
CORE_ADDR func_start;
- func_start = get_pc_function_start (get_frame_pc (frame));
+ func_start = get_frame_func (frame);
examine_prologue (func_start, get_frame_pc (frame), frame);
}
}
@@ -2007,8 +2000,8 @@ ia64_pop_frame_regular (struct frame_info *frame)
}
}
- write_register (sp_regnum, FRAME_CHAIN (frame));
- write_pc (FRAME_SAVED_PC (frame));
+ write_register (sp_regnum, DEPRECATED_FRAME_CHAIN (frame));
+ write_pc (DEPRECATED_FRAME_SAVED_PC (frame));
cfm = read_register (IA64_CFM_REGNUM);
@@ -2194,13 +2187,13 @@ ia64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown);
set_gdbarch_frameless_function_invocation (gdbarch, ia64_frameless_function_invocation);
- set_gdbarch_saved_pc_after_call (gdbarch, ia64_saved_pc_after_call);
+ set_gdbarch_deprecated_saved_pc_after_call (gdbarch, ia64_saved_pc_after_call);
- set_gdbarch_frame_chain (gdbarch, ia64_frame_chain);
- set_gdbarch_frame_saved_pc (gdbarch, ia64_frame_saved_pc);
+ set_gdbarch_deprecated_frame_chain (gdbarch, ia64_frame_chain);
+ set_gdbarch_deprecated_frame_saved_pc (gdbarch, ia64_frame_saved_pc);
set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, ia64_frame_init_saved_regs);
- set_gdbarch_get_saved_register (gdbarch, ia64_get_saved_register);
+ set_gdbarch_deprecated_get_saved_register (gdbarch, ia64_get_saved_register);
set_gdbarch_register_convertible (gdbarch, ia64_register_convertible);
set_gdbarch_register_convert_to_virtual (gdbarch, ia64_register_convert_to_virtual);
@@ -2209,7 +2202,7 @@ ia64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_use_struct_convention (gdbarch, ia64_use_struct_convention);
set_gdbarch_deprecated_extract_return_value (gdbarch, ia64_extract_return_value);
- set_gdbarch_store_struct_return (gdbarch, ia64_store_struct_return);
+ set_gdbarch_deprecated_store_struct_return (gdbarch, ia64_store_struct_return);
set_gdbarch_deprecated_store_return_value (gdbarch, ia64_store_return_value);
set_gdbarch_deprecated_extract_struct_value_address (gdbarch, ia64_extract_struct_value_address);
@@ -2220,15 +2213,12 @@ ia64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_write_pc (gdbarch, ia64_write_pc);
/* Settings for calling functions in the inferior. */
- set_gdbarch_call_dummy_length (gdbarch, 0);
- set_gdbarch_push_arguments (gdbarch, ia64_push_arguments);
- set_gdbarch_push_return_address (gdbarch, ia64_push_return_address);
- set_gdbarch_pop_frame (gdbarch, ia64_pop_frame);
+ set_gdbarch_deprecated_push_arguments (gdbarch, ia64_push_arguments);
+ set_gdbarch_deprecated_push_return_address (gdbarch, ia64_push_return_address);
+ set_gdbarch_deprecated_pop_frame (gdbarch, ia64_pop_frame);
- set_gdbarch_call_dummy_p (gdbarch, 1);
set_gdbarch_call_dummy_words (gdbarch, ia64_call_dummy_words);
set_gdbarch_sizeof_call_dummy_words (gdbarch, sizeof (ia64_call_dummy_words));
- set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 1);
set_gdbarch_deprecated_init_extra_frame_info (gdbarch, ia64_init_extra_frame_info);
set_gdbarch_frame_args_address (gdbarch, ia64_frame_args_address);
set_gdbarch_frame_locals_address (gdbarch, ia64_frame_locals_address);
@@ -2244,13 +2234,7 @@ ia64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
set_gdbarch_read_sp (gdbarch, generic_target_read_sp);
- set_gdbarch_write_sp (gdbarch, generic_target_write_sp);
-
- set_gdbarch_call_dummy_address (gdbarch, entry_point_address);
- set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 0);
- set_gdbarch_call_dummy_start_offset (gdbarch, 0);
- set_gdbarch_call_dummy_stack_adjust_p (gdbarch, 0);
- set_gdbarch_fix_call_dummy (gdbarch, generic_fix_call_dummy);
+ set_gdbarch_deprecated_dummy_write_sp (gdbarch, generic_target_write_sp);
set_gdbarch_decr_pc_after_break (gdbarch, 0);
set_gdbarch_function_start_offset (gdbarch, 0);
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index 19077b4..01ab3d7 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -986,50 +986,46 @@ run_stack_dummy (CORE_ADDR addr, struct regcache *buffer)
{
struct cleanup *old_cleanups = make_cleanup (null_cleanup, 0);
int saved_async = 0;
+ struct breakpoint *bpt;
+ struct symtab_and_line sal;
/* Now proceed, having reached the desired place. */
clear_proceed_status ();
- if (CALL_DUMMY_BREAKPOINT_OFFSET_P)
+ init_sal (&sal); /* initialize to zeroes */
+ if (CALL_DUMMY_LOCATION == AT_ENTRY_POINT)
{
- struct breakpoint *bpt;
- struct symtab_and_line sal;
-
- init_sal (&sal); /* initialize to zeroes */
- if (CALL_DUMMY_LOCATION == AT_ENTRY_POINT)
- {
- sal.pc = CALL_DUMMY_ADDRESS ();
- }
- else
- {
- /* If defined, CALL_DUMMY_BREAKPOINT_OFFSET is where we need
- to put a breakpoint instruction. If not, the call dummy
- already has the breakpoint instruction in it.
-
- ADDR IS THE ADDRESS of the call dummy plus the
- CALL_DUMMY_START_OFFSET, so we need to subtract the
- CALL_DUMMY_START_OFFSET. */
- sal.pc = addr - CALL_DUMMY_START_OFFSET + CALL_DUMMY_BREAKPOINT_OFFSET;
- }
- sal.section = find_pc_overlay (sal.pc);
-
- {
- /* Set up a frame ID for the dummy frame so we can pass it to
- set_momentary_breakpoint. We need to give the breakpoint a
- frame ID so that the breakpoint code can correctly
- re-identify the dummy breakpoint. */
- struct frame_id frame = frame_id_build (read_fp (), sal.pc);
- /* Create a momentary breakpoint at the return address of the
- inferior. That way it breaks when it returns. */
- bpt = set_momentary_breakpoint (sal, frame, bp_call_dummy);
- bpt->disposition = disp_del;
- }
-
- /* If all error()s out of proceed ended up calling normal_stop (and
- perhaps they should; it already does in the special case of error
- out of resume()), then we wouldn't need this. */
- make_cleanup (breakpoint_auto_delete_contents, &stop_bpstat);
+ sal.pc = CALL_DUMMY_ADDRESS ();
+ }
+ else
+ {
+ /* If defined, CALL_DUMMY_BREAKPOINT_OFFSET is where we need to
+ put a breakpoint instruction. If not, the call dummy already
+ has the breakpoint instruction in it.
+
+ ADDR IS THE ADDRESS of the call dummy plus the
+ CALL_DUMMY_START_OFFSET, so we need to subtract the
+ CALL_DUMMY_START_OFFSET. */
+ sal.pc = addr - CALL_DUMMY_START_OFFSET + CALL_DUMMY_BREAKPOINT_OFFSET;
}
+ sal.section = find_pc_overlay (sal.pc);
+
+ {
+ /* Set up a frame ID for the dummy frame so we can pass it to
+ set_momentary_breakpoint. We need to give the breakpoint a
+ frame ID so that the breakpoint code can correctly re-identify
+ the dummy breakpoint. */
+ struct frame_id frame = frame_id_build (read_fp (), sal.pc);
+ /* Create a momentary breakpoint at the return address of the
+ inferior. That way it breaks when it returns. */
+ bpt = set_momentary_breakpoint (sal, frame, bp_call_dummy);
+ bpt->disposition = disp_del;
+ }
+
+ /* If all error()s out of proceed ended up calling normal_stop (and
+ perhaps they should; it already does in the special case of error
+ out of resume()), then we wouldn't need this. */
+ make_cleanup (breakpoint_auto_delete_contents, &stop_bpstat);
disable_watchpoints_before_interactive_call_start ();
proceed_to_finish = 1; /* We want stop_registers, please... */
@@ -1914,8 +1910,13 @@ attach_command (char *args, int from_tty)
/* No traps are generated when attaching to inferior under Mach 3
or GNU hurd. */
#ifndef ATTACH_NO_WAIT
- stop_soon_quietly = 1;
+ /* Careful here. See comments in inferior.h. Basically some OSes
+ don't ignore SIGSTOPs on continue requests anymore. We need a
+ way for handle_inferior_event to reset the stop_signal variable
+ after an attach, and this is what STOP_QUIETLY_NO_SIGSTOP is for. */
+ stop_soon = STOP_QUIETLY_NO_SIGSTOP;
wait_for_inferior ();
+ stop_soon = NO_STOP_QUIETLY;
#endif
/*
diff --git a/gdb/inferior.h b/gdb/inferior.h
index 4616a1f..6203449 100644
--- a/gdb/inferior.h
+++ b/gdb/inferior.h
@@ -24,6 +24,10 @@
#if !defined (INFERIOR_H)
#define INFERIOR_H 1
+struct target_waitstatus;
+struct frame_info;
+struct ui_file;
+struct type;
struct gdbarch;
struct regcache;
@@ -178,8 +182,6 @@ extern CORE_ADDR read_sp (void);
extern CORE_ADDR generic_target_read_sp (void);
-extern void write_sp (CORE_ADDR);
-
extern void generic_target_write_sp (CORE_ADDR);
extern CORE_ADDR read_fp (void);
@@ -392,12 +394,37 @@ extern enum step_over_calls_kind step_over_calls;
extern int step_multi;
-/* Nonzero means expecting a trap and caller will handle it themselves.
- It is used after attach, due to attaching to a process;
- when running in the shell before the child program has been exec'd;
- and when running some kinds of remote stuff (FIXME?). */
+/* Nonzero means expecting a trap and caller will handle it
+ themselves. It is used when running in the shell before the child
+ program has been exec'd; and when running some kinds of remote
+ stuff (FIXME?). */
+
+/* It is also used after attach, due to attaching to a process. This
+ is a bit trickier. When doing an attach, the kernel stops the
+ debuggee with a SIGSTOP. On newer GNU/Linux kernels (>= 2.5.61)
+ the handling of SIGSTOP for a ptraced process has changed. Earlier
+ versions of the kernel would ignore these SIGSTOPs, while now
+ SIGSTOP is treated like any other signal, i.e. it is not muffled.
+
+ If the gdb user does a 'continue' after the 'attach', gdb passes
+ the global variable stop_signal (which stores the signal from the
+ attach, SIGSTOP) to the ptrace(PTRACE_CONT,...) call. This is
+ problematic, because the kernel doesn't ignore such SIGSTOP
+ now. I.e. it is reported back to gdb, which in turn presents it
+ back to the user.
+
+ To avoid the problem, we use STOP_QUIETLY_NO_SIGSTOP, which allows
+ gdb to clear the value of stop_signal after the attach, so that it
+ is not passed back down to the kernel. */
+
+enum stop_kind
+ {
+ NO_STOP_QUIETLY = 0,
+ STOP_QUIETLY,
+ STOP_QUIETLY_NO_SIGSTOP
+ };
-extern int stop_soon_quietly;
+extern enum stop_kind stop_soon;
/* Nonzero if proceed is being used for a "finish" command or a similar
situation when stop_registers should be saved. */
@@ -420,54 +447,13 @@ extern int attach_flag;
#define ON_STACK 1
#define AT_ENTRY_POINT 4
-#if !defined (CALL_DUMMY_ADDRESS)
-#define CALL_DUMMY_ADDRESS() (internal_error (__FILE__, __LINE__, "CALL_DUMMY_ADDRESS"), 0)
-#endif
-#if !defined (CALL_DUMMY_START_OFFSET)
-#define CALL_DUMMY_START_OFFSET (internal_error (__FILE__, __LINE__, "CALL_DUMMY_START_OFFSET"), 0)
-#endif
-#if !defined (CALL_DUMMY_BREAKPOINT_OFFSET)
-#define CALL_DUMMY_BREAKPOINT_OFFSET_P (0)
-#define CALL_DUMMY_BREAKPOINT_OFFSET (internal_error (__FILE__, __LINE__, "CALL_DUMMY_BREAKPOINT_OFFSET"), 0)
-#endif
-#if !defined CALL_DUMMY_BREAKPOINT_OFFSET_P
-#define CALL_DUMMY_BREAKPOINT_OFFSET_P (1)
-#endif
-#if !defined (CALL_DUMMY_LENGTH)
-#define CALL_DUMMY_LENGTH (internal_error (__FILE__, __LINE__, "CALL_DUMMY_LENGTH"), 0)
-#endif
-
-#if defined (CALL_DUMMY_STACK_ADJUST)
-#if !defined (CALL_DUMMY_STACK_ADJUST_P)
-#define CALL_DUMMY_STACK_ADJUST_P (1)
-#endif
-#endif
-#if !defined (CALL_DUMMY_STACK_ADJUST)
-#define CALL_DUMMY_STACK_ADJUST (internal_error (__FILE__, __LINE__, "CALL_DUMMY_STACK_ADJUST"), 0)
-#endif
-#if !defined (CALL_DUMMY_STACK_ADJUST_P)
-#define CALL_DUMMY_STACK_ADJUST_P (0)
-#endif
-
/* FIXME: cagney/2000-04-17: gdbarch should manage this. The default
shouldn't be necessary. */
-#if !defined (CALL_DUMMY_P)
-#if defined (CALL_DUMMY)
-#define CALL_DUMMY_P 1
-#else
-#define CALL_DUMMY_P 0
-#endif
-#endif
-
#if !defined PUSH_DUMMY_FRAME
#define PUSH_DUMMY_FRAME (internal_error (__FILE__, __LINE__, "PUSH_DUMMY_FRAME"), 0)
#endif
-#if !defined FIX_CALL_DUMMY
-#define FIX_CALL_DUMMY(a1,a2,a3,a4,a5,a6,a7) (internal_error (__FILE__, __LINE__, "FIX_CALL_DUMMY"), 0)
-#endif
-
#if !defined STORE_STRUCT_RETURN
#define STORE_STRUCT_RETURN(a1,a2) (internal_error (__FILE__, __LINE__, "STORE_STRUCT_RETURN"), 0)
#endif
diff --git a/gdb/infrun.c b/gdb/infrun.c
index f65af35..9503b10 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -42,6 +42,8 @@
#include "inf-loop.h"
#include "regcache.h"
#include "value.h"
+#include "observer.h"
+#include "language.h"
/* Prototypes for local functions */
@@ -106,21 +108,6 @@ static ptid_t previous_inferior_ptid;
static int may_follow_exec = MAY_FOLLOW_EXEC;
-/* Dynamic function trampolines are similar to solib trampolines in that they
- are between the caller and the callee. The difference is that when you
- enter a dynamic trampoline, you can't determine the callee's address. Some
- (usually complex) code needs to run in the dynamic trampoline to figure out
- the callee's address. This macro is usually called twice. First, when we
- enter the trampoline (looks like a normal function call at that point). It
- should return the PC of a point within the trampoline where the callee's
- address is known. Second, when we hit the breakpoint, this routine returns
- the callee's address. At that point, things proceed as per a step resume
- breakpoint. */
-
-#ifndef DYNAMIC_TRAMPOLINE_NEXTPC
-#define DYNAMIC_TRAMPOLINE_NEXTPC(pc) 0
-#endif
-
/* If the program uses ELF-style shared libraries, then calls to
functions in shared libraries go through stubs, which live in a
table called the PLT (Procedure Linkage Table). The first time the
@@ -299,7 +286,7 @@ int stop_after_trap;
when running in the shell before the child program has been exec'd;
and when running some kinds of remote stuff (FIXME?). */
-int stop_soon_quietly;
+enum stop_kind stop_soon;
/* Nonzero if proceed is being used for a "finish" command or a similar
situation when stop_registers should be saved. */
@@ -672,7 +659,7 @@ clear_proceed_status (void)
step_frame_id = null_frame_id;
step_over_calls = STEP_OVER_UNDEBUGGABLE;
stop_after_trap = 0;
- stop_soon_quietly = 0;
+ stop_soon = NO_STOP_QUIETLY;
proceed_to_finish = 0;
breakpoint_proceeded = 1; /* We're about to proceed... */
@@ -804,7 +791,6 @@ proceed (CORE_ADDR addr, enum target_signal siggnal, int step)
to be preserved over calls to it and cleared when the inferior
is started. */
static CORE_ADDR prev_pc;
-static CORE_ADDR prev_func_start;
static char *prev_func_name;
@@ -815,7 +801,7 @@ start_remote (void)
{
init_thread_list ();
init_wait_for_inferior ();
- stop_soon_quietly = 1;
+ stop_soon = STOP_QUIETLY;
trap_expected = 0;
/* Always go on waiting for the target, regardless of the mode. */
@@ -843,7 +829,6 @@ init_wait_for_inferior (void)
{
/* These are meaningless until the first time through wait_for_inferior. */
prev_pc = 0;
- prev_func_start = 0;
prev_func_name = NULL;
#ifdef HP_OS_BUG
@@ -1131,8 +1116,7 @@ context_switch (struct execution_control_state *ecs)
if (in_thread_list (inferior_ptid) && in_thread_list (ecs->ptid))
{ /* Perform infrun state context switch: */
/* Save infrun state for the old thread. */
- save_infrun_state (inferior_ptid, prev_pc,
- prev_func_start, prev_func_name,
+ save_infrun_state (inferior_ptid, prev_pc, prev_func_name,
trap_expected, step_resume_breakpoint,
through_sigtramp_breakpoint, step_range_start,
step_range_end, &step_frame_id,
@@ -1143,8 +1127,7 @@ context_switch (struct execution_control_state *ecs)
ecs->current_line, ecs->current_symtab, step_sp);
/* Load infrun state for the new thread. */
- load_infrun_state (ecs->ptid, &prev_pc,
- &prev_func_start, &prev_func_name,
+ load_infrun_state (ecs->ptid, &prev_pc, &prev_func_name,
&trap_expected, &step_resume_breakpoint,
&through_sigtramp_breakpoint, &step_range_start,
&step_range_end, &step_frame_id,
@@ -1166,6 +1149,11 @@ void
handle_inferior_event (struct execution_control_state *ecs)
{
CORE_ADDR real_stop_pc;
+ /* NOTE: cagney/2003-03-28: If you're looking at this code and
+ thinking that the variable stepped_after_stopped_by_watchpoint
+ isn't used, then you're wrong! The macro STOPPED_BY_WATCHPOINT,
+ defined in the file "config/pa/nm-hppah.h", accesses the variable
+ indirectly. Mutter something rude about the HP merge. */
int stepped_after_stopped_by_watchpoint;
int sw_single_step_trap_p = 0;
@@ -1178,7 +1166,15 @@ handle_inferior_event (struct execution_control_state *ecs)
case infwait_thread_hop_state:
/* Cancel the waiton_ptid. */
ecs->waiton_ptid = pid_to_ptid (-1);
- /* Fall thru to the normal_state case. */
+ /* See comments where a TARGET_WAITKIND_SYSCALL_RETURN event
+ is serviced in this loop, below. */
+ if (ecs->enable_hw_watchpoints_after_wait)
+ {
+ TARGET_ENABLE_HW_WATCHPOINTS (PIDGET (inferior_ptid));
+ ecs->enable_hw_watchpoints_after_wait = 0;
+ }
+ stepped_after_stopped_by_watchpoint = 0;
+ break;
case infwait_normal_state:
/* See comments where a TARGET_WAITKIND_SYSCALL_RETURN event
@@ -1192,6 +1188,7 @@ handle_inferior_event (struct execution_control_state *ecs)
break;
case infwait_nullified_state:
+ stepped_after_stopped_by_watchpoint = 0;
break;
case infwait_nonstep_watch_state:
@@ -1202,6 +1199,9 @@ handle_inferior_event (struct execution_control_state *ecs)
in combination correctly? */
stepped_after_stopped_by_watchpoint = 1;
break;
+
+ default:
+ internal_error (__FILE__, __LINE__, "bad switch");
}
ecs->infwait_state = infwait_normal_state;
@@ -1254,7 +1254,7 @@ handle_inferior_event (struct execution_control_state *ecs)
might be the shell which has just loaded some objects,
otherwise add the symbols for the newly loaded objects. */
#ifdef SOLIB_ADD
- if (!stop_soon_quietly)
+ if (stop_soon == NO_STOP_QUIETLY)
{
/* Remove breakpoints, SOLIB_ADD might adjust
breakpoint addresses via breakpoint_re_set. */
@@ -1753,7 +1753,9 @@ handle_inferior_event (struct execution_control_state *ecs)
if (stop_signal == TARGET_SIGNAL_TRAP
|| (breakpoints_inserted &&
(stop_signal == TARGET_SIGNAL_ILL
- || stop_signal == TARGET_SIGNAL_EMT)) || stop_soon_quietly)
+ || stop_signal == TARGET_SIGNAL_EMT))
+ || stop_soon == STOP_QUIETLY
+ || stop_soon == STOP_QUIETLY_NO_SIGSTOP)
{
if (stop_signal == TARGET_SIGNAL_TRAP && stop_after_trap)
{
@@ -1761,12 +1763,27 @@ handle_inferior_event (struct execution_control_state *ecs)
stop_stepping (ecs);
return;
}
- if (stop_soon_quietly)
+
+ /* This is originated from start_remote(), start_inferior() and
+ shared libraries hook functions. */
+ if (stop_soon == STOP_QUIETLY)
{
stop_stepping (ecs);
return;
}
+ /* This originates from attach_command(). We need to overwrite
+ the stop_signal here, because some kernels don't ignore a
+ SIGSTOP in a subsequent ptrace(PTRACE_SONT,SOGSTOP) call.
+ See more comments in inferior.h. */
+ if (stop_soon == STOP_QUIETLY_NO_SIGSTOP)
+ {
+ stop_stepping (ecs);
+ if (stop_signal == TARGET_SIGNAL_STOP)
+ stop_signal = TARGET_SIGNAL_0;
+ return;
+ }
+
/* Don't even think about breakpoints
if just proceeded over a breakpoint.
@@ -1808,26 +1825,30 @@ handle_inferior_event (struct execution_control_state *ecs)
stop_print_frame = 1;
}
+ /* NOTE: cagney/2003-03-29: These two checks for a random signal
+ at one stage in the past included checks for an inferior
+ function call's call dummy's return breakpoint. The original
+ comment, that went with the test, read:
+
+ ``End of a stack dummy. Some systems (e.g. Sony news) give
+ another signal besides SIGTRAP, so check here as well as
+ above.''
+
+ If someone ever tries to get get call dummys on a
+ non-executable stack to work (where the target would stop
+ with something like a SIGSEG), then those tests might need to
+ be re-instated. Given, however, that the tests were only
+ enabled when momentary breakpoints were not being used, I
+ suspect that it won't be the case. */
+
if (stop_signal == TARGET_SIGNAL_TRAP)
ecs->random_signal
= !(bpstat_explains_signal (stop_bpstat)
|| trap_expected
- || (!CALL_DUMMY_BREAKPOINT_OFFSET_P
- && DEPRECATED_PC_IN_CALL_DUMMY (stop_pc, read_sp (),
- get_frame_base (get_current_frame ())))
|| (step_range_end && step_resume_breakpoint == NULL));
-
else
{
- ecs->random_signal = !(bpstat_explains_signal (stop_bpstat)
- /* End of a stack dummy. Some systems (e.g. Sony
- news) give another signal besides SIGTRAP, so
- check here as well as above. */
- || (!CALL_DUMMY_BREAKPOINT_OFFSET_P
- && DEPRECATED_PC_IN_CALL_DUMMY (stop_pc, read_sp (),
- get_frame_base
- (get_current_frame
- ()))));
+ ecs->random_signal = !bpstat_explains_signal (stop_bpstat);
if (!ecs->random_signal)
stop_signal = TARGET_SIGNAL_TRAP;
}
@@ -2169,31 +2190,6 @@ process_event_stop_test:
return;
}
- if (!CALL_DUMMY_BREAKPOINT_OFFSET_P)
- {
- /* This is the old way of detecting the end of the stack dummy.
- An architecture which defines CALL_DUMMY_BREAKPOINT_OFFSET gets
- handled above. As soon as we can test it on all of them, all
- architectures should define it. */
-
- /* If this is the breakpoint at the end of a stack dummy,
- just stop silently, unless the user was doing an si/ni, in which
- case she'd better know what she's doing. */
-
- if (CALL_DUMMY_HAS_COMPLETED (stop_pc, read_sp (),
- get_frame_base (get_current_frame ()))
- && !step_range_end)
- {
- stop_print_frame = 0;
- stop_stack_dummy = 1;
-#ifdef HP_OS_BUG
- trap_expected_after_continue = 1;
-#endif
- stop_stepping (ecs);
- return;
- }
- }
-
if (step_resume_breakpoint)
{
/* Having a step-resume breakpoint overrides anything
@@ -2400,28 +2396,11 @@ process_event_stop_test:
function. That's what tells us (a) whether we want to step
into it at all, and (b) what prologue we want to run to
the end of, if we do step into it. */
- real_stop_pc = SKIP_TRAMPOLINE_CODE (stop_pc);
+ real_stop_pc = skip_language_trampoline (stop_pc);
+ if (real_stop_pc == 0)
+ real_stop_pc = SKIP_TRAMPOLINE_CODE (stop_pc);
if (real_stop_pc != 0)
ecs->stop_func_start = real_stop_pc;
- else
- {
- real_stop_pc = DYNAMIC_TRAMPOLINE_NEXTPC (stop_pc);
- if (real_stop_pc)
- {
- struct symtab_and_line xxx;
- /* Why isn't this s_a_l called "sr_sal", like all of the
- other s_a_l's where this code is duplicated? */
- init_sal (&xxx); /* initialize to zeroes */
- xxx.pc = real_stop_pc;
- xxx.section = find_pc_overlay (xxx.pc);
- check_for_old_step_resume_breakpoint ();
- step_resume_breakpoint =
- set_momentary_breakpoint (xxx, null_frame_id, bp_step_resume);
- insert_breakpoints ();
- keep_going (ecs);
- return;
- }
- }
/* If we have line number information for the function we
are thinking of stepping into, step into it.
@@ -2692,7 +2671,44 @@ step_over_function (struct execution_control_state *ecs)
struct symtab_and_line sr_sal;
init_sal (&sr_sal); /* initialize to zeros */
- sr_sal.pc = ADDR_BITS_REMOVE (SAVED_PC_AFTER_CALL (get_current_frame ()));
+
+ /* NOTE: cagney/2003-04-06:
+
+ At this point the equality get_frame_pc() == get_frame_func()
+ should hold. This may make it possible for this code to tell the
+ frame where it's function is, instead of the reverse. This would
+ avoid the need to search for the frame's function, which can get
+ very messy when there is no debug info available (look at the
+ heuristic find pc start code found in targets like the MIPS). */
+
+ /* NOTE: cagney/2003-04-06:
+
+ The intent of DEPRECATED_SAVED_PC_AFTER_CALL was to:
+
+ - provide a very light weight equivalent to frame_unwind_pc()
+ (nee FRAME_SAVED_PC) that avoids the prologue analyzer
+
+ - avoid handling the case where the PC hasn't been saved in the
+ prologue analyzer
+
+ Unfortunatly, not five lines further down, is a call to
+ get_frame_id() and that is guarenteed to trigger the prologue
+ analyzer.
+
+ The `correct fix' is for the prologe analyzer to handle the case
+ where the prologue is incomplete (PC in prologue) and,
+ consequently, the return pc has not yet been saved. It should be
+ noted that the prologue analyzer needs to handle this case
+ anyway: frameless leaf functions that don't save the return PC;
+ single stepping through a prologue.
+
+ The d10v handles all this by bailing out of the prologue analsis
+ when it reaches the current instruction. */
+
+ if (DEPRECATED_SAVED_PC_AFTER_CALL_P ())
+ sr_sal.pc = ADDR_BITS_REMOVE (DEPRECATED_SAVED_PC_AFTER_CALL (get_current_frame ()));
+ else
+ sr_sal.pc = ADDR_BITS_REMOVE (frame_pc_unwind (get_current_frame ()));
sr_sal.section = find_pc_overlay (sr_sal.pc);
check_for_old_step_resume_breakpoint ();
@@ -2717,7 +2733,6 @@ stop_stepping (struct execution_control_state *ecs)
time, just like we did above if we didn't break out of the
loop. */
prev_pc = read_pc ();
- prev_func_start = ecs->stop_func_start;
prev_func_name = ecs->stop_func_name;
}
@@ -2734,11 +2749,6 @@ keep_going (struct execution_control_state *ecs)
{
/* Save the pc before execution, to compare with pc after stop. */
prev_pc = read_pc (); /* Might have been DECR_AFTER_BREAK */
- prev_func_start = ecs->stop_func_start; /* Ok, since if DECR_PC_AFTER
- BREAK is defined, the
- original pc would not have
- been at the start of a
- function. */
prev_func_name = ecs->stop_func_name;
if (ecs->update_step_sp)
@@ -3113,6 +3123,7 @@ normal_stop (void)
done:
annotate_stopped ();
+ observer_notify_normal_stop ();
}
static int
@@ -3493,7 +3504,7 @@ struct inferior_status
enum step_over_calls_kind step_over_calls;
CORE_ADDR step_resume_break_address;
int stop_after_trap;
- int stop_soon_quietly;
+ int stop_soon;
struct regcache *stop_registers;
/* These are here because if call_function_by_hand has written some
@@ -3539,7 +3550,7 @@ save_inferior_status (int restore_stack_info)
inf_status->step_frame_id = step_frame_id;
inf_status->step_over_calls = step_over_calls;
inf_status->stop_after_trap = stop_after_trap;
- inf_status->stop_soon_quietly = stop_soon_quietly;
+ inf_status->stop_soon = stop_soon;
/* Save original bpstat chain here; replace it with copy of chain.
If caller's caller is walking the chain, they'll be happier if we
hand them back the original chain when restore_inferior_status is
@@ -3593,7 +3604,7 @@ restore_inferior_status (struct inferior_status *inf_status)
step_frame_id = inf_status->step_frame_id;
step_over_calls = inf_status->step_over_calls;
stop_after_trap = inf_status->stop_after_trap;
- stop_soon_quietly = inf_status->stop_soon_quietly;
+ stop_soon = inf_status->stop_soon;
bpstat_clear (&stop_bpstat);
stop_bpstat = inf_status->stop_bpstat;
breakpoint_proceeded = inf_status->breakpoint_proceeded;
diff --git a/gdb/infttrace.c b/gdb/infttrace.c
index 02a5576..f86ab02 100644
--- a/gdb/infttrace.c
+++ b/gdb/infttrace.c
@@ -27,6 +27,7 @@
#include "gdb_string.h"
#include "gdb_wait.h"
#include "command.h"
+#include "gdbthread.h"
/* We need pstat functionality so that we can get the exec file
for a process we attach to.
@@ -2947,7 +2948,7 @@ ptrace_wait (ptid_t ptid, int *status)
child_acknowledge_created_inferior.)
*/
int
-parent_attach_all (void)
+parent_attach_all (int p1, PTRACE_ARG3_TYPE p2, int p3)
{
int tt_status;
@@ -3674,7 +3675,7 @@ call_ptrace (int pt_request, int gdb_tid, PTRACE_ARG3_TYPE addr, int data)
there's no need for any "break" statements.
*/
case PT_SETTRC:
- return parent_attach_all ();
+ return parent_attach_all (0, 0, 0);
case PT_RUREGS:
tt_status = read_from_register_save_state (gdb_tid,
@@ -5378,8 +5379,7 @@ hppa_insert_hw_watchpoint (int pid, CORE_ADDR start, LONGEST len, int type)
watchpoints.
*/
int
-hppa_remove_hw_watchpoint (int pid, CORE_ADDR start, LONGEST len,
- enum bptype type)
+hppa_remove_hw_watchpoint (int pid, CORE_ADDR start, LONGEST len, int type)
{
CORE_ADDR page_start;
int dictionary_is_empty;
@@ -5439,7 +5439,7 @@ hppa_remove_hw_watchpoint (int pid, CORE_ADDR start, LONGEST len,
hardware support.
*/
int
-hppa_can_use_hw_watchpoint (enum bptype type, int cnt, enum bptype ot)
+hppa_can_use_hw_watchpoint (int type, int cnt, int ot)
{
return (type == bp_hardware_watchpoint);
}
diff --git a/gdb/jv-lang.c b/gdb/jv-lang.c
index ecd486c..1a829af 100644
--- a/gdb/jv-lang.c
+++ b/gdb/jv-lang.c
@@ -33,8 +33,9 @@
#include "c-lang.h"
#include "jv-lang.h"
#include "gdbcore.h"
-#include "block.h"
#include "dictionary.h"
+#include "block.h"
+#include "demangle.h"
#include <ctype.h>
struct type *java_int_type;
@@ -992,6 +993,12 @@ java_create_fundamental_type (struct objfile *objfile, int typeid)
return c_create_fundamental_type (objfile, typeid);
}
+static char *java_demangle (const char *mangled, int options)
+{
+ return cplus_demangle (mangled, options | DMGL_JAVA);
+}
+
+
/* Table mapping opcodes into strings for printing operators
and precedences of the operators. */
@@ -1050,6 +1057,8 @@ const struct language_defn java_language_defn =
java_print_type, /* Print a type using appropriate syntax */
java_val_print, /* Print a value using appropriate syntax */
java_value_print, /* Print a top-level value */
+ NULL, /* Language specific skip_trampoline */
+ java_demangle, /* Language specific symbol demangler */
{"", "", "", ""}, /* Binary format info */
{"0%lo", "0", "o", ""}, /* Octal format info */
{"%ld", "", "d", ""}, /* Decimal format info */
diff --git a/gdb/language.c b/gdb/language.c
index 1a24b39..aba597a 100644
--- a/gdb/language.c
+++ b/gdb/language.c
@@ -44,6 +44,7 @@
#include "target.h"
#include "parser-defs.h"
#include "jv-lang.h"
+#include "demangle.h"
extern void _initialize_language (void);
@@ -100,6 +101,8 @@ static int unk_lang_val_print (struct type *, char *, int, CORE_ADDR,
static int unk_lang_value_print (struct value *, struct ui_file *, int, enum val_prettyprint);
+static CORE_ADDR unk_lang_trampoline (CORE_ADDR pc);
+
/* Forward declaration */
extern const struct language_defn unknown_language_defn;
@@ -1338,6 +1341,44 @@ add_language (const struct language_defn *lang)
languages[languages_size++] = lang;
}
+/* Iterate through all registered languages looking for and calling
+ any non-NULL struct language_defn.skip_trampoline() functions.
+ Return the result from the first that returns non-zero, or 0 if all
+ `fail'. */
+CORE_ADDR
+skip_language_trampoline (CORE_ADDR pc)
+{
+ int i;
+
+ for (i = 0; i < languages_size; i++)
+ {
+ if (languages[i]->skip_trampoline)
+ {
+ CORE_ADDR real_pc = (languages[i]->skip_trampoline) (pc);
+ if (real_pc)
+ return real_pc;
+ }
+ }
+
+ return 0;
+}
+
+/* Return demangled language symbol, or NULL.
+ FIXME: Options are only useful for certain languages and ignored
+ by others, so it would be better to remove them here and have a
+ more flexible demangler for the languages that need it.
+ FIXME: Sometimes the demangler is invoked when we don't know the
+ language, so we can't use this everywhere. */
+char *
+language_demangle (const struct language_defn *current_language,
+ const char *mangled, int options)
+{
+ if (current_language != NULL && current_language->la_demangle)
+ return current_language->la_demangle (mangled, options);
+ return NULL;
+}
+
+
/* Define the language that is no language. */
static int
@@ -1399,6 +1440,18 @@ unk_lang_value_print (struct value *val, struct ui_file *stream, int format,
error ("internal error - unimplemented function unk_lang_value_print called.");
}
+static CORE_ADDR unk_lang_trampoline (CORE_ADDR pc)
+{
+ return 0;
+}
+
+/* Unknown languages just use the cplus demangler. */
+static char *unk_lang_demangle (const char *mangled, int options)
+{
+ return cplus_demangle (mangled, options);
+}
+
+
static struct type **const (unknown_builtin_types[]) =
{
0
@@ -1426,6 +1479,8 @@ const struct language_defn unknown_language_defn =
unk_lang_print_type, /* Print a type using appropriate syntax */
unk_lang_val_print, /* Print a value using appropriate syntax */
unk_lang_value_print, /* Print a top-level value */
+ unk_lang_trampoline, /* Language specific skip_trampoline */
+ unk_lang_demangle, /* Language specific symbol demangler */
{"", "", "", ""}, /* Binary format info */
{"0%lo", "0", "o", ""}, /* Octal format info */
{"%ld", "", "d", ""}, /* Decimal format info */
@@ -1456,6 +1511,8 @@ const struct language_defn auto_language_defn =
unk_lang_print_type, /* Print a type using appropriate syntax */
unk_lang_val_print, /* Print a value using appropriate syntax */
unk_lang_value_print, /* Print a top-level value */
+ unk_lang_trampoline, /* Language specific skip_trampoline */
+ unk_lang_demangle, /* Language specific symbol demangler */
{"", "", "", ""}, /* Binary format info */
{"0%lo", "0", "o", ""}, /* Octal format info */
{"%ld", "", "d", ""}, /* Decimal format info */
@@ -1485,6 +1542,8 @@ const struct language_defn local_language_defn =
unk_lang_print_type, /* Print a type using appropriate syntax */
unk_lang_val_print, /* Print a value using appropriate syntax */
unk_lang_value_print, /* Print a top-level value */
+ unk_lang_trampoline, /* Language specific skip_trampoline */
+ unk_lang_demangle, /* Language specific symbol demangler */
{"", "", "", ""}, /* Binary format info */
{"0%lo", "0", "o", ""}, /* Octal format info */
{"%ld", "", "d", ""}, /* Decimal format info */
diff --git a/gdb/language.h b/gdb/language.h
index ab5e5d2..a873699 100644
--- a/gdb/language.h
+++ b/gdb/language.h
@@ -30,6 +30,8 @@
struct value;
struct objfile;
struct expression;
+struct ui_file;
+
/* enum exp_opcode; ANSI's `wisdom' didn't include forward enum decls. */
/* This used to be included to configure GDB for one or more specific
@@ -203,6 +205,15 @@ struct language_defn
int (*la_value_print) (struct value *, struct ui_file *,
int, enum val_prettyprint);
+ /* PC is possibly an unknown languages trampoline.
+ If that PC falls in a trampoline belonging to this language,
+ return the address of the first pc in the real function, or 0
+ if it isn't a language tramp for this language. */
+ CORE_ADDR (*skip_trampoline) (CORE_ADDR pc);
+
+ /* Return demangled language symbol, or NULL. */
+ char *(*la_demangle) (const char *mangled, int options);
+
/* Base 2 (binary) formats. */
struct language_format_info la_binary_format;
@@ -465,4 +476,12 @@ extern void add_language (const struct language_defn *);
extern enum language get_frame_language (void); /* In stack.c */
+/* Check for a language-specific trampoline. */
+
+extern CORE_ADDR skip_language_trampoline (CORE_ADDR pc);
+
+/* Return demangled language symbol, or NULL. */
+extern char *language_demangle (const struct language_defn *current_language,
+ const char *mangled, int options);
+
#endif /* defined (LANGUAGE_H) */
diff --git a/gdb/lin-lwp.c b/gdb/lin-lwp.c
index 9f9dd81..c36394e 100644
--- a/gdb/lin-lwp.c
+++ b/gdb/lin-lwp.c
@@ -172,8 +172,7 @@ status_to_str (int status)
snprintf (buf, sizeof (buf), "%s (terminated)",
strsignal (WSTOPSIG (status)));
else
- snprintf (buf, sizeof (buf), "%d (exited)",
- WEXITSTATUS (status));
+ snprintf (buf, sizeof (buf), "%d (exited)", WEXITSTATUS (status));
return buf;
}
@@ -306,8 +305,8 @@ iterate_over_lwps (int (*callback) (struct lwp_info *, void *), void *data)
int
lin_lwp_prepare_to_proceed (void)
{
- if (! ptid_equal (trap_ptid, null_ptid)
- && ! ptid_equal (inferior_ptid, trap_ptid))
+ if (!ptid_equal (trap_ptid, null_ptid)
+ && !ptid_equal (inferior_ptid, trap_ptid))
{
/* Switched over from TRAP_PID. */
CORE_ADDR stop_pc = read_pc ();
@@ -319,7 +318,7 @@ lin_lwp_prepare_to_proceed (void)
if (trap_pc != stop_pc && breakpoint_here_p (trap_pc))
{
/* User hasn't deleted the breakpoint. Return non-zero, and
- switch back to TRAP_PID. */
+ switch back to TRAP_PID. */
inferior_ptid = trap_ptid;
/* FIXME: Is this stuff really necessary? */
@@ -355,7 +354,7 @@ lin_lwp_attach_lwp (ptid_t ptid, int verbose)
/* Make sure SIGCHLD is blocked. We don't want SIGCHLD events
to interrupt either the ptrace() or waitpid() calls below. */
- if (! sigismember (&blocked_mask, SIGCHLD))
+ if (!sigismember (&blocked_mask, SIGCHLD))
{
sigaddset (&blocked_mask, SIGCHLD);
sigprocmask (SIG_BLOCK, &blocked_mask, NULL);
@@ -380,8 +379,8 @@ lin_lwp_attach_lwp (ptid_t ptid, int verbose)
safe_strerror (errno));
if (debug_lin_lwp)
- fprintf_unfiltered (gdb_stdlog,
- "LLAL: PTRACE_ATTACH %s, 0, 0 (OK)\n",
+ fprintf_unfiltered (gdb_stdlog,
+ "LLAL: PTRACE_ATTACH %s, 0, 0 (OK)\n",
target_pid_to_str (ptid));
pid = waitpid (GET_LWP (ptid), &status, 0);
@@ -401,18 +400,18 @@ lin_lwp_attach_lwp (ptid_t ptid, int verbose)
{
fprintf_unfiltered (gdb_stdlog,
"LLAL: waitpid %s received %s\n",
- target_pid_to_str (ptid),
+ target_pid_to_str (ptid),
status_to_str (status));
}
}
else
{
/* We assume that the LWP representing the original process
- is already stopped. Mark it as stopped in the data structure
- that the lin-lwp layer uses to keep track of threads. Note
- that this won't have already been done since the main thread
- will have, we assume, been stopped by an attach from a
- different layer. */
+ is already stopped. Mark it as stopped in the data structure
+ that the lin-lwp layer uses to keep track of threads. Note
+ that this won't have already been done since the main thread
+ will have, we assume, been stopped by an attach from a
+ different layer. */
lp->stopped = 1;
}
}
@@ -455,8 +454,7 @@ lin_lwp_attach (char *args, int from_tty)
if (debug_lin_lwp)
{
fprintf_unfiltered (gdb_stdlog,
- "LLA: waitpid %ld, faking SIGSTOP\n",
- (long) pid);
+ "LLA: waitpid %ld, faking SIGSTOP\n", (long) pid);
}
}
@@ -467,7 +465,7 @@ detach_callback (struct lwp_info *lp, void *data)
if (debug_lin_lwp && lp->status)
fprintf_unfiltered (gdb_stdlog, "DC: Pending %s for %s on detach.\n",
- strsignal (WSTOPSIG (lp->status)),
+ strsignal (WSTOPSIG (lp->status)),
target_pid_to_str (lp->ptid));
while (lp->signalled && lp->stopped)
@@ -479,10 +477,10 @@ detach_callback (struct lwp_info *lp, void *data)
safe_strerror (errno));
if (debug_lin_lwp)
- fprintf_unfiltered (gdb_stdlog,
+ fprintf_unfiltered (gdb_stdlog,
"DC: PTRACE_CONTINUE (%s, 0, %s) (OK)\n",
target_pid_to_str (lp->ptid),
- status_to_str (lp->status));
+ status_to_str (lp->status));
lp->stopped = 0;
lp->signalled = 0;
@@ -505,7 +503,7 @@ detach_callback (struct lwp_info *lp, void *data)
if (debug_lin_lwp)
fprintf_unfiltered (gdb_stdlog,
"PTRACE_DETACH (%s, %s, 0) (OK)\n",
- target_pid_to_str (lp->ptid),
+ target_pid_to_str (lp->ptid),
strsignal (WSTOPSIG (lp->status)));
delete_lwp (lp->ptid);
@@ -547,7 +545,7 @@ resume_callback (struct lwp_info *lp, void *data)
child_resume (pid_to_ptid (GET_LWP (lp->ptid)), 0, TARGET_SIGNAL_0);
if (debug_lin_lwp)
- fprintf_unfiltered (gdb_stdlog,
+ fprintf_unfiltered (gdb_stdlog,
"RC: PTRACE_CONT %s, 0, 0 (resume sibling)\n",
target_pid_to_str (lp->ptid));
lp->stopped = 0;
@@ -606,13 +604,13 @@ lin_lwp_resume (ptid_t ptid, int step, enum target_signal signo)
if (lp->status)
{
/* FIXME: What should we do if we are supposed to continue
- this thread with a signal? */
+ this thread with a signal? */
gdb_assert (signo == TARGET_SIGNAL_0);
return;
}
/* Mark LWP as not stopped to prevent it from being continued by
- resume_callback. */
+ resume_callback. */
lp->stopped = 0;
}
@@ -634,7 +632,7 @@ lin_lwp_resume (ptid_t ptid, int step, enum target_signal signo)
static int
stop_callback (struct lwp_info *lp, void *data)
{
- if (! lp->stopped && ! lp->signalled)
+ if (!lp->stopped && !lp->signalled)
{
int ret;
@@ -662,7 +660,7 @@ stop_wait_callback (struct lwp_info *lp, void *data)
{
sigset_t *flush_mask = data;
- if (! lp->stopped && lp->signalled)
+ if (!lp->stopped && lp->signalled)
{
pid_t pid;
int status;
@@ -681,7 +679,7 @@ stop_wait_callback (struct lwp_info *lp, void *data)
{
fprintf_unfiltered (gdb_stdlog,
"SWC: waitpid %s received %s\n",
- target_pid_to_str (lp->ptid),
+ target_pid_to_str (lp->ptid),
status_to_str (status));
}
@@ -692,14 +690,14 @@ stop_wait_callback (struct lwp_info *lp, void *data)
if (in_thread_list (lp->ptid))
{
/* Core GDB cannot deal with us deleting the current
- thread. */
+ thread. */
if (!ptid_equal (lp->ptid, inferior_ptid))
delete_thread (lp->ptid);
printf_unfiltered ("[%s exited]\n",
target_pid_to_str (lp->ptid));
}
if (debug_lin_lwp)
- fprintf_unfiltered (gdb_stdlog, "SWC: %s exited.\n",
+ fprintf_unfiltered (gdb_stdlog, "SWC: %s exited.\n",
target_pid_to_str (lp->ptid));
delete_lwp (lp->ptid);
@@ -727,29 +725,29 @@ stop_wait_callback (struct lwp_info *lp, void *data)
if (WSTOPSIG (status) == SIGTRAP)
{
/* If a LWP other than the LWP that we're reporting an
- event for has hit a GDB breakpoint (as opposed to
- some random trap signal), then just arrange for it to
- hit it again later. We don't keep the SIGTRAP status
- and don't forward the SIGTRAP signal to the LWP. We
- will handle the current event, eventually we will
- resume all LWPs, and this one will get its breakpoint
- trap again.
-
- If we do not do this, then we run the risk that the
- user will delete or disable the breakpoint, but the
- thread will have already tripped on it. */
+ event for has hit a GDB breakpoint (as opposed to
+ some random trap signal), then just arrange for it to
+ hit it again later. We don't keep the SIGTRAP status
+ and don't forward the SIGTRAP signal to the LWP. We
+ will handle the current event, eventually we will
+ resume all LWPs, and this one will get its breakpoint
+ trap again.
+
+ If we do not do this, then we run the risk that the
+ user will delete or disable the breakpoint, but the
+ thread will have already tripped on it. */
/* Now resume this LWP and get the SIGSTOP event. */
errno = 0;
ptrace (PTRACE_CONT, GET_LWP (lp->ptid), 0, 0);
if (debug_lin_lwp)
{
- fprintf_unfiltered (gdb_stdlog,
+ fprintf_unfiltered (gdb_stdlog,
"PTRACE_CONT %s, 0, 0 (%s)\n",
target_pid_to_str (lp->ptid),
errno ? safe_strerror (errno) : "OK");
- fprintf_unfiltered (gdb_stdlog,
+ fprintf_unfiltered (gdb_stdlog,
"SWC: Candidate SIGTRAP event in %s\n",
target_pid_to_str (lp->ptid));
}
@@ -767,39 +765,39 @@ stop_wait_callback (struct lwp_info *lp, void *data)
else
{
/* The thread was stopped with a signal other than
- SIGSTOP, and didn't accidentally trip a breakpoint. */
+ SIGSTOP, and didn't accidentally trip a breakpoint. */
if (debug_lin_lwp)
{
- fprintf_unfiltered (gdb_stdlog,
+ fprintf_unfiltered (gdb_stdlog,
"SWC: Pending event %s in %s\n",
- status_to_str ((int) status),
+ status_to_str ((int) status),
target_pid_to_str (lp->ptid));
}
/* Now resume this LWP and get the SIGSTOP event. */
errno = 0;
ptrace (PTRACE_CONT, GET_LWP (lp->ptid), 0, 0);
if (debug_lin_lwp)
- fprintf_unfiltered (gdb_stdlog,
+ fprintf_unfiltered (gdb_stdlog,
"SWC: PTRACE_CONT %s, 0, 0 (%s)\n",
target_pid_to_str (lp->ptid),
errno ? safe_strerror (errno) : "OK");
/* Hold this event/waitstatus while we check to see if
- there are any more (we still want to get that SIGSTOP). */
+ there are any more (we still want to get that SIGSTOP). */
stop_wait_callback (lp, data);
/* If the lp->status field is still empty, use it to hold
- this event. If not, then this event must be returned
- to the event queue of the LWP. */
+ this event. If not, then this event must be returned
+ to the event queue of the LWP. */
if (lp->status == 0)
lp->status = status;
else
{
if (debug_lin_lwp)
{
- fprintf_unfiltered (gdb_stdlog,
+ fprintf_unfiltered (gdb_stdlog,
"SWC: kill %s, %s\n",
- target_pid_to_str (lp->ptid),
+ target_pid_to_str (lp->ptid),
status_to_str ((int) status));
}
kill (GET_LWP (lp->ptid), WSTOPSIG (status));
@@ -810,7 +808,7 @@ stop_wait_callback (struct lwp_info *lp, void *data)
else
{
/* We caught the SIGSTOP that we intended to catch, so
- there's no SIGSTOP pending. */
+ there's no SIGSTOP pending. */
lp->stopped = 1;
lp->signalled = 0;
}
@@ -904,8 +902,8 @@ cancel_breakpoints_callback (struct lwp_info *lp, void *data)
tripped on it. */
if (lp->status != 0
- && WIFSTOPPED (lp->status) && WSTOPSIG (lp->status) == SIGTRAP
- && breakpoint_inserted_here_p (read_pc_pid (lp->ptid) -
+ && WIFSTOPPED (lp->status) && WSTOPSIG (lp->status) == SIGTRAP
+ && breakpoint_inserted_here_p (read_pc_pid (lp->ptid) -
DECR_PC_AFTER_BREAK))
{
if (debug_lin_lwp)
@@ -948,7 +946,7 @@ select_event_lwp (struct lwp_info **orig_lp, int *status)
else
{
/* No single-stepping LWP. Select one at random, out of those
- which have had SIGTRAP events. */
+ which have had SIGTRAP events. */
/* First see how many SIGTRAP events we have. */
iterate_over_lwps (count_events_callback, &num_events);
@@ -958,8 +956,8 @@ select_event_lwp (struct lwp_info **orig_lp, int *status)
((num_events * (double) rand ()) / (RAND_MAX + 1.0));
if (debug_lin_lwp && num_events > 1)
- fprintf_unfiltered (gdb_stdlog,
- "SEL: Found %d SIGTRAP events, selecting #%d\n",
+ fprintf_unfiltered (gdb_stdlog,
+ "SEL: Found %d SIGTRAP events, selecting #%d\n",
num_events, random_selector);
event_lp = iterate_over_lwps (select_event_lwp_callback,
@@ -970,7 +968,7 @@ select_event_lwp (struct lwp_info **orig_lp, int *status)
{
/* Switch the event LWP. */
*orig_lp = event_lp;
- *status = event_lp->status;
+ *status = event_lp->status;
}
/* Flush the wait status for the event LWP. */
@@ -1014,17 +1012,16 @@ child_wait (ptid_t ptid, struct target_waitstatus *ourstatus)
if (debug_lin_lwp)
{
- fprintf_unfiltered (gdb_stdlog,
+ fprintf_unfiltered (gdb_stdlog,
"CW: waitpid %ld received %s\n",
- (long) pid,
- status_to_str (status));
+ (long) pid, status_to_str (status));
}
save_errno = errno;
/* Make sure we don't report an event for the exit of the
- original program, if we've detached from it. */
- if (pid != -1 && ! WIFSTOPPED (status) && pid != GET_PID (inferior_ptid))
+ original program, if we've detached from it. */
+ if (pid != -1 && !WIFSTOPPED (status) && pid != GET_PID (inferior_ptid))
{
pid = -1;
save_errno = EINTR;
@@ -1037,7 +1034,7 @@ child_wait (ptid_t ptid, struct target_waitstatus *ourstatus)
if (pid == -1)
{
- warning ("Child process unexpectedly missing: %s",
+ warning ("Child process unexpectedly missing: %s",
safe_strerror (errno));
/* Claim it exited with unknown signal. */
@@ -1064,13 +1061,13 @@ lin_lwp_wait (ptid_t ptid, struct target_waitstatus *ourstatus)
sigemptyset (&flush_mask);
/* Make sure SIGCHLD is blocked. */
- if (! sigismember (&blocked_mask, SIGCHLD))
+ if (!sigismember (&blocked_mask, SIGCHLD))
{
sigaddset (&blocked_mask, SIGCHLD);
sigprocmask (SIG_BLOCK, &blocked_mask, NULL);
}
- retry:
+retry:
/* Make sure there is at least one LWP that has been resumed, at
least if there are any LWPs at all. */
@@ -1089,7 +1086,7 @@ lin_lwp_wait (ptid_t ptid, struct target_waitstatus *ourstatus)
if (debug_lin_lwp && status)
fprintf_unfiltered (gdb_stdlog,
"LLW: Using pending wait status %s for %s.\n",
- status_to_str (status),
+ status_to_str (status),
target_pid_to_str (lp->ptid));
}
@@ -1101,7 +1098,7 @@ lin_lwp_wait (ptid_t ptid, struct target_waitstatus *ourstatus)
else if (is_lwp (ptid))
{
if (debug_lin_lwp)
- fprintf_unfiltered (gdb_stdlog,
+ fprintf_unfiltered (gdb_stdlog,
"LLW: Waiting for specific LWP %s.\n",
target_pid_to_str (ptid));
@@ -1114,7 +1111,7 @@ lin_lwp_wait (ptid_t ptid, struct target_waitstatus *ourstatus)
if (debug_lin_lwp && status)
fprintf_unfiltered (gdb_stdlog,
"LLW: Using pending wait status %s for %s.\n",
- status_to_str (status),
+ status_to_str (status),
target_pid_to_str (lp->ptid));
/* If we have to wait, take into account whether PID is a cloned
@@ -1127,19 +1124,19 @@ lin_lwp_wait (ptid_t ptid, struct target_waitstatus *ourstatus)
if (status && lp->signalled)
{
/* A pending SIGSTOP may interfere with the normal stream of
- events. In a typical case where interference is a problem,
- we have a SIGSTOP signal pending for LWP A while
- single-stepping it, encounter an event in LWP B, and take the
- pending SIGSTOP while trying to stop LWP A. After processing
- the event in LWP B, LWP A is continued, and we'll never see
- the SIGTRAP associated with the last time we were
- single-stepping LWP A. */
+ events. In a typical case where interference is a problem,
+ we have a SIGSTOP signal pending for LWP A while
+ single-stepping it, encounter an event in LWP B, and take the
+ pending SIGSTOP while trying to stop LWP A. After processing
+ the event in LWP B, LWP A is continued, and we'll never see
+ the SIGTRAP associated with the last time we were
+ single-stepping LWP A. */
/* Resume the thread. It should halt immediately returning the
- pending SIGSTOP. */
+ pending SIGSTOP. */
registers_changed ();
child_resume (pid_to_ptid (GET_LWP (lp->ptid)), lp->step,
- TARGET_SIGNAL_0);
+ TARGET_SIGNAL_0);
if (debug_lin_lwp)
fprintf_unfiltered (gdb_stdlog,
"LLW: %s %s, 0, 0 (expect SIGSTOP)\n",
@@ -1152,8 +1149,8 @@ lin_lwp_wait (ptid_t ptid, struct target_waitstatus *ourstatus)
stop_wait_callback (lp, NULL);
}
- set_sigint_trap (); /* Causes SIGINT to be passed on to the
- attached process. */
+ set_sigint_trap (); /* Causes SIGINT to be passed on to the
+ attached process. */
set_sigio_trap ();
while (status == 0)
@@ -1169,8 +1166,7 @@ lin_lwp_wait (ptid_t ptid, struct target_waitstatus *ourstatus)
{
fprintf_unfiltered (gdb_stdlog,
"LLW: waitpid %ld received %s\n",
- (long) lwpid,
- status_to_str (status));
+ (long) lwpid, status_to_str (status));
}
lp = find_lwp_pid (pid_to_ptid (lwpid));
@@ -1179,13 +1175,13 @@ lin_lwp_wait (ptid_t ptid, struct target_waitstatus *ourstatus)
our list, i.e. not part of the current process. This can happen
if we detach from a program we original forked and then it
exits. */
- if (! WIFSTOPPED (status) && ! lp)
+ if (!WIFSTOPPED (status) && !lp)
{
status = 0;
continue;
}
- if (! lp)
+ if (!lp)
{
lp = add_lwp (BUILD_LWP (lwpid, GET_PID (inferior_ptid)));
if (options & __WCLONE)
@@ -1197,10 +1193,10 @@ lin_lwp_wait (ptid_t ptid, struct target_waitstatus *ourstatus)
&& WSTOPSIG (status) == SIGSTOP);
lp->signalled = 1;
- if (! in_thread_list (inferior_ptid))
+ if (!in_thread_list (inferior_ptid))
{
inferior_ptid = BUILD_LWP (GET_PID (inferior_ptid),
- GET_PID (inferior_ptid));
+ GET_PID (inferior_ptid));
add_thread (inferior_ptid);
}
@@ -1211,22 +1207,22 @@ lin_lwp_wait (ptid_t ptid, struct target_waitstatus *ourstatus)
}
/* Make sure we don't report a TARGET_WAITKIND_EXITED or
- TARGET_WAITKIND_SIGNALLED event if there are still LWP's
- left in the process. */
+ TARGET_WAITKIND_SIGNALLED event if there are still LWP's
+ left in the process. */
if ((WIFEXITED (status) || WIFSIGNALED (status)) && num_lwps > 1)
{
if (in_thread_list (lp->ptid))
{
/* Core GDB cannot deal with us deleting the current
- thread. */
- if (! ptid_equal (lp->ptid, inferior_ptid))
+ thread. */
+ if (!ptid_equal (lp->ptid, inferior_ptid))
delete_thread (lp->ptid);
printf_unfiltered ("[%s exited]\n",
target_pid_to_str (lp->ptid));
}
if (debug_lin_lwp)
- fprintf_unfiltered (gdb_stdlog,
- "LLW: %s exited.\n",
+ fprintf_unfiltered (gdb_stdlog,
+ "LLW: %s exited.\n",
target_pid_to_str (lp->ptid));
delete_lwp (lp->ptid);
@@ -1240,13 +1236,12 @@ lin_lwp_wait (ptid_t ptid, struct target_waitstatus *ourstatus)
}
/* Make sure we don't report a SIGSTOP that we sent
- ourselves in an attempt to stop an LWP. */
+ ourselves in an attempt to stop an LWP. */
if (lp->signalled
- && WIFSTOPPED (status)
- && WSTOPSIG (status) == SIGSTOP)
+ && WIFSTOPPED (status) && WSTOPSIG (status) == SIGSTOP)
{
if (debug_lin_lwp)
- fprintf_unfiltered (gdb_stdlog,
+ fprintf_unfiltered (gdb_stdlog,
"LLW: Delayed SIGSTOP caught for %s.\n",
target_pid_to_str (lp->ptid));
@@ -1255,11 +1250,11 @@ lin_lwp_wait (ptid_t ptid, struct target_waitstatus *ourstatus)
registers_changed ();
child_resume (pid_to_ptid (GET_LWP (lp->ptid)), lp->step,
- TARGET_SIGNAL_0);
+ TARGET_SIGNAL_0);
if (debug_lin_lwp)
fprintf_unfiltered (gdb_stdlog,
"LLW: %s %s, 0, 0 (discard SIGSTOP)\n",
- lp->step ?
+ lp->step ?
"PTRACE_SINGLESTEP" : "PTRACE_CONT",
target_pid_to_str (lp->ptid));
@@ -1309,16 +1304,17 @@ lin_lwp_wait (ptid_t ptid, struct target_waitstatus *ourstatus)
&& signal_pass_state (signo) == 1)
{
/* FIMXE: kettenis/2001-06-06: Should we resume all threads
- here? It is not clear we should. GDB may not expect
- other threads to run. On the other hand, not resuming
- newly attached threads may cause an unwanted delay in
- getting them running. */
+ here? It is not clear we should. GDB may not expect
+ other threads to run. On the other hand, not resuming
+ newly attached threads may cause an unwanted delay in
+ getting them running. */
registers_changed ();
child_resume (pid_to_ptid (GET_LWP (lp->ptid)), lp->step, signo);
if (debug_lin_lwp)
fprintf_unfiltered (gdb_stdlog,
"LLW: %s %s, %s (preempt 'handle')\n",
- lp->step ? "PTRACE_SINGLESTEP" : "PTRACE_CONT",
+ lp->step ?
+ "PTRACE_SINGLESTEP" : "PTRACE_CONT",
target_pid_to_str (lp->ptid),
signo ? strsignal (signo) : "0");
lp->stopped = 0;
@@ -1326,13 +1322,12 @@ lin_lwp_wait (ptid_t ptid, struct target_waitstatus *ourstatus)
goto retry;
}
- if (signo == TARGET_SIGNAL_INT
- && signal_pass_state (signo) == 0)
+ if (signo == TARGET_SIGNAL_INT && signal_pass_state (signo) == 0)
{
/* If ^C/BREAK is typed at the tty/console, SIGINT gets
- forwarded to the entire process group, that is, all LWP's
- will receive it. Since we only want to report it once,
- we try to flush it from all LWPs except this one. */
+ forwarded to the entire process group, that is, all LWP's
+ will receive it. Since we only want to report it once,
+ we try to flush it from all LWPs except this one. */
sigaddset (&flush_mask, SIGINT);
}
}
@@ -1342,8 +1337,7 @@ lin_lwp_wait (ptid_t ptid, struct target_waitstatus *ourstatus)
if (debug_lin_lwp)
fprintf_unfiltered (gdb_stdlog, "LLW: Candidate event %s in %s.\n",
- status_to_str (status),
- target_pid_to_str (lp->ptid));
+ status_to_str (status), target_pid_to_str (lp->ptid));
/* Now stop all other LWP's ... */
iterate_over_lwps (stop_callback, NULL);
@@ -1370,7 +1364,7 @@ lin_lwp_wait (ptid_t ptid, struct target_waitstatus *ourstatus)
{
trap_ptid = (threaded ? lp->ptid : pid_to_ptid (GET_LWP (lp->ptid)));
if (debug_lin_lwp)
- fprintf_unfiltered (gdb_stdlog,
+ fprintf_unfiltered (gdb_stdlog,
"LLW: trap_ptid is %s.\n",
target_pid_to_str (trap_ptid));
}
@@ -1387,7 +1381,7 @@ kill_callback (struct lwp_info *lp, void *data)
errno = 0;
ptrace (PTRACE_KILL, GET_LWP (lp->ptid), 0, 0);
if (debug_lin_lwp)
- fprintf_unfiltered (gdb_stdlog,
+ fprintf_unfiltered (gdb_stdlog,
"KC: PTRACE_KILL %s, 0, 0 (%s)\n",
target_pid_to_str (lp->ptid),
errno ? safe_strerror (errno) : "OK");
@@ -1430,7 +1424,7 @@ kill_wait_callback (struct lwp_info *lp, void *data)
if (pid != (pid_t) -1 && debug_lin_lwp)
{
fprintf_unfiltered (gdb_stdlog,
- "KWC: wait %s received unk.\n",
+ "KWC: wait %s received unk.\n",
target_pid_to_str (lp->ptid));
}
}
@@ -1458,7 +1452,7 @@ lin_lwp_create_inferior (char *exec_file, char *allargs, char **env)
child_ops.to_create_inferior (exec_file, allargs, env);
}
-static void
+static void
lin_lwp_mourn_inferior (void)
{
trap_ptid = null_ptid;
@@ -1475,8 +1469,7 @@ lin_lwp_mourn_inferior (void)
static int
lin_lwp_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write,
- struct mem_attrib *attrib,
- struct target_ops *target)
+ struct mem_attrib *attrib, struct target_ops *target)
{
struct cleanup *old_chain = save_inferior_ptid ();
int xfer;
@@ -1502,7 +1495,7 @@ lin_lwp_thread_alive (ptid_t ptid)
if (debug_lin_lwp)
fprintf_unfiltered (gdb_stdlog,
"LLTA: PTRACE_PEEKUSER %s, 0, 0 (%s)\n",
- target_pid_to_str (ptid),
+ target_pid_to_str (ptid),
errno ? safe_strerror (errno) : "OK");
if (errno)
return 0;
@@ -1586,11 +1579,9 @@ _initialize_lin_lwp (void)
sigemptyset (&blocked_mask);
add_show_from_set (add_set_cmd ("lin-lwp", no_class, var_zinteger,
- (char *) &debug_lin_lwp,
+ (char *) &debug_lin_lwp,
"Set debugging of GNU/Linux lwp module.\n\
-Enables printf debugging output.\n",
- &setdebuglist),
- &showdebuglist);
+Enables printf debugging output.\n", &setdebuglist), &showdebuglist);
}
diff --git a/gdb/linespec.h b/gdb/linespec.h
index 7c3f90c..3ede4bd 100644
--- a/gdb/linespec.h
+++ b/gdb/linespec.h
@@ -19,6 +19,8 @@
#if !defined (LINESPEC_H)
#define LINESPEC_H 1
+struct symtab;
+
extern struct symtabs_and_lines
decode_line_1 (char **argptr, int funfirstline,
struct symtab *default_symtab, int default_line,
diff --git a/gdb/linux-proc.c b/gdb/linux-proc.c
index 00383e9..a951296 100644
--- a/gdb/linux-proc.c
+++ b/gdb/linux-proc.c
@@ -21,17 +21,17 @@
#include "defs.h"
#include "inferior.h"
-#include <sys/param.h> /* for MAXPATHLEN */
-#include <sys/procfs.h> /* for elf_gregset etc. */
-#include "gdb_stat.h" /* for struct stat */
-#include <ctype.h> /* for isdigit */
-#include <unistd.h> /* for open, pread64 */
-#include <fcntl.h> /* for O_RDONLY */
-#include "regcache.h" /* for registers_changed */
-#include "gregset.h" /* for gregset */
-#include "gdbcore.h" /* for get_exec_file */
-#include "gdbthread.h" /* for struct thread_info etc. */
-#include "elf-bfd.h" /* for elfcore_write_* */
+#include <sys/param.h> /* for MAXPATHLEN */
+#include <sys/procfs.h> /* for elf_gregset etc. */
+#include "gdb_stat.h" /* for struct stat */
+#include <ctype.h> /* for isdigit */
+#include <unistd.h> /* for open, pread64 */
+#include <fcntl.h> /* for O_RDONLY */
+#include "regcache.h" /* for registers_changed */
+#include "gregset.h" /* for gregset */
+#include "gdbcore.h" /* for get_exec_file */
+#include "gdbthread.h" /* for struct thread_info etc. */
+#include "elf-bfd.h" /* for elfcore_write_* */
#include "cli/cli-decode.h" /* for add_info */
#include "gdb_string.h"
@@ -69,28 +69,26 @@ child_pid_to_exec_file (int pid)
* Service function for corefiles and info proc.
*/
-static int
-read_mapping (FILE *mapfile,
- long long *addr,
- long long *endaddr,
- char *permissions,
- long long *offset,
- char *device,
- long long *inode,
- char *filename)
+static int
+read_mapping (FILE *mapfile,
+ long long *addr,
+ long long *endaddr,
+ char *permissions,
+ long long *offset,
+ char *device, long long *inode, char *filename)
{
- int ret = fscanf (mapfile, "%llx-%llx %s %llx %s %llx",
+ int ret = fscanf (mapfile, "%llx-%llx %s %llx %s %llx",
addr, endaddr, permissions, offset, device, inode);
if (ret > 0 && ret != EOF && *inode != 0)
{
/* Eat everything up to EOL for the filename. This will prevent
- weird filenames (such as one with embedded whitespace) from
- confusing this code. It also makes this code more robust
- in respect to annotations the kernel may add after the
- filename.
+ weird filenames (such as one with embedded whitespace) from
+ confusing this code. It also makes this code more robust
+ in respect to annotations the kernel may add after the
+ filename.
- Note the filename is used for informational purposes only. */
+ Note the filename is used for informational purposes only. */
ret += fscanf (mapfile, "%[^\n]\n", filename);
}
else
@@ -108,11 +106,9 @@ read_mapping (FILE *mapfile,
*/
static int
-linux_find_memory_regions (int (*func) (CORE_ADDR,
+linux_find_memory_regions (int (*func) (CORE_ADDR,
unsigned long,
- int, int, int,
- void *),
- void *obfd)
+ int, int, int, void *), void *obfd)
{
long long pid = PIDGET (inferior_ptid);
char mapsfilename[MAXPATHLEN];
@@ -128,31 +124,29 @@ linux_find_memory_regions (int (*func) (CORE_ADDR,
error ("Could not open %s\n", mapsfilename);
if (info_verbose)
- fprintf_filtered (gdb_stdout,
+ fprintf_filtered (gdb_stdout,
"Reading memory regions from %s\n", mapsfilename);
/* Now iterate until end-of-file. */
- while (read_mapping (mapsfile, &addr, &endaddr, &permissions[0],
+ while (read_mapping (mapsfile, &addr, &endaddr, &permissions[0],
&offset, &device[0], &inode, &filename[0]))
{
size = endaddr - addr;
/* Get the segment's permissions. */
- read = (strchr (permissions, 'r') != 0);
+ read = (strchr (permissions, 'r') != 0);
write = (strchr (permissions, 'w') != 0);
- exec = (strchr (permissions, 'x') != 0);
+ exec = (strchr (permissions, 'x') != 0);
if (info_verbose)
{
- fprintf_filtered (gdb_stdout,
- "Save segment, %lld bytes at 0x%s (%c%c%c)",
- size, paddr_nz (addr),
- read ? 'r' : ' ',
- write ? 'w' : ' ',
- exec ? 'x' : ' ');
+ fprintf_filtered (gdb_stdout,
+ "Save segment, %lld bytes at 0x%s (%c%c%c)",
+ size, paddr_nz (addr),
+ read ? 'r' : ' ',
+ write ? 'w' : ' ', exec ? 'x' : ' ');
if (filename && filename[0])
- fprintf_filtered (gdb_stdout,
- " for %s", filename);
+ fprintf_filtered (gdb_stdout, " for %s", filename);
fprintf_filtered (gdb_stdout, "\n");
}
@@ -169,7 +163,7 @@ linux_find_memory_regions (int (*func) (CORE_ADDR,
*/
static char *
-linux_do_thread_registers (bfd *obfd, ptid_t ptid,
+linux_do_thread_registers (bfd *obfd, ptid_t ptid,
char *note_data, int *note_size)
{
gdb_gregset_t gregs;
@@ -180,26 +174,23 @@ linux_do_thread_registers (bfd *obfd, ptid_t ptid,
unsigned long merged_pid = ptid_get_tid (ptid) << 16 | ptid_get_pid (ptid);
fill_gregset (&gregs, -1);
- note_data = (char *) elfcore_write_prstatus (obfd,
- note_data,
- note_size,
- merged_pid,
- stop_signal,
- &gregs);
+ note_data = (char *) elfcore_write_prstatus (obfd,
+ note_data,
+ note_size,
+ merged_pid,
+ stop_signal, &gregs);
fill_fpregset (&fpregs, -1);
- note_data = (char *) elfcore_write_prfpreg (obfd,
- note_data,
- note_size,
- &fpregs,
- sizeof (fpregs));
+ note_data = (char *) elfcore_write_prfpreg (obfd,
+ note_data,
+ note_size,
+ &fpregs, sizeof (fpregs));
#ifdef FILL_FPXREGSET
fill_fpxregset (&fpxregs, -1);
- note_data = (char *) elfcore_write_prxfpreg (obfd,
- note_data,
- note_size,
- &fpxregs,
- sizeof (fpxregs));
+ note_data = (char *) elfcore_write_prxfpreg (obfd,
+ note_data,
+ note_size,
+ &fpxregs, sizeof (fpxregs));
#endif
return note_data;
}
@@ -228,9 +219,9 @@ linux_corefile_thread_callback (struct thread_info *ti, void *data)
registers_changed ();
target_fetch_registers (-1); /* FIXME should not be necessary;
fill_gregset should do it automatically. */
- args->note_data = linux_do_thread_registers (args->obfd,
- ti->ptid,
- args->note_data,
+ args->note_data = linux_do_thread_registers (args->obfd,
+ ti->ptid,
+ args->note_data,
args->note_size);
args->num_notes++;
inferior_ptid = saved_ptid;
@@ -252,28 +243,24 @@ linux_make_note_section (bfd *obfd, int *note_size)
{
struct linux_corefile_thread_data thread_args;
struct cleanup *old_chain;
- char fname[16] = {'\0'};
- char psargs[80] = {'\0'};
+ char fname[16] = { '\0' };
+ char psargs[80] = { '\0' };
char *note_data = NULL;
ptid_t current_ptid = inferior_ptid;
if (get_exec_file (0))
{
strncpy (fname, strrchr (get_exec_file (0), '/') + 1, sizeof (fname));
- strncpy (psargs, get_exec_file (0),
- sizeof (psargs));
+ strncpy (psargs, get_exec_file (0), sizeof (psargs));
if (get_inferior_args ())
{
- strncat (psargs, " ",
- sizeof (psargs) - strlen (psargs));
- strncat (psargs, get_inferior_args (),
+ strncat (psargs, " ", sizeof (psargs) - strlen (psargs));
+ strncat (psargs, get_inferior_args (),
sizeof (psargs) - strlen (psargs));
}
- note_data = (char *) elfcore_write_prpsinfo (obfd,
- note_data,
- note_size,
- fname,
- psargs);
+ note_data = (char *) elfcore_write_prpsinfo (obfd,
+ note_data,
+ note_size, fname, psargs);
}
/* Dump information for threads. */
@@ -285,8 +272,8 @@ linux_make_note_section (bfd *obfd, int *note_size)
if (thread_args.num_notes == 0)
{
/* iterate_over_threads didn't come up with any threads;
- just use inferior_ptid. */
- note_data = linux_do_thread_registers (obfd, inferior_ptid,
+ just use inferior_ptid. */
+ note_data = linux_do_thread_registers (obfd, inferior_ptid,
note_data, note_size);
}
else
@@ -420,33 +407,30 @@ linux_info_proc_cmd (char *args, int from_tty)
if (TARGET_ADDR_BIT == 32)
{
header_fmt_string = "\t%10s %10s %10s %10s %7s\n";
- data_fmt_string = "\t%#10lx %#10lx %#10x %#10x %7s\n";
+ data_fmt_string = "\t%#10lx %#10lx %#10x %#10x %7s\n";
}
else
{
header_fmt_string = " %18s %18s %10s %10s %7s\n";
- data_fmt_string = " %#18lx %#18lx %#10x %#10x %7s\n";
+ data_fmt_string = " %#18lx %#18lx %#10x %#10x %7s\n";
}
printf_filtered ("Mapped address spaces:\n\n");
- printf_filtered (header_fmt_string,
+ printf_filtered (header_fmt_string,
"Start Addr",
" End Addr",
- " Size",
- " Offset",
- "objfile");
-
- while (read_mapping (procfile, &addr, &endaddr, &permissions[0],
+ " Size", " Offset", "objfile");
+
+ while (read_mapping (procfile, &addr, &endaddr, &permissions[0],
&offset, &device[0], &inode, &filename[0]))
{
size = endaddr - addr;
- printf_filtered (data_fmt_string,
- (unsigned long) addr, /* FIXME: pr_addr */
- (unsigned long) endaddr,
- (int) size,
- (unsigned int) offset,
+ printf_filtered (data_fmt_string, (unsigned long) addr, /* FIXME: pr_addr */
+ (unsigned long) endaddr,
+ (int) size,
+ (unsigned int) offset,
filename[0] ? filename : "");
-
+
}
fclose (procfile);
@@ -463,7 +447,7 @@ linux_info_proc_cmd (char *args, int from_tty)
printf_filtered (buffer);
fclose (procfile);
}
- else
+ else
warning ("unable to open /proc file '%s'", fname1);
}
if (stat_f || all)
@@ -493,16 +477,16 @@ linux_info_proc_cmd (char *args, int from_tty)
if (fscanf (procfile, "%u ", &itmp) > 0)
printf_filtered ("Flags: 0x%x\n", itmp);
if (fscanf (procfile, "%u ", &itmp) > 0)
- printf_filtered ("Minor faults (no memory page): %u\n",
+ printf_filtered ("Minor faults (no memory page): %u\n",
(unsigned int) itmp);
if (fscanf (procfile, "%u ", &itmp) > 0)
- printf_filtered ("Minor faults, children: %u\n",
+ printf_filtered ("Minor faults, children: %u\n",
(unsigned int) itmp);
if (fscanf (procfile, "%u ", &itmp) > 0)
- printf_filtered ("Major faults (memory page faults): %u\n",
+ printf_filtered ("Major faults (memory page faults): %u\n",
(unsigned int) itmp);
if (fscanf (procfile, "%u ", &itmp) > 0)
- printf_filtered ("Major faults, children: %u\n",
+ printf_filtered ("Major faults, children: %u\n",
(unsigned int) itmp);
if (fscanf (procfile, "%d ", &itmp) > 0)
printf_filtered ("utime: %d\n", itmp);
@@ -513,36 +497,34 @@ linux_info_proc_cmd (char *args, int from_tty)
if (fscanf (procfile, "%d ", &itmp) > 0)
printf_filtered ("stime, children: %d\n", itmp);
if (fscanf (procfile, "%d ", &itmp) > 0)
- printf_filtered ("jiffies remaining in current time slice: %d\n",
+ printf_filtered ("jiffies remaining in current time slice: %d\n",
itmp);
if (fscanf (procfile, "%d ", &itmp) > 0)
printf_filtered ("'nice' value: %d\n", itmp);
if (fscanf (procfile, "%u ", &itmp) > 0)
- printf_filtered ("jiffies until next timeout: %u\n",
+ printf_filtered ("jiffies until next timeout: %u\n",
(unsigned int) itmp);
if (fscanf (procfile, "%u ", &itmp) > 0)
- printf_filtered ("jiffies until next SIGALRM: %u\n",
+ printf_filtered ("jiffies until next SIGALRM: %u\n",
(unsigned int) itmp);
if (fscanf (procfile, "%d ", &itmp) > 0)
- printf_filtered ("start time (jiffies since system boot): %d\n",
+ printf_filtered ("start time (jiffies since system boot): %d\n",
itmp);
if (fscanf (procfile, "%u ", &itmp) > 0)
- printf_filtered ("Virtual memory size: %u\n",
+ printf_filtered ("Virtual memory size: %u\n",
(unsigned int) itmp);
if (fscanf (procfile, "%u ", &itmp) > 0)
- printf_filtered ("Resident set size: %u\n",
- (unsigned int) itmp);
+ printf_filtered ("Resident set size: %u\n", (unsigned int) itmp);
if (fscanf (procfile, "%u ", &itmp) > 0)
- printf_filtered ("rlim: %u\n",
- (unsigned int) itmp);
+ printf_filtered ("rlim: %u\n", (unsigned int) itmp);
if (fscanf (procfile, "%u ", &itmp) > 0)
printf_filtered ("Start of text: 0x%x\n", itmp);
if (fscanf (procfile, "%u ", &itmp) > 0)
printf_filtered ("End of text: 0x%x\n", itmp);
if (fscanf (procfile, "%u ", &itmp) > 0)
printf_filtered ("Start of stack: 0x%x\n", itmp);
-#if 0 /* Don't know how architecture-dependent the rest is...
- Anyway the signal bitmap info is available from "status". */
+#if 0 /* Don't know how architecture-dependent the rest is...
+ Anyway the signal bitmap info is available from "status". */
if (fscanf (procfile, "%u ", &itmp) > 0) /* FIXME arch? */
printf_filtered ("Kernel stack pointer: 0x%x\n", itmp);
if (fscanf (procfile, "%u ", &itmp) > 0) /* FIXME arch? */
@@ -574,7 +556,7 @@ _initialize_linux_proc (void)
inftarg_set_find_memory_regions (linux_find_memory_regions);
inftarg_set_make_corefile_notes (linux_make_note_section);
- add_info ("proc", linux_info_proc_cmd,
+ add_info ("proc", linux_info_proc_cmd,
"Show /proc process information about any running process.\n\
Specify any process id, or use the program being debugged by default.\n\
Specify any of the following keywords for detailed info:\n\
@@ -584,9 +566,9 @@ Specify any of the following keywords for detailed info:\n\
all -- list all available /proc info.");
}
-int linux_proc_xfer_memory (CORE_ADDR addr, char *myaddr, int len, int write,
- struct mem_attrib *attrib,
- struct target_ops *target)
+int
+linux_proc_xfer_memory (CORE_ADDR addr, char *myaddr, int len, int write,
+ struct mem_attrib *attrib, struct target_ops *target)
{
int fd, ret;
char filename[64];
@@ -616,8 +598,7 @@ int linux_proc_xfer_memory (CORE_ADDR addr, char *myaddr, int len, int write,
#ifdef HAVE_PREAD64
if (pread64 (fd, myaddr, len, addr) != len)
#else
- if (lseek (fd, addr, SEEK_SET) == -1
- || read (fd, myaddr, len) != len)
+ if (lseek (fd, addr, SEEK_SET) == -1 || read (fd, myaddr, len) != len)
#endif
ret = 0;
else
diff --git a/gdb/m2-lang.c b/gdb/m2-lang.c
index 116d850..4932cdf 100644
--- a/gdb/m2-lang.c
+++ b/gdb/m2-lang.c
@@ -426,6 +426,8 @@ const struct language_defn m2_language_defn =
m2_print_type, /* Print a type using appropriate syntax */
m2_val_print, /* Print a value using appropriate syntax */
c_value_print, /* Print a top-level value */
+ NULL, /* Language specific skip_trampoline */
+ NULL, /* Language specific symbol demangler */
{"", "", "", ""}, /* Binary format info */
{"%loB", "", "o", "B"}, /* Octal format info */
{"%ld", "", "d", ""}, /* Decimal format info */
diff --git a/gdb/m3-nat.c b/gdb/m3-nat.c
index 28e62a8..93ef57a 100644
--- a/gdb/m3-nat.c
+++ b/gdb/m3-nat.c
@@ -1,4566 +1,4566 @@
-/* Interface GDB to Mach 3.0 operating systems.
- (Most) Mach 3.0 related routines live in this file.
-
- Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
- 2002 Free Software Foundation, Inc.
-
- This file is part of GDB.
-
- 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.
-
- 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.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-
-/*
- * Author: Jukka Virtanen <jtv@hut.fi>
- * Computing Centre
- * Helsinki University of Technology
- * Finland
- *
- * Thanks to my friends who helped with ideas and testing:
- *
- * Johannes Helander, Antti Louko, Tero Mononen,
- * jvh@cs.hut.fi alo@hut.fi tmo@cs.hut.fi
- *
- * Tero Kivinen and Eamonn McManus
- * kivinen@cs.hut.fi emcmanus@gr.osf.org
- *
- */
-
-#include <stdio.h>
-
-#include <mach.h>
-#include <servers/netname.h>
-#include <servers/machid.h>
-#include <mach/message.h>
-#include <mach/notify.h>
-#include <mach_error.h>
-#include <mach/exception.h>
-#include <mach/vm_attributes.h>
-
-#include "defs.h"
-#include "inferior.h"
-#include "symtab.h"
-#include "value.h"
-#include "language.h"
-#include "target.h"
-#include "gdb_wait.h"
-#include "gdbcmd.h"
-#include "gdbcore.h"
-#include "regcache.h"
-
-#if 0
-#include <servers/machid_lib.h>
-#else
-#define MACH_TYPE_TASK 1
-#define MACH_TYPE_THREAD 2
-#endif
-
-/* Included only for signal names and NSIG
-
- * note: There are many problems in signal handling with
- * gdb in Mach 3.0 in general.
- */
-#include <signal.h>
-#define SIG_UNKNOWN 0 /* Exception that has no matching unix signal */
-
-#include <cthreads.h>
-
-/* This is what a cproc looks like. This is here partly because
- cthread_internals.h is not a header we can just #include, partly with
- an eye towards perhaps getting this to work with cross-debugging
- someday. Best solution is if CMU publishes a real interface to this
- stuff. */
-#define CPROC_NEXT_OFFSET 0
-#define CPROC_NEXT_SIZE (TARGET_PTR_BIT / HOST_CHAR_BIT)
-#define CPROC_INCARNATION_OFFSET (CPROC_NEXT_OFFSET + CPROC_NEXT_SIZE)
-#define CPROC_INCARNATION_SIZE (sizeof (cthread_t))
-#define CPROC_LIST_OFFSET (CPROC_INCARNATION_OFFSET + CPROC_INCARNATION_SIZE)
-#define CPROC_LIST_SIZE (TARGET_PTR_BIT / HOST_CHAR_BIT)
-#define CPROC_WAIT_OFFSET (CPROC_LIST_OFFSET + CPROC_LIST_SIZE)
-#define CPROC_WAIT_SIZE (TARGET_PTR_BIT / HOST_CHAR_BIT)
-#define CPROC_REPLY_OFFSET (CPROC_WAIT_OFFSET + CPROC_WAIT_SIZE)
-#define CPROC_REPLY_SIZE (sizeof (mach_port_t))
-#define CPROC_CONTEXT_OFFSET (CPROC_REPLY_OFFSET + CPROC_REPLY_SIZE)
-#define CPROC_CONTEXT_SIZE (TARGET_INT_BIT / HOST_CHAR_BIT)
-#define CPROC_LOCK_OFFSET (CPROC_CONTEXT_OFFSET + CPROC_CONTEXT_SIZE)
-#define CPROC_LOCK_SIZE (sizeof (spin_lock_t))
-#define CPROC_STATE_OFFSET (CPROC_LOCK_OFFSET + CPROC_LOCK_SIZE)
-#define CPROC_STATE_SIZE (TARGET_INT_BIT / HOST_CHAR_BIT)
-#define CPROC_WIRED_OFFSET (CPROC_STATE_OFFSET + CPROC_STATE_SIZE)
-#define CPROC_WIRED_SIZE (sizeof (mach_port_t))
-#define CPROC_BUSY_OFFSET (CPROC_WIRED_OFFSET + CPROC_WIRED_SIZE)
-#define CPROC_BUSY_SIZE (TARGET_INT_BIT / HOST_CHAR_BIT)
-#define CPROC_MSG_OFFSET (CPROC_BUSY_OFFSET + CPROC_BUSY_SIZE)
-#define CPROC_MSG_SIZE (sizeof (mach_msg_header_t))
-#define CPROC_BASE_OFFSET (CPROC_MSG_OFFSET + CPROC_MSG_SIZE)
-#define CPROC_BASE_SIZE (TARGET_INT_BIT / HOST_CHAR_BIT)
-#define CPROC_SIZE_OFFSET (CPROC_BASE_OFFSET + CPROC_BASE_SIZE)
-#define CPROC_SIZE_SIZE (TARGET_INT_BIT / HOST_CHAR_BIT)
-#define CPROC_SIZE (CPROC_SIZE_OFFSET + CPROC_SIZE_SIZE)
-
-/* Values for the state field in the cproc. */
-#define CPROC_RUNNING 0
-#define CPROC_SWITCHING 1
-#define CPROC_BLOCKED 2
-#define CPROC_CONDWAIT 4
-
-/* For cproc and kernel thread mapping */
-typedef struct gdb_thread
- {
- mach_port_t name;
- CORE_ADDR sp;
- CORE_ADDR pc;
- CORE_ADDR fp;
- boolean_t in_emulator;
- int slotid;
-
- /* This is for the mthreads list. It points to the cproc list.
- Perhaps the two lists should be merged (or perhaps it was a mistake
- to make them both use a struct gdb_thread). */
- struct gdb_thread *cproc;
-
- /* These are for the cproc list, which is linked through the next field
- of the struct gdb_thread. */
- char raw_cproc[CPROC_SIZE];
- /* The cthread which is pointed to by the incarnation field from the
- cproc. This points to the copy we've read into GDB. */
- cthread_t cthread;
- /* Point back to the mthreads list. */
- int reverse_map;
- struct gdb_thread *next;
- }
- *gdb_thread_t;
-
-/*
- * Actions for Mach exceptions.
- *
- * sigmap field maps the exception to corresponding Unix signal.
- *
- * I do not know how to map the exception to unix signal
- * if SIG_UNKNOWN is specified.
- */
-
-struct exception_list
- {
- char *name;
- boolean_t forward;
- boolean_t print;
- int sigmap;
- }
-exception_map[] =
-{
- {
- "not_mach3_exception", FALSE, TRUE, SIG_UNKNOWN
- }
- ,
- {
- "EXC_BAD_ACCESS", FALSE, TRUE, SIGSEGV
- }
- ,
- {
- "EXC_BAD_INSTRUCTION", FALSE, TRUE, SIGILL
- }
- ,
- {
- "EXC_ARITHMETIC", FALSE, TRUE, SIGFPE
- }
- ,
- {
- "EXC_EMULATION", FALSE, TRUE, SIGEMT
- }
- , /* ??? */
- {
- "EXC_SOFTWARE", FALSE, TRUE, SIG_UNKNOWN
- }
- ,
- {
- "EXC_BREAKPOINT", FALSE, FALSE, SIGTRAP
- }
-};
-
-/* Mach exception table size */
-int max_exception = sizeof (exception_map) / sizeof (struct exception_list) - 1;
-
-#define MAX_EXCEPTION max_exception
-
-WAITTYPE wait_status;
-
-/* If you define this, intercepted bsd server calls will be
- * dumped while waiting the inferior to EXEC the correct
- * program
- */
-/* #define DUMP_SYSCALL /* debugging interceptor */
-
-/* xx_debug() outputs messages if this is nonzero.
- * If > 1, DUMP_SYSCALL will dump message contents.
- */
-int debug_level = 0;
-
-/* "Temporary" debug stuff */
-void
-xx_debug (char *fmt, int a, int b, int c)
-{
- if (debug_level)
- warning (fmt, a, b, c);
-}
-
-/* This is in libmach.a */
-extern mach_port_t name_server_port;
-
-/* Set in catch_exception_raise */
-int stop_exception, stop_code, stop_subcode;
-int stopped_in_exception;
-
-/* Thread that was the active thread when we stopped */
-thread_t stop_thread = MACH_PORT_NULL;
-
-char *hostname = "";
-
-/* Set when task is attached or created */
-boolean_t emulator_present = FALSE;
-
-task_t inferior_task;
-thread_t current_thread;
-
-/* Exception ports for inferior task */
-mach_port_t inferior_exception_port = MACH_PORT_NULL;
-mach_port_t inferior_old_exception_port = MACH_PORT_NULL;
-
-/* task exceptions and notifications */
-mach_port_t inferior_wait_port_set = MACH_PORT_NULL;
-mach_port_t our_notify_port = MACH_PORT_NULL;
-
-/* This is "inferior_wait_port_set" when not single stepping, and
- * "singlestepped_thread_port" when we are single stepping.
- *
- * This is protected by a cleanup function: discard_single_step()
- */
-mach_port_t currently_waiting_for = MACH_PORT_NULL;
-
-/* A port for external messages to gdb.
- * External in the meaning that they do not come
- * from the inferior_task, but rather from external
- * tasks.
- *
- * As a debugging feature:
- * A debugger debugging another debugger can stop the
- * inferior debugger by the following command sequence
- * (without running external programs)
- *
- * (top-gdb) set stop_inferior_gdb ()
- * (top-gdb) continue
- */
-mach_port_t our_message_port = MACH_PORT_NULL;
-
-/* For single stepping */
-mach_port_t thread_exception_port = MACH_PORT_NULL;
-mach_port_t thread_saved_exception_port = MACH_PORT_NULL;
-mach_port_t singlestepped_thread_port = MACH_PORT_NULL;
-
-/* For machid calls */
-mach_port_t mid_server = MACH_PORT_NULL;
-mach_port_t mid_auth = MACH_PORT_NULL;
-
-/* If gdb thinks the inferior task is not suspended, it
- * must take suspend/abort the threads when it reads the state.
- */
-int must_suspend_thread = 0;
-
-/* When single stepping, we switch the port that mach_really_wait() listens to.
- * This cleanup is a guard to prevent the port set from being left to
- * the singlestepped_thread_port when error() is called.
- * This is nonzero only when we are single stepping.
- */
-#define NULL_CLEANUP (struct cleanup *)0
-struct cleanup *cleanup_step = NULL_CLEANUP;
-
-
-static struct target_ops m3_ops;
-
-static void m3_kill_inferior ();
-
-#if 0
-#define MACH_TYPE_EXCEPTION_PORT -1
-#endif
-
-/* Chain of ports to remember requested notifications. */
-
-struct port_chain
- {
- struct port_chain *next;
- mach_port_t port;
- int type;
- int mid; /* Now only valid with MACH_TYPE_THREAD and */
- /* MACH_TYPE_THREAD */
- };
-typedef struct port_chain *port_chain_t;
-
-/* Room for chain nodes comes from pchain_obstack */
-struct obstack pchain_obstack;
-struct obstack *port_chain_obstack = &pchain_obstack;
-
-/* For thread handling */
-struct obstack Cproc_obstack;
-struct obstack *cproc_obstack = &Cproc_obstack;
-
-/* the list of notified ports */
-port_chain_t notify_chain = (port_chain_t) NULL;
-
-port_chain_t
-port_chain_insert (port_chain_t list, mach_port_t name, int type)
-{
- kern_return_t ret;
- port_chain_t new;
- int mid;
-
- if (!MACH_PORT_VALID (name))
- return list;
-
- if (type == MACH_TYPE_TASK || type == MACH_TYPE_THREAD)
- {
- if (!MACH_PORT_VALID (mid_server))
- {
- warning ("Machid server port invalid, can not map port 0x%x to MID",
- name);
- mid = name;
- }
- else
- {
- ret = machid_mach_register (mid_server, mid_auth, name, type, &mid);
-
- if (ret != KERN_SUCCESS)
- {
- warning ("Can not map name (0x%x) to MID with machid", name);
- mid = name;
- }
- }
- }
- else
- internal_error (__FILE__, __LINE__, "failed internal consistency check");
-
- new = (port_chain_t) obstack_alloc (port_chain_obstack,
- sizeof (struct port_chain));
- new->next = list;
- new->port = name;
- new->type = type;
- new->mid = mid;
-
- return new;
-}
-
-port_chain_t
-port_chain_delete (port_chain_t list, mach_port_t elem)
-{
- if (list)
- if (list->port == elem)
- list = list->next;
- else
- while (list->next)
- {
- if (list->next->port == elem)
- list->next = list->next->next; /* GCd with obstack_free() */
- else
- list = list->next;
- }
- return list;
-}
-
-void
-port_chain_destroy (struct obstack *ostack)
-{
- obstack_free (ostack, 0);
- obstack_init (ostack);
-}
-
-port_chain_t
-port_chain_member (port_chain_t list, mach_port_t elem)
-{
- while (list)
- {
- if (list->port == elem)
- return list;
- list = list->next;
- }
- return (port_chain_t) NULL;
-}
-
-int
-map_port_name_to_mid (mach_port_t name, int type)
-{
- port_chain_t elem;
-
- if (!MACH_PORT_VALID (name))
- return -1;
-
- elem = port_chain_member (notify_chain, name);
-
- if (elem && (elem->type == type))
- return elem->mid;
-
- if (elem)
- return -1;
-
- if (!MACH_PORT_VALID (mid_server))
- {
- warning ("Machid server port invalid, can not map port 0x%x to mid",
- name);
- return -1;
- }
- else
- {
- int mid;
- kern_return_t ret;
-
- ret = machid_mach_register (mid_server, mid_auth, name, type, &mid);
-
- if (ret != KERN_SUCCESS)
- {
- warning ("Can not map name (0x%x) to mid with machid", name);
- return -1;
- }
- return mid;
- }
-}
-
-/* Guard for currently_waiting_for and singlestepped_thread_port */
-static void
-discard_single_step (thread_t thread)
-{
- currently_waiting_for = inferior_wait_port_set;
-
- cleanup_step = NULL_CLEANUP;
- if (MACH_PORT_VALID (thread) && MACH_PORT_VALID (singlestepped_thread_port))
- setup_single_step (thread, FALSE);
-}
-
-setup_single_step (thread_t thread, boolean_t start_step)
-{
- kern_return_t ret;
-
- if (!MACH_PORT_VALID (thread))
- error ("Invalid thread supplied to setup_single_step");
- else
- {
- mach_port_t teport;
-
- /* Get the current thread exception port */
- ret = thread_get_exception_port (thread, &teport);
- CHK ("Getting thread's exception port", ret);
-
- if (start_step)
- {
- if (MACH_PORT_VALID (singlestepped_thread_port))
- {
- warning ("Singlestepped_thread_port (0x%x) is still valid?",
- singlestepped_thread_port);
- singlestepped_thread_port = MACH_PORT_NULL;
- }
-
- /* If we are already stepping this thread */
- if (MACH_PORT_VALID (teport) && teport == thread_exception_port)
- {
- ret = mach_port_deallocate (mach_task_self (), teport);
- CHK ("Could not deallocate thread exception port", ret);
- }
- else
- {
- ret = thread_set_exception_port (thread, thread_exception_port);
- CHK ("Setting exception port for thread", ret);
-#if 0
- /* Insert thread exception port to wait port set */
- ret = mach_port_move_member (mach_task_self (),
- thread_exception_port,
- inferior_wait_port_set);
- CHK ("Moving thread exception port to inferior_wait_port_set",
- ret);
-#endif
- thread_saved_exception_port = teport;
- }
-
- thread_trace (thread, TRUE);
-
- singlestepped_thread_port = thread_exception_port;
- currently_waiting_for = singlestepped_thread_port;
- cleanup_step = make_cleanup (discard_single_step, thread);
- }
- else
- {
- if (!MACH_PORT_VALID (teport))
- error ("Single stepped thread had an invalid exception port?");
-
- if (teport != thread_exception_port)
- error ("Single stepped thread had an unknown exception port?");
-
- ret = mach_port_deallocate (mach_task_self (), teport);
- CHK ("Couldn't deallocate thread exception port", ret);
-#if 0
- /* Remove thread exception port from wait port set */
- ret = mach_port_move_member (mach_task_self (),
- thread_exception_port,
- MACH_PORT_NULL);
- CHK ("Removing thread exception port from inferior_wait_port_set",
- ret);
-#endif
- /* Restore thread's old exception port */
- ret = thread_set_exception_port (thread,
- thread_saved_exception_port);
- CHK ("Restoring stepped thread's exception port", ret);
-
- if (MACH_PORT_VALID (thread_saved_exception_port))
- (void) mach_port_deallocate (mach_task_self (),
- thread_saved_exception_port);
-
- thread_trace (thread, FALSE);
-
- singlestepped_thread_port = MACH_PORT_NULL;
- currently_waiting_for = inferior_wait_port_set;
- if (cleanup_step)
- discard_cleanups (cleanup_step);
- }
- }
-}
-
-static
-request_notify (mach_port_t name, mach_msg_id_t variant, int type)
-{
- kern_return_t ret;
- mach_port_t previous_port_dummy = MACH_PORT_NULL;
-
- if (!MACH_PORT_VALID (name))
- return;
-
- if (port_chain_member (notify_chain, name))
- return;
-
- ret = mach_port_request_notification (mach_task_self (),
- name,
- variant,
- 1,
- our_notify_port,
- MACH_MSG_TYPE_MAKE_SEND_ONCE,
- &previous_port_dummy);
- CHK ("Serious: request_notify failed", ret);
-
- (void) mach_port_deallocate (mach_task_self (),
- previous_port_dummy);
-
- notify_chain = port_chain_insert (notify_chain, name, type);
-}
-
-reverse_msg_bits (mach_msg_header_t *msgp, int type)
-{
- int rbits, lbits;
- rbits = MACH_MSGH_BITS_REMOTE (msgp->msgh_bits);
- lbits = type;
- msgp->msgh_bits =
- (msgp->msgh_bits & ~MACH_MSGH_BITS_PORTS_MASK) |
- MACH_MSGH_BITS (lbits, rbits);
-}
-
-/* On the third day He said:
-
- Let this be global
- and then it was global.
-
- When creating the inferior fork, the
- child code in inflow.c sets the name of the
- bootstrap_port in its address space to this
- variable.
-
- The name is transferred to our address space
- with mach3_read_inferior().
-
- Thou shalt not do this with
- task_get_bootstrap_port() in this task, since
- the name in the inferior task is different than
- the one we get.
-
- For blessed are the meek, as they shall inherit
- the address space.
- */
-mach_port_t original_server_port_name = MACH_PORT_NULL;
-
-
-/* Called from inferior after FORK but before EXEC */
-static void
-m3_trace_me (void)
-{
- kern_return_t ret;
-
- /* Get the NAME of the bootstrap port in this task
- so that GDB can read it */
- ret = task_get_bootstrap_port (mach_task_self (),
- &original_server_port_name);
- if (ret != KERN_SUCCESS)
- internal_error (__FILE__, __LINE__, "failed internal consistency check");
- ret = mach_port_deallocate (mach_task_self (),
- original_server_port_name);
- if (ret != KERN_SUCCESS)
- internal_error (__FILE__, __LINE__, "failed internal consistency check");
-
- /* Suspend this task to let the parent change my ports.
- Resumed by the debugger */
- ret = task_suspend (mach_task_self ());
- if (ret != KERN_SUCCESS)
- internal_error (__FILE__, __LINE__, "failed internal consistency check");
-}
-
-/*
- * Intercept system calls to Unix server.
- * After EXEC_COUNTER calls to exec(), return.
- *
- * Pre-assertion: Child is suspended. (Not verified)
- * Post-condition: Child is suspended after EXEC_COUNTER exec() calls.
- */
-
-void
-intercept_exec_calls (int exec_counter)
-{
- int terminal_initted = 0;
-
- struct syscall_msg_t
- {
- mach_msg_header_t header;
- mach_msg_type_t type;
- char room[2000]; /* Enuff space */
- };
-
- struct syscall_msg_t syscall_in, syscall_out;
-
- mach_port_t fake_server;
- mach_port_t original_server_send;
- mach_port_t original_exec_reply;
- mach_port_t exec_reply;
- mach_port_t exec_reply_send;
- mach_msg_type_name_t acquired;
- mach_port_t emulator_server_port_name;
- struct task_basic_info info;
- mach_msg_type_number_t info_count;
-
- kern_return_t ret;
-
- if (exec_counter <= 0)
- return; /* We are already set up in the correct program */
-
- ret = mach_port_allocate (mach_task_self (),
- MACH_PORT_RIGHT_RECEIVE,
- &fake_server);
- CHK ("create inferior_fake_server port failed", ret);
-
- /* Wait for inferior_task to suspend itself */
- while (1)
- {
- info_count = sizeof (info);
- ret = task_info (inferior_task,
- TASK_BASIC_INFO,
- (task_info_t) & info,
- &info_count);
- CHK ("Task info", ret);
-
- if (info.suspend_count)
- break;
-
- /* Note that the definition of the parameter was undefined
- * at the time of this writing, so I just use an `ad hoc' value.
- */
- (void) swtch_pri (42); /* Universal Priority Value */
- }
-
- /* Read the inferior's bootstrap port name */
- if (!mach3_read_inferior (&original_server_port_name,
- &original_server_port_name,
- sizeof (original_server_port_name)))
- error ("Can't read inferior task bootstrap port name");
-
- /* @@ BUG: If more than 1 send right GDB will FAIL!!! */
- /* Should get refs, and set them back when restoring */
- /* Steal the original bsd server send right from inferior */
- ret = mach_port_extract_right (inferior_task,
- original_server_port_name,
- MACH_MSG_TYPE_MOVE_SEND,
- &original_server_send,
- &acquired);
- CHK ("mach_port_extract_right (bsd server send)", ret);
-
- if (acquired != MACH_MSG_TYPE_PORT_SEND)
- error ("Incorrect right extracted, send right to bsd server expected");
-
- ret = mach_port_insert_right (inferior_task,
- original_server_port_name,
- fake_server,
- MACH_MSG_TYPE_MAKE_SEND);
- CHK ("mach_port_insert_right (fake server send)", ret);
-
- xx_debug ("inferior task bsd server ports set up \nfs %x, ospn %x, oss %x\n",
- fake_server,
- original_server_port_name, original_server_send);
-
- /* A receive right to the reply generated by unix server exec() request */
- ret = mach_port_allocate (mach_task_self (),
- MACH_PORT_RIGHT_RECEIVE,
- &exec_reply);
- CHK ("create intercepted_reply_port port failed", ret);
-
- /* Pass this send right to Unix server so it replies to us after exec() */
- ret = mach_port_extract_right (mach_task_self (),
- exec_reply,
- MACH_MSG_TYPE_MAKE_SEND_ONCE,
- &exec_reply_send,
- &acquired);
- CHK ("mach_port_extract_right (exec_reply)", ret);
-
- if (acquired != MACH_MSG_TYPE_PORT_SEND_ONCE)
- error ("Incorrect right extracted, send once expected for exec reply");
-
- ret = mach_port_move_member (mach_task_self (),
- fake_server,
- inferior_wait_port_set);
- CHK ("Moving fake syscall port to inferior_wait_port_set", ret);
-
- xx_debug ("syscall fake server set up, resuming inferior\n");
-
- ret = task_resume (inferior_task);
- CHK ("task_resume (startup)", ret);
-
- /* Read requests from the inferior.
- Pass directly through everything else except exec() calls.
- */
- while (exec_counter > 0)
- {
- ret = mach_msg (&syscall_in.header, /* header */
- MACH_RCV_MSG, /* options */
- 0, /* send size */
- sizeof (struct syscall_msg_t), /* receive size */
- inferior_wait_port_set, /* receive_name */
- MACH_MSG_TIMEOUT_NONE,
- MACH_PORT_NULL);
- CHK ("mach_msg (intercepted sycall)", ret);
-
-#ifdef DUMP_SYSCALL
- print_msg (&syscall_in.header);
-#endif
-
- /* ASSERT : msgh_local_port == fake_server */
-
- if (notify_server (&syscall_in.header, &syscall_out.header))
- error ("received a notify while intercepting syscalls");
-
- if (syscall_in.header.msgh_id == MIG_EXEC_SYSCALL_ID)
- {
- xx_debug ("Received EXEC SYSCALL, counter = %d\n", exec_counter);
- if (exec_counter == 1)
- {
- original_exec_reply = syscall_in.header.msgh_remote_port;
- syscall_in.header.msgh_remote_port = exec_reply_send;
- }
-
- if (!terminal_initted)
- {
- /* Now that the child has exec'd we know it has already set its
- process group. On POSIX systems, tcsetpgrp will fail with
- EPERM if we try it before the child's setpgid. */
-
- /* Set up the "saved terminal modes" of the inferior
- based on what modes we are starting it with. */
- target_terminal_init ();
-
- /* Install inferior's terminal modes. */
- target_terminal_inferior ();
-
- terminal_initted = 1;
- }
-
- exec_counter--;
- }
-
- syscall_in.header.msgh_local_port = syscall_in.header.msgh_remote_port;
- syscall_in.header.msgh_remote_port = original_server_send;
-
- reverse_msg_bits (&syscall_in.header, MACH_MSG_TYPE_COPY_SEND);
-
- ret = mach_msg_send (&syscall_in.header);
- CHK ("Forwarded syscall", ret);
- }
-
- ret = mach_port_move_member (mach_task_self (),
- fake_server,
- MACH_PORT_NULL);
- CHK ("Moving fake syscall out of inferior_wait_port_set", ret);
-
- ret = mach_port_move_member (mach_task_self (),
- exec_reply,
- inferior_wait_port_set);
- CHK ("Moving exec_reply to inferior_wait_port_set", ret);
-
- ret = mach_msg (&syscall_in.header, /* header */
- MACH_RCV_MSG, /* options */
- 0, /* send size */
- sizeof (struct syscall_msg_t), /* receive size */
- inferior_wait_port_set, /* receive_name */
- MACH_MSG_TIMEOUT_NONE,
- MACH_PORT_NULL);
- CHK ("mach_msg (exec reply)", ret);
-
- ret = task_suspend (inferior_task);
- CHK ("Suspending inferior after last exec", ret);
-
- must_suspend_thread = 0;
-
- xx_debug ("Received exec reply from bsd server, suspended inferior task\n");
-
-#ifdef DUMP_SYSCALL
- print_msg (&syscall_in.header);
-#endif
-
- /* Message should appear as if it came from the unix server */
- syscall_in.header.msgh_local_port = MACH_PORT_NULL;
-
- /* and go to the inferior task original reply port */
- syscall_in.header.msgh_remote_port = original_exec_reply;
-
- reverse_msg_bits (&syscall_in.header, MACH_MSG_TYPE_MOVE_SEND_ONCE);
-
- ret = mach_msg_send (&syscall_in.header);
- CHK ("Forwarding exec reply to inferior", ret);
-
- /* Garbage collect */
- ret = mach_port_deallocate (inferior_task,
- original_server_port_name);
- CHK ("deallocating fake server send right", ret);
-
- ret = mach_port_insert_right (inferior_task,
- original_server_port_name,
- original_server_send,
- MACH_MSG_TYPE_MOVE_SEND);
- CHK ("Restoring the original bsd server send right", ret);
-
- ret = mach_port_destroy (mach_task_self (),
- fake_server);
- fake_server = MACH_PORT_DEAD;
- CHK ("mach_port_destroy (fake_server)", ret);
-
- ret = mach_port_destroy (mach_task_self (),
- exec_reply);
- exec_reply = MACH_PORT_DEAD;
- CHK ("mach_port_destroy (exec_reply)", ret);
-
- xx_debug ("Done with exec call interception\n");
-}
-
-void
-consume_send_rights (thread_array_t thread_list, int thread_count)
-{
- int index;
-
- if (!thread_count)
- return;
-
- for (index = 0; index < thread_count; index++)
- {
- /* Since thread kill command kills threads, don't check ret */
- (void) mach_port_deallocate (mach_task_self (),
- thread_list[index]);
- }
-}
-
-/* suspend/abort/resume a thread. */
-setup_thread (mach_port_t thread, int what)
-{
- kern_return_t ret;
-
- if (what)
- {
- ret = thread_suspend (thread);
- CHK ("setup_thread thread_suspend", ret);
-
- ret = thread_abort (thread);
- CHK ("setup_thread thread_abort", ret);
- }
- else
- {
- ret = thread_resume (thread);
- CHK ("setup_thread thread_resume", ret);
- }
-}
-
-int
-map_slot_to_mid (int slot, thread_array_t threads, int thread_count)
-{
- kern_return_t ret;
- int deallocate = 0;
- int index;
- int mid;
-
- if (!threads)
- {
- deallocate++;
- ret = task_threads (inferior_task, &threads, &thread_count);
- CHK ("Can not select a thread from a dead task", ret);
- }
-
- if (slot < 0 || slot >= thread_count)
- {
- if (deallocate)
- {
- consume_send_rights (threads, thread_count);
- (void) vm_deallocate (mach_task_self (), (vm_address_t) threads,
- (thread_count * sizeof (mach_port_t)));
- }
- if (slot < 0)
- error ("invalid slot number");
- else
- return -(slot + 1);
- }
-
- mid = map_port_name_to_mid (threads[slot], MACH_TYPE_THREAD);
-
- if (deallocate)
- {
- consume_send_rights (threads, thread_count);
- (void) vm_deallocate (mach_task_self (), (vm_address_t) threads,
- (thread_count * sizeof (mach_port_t)));
- }
-
- return mid;
-}
-
-static int
-parse_thread_id (char *arg, int thread_count, int slots)
-{
- kern_return_t ret;
- int mid;
- int slot;
- int index;
-
- if (arg == 0)
- return 0;
-
- while (*arg && (*arg == ' ' || *arg == '\t'))
- arg++;
-
- if (!*arg)
- return 0;
-
- /* Currently parse MID and @SLOTNUMBER */
- if (*arg != '@')
- {
- mid = atoi (arg);
- if (mid <= 0)
- error ("valid thread mid expected");
- return mid;
- }
-
- arg++;
- slot = atoi (arg);
-
- if (slot < 0)
- error ("invalid slot number");
-
- /* If you want slot numbers to remain slot numbers, set slots.
-
- * Well, since 0 is reserved, return the ordinal number
- * of the thread rather than the slot number. Awk, this
- * counts as a kludge.
- */
- if (slots)
- return -(slot + 1);
-
- if (thread_count && slot >= thread_count)
- return -(slot + 1);
-
- mid = map_slot_to_mid (slot);
-
- return mid;
-}
-
-/* THREAD_ID 0 is special; it selects the first kernel
- * thread from the list (i.e. SLOTNUMBER 0)
- * This is used when starting the program with 'run' or when attaching.
- *
- * If FLAG is 0 the context is not changed, and the registers, frame, etc
- * will continue to describe the old thread.
- *
- * If FLAG is nonzero, really select the thread.
- * If FLAG is 2, the THREAD_ID is a slotnumber instead of a mid.
- *
- */
-kern_return_t
-select_thread (mach_port_t task, int thread_id, int flag)
-{
- thread_array_t thread_list;
- int thread_count;
- kern_return_t ret;
- int index;
- thread_t new_thread = MACH_PORT_NULL;
-
- if (thread_id < 0)
- error ("Can't select cprocs without kernel thread");
-
- ret = task_threads (task, &thread_list, &thread_count);
- if (ret != KERN_SUCCESS)
- {
- warning ("Can not select a thread from a dead task");
- m3_kill_inferior ();
- return KERN_FAILURE;
- }
-
- if (thread_count == 0)
- {
- /* The task can not do anything anymore, but it still
- * exists as a container for memory and ports.
- */
- registers_changed ();
- warning ("Task %d has no threads",
- map_port_name_to_mid (task, MACH_TYPE_TASK));
- current_thread = MACH_PORT_NULL;
- (void) vm_deallocate (mach_task_self (),
- (vm_address_t) thread_list,
- (thread_count * sizeof (mach_port_t)));
- return KERN_FAILURE;
- }
-
- if (!thread_id || flag == 2)
- {
- /* First thread or a slotnumber */
- if (!thread_id)
- new_thread = thread_list[0];
- else
- {
- if (thread_id < thread_count)
- new_thread = thread_list[thread_id];
- else
- {
- (void) vm_deallocate (mach_task_self (),
- (vm_address_t) thread_list,
- (thread_count * sizeof (mach_port_t)));
- error ("No such thread slot number : %d", thread_id);
- }
- }
- }
- else
- {
- for (index = 0; index < thread_count; index++)
- if (thread_id == map_port_name_to_mid (thread_list[index],
- MACH_TYPE_THREAD))
- {
- new_thread = thread_list[index];
- index = -1;
- break;
- }
-
- if (index != -1)
- error ("No thread with mid %d", thread_id);
- }
-
- /* Notify when the selected thread dies */
- request_notify (new_thread, MACH_NOTIFY_DEAD_NAME, MACH_TYPE_THREAD);
-
- ret = vm_deallocate (mach_task_self (),
- (vm_address_t) thread_list,
- (thread_count * sizeof (mach_port_t)));
- CHK ("vm_deallocate", ret);
-
- if (!flag)
- current_thread = new_thread;
- else
- {
-#if 0
- if (MACH_PORT_VALID (current_thread))
- {
- /* Store the gdb's view of the thread we are deselecting
-
- * @@ I think gdb updates registers immediately when they are
- * changed, so don't do this.
- */
- ret = thread_abort (current_thread);
- CHK ("Could not abort system calls when saving state of old thread",
- ret);
- target_prepare_to_store ();
- target_store_registers (-1);
- }
-#endif
-
- registers_changed ();
-
- current_thread = new_thread;
-
- ret = thread_abort (current_thread);
- CHK ("Could not abort system calls when selecting a thread", ret);
-
- stop_pc = read_pc ();
- flush_cached_frames ();
-
- select_frame (get_current_frame ());
- }
-
- return KERN_SUCCESS;
-}
-
-/*
- * Switch to use thread named NEW_THREAD.
- * Return it's MID
- */
-int
-switch_to_thread (thread_t new_thread)
-{
- thread_t saved_thread = current_thread;
- int mid;
-
- mid = map_port_name_to_mid (new_thread,
- MACH_TYPE_THREAD);
- if (mid == -1)
- warning ("Can't map thread name 0x%x to mid", new_thread);
- else if (select_thread (inferior_task, mid, 1) != KERN_SUCCESS)
- {
- if (current_thread)
- current_thread = saved_thread;
- error ("Could not select thread %d", mid);
- }
-
- return mid;
-}
-
-/* Do this in gdb after doing FORK but before STARTUP_INFERIOR.
- * Note that the registers are not yet valid in the inferior task.
- */
-static int
-m3_trace_him (int pid)
-{
- kern_return_t ret;
-
- push_target (&m3_ops);
-
- inferior_task = task_by_pid (pid);
-
- if (!MACH_PORT_VALID (inferior_task))
- error ("Can not map Unix pid %d to Mach task", pid);
-
- /* Clean up previous notifications and create new ones */
- setup_notify_port (1);
-
- /* When notification appears, the inferior task has died */
- request_notify (inferior_task, MACH_NOTIFY_DEAD_NAME, MACH_TYPE_TASK);
-
- emulator_present = have_emulator_p (inferior_task);
-
- /* By default, select the first thread,
- * If task has no threads, gives a warning
- * Does not fetch registers, since they are not yet valid.
- */
- select_thread (inferior_task, 0, 0);
-
- inferior_exception_port = MACH_PORT_NULL;
-
- setup_exception_port ();
-
- xx_debug ("Now the debugged task is created\n");
-
- /* One trap to exec the shell, one to exec the program being debugged. */
- intercept_exec_calls (2);
-
- return pid;
-}
-
-setup_exception_port (void)
-{
- kern_return_t ret;
-
- ret = mach_port_allocate (mach_task_self (),
- MACH_PORT_RIGHT_RECEIVE,
- &inferior_exception_port);
- CHK ("mach_port_allocate", ret);
-
- /* add send right */
- ret = mach_port_insert_right (mach_task_self (),
- inferior_exception_port,
- inferior_exception_port,
- MACH_MSG_TYPE_MAKE_SEND);
- CHK ("mach_port_insert_right", ret);
-
- ret = mach_port_move_member (mach_task_self (),
- inferior_exception_port,
- inferior_wait_port_set);
- CHK ("mach_port_move_member", ret);
-
- ret = task_get_special_port (inferior_task,
- TASK_EXCEPTION_PORT,
- &inferior_old_exception_port);
- CHK ("task_get_special_port(old exc)", ret);
-
- ret = task_set_special_port (inferior_task,
- TASK_EXCEPTION_PORT,
- inferior_exception_port);
- CHK ("task_set_special_port", ret);
-
- ret = mach_port_deallocate (mach_task_self (),
- inferior_exception_port);
- CHK ("mack_port_deallocate", ret);
-
-#if 0
- /* When notify appears, the inferior_task's exception
- * port has been destroyed.
- *
- * Not used, since the dead_name_notification already
- * appears when task dies.
- *
- */
- request_notify (inferior_exception_port,
- MACH_NOTIFY_NO_SENDERS,
- MACH_TYPE_EXCEPTION_PORT);
-#endif
-}
-
-/* Nonzero if gdb is waiting for a message */
-int mach_really_waiting;
-
-/* Wait for the inferior to stop for some reason.
- - Loop on notifications until inferior_task dies.
- - Loop on exceptions until stopped_in_exception comes true.
- (e.g. we receive a single step trace trap)
- - a message arrives to gdb's message port
-
- There is no other way to exit this loop.
-
- Returns the inferior_ptid for rest of gdb.
- Side effects: Set *OURSTATUS. */
-ptid_t
-mach_really_wait (ptid_t ptid, struct target_waitstatus *ourstatus)
-{
- kern_return_t ret;
- int w;
-
- struct msg
- {
- mach_msg_header_t header;
- mach_msg_type_t foo;
- int data[8000];
- }
- in_msg, out_msg;
-
- /* Either notify (death), exception or message can stop the inferior */
- stopped_in_exception = FALSE;
-
- while (1)
- {
- QUIT;
-
- stop_exception = stop_code = stop_subcode = -1;
- stop_thread = MACH_PORT_NULL;
-
- mach_really_waiting = 1;
- ret = mach_msg (&in_msg.header, /* header */
- MACH_RCV_MSG, /* options */
- 0, /* send size */
- sizeof (struct msg), /* receive size */
- currently_waiting_for, /* receive name */
- MACH_MSG_TIMEOUT_NONE,
- MACH_PORT_NULL);
- mach_really_waiting = 0;
- CHK ("mach_msg (receive)", ret);
-
- /* Check if we received a notify of the childs' death */
- if (notify_server (&in_msg.header, &out_msg.header))
- {
- /* If inferior_task is null then the inferior has
- gone away and we want to return to command level.
- Otherwise it was just an informative message and we
- need to look to see if there are any more. */
- if (inferior_task != MACH_PORT_NULL)
- continue;
- else
- {
- /* Collect Unix exit status for gdb */
-
- wait3 (&w, WNOHANG, 0);
-
- /* This mess is here to check that the rest of
- * gdb knows that the inferior died. It also
- * tries to hack around the fact that Mach 3.0 (mk69)
- * unix server (ux28) does not always know what
- * has happened to it's children when mach-magic
- * is applied on them.
- */
- if ((!WIFEXITED (w) && WIFSTOPPED (w)) ||
- (WIFEXITED (w) && WEXITSTATUS (w) > 0377))
- {
- WSETEXIT (w, 0);
- warning ("Using exit value 0 for terminated task");
- }
- else if (!WIFEXITED (w))
- {
- int sig = WTERMSIG (w);
-
- /* Signals cause problems. Warn the user. */
- if (sig != SIGKILL) /* Bad luck if garbage matches this */
- warning ("The terminating signal stuff may be nonsense");
- else if (sig > NSIG)
- {
- WSETEXIT (w, 0);
- warning ("Using exit value 0 for terminated task");
- }
- }
- store_waitstatus (ourstatus, w);
- return inferior_ptid;
- }
- }
-
- /* Hmm. Check for exception, as it was not a notification.
- exc_server() does an upcall to catch_exception_raise()
- if this rpc is an exception. Further actions are decided
- there.
- */
- if (!exc_server (&in_msg.header, &out_msg.header))
- {
-
- /* Not an exception, check for message.
-
- * Messages don't come from the inferior, or if they
- * do they better be asynchronous or it will hang.
- */
- if (gdb_message_server (&in_msg.header))
- continue;
-
- error ("Unrecognized message received in mach_really_wait");
- }
-
- /* Send the reply of the exception rpc to the suspended task */
- ret = mach_msg_send (&out_msg.header);
- CHK ("mach_msg_send (exc reply)", ret);
-
- if (stopped_in_exception)
- {
- /* Get unix state. May be changed in mach3_exception_actions() */
- wait3 (&w, WNOHANG, 0);
-
- mach3_exception_actions (&w, FALSE, "Task");
-
- store_waitstatus (ourstatus, w);
- return inferior_ptid;
- }
- }
-}
-
-/* Called by macro DO_QUIT() in utils.c(quit).
- * This is called just before calling error() to return to command level
- */
-void
-mach3_quit (void)
-{
- int mid;
- kern_return_t ret;
-
- if (mach_really_waiting)
- {
- ret = task_suspend (inferior_task);
-
- if (ret != KERN_SUCCESS)
- {
- warning ("Could not suspend task for interrupt: %s",
- mach_error_string (ret));
- mach_really_waiting = 0;
- return;
- }
- }
-
- must_suspend_thread = 0;
- mach_really_waiting = 0;
-
- mid = map_port_name_to_mid (current_thread, MACH_TYPE_THREAD);
- if (mid == -1)
- {
- warning ("Selecting first existing kernel thread");
- mid = 0;
- }
-
- current_thread = MACH_PORT_NULL; /* Force setup */
- select_thread (inferior_task, mid, 1);
-
- return;
-}
-
-#if 0
-/* bogus bogus bogus. It is NOT OK to quit out of target_wait. */
-
-/* If ^C is typed when we are waiting for a message
- * and your Unix server is able to notice that we
- * should quit now.
- *
- * Called by REQUEST_QUIT() from utils.c(request_quit)
- */
-void
-mach3_request_quit (void)
-{
- if (mach_really_waiting)
- immediate_quit = 1;
-}
-#endif
-
-/*
- * Gdb message server.
- * Currently implemented is the STOP message, that causes
- * gdb to return to the command level like ^C had been typed from terminal.
- */
-int
-gdb_message_server (mach_msg_header_t *InP)
-{
- kern_return_t ret;
- int mid;
-
- if (InP->msgh_local_port == our_message_port)
- {
- /* A message coming to our_message_port. Check validity */
- switch (InP->msgh_id)
- {
-
- case GDB_MESSAGE_ID_STOP:
- ret = task_suspend (inferior_task);
- if (ret != KERN_SUCCESS)
- warning ("Could not suspend task for stop message: %s",
- mach_error_string (ret));
-
- /* QUIT in mach_really_wait() loop. */
- request_quit (0);
- break;
-
- default:
- warning ("Invalid message id %d received, ignored.",
- InP->msgh_id);
- break;
- }
-
- return 1;
- }
-
- /* Message not handled by this server */
- return 0;
-}
-
-/* NOTE: This is not an RPC call. It is a simpleroutine.
-
- * This is not called from this gdb code.
- *
- * It may be called by another debugger to cause this
- * debugger to enter command level:
- *
- * (gdb) set stop_inferior_gdb ()
- * (gdb) continue
- *
- * External program "stop-gdb" implements this also.
- */
-void
-stop_inferior_gdb (void)
-{
- kern_return_t ret;
-
- /* Code generated by mig, with minor cleanups :-)
-
- * simpleroutine stop_inferior_gdb (our_message_port : mach_port_t);
- */
-
- typedef struct
- {
- mach_msg_header_t Head;
- }
- Request;
-
- Request Mess;
-
- register Request *InP = &Mess;
-
- InP->Head.msgh_bits = MACH_MSGH_BITS (MACH_MSG_TYPE_COPY_SEND, 0);
-
- /* msgh_size passed as argument */
- InP->Head.msgh_remote_port = our_message_port;
- InP->Head.msgh_local_port = MACH_PORT_NULL;
- InP->Head.msgh_seqno = 0;
- InP->Head.msgh_id = GDB_MESSAGE_ID_STOP;
-
- ret = mach_msg (&InP->Head,
- MACH_SEND_MSG | MACH_MSG_OPTION_NONE,
- sizeof (Request),
- 0,
- MACH_PORT_NULL,
- MACH_MSG_TIMEOUT_NONE,
- MACH_PORT_NULL);
-}
-
-#ifdef THREAD_ALLOWED_TO_BREAK
-/*
- * Return 1 if the MID specifies the thread that caused the
- * last exception.
- * Since catch_exception_raise() selects the thread causing
- * the last exception to current_thread, we just check that
- * it is selected and the last exception was a breakpoint.
- */
-int
-mach_thread_for_breakpoint (int mid)
-{
- int cmid = map_port_name_to_mid (current_thread, MACH_TYPE_THREAD);
-
- if (mid < 0)
- {
- mid = map_slot_to_mid (-(mid + 1), 0, 0);
- if (mid < 0)
- return 0; /* Don't stop, no such slot */
- }
-
- if (!mid || cmid == -1)
- return 1; /* stop */
-
- return cmid == mid && stop_exception == EXC_BREAKPOINT;
-}
-#endif /* THREAD_ALLOWED_TO_BREAK */
-
-#ifdef THREAD_PARSE_ID
-/*
- * Map a thread id string (MID or a @SLOTNUMBER)
- * to a thread-id.
- *
- * 0 matches all threads.
- * Otherwise the meaning is defined only in this file.
- * (mach_thread_for_breakpoint uses it)
- *
- * @@ This allows non-existent MIDs to be specified.
- * It now also allows non-existent slots to be
- * specified. (Slot numbers stored are negative,
- * and the magnitude is one greater than the actual
- * slot index. (Since 0 is reserved))
- */
-int
-mach_thread_parse_id (char *arg)
-{
- int mid;
- if (arg == 0)
- error ("thread id expected");
- mid = parse_thread_id (arg, 0, 1);
-
- return mid;
-}
-#endif /* THREAD_PARSE_ID */
-
-#ifdef THREAD_OUTPUT_ID
-char *
-mach_thread_output_id (int mid)
-{
- static char foobar[20];
-
- if (mid > 0)
- sprintf (foobar, "mid %d", mid);
- else if (mid < 0)
- sprintf (foobar, "@%d", -(mid + 1));
- else
- sprintf (foobar, "*any thread*");
-
- return foobar;
-}
-#endif /* THREAD_OUTPUT_ID */
-
-/* Called with hook PREPARE_TO_PROCEED() from infrun.c.
-
- * If we have switched threads and stopped at breakpoint return 1 otherwise 0.
- *
- * if SELECT_IT is nonzero, reselect the thread that was active when
- * we stopped at a breakpoint.
- *
- * Note that this implementation is potentially redundant now that
- * default_prepare_to_proceed() has been added.
- *
- * FIXME This may not support switching threads after Ctrl-C
- * correctly. The default implementation does support this.
- */
-
-mach3_prepare_to_proceed (int select_it)
-{
- if (stop_thread &&
- stop_thread != current_thread &&
- stop_exception == EXC_BREAKPOINT)
- {
- int mid;
-
- if (!select_it)
- return 1;
-
- mid = switch_to_thread (stop_thread);
-
- return 1;
- }
-
- return 0;
-}
-
-/* this stuff here is an upcall via libmach/excServer.c
- and mach_really_wait which does the actual upcall.
-
- The code will pass the exception to the inferior if:
-
- - The task that signaled is not the inferior task
- (e.g. when debugging another debugger)
-
- - The user has explicitely requested to pass on the exceptions.
- (e.g to the default unix exception handler, which maps
- exceptions to signals, or the user has her own exception handler)
-
- - If the thread that signaled is being single-stepped and it
- has set it's own exception port and the exception is not
- EXC_BREAKPOINT. (Maybe this is not desirable?)
- */
-
-kern_return_t
-catch_exception_raise (mach_port_t port, thread_t thread, task_t task,
- int exception, int code, int subcode)
-{
- kern_return_t ret;
- boolean_t signal_thread;
- int mid = map_port_name_to_mid (thread, MACH_TYPE_THREAD);
-
- if (!MACH_PORT_VALID (thread))
- {
- /* If the exception was sent and thread dies before we
- receive it, THREAD will be MACH_PORT_DEAD
- */
-
- current_thread = thread = MACH_PORT_NULL;
- error ("Received exception from nonexistent thread");
- }
-
- /* Check if the task died in transit.
- * @@ Isn't the thread also invalid in such case?
- */
- if (!MACH_PORT_VALID (task))
- {
- current_thread = thread = MACH_PORT_NULL;
- error ("Received exception from nonexistent task");
- }
-
- if (exception < 0 || exception > MAX_EXCEPTION)
- internal_error (__FILE__, __LINE__,
- "catch_exception_raise: unknown exception code %d thread %d",
- exception,
- mid);
-
- if (!MACH_PORT_VALID (inferior_task))
- error ("got an exception, but inferior_task is null or dead");
-
- stop_exception = exception;
- stop_code = code;
- stop_subcode = subcode;
- stop_thread = thread;
-
- signal_thread = exception != EXC_BREAKPOINT &&
- port == singlestepped_thread_port &&
- MACH_PORT_VALID (thread_saved_exception_port);
-
- /* If it was not our inferior or if we want to forward
- * the exception to the inferior's handler, do it here
- *
- * Note: If you have forwarded EXC_BREAKPOINT I trust you know why.
- */
- if (task != inferior_task ||
- signal_thread ||
- exception_map[exception].forward)
- {
- mach_port_t eport = inferior_old_exception_port;
-
- if (signal_thread)
- {
- /*
- GDB now forwards the exeption to thread's original handler,
- since the user propably knows what he is doing.
- Give a message, though.
- */
-
- mach3_exception_actions ((WAITTYPE *) NULL, TRUE, "Thread");
- eport = thread_saved_exception_port;
- }
-
- /* Send the exception to the original handler */
- ret = exception_raise (eport,
- thread,
- task,
- exception,
- code,
- subcode);
-
- (void) mach_port_deallocate (mach_task_self (), task);
- (void) mach_port_deallocate (mach_task_self (), thread);
-
- /* If we come here, we don't want to trace any more, since we
- * will never stop for tracing anyway.
- */
- discard_single_step (thread);
-
- /* Do not stop the inferior */
- return ret;
- }
-
- /* Now gdb handles the exception */
- stopped_in_exception = TRUE;
-
- ret = task_suspend (task);
- CHK ("Error suspending inferior after exception", ret);
-
- must_suspend_thread = 0;
-
- if (current_thread != thread)
- {
- if (MACH_PORT_VALID (singlestepped_thread_port))
- /* Cleanup discards single stepping */
- error ("Exception from thread %d while singlestepping thread %d",
- mid,
- map_port_name_to_mid (current_thread, MACH_TYPE_THREAD));
-
- /* Then select the thread that caused the exception */
- if (select_thread (inferior_task, mid, 0) != KERN_SUCCESS)
- error ("Could not select thread %d causing exception", mid);
- else
- warning ("Gdb selected thread %d", mid);
- }
-
- /* If we receive an exception that is not breakpoint
- * exception, we interrupt the single step and return to
- * debugger. Trace condition is cleared.
- */
- if (MACH_PORT_VALID (singlestepped_thread_port))
- {
- if (stop_exception != EXC_BREAKPOINT)
- warning ("Single step interrupted by exception");
- else if (port == singlestepped_thread_port)
- {
- /* Single step exception occurred, remove trace bit
- * and return to gdb.
- */
- if (!MACH_PORT_VALID (current_thread))
- error ("Single stepped thread is not valid");
-
- /* Resume threads, but leave the task suspended */
- resume_all_threads (0);
- }
- else
- warning ("Breakpoint while single stepping?");
-
- discard_single_step (current_thread);
- }
-
- (void) mach_port_deallocate (mach_task_self (), task);
- (void) mach_port_deallocate (mach_task_self (), thread);
-
- return KERN_SUCCESS;
-}
-
-int
-port_valid (mach_port_t port, int mask)
-{
- kern_return_t ret;
- mach_port_type_t type;
-
- ret = mach_port_type (mach_task_self (),
- port,
- &type);
- if (ret != KERN_SUCCESS || (type & mask) != mask)
- return 0;
- return 1;
-}
-
-/* @@ No vm read cache implemented yet */
-boolean_t vm_read_cache_valid = FALSE;
-
-/*
- * Read inferior task's LEN bytes from ADDR and copy it to MYADDR
- * in gdb's address space.
- *
- * Return 0 on failure; number of bytes read otherwise.
- */
-int
-mach3_read_inferior (CORE_ADDR addr, char *myaddr, int length)
-{
- kern_return_t ret;
- vm_address_t low_address = (vm_address_t) trunc_page (addr);
- vm_size_t aligned_length =
- (vm_size_t) round_page (addr + length) - low_address;
- pointer_t copied_memory;
- int copy_count;
-
- /* Get memory from inferior with page aligned addresses */
- ret = vm_read (inferior_task,
- low_address,
- aligned_length,
- &copied_memory,
- &copy_count);
- if (ret != KERN_SUCCESS)
- {
- /* the problem is that the inferior might be killed for whatever reason
- * before we go to mach_really_wait. This is one place that ought to
- * catch many of those errors.
- * @@ A better fix would be to make all external events to GDB
- * to arrive via a SINGLE port set. (Including user input!)
- */
-
- if (!port_valid (inferior_task, MACH_PORT_TYPE_SEND))
- {
- m3_kill_inferior ();
- error ("Inferior killed (task port invalid)");
- }
- else
- {
-#ifdef OSF
- extern int errno;
- /* valprint.c gives nicer format if this does not
- screw it. Eamonn seems to like this, so I enable
- it if OSF is defined...
- */
- warning ("[read inferior %x failed: %s]",
- addr, mach_error_string (ret));
- errno = 0;
-#endif
- return 0;
- }
- }
-
- memcpy (myaddr, (char *) addr - low_address + copied_memory, length);
-
- ret = vm_deallocate (mach_task_self (),
- copied_memory,
- copy_count);
- CHK ("mach3_read_inferior vm_deallocate failed", ret);
-
- return length;
-}
-
-#define CHK_GOTO_OUT(str,ret) \
- do if (ret != KERN_SUCCESS) { errstr = #str; goto out; } while(0)
-
-struct vm_region_list
-{
- struct vm_region_list *next;
- vm_prot_t protection;
- vm_address_t start;
- vm_size_t length;
-};
-
-struct obstack region_obstack;
-
-/*
- * Write inferior task's LEN bytes from ADDR and copy it to MYADDR
- * in gdb's address space.
- */
-int
-mach3_write_inferior (CORE_ADDR addr, char *myaddr, int length)
-{
- kern_return_t ret;
- vm_address_t low_address = (vm_address_t) trunc_page (addr);
- vm_size_t aligned_length =
- (vm_size_t) round_page (addr + length) - low_address;
- pointer_t copied_memory;
- int copy_count;
- int deallocate = 0;
-
- char *errstr = "Bug in mach3_write_inferior";
-
- struct vm_region_list *region_element;
- struct vm_region_list *region_head = (struct vm_region_list *) NULL;
-
- /* Get memory from inferior with page aligned addresses */
- ret = vm_read (inferior_task,
- low_address,
- aligned_length,
- &copied_memory,
- &copy_count);
- CHK_GOTO_OUT ("mach3_write_inferior vm_read failed", ret);
-
- deallocate++;
-
- memcpy ((char *) addr - low_address + copied_memory, myaddr, length);
-
- obstack_init (&region_obstack);
-
- /* Do writes atomically.
- * First check for holes and unwritable memory.
- */
- {
- vm_size_t remaining_length = aligned_length;
- vm_address_t region_address = low_address;
-
- struct vm_region_list *scan;
-
- while (region_address < low_address + aligned_length)
- {
- vm_prot_t protection;
- vm_prot_t max_protection;
- vm_inherit_t inheritance;
- boolean_t shared;
- mach_port_t object_name;
- vm_offset_t offset;
- vm_size_t region_length = remaining_length;
- vm_address_t old_address = region_address;
-
- ret = vm_region (inferior_task,
- &region_address,
- &region_length,
- &protection,
- &max_protection,
- &inheritance,
- &shared,
- &object_name,
- &offset);
- CHK_GOTO_OUT ("vm_region failed", ret);
-
- /* Check for holes in memory */
- if (old_address != region_address)
- {
- warning ("No memory at 0x%x. Nothing written",
- old_address);
- ret = KERN_SUCCESS;
- length = 0;
- goto out;
- }
-
- if (!(max_protection & VM_PROT_WRITE))
- {
- warning ("Memory at address 0x%x is unwritable. Nothing written",
- old_address);
- ret = KERN_SUCCESS;
- length = 0;
- goto out;
- }
-
- /* Chain the regions for later use */
- region_element =
- (struct vm_region_list *)
- obstack_alloc (&region_obstack, sizeof (struct vm_region_list));
-
- region_element->protection = protection;
- region_element->start = region_address;
- region_element->length = region_length;
-
- /* Chain the regions along with protections */
- region_element->next = region_head;
- region_head = region_element;
-
- region_address += region_length;
- remaining_length = remaining_length - region_length;
- }
-
- /* If things fail after this, we give up.
- * Somebody is messing up inferior_task's mappings.
- */
-
- /* Enable writes to the chained vm regions */
- for (scan = region_head; scan; scan = scan->next)
- {
- boolean_t protection_changed = FALSE;
-
- if (!(scan->protection & VM_PROT_WRITE))
- {
- ret = vm_protect (inferior_task,
- scan->start,
- scan->length,
- FALSE,
- scan->protection | VM_PROT_WRITE);
- CHK_GOTO_OUT ("vm_protect: enable write failed", ret);
- }
- }
-
- ret = vm_write (inferior_task,
- low_address,
- copied_memory,
- aligned_length);
- CHK_GOTO_OUT ("vm_write failed", ret);
-
- /* Set up the original region protections, if they were changed */
- for (scan = region_head; scan; scan = scan->next)
- {
- boolean_t protection_changed = FALSE;
-
- if (!(scan->protection & VM_PROT_WRITE))
- {
- ret = vm_protect (inferior_task,
- scan->start,
- scan->length,
- FALSE,
- scan->protection);
- CHK_GOTO_OUT ("vm_protect: enable write failed", ret);
- }
- }
- }
-
-out:
- if (deallocate)
- {
- obstack_free (&region_obstack, 0);
-
- (void) vm_deallocate (mach_task_self (),
- copied_memory,
- copy_count);
- }
-
- if (ret != KERN_SUCCESS)
- {
- warning ("%s %s", errstr, mach_error_string (ret));
- return 0;
- }
-
- return length;
-}
-
-/* Return 0 on failure, number of bytes handled otherwise. TARGET is
- ignored. */
-static int
-m3_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write,
- struct target_ops *target)
-{
- int result;
-
- if (write)
- result = mach3_write_inferior (memaddr, myaddr, len);
- else
- result = mach3_read_inferior (memaddr, myaddr, len);
-
- return result;
-}
-
-
-static char *
-translate_state (int state)
-{
- switch (state)
- {
- case TH_STATE_RUNNING:
- return ("R");
- case TH_STATE_STOPPED:
- return ("S");
- case TH_STATE_WAITING:
- return ("W");
- case TH_STATE_UNINTERRUPTIBLE:
- return ("U");
- case TH_STATE_HALTED:
- return ("H");
- default:
- return ("?");
- }
-}
-
-static char *
-translate_cstate (int state)
-{
- switch (state)
- {
- case CPROC_RUNNING:
- return "R";
- case CPROC_SWITCHING:
- return "S";
- case CPROC_BLOCKED:
- return "B";
- case CPROC_CONDWAIT:
- return "C";
- case CPROC_CONDWAIT | CPROC_SWITCHING:
- return "CS";
- default:
- return "?";
- }
-}
-
-/* type == MACH_MSG_TYPE_COPY_SEND || type == MACH_MSG_TYPE_MAKE_SEND */
-
-mach_port_t /* no mach_port_name_t found in include files. */
-map_inferior_port_name (mach_port_t inferior_name, mach_msg_type_name_t type)
-{
- kern_return_t ret;
- mach_msg_type_name_t acquired;
- mach_port_t iport;
-
- ret = mach_port_extract_right (inferior_task,
- inferior_name,
- type,
- &iport,
- &acquired);
- CHK ("mach_port_extract_right (map_inferior_port_name)", ret);
-
- if (acquired != MACH_MSG_TYPE_PORT_SEND)
- error ("Incorrect right extracted, (map_inferior_port_name)");
-
- ret = mach_port_deallocate (mach_task_self (),
- iport);
- CHK ("Deallocating mapped port (map_inferior_port_name)", ret);
-
- return iport;
-}
-
-/*
- * Naming convention:
- * Always return user defined name if found.
- * _K == A kernel thread with no matching CPROC
- * _C == A cproc with no current cthread
- * _t == A cthread with no user defined name
- *
- * The digits that follow the _names are the SLOT number of the
- * kernel thread if there is such a thing, otherwise just a negation
- * of the sequential number of such cprocs.
- */
-
-static char buf[7];
-
-static char *
-get_thread_name (gdb_thread_t one_cproc, int id)
-{
- if (one_cproc)
- if (one_cproc->cthread == NULL)
- {
- /* cproc not mapped to any cthread */
- sprintf (buf, "_C%d", id);
- }
- else if (!one_cproc->cthread->name)
- {
- /* cproc and cthread, but no name */
- sprintf (buf, "_t%d", id);
- }
- else
- return (char *) (one_cproc->cthread->name);
- else
- {
- if (id < 0)
- warning ("Inconsistency in thread name id %d", id);
-
- /* Kernel thread without cproc */
- sprintf (buf, "_K%d", id);
- }
-
- return buf;
-}
-
-int
-fetch_thread_info (mach_port_t task, gdb_thread_t *mthreads_out)
-{
- kern_return_t ret;
- thread_array_t th_table;
- int th_count;
- gdb_thread_t mthreads = NULL;
- int index;
-
- ret = task_threads (task, &th_table, &th_count);
- if (ret != KERN_SUCCESS)
- {
- warning ("Error getting inferior's thread list:%s",
- mach_error_string (ret));
- m3_kill_inferior ();
- return -1;
- }
-
- mthreads = (gdb_thread_t)
- obstack_alloc
- (cproc_obstack,
- th_count * sizeof (struct gdb_thread));
-
- for (index = 0; index < th_count; index++)
- {
- thread_t saved_thread = MACH_PORT_NULL;
- int mid;
-
- if (must_suspend_thread)
- setup_thread (th_table[index], 1);
-
- if (th_table[index] != current_thread)
- {
- saved_thread = current_thread;
-
- mid = switch_to_thread (th_table[index]);
- }
-
- mthreads[index].name = th_table[index];
- mthreads[index].cproc = NULL; /* map_cprocs_to_kernel_threads() */
- mthreads[index].in_emulator = FALSE;
- mthreads[index].slotid = index;
-
- mthreads[index].sp = read_register (SP_REGNUM);
- mthreads[index].fp = read_register (FP_REGNUM);
- mthreads[index].pc = read_pc ();
-
- if (MACH_PORT_VALID (saved_thread))
- mid = switch_to_thread (saved_thread);
-
- if (must_suspend_thread)
- setup_thread (th_table[index], 0);
- }
-
- consume_send_rights (th_table, th_count);
- ret = vm_deallocate (mach_task_self (), (vm_address_t) th_table,
- (th_count * sizeof (mach_port_t)));
- if (ret != KERN_SUCCESS)
- {
- warning ("Error trying to deallocate thread list : %s",
- mach_error_string (ret));
- }
-
- *mthreads_out = mthreads;
-
- return th_count;
-}
-
-
-/*
- * Current emulator always saves the USP on top of
- * emulator stack below struct emul_stack_top stuff.
- */
-CORE_ADDR
-fetch_usp_from_emulator_stack (CORE_ADDR sp)
-{
- CORE_ADDR stack_pointer;
-
- sp = (sp & ~(EMULATOR_STACK_SIZE - 1)) +
- EMULATOR_STACK_SIZE - sizeof (struct emul_stack_top);
-
- if (mach3_read_inferior (sp,
- &stack_pointer,
- sizeof (CORE_ADDR)) != sizeof (CORE_ADDR))
- {
- warning ("Can't read user sp from emulator stack address 0x%x", sp);
- return 0;
- }
-
- return stack_pointer;
-}
-
-#ifdef MK67
-
-/* get_emulation_vector() interface was changed after mk67 */
-#define EMUL_VECTOR_COUNT 400 /* Value does not matter too much */
-
-#endif /* MK67 */
-
-/* Check if the emulator exists at task's address space.
- */
-boolean_t
-have_emulator_p (task_t task)
-{
- kern_return_t ret;
-#ifndef EMUL_VECTOR_COUNT
- vm_offset_t *emulation_vector;
- int n;
-#else
- vm_offset_t emulation_vector[EMUL_VECTOR_COUNT];
- int n = EMUL_VECTOR_COUNT;
-#endif
- int i;
- int vector_start;
-
- ret = task_get_emulation_vector (task,
- &vector_start,
-#ifndef EMUL_VECTOR_COUNT
- &emulation_vector,
-#else
- emulation_vector,
-#endif
- &n);
- CHK ("task_get_emulation_vector", ret);
- xx_debug ("%d vectors from %d at 0x%08x\n",
- n, vector_start, emulation_vector);
-
- for (i = 0; i < n; i++)
- {
- vm_offset_t entry = emulation_vector[i];
-
- if (EMULATOR_BASE <= entry && entry <= EMULATOR_END)
- return TRUE;
- else if (entry)
- {
- static boolean_t informed = FALSE;
- if (!informed)
- {
- warning ("Emulation vector address 0x08%x outside emulator space",
- entry);
- informed = TRUE;
- }
- }
- }
- return FALSE;
-}
-
-/* Map cprocs to kernel threads and vice versa. */
-
-void
-map_cprocs_to_kernel_threads (gdb_thread_t cprocs, gdb_thread_t mthreads,
- int thread_count)
-{
- int index;
- gdb_thread_t scan;
- boolean_t all_mapped = TRUE;
- LONGEST stack_base;
- LONGEST stack_size;
-
- for (scan = cprocs; scan; scan = scan->next)
- {
- /* Default to: no kernel thread for this cproc */
- scan->reverse_map = -1;
-
- /* Check if the cproc is found by its stack */
- for (index = 0; index < thread_count; index++)
- {
- stack_base =
- extract_signed_integer (scan->raw_cproc + CPROC_BASE_OFFSET,
- CPROC_BASE_SIZE);
- stack_size =
- extract_signed_integer (scan->raw_cproc + CPROC_SIZE_OFFSET,
- CPROC_SIZE_SIZE);
- if ((mthreads + index)->sp > stack_base &&
- (mthreads + index)->sp <= stack_base + stack_size)
- {
- (mthreads + index)->cproc = scan;
- scan->reverse_map = index;
- break;
- }
- }
- all_mapped &= (scan->reverse_map != -1);
- }
-
- /* Check for threads that are currently in the emulator.
- * If so, they have a different stack, and the still unmapped
- * cprocs may well get mapped to these threads.
- *
- * If:
- * - cproc stack does not match any kernel thread stack pointer
- * - there is at least one extra kernel thread
- * that has no cproc mapped above.
- * - some kernel thread stack pointer points to emulator space
- * then we find the user stack pointer saved in the emulator
- * stack, and try to map that to the cprocs.
- *
- * Also set in_emulator for kernel threads.
- */
-
- if (emulator_present)
- {
- for (index = 0; index < thread_count; index++)
- {
- CORE_ADDR emul_sp;
- CORE_ADDR usp;
-
- gdb_thread_t mthread = (mthreads + index);
- emul_sp = mthread->sp;
-
- if (mthread->cproc == NULL &&
- EMULATOR_BASE <= emul_sp && emul_sp <= EMULATOR_END)
- {
- mthread->in_emulator = emulator_present;
-
- if (!all_mapped && cprocs)
- {
- usp = fetch_usp_from_emulator_stack (emul_sp);
-
- /* @@ Could be more accurate */
- if (!usp)
- error ("Zero stack pointer read from emulator?");
-
- /* Try to match this stack pointer to the cprocs that
- * don't yet have a kernel thread.
- */
- for (scan = cprocs; scan; scan = scan->next)
- {
-
- /* Check is this unmapped CPROC stack contains
- * the user stack pointer saved in the
- * emulator.
- */
- if (scan->reverse_map == -1)
- {
- stack_base =
- extract_signed_integer
- (scan->raw_cproc + CPROC_BASE_OFFSET,
- CPROC_BASE_SIZE);
- stack_size =
- extract_signed_integer
- (scan->raw_cproc + CPROC_SIZE_OFFSET,
- CPROC_SIZE_SIZE);
- if (usp > stack_base &&
- usp <= stack_base + stack_size)
- {
- mthread->cproc = scan;
- scan->reverse_map = index;
- break;
- }
- }
- }
- }
- }
- }
- }
-}
-
-/*
- * Format of the thread_list command
- *
- * slot mid sel name emul ks susp cstate wired address
- */
-#define TL_FORMAT "%-2.2s %5d%c %-10.10s %1.1s%s%-5.5s %-2.2s %-5.5s "
-
-#define TL_HEADER "\n@ MID Name KState CState Where\n"
-
-void
-print_tl_address (struct ui_file *stream, CORE_ADDR pc)
-{
- if (!lookup_minimal_symbol_by_pc (pc))
- fprintf_filtered (stream, local_hex_format (), pc);
- else
- {
- extern int addressprint;
- extern int asm_demangle;
-
- int store = addressprint;
- addressprint = 0;
- print_address_symbolic (pc, stream, asm_demangle, "");
- addressprint = store;
- }
-}
-
-/* For thread names, but also for gdb_message_port external name */
-#define MAX_NAME_LEN 50
-
-/* Returns the address of variable NAME or 0 if not found */
-CORE_ADDR
-lookup_address_of_variable (char *name)
-{
- struct symbol *sym;
- CORE_ADDR symaddr = 0;
- struct minimal_symbol *msymbol;
-
- sym = lookup_symbol (name,
- (struct block *) NULL,
- VAR_NAMESPACE,
- (int *) NULL,
- (struct symtab **) NULL);
-
- if (sym)
- symaddr = SYMBOL_VALUE (sym);
-
- if (!symaddr)
- {
- msymbol = lookup_minimal_symbol (name, NULL, NULL);
-
- if (msymbol && msymbol->type == mst_data)
- symaddr = SYMBOL_VALUE_ADDRESS (msymbol);
- }
-
- return symaddr;
-}
-
-static gdb_thread_t
-get_cprocs (void)
-{
- gdb_thread_t cproc_head;
- gdb_thread_t cproc_copy;
- CORE_ADDR their_cprocs;
- char *buf;
- char *name;
- cthread_t cthread;
- CORE_ADDR symaddr;
-
- buf = alloca (TARGET_PTR_BIT / HOST_CHAR_BIT);
- symaddr = lookup_address_of_variable ("cproc_list");
-
- if (!symaddr)
- {
- /* cproc_list is not in a file compiled with debugging
- symbols, but don't give up yet */
-
- symaddr = lookup_address_of_variable ("cprocs");
-
- if (symaddr)
- {
- static int informed = 0;
- if (!informed)
- {
- informed++;
- warning ("Your program is loaded with an old threads library.");
- warning ("GDB does not know the old form of threads");
- warning ("so things may not work.");
- }
- }
- }
-
- /* Stripped or no -lthreads loaded or "cproc_list" is in wrong segment. */
- if (!symaddr)
- return NULL;
-
- /* Get the address of the first cproc in the task */
- if (!mach3_read_inferior (symaddr,
- buf,
- TARGET_PTR_BIT / HOST_CHAR_BIT))
- error ("Can't read cproc master list at address (0x%x).", symaddr);
- their_cprocs = extract_address (buf, TARGET_PTR_BIT / HOST_CHAR_BIT);
-
- /* Scan the CPROCs in the task.
- CPROCs are chained with LIST field, not NEXT field, which
- chains mutexes, condition variables and queues */
-
- cproc_head = NULL;
-
- while (their_cprocs != (CORE_ADDR) 0)
- {
- CORE_ADDR cproc_copy_incarnation;
- cproc_copy = (gdb_thread_t) obstack_alloc (cproc_obstack,
- sizeof (struct gdb_thread));
-
- if (!mach3_read_inferior (their_cprocs,
- &cproc_copy->raw_cproc[0],
- CPROC_SIZE))
- error ("Can't read next cproc at 0x%x.", their_cprocs);
-
- their_cprocs =
- extract_address (cproc_copy->raw_cproc + CPROC_LIST_OFFSET,
- CPROC_LIST_SIZE);
- cproc_copy_incarnation =
- extract_address (cproc_copy->raw_cproc + CPROC_INCARNATION_OFFSET,
- CPROC_INCARNATION_SIZE);
-
- if (cproc_copy_incarnation == (CORE_ADDR) 0)
- cproc_copy->cthread = NULL;
- else
- {
- /* This CPROC has an attached CTHREAD. Get its name */
- cthread = (cthread_t) obstack_alloc (cproc_obstack,
- sizeof (struct cthread));
-
- if (!mach3_read_inferior (cproc_copy_incarnation,
- cthread,
- sizeof (struct cthread)))
- error ("Can't read next thread at 0x%x.",
- cproc_copy_incarnation);
-
- cproc_copy->cthread = cthread;
-
- if (cthread->name)
- {
- name = (char *) obstack_alloc (cproc_obstack, MAX_NAME_LEN);
-
- if (!mach3_read_inferior (cthread->name, name, MAX_NAME_LEN))
- error ("Can't read next thread's name at 0x%x.", cthread->name);
-
- cthread->name = name;
- }
- }
-
- /* insert in front */
- cproc_copy->next = cproc_head;
- cproc_head = cproc_copy;
- }
- return cproc_head;
-}
-
-#ifndef FETCH_CPROC_STATE
-/*
- * Check if your machine does not grok the way this routine
- * fetches the FP,PC and SP of a cproc that is not
- * currently attached to any kernel thread (e.g. its cproc.context
- * field points to the place in stack where the context
- * is saved).
- *
- * If it doesn't, define your own routine.
- */
-#define FETCH_CPROC_STATE(mth) mach3_cproc_state (mth)
-
-int
-mach3_cproc_state (gdb_thread_t mthread)
-{
- int context;
-
- if (!mthread || !mthread->cproc)
- return -1;
-
- context = extract_signed_integer
- (mthread->cproc->raw_cproc + CPROC_CONTEXT_OFFSET,
- CPROC_CONTEXT_SIZE);
- if (context == 0)
- return -1;
-
- mthread->sp = context + MACHINE_CPROC_SP_OFFSET;
-
- if (mach3_read_inferior (context + MACHINE_CPROC_PC_OFFSET,
- &mthread->pc,
- sizeof (CORE_ADDR)) != sizeof (CORE_ADDR))
- {
- warning ("Can't read cproc pc from inferior");
- return -1;
- }
-
- if (mach3_read_inferior (context + MACHINE_CPROC_FP_OFFSET,
- &mthread->fp,
- sizeof (CORE_ADDR)) != sizeof (CORE_ADDR))
- {
- warning ("Can't read cproc fp from inferior");
- return -1;
- }
-
- return 0;
-}
-#endif /* FETCH_CPROC_STATE */
-
-
-void
-thread_list_command (void)
-{
- thread_basic_info_data_t ths;
- int thread_count;
- gdb_thread_t cprocs;
- gdb_thread_t scan;
- int index;
- char *name;
- char selected;
- char *wired;
- int infoCnt;
- kern_return_t ret;
- mach_port_t mid_or_port;
- gdb_thread_t their_threads;
- gdb_thread_t kthread;
-
- int neworder = 1;
-
- char *fmt = "There are %d kernel threads in task %d.\n";
-
- int tmid = map_port_name_to_mid (inferior_task, MACH_TYPE_TASK);
-
- MACH_ERROR_NO_INFERIOR;
-
- thread_count = fetch_thread_info (inferior_task,
- &their_threads);
- if (thread_count == -1)
- return;
-
- if (thread_count == 1)
- fmt = "There is %d kernel thread in task %d.\n";
-
- printf_filtered (fmt, thread_count, tmid);
-
- puts_filtered (TL_HEADER);
-
- cprocs = get_cprocs ();
-
- map_cprocs_to_kernel_threads (cprocs, their_threads, thread_count);
-
- for (scan = cprocs; scan; scan = scan->next)
- {
- int mid;
- char buf[10];
- char slot[3];
- int cproc_state =
- extract_signed_integer
- (scan->raw_cproc + CPROC_STATE_OFFSET, CPROC_STATE_SIZE);
-
- selected = ' ';
-
- /* a wired cproc? */
- wired = (extract_address (scan->raw_cproc + CPROC_WIRED_OFFSET,
- CPROC_WIRED_SIZE)
- ? "wired" : "");
-
- if (scan->reverse_map != -1)
- kthread = (their_threads + scan->reverse_map);
- else
- kthread = NULL;
-
- if (kthread)
- {
- /* These cprocs have a kernel thread */
-
- mid = map_port_name_to_mid (kthread->name, MACH_TYPE_THREAD);
-
- infoCnt = THREAD_BASIC_INFO_COUNT;
-
- ret = thread_info (kthread->name,
- THREAD_BASIC_INFO,
- (thread_info_t) & ths,
- &infoCnt);
-
- if (ret != KERN_SUCCESS)
- {
- warning ("Unable to get basic info on thread %d : %s",
- mid,
- mach_error_string (ret));
- continue;
- }
-
- /* Who is the first to have more than 100 threads */
- sprintf (slot, "%d", kthread->slotid % 100);
-
- if (kthread->name == current_thread)
- selected = '*';
-
- if (ths.suspend_count)
- sprintf (buf, "%d", ths.suspend_count);
- else
- buf[0] = '\000';
-
-#if 0
- if (ths.flags & TH_FLAGS_SWAPPED)
- strcat (buf, "S");
-#endif
-
- if (ths.flags & TH_FLAGS_IDLE)
- strcat (buf, "I");
-
- printf_filtered (TL_FORMAT,
- slot,
- mid,
- selected,
- get_thread_name (scan, kthread->slotid),
- kthread->in_emulator ? "E" : "",
- translate_state (ths.run_state),
- buf,
- translate_cstate (cproc_state),
- wired);
- print_tl_address (gdb_stdout, kthread->pc);
- }
- else
- {
- /* These cprocs don't have a kernel thread.
- * find out the calling frame with
- * FETCH_CPROC_STATE.
- */
-
- struct gdb_thread state;
-
-#if 0
- /* jtv -> emcmanus: why do you want this here? */
- if (scan->incarnation == NULL)
- continue; /* EMcM */
-#endif
-
- printf_filtered (TL_FORMAT,
- "-",
- -neworder, /* Pseudo MID */
- selected,
- get_thread_name (scan, -neworder),
- "",
- "-", /* kernel state */
- "",
- translate_cstate (cproc_state),
- "");
- state.cproc = scan;
-
- if (FETCH_CPROC_STATE (&state) == -1)
- puts_filtered ("???");
- else
- print_tl_address (gdb_stdout, state.pc);
-
- neworder++;
- }
- puts_filtered ("\n");
- }
-
- /* Scan for kernel threads without cprocs */
- for (index = 0; index < thread_count; index++)
- {
- if (!their_threads[index].cproc)
- {
- int mid;
-
- char buf[10];
- char slot[3];
-
- mach_port_t name = their_threads[index].name;
-
- mid = map_port_name_to_mid (name, MACH_TYPE_THREAD);
-
- infoCnt = THREAD_BASIC_INFO_COUNT;
-
- ret = thread_info (name,
- THREAD_BASIC_INFO,
- (thread_info_t) & ths,
- &infoCnt);
-
- if (ret != KERN_SUCCESS)
- {
- warning ("Unable to get basic info on thread %d : %s",
- mid,
- mach_error_string (ret));
- continue;
- }
-
- sprintf (slot, "%d", index % 100);
-
- if (name == current_thread)
- selected = '*';
- else
- selected = ' ';
-
- if (ths.suspend_count)
- sprintf (buf, "%d", ths.suspend_count);
- else
- buf[0] = '\000';
-
-#if 0
- if (ths.flags & TH_FLAGS_SWAPPED)
- strcat (buf, "S");
-#endif
-
- if (ths.flags & TH_FLAGS_IDLE)
- strcat (buf, "I");
-
- printf_filtered (TL_FORMAT,
- slot,
- mid,
- selected,
- get_thread_name (NULL, index),
- their_threads[index].in_emulator ? "E" : "",
- translate_state (ths.run_state),
- buf,
- "", /* No cproc state */
- ""); /* Can't be wired */
- print_tl_address (gdb_stdout, their_threads[index].pc);
- puts_filtered ("\n");
- }
- }
-
- obstack_free (cproc_obstack, 0);
- obstack_init (cproc_obstack);
-}
-
-void
-thread_select_command (char *args, int from_tty)
-{
- int mid;
- thread_array_t thread_list;
- int thread_count;
- kern_return_t ret;
- int is_slot = 0;
-
- MACH_ERROR_NO_INFERIOR;
-
- if (!args)
- error_no_arg ("MID or @SLOTNUMBER to specify a thread to select");
-
- while (*args == ' ' || *args == '\t')
- args++;
-
- if (*args == '@')
- {
- is_slot++;
- args++;
- }
-
- mid = atoi (args);
-
- if (mid == 0)
- if (!is_slot || *args != '0') /* Rudimentary checks */
- error ("You must select threads by MID or @SLOTNUMBER");
-
- if (select_thread (inferior_task, mid, is_slot ? 2 : 1) != KERN_SUCCESS)
- return;
-
- if (from_tty)
- printf_filtered ("Thread %d selected\n",
- is_slot ? map_port_name_to_mid (current_thread,
- MACH_TYPE_THREAD) : mid);
-}
-
-thread_trace (mach_port_t thread, boolean_t set)
-{
- int flavor = TRACE_FLAVOR;
- unsigned int stateCnt = TRACE_FLAVOR_SIZE;
- kern_return_t ret;
- thread_state_data_t state;
-
- if (!MACH_PORT_VALID (thread))
- {
- warning ("thread_trace: invalid thread");
- return;
- }
-
- if (must_suspend_thread)
- setup_thread (thread, 1);
-
- ret = thread_get_state (thread, flavor, state, &stateCnt);
- CHK ("thread_trace: error reading thread state", ret);
-
- if (set)
- {
- TRACE_SET (thread, state);
- }
- else
- {
- if (!TRACE_CLEAR (thread, state))
- {
- if (must_suspend_thread)
- setup_thread (thread, 0);
- return;
- }
- }
-
- ret = thread_set_state (thread, flavor, state, stateCnt);
- CHK ("thread_trace: error writing thread state", ret);
- if (must_suspend_thread)
- setup_thread (thread, 0);
-}
-
-#ifdef FLUSH_INFERIOR_CACHE
-
-/* When over-writing code on some machines the I-Cache must be flushed
- explicitly, because it is not kept coherent by the lazy hardware.
- This definitely includes breakpoints, for instance, or else we
- end up looping in mysterious Bpt traps */
-
-flush_inferior_icache (CORE_ADDR pc, int amount)
-{
- vm_machine_attribute_val_t flush = MATTR_VAL_ICACHE_FLUSH;
- kern_return_t ret;
-
- ret = vm_machine_attribute (inferior_task,
- pc,
- amount,
- MATTR_CACHE,
- &flush);
- if (ret != KERN_SUCCESS)
- warning ("Error flushing inferior's cache : %s",
- mach_error_string (ret));
-}
-#endif /* FLUSH_INFERIOR_CACHE */
-
-
-static
-suspend_all_threads (int from_tty)
-{
- kern_return_t ret;
- thread_array_t thread_list;
- int thread_count, index;
- int infoCnt;
- thread_basic_info_data_t th_info;
-
-
- ret = task_threads (inferior_task, &thread_list, &thread_count);
- if (ret != KERN_SUCCESS)
- {
- warning ("Could not suspend inferior threads.");
- m3_kill_inferior ();
- throw_exception (RETURN_ERROR);
- }
-
- for (index = 0; index < thread_count; index++)
- {
- int mid;
-
- mid = map_port_name_to_mid (thread_list[index],
- MACH_TYPE_THREAD);
-
- ret = thread_suspend (thread_list[index]);
-
- if (ret != KERN_SUCCESS)
- warning ("Error trying to suspend thread %d : %s",
- mid, mach_error_string (ret));
-
- if (from_tty)
- {
- infoCnt = THREAD_BASIC_INFO_COUNT;
- ret = thread_info (thread_list[index],
- THREAD_BASIC_INFO,
- (thread_info_t) & th_info,
- &infoCnt);
- CHK ("suspend can't get thread info", ret);
-
- warning ("Thread %d suspend count is %d",
- mid, th_info.suspend_count);
- }
- }
-
- consume_send_rights (thread_list, thread_count);
- ret = vm_deallocate (mach_task_self (),
- (vm_address_t) thread_list,
- (thread_count * sizeof (int)));
- CHK ("Error trying to deallocate thread list", ret);
-}
-
-void
-thread_suspend_command (char *args, int from_tty)
-{
- kern_return_t ret;
- int mid;
- mach_port_t saved_thread;
- int infoCnt;
- thread_basic_info_data_t th_info;
-
- MACH_ERROR_NO_INFERIOR;
-
- if (!strcasecmp (args, "all"))
- {
- suspend_all_threads (from_tty);
- return;
- }
-
- saved_thread = current_thread;
-
- mid = parse_thread_id (args, 0, 0);
-
- if (mid < 0)
- error ("You can suspend only existing kernel threads with MID or @SLOTNUMBER");
-
- if (mid == 0)
- mid = map_port_name_to_mid (current_thread, MACH_TYPE_THREAD);
- else if (select_thread (inferior_task, mid, 0) != KERN_SUCCESS)
- {
- if (current_thread)
- current_thread = saved_thread;
- error ("Could not select thread %d", mid);
- }
-
- ret = thread_suspend (current_thread);
- if (ret != KERN_SUCCESS)
- warning ("thread_suspend failed : %s",
- mach_error_string (ret));
-
- infoCnt = THREAD_BASIC_INFO_COUNT;
- ret = thread_info (current_thread,
- THREAD_BASIC_INFO,
- (thread_info_t) & th_info,
- &infoCnt);
- CHK ("suspend can't get thread info", ret);
-
- warning ("Thread %d suspend count is %d", mid, th_info.suspend_count);
-
- current_thread = saved_thread;
-}
-
-resume_all_threads (int from_tty)
-{
- kern_return_t ret;
- thread_array_t thread_list;
- int thread_count, index;
- int mid;
- int infoCnt;
- thread_basic_info_data_t th_info;
-
- ret = task_threads (inferior_task, &thread_list, &thread_count);
- if (ret != KERN_SUCCESS)
- {
- m3_kill_inferior ();
- error ("task_threads", mach_error_string (ret));
- }
-
- for (index = 0; index < thread_count; index++)
- {
- infoCnt = THREAD_BASIC_INFO_COUNT;
- ret = thread_info (thread_list[index],
- THREAD_BASIC_INFO,
- (thread_info_t) & th_info,
- &infoCnt);
- CHK ("resume_all can't get thread info", ret);
-
- mid = map_port_name_to_mid (thread_list[index],
- MACH_TYPE_THREAD);
-
- if (!th_info.suspend_count)
- {
- if (mid != -1 && from_tty)
- warning ("Thread %d is not suspended", mid);
- continue;
- }
-
- ret = thread_resume (thread_list[index]);
-
- if (ret != KERN_SUCCESS)
- warning ("Error trying to resume thread %d : %s",
- mid, mach_error_string (ret));
- else if (mid != -1 && from_tty)
- warning ("Thread %d suspend count is %d",
- mid, --th_info.suspend_count);
- }
-
- consume_send_rights (thread_list, thread_count);
- ret = vm_deallocate (mach_task_self (),
- (vm_address_t) thread_list,
- (thread_count * sizeof (int)));
- CHK ("Error trying to deallocate thread list", ret);
-}
-
-void
-thread_resume_command (char *args, int from_tty)
-{
- int mid;
- mach_port_t saved_thread;
- kern_return_t ret;
- thread_basic_info_data_t th_info;
- int infoCnt = THREAD_BASIC_INFO_COUNT;
-
- MACH_ERROR_NO_INFERIOR;
-
- if (!strcasecmp (args, "all"))
- {
- resume_all_threads (from_tty);
- return;
- }
-
- saved_thread = current_thread;
-
- mid = parse_thread_id (args, 0, 0);
-
- if (mid < 0)
- error ("You can resume only existing kernel threads with MID or @SLOTNUMBER");
-
- if (mid == 0)
- mid = map_port_name_to_mid (current_thread, MACH_TYPE_THREAD);
- else if (select_thread (inferior_task, mid, 0) != KERN_SUCCESS)
- {
- if (current_thread)
- current_thread = saved_thread;
- throw_exception (RETURN_ERROR);
- }
-
- ret = thread_info (current_thread,
- THREAD_BASIC_INFO,
- (thread_info_t) & th_info,
- &infoCnt);
- CHK ("resume can't get thread info", ret);
-
- if (!th_info.suspend_count)
- {
- warning ("Thread %d is not suspended", mid);
- goto out;
- }
-
- ret = thread_resume (current_thread);
- if (ret != KERN_SUCCESS)
- warning ("thread_resume failed : %s",
- mach_error_string (ret));
- else
- {
- th_info.suspend_count--;
- warning ("Thread %d suspend count is %d", mid, th_info.suspend_count);
- }
-
-out:
- current_thread = saved_thread;
-}
-
-void
-thread_kill_command (char *args, int from_tty)
-{
- int mid;
- kern_return_t ret;
- int thread_count;
- thread_array_t thread_table;
- int index;
- mach_port_t thread_to_kill = MACH_PORT_NULL;
-
-
- MACH_ERROR_NO_INFERIOR;
-
- if (!args)
- error_no_arg ("thread mid to kill from the inferior task");
-
- mid = parse_thread_id (args, 0, 0);
-
- if (mid < 0)
- error ("You can kill only existing kernel threads with MID or @SLOTNUMBER");
-
- if (mid)
- {
- ret = machid_mach_port (mid_server, mid_auth, mid, &thread_to_kill);
- CHK ("thread_kill_command: machid_mach_port map failed", ret);
- }
- else
- mid = map_port_name_to_mid (current_thread, MACH_TYPE_THREAD);
-
- /* Don't allow gdb to kill *any* thread in the system. Use mkill program for that */
- ret = task_threads (inferior_task, &thread_table, &thread_count);
- CHK ("Error getting inferior's thread list", ret);
-
- if (thread_to_kill == current_thread)
- {
- ret = thread_terminate (thread_to_kill);
- CHK ("Thread could not be terminated", ret);
-
- if (select_thread (inferior_task, 0, 1) != KERN_SUCCESS)
- warning ("Last thread was killed, use \"kill\" command to kill task");
- }
- else
- for (index = 0; index < thread_count; index++)
- if (thread_table[index] == thread_to_kill)
- {
- ret = thread_terminate (thread_to_kill);
- CHK ("Thread could not be terminated", ret);
- }
-
- if (thread_count > 1)
- consume_send_rights (thread_table, thread_count);
-
- ret = vm_deallocate (mach_task_self (), (vm_address_t) thread_table,
- (thread_count * sizeof (mach_port_t)));
- CHK ("Error trying to deallocate thread list", ret);
-
- warning ("Thread %d killed", mid);
-}
-
-
-/* Task specific commands; add more if you like */
-
-void
-task_resume_command (char *args, int from_tty)
-{
- kern_return_t ret;
- task_basic_info_data_t ta_info;
- int infoCnt = TASK_BASIC_INFO_COUNT;
- int mid = map_port_name_to_mid (inferior_task, MACH_TYPE_TASK);
-
- MACH_ERROR_NO_INFERIOR;
-
- /* Would be trivial to change, but is it desirable? */
- if (args)
- error ("Currently gdb can resume only it's inferior task");
-
- ret = task_info (inferior_task,
- TASK_BASIC_INFO,
- (task_info_t) & ta_info,
- &infoCnt);
- CHK ("task_resume_command: task_info failed", ret);
-
- if (ta_info.suspend_count == 0)
- error ("Inferior task %d is not suspended", mid);
- else if (ta_info.suspend_count == 1 &&
- from_tty &&
- !query ("Suspend count is now 1. Do you know what you are doing? "))
- error ("Task not resumed");
-
- ret = task_resume (inferior_task);
- CHK ("task_resume_command: task_resume", ret);
-
- if (ta_info.suspend_count == 1)
- {
- warning ("Inferior task %d is no longer suspended", mid);
- must_suspend_thread = 1;
- /* @@ This is not complete: Registers change all the time when not
- suspended! */
- registers_changed ();
- }
- else
- warning ("Inferior task %d suspend count is now %d",
- mid, ta_info.suspend_count - 1);
-}
-
-
-void
-task_suspend_command (char *args, int from_tty)
-{
- kern_return_t ret;
- task_basic_info_data_t ta_info;
- int infoCnt = TASK_BASIC_INFO_COUNT;
- int mid = map_port_name_to_mid (inferior_task, MACH_TYPE_TASK);
-
- MACH_ERROR_NO_INFERIOR;
-
- /* Would be trivial to change, but is it desirable? */
- if (args)
- error ("Currently gdb can suspend only it's inferior task");
-
- ret = task_suspend (inferior_task);
- CHK ("task_suspend_command: task_suspend", ret);
-
- must_suspend_thread = 0;
-
- ret = task_info (inferior_task,
- TASK_BASIC_INFO,
- (task_info_t) & ta_info,
- &infoCnt);
- CHK ("task_suspend_command: task_info failed", ret);
-
- warning ("Inferior task %d suspend count is now %d",
- mid, ta_info.suspend_count);
-}
-
-static char *
-get_size (int bytes)
-{
- static char size[30];
- int zz = bytes / 1024;
-
- if (zz / 1024)
- sprintf (size, "%-2.1f M", ((float) bytes) / (1024.0 * 1024.0));
- else
- sprintf (size, "%d K", zz);
-
- return size;
-}
-
-/* Does this require the target task to be suspended?? I don't think so. */
-void
-task_info_command (char *args, int from_tty)
-{
- int mid = -5;
- mach_port_t task;
- kern_return_t ret;
- task_basic_info_data_t ta_info;
- int infoCnt = TASK_BASIC_INFO_COUNT;
- int page_size = round_page (1);
- int thread_count = 0;
-
- if (MACH_PORT_VALID (inferior_task))
- mid = map_port_name_to_mid (inferior_task,
- MACH_TYPE_TASK);
-
- task = inferior_task;
-
- if (args)
- {
- int tmid = atoi (args);
-
- if (tmid <= 0)
- error ("Invalid mid %d for task info", tmid);
-
- if (tmid != mid)
- {
- mid = tmid;
- ret = machid_mach_port (mid_server, mid_auth, tmid, &task);
- CHK ("task_info_command: machid_mach_port map failed", ret);
- }
- }
-
- if (mid < 0)
- error ("You have to give the task MID as an argument");
-
- ret = task_info (task,
- TASK_BASIC_INFO,
- (task_info_t) & ta_info,
- &infoCnt);
- CHK ("task_info_command: task_info failed", ret);
-
- printf_filtered ("\nTask info for task %d:\n\n", mid);
- printf_filtered (" Suspend count : %d\n", ta_info.suspend_count);
- printf_filtered (" Base priority : %d\n", ta_info.base_priority);
- printf_filtered (" Virtual size : %s\n", get_size (ta_info.virtual_size));
- printf_filtered (" Resident size : %s\n", get_size (ta_info.resident_size));
-
- {
- thread_array_t thread_list;
-
- ret = task_threads (task, &thread_list, &thread_count);
- CHK ("task_info_command: task_threads", ret);
-
- printf_filtered (" Thread count : %d\n", thread_count);
-
- consume_send_rights (thread_list, thread_count);
- ret = vm_deallocate (mach_task_self (),
- (vm_address_t) thread_list,
- (thread_count * sizeof (int)));
- CHK ("Error trying to deallocate thread list", ret);
- }
- if (have_emulator_p (task))
- printf_filtered (" Emulator at : 0x%x..0x%x\n",
- EMULATOR_BASE, EMULATOR_END);
- else
- printf_filtered (" No emulator.\n");
-
- if (thread_count && task == inferior_task)
- printf_filtered ("\nUse the \"thread list\" command to see the threads\n");
-}
-
-/* You may either FORWARD the exception to the inferior, or KEEP
- * it and return to GDB command level.
- *
- * exception mid [ forward | keep ]
- */
-
-static void
-exception_command (char *args, int from_tty)
-{
- char *scan = args;
- int exception;
- int len;
-
- if (!args)
- error_no_arg ("exception number action");
-
- while (*scan == ' ' || *scan == '\t')
- scan++;
-
- if ('0' <= *scan && *scan <= '9')
- while ('0' <= *scan && *scan <= '9')
- scan++;
- else
- error ("exception number action");
-
- exception = atoi (args);
- if (exception <= 0 || exception > MAX_EXCEPTION)
- error ("Allowed exception numbers are in range 1..%d",
- MAX_EXCEPTION);
-
- if (*scan != ' ' && *scan != '\t')
- error ("exception number must be followed by a space");
- else
- while (*scan == ' ' || *scan == '\t')
- scan++;
-
- args = scan;
- len = 0;
- while (*scan)
- {
- len++;
- scan++;
- }
-
- if (!len)
- error ("exception number action");
-
- if (!strncasecmp (args, "forward", len))
- exception_map[exception].forward = TRUE;
- else if (!strncasecmp (args, "keep", len))
- exception_map[exception].forward = FALSE;
- else
- error ("exception action is either \"keep\" or \"forward\"");
-}
-
-static void
-print_exception_info (int exception)
-{
- boolean_t forward = exception_map[exception].forward;
-
- printf_filtered ("%s\t(%d): ", exception_map[exception].name,
- exception);
- if (!forward)
- if (exception_map[exception].sigmap != SIG_UNKNOWN)
- printf_filtered ("keep and handle as signal %d\n",
- exception_map[exception].sigmap);
- else
- printf_filtered ("keep and handle as unknown signal %d\n",
- exception_map[exception].sigmap);
- else
- printf_filtered ("forward exception to inferior\n");
-}
-
-void
-exception_info (char *args, int from_tty)
-{
- int exception;
-
- if (!args)
- for (exception = 1; exception <= MAX_EXCEPTION; exception++)
- print_exception_info (exception);
- else
- {
- exception = atoi (args);
-
- if (exception <= 0 || exception > MAX_EXCEPTION)
- error ("Invalid exception number, values from 1 to %d allowed",
- MAX_EXCEPTION);
- print_exception_info (exception);
- }
-}
-
-/* Check for actions for mach exceptions.
- */
-mach3_exception_actions (WAITTYPE *w, boolean_t force_print_only, char *who)
-{
- boolean_t force_print = FALSE;
-
-
- if (force_print_only ||
- exception_map[stop_exception].sigmap == SIG_UNKNOWN)
- force_print = TRUE;
- else
- WSETSTOP (*w, exception_map[stop_exception].sigmap);
-
- if (exception_map[stop_exception].print || force_print)
- {
- target_terminal_ours ();
-
- printf_filtered ("\n%s received %s exception : ",
- who,
- exception_map[stop_exception].name);
-
- wrap_here (" ");
-
- switch (stop_exception)
- {
- case EXC_BAD_ACCESS:
- printf_filtered ("referencing address 0x%x : %s\n",
- stop_subcode,
- mach_error_string (stop_code));
- break;
- case EXC_BAD_INSTRUCTION:
- printf_filtered
- ("illegal or undefined instruction. code %d subcode %d\n",
- stop_code, stop_subcode);
- break;
- case EXC_ARITHMETIC:
- printf_filtered ("code %d\n", stop_code);
- break;
- case EXC_EMULATION:
- printf_filtered ("code %d subcode %d\n", stop_code, stop_subcode);
- break;
- case EXC_SOFTWARE:
- printf_filtered ("%s specific, code 0x%x\n",
- stop_code < 0xffff ? "hardware" : "os emulation",
- stop_code);
- break;
- case EXC_BREAKPOINT:
- printf_filtered ("type %d (machine dependent)\n",
- stop_code);
- break;
- default:
- internal_error (__FILE__, __LINE__,
- "Unknown exception");
- }
- }
-}
-
-setup_notify_port (int create_new)
-{
- kern_return_t ret;
-
- if (MACH_PORT_VALID (our_notify_port))
- {
- ret = mach_port_destroy (mach_task_self (), our_notify_port);
- CHK ("Could not destroy our_notify_port", ret);
- }
-
- our_notify_port = MACH_PORT_NULL;
- notify_chain = (port_chain_t) NULL;
- port_chain_destroy (port_chain_obstack);
-
- if (create_new)
- {
- ret = mach_port_allocate (mach_task_self (),
- MACH_PORT_RIGHT_RECEIVE,
- &our_notify_port);
- if (ret != KERN_SUCCESS)
- internal_error (__FILE__, __LINE__,
- "Creating notify port %s", mach_error_string (ret));
-
- ret = mach_port_move_member (mach_task_self (),
- our_notify_port,
- inferior_wait_port_set);
- if (ret != KERN_SUCCESS)
- internal_error (__FILE__, __LINE__,
- "initial move member %s", mach_error_string (ret));
- }
-}
-
-/*
- * Register our message port to the net name server
- *
- * Currently used only by the external stop-gdb program
- * since ^C does not work if you would like to enter
- * gdb command level while debugging your program.
- *
- * NOTE: If the message port is sometimes used for other
- * purposes also, the NAME must not be a guessable one.
- * Then, there should be a way to change it.
- */
-
-char registered_name[MAX_NAME_LEN];
-
-void
-message_port_info (char *args, int from_tty)
-{
- if (registered_name[0])
- printf_filtered ("gdb's message port name: '%s'\n",
- registered_name);
- else
- printf_filtered ("gdb's message port is not currently registered\n");
-}
-
-void
-gdb_register_port (char *name, mach_port_t port)
-{
- kern_return_t ret;
- static int already_signed = 0;
- int len;
-
- if (!MACH_PORT_VALID (port) || !name || !*name)
- {
- warning ("Invalid registration request");
- return;
- }
-
- if (!already_signed)
- {
- ret = mach_port_insert_right (mach_task_self (),
- our_message_port,
- our_message_port,
- MACH_MSG_TYPE_MAKE_SEND);
- CHK ("Failed to create a signature to our_message_port", ret);
- already_signed = 1;
- }
- else if (already_signed > 1)
- {
- ret = netname_check_out (name_server_port,
- registered_name,
- our_message_port);
- CHK ("Failed to check out gdb's message port", ret);
- registered_name[0] = '\000';
- already_signed = 1;
- }
-
- ret = netname_check_in (name_server_port, /* Name server port */
- name, /* Name of service */
- our_message_port, /* Signature */
- port); /* Creates a new send right */
- CHK ("Failed to check in the port", ret);
-
- len = 0;
- while (len < MAX_NAME_LEN && *(name + len))
- {
- registered_name[len] = *(name + len);
- len++;
- }
- registered_name[len] = '\000';
- already_signed = 2;
-}
-
-struct cmd_list_element *cmd_thread_list;
-struct cmd_list_element *cmd_task_list;
-
-/*ARGSUSED */
-static void
-thread_command (char *arg, int from_tty)
-{
- printf_unfiltered ("\"thread\" must be followed by the name of a thread command.\n");
- help_list (cmd_thread_list, "thread ", -1, gdb_stdout);
-}
-
-/*ARGSUSED */
-static void
-task_command (char *arg, int from_tty)
-{
- printf_unfiltered ("\"task\" must be followed by the name of a task command.\n");
- help_list (cmd_task_list, "task ", -1, gdb_stdout);
-}
-
-add_mach_specific_commands (void)
-{
- /* Thread handling commands */
-
- /* FIXME: Move our thread support into the generic thread.c stuff so we
- can share that code. */
- add_prefix_cmd ("mthread", class_stack, thread_command,
- "Generic command for handling Mach threads in the debugged task.",
- &cmd_thread_list, "thread ", 0, &cmdlist);
-
- add_com_alias ("th", "mthread", class_stack, 1);
-
- add_cmd ("select", class_stack, thread_select_command,
- "Select and print MID of the selected thread",
- &cmd_thread_list);
- add_cmd ("list", class_stack, thread_list_command,
- "List info of task's threads. Selected thread is marked with '*'",
- &cmd_thread_list);
- add_cmd ("suspend", class_run, thread_suspend_command,
- "Suspend one or all of the threads in the selected task.",
- &cmd_thread_list);
- add_cmd ("resume", class_run, thread_resume_command,
- "Resume one or all of the threads in the selected task.",
- &cmd_thread_list);
- add_cmd ("kill", class_run, thread_kill_command,
- "Kill the specified thread MID from inferior task.",
- &cmd_thread_list);
-#if 0
- /* The rest of this support (condition_thread) was not merged. It probably
- should not be merged in this form, but instead added to the generic GDB
- thread support. */
- add_cmd ("break", class_breakpoint, condition_thread,
- "Breakpoint N will only be effective for thread MID or @SLOT\n\
- If MID/@SLOT is omitted allow all threads to break at breakpoint",
- &cmd_thread_list);
-#endif
- /* Thread command shorthands (for backward compatibility) */
- add_alias_cmd ("ts", "mthread select", 0, 0, &cmdlist);
- add_alias_cmd ("tl", "mthread list", 0, 0, &cmdlist);
-
- /* task handling commands */
-
- add_prefix_cmd ("task", class_stack, task_command,
- "Generic command for handling debugged task.",
- &cmd_task_list, "task ", 0, &cmdlist);
-
- add_com_alias ("ta", "task", class_stack, 1);
-
- add_cmd ("suspend", class_run, task_suspend_command,
- "Suspend the inferior task.",
- &cmd_task_list);
- add_cmd ("resume", class_run, task_resume_command,
- "Resume the inferior task.",
- &cmd_task_list);
- add_cmd ("info", no_class, task_info_command,
- "Print information about the specified task.",
- &cmd_task_list);
-
- /* Print my message port name */
-
- add_info ("message-port", message_port_info,
- "Returns the name of gdb's message port in the netnameserver");
-
- /* Exception commands */
-
- add_info ("exceptions", exception_info,
- "What debugger does when program gets various exceptions.\n\
-Specify an exception number as argument to print info on that\n\
-exception only.");
-
- add_com ("exception", class_run, exception_command,
- "Specify how to handle an exception.\n\
-Args are exception number followed by \"forward\" or \"keep\".\n\
-`Forward' means forward the exception to the program's normal exception\n\
-handler.\n\
-`Keep' means reenter debugger if this exception happens, and GDB maps\n\
-the exception to some signal (see info exception)\n\
-Normally \"keep\" is used to return to GDB on exception.");
-}
-
-kern_return_t
-do_mach_notify_dead_name (mach_port_t notify, mach_port_t name)
-{
- kern_return_t kr = KERN_SUCCESS;
-
- /* Find the thing that notified */
- port_chain_t element = port_chain_member (notify_chain, name);
-
- /* Take name of from unreceived dead name notification list */
- notify_chain = port_chain_delete (notify_chain, name);
-
- if (!element)
- error ("Received a dead name notify from unchained port (0x%x)", name);
-
- switch (element->type)
- {
-
- case MACH_TYPE_THREAD:
- target_terminal_ours_for_output ();
- if (name == current_thread)
- {
- printf_filtered ("\nCurrent thread %d died", element->mid);
- current_thread = MACH_PORT_NULL;
- }
- else
- printf_filtered ("\nThread %d died", element->mid);
-
- break;
-
- case MACH_TYPE_TASK:
- target_terminal_ours_for_output ();
- if (name != inferior_task)
- printf_filtered ("Task %d died, but it was not the selected task",
- element->mid);
- else
- {
- printf_filtered ("Current task %d died", element->mid);
-
- mach_port_destroy (mach_task_self (), name);
- inferior_task = MACH_PORT_NULL;
-
- if (notify_chain)
- warning ("There were still unreceived dead_name_notifications???");
-
- /* Destroy the old notifications */
- setup_notify_port (0);
-
- }
- break;
-
- default:
- error ("Unregistered dead_name 0x%x notification received. Type is %d, mid is 0x%x",
- name, element->type, element->mid);
- break;
- }
-
- return KERN_SUCCESS;
-}
-
-kern_return_t
-do_mach_notify_msg_accepted (mach_port_t notify, mach_port_t name)
-{
- warning ("do_mach_notify_msg_accepted : notify %x, name %x",
- notify, name);
- return KERN_SUCCESS;
-}
-
-kern_return_t
-do_mach_notify_no_senders (mach_port_t notify, mach_port_mscount_t mscount)
-{
- warning ("do_mach_notify_no_senders : notify %x, mscount %x",
- notify, mscount);
- return KERN_SUCCESS;
-}
-
-kern_return_t
-do_mach_notify_port_deleted (mach_port_t notify, mach_port_t name)
-{
- warning ("do_mach_notify_port_deleted : notify %x, name %x",
- notify, name);
- return KERN_SUCCESS;
-}
-
-kern_return_t
-do_mach_notify_port_destroyed (mach_port_t notify, mach_port_t rights)
-{
- warning ("do_mach_notify_port_destroyed : notify %x, rights %x",
- notify, rights);
- return KERN_SUCCESS;
-}
-
-kern_return_t
-do_mach_notify_send_once (mach_port_t notify)
-{
-#ifdef DUMP_SYSCALL
- /* MANY of these are generated. */
- warning ("do_mach_notify_send_once : notify %x",
- notify);
-#endif
- return KERN_SUCCESS;
-}
-
-/* Kills the inferior. It's gone when you call this */
-static void
-kill_inferior_fast (void)
-{
- WAITTYPE w;
-
- if (PIDGET (inferior_ptid) == 0 || PIDGET (inferior_ptid) == 1)
- return;
-
- /* kill() it, since the Unix server does not otherwise notice when
- * killed with task_terminate().
- */
- if (PIDGET (inferior_ptid) > 0)
- kill (PIDGET (inferior_ptid), SIGKILL);
-
- /* It's propably terminate already */
- (void) task_terminate (inferior_task);
-
- inferior_task = MACH_PORT_NULL;
- current_thread = MACH_PORT_NULL;
-
- wait3 (&w, WNOHANG, 0);
-
- setup_notify_port (0);
-}
-
-static void
-m3_kill_inferior (void)
-{
- kill_inferior_fast ();
- target_mourn_inferior ();
-}
-
-/* Clean up after the inferior dies. */
-
-static void
-m3_mourn_inferior (void)
-{
- unpush_target (&m3_ops);
- generic_mourn_inferior ();
-}
-
-
-/* Fork an inferior process, and start debugging it. */
-
-static void
-m3_create_inferior (char *exec_file, char *allargs, char **env)
-{
- fork_inferior (exec_file, allargs, env, m3_trace_me, m3_trace_him, NULL, NULL);
- /* We are at the first instruction we care about. */
- /* Pedal to the metal... */
- proceed ((CORE_ADDR) -1, 0, 0);
-}
-
-/* Mark our target-struct as eligible for stray "run" and "attach"
- commands. */
-static int
-m3_can_run (void)
-{
- return 1;
-}
-
-/* Mach 3.0 does not need ptrace for anything
- * Make sure nobody uses it on mach.
- */
-ptrace (int a, int b, int c, int d)
-{
- error ("Lose, Lose! Somebody called ptrace\n");
-}
-
-/* Resume execution of the inferior process.
- If STEP is nonzero, single-step it.
- If SIGNAL is nonzero, give it that signal. */
-
-void
-m3_resume (ptid_t ptid, int step, enum target_signal signal)
-{
- kern_return_t ret;
-
- if (step)
- {
- thread_basic_info_data_t th_info;
- unsigned int infoCnt = THREAD_BASIC_INFO_COUNT;
-
- /* There is no point in single stepping when current_thread
- * is dead.
- */
- if (!MACH_PORT_VALID (current_thread))
- error ("No thread selected; can not single step");
-
- /* If current_thread is suspended, tracing it would never return.
- */
- ret = thread_info (current_thread,
- THREAD_BASIC_INFO,
- (thread_info_t) & th_info,
- &infoCnt);
- CHK ("child_resume: can't get thread info", ret);
-
- if (th_info.suspend_count)
- error ("Can't trace a suspended thread. Use \"thread resume\" command to resume it");
- }
-
- vm_read_cache_valid = FALSE;
-
- if (signal && PIDGET (inferior_ptid) > 0) /* Do not signal, if attached by MID */
- kill (PIDGET (inferior_ptid), target_signal_to_host (signal));
-
- if (step)
- {
- suspend_all_threads (0);
-
- setup_single_step (current_thread, TRUE);
-
- ret = thread_resume (current_thread);
- CHK ("thread_resume", ret);
- }
-
- ret = task_resume (inferior_task);
- if (ret == KERN_FAILURE)
- warning ("Task was not suspended");
- else
- CHK ("Resuming task", ret);
-
- /* HACK HACK This is needed by the multiserver system HACK HACK */
- while ((ret = task_resume (inferior_task)) == KERN_SUCCESS)
- /* make sure it really runs */ ;
- /* HACK HACK This is needed by the multiserver system HACK HACK */
-}
-
-#ifdef ATTACH_DETACH
-
-/* Start debugging the process with the given task */
-void
-task_attach (task_t tid)
-{
- kern_return_t ret;
- inferior_task = tid;
-
- ret = task_suspend (inferior_task);
- CHK ("task_attach: task_suspend", ret);
-
- must_suspend_thread = 0;
-
- setup_notify_port (1);
-
- request_notify (inferior_task, MACH_NOTIFY_DEAD_NAME, MACH_TYPE_TASK);
-
- setup_exception_port ();
-
- emulator_present = have_emulator_p (inferior_task);
-
- attach_flag = 1;
-}
-
-/* Well, we can call error also here and leave the
- * target stack inconsistent. Sigh.
- * Fix this sometime (the only way to fail here is that
- * the task has no threads at all, which is rare, but
- * possible; or if the target task has died, which is also
- * possible, but unlikely, since it has been suspended.
- * (Someone must have killed it))
- */
-void
-attach_to_thread (void)
-{
- if (select_thread (inferior_task, 0, 1) != KERN_SUCCESS)
- error ("Could not select any threads to attach to");
-}
-
-mid_attach (int mid)
-{
- kern_return_t ret;
-
- ret = machid_mach_port (mid_server, mid_auth, mid, &inferior_task);
- CHK ("mid_attach: machid_mach_port", ret);
-
- task_attach (inferior_task);
-
- return mid;
-}
-
-/*
- * Start debugging the process whose unix process-id is PID.
- * A negative "pid" value is legal and signifies a mach_id not a unix pid.
- *
- * Prevent (possible unwanted) dangerous operations by enabled users
- * like "atta 0" or "atta foo" (equal to the previous :-) and
- * "atta pidself". Anyway, the latter is allowed by specifying a MID.
- */
-static int
-m3_do_attach (int pid)
-{
- kern_return_t ret;
-
- if (pid == 0)
- error ("MID=0, Debugging the master unix server does not compute");
-
- /* Foo. This assumes gdb has a unix pid */
- if (pid == getpid ())
- error ("I will debug myself only by mid. (Gdb would suspend itself!)");
-
- if (pid < 0)
- {
- mid_attach (-(pid));
-
- /* inferior_ptid will be NEGATIVE! */
- inferior_ptid = pid_to_ptid (pid);
-
- return PIDGET (inferior_ptid);
- }
-
- inferior_task = task_by_pid (pid);
- if (!MACH_PORT_VALID (inferior_task))
- error ("Cannot map Unix pid %d to Mach task port", pid);
-
- task_attach (inferior_task);
-
- inferior_ptid = pid_to_ptid (pid);
-
- return PIDGET (inferior_ptid);
-}
-
-/* Attach to process PID, then initialize for debugging it
- and wait for the trace-trap that results from attaching. */
-
-static void
-m3_attach (char *args, int from_tty)
-{
- char *exec_file;
- int pid;
-
- if (!args)
- error_no_arg ("process-id to attach");
-
- pid = atoi (args);
-
- if (pid == getpid ()) /* Trying to masturbate? */
- error ("I refuse to debug myself!");
-
- if (from_tty)
- {
- exec_file = (char *) get_exec_file (0);
-
- if (exec_file)
- printf_unfiltered ("Attaching to program `%s', %s\n", exec_file,
- target_pid_to_str (pid_to_ptid (pid)));
- else
- printf_unfiltered ("Attaching to %s\n",
- target_pid_to_str (pid_to_ptid (pid)));
-
- gdb_flush (gdb_stdout);
- }
-
- m3_do_attach (pid_to_ptid (pid));
- inferior_ptid = pid_to_ptid (pid);
- push_target (&m3_ops);
-}
-
-void
-deallocate_inferior_ports (void)
-{
- kern_return_t ret;
- thread_array_t thread_list;
- int thread_count, index;
-
- if (!MACH_PORT_VALID (inferior_task))
- return;
-
- ret = task_threads (inferior_task, &thread_list, &thread_count);
- if (ret != KERN_SUCCESS)
- {
- warning ("deallocate_inferior_ports: task_threads",
- mach_error_string (ret));
- return;
- }
-
- /* Get rid of send rights to task threads */
- for (index = 0; index < thread_count; index++)
- {
- int rights;
- ret = mach_port_get_refs (mach_task_self (),
- thread_list[index],
- MACH_PORT_RIGHT_SEND,
- &rights);
- CHK ("deallocate_inferior_ports: get refs", ret);
-
- if (rights > 0)
- {
- ret = mach_port_mod_refs (mach_task_self (),
- thread_list[index],
- MACH_PORT_RIGHT_SEND,
- -rights);
- CHK ("deallocate_inferior_ports: mod refs", ret);
- }
- }
-
- ret = mach_port_mod_refs (mach_task_self (),
- inferior_exception_port,
- MACH_PORT_RIGHT_RECEIVE,
- -1);
- CHK ("deallocate_inferior_ports: cannot get rid of exception port", ret);
-
- ret = mach_port_deallocate (mach_task_self (),
- inferior_task);
- CHK ("deallocate_task_port: deallocating inferior_task", ret);
-
- current_thread = MACH_PORT_NULL;
- inferior_task = MACH_PORT_NULL;
-}
-
-/* Stop debugging the process whose number is PID
- and continue it with signal number SIGNAL.
- SIGNAL = 0 means just continue it. */
-
-static void
-m3_do_detach (int signal)
-{
- kern_return_t ret;
-
- MACH_ERROR_NO_INFERIOR;
-
- if (current_thread != MACH_PORT_NULL)
- {
- /* Store the gdb's view of the thread we are deselecting
- * before we detach.
- * @@ I am really not sure if this is ever needeed.
- */
- target_prepare_to_store ();
- target_store_registers (-1);
- }
-
- ret = task_set_special_port (inferior_task,
- TASK_EXCEPTION_PORT,
- inferior_old_exception_port);
- CHK ("task_set_special_port", ret);
-
- /* Discard all requested notifications */
- setup_notify_port (0);
-
- if (remove_breakpoints ())
- warning ("Could not remove breakpoints when detaching");
-
- if (signal && PIDGET (inferior_ptid) > 0)
- kill (PIDGET (inferior_ptid), signal);
-
- /* the task might be dead by now */
- (void) task_resume (inferior_task);
-
- deallocate_inferior_ports ();
-
- attach_flag = 0;
-}
-
-/* Take a program previously attached to and detaches it.
- The program resumes execution and will no longer stop
- on signals, etc. We'd better not have left any breakpoints
- in the program or it'll die when it hits one. For this
- to work, it may be necessary for the process to have been
- previously attached. It *might* work if the program was
- started via fork. */
-
-static void
-m3_detach (char *args, int from_tty)
-{
- int siggnal = 0;
-
- if (from_tty)
- {
- char *exec_file = get_exec_file (0);
- if (exec_file == 0)
- exec_file = "";
- printf_unfiltered ("Detaching from program: %s %s\n",
- exec_file, target_pid_to_str (inferior_ptid));
- gdb_flush (gdb_stdout);
- }
- if (args)
- siggnal = atoi (args);
-
- m3_do_detach (siggnal);
- inferior_ptid = null_ptid;
- unpush_target (&m3_ops); /* Pop out of handling an inferior */
-}
-#endif /* ATTACH_DETACH */
-
-/* Get ready to modify the registers array. On machines which store
- individual registers, this doesn't need to do anything. On machines
- which store all the registers in one fell swoop, this makes sure
- that registers contains all the registers from the program being
- debugged. */
-
-static void
-m3_prepare_to_store (void)
-{
-#ifdef CHILD_PREPARE_TO_STORE
- CHILD_PREPARE_TO_STORE ();
-#endif
-}
-
-/* Print status information about what we're accessing. */
-
-static void
-m3_files_info (struct target_ops *ignore)
-{
- /* FIXME: should print MID and all that crap. */
- printf_unfiltered ("\tUsing the running image of %s %s.\n",
- attach_flag ? "attached" : "child", target_pid_to_str (inferior_ptid));
-}
-
-static void
-m3_open (char *arg, int from_tty)
-{
- error ("Use the \"run\" command to start a Unix child process.");
-}
-
-#ifdef DUMP_SYSCALL
-#define STR(x) #x
-
-char *bsd1_names[] =
-{
- "execve",
- "fork",
- "take_signal",
- "sigreturn",
- "getrusage",
- "chdir",
- "chroot",
- "open",
- "creat",
- "mknod",
- "link",
- "symlink",
- "unlink",
- "access",
- "stat",
- "readlink",
- "chmod",
- "chown",
- "utimes",
- "truncate",
- "rename",
- "mkdir",
- "rmdir",
- "xutimes",
- "mount",
- "umount",
- "acct",
- "setquota",
- "write_short",
- "write_long",
- "send_short",
- "send_long",
- "sendto_short",
- "sendto_long",
- "select",
- "task_by_pid",
- "recvfrom_short",
- "recvfrom_long",
- "setgroups",
- "setrlimit",
- "sigvec",
- "sigstack",
- "settimeofday",
- "adjtime",
- "setitimer",
- "sethostname",
- "bind",
- "accept",
- "connect",
- "setsockopt",
- "getsockopt",
- "getsockname",
- "getpeername",
- "init_process",
- "table_set",
- "table_get",
- "pioctl",
- "emulator_error",
- "readwrite",
- "share_wakeup",
- 0,
- "maprw_request_it",
- "maprw_release_it",
- "maprw_remap",
- "pid_by_task",
-};
-
-int bsd1_nnames = sizeof (bsd1_names) / sizeof (bsd1_names[0]);
-
-char *
-name_str (int name, char *buf)
-{
- switch (name)
- {
- case MACH_MSG_TYPE_BOOLEAN:
- return "boolean";
- case MACH_MSG_TYPE_INTEGER_16:
- return "short";
- case MACH_MSG_TYPE_INTEGER_32:
- return "long";
- case MACH_MSG_TYPE_CHAR:
- return "char";
- case MACH_MSG_TYPE_BYTE:
- return "byte";
- case MACH_MSG_TYPE_REAL:
- return "real";
- case MACH_MSG_TYPE_STRING:
- return "string";
- default:
- sprintf (buf, "%d", name);
- return buf;
- }
-}
-
-char *
-id_str (int id, char *buf)
-{
- char *p;
- if (id >= 101000 && id < 101000 + bsd1_nnames)
- {
- if (p = bsd1_names[id - 101000])
- return p;
- }
- if (id == 102000)
- return "psignal_retry";
- if (id == 100000)
- return "syscall";
- sprintf (buf, "%d", id);
- return buf;
-}
-
-print_msg (mach_msg_header_t *mp)
-{
- char *fmt_x = "%20s : 0x%08x\n";
- char *fmt_d = "%20s : %10d\n";
- char *fmt_s = "%20s : %s\n";
- char buf[100];
-
- puts_filtered ("\n");
-#define pr(fmt,h,x) printf_filtered(fmt,STR(x),(h).x)
- pr (fmt_x, (*mp), msgh_bits);
- pr (fmt_d, (*mp), msgh_size);
- pr (fmt_x, (*mp), msgh_remote_port);
- pr (fmt_x, (*mp), msgh_local_port);
- pr (fmt_d, (*mp), msgh_kind);
- printf_filtered (fmt_s, STR (msgh_id), id_str (mp->msgh_id, buf));
-
- if (debug_level > 1)
- {
- char *p, *ep, *dp;
- int plen;
- p = (char *) mp;
- ep = p + mp->msgh_size;
- p += sizeof (*mp);
- for (; p < ep; p += plen)
- {
- mach_msg_type_t *tp;
- mach_msg_type_long_t *tlp;
- int name, size, number;
- tp = (mach_msg_type_t *) p;
- if (tp->msgt_longform)
- {
- tlp = (mach_msg_type_long_t *) tp;
- name = tlp->msgtl_name;
- size = tlp->msgtl_size;
- number = tlp->msgtl_number;
- plen = sizeof (*tlp);
- }
- else
- {
- name = tp->msgt_name;
- size = tp->msgt_size;
- number = tp->msgt_number;
- plen = sizeof (*tp);
- }
- printf_filtered ("name=%-16s size=%2d number=%7d inline=%d long=%d deal=%d\n",
- name_str (name, buf), size, number, tp->msgt_inline,
- tp->msgt_longform, tp->msgt_deallocate);
- dp = p + plen;
- if (tp->msgt_inline)
- {
- int l;
- l = size * number / 8;
- l = (l + sizeof (long) - 1) & ~((sizeof (long)) - 1);
- plen += l;
- print_data (dp, size, number);
- }
- else
- {
- plen += sizeof (int *);
- }
- printf_filtered ("plen=%d\n", plen);
- }
- }
-}
-
-print_data (char *p, int size, int number)
-{
- int *ip;
- short *sp;
- int i;
-
- switch (size)
- {
- case 8:
- for (i = 0; i < number; i++)
- {
- printf_filtered (" %02x", p[i]);
- }
- break;
- case 16:
- sp = (short *) p;
- for (i = 0; i < number; i++)
- {
- printf_filtered (" %04x", sp[i]);
- }
- break;
- case 32:
- ip = (int *) p;
- for (i = 0; i < number; i++)
- {
- printf_filtered (" %08x", ip[i]);
- }
- break;
- }
- puts_filtered ("\n");
-}
-#endif /* DUMP_SYSCALL */
-
-static void
-m3_stop (void)
-{
- error ("to_stop target function not implemented");
-}
-
-static char *
-m3_pid_to_exec_file (int pid)
-{
- error ("to_pid_to_exec_file target function not implemented");
- return NULL; /* To keep all compilers happy. */
-}
-
-static void
-init_m3_ops (void)
-{
- m3_ops.to_shortname = "mach";
- m3_ops.to_longname = "Mach child process";
- m3_ops.to_doc = "Mach child process (started by the \"run\" command).";
- m3_ops.to_open = m3_open;
- m3_ops.to_attach = m3_attach;
- m3_ops.to_detach = m3_detach;
- m3_ops.to_resume = m3_resume;
- m3_ops.to_wait = mach_really_wait;
- m3_ops.to_fetch_registers = fetch_inferior_registers;
- m3_ops.to_store_registers = store_inferior_registers;
- m3_ops.to_prepare_to_store = m3_prepare_to_store;
- m3_ops.to_xfer_memory = m3_xfer_memory;
- m3_ops.to_files_info = m3_files_info;
- m3_ops.to_insert_breakpoint = memory_insert_breakpoint;
- m3_ops.to_remove_breakpoint = memory_remove_breakpoint;
- m3_ops.to_terminal_init = terminal_init_inferior;
- m3_ops.to_terminal_inferior = terminal_inferior;
- m3_ops.to_terminal_ours_for_output = terminal_ours_for_output;
- m3_ops.to_terminal_save_ours = terminal_save_ours;
- m3_ops.to_terminal_ours = terminal_ours;
- m3_ops.to_terminal_info = child_terminal_info;
- m3_ops.to_kill = m3_kill_inferior;
- m3_ops.to_create_inferior = m3_create_inferior;
- m3_ops.to_mourn_inferior = m3_mourn_inferior;
- m3_ops.to_can_run = m3_can_run;
- m3_ops.to_stop = m3_stop;
- m3_ops.to_pid_to_exec_file = m3_pid_to_exec_file;
- m3_ops.to_stratum = process_stratum;
- m3_ops.to_has_all_memory = 1;
- m3_ops.to_has_memory = 1;
- m3_ops.to_has_stack = 1;
- m3_ops.to_has_registers = 1;
- m3_ops.to_has_execution = 1;
- m3_ops.to_magic = OPS_MAGIC;
-}
-
-void
-_initialize_m3_nat (void)
-{
- kern_return_t ret;
-
- init_m3_ops ();
- add_target (&m3_ops);
-
- ret = mach_port_allocate (mach_task_self (),
- MACH_PORT_RIGHT_PORT_SET,
- &inferior_wait_port_set);
- if (ret != KERN_SUCCESS)
- internal_error (__FILE__, __LINE__,
- "initial port set %s", mach_error_string (ret));
-
- /* mach_really_wait now waits for this */
- currently_waiting_for = inferior_wait_port_set;
-
- ret = netname_look_up (name_server_port, hostname, "MachID", &mid_server);
- if (ret != KERN_SUCCESS)
- {
- mid_server = MACH_PORT_NULL;
-
- warning ("initialize machid: netname_lookup_up(MachID) : %s",
- mach_error_string (ret));
- warning ("Some (most?) features disabled...");
- }
-
- mid_auth = mach_privileged_host_port ();
- if (mid_auth == MACH_PORT_NULL)
- mid_auth = mach_task_self ();
-
- obstack_init (port_chain_obstack);
-
- ret = mach_port_allocate (mach_task_self (),
- MACH_PORT_RIGHT_RECEIVE,
- &thread_exception_port);
- CHK ("Creating thread_exception_port for single stepping", ret);
-
- ret = mach_port_insert_right (mach_task_self (),
- thread_exception_port,
- thread_exception_port,
- MACH_MSG_TYPE_MAKE_SEND);
- CHK ("Inserting send right to thread_exception_port", ret);
-
- /* Allocate message port */
- ret = mach_port_allocate (mach_task_self (),
- MACH_PORT_RIGHT_RECEIVE,
- &our_message_port);
- if (ret != KERN_SUCCESS)
- warning ("Creating message port %s", mach_error_string (ret));
- else
- {
- char buf[MAX_NAME_LEN];
- ret = mach_port_move_member (mach_task_self (),
- our_message_port,
- inferior_wait_port_set);
- if (ret != KERN_SUCCESS)
- warning ("message move member %s", mach_error_string (ret));
-
-
- /* @@@@ No way to change message port name currently */
- /* Foo. This assumes gdb has a unix pid */
- sprintf (buf, "gdb-%d", getpid ());
- gdb_register_port (buf, our_message_port);
- }
-
- /* Heap for thread commands */
- obstack_init (cproc_obstack);
-
- add_mach_specific_commands ();
-}
+// OBSOLETE /* Interface GDB to Mach 3.0 operating systems.
+// OBSOLETE (Most) Mach 3.0 related routines live in this file.
+// OBSOLETE
+// OBSOLETE Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
+// OBSOLETE 2002 Free Software Foundation, Inc.
+// OBSOLETE
+// OBSOLETE This file is part of GDB.
+// OBSOLETE
+// OBSOLETE This program is free software; you can redistribute it and/or modify
+// OBSOLETE it under the terms of the GNU General Public License as published by
+// OBSOLETE the Free Software Foundation; either version 2 of the License, or
+// OBSOLETE (at your option) any later version.
+// OBSOLETE
+// OBSOLETE This program is distributed in the hope that it will be useful,
+// OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of
+// OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// OBSOLETE GNU General Public License for more details.
+// OBSOLETE
+// OBSOLETE You should have received a copy of the GNU General Public License
+// OBSOLETE along with this program; if not, write to the Free Software
+// OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330,
+// OBSOLETE Boston, MA 02111-1307, USA. */
+// OBSOLETE
+// OBSOLETE /*
+// OBSOLETE * Author: Jukka Virtanen <jtv@hut.fi>
+// OBSOLETE * Computing Centre
+// OBSOLETE * Helsinki University of Technology
+// OBSOLETE * Finland
+// OBSOLETE *
+// OBSOLETE * Thanks to my friends who helped with ideas and testing:
+// OBSOLETE *
+// OBSOLETE * Johannes Helander, Antti Louko, Tero Mononen,
+// OBSOLETE * jvh@cs.hut.fi alo@hut.fi tmo@cs.hut.fi
+// OBSOLETE *
+// OBSOLETE * Tero Kivinen and Eamonn McManus
+// OBSOLETE * kivinen@cs.hut.fi emcmanus@gr.osf.org
+// OBSOLETE *
+// OBSOLETE */
+// OBSOLETE
+// OBSOLETE #include <stdio.h>
+// OBSOLETE
+// OBSOLETE #include <mach.h>
+// OBSOLETE #include <servers/netname.h>
+// OBSOLETE #include <servers/machid.h>
+// OBSOLETE #include <mach/message.h>
+// OBSOLETE #include <mach/notify.h>
+// OBSOLETE #include <mach_error.h>
+// OBSOLETE #include <mach/exception.h>
+// OBSOLETE #include <mach/vm_attributes.h>
+// OBSOLETE
+// OBSOLETE #include "defs.h"
+// OBSOLETE #include "inferior.h"
+// OBSOLETE #include "symtab.h"
+// OBSOLETE #include "value.h"
+// OBSOLETE #include "language.h"
+// OBSOLETE #include "target.h"
+// OBSOLETE #include "gdb_wait.h"
+// OBSOLETE #include "gdbcmd.h"
+// OBSOLETE #include "gdbcore.h"
+// OBSOLETE #include "regcache.h"
+// OBSOLETE
+// OBSOLETE #if 0
+// OBSOLETE #include <servers/machid_lib.h>
+// OBSOLETE #else
+// OBSOLETE #define MACH_TYPE_TASK 1
+// OBSOLETE #define MACH_TYPE_THREAD 2
+// OBSOLETE #endif
+// OBSOLETE
+// OBSOLETE /* Included only for signal names and NSIG
+// OBSOLETE
+// OBSOLETE * note: There are many problems in signal handling with
+// OBSOLETE * gdb in Mach 3.0 in general.
+// OBSOLETE */
+// OBSOLETE #include <signal.h>
+// OBSOLETE #define SIG_UNKNOWN 0 /* Exception that has no matching unix signal */
+// OBSOLETE
+// OBSOLETE #include <cthreads.h>
+// OBSOLETE
+// OBSOLETE /* This is what a cproc looks like. This is here partly because
+// OBSOLETE cthread_internals.h is not a header we can just #include, partly with
+// OBSOLETE an eye towards perhaps getting this to work with cross-debugging
+// OBSOLETE someday. Best solution is if CMU publishes a real interface to this
+// OBSOLETE stuff. */
+// OBSOLETE #define CPROC_NEXT_OFFSET 0
+// OBSOLETE #define CPROC_NEXT_SIZE (TARGET_PTR_BIT / HOST_CHAR_BIT)
+// OBSOLETE #define CPROC_INCARNATION_OFFSET (CPROC_NEXT_OFFSET + CPROC_NEXT_SIZE)
+// OBSOLETE #define CPROC_INCARNATION_SIZE (sizeof (cthread_t))
+// OBSOLETE #define CPROC_LIST_OFFSET (CPROC_INCARNATION_OFFSET + CPROC_INCARNATION_SIZE)
+// OBSOLETE #define CPROC_LIST_SIZE (TARGET_PTR_BIT / HOST_CHAR_BIT)
+// OBSOLETE #define CPROC_WAIT_OFFSET (CPROC_LIST_OFFSET + CPROC_LIST_SIZE)
+// OBSOLETE #define CPROC_WAIT_SIZE (TARGET_PTR_BIT / HOST_CHAR_BIT)
+// OBSOLETE #define CPROC_REPLY_OFFSET (CPROC_WAIT_OFFSET + CPROC_WAIT_SIZE)
+// OBSOLETE #define CPROC_REPLY_SIZE (sizeof (mach_port_t))
+// OBSOLETE #define CPROC_CONTEXT_OFFSET (CPROC_REPLY_OFFSET + CPROC_REPLY_SIZE)
+// OBSOLETE #define CPROC_CONTEXT_SIZE (TARGET_INT_BIT / HOST_CHAR_BIT)
+// OBSOLETE #define CPROC_LOCK_OFFSET (CPROC_CONTEXT_OFFSET + CPROC_CONTEXT_SIZE)
+// OBSOLETE #define CPROC_LOCK_SIZE (sizeof (spin_lock_t))
+// OBSOLETE #define CPROC_STATE_OFFSET (CPROC_LOCK_OFFSET + CPROC_LOCK_SIZE)
+// OBSOLETE #define CPROC_STATE_SIZE (TARGET_INT_BIT / HOST_CHAR_BIT)
+// OBSOLETE #define CPROC_WIRED_OFFSET (CPROC_STATE_OFFSET + CPROC_STATE_SIZE)
+// OBSOLETE #define CPROC_WIRED_SIZE (sizeof (mach_port_t))
+// OBSOLETE #define CPROC_BUSY_OFFSET (CPROC_WIRED_OFFSET + CPROC_WIRED_SIZE)
+// OBSOLETE #define CPROC_BUSY_SIZE (TARGET_INT_BIT / HOST_CHAR_BIT)
+// OBSOLETE #define CPROC_MSG_OFFSET (CPROC_BUSY_OFFSET + CPROC_BUSY_SIZE)
+// OBSOLETE #define CPROC_MSG_SIZE (sizeof (mach_msg_header_t))
+// OBSOLETE #define CPROC_BASE_OFFSET (CPROC_MSG_OFFSET + CPROC_MSG_SIZE)
+// OBSOLETE #define CPROC_BASE_SIZE (TARGET_INT_BIT / HOST_CHAR_BIT)
+// OBSOLETE #define CPROC_SIZE_OFFSET (CPROC_BASE_OFFSET + CPROC_BASE_SIZE)
+// OBSOLETE #define CPROC_SIZE_SIZE (TARGET_INT_BIT / HOST_CHAR_BIT)
+// OBSOLETE #define CPROC_SIZE (CPROC_SIZE_OFFSET + CPROC_SIZE_SIZE)
+// OBSOLETE
+// OBSOLETE /* Values for the state field in the cproc. */
+// OBSOLETE #define CPROC_RUNNING 0
+// OBSOLETE #define CPROC_SWITCHING 1
+// OBSOLETE #define CPROC_BLOCKED 2
+// OBSOLETE #define CPROC_CONDWAIT 4
+// OBSOLETE
+// OBSOLETE /* For cproc and kernel thread mapping */
+// OBSOLETE typedef struct gdb_thread
+// OBSOLETE {
+// OBSOLETE mach_port_t name;
+// OBSOLETE CORE_ADDR sp;
+// OBSOLETE CORE_ADDR pc;
+// OBSOLETE CORE_ADDR fp;
+// OBSOLETE boolean_t in_emulator;
+// OBSOLETE int slotid;
+// OBSOLETE
+// OBSOLETE /* This is for the mthreads list. It points to the cproc list.
+// OBSOLETE Perhaps the two lists should be merged (or perhaps it was a mistake
+// OBSOLETE to make them both use a struct gdb_thread). */
+// OBSOLETE struct gdb_thread *cproc;
+// OBSOLETE
+// OBSOLETE /* These are for the cproc list, which is linked through the next field
+// OBSOLETE of the struct gdb_thread. */
+// OBSOLETE char raw_cproc[CPROC_SIZE];
+// OBSOLETE /* The cthread which is pointed to by the incarnation field from the
+// OBSOLETE cproc. This points to the copy we've read into GDB. */
+// OBSOLETE cthread_t cthread;
+// OBSOLETE /* Point back to the mthreads list. */
+// OBSOLETE int reverse_map;
+// OBSOLETE struct gdb_thread *next;
+// OBSOLETE }
+// OBSOLETE *gdb_thread_t;
+// OBSOLETE
+// OBSOLETE /*
+// OBSOLETE * Actions for Mach exceptions.
+// OBSOLETE *
+// OBSOLETE * sigmap field maps the exception to corresponding Unix signal.
+// OBSOLETE *
+// OBSOLETE * I do not know how to map the exception to unix signal
+// OBSOLETE * if SIG_UNKNOWN is specified.
+// OBSOLETE */
+// OBSOLETE
+// OBSOLETE struct exception_list
+// OBSOLETE {
+// OBSOLETE char *name;
+// OBSOLETE boolean_t forward;
+// OBSOLETE boolean_t print;
+// OBSOLETE int sigmap;
+// OBSOLETE }
+// OBSOLETE exception_map[] =
+// OBSOLETE {
+// OBSOLETE {
+// OBSOLETE "not_mach3_exception", FALSE, TRUE, SIG_UNKNOWN
+// OBSOLETE }
+// OBSOLETE ,
+// OBSOLETE {
+// OBSOLETE "EXC_BAD_ACCESS", FALSE, TRUE, SIGSEGV
+// OBSOLETE }
+// OBSOLETE ,
+// OBSOLETE {
+// OBSOLETE "EXC_BAD_INSTRUCTION", FALSE, TRUE, SIGILL
+// OBSOLETE }
+// OBSOLETE ,
+// OBSOLETE {
+// OBSOLETE "EXC_ARITHMETIC", FALSE, TRUE, SIGFPE
+// OBSOLETE }
+// OBSOLETE ,
+// OBSOLETE {
+// OBSOLETE "EXC_EMULATION", FALSE, TRUE, SIGEMT
+// OBSOLETE }
+// OBSOLETE , /* ??? */
+// OBSOLETE {
+// OBSOLETE "EXC_SOFTWARE", FALSE, TRUE, SIG_UNKNOWN
+// OBSOLETE }
+// OBSOLETE ,
+// OBSOLETE {
+// OBSOLETE "EXC_BREAKPOINT", FALSE, FALSE, SIGTRAP
+// OBSOLETE }
+// OBSOLETE };
+// OBSOLETE
+// OBSOLETE /* Mach exception table size */
+// OBSOLETE int max_exception = sizeof (exception_map) / sizeof (struct exception_list) - 1;
+// OBSOLETE
+// OBSOLETE #define MAX_EXCEPTION max_exception
+// OBSOLETE
+// OBSOLETE WAITTYPE wait_status;
+// OBSOLETE
+// OBSOLETE /* If you define this, intercepted bsd server calls will be
+// OBSOLETE * dumped while waiting the inferior to EXEC the correct
+// OBSOLETE * program
+// OBSOLETE */
+// OBSOLETE /* #define DUMP_SYSCALL /* debugging interceptor */
+// OBSOLETE
+// OBSOLETE /* xx_debug() outputs messages if this is nonzero.
+// OBSOLETE * If > 1, DUMP_SYSCALL will dump message contents.
+// OBSOLETE */
+// OBSOLETE int debug_level = 0;
+// OBSOLETE
+// OBSOLETE /* "Temporary" debug stuff */
+// OBSOLETE void
+// OBSOLETE xx_debug (char *fmt, int a, int b, int c)
+// OBSOLETE {
+// OBSOLETE if (debug_level)
+// OBSOLETE warning (fmt, a, b, c);
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE /* This is in libmach.a */
+// OBSOLETE extern mach_port_t name_server_port;
+// OBSOLETE
+// OBSOLETE /* Set in catch_exception_raise */
+// OBSOLETE int stop_exception, stop_code, stop_subcode;
+// OBSOLETE int stopped_in_exception;
+// OBSOLETE
+// OBSOLETE /* Thread that was the active thread when we stopped */
+// OBSOLETE thread_t stop_thread = MACH_PORT_NULL;
+// OBSOLETE
+// OBSOLETE char *hostname = "";
+// OBSOLETE
+// OBSOLETE /* Set when task is attached or created */
+// OBSOLETE boolean_t emulator_present = FALSE;
+// OBSOLETE
+// OBSOLETE task_t inferior_task;
+// OBSOLETE thread_t current_thread;
+// OBSOLETE
+// OBSOLETE /* Exception ports for inferior task */
+// OBSOLETE mach_port_t inferior_exception_port = MACH_PORT_NULL;
+// OBSOLETE mach_port_t inferior_old_exception_port = MACH_PORT_NULL;
+// OBSOLETE
+// OBSOLETE /* task exceptions and notifications */
+// OBSOLETE mach_port_t inferior_wait_port_set = MACH_PORT_NULL;
+// OBSOLETE mach_port_t our_notify_port = MACH_PORT_NULL;
+// OBSOLETE
+// OBSOLETE /* This is "inferior_wait_port_set" when not single stepping, and
+// OBSOLETE * "singlestepped_thread_port" when we are single stepping.
+// OBSOLETE *
+// OBSOLETE * This is protected by a cleanup function: discard_single_step()
+// OBSOLETE */
+// OBSOLETE mach_port_t currently_waiting_for = MACH_PORT_NULL;
+// OBSOLETE
+// OBSOLETE /* A port for external messages to gdb.
+// OBSOLETE * External in the meaning that they do not come
+// OBSOLETE * from the inferior_task, but rather from external
+// OBSOLETE * tasks.
+// OBSOLETE *
+// OBSOLETE * As a debugging feature:
+// OBSOLETE * A debugger debugging another debugger can stop the
+// OBSOLETE * inferior debugger by the following command sequence
+// OBSOLETE * (without running external programs)
+// OBSOLETE *
+// OBSOLETE * (top-gdb) set stop_inferior_gdb ()
+// OBSOLETE * (top-gdb) continue
+// OBSOLETE */
+// OBSOLETE mach_port_t our_message_port = MACH_PORT_NULL;
+// OBSOLETE
+// OBSOLETE /* For single stepping */
+// OBSOLETE mach_port_t thread_exception_port = MACH_PORT_NULL;
+// OBSOLETE mach_port_t thread_saved_exception_port = MACH_PORT_NULL;
+// OBSOLETE mach_port_t singlestepped_thread_port = MACH_PORT_NULL;
+// OBSOLETE
+// OBSOLETE /* For machid calls */
+// OBSOLETE mach_port_t mid_server = MACH_PORT_NULL;
+// OBSOLETE mach_port_t mid_auth = MACH_PORT_NULL;
+// OBSOLETE
+// OBSOLETE /* If gdb thinks the inferior task is not suspended, it
+// OBSOLETE * must take suspend/abort the threads when it reads the state.
+// OBSOLETE */
+// OBSOLETE int must_suspend_thread = 0;
+// OBSOLETE
+// OBSOLETE /* When single stepping, we switch the port that mach_really_wait() listens to.
+// OBSOLETE * This cleanup is a guard to prevent the port set from being left to
+// OBSOLETE * the singlestepped_thread_port when error() is called.
+// OBSOLETE * This is nonzero only when we are single stepping.
+// OBSOLETE */
+// OBSOLETE #define NULL_CLEANUP (struct cleanup *)0
+// OBSOLETE struct cleanup *cleanup_step = NULL_CLEANUP;
+// OBSOLETE
+// OBSOLETE
+// OBSOLETE static struct target_ops m3_ops;
+// OBSOLETE
+// OBSOLETE static void m3_kill_inferior ();
+// OBSOLETE
+// OBSOLETE #if 0
+// OBSOLETE #define MACH_TYPE_EXCEPTION_PORT -1
+// OBSOLETE #endif
+// OBSOLETE
+// OBSOLETE /* Chain of ports to remember requested notifications. */
+// OBSOLETE
+// OBSOLETE struct port_chain
+// OBSOLETE {
+// OBSOLETE struct port_chain *next;
+// OBSOLETE mach_port_t port;
+// OBSOLETE int type;
+// OBSOLETE int mid; /* Now only valid with MACH_TYPE_THREAD and */
+// OBSOLETE /* MACH_TYPE_THREAD */
+// OBSOLETE };
+// OBSOLETE typedef struct port_chain *port_chain_t;
+// OBSOLETE
+// OBSOLETE /* Room for chain nodes comes from pchain_obstack */
+// OBSOLETE struct obstack pchain_obstack;
+// OBSOLETE struct obstack *port_chain_obstack = &pchain_obstack;
+// OBSOLETE
+// OBSOLETE /* For thread handling */
+// OBSOLETE struct obstack Cproc_obstack;
+// OBSOLETE struct obstack *cproc_obstack = &Cproc_obstack;
+// OBSOLETE
+// OBSOLETE /* the list of notified ports */
+// OBSOLETE port_chain_t notify_chain = (port_chain_t) NULL;
+// OBSOLETE
+// OBSOLETE port_chain_t
+// OBSOLETE port_chain_insert (port_chain_t list, mach_port_t name, int type)
+// OBSOLETE {
+// OBSOLETE kern_return_t ret;
+// OBSOLETE port_chain_t new;
+// OBSOLETE int mid;
+// OBSOLETE
+// OBSOLETE if (!MACH_PORT_VALID (name))
+// OBSOLETE return list;
+// OBSOLETE
+// OBSOLETE if (type == MACH_TYPE_TASK || type == MACH_TYPE_THREAD)
+// OBSOLETE {
+// OBSOLETE if (!MACH_PORT_VALID (mid_server))
+// OBSOLETE {
+// OBSOLETE warning ("Machid server port invalid, can not map port 0x%x to MID",
+// OBSOLETE name);
+// OBSOLETE mid = name;
+// OBSOLETE }
+// OBSOLETE else
+// OBSOLETE {
+// OBSOLETE ret = machid_mach_register (mid_server, mid_auth, name, type, &mid);
+// OBSOLETE
+// OBSOLETE if (ret != KERN_SUCCESS)
+// OBSOLETE {
+// OBSOLETE warning ("Can not map name (0x%x) to MID with machid", name);
+// OBSOLETE mid = name;
+// OBSOLETE }
+// OBSOLETE }
+// OBSOLETE }
+// OBSOLETE else
+// OBSOLETE internal_error (__FILE__, __LINE__, "failed internal consistency check");
+// OBSOLETE
+// OBSOLETE new = (port_chain_t) obstack_alloc (port_chain_obstack,
+// OBSOLETE sizeof (struct port_chain));
+// OBSOLETE new->next = list;
+// OBSOLETE new->port = name;
+// OBSOLETE new->type = type;
+// OBSOLETE new->mid = mid;
+// OBSOLETE
+// OBSOLETE return new;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE port_chain_t
+// OBSOLETE port_chain_delete (port_chain_t list, mach_port_t elem)
+// OBSOLETE {
+// OBSOLETE if (list)
+// OBSOLETE if (list->port == elem)
+// OBSOLETE list = list->next;
+// OBSOLETE else
+// OBSOLETE while (list->next)
+// OBSOLETE {
+// OBSOLETE if (list->next->port == elem)
+// OBSOLETE list->next = list->next->next; /* GCd with obstack_free() */
+// OBSOLETE else
+// OBSOLETE list = list->next;
+// OBSOLETE }
+// OBSOLETE return list;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE void
+// OBSOLETE port_chain_destroy (struct obstack *ostack)
+// OBSOLETE {
+// OBSOLETE obstack_free (ostack, 0);
+// OBSOLETE obstack_init (ostack);
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE port_chain_t
+// OBSOLETE port_chain_member (port_chain_t list, mach_port_t elem)
+// OBSOLETE {
+// OBSOLETE while (list)
+// OBSOLETE {
+// OBSOLETE if (list->port == elem)
+// OBSOLETE return list;
+// OBSOLETE list = list->next;
+// OBSOLETE }
+// OBSOLETE return (port_chain_t) NULL;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE int
+// OBSOLETE map_port_name_to_mid (mach_port_t name, int type)
+// OBSOLETE {
+// OBSOLETE port_chain_t elem;
+// OBSOLETE
+// OBSOLETE if (!MACH_PORT_VALID (name))
+// OBSOLETE return -1;
+// OBSOLETE
+// OBSOLETE elem = port_chain_member (notify_chain, name);
+// OBSOLETE
+// OBSOLETE if (elem && (elem->type == type))
+// OBSOLETE return elem->mid;
+// OBSOLETE
+// OBSOLETE if (elem)
+// OBSOLETE return -1;
+// OBSOLETE
+// OBSOLETE if (!MACH_PORT_VALID (mid_server))
+// OBSOLETE {
+// OBSOLETE warning ("Machid server port invalid, can not map port 0x%x to mid",
+// OBSOLETE name);
+// OBSOLETE return -1;
+// OBSOLETE }
+// OBSOLETE else
+// OBSOLETE {
+// OBSOLETE int mid;
+// OBSOLETE kern_return_t ret;
+// OBSOLETE
+// OBSOLETE ret = machid_mach_register (mid_server, mid_auth, name, type, &mid);
+// OBSOLETE
+// OBSOLETE if (ret != KERN_SUCCESS)
+// OBSOLETE {
+// OBSOLETE warning ("Can not map name (0x%x) to mid with machid", name);
+// OBSOLETE return -1;
+// OBSOLETE }
+// OBSOLETE return mid;
+// OBSOLETE }
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE /* Guard for currently_waiting_for and singlestepped_thread_port */
+// OBSOLETE static void
+// OBSOLETE discard_single_step (thread_t thread)
+// OBSOLETE {
+// OBSOLETE currently_waiting_for = inferior_wait_port_set;
+// OBSOLETE
+// OBSOLETE cleanup_step = NULL_CLEANUP;
+// OBSOLETE if (MACH_PORT_VALID (thread) && MACH_PORT_VALID (singlestepped_thread_port))
+// OBSOLETE setup_single_step (thread, FALSE);
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE setup_single_step (thread_t thread, boolean_t start_step)
+// OBSOLETE {
+// OBSOLETE kern_return_t ret;
+// OBSOLETE
+// OBSOLETE if (!MACH_PORT_VALID (thread))
+// OBSOLETE error ("Invalid thread supplied to setup_single_step");
+// OBSOLETE else
+// OBSOLETE {
+// OBSOLETE mach_port_t teport;
+// OBSOLETE
+// OBSOLETE /* Get the current thread exception port */
+// OBSOLETE ret = thread_get_exception_port (thread, &teport);
+// OBSOLETE CHK ("Getting thread's exception port", ret);
+// OBSOLETE
+// OBSOLETE if (start_step)
+// OBSOLETE {
+// OBSOLETE if (MACH_PORT_VALID (singlestepped_thread_port))
+// OBSOLETE {
+// OBSOLETE warning ("Singlestepped_thread_port (0x%x) is still valid?",
+// OBSOLETE singlestepped_thread_port);
+// OBSOLETE singlestepped_thread_port = MACH_PORT_NULL;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE /* If we are already stepping this thread */
+// OBSOLETE if (MACH_PORT_VALID (teport) && teport == thread_exception_port)
+// OBSOLETE {
+// OBSOLETE ret = mach_port_deallocate (mach_task_self (), teport);
+// OBSOLETE CHK ("Could not deallocate thread exception port", ret);
+// OBSOLETE }
+// OBSOLETE else
+// OBSOLETE {
+// OBSOLETE ret = thread_set_exception_port (thread, thread_exception_port);
+// OBSOLETE CHK ("Setting exception port for thread", ret);
+// OBSOLETE #if 0
+// OBSOLETE /* Insert thread exception port to wait port set */
+// OBSOLETE ret = mach_port_move_member (mach_task_self (),
+// OBSOLETE thread_exception_port,
+// OBSOLETE inferior_wait_port_set);
+// OBSOLETE CHK ("Moving thread exception port to inferior_wait_port_set",
+// OBSOLETE ret);
+// OBSOLETE #endif
+// OBSOLETE thread_saved_exception_port = teport;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE thread_trace (thread, TRUE);
+// OBSOLETE
+// OBSOLETE singlestepped_thread_port = thread_exception_port;
+// OBSOLETE currently_waiting_for = singlestepped_thread_port;
+// OBSOLETE cleanup_step = make_cleanup (discard_single_step, thread);
+// OBSOLETE }
+// OBSOLETE else
+// OBSOLETE {
+// OBSOLETE if (!MACH_PORT_VALID (teport))
+// OBSOLETE error ("Single stepped thread had an invalid exception port?");
+// OBSOLETE
+// OBSOLETE if (teport != thread_exception_port)
+// OBSOLETE error ("Single stepped thread had an unknown exception port?");
+// OBSOLETE
+// OBSOLETE ret = mach_port_deallocate (mach_task_self (), teport);
+// OBSOLETE CHK ("Couldn't deallocate thread exception port", ret);
+// OBSOLETE #if 0
+// OBSOLETE /* Remove thread exception port from wait port set */
+// OBSOLETE ret = mach_port_move_member (mach_task_self (),
+// OBSOLETE thread_exception_port,
+// OBSOLETE MACH_PORT_NULL);
+// OBSOLETE CHK ("Removing thread exception port from inferior_wait_port_set",
+// OBSOLETE ret);
+// OBSOLETE #endif
+// OBSOLETE /* Restore thread's old exception port */
+// OBSOLETE ret = thread_set_exception_port (thread,
+// OBSOLETE thread_saved_exception_port);
+// OBSOLETE CHK ("Restoring stepped thread's exception port", ret);
+// OBSOLETE
+// OBSOLETE if (MACH_PORT_VALID (thread_saved_exception_port))
+// OBSOLETE (void) mach_port_deallocate (mach_task_self (),
+// OBSOLETE thread_saved_exception_port);
+// OBSOLETE
+// OBSOLETE thread_trace (thread, FALSE);
+// OBSOLETE
+// OBSOLETE singlestepped_thread_port = MACH_PORT_NULL;
+// OBSOLETE currently_waiting_for = inferior_wait_port_set;
+// OBSOLETE if (cleanup_step)
+// OBSOLETE discard_cleanups (cleanup_step);
+// OBSOLETE }
+// OBSOLETE }
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE static
+// OBSOLETE request_notify (mach_port_t name, mach_msg_id_t variant, int type)
+// OBSOLETE {
+// OBSOLETE kern_return_t ret;
+// OBSOLETE mach_port_t previous_port_dummy = MACH_PORT_NULL;
+// OBSOLETE
+// OBSOLETE if (!MACH_PORT_VALID (name))
+// OBSOLETE return;
+// OBSOLETE
+// OBSOLETE if (port_chain_member (notify_chain, name))
+// OBSOLETE return;
+// OBSOLETE
+// OBSOLETE ret = mach_port_request_notification (mach_task_self (),
+// OBSOLETE name,
+// OBSOLETE variant,
+// OBSOLETE 1,
+// OBSOLETE our_notify_port,
+// OBSOLETE MACH_MSG_TYPE_MAKE_SEND_ONCE,
+// OBSOLETE &previous_port_dummy);
+// OBSOLETE CHK ("Serious: request_notify failed", ret);
+// OBSOLETE
+// OBSOLETE (void) mach_port_deallocate (mach_task_self (),
+// OBSOLETE previous_port_dummy);
+// OBSOLETE
+// OBSOLETE notify_chain = port_chain_insert (notify_chain, name, type);
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE reverse_msg_bits (mach_msg_header_t *msgp, int type)
+// OBSOLETE {
+// OBSOLETE int rbits, lbits;
+// OBSOLETE rbits = MACH_MSGH_BITS_REMOTE (msgp->msgh_bits);
+// OBSOLETE lbits = type;
+// OBSOLETE msgp->msgh_bits =
+// OBSOLETE (msgp->msgh_bits & ~MACH_MSGH_BITS_PORTS_MASK) |
+// OBSOLETE MACH_MSGH_BITS (lbits, rbits);
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE /* On the third day He said:
+// OBSOLETE
+// OBSOLETE Let this be global
+// OBSOLETE and then it was global.
+// OBSOLETE
+// OBSOLETE When creating the inferior fork, the
+// OBSOLETE child code in inflow.c sets the name of the
+// OBSOLETE bootstrap_port in its address space to this
+// OBSOLETE variable.
+// OBSOLETE
+// OBSOLETE The name is transferred to our address space
+// OBSOLETE with mach3_read_inferior().
+// OBSOLETE
+// OBSOLETE Thou shalt not do this with
+// OBSOLETE task_get_bootstrap_port() in this task, since
+// OBSOLETE the name in the inferior task is different than
+// OBSOLETE the one we get.
+// OBSOLETE
+// OBSOLETE For blessed are the meek, as they shall inherit
+// OBSOLETE the address space.
+// OBSOLETE */
+// OBSOLETE mach_port_t original_server_port_name = MACH_PORT_NULL;
+// OBSOLETE
+// OBSOLETE
+// OBSOLETE /* Called from inferior after FORK but before EXEC */
+// OBSOLETE static void
+// OBSOLETE m3_trace_me (void)
+// OBSOLETE {
+// OBSOLETE kern_return_t ret;
+// OBSOLETE
+// OBSOLETE /* Get the NAME of the bootstrap port in this task
+// OBSOLETE so that GDB can read it */
+// OBSOLETE ret = task_get_bootstrap_port (mach_task_self (),
+// OBSOLETE &original_server_port_name);
+// OBSOLETE if (ret != KERN_SUCCESS)
+// OBSOLETE internal_error (__FILE__, __LINE__, "failed internal consistency check");
+// OBSOLETE ret = mach_port_deallocate (mach_task_self (),
+// OBSOLETE original_server_port_name);
+// OBSOLETE if (ret != KERN_SUCCESS)
+// OBSOLETE internal_error (__FILE__, __LINE__, "failed internal consistency check");
+// OBSOLETE
+// OBSOLETE /* Suspend this task to let the parent change my ports.
+// OBSOLETE Resumed by the debugger */
+// OBSOLETE ret = task_suspend (mach_task_self ());
+// OBSOLETE if (ret != KERN_SUCCESS)
+// OBSOLETE internal_error (__FILE__, __LINE__, "failed internal consistency check");
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE /*
+// OBSOLETE * Intercept system calls to Unix server.
+// OBSOLETE * After EXEC_COUNTER calls to exec(), return.
+// OBSOLETE *
+// OBSOLETE * Pre-assertion: Child is suspended. (Not verified)
+// OBSOLETE * Post-condition: Child is suspended after EXEC_COUNTER exec() calls.
+// OBSOLETE */
+// OBSOLETE
+// OBSOLETE void
+// OBSOLETE intercept_exec_calls (int exec_counter)
+// OBSOLETE {
+// OBSOLETE int terminal_initted = 0;
+// OBSOLETE
+// OBSOLETE struct syscall_msg_t
+// OBSOLETE {
+// OBSOLETE mach_msg_header_t header;
+// OBSOLETE mach_msg_type_t type;
+// OBSOLETE char room[2000]; /* Enuff space */
+// OBSOLETE };
+// OBSOLETE
+// OBSOLETE struct syscall_msg_t syscall_in, syscall_out;
+// OBSOLETE
+// OBSOLETE mach_port_t fake_server;
+// OBSOLETE mach_port_t original_server_send;
+// OBSOLETE mach_port_t original_exec_reply;
+// OBSOLETE mach_port_t exec_reply;
+// OBSOLETE mach_port_t exec_reply_send;
+// OBSOLETE mach_msg_type_name_t acquired;
+// OBSOLETE mach_port_t emulator_server_port_name;
+// OBSOLETE struct task_basic_info info;
+// OBSOLETE mach_msg_type_number_t info_count;
+// OBSOLETE
+// OBSOLETE kern_return_t ret;
+// OBSOLETE
+// OBSOLETE if (exec_counter <= 0)
+// OBSOLETE return; /* We are already set up in the correct program */
+// OBSOLETE
+// OBSOLETE ret = mach_port_allocate (mach_task_self (),
+// OBSOLETE MACH_PORT_RIGHT_RECEIVE,
+// OBSOLETE &fake_server);
+// OBSOLETE CHK ("create inferior_fake_server port failed", ret);
+// OBSOLETE
+// OBSOLETE /* Wait for inferior_task to suspend itself */
+// OBSOLETE while (1)
+// OBSOLETE {
+// OBSOLETE info_count = sizeof (info);
+// OBSOLETE ret = task_info (inferior_task,
+// OBSOLETE TASK_BASIC_INFO,
+// OBSOLETE (task_info_t) & info,
+// OBSOLETE &info_count);
+// OBSOLETE CHK ("Task info", ret);
+// OBSOLETE
+// OBSOLETE if (info.suspend_count)
+// OBSOLETE break;
+// OBSOLETE
+// OBSOLETE /* Note that the definition of the parameter was undefined
+// OBSOLETE * at the time of this writing, so I just use an `ad hoc' value.
+// OBSOLETE */
+// OBSOLETE (void) swtch_pri (42); /* Universal Priority Value */
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE /* Read the inferior's bootstrap port name */
+// OBSOLETE if (!mach3_read_inferior (&original_server_port_name,
+// OBSOLETE &original_server_port_name,
+// OBSOLETE sizeof (original_server_port_name)))
+// OBSOLETE error ("Can't read inferior task bootstrap port name");
+// OBSOLETE
+// OBSOLETE /* @@ BUG: If more than 1 send right GDB will FAIL!!! */
+// OBSOLETE /* Should get refs, and set them back when restoring */
+// OBSOLETE /* Steal the original bsd server send right from inferior */
+// OBSOLETE ret = mach_port_extract_right (inferior_task,
+// OBSOLETE original_server_port_name,
+// OBSOLETE MACH_MSG_TYPE_MOVE_SEND,
+// OBSOLETE &original_server_send,
+// OBSOLETE &acquired);
+// OBSOLETE CHK ("mach_port_extract_right (bsd server send)", ret);
+// OBSOLETE
+// OBSOLETE if (acquired != MACH_MSG_TYPE_PORT_SEND)
+// OBSOLETE error ("Incorrect right extracted, send right to bsd server expected");
+// OBSOLETE
+// OBSOLETE ret = mach_port_insert_right (inferior_task,
+// OBSOLETE original_server_port_name,
+// OBSOLETE fake_server,
+// OBSOLETE MACH_MSG_TYPE_MAKE_SEND);
+// OBSOLETE CHK ("mach_port_insert_right (fake server send)", ret);
+// OBSOLETE
+// OBSOLETE xx_debug ("inferior task bsd server ports set up \nfs %x, ospn %x, oss %x\n",
+// OBSOLETE fake_server,
+// OBSOLETE original_server_port_name, original_server_send);
+// OBSOLETE
+// OBSOLETE /* A receive right to the reply generated by unix server exec() request */
+// OBSOLETE ret = mach_port_allocate (mach_task_self (),
+// OBSOLETE MACH_PORT_RIGHT_RECEIVE,
+// OBSOLETE &exec_reply);
+// OBSOLETE CHK ("create intercepted_reply_port port failed", ret);
+// OBSOLETE
+// OBSOLETE /* Pass this send right to Unix server so it replies to us after exec() */
+// OBSOLETE ret = mach_port_extract_right (mach_task_self (),
+// OBSOLETE exec_reply,
+// OBSOLETE MACH_MSG_TYPE_MAKE_SEND_ONCE,
+// OBSOLETE &exec_reply_send,
+// OBSOLETE &acquired);
+// OBSOLETE CHK ("mach_port_extract_right (exec_reply)", ret);
+// OBSOLETE
+// OBSOLETE if (acquired != MACH_MSG_TYPE_PORT_SEND_ONCE)
+// OBSOLETE error ("Incorrect right extracted, send once expected for exec reply");
+// OBSOLETE
+// OBSOLETE ret = mach_port_move_member (mach_task_self (),
+// OBSOLETE fake_server,
+// OBSOLETE inferior_wait_port_set);
+// OBSOLETE CHK ("Moving fake syscall port to inferior_wait_port_set", ret);
+// OBSOLETE
+// OBSOLETE xx_debug ("syscall fake server set up, resuming inferior\n");
+// OBSOLETE
+// OBSOLETE ret = task_resume (inferior_task);
+// OBSOLETE CHK ("task_resume (startup)", ret);
+// OBSOLETE
+// OBSOLETE /* Read requests from the inferior.
+// OBSOLETE Pass directly through everything else except exec() calls.
+// OBSOLETE */
+// OBSOLETE while (exec_counter > 0)
+// OBSOLETE {
+// OBSOLETE ret = mach_msg (&syscall_in.header, /* header */
+// OBSOLETE MACH_RCV_MSG, /* options */
+// OBSOLETE 0, /* send size */
+// OBSOLETE sizeof (struct syscall_msg_t), /* receive size */
+// OBSOLETE inferior_wait_port_set, /* receive_name */
+// OBSOLETE MACH_MSG_TIMEOUT_NONE,
+// OBSOLETE MACH_PORT_NULL);
+// OBSOLETE CHK ("mach_msg (intercepted sycall)", ret);
+// OBSOLETE
+// OBSOLETE #ifdef DUMP_SYSCALL
+// OBSOLETE print_msg (&syscall_in.header);
+// OBSOLETE #endif
+// OBSOLETE
+// OBSOLETE /* ASSERT : msgh_local_port == fake_server */
+// OBSOLETE
+// OBSOLETE if (notify_server (&syscall_in.header, &syscall_out.header))
+// OBSOLETE error ("received a notify while intercepting syscalls");
+// OBSOLETE
+// OBSOLETE if (syscall_in.header.msgh_id == MIG_EXEC_SYSCALL_ID)
+// OBSOLETE {
+// OBSOLETE xx_debug ("Received EXEC SYSCALL, counter = %d\n", exec_counter);
+// OBSOLETE if (exec_counter == 1)
+// OBSOLETE {
+// OBSOLETE original_exec_reply = syscall_in.header.msgh_remote_port;
+// OBSOLETE syscall_in.header.msgh_remote_port = exec_reply_send;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE if (!terminal_initted)
+// OBSOLETE {
+// OBSOLETE /* Now that the child has exec'd we know it has already set its
+// OBSOLETE process group. On POSIX systems, tcsetpgrp will fail with
+// OBSOLETE EPERM if we try it before the child's setpgid. */
+// OBSOLETE
+// OBSOLETE /* Set up the "saved terminal modes" of the inferior
+// OBSOLETE based on what modes we are starting it with. */
+// OBSOLETE target_terminal_init ();
+// OBSOLETE
+// OBSOLETE /* Install inferior's terminal modes. */
+// OBSOLETE target_terminal_inferior ();
+// OBSOLETE
+// OBSOLETE terminal_initted = 1;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE exec_counter--;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE syscall_in.header.msgh_local_port = syscall_in.header.msgh_remote_port;
+// OBSOLETE syscall_in.header.msgh_remote_port = original_server_send;
+// OBSOLETE
+// OBSOLETE reverse_msg_bits (&syscall_in.header, MACH_MSG_TYPE_COPY_SEND);
+// OBSOLETE
+// OBSOLETE ret = mach_msg_send (&syscall_in.header);
+// OBSOLETE CHK ("Forwarded syscall", ret);
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE ret = mach_port_move_member (mach_task_self (),
+// OBSOLETE fake_server,
+// OBSOLETE MACH_PORT_NULL);
+// OBSOLETE CHK ("Moving fake syscall out of inferior_wait_port_set", ret);
+// OBSOLETE
+// OBSOLETE ret = mach_port_move_member (mach_task_self (),
+// OBSOLETE exec_reply,
+// OBSOLETE inferior_wait_port_set);
+// OBSOLETE CHK ("Moving exec_reply to inferior_wait_port_set", ret);
+// OBSOLETE
+// OBSOLETE ret = mach_msg (&syscall_in.header, /* header */
+// OBSOLETE MACH_RCV_MSG, /* options */
+// OBSOLETE 0, /* send size */
+// OBSOLETE sizeof (struct syscall_msg_t), /* receive size */
+// OBSOLETE inferior_wait_port_set, /* receive_name */
+// OBSOLETE MACH_MSG_TIMEOUT_NONE,
+// OBSOLETE MACH_PORT_NULL);
+// OBSOLETE CHK ("mach_msg (exec reply)", ret);
+// OBSOLETE
+// OBSOLETE ret = task_suspend (inferior_task);
+// OBSOLETE CHK ("Suspending inferior after last exec", ret);
+// OBSOLETE
+// OBSOLETE must_suspend_thread = 0;
+// OBSOLETE
+// OBSOLETE xx_debug ("Received exec reply from bsd server, suspended inferior task\n");
+// OBSOLETE
+// OBSOLETE #ifdef DUMP_SYSCALL
+// OBSOLETE print_msg (&syscall_in.header);
+// OBSOLETE #endif
+// OBSOLETE
+// OBSOLETE /* Message should appear as if it came from the unix server */
+// OBSOLETE syscall_in.header.msgh_local_port = MACH_PORT_NULL;
+// OBSOLETE
+// OBSOLETE /* and go to the inferior task original reply port */
+// OBSOLETE syscall_in.header.msgh_remote_port = original_exec_reply;
+// OBSOLETE
+// OBSOLETE reverse_msg_bits (&syscall_in.header, MACH_MSG_TYPE_MOVE_SEND_ONCE);
+// OBSOLETE
+// OBSOLETE ret = mach_msg_send (&syscall_in.header);
+// OBSOLETE CHK ("Forwarding exec reply to inferior", ret);
+// OBSOLETE
+// OBSOLETE /* Garbage collect */
+// OBSOLETE ret = mach_port_deallocate (inferior_task,
+// OBSOLETE original_server_port_name);
+// OBSOLETE CHK ("deallocating fake server send right", ret);
+// OBSOLETE
+// OBSOLETE ret = mach_port_insert_right (inferior_task,
+// OBSOLETE original_server_port_name,
+// OBSOLETE original_server_send,
+// OBSOLETE MACH_MSG_TYPE_MOVE_SEND);
+// OBSOLETE CHK ("Restoring the original bsd server send right", ret);
+// OBSOLETE
+// OBSOLETE ret = mach_port_destroy (mach_task_self (),
+// OBSOLETE fake_server);
+// OBSOLETE fake_server = MACH_PORT_DEAD;
+// OBSOLETE CHK ("mach_port_destroy (fake_server)", ret);
+// OBSOLETE
+// OBSOLETE ret = mach_port_destroy (mach_task_self (),
+// OBSOLETE exec_reply);
+// OBSOLETE exec_reply = MACH_PORT_DEAD;
+// OBSOLETE CHK ("mach_port_destroy (exec_reply)", ret);
+// OBSOLETE
+// OBSOLETE xx_debug ("Done with exec call interception\n");
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE void
+// OBSOLETE consume_send_rights (thread_array_t thread_list, int thread_count)
+// OBSOLETE {
+// OBSOLETE int index;
+// OBSOLETE
+// OBSOLETE if (!thread_count)
+// OBSOLETE return;
+// OBSOLETE
+// OBSOLETE for (index = 0; index < thread_count; index++)
+// OBSOLETE {
+// OBSOLETE /* Since thread kill command kills threads, don't check ret */
+// OBSOLETE (void) mach_port_deallocate (mach_task_self (),
+// OBSOLETE thread_list[index]);
+// OBSOLETE }
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE /* suspend/abort/resume a thread. */
+// OBSOLETE setup_thread (mach_port_t thread, int what)
+// OBSOLETE {
+// OBSOLETE kern_return_t ret;
+// OBSOLETE
+// OBSOLETE if (what)
+// OBSOLETE {
+// OBSOLETE ret = thread_suspend (thread);
+// OBSOLETE CHK ("setup_thread thread_suspend", ret);
+// OBSOLETE
+// OBSOLETE ret = thread_abort (thread);
+// OBSOLETE CHK ("setup_thread thread_abort", ret);
+// OBSOLETE }
+// OBSOLETE else
+// OBSOLETE {
+// OBSOLETE ret = thread_resume (thread);
+// OBSOLETE CHK ("setup_thread thread_resume", ret);
+// OBSOLETE }
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE int
+// OBSOLETE map_slot_to_mid (int slot, thread_array_t threads, int thread_count)
+// OBSOLETE {
+// OBSOLETE kern_return_t ret;
+// OBSOLETE int deallocate = 0;
+// OBSOLETE int index;
+// OBSOLETE int mid;
+// OBSOLETE
+// OBSOLETE if (!threads)
+// OBSOLETE {
+// OBSOLETE deallocate++;
+// OBSOLETE ret = task_threads (inferior_task, &threads, &thread_count);
+// OBSOLETE CHK ("Can not select a thread from a dead task", ret);
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE if (slot < 0 || slot >= thread_count)
+// OBSOLETE {
+// OBSOLETE if (deallocate)
+// OBSOLETE {
+// OBSOLETE consume_send_rights (threads, thread_count);
+// OBSOLETE (void) vm_deallocate (mach_task_self (), (vm_address_t) threads,
+// OBSOLETE (thread_count * sizeof (mach_port_t)));
+// OBSOLETE }
+// OBSOLETE if (slot < 0)
+// OBSOLETE error ("invalid slot number");
+// OBSOLETE else
+// OBSOLETE return -(slot + 1);
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE mid = map_port_name_to_mid (threads[slot], MACH_TYPE_THREAD);
+// OBSOLETE
+// OBSOLETE if (deallocate)
+// OBSOLETE {
+// OBSOLETE consume_send_rights (threads, thread_count);
+// OBSOLETE (void) vm_deallocate (mach_task_self (), (vm_address_t) threads,
+// OBSOLETE (thread_count * sizeof (mach_port_t)));
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE return mid;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE static int
+// OBSOLETE parse_thread_id (char *arg, int thread_count, int slots)
+// OBSOLETE {
+// OBSOLETE kern_return_t ret;
+// OBSOLETE int mid;
+// OBSOLETE int slot;
+// OBSOLETE int index;
+// OBSOLETE
+// OBSOLETE if (arg == 0)
+// OBSOLETE return 0;
+// OBSOLETE
+// OBSOLETE while (*arg && (*arg == ' ' || *arg == '\t'))
+// OBSOLETE arg++;
+// OBSOLETE
+// OBSOLETE if (!*arg)
+// OBSOLETE return 0;
+// OBSOLETE
+// OBSOLETE /* Currently parse MID and @SLOTNUMBER */
+// OBSOLETE if (*arg != '@')
+// OBSOLETE {
+// OBSOLETE mid = atoi (arg);
+// OBSOLETE if (mid <= 0)
+// OBSOLETE error ("valid thread mid expected");
+// OBSOLETE return mid;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE arg++;
+// OBSOLETE slot = atoi (arg);
+// OBSOLETE
+// OBSOLETE if (slot < 0)
+// OBSOLETE error ("invalid slot number");
+// OBSOLETE
+// OBSOLETE /* If you want slot numbers to remain slot numbers, set slots.
+// OBSOLETE
+// OBSOLETE * Well, since 0 is reserved, return the ordinal number
+// OBSOLETE * of the thread rather than the slot number. Awk, this
+// OBSOLETE * counts as a kludge.
+// OBSOLETE */
+// OBSOLETE if (slots)
+// OBSOLETE return -(slot + 1);
+// OBSOLETE
+// OBSOLETE if (thread_count && slot >= thread_count)
+// OBSOLETE return -(slot + 1);
+// OBSOLETE
+// OBSOLETE mid = map_slot_to_mid (slot);
+// OBSOLETE
+// OBSOLETE return mid;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE /* THREAD_ID 0 is special; it selects the first kernel
+// OBSOLETE * thread from the list (i.e. SLOTNUMBER 0)
+// OBSOLETE * This is used when starting the program with 'run' or when attaching.
+// OBSOLETE *
+// OBSOLETE * If FLAG is 0 the context is not changed, and the registers, frame, etc
+// OBSOLETE * will continue to describe the old thread.
+// OBSOLETE *
+// OBSOLETE * If FLAG is nonzero, really select the thread.
+// OBSOLETE * If FLAG is 2, the THREAD_ID is a slotnumber instead of a mid.
+// OBSOLETE *
+// OBSOLETE */
+// OBSOLETE kern_return_t
+// OBSOLETE select_thread (mach_port_t task, int thread_id, int flag)
+// OBSOLETE {
+// OBSOLETE thread_array_t thread_list;
+// OBSOLETE int thread_count;
+// OBSOLETE kern_return_t ret;
+// OBSOLETE int index;
+// OBSOLETE thread_t new_thread = MACH_PORT_NULL;
+// OBSOLETE
+// OBSOLETE if (thread_id < 0)
+// OBSOLETE error ("Can't select cprocs without kernel thread");
+// OBSOLETE
+// OBSOLETE ret = task_threads (task, &thread_list, &thread_count);
+// OBSOLETE if (ret != KERN_SUCCESS)
+// OBSOLETE {
+// OBSOLETE warning ("Can not select a thread from a dead task");
+// OBSOLETE m3_kill_inferior ();
+// OBSOLETE return KERN_FAILURE;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE if (thread_count == 0)
+// OBSOLETE {
+// OBSOLETE /* The task can not do anything anymore, but it still
+// OBSOLETE * exists as a container for memory and ports.
+// OBSOLETE */
+// OBSOLETE registers_changed ();
+// OBSOLETE warning ("Task %d has no threads",
+// OBSOLETE map_port_name_to_mid (task, MACH_TYPE_TASK));
+// OBSOLETE current_thread = MACH_PORT_NULL;
+// OBSOLETE (void) vm_deallocate (mach_task_self (),
+// OBSOLETE (vm_address_t) thread_list,
+// OBSOLETE (thread_count * sizeof (mach_port_t)));
+// OBSOLETE return KERN_FAILURE;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE if (!thread_id || flag == 2)
+// OBSOLETE {
+// OBSOLETE /* First thread or a slotnumber */
+// OBSOLETE if (!thread_id)
+// OBSOLETE new_thread = thread_list[0];
+// OBSOLETE else
+// OBSOLETE {
+// OBSOLETE if (thread_id < thread_count)
+// OBSOLETE new_thread = thread_list[thread_id];
+// OBSOLETE else
+// OBSOLETE {
+// OBSOLETE (void) vm_deallocate (mach_task_self (),
+// OBSOLETE (vm_address_t) thread_list,
+// OBSOLETE (thread_count * sizeof (mach_port_t)));
+// OBSOLETE error ("No such thread slot number : %d", thread_id);
+// OBSOLETE }
+// OBSOLETE }
+// OBSOLETE }
+// OBSOLETE else
+// OBSOLETE {
+// OBSOLETE for (index = 0; index < thread_count; index++)
+// OBSOLETE if (thread_id == map_port_name_to_mid (thread_list[index],
+// OBSOLETE MACH_TYPE_THREAD))
+// OBSOLETE {
+// OBSOLETE new_thread = thread_list[index];
+// OBSOLETE index = -1;
+// OBSOLETE break;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE if (index != -1)
+// OBSOLETE error ("No thread with mid %d", thread_id);
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE /* Notify when the selected thread dies */
+// OBSOLETE request_notify (new_thread, MACH_NOTIFY_DEAD_NAME, MACH_TYPE_THREAD);
+// OBSOLETE
+// OBSOLETE ret = vm_deallocate (mach_task_self (),
+// OBSOLETE (vm_address_t) thread_list,
+// OBSOLETE (thread_count * sizeof (mach_port_t)));
+// OBSOLETE CHK ("vm_deallocate", ret);
+// OBSOLETE
+// OBSOLETE if (!flag)
+// OBSOLETE current_thread = new_thread;
+// OBSOLETE else
+// OBSOLETE {
+// OBSOLETE #if 0
+// OBSOLETE if (MACH_PORT_VALID (current_thread))
+// OBSOLETE {
+// OBSOLETE /* Store the gdb's view of the thread we are deselecting
+// OBSOLETE
+// OBSOLETE * @@ I think gdb updates registers immediately when they are
+// OBSOLETE * changed, so don't do this.
+// OBSOLETE */
+// OBSOLETE ret = thread_abort (current_thread);
+// OBSOLETE CHK ("Could not abort system calls when saving state of old thread",
+// OBSOLETE ret);
+// OBSOLETE target_prepare_to_store ();
+// OBSOLETE target_store_registers (-1);
+// OBSOLETE }
+// OBSOLETE #endif
+// OBSOLETE
+// OBSOLETE registers_changed ();
+// OBSOLETE
+// OBSOLETE current_thread = new_thread;
+// OBSOLETE
+// OBSOLETE ret = thread_abort (current_thread);
+// OBSOLETE CHK ("Could not abort system calls when selecting a thread", ret);
+// OBSOLETE
+// OBSOLETE stop_pc = read_pc ();
+// OBSOLETE flush_cached_frames ();
+// OBSOLETE
+// OBSOLETE select_frame (get_current_frame ());
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE return KERN_SUCCESS;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE /*
+// OBSOLETE * Switch to use thread named NEW_THREAD.
+// OBSOLETE * Return it's MID
+// OBSOLETE */
+// OBSOLETE int
+// OBSOLETE switch_to_thread (thread_t new_thread)
+// OBSOLETE {
+// OBSOLETE thread_t saved_thread = current_thread;
+// OBSOLETE int mid;
+// OBSOLETE
+// OBSOLETE mid = map_port_name_to_mid (new_thread,
+// OBSOLETE MACH_TYPE_THREAD);
+// OBSOLETE if (mid == -1)
+// OBSOLETE warning ("Can't map thread name 0x%x to mid", new_thread);
+// OBSOLETE else if (select_thread (inferior_task, mid, 1) != KERN_SUCCESS)
+// OBSOLETE {
+// OBSOLETE if (current_thread)
+// OBSOLETE current_thread = saved_thread;
+// OBSOLETE error ("Could not select thread %d", mid);
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE return mid;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE /* Do this in gdb after doing FORK but before STARTUP_INFERIOR.
+// OBSOLETE * Note that the registers are not yet valid in the inferior task.
+// OBSOLETE */
+// OBSOLETE static int
+// OBSOLETE m3_trace_him (int pid)
+// OBSOLETE {
+// OBSOLETE kern_return_t ret;
+// OBSOLETE
+// OBSOLETE push_target (&m3_ops);
+// OBSOLETE
+// OBSOLETE inferior_task = task_by_pid (pid);
+// OBSOLETE
+// OBSOLETE if (!MACH_PORT_VALID (inferior_task))
+// OBSOLETE error ("Can not map Unix pid %d to Mach task", pid);
+// OBSOLETE
+// OBSOLETE /* Clean up previous notifications and create new ones */
+// OBSOLETE setup_notify_port (1);
+// OBSOLETE
+// OBSOLETE /* When notification appears, the inferior task has died */
+// OBSOLETE request_notify (inferior_task, MACH_NOTIFY_DEAD_NAME, MACH_TYPE_TASK);
+// OBSOLETE
+// OBSOLETE emulator_present = have_emulator_p (inferior_task);
+// OBSOLETE
+// OBSOLETE /* By default, select the first thread,
+// OBSOLETE * If task has no threads, gives a warning
+// OBSOLETE * Does not fetch registers, since they are not yet valid.
+// OBSOLETE */
+// OBSOLETE select_thread (inferior_task, 0, 0);
+// OBSOLETE
+// OBSOLETE inferior_exception_port = MACH_PORT_NULL;
+// OBSOLETE
+// OBSOLETE setup_exception_port ();
+// OBSOLETE
+// OBSOLETE xx_debug ("Now the debugged task is created\n");
+// OBSOLETE
+// OBSOLETE /* One trap to exec the shell, one to exec the program being debugged. */
+// OBSOLETE intercept_exec_calls (2);
+// OBSOLETE
+// OBSOLETE return pid;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE setup_exception_port (void)
+// OBSOLETE {
+// OBSOLETE kern_return_t ret;
+// OBSOLETE
+// OBSOLETE ret = mach_port_allocate (mach_task_self (),
+// OBSOLETE MACH_PORT_RIGHT_RECEIVE,
+// OBSOLETE &inferior_exception_port);
+// OBSOLETE CHK ("mach_port_allocate", ret);
+// OBSOLETE
+// OBSOLETE /* add send right */
+// OBSOLETE ret = mach_port_insert_right (mach_task_self (),
+// OBSOLETE inferior_exception_port,
+// OBSOLETE inferior_exception_port,
+// OBSOLETE MACH_MSG_TYPE_MAKE_SEND);
+// OBSOLETE CHK ("mach_port_insert_right", ret);
+// OBSOLETE
+// OBSOLETE ret = mach_port_move_member (mach_task_self (),
+// OBSOLETE inferior_exception_port,
+// OBSOLETE inferior_wait_port_set);
+// OBSOLETE CHK ("mach_port_move_member", ret);
+// OBSOLETE
+// OBSOLETE ret = task_get_special_port (inferior_task,
+// OBSOLETE TASK_EXCEPTION_PORT,
+// OBSOLETE &inferior_old_exception_port);
+// OBSOLETE CHK ("task_get_special_port(old exc)", ret);
+// OBSOLETE
+// OBSOLETE ret = task_set_special_port (inferior_task,
+// OBSOLETE TASK_EXCEPTION_PORT,
+// OBSOLETE inferior_exception_port);
+// OBSOLETE CHK ("task_set_special_port", ret);
+// OBSOLETE
+// OBSOLETE ret = mach_port_deallocate (mach_task_self (),
+// OBSOLETE inferior_exception_port);
+// OBSOLETE CHK ("mack_port_deallocate", ret);
+// OBSOLETE
+// OBSOLETE #if 0
+// OBSOLETE /* When notify appears, the inferior_task's exception
+// OBSOLETE * port has been destroyed.
+// OBSOLETE *
+// OBSOLETE * Not used, since the dead_name_notification already
+// OBSOLETE * appears when task dies.
+// OBSOLETE *
+// OBSOLETE */
+// OBSOLETE request_notify (inferior_exception_port,
+// OBSOLETE MACH_NOTIFY_NO_SENDERS,
+// OBSOLETE MACH_TYPE_EXCEPTION_PORT);
+// OBSOLETE #endif
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE /* Nonzero if gdb is waiting for a message */
+// OBSOLETE int mach_really_waiting;
+// OBSOLETE
+// OBSOLETE /* Wait for the inferior to stop for some reason.
+// OBSOLETE - Loop on notifications until inferior_task dies.
+// OBSOLETE - Loop on exceptions until stopped_in_exception comes true.
+// OBSOLETE (e.g. we receive a single step trace trap)
+// OBSOLETE - a message arrives to gdb's message port
+// OBSOLETE
+// OBSOLETE There is no other way to exit this loop.
+// OBSOLETE
+// OBSOLETE Returns the inferior_ptid for rest of gdb.
+// OBSOLETE Side effects: Set *OURSTATUS. */
+// OBSOLETE ptid_t
+// OBSOLETE mach_really_wait (ptid_t ptid, struct target_waitstatus *ourstatus)
+// OBSOLETE {
+// OBSOLETE kern_return_t ret;
+// OBSOLETE int w;
+// OBSOLETE
+// OBSOLETE struct msg
+// OBSOLETE {
+// OBSOLETE mach_msg_header_t header;
+// OBSOLETE mach_msg_type_t foo;
+// OBSOLETE int data[8000];
+// OBSOLETE }
+// OBSOLETE in_msg, out_msg;
+// OBSOLETE
+// OBSOLETE /* Either notify (death), exception or message can stop the inferior */
+// OBSOLETE stopped_in_exception = FALSE;
+// OBSOLETE
+// OBSOLETE while (1)
+// OBSOLETE {
+// OBSOLETE QUIT;
+// OBSOLETE
+// OBSOLETE stop_exception = stop_code = stop_subcode = -1;
+// OBSOLETE stop_thread = MACH_PORT_NULL;
+// OBSOLETE
+// OBSOLETE mach_really_waiting = 1;
+// OBSOLETE ret = mach_msg (&in_msg.header, /* header */
+// OBSOLETE MACH_RCV_MSG, /* options */
+// OBSOLETE 0, /* send size */
+// OBSOLETE sizeof (struct msg), /* receive size */
+// OBSOLETE currently_waiting_for, /* receive name */
+// OBSOLETE MACH_MSG_TIMEOUT_NONE,
+// OBSOLETE MACH_PORT_NULL);
+// OBSOLETE mach_really_waiting = 0;
+// OBSOLETE CHK ("mach_msg (receive)", ret);
+// OBSOLETE
+// OBSOLETE /* Check if we received a notify of the childs' death */
+// OBSOLETE if (notify_server (&in_msg.header, &out_msg.header))
+// OBSOLETE {
+// OBSOLETE /* If inferior_task is null then the inferior has
+// OBSOLETE gone away and we want to return to command level.
+// OBSOLETE Otherwise it was just an informative message and we
+// OBSOLETE need to look to see if there are any more. */
+// OBSOLETE if (inferior_task != MACH_PORT_NULL)
+// OBSOLETE continue;
+// OBSOLETE else
+// OBSOLETE {
+// OBSOLETE /* Collect Unix exit status for gdb */
+// OBSOLETE
+// OBSOLETE wait3 (&w, WNOHANG, 0);
+// OBSOLETE
+// OBSOLETE /* This mess is here to check that the rest of
+// OBSOLETE * gdb knows that the inferior died. It also
+// OBSOLETE * tries to hack around the fact that Mach 3.0 (mk69)
+// OBSOLETE * unix server (ux28) does not always know what
+// OBSOLETE * has happened to it's children when mach-magic
+// OBSOLETE * is applied on them.
+// OBSOLETE */
+// OBSOLETE if ((!WIFEXITED (w) && WIFSTOPPED (w)) ||
+// OBSOLETE (WIFEXITED (w) && WEXITSTATUS (w) > 0377))
+// OBSOLETE {
+// OBSOLETE WSETEXIT (w, 0);
+// OBSOLETE warning ("Using exit value 0 for terminated task");
+// OBSOLETE }
+// OBSOLETE else if (!WIFEXITED (w))
+// OBSOLETE {
+// OBSOLETE int sig = WTERMSIG (w);
+// OBSOLETE
+// OBSOLETE /* Signals cause problems. Warn the user. */
+// OBSOLETE if (sig != SIGKILL) /* Bad luck if garbage matches this */
+// OBSOLETE warning ("The terminating signal stuff may be nonsense");
+// OBSOLETE else if (sig > NSIG)
+// OBSOLETE {
+// OBSOLETE WSETEXIT (w, 0);
+// OBSOLETE warning ("Using exit value 0 for terminated task");
+// OBSOLETE }
+// OBSOLETE }
+// OBSOLETE store_waitstatus (ourstatus, w);
+// OBSOLETE return inferior_ptid;
+// OBSOLETE }
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE /* Hmm. Check for exception, as it was not a notification.
+// OBSOLETE exc_server() does an upcall to catch_exception_raise()
+// OBSOLETE if this rpc is an exception. Further actions are decided
+// OBSOLETE there.
+// OBSOLETE */
+// OBSOLETE if (!exc_server (&in_msg.header, &out_msg.header))
+// OBSOLETE {
+// OBSOLETE
+// OBSOLETE /* Not an exception, check for message.
+// OBSOLETE
+// OBSOLETE * Messages don't come from the inferior, or if they
+// OBSOLETE * do they better be asynchronous or it will hang.
+// OBSOLETE */
+// OBSOLETE if (gdb_message_server (&in_msg.header))
+// OBSOLETE continue;
+// OBSOLETE
+// OBSOLETE error ("Unrecognized message received in mach_really_wait");
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE /* Send the reply of the exception rpc to the suspended task */
+// OBSOLETE ret = mach_msg_send (&out_msg.header);
+// OBSOLETE CHK ("mach_msg_send (exc reply)", ret);
+// OBSOLETE
+// OBSOLETE if (stopped_in_exception)
+// OBSOLETE {
+// OBSOLETE /* Get unix state. May be changed in mach3_exception_actions() */
+// OBSOLETE wait3 (&w, WNOHANG, 0);
+// OBSOLETE
+// OBSOLETE mach3_exception_actions (&w, FALSE, "Task");
+// OBSOLETE
+// OBSOLETE store_waitstatus (ourstatus, w);
+// OBSOLETE return inferior_ptid;
+// OBSOLETE }
+// OBSOLETE }
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE /* Called by macro DO_QUIT() in utils.c(quit).
+// OBSOLETE * This is called just before calling error() to return to command level
+// OBSOLETE */
+// OBSOLETE void
+// OBSOLETE mach3_quit (void)
+// OBSOLETE {
+// OBSOLETE int mid;
+// OBSOLETE kern_return_t ret;
+// OBSOLETE
+// OBSOLETE if (mach_really_waiting)
+// OBSOLETE {
+// OBSOLETE ret = task_suspend (inferior_task);
+// OBSOLETE
+// OBSOLETE if (ret != KERN_SUCCESS)
+// OBSOLETE {
+// OBSOLETE warning ("Could not suspend task for interrupt: %s",
+// OBSOLETE mach_error_string (ret));
+// OBSOLETE mach_really_waiting = 0;
+// OBSOLETE return;
+// OBSOLETE }
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE must_suspend_thread = 0;
+// OBSOLETE mach_really_waiting = 0;
+// OBSOLETE
+// OBSOLETE mid = map_port_name_to_mid (current_thread, MACH_TYPE_THREAD);
+// OBSOLETE if (mid == -1)
+// OBSOLETE {
+// OBSOLETE warning ("Selecting first existing kernel thread");
+// OBSOLETE mid = 0;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE current_thread = MACH_PORT_NULL; /* Force setup */
+// OBSOLETE select_thread (inferior_task, mid, 1);
+// OBSOLETE
+// OBSOLETE return;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE #if 0
+// OBSOLETE /* bogus bogus bogus. It is NOT OK to quit out of target_wait. */
+// OBSOLETE
+// OBSOLETE /* If ^C is typed when we are waiting for a message
+// OBSOLETE * and your Unix server is able to notice that we
+// OBSOLETE * should quit now.
+// OBSOLETE *
+// OBSOLETE * Called by REQUEST_QUIT() from utils.c(request_quit)
+// OBSOLETE */
+// OBSOLETE void
+// OBSOLETE mach3_request_quit (void)
+// OBSOLETE {
+// OBSOLETE if (mach_really_waiting)
+// OBSOLETE immediate_quit = 1;
+// OBSOLETE }
+// OBSOLETE #endif
+// OBSOLETE
+// OBSOLETE /*
+// OBSOLETE * Gdb message server.
+// OBSOLETE * Currently implemented is the STOP message, that causes
+// OBSOLETE * gdb to return to the command level like ^C had been typed from terminal.
+// OBSOLETE */
+// OBSOLETE int
+// OBSOLETE gdb_message_server (mach_msg_header_t *InP)
+// OBSOLETE {
+// OBSOLETE kern_return_t ret;
+// OBSOLETE int mid;
+// OBSOLETE
+// OBSOLETE if (InP->msgh_local_port == our_message_port)
+// OBSOLETE {
+// OBSOLETE /* A message coming to our_message_port. Check validity */
+// OBSOLETE switch (InP->msgh_id)
+// OBSOLETE {
+// OBSOLETE
+// OBSOLETE case GDB_MESSAGE_ID_STOP:
+// OBSOLETE ret = task_suspend (inferior_task);
+// OBSOLETE if (ret != KERN_SUCCESS)
+// OBSOLETE warning ("Could not suspend task for stop message: %s",
+// OBSOLETE mach_error_string (ret));
+// OBSOLETE
+// OBSOLETE /* QUIT in mach_really_wait() loop. */
+// OBSOLETE request_quit (0);
+// OBSOLETE break;
+// OBSOLETE
+// OBSOLETE default:
+// OBSOLETE warning ("Invalid message id %d received, ignored.",
+// OBSOLETE InP->msgh_id);
+// OBSOLETE break;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE return 1;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE /* Message not handled by this server */
+// OBSOLETE return 0;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE /* NOTE: This is not an RPC call. It is a simpleroutine.
+// OBSOLETE
+// OBSOLETE * This is not called from this gdb code.
+// OBSOLETE *
+// OBSOLETE * It may be called by another debugger to cause this
+// OBSOLETE * debugger to enter command level:
+// OBSOLETE *
+// OBSOLETE * (gdb) set stop_inferior_gdb ()
+// OBSOLETE * (gdb) continue
+// OBSOLETE *
+// OBSOLETE * External program "stop-gdb" implements this also.
+// OBSOLETE */
+// OBSOLETE void
+// OBSOLETE stop_inferior_gdb (void)
+// OBSOLETE {
+// OBSOLETE kern_return_t ret;
+// OBSOLETE
+// OBSOLETE /* Code generated by mig, with minor cleanups :-)
+// OBSOLETE
+// OBSOLETE * simpleroutine stop_inferior_gdb (our_message_port : mach_port_t);
+// OBSOLETE */
+// OBSOLETE
+// OBSOLETE typedef struct
+// OBSOLETE {
+// OBSOLETE mach_msg_header_t Head;
+// OBSOLETE }
+// OBSOLETE Request;
+// OBSOLETE
+// OBSOLETE Request Mess;
+// OBSOLETE
+// OBSOLETE register Request *InP = &Mess;
+// OBSOLETE
+// OBSOLETE InP->Head.msgh_bits = MACH_MSGH_BITS (MACH_MSG_TYPE_COPY_SEND, 0);
+// OBSOLETE
+// OBSOLETE /* msgh_size passed as argument */
+// OBSOLETE InP->Head.msgh_remote_port = our_message_port;
+// OBSOLETE InP->Head.msgh_local_port = MACH_PORT_NULL;
+// OBSOLETE InP->Head.msgh_seqno = 0;
+// OBSOLETE InP->Head.msgh_id = GDB_MESSAGE_ID_STOP;
+// OBSOLETE
+// OBSOLETE ret = mach_msg (&InP->Head,
+// OBSOLETE MACH_SEND_MSG | MACH_MSG_OPTION_NONE,
+// OBSOLETE sizeof (Request),
+// OBSOLETE 0,
+// OBSOLETE MACH_PORT_NULL,
+// OBSOLETE MACH_MSG_TIMEOUT_NONE,
+// OBSOLETE MACH_PORT_NULL);
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE #ifdef THREAD_ALLOWED_TO_BREAK
+// OBSOLETE /*
+// OBSOLETE * Return 1 if the MID specifies the thread that caused the
+// OBSOLETE * last exception.
+// OBSOLETE * Since catch_exception_raise() selects the thread causing
+// OBSOLETE * the last exception to current_thread, we just check that
+// OBSOLETE * it is selected and the last exception was a breakpoint.
+// OBSOLETE */
+// OBSOLETE int
+// OBSOLETE mach_thread_for_breakpoint (int mid)
+// OBSOLETE {
+// OBSOLETE int cmid = map_port_name_to_mid (current_thread, MACH_TYPE_THREAD);
+// OBSOLETE
+// OBSOLETE if (mid < 0)
+// OBSOLETE {
+// OBSOLETE mid = map_slot_to_mid (-(mid + 1), 0, 0);
+// OBSOLETE if (mid < 0)
+// OBSOLETE return 0; /* Don't stop, no such slot */
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE if (!mid || cmid == -1)
+// OBSOLETE return 1; /* stop */
+// OBSOLETE
+// OBSOLETE return cmid == mid && stop_exception == EXC_BREAKPOINT;
+// OBSOLETE }
+// OBSOLETE #endif /* THREAD_ALLOWED_TO_BREAK */
+// OBSOLETE
+// OBSOLETE #ifdef THREAD_PARSE_ID
+// OBSOLETE /*
+// OBSOLETE * Map a thread id string (MID or a @SLOTNUMBER)
+// OBSOLETE * to a thread-id.
+// OBSOLETE *
+// OBSOLETE * 0 matches all threads.
+// OBSOLETE * Otherwise the meaning is defined only in this file.
+// OBSOLETE * (mach_thread_for_breakpoint uses it)
+// OBSOLETE *
+// OBSOLETE * @@ This allows non-existent MIDs to be specified.
+// OBSOLETE * It now also allows non-existent slots to be
+// OBSOLETE * specified. (Slot numbers stored are negative,
+// OBSOLETE * and the magnitude is one greater than the actual
+// OBSOLETE * slot index. (Since 0 is reserved))
+// OBSOLETE */
+// OBSOLETE int
+// OBSOLETE mach_thread_parse_id (char *arg)
+// OBSOLETE {
+// OBSOLETE int mid;
+// OBSOLETE if (arg == 0)
+// OBSOLETE error ("thread id expected");
+// OBSOLETE mid = parse_thread_id (arg, 0, 1);
+// OBSOLETE
+// OBSOLETE return mid;
+// OBSOLETE }
+// OBSOLETE #endif /* THREAD_PARSE_ID */
+// OBSOLETE
+// OBSOLETE #ifdef THREAD_OUTPUT_ID
+// OBSOLETE char *
+// OBSOLETE mach_thread_output_id (int mid)
+// OBSOLETE {
+// OBSOLETE static char foobar[20];
+// OBSOLETE
+// OBSOLETE if (mid > 0)
+// OBSOLETE sprintf (foobar, "mid %d", mid);
+// OBSOLETE else if (mid < 0)
+// OBSOLETE sprintf (foobar, "@%d", -(mid + 1));
+// OBSOLETE else
+// OBSOLETE sprintf (foobar, "*any thread*");
+// OBSOLETE
+// OBSOLETE return foobar;
+// OBSOLETE }
+// OBSOLETE #endif /* THREAD_OUTPUT_ID */
+// OBSOLETE
+// OBSOLETE /* Called with hook PREPARE_TO_PROCEED() from infrun.c.
+// OBSOLETE
+// OBSOLETE * If we have switched threads and stopped at breakpoint return 1 otherwise 0.
+// OBSOLETE *
+// OBSOLETE * if SELECT_IT is nonzero, reselect the thread that was active when
+// OBSOLETE * we stopped at a breakpoint.
+// OBSOLETE *
+// OBSOLETE * Note that this implementation is potentially redundant now that
+// OBSOLETE * default_prepare_to_proceed() has been added.
+// OBSOLETE *
+// OBSOLETE * FIXME This may not support switching threads after Ctrl-C
+// OBSOLETE * correctly. The default implementation does support this.
+// OBSOLETE */
+// OBSOLETE
+// OBSOLETE mach3_prepare_to_proceed (int select_it)
+// OBSOLETE {
+// OBSOLETE if (stop_thread &&
+// OBSOLETE stop_thread != current_thread &&
+// OBSOLETE stop_exception == EXC_BREAKPOINT)
+// OBSOLETE {
+// OBSOLETE int mid;
+// OBSOLETE
+// OBSOLETE if (!select_it)
+// OBSOLETE return 1;
+// OBSOLETE
+// OBSOLETE mid = switch_to_thread (stop_thread);
+// OBSOLETE
+// OBSOLETE return 1;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE return 0;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE /* this stuff here is an upcall via libmach/excServer.c
+// OBSOLETE and mach_really_wait which does the actual upcall.
+// OBSOLETE
+// OBSOLETE The code will pass the exception to the inferior if:
+// OBSOLETE
+// OBSOLETE - The task that signaled is not the inferior task
+// OBSOLETE (e.g. when debugging another debugger)
+// OBSOLETE
+// OBSOLETE - The user has explicitely requested to pass on the exceptions.
+// OBSOLETE (e.g to the default unix exception handler, which maps
+// OBSOLETE exceptions to signals, or the user has her own exception handler)
+// OBSOLETE
+// OBSOLETE - If the thread that signaled is being single-stepped and it
+// OBSOLETE has set it's own exception port and the exception is not
+// OBSOLETE EXC_BREAKPOINT. (Maybe this is not desirable?)
+// OBSOLETE */
+// OBSOLETE
+// OBSOLETE kern_return_t
+// OBSOLETE catch_exception_raise (mach_port_t port, thread_t thread, task_t task,
+// OBSOLETE int exception, int code, int subcode)
+// OBSOLETE {
+// OBSOLETE kern_return_t ret;
+// OBSOLETE boolean_t signal_thread;
+// OBSOLETE int mid = map_port_name_to_mid (thread, MACH_TYPE_THREAD);
+// OBSOLETE
+// OBSOLETE if (!MACH_PORT_VALID (thread))
+// OBSOLETE {
+// OBSOLETE /* If the exception was sent and thread dies before we
+// OBSOLETE receive it, THREAD will be MACH_PORT_DEAD
+// OBSOLETE */
+// OBSOLETE
+// OBSOLETE current_thread = thread = MACH_PORT_NULL;
+// OBSOLETE error ("Received exception from nonexistent thread");
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE /* Check if the task died in transit.
+// OBSOLETE * @@ Isn't the thread also invalid in such case?
+// OBSOLETE */
+// OBSOLETE if (!MACH_PORT_VALID (task))
+// OBSOLETE {
+// OBSOLETE current_thread = thread = MACH_PORT_NULL;
+// OBSOLETE error ("Received exception from nonexistent task");
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE if (exception < 0 || exception > MAX_EXCEPTION)
+// OBSOLETE internal_error (__FILE__, __LINE__,
+// OBSOLETE "catch_exception_raise: unknown exception code %d thread %d",
+// OBSOLETE exception,
+// OBSOLETE mid);
+// OBSOLETE
+// OBSOLETE if (!MACH_PORT_VALID (inferior_task))
+// OBSOLETE error ("got an exception, but inferior_task is null or dead");
+// OBSOLETE
+// OBSOLETE stop_exception = exception;
+// OBSOLETE stop_code = code;
+// OBSOLETE stop_subcode = subcode;
+// OBSOLETE stop_thread = thread;
+// OBSOLETE
+// OBSOLETE signal_thread = exception != EXC_BREAKPOINT &&
+// OBSOLETE port == singlestepped_thread_port &&
+// OBSOLETE MACH_PORT_VALID (thread_saved_exception_port);
+// OBSOLETE
+// OBSOLETE /* If it was not our inferior or if we want to forward
+// OBSOLETE * the exception to the inferior's handler, do it here
+// OBSOLETE *
+// OBSOLETE * Note: If you have forwarded EXC_BREAKPOINT I trust you know why.
+// OBSOLETE */
+// OBSOLETE if (task != inferior_task ||
+// OBSOLETE signal_thread ||
+// OBSOLETE exception_map[exception].forward)
+// OBSOLETE {
+// OBSOLETE mach_port_t eport = inferior_old_exception_port;
+// OBSOLETE
+// OBSOLETE if (signal_thread)
+// OBSOLETE {
+// OBSOLETE /*
+// OBSOLETE GDB now forwards the exeption to thread's original handler,
+// OBSOLETE since the user propably knows what he is doing.
+// OBSOLETE Give a message, though.
+// OBSOLETE */
+// OBSOLETE
+// OBSOLETE mach3_exception_actions ((WAITTYPE *) NULL, TRUE, "Thread");
+// OBSOLETE eport = thread_saved_exception_port;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE /* Send the exception to the original handler */
+// OBSOLETE ret = exception_raise (eport,
+// OBSOLETE thread,
+// OBSOLETE task,
+// OBSOLETE exception,
+// OBSOLETE code,
+// OBSOLETE subcode);
+// OBSOLETE
+// OBSOLETE (void) mach_port_deallocate (mach_task_self (), task);
+// OBSOLETE (void) mach_port_deallocate (mach_task_self (), thread);
+// OBSOLETE
+// OBSOLETE /* If we come here, we don't want to trace any more, since we
+// OBSOLETE * will never stop for tracing anyway.
+// OBSOLETE */
+// OBSOLETE discard_single_step (thread);
+// OBSOLETE
+// OBSOLETE /* Do not stop the inferior */
+// OBSOLETE return ret;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE /* Now gdb handles the exception */
+// OBSOLETE stopped_in_exception = TRUE;
+// OBSOLETE
+// OBSOLETE ret = task_suspend (task);
+// OBSOLETE CHK ("Error suspending inferior after exception", ret);
+// OBSOLETE
+// OBSOLETE must_suspend_thread = 0;
+// OBSOLETE
+// OBSOLETE if (current_thread != thread)
+// OBSOLETE {
+// OBSOLETE if (MACH_PORT_VALID (singlestepped_thread_port))
+// OBSOLETE /* Cleanup discards single stepping */
+// OBSOLETE error ("Exception from thread %d while singlestepping thread %d",
+// OBSOLETE mid,
+// OBSOLETE map_port_name_to_mid (current_thread, MACH_TYPE_THREAD));
+// OBSOLETE
+// OBSOLETE /* Then select the thread that caused the exception */
+// OBSOLETE if (select_thread (inferior_task, mid, 0) != KERN_SUCCESS)
+// OBSOLETE error ("Could not select thread %d causing exception", mid);
+// OBSOLETE else
+// OBSOLETE warning ("Gdb selected thread %d", mid);
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE /* If we receive an exception that is not breakpoint
+// OBSOLETE * exception, we interrupt the single step and return to
+// OBSOLETE * debugger. Trace condition is cleared.
+// OBSOLETE */
+// OBSOLETE if (MACH_PORT_VALID (singlestepped_thread_port))
+// OBSOLETE {
+// OBSOLETE if (stop_exception != EXC_BREAKPOINT)
+// OBSOLETE warning ("Single step interrupted by exception");
+// OBSOLETE else if (port == singlestepped_thread_port)
+// OBSOLETE {
+// OBSOLETE /* Single step exception occurred, remove trace bit
+// OBSOLETE * and return to gdb.
+// OBSOLETE */
+// OBSOLETE if (!MACH_PORT_VALID (current_thread))
+// OBSOLETE error ("Single stepped thread is not valid");
+// OBSOLETE
+// OBSOLETE /* Resume threads, but leave the task suspended */
+// OBSOLETE resume_all_threads (0);
+// OBSOLETE }
+// OBSOLETE else
+// OBSOLETE warning ("Breakpoint while single stepping?");
+// OBSOLETE
+// OBSOLETE discard_single_step (current_thread);
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE (void) mach_port_deallocate (mach_task_self (), task);
+// OBSOLETE (void) mach_port_deallocate (mach_task_self (), thread);
+// OBSOLETE
+// OBSOLETE return KERN_SUCCESS;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE int
+// OBSOLETE port_valid (mach_port_t port, int mask)
+// OBSOLETE {
+// OBSOLETE kern_return_t ret;
+// OBSOLETE mach_port_type_t type;
+// OBSOLETE
+// OBSOLETE ret = mach_port_type (mach_task_self (),
+// OBSOLETE port,
+// OBSOLETE &type);
+// OBSOLETE if (ret != KERN_SUCCESS || (type & mask) != mask)
+// OBSOLETE return 0;
+// OBSOLETE return 1;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE /* @@ No vm read cache implemented yet */
+// OBSOLETE boolean_t vm_read_cache_valid = FALSE;
+// OBSOLETE
+// OBSOLETE /*
+// OBSOLETE * Read inferior task's LEN bytes from ADDR and copy it to MYADDR
+// OBSOLETE * in gdb's address space.
+// OBSOLETE *
+// OBSOLETE * Return 0 on failure; number of bytes read otherwise.
+// OBSOLETE */
+// OBSOLETE int
+// OBSOLETE mach3_read_inferior (CORE_ADDR addr, char *myaddr, int length)
+// OBSOLETE {
+// OBSOLETE kern_return_t ret;
+// OBSOLETE vm_address_t low_address = (vm_address_t) trunc_page (addr);
+// OBSOLETE vm_size_t aligned_length =
+// OBSOLETE (vm_size_t) round_page (addr + length) - low_address;
+// OBSOLETE pointer_t copied_memory;
+// OBSOLETE int copy_count;
+// OBSOLETE
+// OBSOLETE /* Get memory from inferior with page aligned addresses */
+// OBSOLETE ret = vm_read (inferior_task,
+// OBSOLETE low_address,
+// OBSOLETE aligned_length,
+// OBSOLETE &copied_memory,
+// OBSOLETE &copy_count);
+// OBSOLETE if (ret != KERN_SUCCESS)
+// OBSOLETE {
+// OBSOLETE /* the problem is that the inferior might be killed for whatever reason
+// OBSOLETE * before we go to mach_really_wait. This is one place that ought to
+// OBSOLETE * catch many of those errors.
+// OBSOLETE * @@ A better fix would be to make all external events to GDB
+// OBSOLETE * to arrive via a SINGLE port set. (Including user input!)
+// OBSOLETE */
+// OBSOLETE
+// OBSOLETE if (!port_valid (inferior_task, MACH_PORT_TYPE_SEND))
+// OBSOLETE {
+// OBSOLETE m3_kill_inferior ();
+// OBSOLETE error ("Inferior killed (task port invalid)");
+// OBSOLETE }
+// OBSOLETE else
+// OBSOLETE {
+// OBSOLETE #ifdef OSF
+// OBSOLETE extern int errno;
+// OBSOLETE /* valprint.c gives nicer format if this does not
+// OBSOLETE screw it. Eamonn seems to like this, so I enable
+// OBSOLETE it if OSF is defined...
+// OBSOLETE */
+// OBSOLETE warning ("[read inferior %x failed: %s]",
+// OBSOLETE addr, mach_error_string (ret));
+// OBSOLETE errno = 0;
+// OBSOLETE #endif
+// OBSOLETE return 0;
+// OBSOLETE }
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE memcpy (myaddr, (char *) addr - low_address + copied_memory, length);
+// OBSOLETE
+// OBSOLETE ret = vm_deallocate (mach_task_self (),
+// OBSOLETE copied_memory,
+// OBSOLETE copy_count);
+// OBSOLETE CHK ("mach3_read_inferior vm_deallocate failed", ret);
+// OBSOLETE
+// OBSOLETE return length;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE #define CHK_GOTO_OUT(str,ret) \
+// OBSOLETE do if (ret != KERN_SUCCESS) { errstr = #str; goto out; } while(0)
+// OBSOLETE
+// OBSOLETE struct vm_region_list
+// OBSOLETE {
+// OBSOLETE struct vm_region_list *next;
+// OBSOLETE vm_prot_t protection;
+// OBSOLETE vm_address_t start;
+// OBSOLETE vm_size_t length;
+// OBSOLETE };
+// OBSOLETE
+// OBSOLETE struct obstack region_obstack;
+// OBSOLETE
+// OBSOLETE /*
+// OBSOLETE * Write inferior task's LEN bytes from ADDR and copy it to MYADDR
+// OBSOLETE * in gdb's address space.
+// OBSOLETE */
+// OBSOLETE int
+// OBSOLETE mach3_write_inferior (CORE_ADDR addr, char *myaddr, int length)
+// OBSOLETE {
+// OBSOLETE kern_return_t ret;
+// OBSOLETE vm_address_t low_address = (vm_address_t) trunc_page (addr);
+// OBSOLETE vm_size_t aligned_length =
+// OBSOLETE (vm_size_t) round_page (addr + length) - low_address;
+// OBSOLETE pointer_t copied_memory;
+// OBSOLETE int copy_count;
+// OBSOLETE int deallocate = 0;
+// OBSOLETE
+// OBSOLETE char *errstr = "Bug in mach3_write_inferior";
+// OBSOLETE
+// OBSOLETE struct vm_region_list *region_element;
+// OBSOLETE struct vm_region_list *region_head = (struct vm_region_list *) NULL;
+// OBSOLETE
+// OBSOLETE /* Get memory from inferior with page aligned addresses */
+// OBSOLETE ret = vm_read (inferior_task,
+// OBSOLETE low_address,
+// OBSOLETE aligned_length,
+// OBSOLETE &copied_memory,
+// OBSOLETE &copy_count);
+// OBSOLETE CHK_GOTO_OUT ("mach3_write_inferior vm_read failed", ret);
+// OBSOLETE
+// OBSOLETE deallocate++;
+// OBSOLETE
+// OBSOLETE memcpy ((char *) addr - low_address + copied_memory, myaddr, length);
+// OBSOLETE
+// OBSOLETE obstack_init (&region_obstack);
+// OBSOLETE
+// OBSOLETE /* Do writes atomically.
+// OBSOLETE * First check for holes and unwritable memory.
+// OBSOLETE */
+// OBSOLETE {
+// OBSOLETE vm_size_t remaining_length = aligned_length;
+// OBSOLETE vm_address_t region_address = low_address;
+// OBSOLETE
+// OBSOLETE struct vm_region_list *scan;
+// OBSOLETE
+// OBSOLETE while (region_address < low_address + aligned_length)
+// OBSOLETE {
+// OBSOLETE vm_prot_t protection;
+// OBSOLETE vm_prot_t max_protection;
+// OBSOLETE vm_inherit_t inheritance;
+// OBSOLETE boolean_t shared;
+// OBSOLETE mach_port_t object_name;
+// OBSOLETE vm_offset_t offset;
+// OBSOLETE vm_size_t region_length = remaining_length;
+// OBSOLETE vm_address_t old_address = region_address;
+// OBSOLETE
+// OBSOLETE ret = vm_region (inferior_task,
+// OBSOLETE &region_address,
+// OBSOLETE &region_length,
+// OBSOLETE &protection,
+// OBSOLETE &max_protection,
+// OBSOLETE &inheritance,
+// OBSOLETE &shared,
+// OBSOLETE &object_name,
+// OBSOLETE &offset);
+// OBSOLETE CHK_GOTO_OUT ("vm_region failed", ret);
+// OBSOLETE
+// OBSOLETE /* Check for holes in memory */
+// OBSOLETE if (old_address != region_address)
+// OBSOLETE {
+// OBSOLETE warning ("No memory at 0x%x. Nothing written",
+// OBSOLETE old_address);
+// OBSOLETE ret = KERN_SUCCESS;
+// OBSOLETE length = 0;
+// OBSOLETE goto out;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE if (!(max_protection & VM_PROT_WRITE))
+// OBSOLETE {
+// OBSOLETE warning ("Memory at address 0x%x is unwritable. Nothing written",
+// OBSOLETE old_address);
+// OBSOLETE ret = KERN_SUCCESS;
+// OBSOLETE length = 0;
+// OBSOLETE goto out;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE /* Chain the regions for later use */
+// OBSOLETE region_element =
+// OBSOLETE (struct vm_region_list *)
+// OBSOLETE obstack_alloc (&region_obstack, sizeof (struct vm_region_list));
+// OBSOLETE
+// OBSOLETE region_element->protection = protection;
+// OBSOLETE region_element->start = region_address;
+// OBSOLETE region_element->length = region_length;
+// OBSOLETE
+// OBSOLETE /* Chain the regions along with protections */
+// OBSOLETE region_element->next = region_head;
+// OBSOLETE region_head = region_element;
+// OBSOLETE
+// OBSOLETE region_address += region_length;
+// OBSOLETE remaining_length = remaining_length - region_length;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE /* If things fail after this, we give up.
+// OBSOLETE * Somebody is messing up inferior_task's mappings.
+// OBSOLETE */
+// OBSOLETE
+// OBSOLETE /* Enable writes to the chained vm regions */
+// OBSOLETE for (scan = region_head; scan; scan = scan->next)
+// OBSOLETE {
+// OBSOLETE boolean_t protection_changed = FALSE;
+// OBSOLETE
+// OBSOLETE if (!(scan->protection & VM_PROT_WRITE))
+// OBSOLETE {
+// OBSOLETE ret = vm_protect (inferior_task,
+// OBSOLETE scan->start,
+// OBSOLETE scan->length,
+// OBSOLETE FALSE,
+// OBSOLETE scan->protection | VM_PROT_WRITE);
+// OBSOLETE CHK_GOTO_OUT ("vm_protect: enable write failed", ret);
+// OBSOLETE }
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE ret = vm_write (inferior_task,
+// OBSOLETE low_address,
+// OBSOLETE copied_memory,
+// OBSOLETE aligned_length);
+// OBSOLETE CHK_GOTO_OUT ("vm_write failed", ret);
+// OBSOLETE
+// OBSOLETE /* Set up the original region protections, if they were changed */
+// OBSOLETE for (scan = region_head; scan; scan = scan->next)
+// OBSOLETE {
+// OBSOLETE boolean_t protection_changed = FALSE;
+// OBSOLETE
+// OBSOLETE if (!(scan->protection & VM_PROT_WRITE))
+// OBSOLETE {
+// OBSOLETE ret = vm_protect (inferior_task,
+// OBSOLETE scan->start,
+// OBSOLETE scan->length,
+// OBSOLETE FALSE,
+// OBSOLETE scan->protection);
+// OBSOLETE CHK_GOTO_OUT ("vm_protect: enable write failed", ret);
+// OBSOLETE }
+// OBSOLETE }
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE out:
+// OBSOLETE if (deallocate)
+// OBSOLETE {
+// OBSOLETE obstack_free (&region_obstack, 0);
+// OBSOLETE
+// OBSOLETE (void) vm_deallocate (mach_task_self (),
+// OBSOLETE copied_memory,
+// OBSOLETE copy_count);
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE if (ret != KERN_SUCCESS)
+// OBSOLETE {
+// OBSOLETE warning ("%s %s", errstr, mach_error_string (ret));
+// OBSOLETE return 0;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE return length;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE /* Return 0 on failure, number of bytes handled otherwise. TARGET is
+// OBSOLETE ignored. */
+// OBSOLETE static int
+// OBSOLETE m3_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write,
+// OBSOLETE struct target_ops *target)
+// OBSOLETE {
+// OBSOLETE int result;
+// OBSOLETE
+// OBSOLETE if (write)
+// OBSOLETE result = mach3_write_inferior (memaddr, myaddr, len);
+// OBSOLETE else
+// OBSOLETE result = mach3_read_inferior (memaddr, myaddr, len);
+// OBSOLETE
+// OBSOLETE return result;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE
+// OBSOLETE static char *
+// OBSOLETE translate_state (int state)
+// OBSOLETE {
+// OBSOLETE switch (state)
+// OBSOLETE {
+// OBSOLETE case TH_STATE_RUNNING:
+// OBSOLETE return ("R");
+// OBSOLETE case TH_STATE_STOPPED:
+// OBSOLETE return ("S");
+// OBSOLETE case TH_STATE_WAITING:
+// OBSOLETE return ("W");
+// OBSOLETE case TH_STATE_UNINTERRUPTIBLE:
+// OBSOLETE return ("U");
+// OBSOLETE case TH_STATE_HALTED:
+// OBSOLETE return ("H");
+// OBSOLETE default:
+// OBSOLETE return ("?");
+// OBSOLETE }
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE static char *
+// OBSOLETE translate_cstate (int state)
+// OBSOLETE {
+// OBSOLETE switch (state)
+// OBSOLETE {
+// OBSOLETE case CPROC_RUNNING:
+// OBSOLETE return "R";
+// OBSOLETE case CPROC_SWITCHING:
+// OBSOLETE return "S";
+// OBSOLETE case CPROC_BLOCKED:
+// OBSOLETE return "B";
+// OBSOLETE case CPROC_CONDWAIT:
+// OBSOLETE return "C";
+// OBSOLETE case CPROC_CONDWAIT | CPROC_SWITCHING:
+// OBSOLETE return "CS";
+// OBSOLETE default:
+// OBSOLETE return "?";
+// OBSOLETE }
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE /* type == MACH_MSG_TYPE_COPY_SEND || type == MACH_MSG_TYPE_MAKE_SEND */
+// OBSOLETE
+// OBSOLETE mach_port_t /* no mach_port_name_t found in include files. */
+// OBSOLETE map_inferior_port_name (mach_port_t inferior_name, mach_msg_type_name_t type)
+// OBSOLETE {
+// OBSOLETE kern_return_t ret;
+// OBSOLETE mach_msg_type_name_t acquired;
+// OBSOLETE mach_port_t iport;
+// OBSOLETE
+// OBSOLETE ret = mach_port_extract_right (inferior_task,
+// OBSOLETE inferior_name,
+// OBSOLETE type,
+// OBSOLETE &iport,
+// OBSOLETE &acquired);
+// OBSOLETE CHK ("mach_port_extract_right (map_inferior_port_name)", ret);
+// OBSOLETE
+// OBSOLETE if (acquired != MACH_MSG_TYPE_PORT_SEND)
+// OBSOLETE error ("Incorrect right extracted, (map_inferior_port_name)");
+// OBSOLETE
+// OBSOLETE ret = mach_port_deallocate (mach_task_self (),
+// OBSOLETE iport);
+// OBSOLETE CHK ("Deallocating mapped port (map_inferior_port_name)", ret);
+// OBSOLETE
+// OBSOLETE return iport;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE /*
+// OBSOLETE * Naming convention:
+// OBSOLETE * Always return user defined name if found.
+// OBSOLETE * _K == A kernel thread with no matching CPROC
+// OBSOLETE * _C == A cproc with no current cthread
+// OBSOLETE * _t == A cthread with no user defined name
+// OBSOLETE *
+// OBSOLETE * The digits that follow the _names are the SLOT number of the
+// OBSOLETE * kernel thread if there is such a thing, otherwise just a negation
+// OBSOLETE * of the sequential number of such cprocs.
+// OBSOLETE */
+// OBSOLETE
+// OBSOLETE static char buf[7];
+// OBSOLETE
+// OBSOLETE static char *
+// OBSOLETE get_thread_name (gdb_thread_t one_cproc, int id)
+// OBSOLETE {
+// OBSOLETE if (one_cproc)
+// OBSOLETE if (one_cproc->cthread == NULL)
+// OBSOLETE {
+// OBSOLETE /* cproc not mapped to any cthread */
+// OBSOLETE sprintf (buf, "_C%d", id);
+// OBSOLETE }
+// OBSOLETE else if (!one_cproc->cthread->name)
+// OBSOLETE {
+// OBSOLETE /* cproc and cthread, but no name */
+// OBSOLETE sprintf (buf, "_t%d", id);
+// OBSOLETE }
+// OBSOLETE else
+// OBSOLETE return (char *) (one_cproc->cthread->name);
+// OBSOLETE else
+// OBSOLETE {
+// OBSOLETE if (id < 0)
+// OBSOLETE warning ("Inconsistency in thread name id %d", id);
+// OBSOLETE
+// OBSOLETE /* Kernel thread without cproc */
+// OBSOLETE sprintf (buf, "_K%d", id);
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE return buf;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE int
+// OBSOLETE fetch_thread_info (mach_port_t task, gdb_thread_t *mthreads_out)
+// OBSOLETE {
+// OBSOLETE kern_return_t ret;
+// OBSOLETE thread_array_t th_table;
+// OBSOLETE int th_count;
+// OBSOLETE gdb_thread_t mthreads = NULL;
+// OBSOLETE int index;
+// OBSOLETE
+// OBSOLETE ret = task_threads (task, &th_table, &th_count);
+// OBSOLETE if (ret != KERN_SUCCESS)
+// OBSOLETE {
+// OBSOLETE warning ("Error getting inferior's thread list:%s",
+// OBSOLETE mach_error_string (ret));
+// OBSOLETE m3_kill_inferior ();
+// OBSOLETE return -1;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE mthreads = (gdb_thread_t)
+// OBSOLETE obstack_alloc
+// OBSOLETE (cproc_obstack,
+// OBSOLETE th_count * sizeof (struct gdb_thread));
+// OBSOLETE
+// OBSOLETE for (index = 0; index < th_count; index++)
+// OBSOLETE {
+// OBSOLETE thread_t saved_thread = MACH_PORT_NULL;
+// OBSOLETE int mid;
+// OBSOLETE
+// OBSOLETE if (must_suspend_thread)
+// OBSOLETE setup_thread (th_table[index], 1);
+// OBSOLETE
+// OBSOLETE if (th_table[index] != current_thread)
+// OBSOLETE {
+// OBSOLETE saved_thread = current_thread;
+// OBSOLETE
+// OBSOLETE mid = switch_to_thread (th_table[index]);
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE mthreads[index].name = th_table[index];
+// OBSOLETE mthreads[index].cproc = NULL; /* map_cprocs_to_kernel_threads() */
+// OBSOLETE mthreads[index].in_emulator = FALSE;
+// OBSOLETE mthreads[index].slotid = index;
+// OBSOLETE
+// OBSOLETE mthreads[index].sp = read_register (SP_REGNUM);
+// OBSOLETE mthreads[index].fp = read_register (FP_REGNUM);
+// OBSOLETE mthreads[index].pc = read_pc ();
+// OBSOLETE
+// OBSOLETE if (MACH_PORT_VALID (saved_thread))
+// OBSOLETE mid = switch_to_thread (saved_thread);
+// OBSOLETE
+// OBSOLETE if (must_suspend_thread)
+// OBSOLETE setup_thread (th_table[index], 0);
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE consume_send_rights (th_table, th_count);
+// OBSOLETE ret = vm_deallocate (mach_task_self (), (vm_address_t) th_table,
+// OBSOLETE (th_count * sizeof (mach_port_t)));
+// OBSOLETE if (ret != KERN_SUCCESS)
+// OBSOLETE {
+// OBSOLETE warning ("Error trying to deallocate thread list : %s",
+// OBSOLETE mach_error_string (ret));
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE *mthreads_out = mthreads;
+// OBSOLETE
+// OBSOLETE return th_count;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE
+// OBSOLETE /*
+// OBSOLETE * Current emulator always saves the USP on top of
+// OBSOLETE * emulator stack below struct emul_stack_top stuff.
+// OBSOLETE */
+// OBSOLETE CORE_ADDR
+// OBSOLETE fetch_usp_from_emulator_stack (CORE_ADDR sp)
+// OBSOLETE {
+// OBSOLETE CORE_ADDR stack_pointer;
+// OBSOLETE
+// OBSOLETE sp = (sp & ~(EMULATOR_STACK_SIZE - 1)) +
+// OBSOLETE EMULATOR_STACK_SIZE - sizeof (struct emul_stack_top);
+// OBSOLETE
+// OBSOLETE if (mach3_read_inferior (sp,
+// OBSOLETE &stack_pointer,
+// OBSOLETE sizeof (CORE_ADDR)) != sizeof (CORE_ADDR))
+// OBSOLETE {
+// OBSOLETE warning ("Can't read user sp from emulator stack address 0x%x", sp);
+// OBSOLETE return 0;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE return stack_pointer;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE #ifdef MK67
+// OBSOLETE
+// OBSOLETE /* get_emulation_vector() interface was changed after mk67 */
+// OBSOLETE #define EMUL_VECTOR_COUNT 400 /* Value does not matter too much */
+// OBSOLETE
+// OBSOLETE #endif /* MK67 */
+// OBSOLETE
+// OBSOLETE /* Check if the emulator exists at task's address space.
+// OBSOLETE */
+// OBSOLETE boolean_t
+// OBSOLETE have_emulator_p (task_t task)
+// OBSOLETE {
+// OBSOLETE kern_return_t ret;
+// OBSOLETE #ifndef EMUL_VECTOR_COUNT
+// OBSOLETE vm_offset_t *emulation_vector;
+// OBSOLETE int n;
+// OBSOLETE #else
+// OBSOLETE vm_offset_t emulation_vector[EMUL_VECTOR_COUNT];
+// OBSOLETE int n = EMUL_VECTOR_COUNT;
+// OBSOLETE #endif
+// OBSOLETE int i;
+// OBSOLETE int vector_start;
+// OBSOLETE
+// OBSOLETE ret = task_get_emulation_vector (task,
+// OBSOLETE &vector_start,
+// OBSOLETE #ifndef EMUL_VECTOR_COUNT
+// OBSOLETE &emulation_vector,
+// OBSOLETE #else
+// OBSOLETE emulation_vector,
+// OBSOLETE #endif
+// OBSOLETE &n);
+// OBSOLETE CHK ("task_get_emulation_vector", ret);
+// OBSOLETE xx_debug ("%d vectors from %d at 0x%08x\n",
+// OBSOLETE n, vector_start, emulation_vector);
+// OBSOLETE
+// OBSOLETE for (i = 0; i < n; i++)
+// OBSOLETE {
+// OBSOLETE vm_offset_t entry = emulation_vector[i];
+// OBSOLETE
+// OBSOLETE if (EMULATOR_BASE <= entry && entry <= EMULATOR_END)
+// OBSOLETE return TRUE;
+// OBSOLETE else if (entry)
+// OBSOLETE {
+// OBSOLETE static boolean_t informed = FALSE;
+// OBSOLETE if (!informed)
+// OBSOLETE {
+// OBSOLETE warning ("Emulation vector address 0x08%x outside emulator space",
+// OBSOLETE entry);
+// OBSOLETE informed = TRUE;
+// OBSOLETE }
+// OBSOLETE }
+// OBSOLETE }
+// OBSOLETE return FALSE;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE /* Map cprocs to kernel threads and vice versa. */
+// OBSOLETE
+// OBSOLETE void
+// OBSOLETE map_cprocs_to_kernel_threads (gdb_thread_t cprocs, gdb_thread_t mthreads,
+// OBSOLETE int thread_count)
+// OBSOLETE {
+// OBSOLETE int index;
+// OBSOLETE gdb_thread_t scan;
+// OBSOLETE boolean_t all_mapped = TRUE;
+// OBSOLETE LONGEST stack_base;
+// OBSOLETE LONGEST stack_size;
+// OBSOLETE
+// OBSOLETE for (scan = cprocs; scan; scan = scan->next)
+// OBSOLETE {
+// OBSOLETE /* Default to: no kernel thread for this cproc */
+// OBSOLETE scan->reverse_map = -1;
+// OBSOLETE
+// OBSOLETE /* Check if the cproc is found by its stack */
+// OBSOLETE for (index = 0; index < thread_count; index++)
+// OBSOLETE {
+// OBSOLETE stack_base =
+// OBSOLETE extract_signed_integer (scan->raw_cproc + CPROC_BASE_OFFSET,
+// OBSOLETE CPROC_BASE_SIZE);
+// OBSOLETE stack_size =
+// OBSOLETE extract_signed_integer (scan->raw_cproc + CPROC_SIZE_OFFSET,
+// OBSOLETE CPROC_SIZE_SIZE);
+// OBSOLETE if ((mthreads + index)->sp > stack_base &&
+// OBSOLETE (mthreads + index)->sp <= stack_base + stack_size)
+// OBSOLETE {
+// OBSOLETE (mthreads + index)->cproc = scan;
+// OBSOLETE scan->reverse_map = index;
+// OBSOLETE break;
+// OBSOLETE }
+// OBSOLETE }
+// OBSOLETE all_mapped &= (scan->reverse_map != -1);
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE /* Check for threads that are currently in the emulator.
+// OBSOLETE * If so, they have a different stack, and the still unmapped
+// OBSOLETE * cprocs may well get mapped to these threads.
+// OBSOLETE *
+// OBSOLETE * If:
+// OBSOLETE * - cproc stack does not match any kernel thread stack pointer
+// OBSOLETE * - there is at least one extra kernel thread
+// OBSOLETE * that has no cproc mapped above.
+// OBSOLETE * - some kernel thread stack pointer points to emulator space
+// OBSOLETE * then we find the user stack pointer saved in the emulator
+// OBSOLETE * stack, and try to map that to the cprocs.
+// OBSOLETE *
+// OBSOLETE * Also set in_emulator for kernel threads.
+// OBSOLETE */
+// OBSOLETE
+// OBSOLETE if (emulator_present)
+// OBSOLETE {
+// OBSOLETE for (index = 0; index < thread_count; index++)
+// OBSOLETE {
+// OBSOLETE CORE_ADDR emul_sp;
+// OBSOLETE CORE_ADDR usp;
+// OBSOLETE
+// OBSOLETE gdb_thread_t mthread = (mthreads + index);
+// OBSOLETE emul_sp = mthread->sp;
+// OBSOLETE
+// OBSOLETE if (mthread->cproc == NULL &&
+// OBSOLETE EMULATOR_BASE <= emul_sp && emul_sp <= EMULATOR_END)
+// OBSOLETE {
+// OBSOLETE mthread->in_emulator = emulator_present;
+// OBSOLETE
+// OBSOLETE if (!all_mapped && cprocs)
+// OBSOLETE {
+// OBSOLETE usp = fetch_usp_from_emulator_stack (emul_sp);
+// OBSOLETE
+// OBSOLETE /* @@ Could be more accurate */
+// OBSOLETE if (!usp)
+// OBSOLETE error ("Zero stack pointer read from emulator?");
+// OBSOLETE
+// OBSOLETE /* Try to match this stack pointer to the cprocs that
+// OBSOLETE * don't yet have a kernel thread.
+// OBSOLETE */
+// OBSOLETE for (scan = cprocs; scan; scan = scan->next)
+// OBSOLETE {
+// OBSOLETE
+// OBSOLETE /* Check is this unmapped CPROC stack contains
+// OBSOLETE * the user stack pointer saved in the
+// OBSOLETE * emulator.
+// OBSOLETE */
+// OBSOLETE if (scan->reverse_map == -1)
+// OBSOLETE {
+// OBSOLETE stack_base =
+// OBSOLETE extract_signed_integer
+// OBSOLETE (scan->raw_cproc + CPROC_BASE_OFFSET,
+// OBSOLETE CPROC_BASE_SIZE);
+// OBSOLETE stack_size =
+// OBSOLETE extract_signed_integer
+// OBSOLETE (scan->raw_cproc + CPROC_SIZE_OFFSET,
+// OBSOLETE CPROC_SIZE_SIZE);
+// OBSOLETE if (usp > stack_base &&
+// OBSOLETE usp <= stack_base + stack_size)
+// OBSOLETE {
+// OBSOLETE mthread->cproc = scan;
+// OBSOLETE scan->reverse_map = index;
+// OBSOLETE break;
+// OBSOLETE }
+// OBSOLETE }
+// OBSOLETE }
+// OBSOLETE }
+// OBSOLETE }
+// OBSOLETE }
+// OBSOLETE }
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE /*
+// OBSOLETE * Format of the thread_list command
+// OBSOLETE *
+// OBSOLETE * slot mid sel name emul ks susp cstate wired address
+// OBSOLETE */
+// OBSOLETE #define TL_FORMAT "%-2.2s %5d%c %-10.10s %1.1s%s%-5.5s %-2.2s %-5.5s "
+// OBSOLETE
+// OBSOLETE #define TL_HEADER "\n@ MID Name KState CState Where\n"
+// OBSOLETE
+// OBSOLETE void
+// OBSOLETE print_tl_address (struct ui_file *stream, CORE_ADDR pc)
+// OBSOLETE {
+// OBSOLETE if (!lookup_minimal_symbol_by_pc (pc))
+// OBSOLETE fprintf_filtered (stream, local_hex_format (), pc);
+// OBSOLETE else
+// OBSOLETE {
+// OBSOLETE extern int addressprint;
+// OBSOLETE extern int asm_demangle;
+// OBSOLETE
+// OBSOLETE int store = addressprint;
+// OBSOLETE addressprint = 0;
+// OBSOLETE print_address_symbolic (pc, stream, asm_demangle, "");
+// OBSOLETE addressprint = store;
+// OBSOLETE }
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE /* For thread names, but also for gdb_message_port external name */
+// OBSOLETE #define MAX_NAME_LEN 50
+// OBSOLETE
+// OBSOLETE /* Returns the address of variable NAME or 0 if not found */
+// OBSOLETE CORE_ADDR
+// OBSOLETE lookup_address_of_variable (char *name)
+// OBSOLETE {
+// OBSOLETE struct symbol *sym;
+// OBSOLETE CORE_ADDR symaddr = 0;
+// OBSOLETE struct minimal_symbol *msymbol;
+// OBSOLETE
+// OBSOLETE sym = lookup_symbol (name,
+// OBSOLETE (struct block *) NULL,
+// OBSOLETE VAR_NAMESPACE,
+// OBSOLETE (int *) NULL,
+// OBSOLETE (struct symtab **) NULL);
+// OBSOLETE
+// OBSOLETE if (sym)
+// OBSOLETE symaddr = SYMBOL_VALUE (sym);
+// OBSOLETE
+// OBSOLETE if (!symaddr)
+// OBSOLETE {
+// OBSOLETE msymbol = lookup_minimal_symbol (name, NULL, NULL);
+// OBSOLETE
+// OBSOLETE if (msymbol && msymbol->type == mst_data)
+// OBSOLETE symaddr = SYMBOL_VALUE_ADDRESS (msymbol);
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE return symaddr;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE static gdb_thread_t
+// OBSOLETE get_cprocs (void)
+// OBSOLETE {
+// OBSOLETE gdb_thread_t cproc_head;
+// OBSOLETE gdb_thread_t cproc_copy;
+// OBSOLETE CORE_ADDR their_cprocs;
+// OBSOLETE char *buf;
+// OBSOLETE char *name;
+// OBSOLETE cthread_t cthread;
+// OBSOLETE CORE_ADDR symaddr;
+// OBSOLETE
+// OBSOLETE buf = alloca (TARGET_PTR_BIT / HOST_CHAR_BIT);
+// OBSOLETE symaddr = lookup_address_of_variable ("cproc_list");
+// OBSOLETE
+// OBSOLETE if (!symaddr)
+// OBSOLETE {
+// OBSOLETE /* cproc_list is not in a file compiled with debugging
+// OBSOLETE symbols, but don't give up yet */
+// OBSOLETE
+// OBSOLETE symaddr = lookup_address_of_variable ("cprocs");
+// OBSOLETE
+// OBSOLETE if (symaddr)
+// OBSOLETE {
+// OBSOLETE static int informed = 0;
+// OBSOLETE if (!informed)
+// OBSOLETE {
+// OBSOLETE informed++;
+// OBSOLETE warning ("Your program is loaded with an old threads library.");
+// OBSOLETE warning ("GDB does not know the old form of threads");
+// OBSOLETE warning ("so things may not work.");
+// OBSOLETE }
+// OBSOLETE }
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE /* Stripped or no -lthreads loaded or "cproc_list" is in wrong segment. */
+// OBSOLETE if (!symaddr)
+// OBSOLETE return NULL;
+// OBSOLETE
+// OBSOLETE /* Get the address of the first cproc in the task */
+// OBSOLETE if (!mach3_read_inferior (symaddr,
+// OBSOLETE buf,
+// OBSOLETE TARGET_PTR_BIT / HOST_CHAR_BIT))
+// OBSOLETE error ("Can't read cproc master list at address (0x%x).", symaddr);
+// OBSOLETE their_cprocs = extract_address (buf, TARGET_PTR_BIT / HOST_CHAR_BIT);
+// OBSOLETE
+// OBSOLETE /* Scan the CPROCs in the task.
+// OBSOLETE CPROCs are chained with LIST field, not NEXT field, which
+// OBSOLETE chains mutexes, condition variables and queues */
+// OBSOLETE
+// OBSOLETE cproc_head = NULL;
+// OBSOLETE
+// OBSOLETE while (their_cprocs != (CORE_ADDR) 0)
+// OBSOLETE {
+// OBSOLETE CORE_ADDR cproc_copy_incarnation;
+// OBSOLETE cproc_copy = (gdb_thread_t) obstack_alloc (cproc_obstack,
+// OBSOLETE sizeof (struct gdb_thread));
+// OBSOLETE
+// OBSOLETE if (!mach3_read_inferior (their_cprocs,
+// OBSOLETE &cproc_copy->raw_cproc[0],
+// OBSOLETE CPROC_SIZE))
+// OBSOLETE error ("Can't read next cproc at 0x%x.", their_cprocs);
+// OBSOLETE
+// OBSOLETE their_cprocs =
+// OBSOLETE extract_address (cproc_copy->raw_cproc + CPROC_LIST_OFFSET,
+// OBSOLETE CPROC_LIST_SIZE);
+// OBSOLETE cproc_copy_incarnation =
+// OBSOLETE extract_address (cproc_copy->raw_cproc + CPROC_INCARNATION_OFFSET,
+// OBSOLETE CPROC_INCARNATION_SIZE);
+// OBSOLETE
+// OBSOLETE if (cproc_copy_incarnation == (CORE_ADDR) 0)
+// OBSOLETE cproc_copy->cthread = NULL;
+// OBSOLETE else
+// OBSOLETE {
+// OBSOLETE /* This CPROC has an attached CTHREAD. Get its name */
+// OBSOLETE cthread = (cthread_t) obstack_alloc (cproc_obstack,
+// OBSOLETE sizeof (struct cthread));
+// OBSOLETE
+// OBSOLETE if (!mach3_read_inferior (cproc_copy_incarnation,
+// OBSOLETE cthread,
+// OBSOLETE sizeof (struct cthread)))
+// OBSOLETE error ("Can't read next thread at 0x%x.",
+// OBSOLETE cproc_copy_incarnation);
+// OBSOLETE
+// OBSOLETE cproc_copy->cthread = cthread;
+// OBSOLETE
+// OBSOLETE if (cthread->name)
+// OBSOLETE {
+// OBSOLETE name = (char *) obstack_alloc (cproc_obstack, MAX_NAME_LEN);
+// OBSOLETE
+// OBSOLETE if (!mach3_read_inferior (cthread->name, name, MAX_NAME_LEN))
+// OBSOLETE error ("Can't read next thread's name at 0x%x.", cthread->name);
+// OBSOLETE
+// OBSOLETE cthread->name = name;
+// OBSOLETE }
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE /* insert in front */
+// OBSOLETE cproc_copy->next = cproc_head;
+// OBSOLETE cproc_head = cproc_copy;
+// OBSOLETE }
+// OBSOLETE return cproc_head;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE #ifndef FETCH_CPROC_STATE
+// OBSOLETE /*
+// OBSOLETE * Check if your machine does not grok the way this routine
+// OBSOLETE * fetches the FP,PC and SP of a cproc that is not
+// OBSOLETE * currently attached to any kernel thread (e.g. its cproc.context
+// OBSOLETE * field points to the place in stack where the context
+// OBSOLETE * is saved).
+// OBSOLETE *
+// OBSOLETE * If it doesn't, define your own routine.
+// OBSOLETE */
+// OBSOLETE #define FETCH_CPROC_STATE(mth) mach3_cproc_state (mth)
+// OBSOLETE
+// OBSOLETE int
+// OBSOLETE mach3_cproc_state (gdb_thread_t mthread)
+// OBSOLETE {
+// OBSOLETE int context;
+// OBSOLETE
+// OBSOLETE if (!mthread || !mthread->cproc)
+// OBSOLETE return -1;
+// OBSOLETE
+// OBSOLETE context = extract_signed_integer
+// OBSOLETE (mthread->cproc->raw_cproc + CPROC_CONTEXT_OFFSET,
+// OBSOLETE CPROC_CONTEXT_SIZE);
+// OBSOLETE if (context == 0)
+// OBSOLETE return -1;
+// OBSOLETE
+// OBSOLETE mthread->sp = context + MACHINE_CPROC_SP_OFFSET;
+// OBSOLETE
+// OBSOLETE if (mach3_read_inferior (context + MACHINE_CPROC_PC_OFFSET,
+// OBSOLETE &mthread->pc,
+// OBSOLETE sizeof (CORE_ADDR)) != sizeof (CORE_ADDR))
+// OBSOLETE {
+// OBSOLETE warning ("Can't read cproc pc from inferior");
+// OBSOLETE return -1;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE if (mach3_read_inferior (context + MACHINE_CPROC_FP_OFFSET,
+// OBSOLETE &mthread->fp,
+// OBSOLETE sizeof (CORE_ADDR)) != sizeof (CORE_ADDR))
+// OBSOLETE {
+// OBSOLETE warning ("Can't read cproc fp from inferior");
+// OBSOLETE return -1;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE return 0;
+// OBSOLETE }
+// OBSOLETE #endif /* FETCH_CPROC_STATE */
+// OBSOLETE
+// OBSOLETE
+// OBSOLETE void
+// OBSOLETE thread_list_command (void)
+// OBSOLETE {
+// OBSOLETE thread_basic_info_data_t ths;
+// OBSOLETE int thread_count;
+// OBSOLETE gdb_thread_t cprocs;
+// OBSOLETE gdb_thread_t scan;
+// OBSOLETE int index;
+// OBSOLETE char *name;
+// OBSOLETE char selected;
+// OBSOLETE char *wired;
+// OBSOLETE int infoCnt;
+// OBSOLETE kern_return_t ret;
+// OBSOLETE mach_port_t mid_or_port;
+// OBSOLETE gdb_thread_t their_threads;
+// OBSOLETE gdb_thread_t kthread;
+// OBSOLETE
+// OBSOLETE int neworder = 1;
+// OBSOLETE
+// OBSOLETE char *fmt = "There are %d kernel threads in task %d.\n";
+// OBSOLETE
+// OBSOLETE int tmid = map_port_name_to_mid (inferior_task, MACH_TYPE_TASK);
+// OBSOLETE
+// OBSOLETE MACH_ERROR_NO_INFERIOR;
+// OBSOLETE
+// OBSOLETE thread_count = fetch_thread_info (inferior_task,
+// OBSOLETE &their_threads);
+// OBSOLETE if (thread_count == -1)
+// OBSOLETE return;
+// OBSOLETE
+// OBSOLETE if (thread_count == 1)
+// OBSOLETE fmt = "There is %d kernel thread in task %d.\n";
+// OBSOLETE
+// OBSOLETE printf_filtered (fmt, thread_count, tmid);
+// OBSOLETE
+// OBSOLETE puts_filtered (TL_HEADER);
+// OBSOLETE
+// OBSOLETE cprocs = get_cprocs ();
+// OBSOLETE
+// OBSOLETE map_cprocs_to_kernel_threads (cprocs, their_threads, thread_count);
+// OBSOLETE
+// OBSOLETE for (scan = cprocs; scan; scan = scan->next)
+// OBSOLETE {
+// OBSOLETE int mid;
+// OBSOLETE char buf[10];
+// OBSOLETE char slot[3];
+// OBSOLETE int cproc_state =
+// OBSOLETE extract_signed_integer
+// OBSOLETE (scan->raw_cproc + CPROC_STATE_OFFSET, CPROC_STATE_SIZE);
+// OBSOLETE
+// OBSOLETE selected = ' ';
+// OBSOLETE
+// OBSOLETE /* a wired cproc? */
+// OBSOLETE wired = (extract_address (scan->raw_cproc + CPROC_WIRED_OFFSET,
+// OBSOLETE CPROC_WIRED_SIZE)
+// OBSOLETE ? "wired" : "");
+// OBSOLETE
+// OBSOLETE if (scan->reverse_map != -1)
+// OBSOLETE kthread = (their_threads + scan->reverse_map);
+// OBSOLETE else
+// OBSOLETE kthread = NULL;
+// OBSOLETE
+// OBSOLETE if (kthread)
+// OBSOLETE {
+// OBSOLETE /* These cprocs have a kernel thread */
+// OBSOLETE
+// OBSOLETE mid = map_port_name_to_mid (kthread->name, MACH_TYPE_THREAD);
+// OBSOLETE
+// OBSOLETE infoCnt = THREAD_BASIC_INFO_COUNT;
+// OBSOLETE
+// OBSOLETE ret = thread_info (kthread->name,
+// OBSOLETE THREAD_BASIC_INFO,
+// OBSOLETE (thread_info_t) & ths,
+// OBSOLETE &infoCnt);
+// OBSOLETE
+// OBSOLETE if (ret != KERN_SUCCESS)
+// OBSOLETE {
+// OBSOLETE warning ("Unable to get basic info on thread %d : %s",
+// OBSOLETE mid,
+// OBSOLETE mach_error_string (ret));
+// OBSOLETE continue;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE /* Who is the first to have more than 100 threads */
+// OBSOLETE sprintf (slot, "%d", kthread->slotid % 100);
+// OBSOLETE
+// OBSOLETE if (kthread->name == current_thread)
+// OBSOLETE selected = '*';
+// OBSOLETE
+// OBSOLETE if (ths.suspend_count)
+// OBSOLETE sprintf (buf, "%d", ths.suspend_count);
+// OBSOLETE else
+// OBSOLETE buf[0] = '\000';
+// OBSOLETE
+// OBSOLETE #if 0
+// OBSOLETE if (ths.flags & TH_FLAGS_SWAPPED)
+// OBSOLETE strcat (buf, "S");
+// OBSOLETE #endif
+// OBSOLETE
+// OBSOLETE if (ths.flags & TH_FLAGS_IDLE)
+// OBSOLETE strcat (buf, "I");
+// OBSOLETE
+// OBSOLETE printf_filtered (TL_FORMAT,
+// OBSOLETE slot,
+// OBSOLETE mid,
+// OBSOLETE selected,
+// OBSOLETE get_thread_name (scan, kthread->slotid),
+// OBSOLETE kthread->in_emulator ? "E" : "",
+// OBSOLETE translate_state (ths.run_state),
+// OBSOLETE buf,
+// OBSOLETE translate_cstate (cproc_state),
+// OBSOLETE wired);
+// OBSOLETE print_tl_address (gdb_stdout, kthread->pc);
+// OBSOLETE }
+// OBSOLETE else
+// OBSOLETE {
+// OBSOLETE /* These cprocs don't have a kernel thread.
+// OBSOLETE * find out the calling frame with
+// OBSOLETE * FETCH_CPROC_STATE.
+// OBSOLETE */
+// OBSOLETE
+// OBSOLETE struct gdb_thread state;
+// OBSOLETE
+// OBSOLETE #if 0
+// OBSOLETE /* jtv -> emcmanus: why do you want this here? */
+// OBSOLETE if (scan->incarnation == NULL)
+// OBSOLETE continue; /* EMcM */
+// OBSOLETE #endif
+// OBSOLETE
+// OBSOLETE printf_filtered (TL_FORMAT,
+// OBSOLETE "-",
+// OBSOLETE -neworder, /* Pseudo MID */
+// OBSOLETE selected,
+// OBSOLETE get_thread_name (scan, -neworder),
+// OBSOLETE "",
+// OBSOLETE "-", /* kernel state */
+// OBSOLETE "",
+// OBSOLETE translate_cstate (cproc_state),
+// OBSOLETE "");
+// OBSOLETE state.cproc = scan;
+// OBSOLETE
+// OBSOLETE if (FETCH_CPROC_STATE (&state) == -1)
+// OBSOLETE puts_filtered ("???");
+// OBSOLETE else
+// OBSOLETE print_tl_address (gdb_stdout, state.pc);
+// OBSOLETE
+// OBSOLETE neworder++;
+// OBSOLETE }
+// OBSOLETE puts_filtered ("\n");
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE /* Scan for kernel threads without cprocs */
+// OBSOLETE for (index = 0; index < thread_count; index++)
+// OBSOLETE {
+// OBSOLETE if (!their_threads[index].cproc)
+// OBSOLETE {
+// OBSOLETE int mid;
+// OBSOLETE
+// OBSOLETE char buf[10];
+// OBSOLETE char slot[3];
+// OBSOLETE
+// OBSOLETE mach_port_t name = their_threads[index].name;
+// OBSOLETE
+// OBSOLETE mid = map_port_name_to_mid (name, MACH_TYPE_THREAD);
+// OBSOLETE
+// OBSOLETE infoCnt = THREAD_BASIC_INFO_COUNT;
+// OBSOLETE
+// OBSOLETE ret = thread_info (name,
+// OBSOLETE THREAD_BASIC_INFO,
+// OBSOLETE (thread_info_t) & ths,
+// OBSOLETE &infoCnt);
+// OBSOLETE
+// OBSOLETE if (ret != KERN_SUCCESS)
+// OBSOLETE {
+// OBSOLETE warning ("Unable to get basic info on thread %d : %s",
+// OBSOLETE mid,
+// OBSOLETE mach_error_string (ret));
+// OBSOLETE continue;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE sprintf (slot, "%d", index % 100);
+// OBSOLETE
+// OBSOLETE if (name == current_thread)
+// OBSOLETE selected = '*';
+// OBSOLETE else
+// OBSOLETE selected = ' ';
+// OBSOLETE
+// OBSOLETE if (ths.suspend_count)
+// OBSOLETE sprintf (buf, "%d", ths.suspend_count);
+// OBSOLETE else
+// OBSOLETE buf[0] = '\000';
+// OBSOLETE
+// OBSOLETE #if 0
+// OBSOLETE if (ths.flags & TH_FLAGS_SWAPPED)
+// OBSOLETE strcat (buf, "S");
+// OBSOLETE #endif
+// OBSOLETE
+// OBSOLETE if (ths.flags & TH_FLAGS_IDLE)
+// OBSOLETE strcat (buf, "I");
+// OBSOLETE
+// OBSOLETE printf_filtered (TL_FORMAT,
+// OBSOLETE slot,
+// OBSOLETE mid,
+// OBSOLETE selected,
+// OBSOLETE get_thread_name (NULL, index),
+// OBSOLETE their_threads[index].in_emulator ? "E" : "",
+// OBSOLETE translate_state (ths.run_state),
+// OBSOLETE buf,
+// OBSOLETE "", /* No cproc state */
+// OBSOLETE ""); /* Can't be wired */
+// OBSOLETE print_tl_address (gdb_stdout, their_threads[index].pc);
+// OBSOLETE puts_filtered ("\n");
+// OBSOLETE }
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE obstack_free (cproc_obstack, 0);
+// OBSOLETE obstack_init (cproc_obstack);
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE void
+// OBSOLETE thread_select_command (char *args, int from_tty)
+// OBSOLETE {
+// OBSOLETE int mid;
+// OBSOLETE thread_array_t thread_list;
+// OBSOLETE int thread_count;
+// OBSOLETE kern_return_t ret;
+// OBSOLETE int is_slot = 0;
+// OBSOLETE
+// OBSOLETE MACH_ERROR_NO_INFERIOR;
+// OBSOLETE
+// OBSOLETE if (!args)
+// OBSOLETE error_no_arg ("MID or @SLOTNUMBER to specify a thread to select");
+// OBSOLETE
+// OBSOLETE while (*args == ' ' || *args == '\t')
+// OBSOLETE args++;
+// OBSOLETE
+// OBSOLETE if (*args == '@')
+// OBSOLETE {
+// OBSOLETE is_slot++;
+// OBSOLETE args++;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE mid = atoi (args);
+// OBSOLETE
+// OBSOLETE if (mid == 0)
+// OBSOLETE if (!is_slot || *args != '0') /* Rudimentary checks */
+// OBSOLETE error ("You must select threads by MID or @SLOTNUMBER");
+// OBSOLETE
+// OBSOLETE if (select_thread (inferior_task, mid, is_slot ? 2 : 1) != KERN_SUCCESS)
+// OBSOLETE return;
+// OBSOLETE
+// OBSOLETE if (from_tty)
+// OBSOLETE printf_filtered ("Thread %d selected\n",
+// OBSOLETE is_slot ? map_port_name_to_mid (current_thread,
+// OBSOLETE MACH_TYPE_THREAD) : mid);
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE thread_trace (mach_port_t thread, boolean_t set)
+// OBSOLETE {
+// OBSOLETE int flavor = TRACE_FLAVOR;
+// OBSOLETE unsigned int stateCnt = TRACE_FLAVOR_SIZE;
+// OBSOLETE kern_return_t ret;
+// OBSOLETE thread_state_data_t state;
+// OBSOLETE
+// OBSOLETE if (!MACH_PORT_VALID (thread))
+// OBSOLETE {
+// OBSOLETE warning ("thread_trace: invalid thread");
+// OBSOLETE return;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE if (must_suspend_thread)
+// OBSOLETE setup_thread (thread, 1);
+// OBSOLETE
+// OBSOLETE ret = thread_get_state (thread, flavor, state, &stateCnt);
+// OBSOLETE CHK ("thread_trace: error reading thread state", ret);
+// OBSOLETE
+// OBSOLETE if (set)
+// OBSOLETE {
+// OBSOLETE TRACE_SET (thread, state);
+// OBSOLETE }
+// OBSOLETE else
+// OBSOLETE {
+// OBSOLETE if (!TRACE_CLEAR (thread, state))
+// OBSOLETE {
+// OBSOLETE if (must_suspend_thread)
+// OBSOLETE setup_thread (thread, 0);
+// OBSOLETE return;
+// OBSOLETE }
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE ret = thread_set_state (thread, flavor, state, stateCnt);
+// OBSOLETE CHK ("thread_trace: error writing thread state", ret);
+// OBSOLETE if (must_suspend_thread)
+// OBSOLETE setup_thread (thread, 0);
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE #ifdef FLUSH_INFERIOR_CACHE
+// OBSOLETE
+// OBSOLETE /* When over-writing code on some machines the I-Cache must be flushed
+// OBSOLETE explicitly, because it is not kept coherent by the lazy hardware.
+// OBSOLETE This definitely includes breakpoints, for instance, or else we
+// OBSOLETE end up looping in mysterious Bpt traps */
+// OBSOLETE
+// OBSOLETE flush_inferior_icache (CORE_ADDR pc, int amount)
+// OBSOLETE {
+// OBSOLETE vm_machine_attribute_val_t flush = MATTR_VAL_ICACHE_FLUSH;
+// OBSOLETE kern_return_t ret;
+// OBSOLETE
+// OBSOLETE ret = vm_machine_attribute (inferior_task,
+// OBSOLETE pc,
+// OBSOLETE amount,
+// OBSOLETE MATTR_CACHE,
+// OBSOLETE &flush);
+// OBSOLETE if (ret != KERN_SUCCESS)
+// OBSOLETE warning ("Error flushing inferior's cache : %s",
+// OBSOLETE mach_error_string (ret));
+// OBSOLETE }
+// OBSOLETE #endif /* FLUSH_INFERIOR_CACHE */
+// OBSOLETE
+// OBSOLETE
+// OBSOLETE static
+// OBSOLETE suspend_all_threads (int from_tty)
+// OBSOLETE {
+// OBSOLETE kern_return_t ret;
+// OBSOLETE thread_array_t thread_list;
+// OBSOLETE int thread_count, index;
+// OBSOLETE int infoCnt;
+// OBSOLETE thread_basic_info_data_t th_info;
+// OBSOLETE
+// OBSOLETE
+// OBSOLETE ret = task_threads (inferior_task, &thread_list, &thread_count);
+// OBSOLETE if (ret != KERN_SUCCESS)
+// OBSOLETE {
+// OBSOLETE warning ("Could not suspend inferior threads.");
+// OBSOLETE m3_kill_inferior ();
+// OBSOLETE throw_exception (RETURN_ERROR);
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE for (index = 0; index < thread_count; index++)
+// OBSOLETE {
+// OBSOLETE int mid;
+// OBSOLETE
+// OBSOLETE mid = map_port_name_to_mid (thread_list[index],
+// OBSOLETE MACH_TYPE_THREAD);
+// OBSOLETE
+// OBSOLETE ret = thread_suspend (thread_list[index]);
+// OBSOLETE
+// OBSOLETE if (ret != KERN_SUCCESS)
+// OBSOLETE warning ("Error trying to suspend thread %d : %s",
+// OBSOLETE mid, mach_error_string (ret));
+// OBSOLETE
+// OBSOLETE if (from_tty)
+// OBSOLETE {
+// OBSOLETE infoCnt = THREAD_BASIC_INFO_COUNT;
+// OBSOLETE ret = thread_info (thread_list[index],
+// OBSOLETE THREAD_BASIC_INFO,
+// OBSOLETE (thread_info_t) & th_info,
+// OBSOLETE &infoCnt);
+// OBSOLETE CHK ("suspend can't get thread info", ret);
+// OBSOLETE
+// OBSOLETE warning ("Thread %d suspend count is %d",
+// OBSOLETE mid, th_info.suspend_count);
+// OBSOLETE }
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE consume_send_rights (thread_list, thread_count);
+// OBSOLETE ret = vm_deallocate (mach_task_self (),
+// OBSOLETE (vm_address_t) thread_list,
+// OBSOLETE (thread_count * sizeof (int)));
+// OBSOLETE CHK ("Error trying to deallocate thread list", ret);
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE void
+// OBSOLETE thread_suspend_command (char *args, int from_tty)
+// OBSOLETE {
+// OBSOLETE kern_return_t ret;
+// OBSOLETE int mid;
+// OBSOLETE mach_port_t saved_thread;
+// OBSOLETE int infoCnt;
+// OBSOLETE thread_basic_info_data_t th_info;
+// OBSOLETE
+// OBSOLETE MACH_ERROR_NO_INFERIOR;
+// OBSOLETE
+// OBSOLETE if (!strcasecmp (args, "all"))
+// OBSOLETE {
+// OBSOLETE suspend_all_threads (from_tty);
+// OBSOLETE return;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE saved_thread = current_thread;
+// OBSOLETE
+// OBSOLETE mid = parse_thread_id (args, 0, 0);
+// OBSOLETE
+// OBSOLETE if (mid < 0)
+// OBSOLETE error ("You can suspend only existing kernel threads with MID or @SLOTNUMBER");
+// OBSOLETE
+// OBSOLETE if (mid == 0)
+// OBSOLETE mid = map_port_name_to_mid (current_thread, MACH_TYPE_THREAD);
+// OBSOLETE else if (select_thread (inferior_task, mid, 0) != KERN_SUCCESS)
+// OBSOLETE {
+// OBSOLETE if (current_thread)
+// OBSOLETE current_thread = saved_thread;
+// OBSOLETE error ("Could not select thread %d", mid);
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE ret = thread_suspend (current_thread);
+// OBSOLETE if (ret != KERN_SUCCESS)
+// OBSOLETE warning ("thread_suspend failed : %s",
+// OBSOLETE mach_error_string (ret));
+// OBSOLETE
+// OBSOLETE infoCnt = THREAD_BASIC_INFO_COUNT;
+// OBSOLETE ret = thread_info (current_thread,
+// OBSOLETE THREAD_BASIC_INFO,
+// OBSOLETE (thread_info_t) & th_info,
+// OBSOLETE &infoCnt);
+// OBSOLETE CHK ("suspend can't get thread info", ret);
+// OBSOLETE
+// OBSOLETE warning ("Thread %d suspend count is %d", mid, th_info.suspend_count);
+// OBSOLETE
+// OBSOLETE current_thread = saved_thread;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE resume_all_threads (int from_tty)
+// OBSOLETE {
+// OBSOLETE kern_return_t ret;
+// OBSOLETE thread_array_t thread_list;
+// OBSOLETE int thread_count, index;
+// OBSOLETE int mid;
+// OBSOLETE int infoCnt;
+// OBSOLETE thread_basic_info_data_t th_info;
+// OBSOLETE
+// OBSOLETE ret = task_threads (inferior_task, &thread_list, &thread_count);
+// OBSOLETE if (ret != KERN_SUCCESS)
+// OBSOLETE {
+// OBSOLETE m3_kill_inferior ();
+// OBSOLETE error ("task_threads", mach_error_string (ret));
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE for (index = 0; index < thread_count; index++)
+// OBSOLETE {
+// OBSOLETE infoCnt = THREAD_BASIC_INFO_COUNT;
+// OBSOLETE ret = thread_info (thread_list[index],
+// OBSOLETE THREAD_BASIC_INFO,
+// OBSOLETE (thread_info_t) & th_info,
+// OBSOLETE &infoCnt);
+// OBSOLETE CHK ("resume_all can't get thread info", ret);
+// OBSOLETE
+// OBSOLETE mid = map_port_name_to_mid (thread_list[index],
+// OBSOLETE MACH_TYPE_THREAD);
+// OBSOLETE
+// OBSOLETE if (!th_info.suspend_count)
+// OBSOLETE {
+// OBSOLETE if (mid != -1 && from_tty)
+// OBSOLETE warning ("Thread %d is not suspended", mid);
+// OBSOLETE continue;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE ret = thread_resume (thread_list[index]);
+// OBSOLETE
+// OBSOLETE if (ret != KERN_SUCCESS)
+// OBSOLETE warning ("Error trying to resume thread %d : %s",
+// OBSOLETE mid, mach_error_string (ret));
+// OBSOLETE else if (mid != -1 && from_tty)
+// OBSOLETE warning ("Thread %d suspend count is %d",
+// OBSOLETE mid, --th_info.suspend_count);
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE consume_send_rights (thread_list, thread_count);
+// OBSOLETE ret = vm_deallocate (mach_task_self (),
+// OBSOLETE (vm_address_t) thread_list,
+// OBSOLETE (thread_count * sizeof (int)));
+// OBSOLETE CHK ("Error trying to deallocate thread list", ret);
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE void
+// OBSOLETE thread_resume_command (char *args, int from_tty)
+// OBSOLETE {
+// OBSOLETE int mid;
+// OBSOLETE mach_port_t saved_thread;
+// OBSOLETE kern_return_t ret;
+// OBSOLETE thread_basic_info_data_t th_info;
+// OBSOLETE int infoCnt = THREAD_BASIC_INFO_COUNT;
+// OBSOLETE
+// OBSOLETE MACH_ERROR_NO_INFERIOR;
+// OBSOLETE
+// OBSOLETE if (!strcasecmp (args, "all"))
+// OBSOLETE {
+// OBSOLETE resume_all_threads (from_tty);
+// OBSOLETE return;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE saved_thread = current_thread;
+// OBSOLETE
+// OBSOLETE mid = parse_thread_id (args, 0, 0);
+// OBSOLETE
+// OBSOLETE if (mid < 0)
+// OBSOLETE error ("You can resume only existing kernel threads with MID or @SLOTNUMBER");
+// OBSOLETE
+// OBSOLETE if (mid == 0)
+// OBSOLETE mid = map_port_name_to_mid (current_thread, MACH_TYPE_THREAD);
+// OBSOLETE else if (select_thread (inferior_task, mid, 0) != KERN_SUCCESS)
+// OBSOLETE {
+// OBSOLETE if (current_thread)
+// OBSOLETE current_thread = saved_thread;
+// OBSOLETE throw_exception (RETURN_ERROR);
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE ret = thread_info (current_thread,
+// OBSOLETE THREAD_BASIC_INFO,
+// OBSOLETE (thread_info_t) & th_info,
+// OBSOLETE &infoCnt);
+// OBSOLETE CHK ("resume can't get thread info", ret);
+// OBSOLETE
+// OBSOLETE if (!th_info.suspend_count)
+// OBSOLETE {
+// OBSOLETE warning ("Thread %d is not suspended", mid);
+// OBSOLETE goto out;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE ret = thread_resume (current_thread);
+// OBSOLETE if (ret != KERN_SUCCESS)
+// OBSOLETE warning ("thread_resume failed : %s",
+// OBSOLETE mach_error_string (ret));
+// OBSOLETE else
+// OBSOLETE {
+// OBSOLETE th_info.suspend_count--;
+// OBSOLETE warning ("Thread %d suspend count is %d", mid, th_info.suspend_count);
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE out:
+// OBSOLETE current_thread = saved_thread;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE void
+// OBSOLETE thread_kill_command (char *args, int from_tty)
+// OBSOLETE {
+// OBSOLETE int mid;
+// OBSOLETE kern_return_t ret;
+// OBSOLETE int thread_count;
+// OBSOLETE thread_array_t thread_table;
+// OBSOLETE int index;
+// OBSOLETE mach_port_t thread_to_kill = MACH_PORT_NULL;
+// OBSOLETE
+// OBSOLETE
+// OBSOLETE MACH_ERROR_NO_INFERIOR;
+// OBSOLETE
+// OBSOLETE if (!args)
+// OBSOLETE error_no_arg ("thread mid to kill from the inferior task");
+// OBSOLETE
+// OBSOLETE mid = parse_thread_id (args, 0, 0);
+// OBSOLETE
+// OBSOLETE if (mid < 0)
+// OBSOLETE error ("You can kill only existing kernel threads with MID or @SLOTNUMBER");
+// OBSOLETE
+// OBSOLETE if (mid)
+// OBSOLETE {
+// OBSOLETE ret = machid_mach_port (mid_server, mid_auth, mid, &thread_to_kill);
+// OBSOLETE CHK ("thread_kill_command: machid_mach_port map failed", ret);
+// OBSOLETE }
+// OBSOLETE else
+// OBSOLETE mid = map_port_name_to_mid (current_thread, MACH_TYPE_THREAD);
+// OBSOLETE
+// OBSOLETE /* Don't allow gdb to kill *any* thread in the system. Use mkill program for that */
+// OBSOLETE ret = task_threads (inferior_task, &thread_table, &thread_count);
+// OBSOLETE CHK ("Error getting inferior's thread list", ret);
+// OBSOLETE
+// OBSOLETE if (thread_to_kill == current_thread)
+// OBSOLETE {
+// OBSOLETE ret = thread_terminate (thread_to_kill);
+// OBSOLETE CHK ("Thread could not be terminated", ret);
+// OBSOLETE
+// OBSOLETE if (select_thread (inferior_task, 0, 1) != KERN_SUCCESS)
+// OBSOLETE warning ("Last thread was killed, use \"kill\" command to kill task");
+// OBSOLETE }
+// OBSOLETE else
+// OBSOLETE for (index = 0; index < thread_count; index++)
+// OBSOLETE if (thread_table[index] == thread_to_kill)
+// OBSOLETE {
+// OBSOLETE ret = thread_terminate (thread_to_kill);
+// OBSOLETE CHK ("Thread could not be terminated", ret);
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE if (thread_count > 1)
+// OBSOLETE consume_send_rights (thread_table, thread_count);
+// OBSOLETE
+// OBSOLETE ret = vm_deallocate (mach_task_self (), (vm_address_t) thread_table,
+// OBSOLETE (thread_count * sizeof (mach_port_t)));
+// OBSOLETE CHK ("Error trying to deallocate thread list", ret);
+// OBSOLETE
+// OBSOLETE warning ("Thread %d killed", mid);
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE
+// OBSOLETE /* Task specific commands; add more if you like */
+// OBSOLETE
+// OBSOLETE void
+// OBSOLETE task_resume_command (char *args, int from_tty)
+// OBSOLETE {
+// OBSOLETE kern_return_t ret;
+// OBSOLETE task_basic_info_data_t ta_info;
+// OBSOLETE int infoCnt = TASK_BASIC_INFO_COUNT;
+// OBSOLETE int mid = map_port_name_to_mid (inferior_task, MACH_TYPE_TASK);
+// OBSOLETE
+// OBSOLETE MACH_ERROR_NO_INFERIOR;
+// OBSOLETE
+// OBSOLETE /* Would be trivial to change, but is it desirable? */
+// OBSOLETE if (args)
+// OBSOLETE error ("Currently gdb can resume only it's inferior task");
+// OBSOLETE
+// OBSOLETE ret = task_info (inferior_task,
+// OBSOLETE TASK_BASIC_INFO,
+// OBSOLETE (task_info_t) & ta_info,
+// OBSOLETE &infoCnt);
+// OBSOLETE CHK ("task_resume_command: task_info failed", ret);
+// OBSOLETE
+// OBSOLETE if (ta_info.suspend_count == 0)
+// OBSOLETE error ("Inferior task %d is not suspended", mid);
+// OBSOLETE else if (ta_info.suspend_count == 1 &&
+// OBSOLETE from_tty &&
+// OBSOLETE !query ("Suspend count is now 1. Do you know what you are doing? "))
+// OBSOLETE error ("Task not resumed");
+// OBSOLETE
+// OBSOLETE ret = task_resume (inferior_task);
+// OBSOLETE CHK ("task_resume_command: task_resume", ret);
+// OBSOLETE
+// OBSOLETE if (ta_info.suspend_count == 1)
+// OBSOLETE {
+// OBSOLETE warning ("Inferior task %d is no longer suspended", mid);
+// OBSOLETE must_suspend_thread = 1;
+// OBSOLETE /* @@ This is not complete: Registers change all the time when not
+// OBSOLETE suspended! */
+// OBSOLETE registers_changed ();
+// OBSOLETE }
+// OBSOLETE else
+// OBSOLETE warning ("Inferior task %d suspend count is now %d",
+// OBSOLETE mid, ta_info.suspend_count - 1);
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE
+// OBSOLETE void
+// OBSOLETE task_suspend_command (char *args, int from_tty)
+// OBSOLETE {
+// OBSOLETE kern_return_t ret;
+// OBSOLETE task_basic_info_data_t ta_info;
+// OBSOLETE int infoCnt = TASK_BASIC_INFO_COUNT;
+// OBSOLETE int mid = map_port_name_to_mid (inferior_task, MACH_TYPE_TASK);
+// OBSOLETE
+// OBSOLETE MACH_ERROR_NO_INFERIOR;
+// OBSOLETE
+// OBSOLETE /* Would be trivial to change, but is it desirable? */
+// OBSOLETE if (args)
+// OBSOLETE error ("Currently gdb can suspend only it's inferior task");
+// OBSOLETE
+// OBSOLETE ret = task_suspend (inferior_task);
+// OBSOLETE CHK ("task_suspend_command: task_suspend", ret);
+// OBSOLETE
+// OBSOLETE must_suspend_thread = 0;
+// OBSOLETE
+// OBSOLETE ret = task_info (inferior_task,
+// OBSOLETE TASK_BASIC_INFO,
+// OBSOLETE (task_info_t) & ta_info,
+// OBSOLETE &infoCnt);
+// OBSOLETE CHK ("task_suspend_command: task_info failed", ret);
+// OBSOLETE
+// OBSOLETE warning ("Inferior task %d suspend count is now %d",
+// OBSOLETE mid, ta_info.suspend_count);
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE static char *
+// OBSOLETE get_size (int bytes)
+// OBSOLETE {
+// OBSOLETE static char size[30];
+// OBSOLETE int zz = bytes / 1024;
+// OBSOLETE
+// OBSOLETE if (zz / 1024)
+// OBSOLETE sprintf (size, "%-2.1f M", ((float) bytes) / (1024.0 * 1024.0));
+// OBSOLETE else
+// OBSOLETE sprintf (size, "%d K", zz);
+// OBSOLETE
+// OBSOLETE return size;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE /* Does this require the target task to be suspended?? I don't think so. */
+// OBSOLETE void
+// OBSOLETE task_info_command (char *args, int from_tty)
+// OBSOLETE {
+// OBSOLETE int mid = -5;
+// OBSOLETE mach_port_t task;
+// OBSOLETE kern_return_t ret;
+// OBSOLETE task_basic_info_data_t ta_info;
+// OBSOLETE int infoCnt = TASK_BASIC_INFO_COUNT;
+// OBSOLETE int page_size = round_page (1);
+// OBSOLETE int thread_count = 0;
+// OBSOLETE
+// OBSOLETE if (MACH_PORT_VALID (inferior_task))
+// OBSOLETE mid = map_port_name_to_mid (inferior_task,
+// OBSOLETE MACH_TYPE_TASK);
+// OBSOLETE
+// OBSOLETE task = inferior_task;
+// OBSOLETE
+// OBSOLETE if (args)
+// OBSOLETE {
+// OBSOLETE int tmid = atoi (args);
+// OBSOLETE
+// OBSOLETE if (tmid <= 0)
+// OBSOLETE error ("Invalid mid %d for task info", tmid);
+// OBSOLETE
+// OBSOLETE if (tmid != mid)
+// OBSOLETE {
+// OBSOLETE mid = tmid;
+// OBSOLETE ret = machid_mach_port (mid_server, mid_auth, tmid, &task);
+// OBSOLETE CHK ("task_info_command: machid_mach_port map failed", ret);
+// OBSOLETE }
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE if (mid < 0)
+// OBSOLETE error ("You have to give the task MID as an argument");
+// OBSOLETE
+// OBSOLETE ret = task_info (task,
+// OBSOLETE TASK_BASIC_INFO,
+// OBSOLETE (task_info_t) & ta_info,
+// OBSOLETE &infoCnt);
+// OBSOLETE CHK ("task_info_command: task_info failed", ret);
+// OBSOLETE
+// OBSOLETE printf_filtered ("\nTask info for task %d:\n\n", mid);
+// OBSOLETE printf_filtered (" Suspend count : %d\n", ta_info.suspend_count);
+// OBSOLETE printf_filtered (" Base priority : %d\n", ta_info.base_priority);
+// OBSOLETE printf_filtered (" Virtual size : %s\n", get_size (ta_info.virtual_size));
+// OBSOLETE printf_filtered (" Resident size : %s\n", get_size (ta_info.resident_size));
+// OBSOLETE
+// OBSOLETE {
+// OBSOLETE thread_array_t thread_list;
+// OBSOLETE
+// OBSOLETE ret = task_threads (task, &thread_list, &thread_count);
+// OBSOLETE CHK ("task_info_command: task_threads", ret);
+// OBSOLETE
+// OBSOLETE printf_filtered (" Thread count : %d\n", thread_count);
+// OBSOLETE
+// OBSOLETE consume_send_rights (thread_list, thread_count);
+// OBSOLETE ret = vm_deallocate (mach_task_self (),
+// OBSOLETE (vm_address_t) thread_list,
+// OBSOLETE (thread_count * sizeof (int)));
+// OBSOLETE CHK ("Error trying to deallocate thread list", ret);
+// OBSOLETE }
+// OBSOLETE if (have_emulator_p (task))
+// OBSOLETE printf_filtered (" Emulator at : 0x%x..0x%x\n",
+// OBSOLETE EMULATOR_BASE, EMULATOR_END);
+// OBSOLETE else
+// OBSOLETE printf_filtered (" No emulator.\n");
+// OBSOLETE
+// OBSOLETE if (thread_count && task == inferior_task)
+// OBSOLETE printf_filtered ("\nUse the \"thread list\" command to see the threads\n");
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE /* You may either FORWARD the exception to the inferior, or KEEP
+// OBSOLETE * it and return to GDB command level.
+// OBSOLETE *
+// OBSOLETE * exception mid [ forward | keep ]
+// OBSOLETE */
+// OBSOLETE
+// OBSOLETE static void
+// OBSOLETE exception_command (char *args, int from_tty)
+// OBSOLETE {
+// OBSOLETE char *scan = args;
+// OBSOLETE int exception;
+// OBSOLETE int len;
+// OBSOLETE
+// OBSOLETE if (!args)
+// OBSOLETE error_no_arg ("exception number action");
+// OBSOLETE
+// OBSOLETE while (*scan == ' ' || *scan == '\t')
+// OBSOLETE scan++;
+// OBSOLETE
+// OBSOLETE if ('0' <= *scan && *scan <= '9')
+// OBSOLETE while ('0' <= *scan && *scan <= '9')
+// OBSOLETE scan++;
+// OBSOLETE else
+// OBSOLETE error ("exception number action");
+// OBSOLETE
+// OBSOLETE exception = atoi (args);
+// OBSOLETE if (exception <= 0 || exception > MAX_EXCEPTION)
+// OBSOLETE error ("Allowed exception numbers are in range 1..%d",
+// OBSOLETE MAX_EXCEPTION);
+// OBSOLETE
+// OBSOLETE if (*scan != ' ' && *scan != '\t')
+// OBSOLETE error ("exception number must be followed by a space");
+// OBSOLETE else
+// OBSOLETE while (*scan == ' ' || *scan == '\t')
+// OBSOLETE scan++;
+// OBSOLETE
+// OBSOLETE args = scan;
+// OBSOLETE len = 0;
+// OBSOLETE while (*scan)
+// OBSOLETE {
+// OBSOLETE len++;
+// OBSOLETE scan++;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE if (!len)
+// OBSOLETE error ("exception number action");
+// OBSOLETE
+// OBSOLETE if (!strncasecmp (args, "forward", len))
+// OBSOLETE exception_map[exception].forward = TRUE;
+// OBSOLETE else if (!strncasecmp (args, "keep", len))
+// OBSOLETE exception_map[exception].forward = FALSE;
+// OBSOLETE else
+// OBSOLETE error ("exception action is either \"keep\" or \"forward\"");
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE static void
+// OBSOLETE print_exception_info (int exception)
+// OBSOLETE {
+// OBSOLETE boolean_t forward = exception_map[exception].forward;
+// OBSOLETE
+// OBSOLETE printf_filtered ("%s\t(%d): ", exception_map[exception].name,
+// OBSOLETE exception);
+// OBSOLETE if (!forward)
+// OBSOLETE if (exception_map[exception].sigmap != SIG_UNKNOWN)
+// OBSOLETE printf_filtered ("keep and handle as signal %d\n",
+// OBSOLETE exception_map[exception].sigmap);
+// OBSOLETE else
+// OBSOLETE printf_filtered ("keep and handle as unknown signal %d\n",
+// OBSOLETE exception_map[exception].sigmap);
+// OBSOLETE else
+// OBSOLETE printf_filtered ("forward exception to inferior\n");
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE void
+// OBSOLETE exception_info (char *args, int from_tty)
+// OBSOLETE {
+// OBSOLETE int exception;
+// OBSOLETE
+// OBSOLETE if (!args)
+// OBSOLETE for (exception = 1; exception <= MAX_EXCEPTION; exception++)
+// OBSOLETE print_exception_info (exception);
+// OBSOLETE else
+// OBSOLETE {
+// OBSOLETE exception = atoi (args);
+// OBSOLETE
+// OBSOLETE if (exception <= 0 || exception > MAX_EXCEPTION)
+// OBSOLETE error ("Invalid exception number, values from 1 to %d allowed",
+// OBSOLETE MAX_EXCEPTION);
+// OBSOLETE print_exception_info (exception);
+// OBSOLETE }
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE /* Check for actions for mach exceptions.
+// OBSOLETE */
+// OBSOLETE mach3_exception_actions (WAITTYPE *w, boolean_t force_print_only, char *who)
+// OBSOLETE {
+// OBSOLETE boolean_t force_print = FALSE;
+// OBSOLETE
+// OBSOLETE
+// OBSOLETE if (force_print_only ||
+// OBSOLETE exception_map[stop_exception].sigmap == SIG_UNKNOWN)
+// OBSOLETE force_print = TRUE;
+// OBSOLETE else
+// OBSOLETE WSETSTOP (*w, exception_map[stop_exception].sigmap);
+// OBSOLETE
+// OBSOLETE if (exception_map[stop_exception].print || force_print)
+// OBSOLETE {
+// OBSOLETE target_terminal_ours ();
+// OBSOLETE
+// OBSOLETE printf_filtered ("\n%s received %s exception : ",
+// OBSOLETE who,
+// OBSOLETE exception_map[stop_exception].name);
+// OBSOLETE
+// OBSOLETE wrap_here (" ");
+// OBSOLETE
+// OBSOLETE switch (stop_exception)
+// OBSOLETE {
+// OBSOLETE case EXC_BAD_ACCESS:
+// OBSOLETE printf_filtered ("referencing address 0x%x : %s\n",
+// OBSOLETE stop_subcode,
+// OBSOLETE mach_error_string (stop_code));
+// OBSOLETE break;
+// OBSOLETE case EXC_BAD_INSTRUCTION:
+// OBSOLETE printf_filtered
+// OBSOLETE ("illegal or undefined instruction. code %d subcode %d\n",
+// OBSOLETE stop_code, stop_subcode);
+// OBSOLETE break;
+// OBSOLETE case EXC_ARITHMETIC:
+// OBSOLETE printf_filtered ("code %d\n", stop_code);
+// OBSOLETE break;
+// OBSOLETE case EXC_EMULATION:
+// OBSOLETE printf_filtered ("code %d subcode %d\n", stop_code, stop_subcode);
+// OBSOLETE break;
+// OBSOLETE case EXC_SOFTWARE:
+// OBSOLETE printf_filtered ("%s specific, code 0x%x\n",
+// OBSOLETE stop_code < 0xffff ? "hardware" : "os emulation",
+// OBSOLETE stop_code);
+// OBSOLETE break;
+// OBSOLETE case EXC_BREAKPOINT:
+// OBSOLETE printf_filtered ("type %d (machine dependent)\n",
+// OBSOLETE stop_code);
+// OBSOLETE break;
+// OBSOLETE default:
+// OBSOLETE internal_error (__FILE__, __LINE__,
+// OBSOLETE "Unknown exception");
+// OBSOLETE }
+// OBSOLETE }
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE setup_notify_port (int create_new)
+// OBSOLETE {
+// OBSOLETE kern_return_t ret;
+// OBSOLETE
+// OBSOLETE if (MACH_PORT_VALID (our_notify_port))
+// OBSOLETE {
+// OBSOLETE ret = mach_port_destroy (mach_task_self (), our_notify_port);
+// OBSOLETE CHK ("Could not destroy our_notify_port", ret);
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE our_notify_port = MACH_PORT_NULL;
+// OBSOLETE notify_chain = (port_chain_t) NULL;
+// OBSOLETE port_chain_destroy (port_chain_obstack);
+// OBSOLETE
+// OBSOLETE if (create_new)
+// OBSOLETE {
+// OBSOLETE ret = mach_port_allocate (mach_task_self (),
+// OBSOLETE MACH_PORT_RIGHT_RECEIVE,
+// OBSOLETE &our_notify_port);
+// OBSOLETE if (ret != KERN_SUCCESS)
+// OBSOLETE internal_error (__FILE__, __LINE__,
+// OBSOLETE "Creating notify port %s", mach_error_string (ret));
+// OBSOLETE
+// OBSOLETE ret = mach_port_move_member (mach_task_self (),
+// OBSOLETE our_notify_port,
+// OBSOLETE inferior_wait_port_set);
+// OBSOLETE if (ret != KERN_SUCCESS)
+// OBSOLETE internal_error (__FILE__, __LINE__,
+// OBSOLETE "initial move member %s", mach_error_string (ret));
+// OBSOLETE }
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE /*
+// OBSOLETE * Register our message port to the net name server
+// OBSOLETE *
+// OBSOLETE * Currently used only by the external stop-gdb program
+// OBSOLETE * since ^C does not work if you would like to enter
+// OBSOLETE * gdb command level while debugging your program.
+// OBSOLETE *
+// OBSOLETE * NOTE: If the message port is sometimes used for other
+// OBSOLETE * purposes also, the NAME must not be a guessable one.
+// OBSOLETE * Then, there should be a way to change it.
+// OBSOLETE */
+// OBSOLETE
+// OBSOLETE char registered_name[MAX_NAME_LEN];
+// OBSOLETE
+// OBSOLETE void
+// OBSOLETE message_port_info (char *args, int from_tty)
+// OBSOLETE {
+// OBSOLETE if (registered_name[0])
+// OBSOLETE printf_filtered ("gdb's message port name: '%s'\n",
+// OBSOLETE registered_name);
+// OBSOLETE else
+// OBSOLETE printf_filtered ("gdb's message port is not currently registered\n");
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE void
+// OBSOLETE gdb_register_port (char *name, mach_port_t port)
+// OBSOLETE {
+// OBSOLETE kern_return_t ret;
+// OBSOLETE static int already_signed = 0;
+// OBSOLETE int len;
+// OBSOLETE
+// OBSOLETE if (!MACH_PORT_VALID (port) || !name || !*name)
+// OBSOLETE {
+// OBSOLETE warning ("Invalid registration request");
+// OBSOLETE return;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE if (!already_signed)
+// OBSOLETE {
+// OBSOLETE ret = mach_port_insert_right (mach_task_self (),
+// OBSOLETE our_message_port,
+// OBSOLETE our_message_port,
+// OBSOLETE MACH_MSG_TYPE_MAKE_SEND);
+// OBSOLETE CHK ("Failed to create a signature to our_message_port", ret);
+// OBSOLETE already_signed = 1;
+// OBSOLETE }
+// OBSOLETE else if (already_signed > 1)
+// OBSOLETE {
+// OBSOLETE ret = netname_check_out (name_server_port,
+// OBSOLETE registered_name,
+// OBSOLETE our_message_port);
+// OBSOLETE CHK ("Failed to check out gdb's message port", ret);
+// OBSOLETE registered_name[0] = '\000';
+// OBSOLETE already_signed = 1;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE ret = netname_check_in (name_server_port, /* Name server port */
+// OBSOLETE name, /* Name of service */
+// OBSOLETE our_message_port, /* Signature */
+// OBSOLETE port); /* Creates a new send right */
+// OBSOLETE CHK ("Failed to check in the port", ret);
+// OBSOLETE
+// OBSOLETE len = 0;
+// OBSOLETE while (len < MAX_NAME_LEN && *(name + len))
+// OBSOLETE {
+// OBSOLETE registered_name[len] = *(name + len);
+// OBSOLETE len++;
+// OBSOLETE }
+// OBSOLETE registered_name[len] = '\000';
+// OBSOLETE already_signed = 2;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE struct cmd_list_element *cmd_thread_list;
+// OBSOLETE struct cmd_list_element *cmd_task_list;
+// OBSOLETE
+// OBSOLETE /*ARGSUSED */
+// OBSOLETE static void
+// OBSOLETE thread_command (char *arg, int from_tty)
+// OBSOLETE {
+// OBSOLETE printf_unfiltered ("\"thread\" must be followed by the name of a thread command.\n");
+// OBSOLETE help_list (cmd_thread_list, "thread ", -1, gdb_stdout);
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE /*ARGSUSED */
+// OBSOLETE static void
+// OBSOLETE task_command (char *arg, int from_tty)
+// OBSOLETE {
+// OBSOLETE printf_unfiltered ("\"task\" must be followed by the name of a task command.\n");
+// OBSOLETE help_list (cmd_task_list, "task ", -1, gdb_stdout);
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE add_mach_specific_commands (void)
+// OBSOLETE {
+// OBSOLETE /* Thread handling commands */
+// OBSOLETE
+// OBSOLETE /* FIXME: Move our thread support into the generic thread.c stuff so we
+// OBSOLETE can share that code. */
+// OBSOLETE add_prefix_cmd ("mthread", class_stack, thread_command,
+// OBSOLETE "Generic command for handling Mach threads in the debugged task.",
+// OBSOLETE &cmd_thread_list, "thread ", 0, &cmdlist);
+// OBSOLETE
+// OBSOLETE add_com_alias ("th", "mthread", class_stack, 1);
+// OBSOLETE
+// OBSOLETE add_cmd ("select", class_stack, thread_select_command,
+// OBSOLETE "Select and print MID of the selected thread",
+// OBSOLETE &cmd_thread_list);
+// OBSOLETE add_cmd ("list", class_stack, thread_list_command,
+// OBSOLETE "List info of task's threads. Selected thread is marked with '*'",
+// OBSOLETE &cmd_thread_list);
+// OBSOLETE add_cmd ("suspend", class_run, thread_suspend_command,
+// OBSOLETE "Suspend one or all of the threads in the selected task.",
+// OBSOLETE &cmd_thread_list);
+// OBSOLETE add_cmd ("resume", class_run, thread_resume_command,
+// OBSOLETE "Resume one or all of the threads in the selected task.",
+// OBSOLETE &cmd_thread_list);
+// OBSOLETE add_cmd ("kill", class_run, thread_kill_command,
+// OBSOLETE "Kill the specified thread MID from inferior task.",
+// OBSOLETE &cmd_thread_list);
+// OBSOLETE #if 0
+// OBSOLETE /* The rest of this support (condition_thread) was not merged. It probably
+// OBSOLETE should not be merged in this form, but instead added to the generic GDB
+// OBSOLETE thread support. */
+// OBSOLETE add_cmd ("break", class_breakpoint, condition_thread,
+// OBSOLETE "Breakpoint N will only be effective for thread MID or @SLOT\n\
+// OBSOLETE If MID/@SLOT is omitted allow all threads to break at breakpoint",
+// OBSOLETE &cmd_thread_list);
+// OBSOLETE #endif
+// OBSOLETE /* Thread command shorthands (for backward compatibility) */
+// OBSOLETE add_alias_cmd ("ts", "mthread select", 0, 0, &cmdlist);
+// OBSOLETE add_alias_cmd ("tl", "mthread list", 0, 0, &cmdlist);
+// OBSOLETE
+// OBSOLETE /* task handling commands */
+// OBSOLETE
+// OBSOLETE add_prefix_cmd ("task", class_stack, task_command,
+// OBSOLETE "Generic command for handling debugged task.",
+// OBSOLETE &cmd_task_list, "task ", 0, &cmdlist);
+// OBSOLETE
+// OBSOLETE add_com_alias ("ta", "task", class_stack, 1);
+// OBSOLETE
+// OBSOLETE add_cmd ("suspend", class_run, task_suspend_command,
+// OBSOLETE "Suspend the inferior task.",
+// OBSOLETE &cmd_task_list);
+// OBSOLETE add_cmd ("resume", class_run, task_resume_command,
+// OBSOLETE "Resume the inferior task.",
+// OBSOLETE &cmd_task_list);
+// OBSOLETE add_cmd ("info", no_class, task_info_command,
+// OBSOLETE "Print information about the specified task.",
+// OBSOLETE &cmd_task_list);
+// OBSOLETE
+// OBSOLETE /* Print my message port name */
+// OBSOLETE
+// OBSOLETE add_info ("message-port", message_port_info,
+// OBSOLETE "Returns the name of gdb's message port in the netnameserver");
+// OBSOLETE
+// OBSOLETE /* Exception commands */
+// OBSOLETE
+// OBSOLETE add_info ("exceptions", exception_info,
+// OBSOLETE "What debugger does when program gets various exceptions.\n\
+// OBSOLETE Specify an exception number as argument to print info on that\n\
+// OBSOLETE exception only.");
+// OBSOLETE
+// OBSOLETE add_com ("exception", class_run, exception_command,
+// OBSOLETE "Specify how to handle an exception.\n\
+// OBSOLETE Args are exception number followed by \"forward\" or \"keep\".\n\
+// OBSOLETE `Forward' means forward the exception to the program's normal exception\n\
+// OBSOLETE handler.\n\
+// OBSOLETE `Keep' means reenter debugger if this exception happens, and GDB maps\n\
+// OBSOLETE the exception to some signal (see info exception)\n\
+// OBSOLETE Normally \"keep\" is used to return to GDB on exception.");
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE kern_return_t
+// OBSOLETE do_mach_notify_dead_name (mach_port_t notify, mach_port_t name)
+// OBSOLETE {
+// OBSOLETE kern_return_t kr = KERN_SUCCESS;
+// OBSOLETE
+// OBSOLETE /* Find the thing that notified */
+// OBSOLETE port_chain_t element = port_chain_member (notify_chain, name);
+// OBSOLETE
+// OBSOLETE /* Take name of from unreceived dead name notification list */
+// OBSOLETE notify_chain = port_chain_delete (notify_chain, name);
+// OBSOLETE
+// OBSOLETE if (!element)
+// OBSOLETE error ("Received a dead name notify from unchained port (0x%x)", name);
+// OBSOLETE
+// OBSOLETE switch (element->type)
+// OBSOLETE {
+// OBSOLETE
+// OBSOLETE case MACH_TYPE_THREAD:
+// OBSOLETE target_terminal_ours_for_output ();
+// OBSOLETE if (name == current_thread)
+// OBSOLETE {
+// OBSOLETE printf_filtered ("\nCurrent thread %d died", element->mid);
+// OBSOLETE current_thread = MACH_PORT_NULL;
+// OBSOLETE }
+// OBSOLETE else
+// OBSOLETE printf_filtered ("\nThread %d died", element->mid);
+// OBSOLETE
+// OBSOLETE break;
+// OBSOLETE
+// OBSOLETE case MACH_TYPE_TASK:
+// OBSOLETE target_terminal_ours_for_output ();
+// OBSOLETE if (name != inferior_task)
+// OBSOLETE printf_filtered ("Task %d died, but it was not the selected task",
+// OBSOLETE element->mid);
+// OBSOLETE else
+// OBSOLETE {
+// OBSOLETE printf_filtered ("Current task %d died", element->mid);
+// OBSOLETE
+// OBSOLETE mach_port_destroy (mach_task_self (), name);
+// OBSOLETE inferior_task = MACH_PORT_NULL;
+// OBSOLETE
+// OBSOLETE if (notify_chain)
+// OBSOLETE warning ("There were still unreceived dead_name_notifications???");
+// OBSOLETE
+// OBSOLETE /* Destroy the old notifications */
+// OBSOLETE setup_notify_port (0);
+// OBSOLETE
+// OBSOLETE }
+// OBSOLETE break;
+// OBSOLETE
+// OBSOLETE default:
+// OBSOLETE error ("Unregistered dead_name 0x%x notification received. Type is %d, mid is 0x%x",
+// OBSOLETE name, element->type, element->mid);
+// OBSOLETE break;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE return KERN_SUCCESS;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE kern_return_t
+// OBSOLETE do_mach_notify_msg_accepted (mach_port_t notify, mach_port_t name)
+// OBSOLETE {
+// OBSOLETE warning ("do_mach_notify_msg_accepted : notify %x, name %x",
+// OBSOLETE notify, name);
+// OBSOLETE return KERN_SUCCESS;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE kern_return_t
+// OBSOLETE do_mach_notify_no_senders (mach_port_t notify, mach_port_mscount_t mscount)
+// OBSOLETE {
+// OBSOLETE warning ("do_mach_notify_no_senders : notify %x, mscount %x",
+// OBSOLETE notify, mscount);
+// OBSOLETE return KERN_SUCCESS;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE kern_return_t
+// OBSOLETE do_mach_notify_port_deleted (mach_port_t notify, mach_port_t name)
+// OBSOLETE {
+// OBSOLETE warning ("do_mach_notify_port_deleted : notify %x, name %x",
+// OBSOLETE notify, name);
+// OBSOLETE return KERN_SUCCESS;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE kern_return_t
+// OBSOLETE do_mach_notify_port_destroyed (mach_port_t notify, mach_port_t rights)
+// OBSOLETE {
+// OBSOLETE warning ("do_mach_notify_port_destroyed : notify %x, rights %x",
+// OBSOLETE notify, rights);
+// OBSOLETE return KERN_SUCCESS;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE kern_return_t
+// OBSOLETE do_mach_notify_send_once (mach_port_t notify)
+// OBSOLETE {
+// OBSOLETE #ifdef DUMP_SYSCALL
+// OBSOLETE /* MANY of these are generated. */
+// OBSOLETE warning ("do_mach_notify_send_once : notify %x",
+// OBSOLETE notify);
+// OBSOLETE #endif
+// OBSOLETE return KERN_SUCCESS;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE /* Kills the inferior. It's gone when you call this */
+// OBSOLETE static void
+// OBSOLETE kill_inferior_fast (void)
+// OBSOLETE {
+// OBSOLETE WAITTYPE w;
+// OBSOLETE
+// OBSOLETE if (PIDGET (inferior_ptid) == 0 || PIDGET (inferior_ptid) == 1)
+// OBSOLETE return;
+// OBSOLETE
+// OBSOLETE /* kill() it, since the Unix server does not otherwise notice when
+// OBSOLETE * killed with task_terminate().
+// OBSOLETE */
+// OBSOLETE if (PIDGET (inferior_ptid) > 0)
+// OBSOLETE kill (PIDGET (inferior_ptid), SIGKILL);
+// OBSOLETE
+// OBSOLETE /* It's propably terminate already */
+// OBSOLETE (void) task_terminate (inferior_task);
+// OBSOLETE
+// OBSOLETE inferior_task = MACH_PORT_NULL;
+// OBSOLETE current_thread = MACH_PORT_NULL;
+// OBSOLETE
+// OBSOLETE wait3 (&w, WNOHANG, 0);
+// OBSOLETE
+// OBSOLETE setup_notify_port (0);
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE static void
+// OBSOLETE m3_kill_inferior (void)
+// OBSOLETE {
+// OBSOLETE kill_inferior_fast ();
+// OBSOLETE target_mourn_inferior ();
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE /* Clean up after the inferior dies. */
+// OBSOLETE
+// OBSOLETE static void
+// OBSOLETE m3_mourn_inferior (void)
+// OBSOLETE {
+// OBSOLETE unpush_target (&m3_ops);
+// OBSOLETE generic_mourn_inferior ();
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE
+// OBSOLETE /* Fork an inferior process, and start debugging it. */
+// OBSOLETE
+// OBSOLETE static void
+// OBSOLETE m3_create_inferior (char *exec_file, char *allargs, char **env)
+// OBSOLETE {
+// OBSOLETE fork_inferior (exec_file, allargs, env, m3_trace_me, m3_trace_him, NULL, NULL);
+// OBSOLETE /* We are at the first instruction we care about. */
+// OBSOLETE /* Pedal to the metal... */
+// OBSOLETE proceed ((CORE_ADDR) -1, 0, 0);
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE /* Mark our target-struct as eligible for stray "run" and "attach"
+// OBSOLETE commands. */
+// OBSOLETE static int
+// OBSOLETE m3_can_run (void)
+// OBSOLETE {
+// OBSOLETE return 1;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE /* Mach 3.0 does not need ptrace for anything
+// OBSOLETE * Make sure nobody uses it on mach.
+// OBSOLETE */
+// OBSOLETE ptrace (int a, int b, int c, int d)
+// OBSOLETE {
+// OBSOLETE error ("Lose, Lose! Somebody called ptrace\n");
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE /* Resume execution of the inferior process.
+// OBSOLETE If STEP is nonzero, single-step it.
+// OBSOLETE If SIGNAL is nonzero, give it that signal. */
+// OBSOLETE
+// OBSOLETE void
+// OBSOLETE m3_resume (ptid_t ptid, int step, enum target_signal signal)
+// OBSOLETE {
+// OBSOLETE kern_return_t ret;
+// OBSOLETE
+// OBSOLETE if (step)
+// OBSOLETE {
+// OBSOLETE thread_basic_info_data_t th_info;
+// OBSOLETE unsigned int infoCnt = THREAD_BASIC_INFO_COUNT;
+// OBSOLETE
+// OBSOLETE /* There is no point in single stepping when current_thread
+// OBSOLETE * is dead.
+// OBSOLETE */
+// OBSOLETE if (!MACH_PORT_VALID (current_thread))
+// OBSOLETE error ("No thread selected; can not single step");
+// OBSOLETE
+// OBSOLETE /* If current_thread is suspended, tracing it would never return.
+// OBSOLETE */
+// OBSOLETE ret = thread_info (current_thread,
+// OBSOLETE THREAD_BASIC_INFO,
+// OBSOLETE (thread_info_t) & th_info,
+// OBSOLETE &infoCnt);
+// OBSOLETE CHK ("child_resume: can't get thread info", ret);
+// OBSOLETE
+// OBSOLETE if (th_info.suspend_count)
+// OBSOLETE error ("Can't trace a suspended thread. Use \"thread resume\" command to resume it");
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE vm_read_cache_valid = FALSE;
+// OBSOLETE
+// OBSOLETE if (signal && PIDGET (inferior_ptid) > 0) /* Do not signal, if attached by MID */
+// OBSOLETE kill (PIDGET (inferior_ptid), target_signal_to_host (signal));
+// OBSOLETE
+// OBSOLETE if (step)
+// OBSOLETE {
+// OBSOLETE suspend_all_threads (0);
+// OBSOLETE
+// OBSOLETE setup_single_step (current_thread, TRUE);
+// OBSOLETE
+// OBSOLETE ret = thread_resume (current_thread);
+// OBSOLETE CHK ("thread_resume", ret);
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE ret = task_resume (inferior_task);
+// OBSOLETE if (ret == KERN_FAILURE)
+// OBSOLETE warning ("Task was not suspended");
+// OBSOLETE else
+// OBSOLETE CHK ("Resuming task", ret);
+// OBSOLETE
+// OBSOLETE /* HACK HACK This is needed by the multiserver system HACK HACK */
+// OBSOLETE while ((ret = task_resume (inferior_task)) == KERN_SUCCESS)
+// OBSOLETE /* make sure it really runs */ ;
+// OBSOLETE /* HACK HACK This is needed by the multiserver system HACK HACK */
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE #ifdef ATTACH_DETACH
+// OBSOLETE
+// OBSOLETE /* Start debugging the process with the given task */
+// OBSOLETE void
+// OBSOLETE task_attach (task_t tid)
+// OBSOLETE {
+// OBSOLETE kern_return_t ret;
+// OBSOLETE inferior_task = tid;
+// OBSOLETE
+// OBSOLETE ret = task_suspend (inferior_task);
+// OBSOLETE CHK ("task_attach: task_suspend", ret);
+// OBSOLETE
+// OBSOLETE must_suspend_thread = 0;
+// OBSOLETE
+// OBSOLETE setup_notify_port (1);
+// OBSOLETE
+// OBSOLETE request_notify (inferior_task, MACH_NOTIFY_DEAD_NAME, MACH_TYPE_TASK);
+// OBSOLETE
+// OBSOLETE setup_exception_port ();
+// OBSOLETE
+// OBSOLETE emulator_present = have_emulator_p (inferior_task);
+// OBSOLETE
+// OBSOLETE attach_flag = 1;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE /* Well, we can call error also here and leave the
+// OBSOLETE * target stack inconsistent. Sigh.
+// OBSOLETE * Fix this sometime (the only way to fail here is that
+// OBSOLETE * the task has no threads at all, which is rare, but
+// OBSOLETE * possible; or if the target task has died, which is also
+// OBSOLETE * possible, but unlikely, since it has been suspended.
+// OBSOLETE * (Someone must have killed it))
+// OBSOLETE */
+// OBSOLETE void
+// OBSOLETE attach_to_thread (void)
+// OBSOLETE {
+// OBSOLETE if (select_thread (inferior_task, 0, 1) != KERN_SUCCESS)
+// OBSOLETE error ("Could not select any threads to attach to");
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE mid_attach (int mid)
+// OBSOLETE {
+// OBSOLETE kern_return_t ret;
+// OBSOLETE
+// OBSOLETE ret = machid_mach_port (mid_server, mid_auth, mid, &inferior_task);
+// OBSOLETE CHK ("mid_attach: machid_mach_port", ret);
+// OBSOLETE
+// OBSOLETE task_attach (inferior_task);
+// OBSOLETE
+// OBSOLETE return mid;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE /*
+// OBSOLETE * Start debugging the process whose unix process-id is PID.
+// OBSOLETE * A negative "pid" value is legal and signifies a mach_id not a unix pid.
+// OBSOLETE *
+// OBSOLETE * Prevent (possible unwanted) dangerous operations by enabled users
+// OBSOLETE * like "atta 0" or "atta foo" (equal to the previous :-) and
+// OBSOLETE * "atta pidself". Anyway, the latter is allowed by specifying a MID.
+// OBSOLETE */
+// OBSOLETE static int
+// OBSOLETE m3_do_attach (int pid)
+// OBSOLETE {
+// OBSOLETE kern_return_t ret;
+// OBSOLETE
+// OBSOLETE if (pid == 0)
+// OBSOLETE error ("MID=0, Debugging the master unix server does not compute");
+// OBSOLETE
+// OBSOLETE /* Foo. This assumes gdb has a unix pid */
+// OBSOLETE if (pid == getpid ())
+// OBSOLETE error ("I will debug myself only by mid. (Gdb would suspend itself!)");
+// OBSOLETE
+// OBSOLETE if (pid < 0)
+// OBSOLETE {
+// OBSOLETE mid_attach (-(pid));
+// OBSOLETE
+// OBSOLETE /* inferior_ptid will be NEGATIVE! */
+// OBSOLETE inferior_ptid = pid_to_ptid (pid);
+// OBSOLETE
+// OBSOLETE return PIDGET (inferior_ptid);
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE inferior_task = task_by_pid (pid);
+// OBSOLETE if (!MACH_PORT_VALID (inferior_task))
+// OBSOLETE error ("Cannot map Unix pid %d to Mach task port", pid);
+// OBSOLETE
+// OBSOLETE task_attach (inferior_task);
+// OBSOLETE
+// OBSOLETE inferior_ptid = pid_to_ptid (pid);
+// OBSOLETE
+// OBSOLETE return PIDGET (inferior_ptid);
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE /* Attach to process PID, then initialize for debugging it
+// OBSOLETE and wait for the trace-trap that results from attaching. */
+// OBSOLETE
+// OBSOLETE static void
+// OBSOLETE m3_attach (char *args, int from_tty)
+// OBSOLETE {
+// OBSOLETE char *exec_file;
+// OBSOLETE int pid;
+// OBSOLETE
+// OBSOLETE if (!args)
+// OBSOLETE error_no_arg ("process-id to attach");
+// OBSOLETE
+// OBSOLETE pid = atoi (args);
+// OBSOLETE
+// OBSOLETE if (pid == getpid ()) /* Trying to masturbate? */
+// OBSOLETE error ("I refuse to debug myself!");
+// OBSOLETE
+// OBSOLETE if (from_tty)
+// OBSOLETE {
+// OBSOLETE exec_file = (char *) get_exec_file (0);
+// OBSOLETE
+// OBSOLETE if (exec_file)
+// OBSOLETE printf_unfiltered ("Attaching to program `%s', %s\n", exec_file,
+// OBSOLETE target_pid_to_str (pid_to_ptid (pid)));
+// OBSOLETE else
+// OBSOLETE printf_unfiltered ("Attaching to %s\n",
+// OBSOLETE target_pid_to_str (pid_to_ptid (pid)));
+// OBSOLETE
+// OBSOLETE gdb_flush (gdb_stdout);
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE m3_do_attach (pid_to_ptid (pid));
+// OBSOLETE inferior_ptid = pid_to_ptid (pid);
+// OBSOLETE push_target (&m3_ops);
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE void
+// OBSOLETE deallocate_inferior_ports (void)
+// OBSOLETE {
+// OBSOLETE kern_return_t ret;
+// OBSOLETE thread_array_t thread_list;
+// OBSOLETE int thread_count, index;
+// OBSOLETE
+// OBSOLETE if (!MACH_PORT_VALID (inferior_task))
+// OBSOLETE return;
+// OBSOLETE
+// OBSOLETE ret = task_threads (inferior_task, &thread_list, &thread_count);
+// OBSOLETE if (ret != KERN_SUCCESS)
+// OBSOLETE {
+// OBSOLETE warning ("deallocate_inferior_ports: task_threads",
+// OBSOLETE mach_error_string (ret));
+// OBSOLETE return;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE /* Get rid of send rights to task threads */
+// OBSOLETE for (index = 0; index < thread_count; index++)
+// OBSOLETE {
+// OBSOLETE int rights;
+// OBSOLETE ret = mach_port_get_refs (mach_task_self (),
+// OBSOLETE thread_list[index],
+// OBSOLETE MACH_PORT_RIGHT_SEND,
+// OBSOLETE &rights);
+// OBSOLETE CHK ("deallocate_inferior_ports: get refs", ret);
+// OBSOLETE
+// OBSOLETE if (rights > 0)
+// OBSOLETE {
+// OBSOLETE ret = mach_port_mod_refs (mach_task_self (),
+// OBSOLETE thread_list[index],
+// OBSOLETE MACH_PORT_RIGHT_SEND,
+// OBSOLETE -rights);
+// OBSOLETE CHK ("deallocate_inferior_ports: mod refs", ret);
+// OBSOLETE }
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE ret = mach_port_mod_refs (mach_task_self (),
+// OBSOLETE inferior_exception_port,
+// OBSOLETE MACH_PORT_RIGHT_RECEIVE,
+// OBSOLETE -1);
+// OBSOLETE CHK ("deallocate_inferior_ports: cannot get rid of exception port", ret);
+// OBSOLETE
+// OBSOLETE ret = mach_port_deallocate (mach_task_self (),
+// OBSOLETE inferior_task);
+// OBSOLETE CHK ("deallocate_task_port: deallocating inferior_task", ret);
+// OBSOLETE
+// OBSOLETE current_thread = MACH_PORT_NULL;
+// OBSOLETE inferior_task = MACH_PORT_NULL;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE /* Stop debugging the process whose number is PID
+// OBSOLETE and continue it with signal number SIGNAL.
+// OBSOLETE SIGNAL = 0 means just continue it. */
+// OBSOLETE
+// OBSOLETE static void
+// OBSOLETE m3_do_detach (int signal)
+// OBSOLETE {
+// OBSOLETE kern_return_t ret;
+// OBSOLETE
+// OBSOLETE MACH_ERROR_NO_INFERIOR;
+// OBSOLETE
+// OBSOLETE if (current_thread != MACH_PORT_NULL)
+// OBSOLETE {
+// OBSOLETE /* Store the gdb's view of the thread we are deselecting
+// OBSOLETE * before we detach.
+// OBSOLETE * @@ I am really not sure if this is ever needeed.
+// OBSOLETE */
+// OBSOLETE target_prepare_to_store ();
+// OBSOLETE target_store_registers (-1);
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE ret = task_set_special_port (inferior_task,
+// OBSOLETE TASK_EXCEPTION_PORT,
+// OBSOLETE inferior_old_exception_port);
+// OBSOLETE CHK ("task_set_special_port", ret);
+// OBSOLETE
+// OBSOLETE /* Discard all requested notifications */
+// OBSOLETE setup_notify_port (0);
+// OBSOLETE
+// OBSOLETE if (remove_breakpoints ())
+// OBSOLETE warning ("Could not remove breakpoints when detaching");
+// OBSOLETE
+// OBSOLETE if (signal && PIDGET (inferior_ptid) > 0)
+// OBSOLETE kill (PIDGET (inferior_ptid), signal);
+// OBSOLETE
+// OBSOLETE /* the task might be dead by now */
+// OBSOLETE (void) task_resume (inferior_task);
+// OBSOLETE
+// OBSOLETE deallocate_inferior_ports ();
+// OBSOLETE
+// OBSOLETE attach_flag = 0;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE /* Take a program previously attached to and detaches it.
+// OBSOLETE The program resumes execution and will no longer stop
+// OBSOLETE on signals, etc. We'd better not have left any breakpoints
+// OBSOLETE in the program or it'll die when it hits one. For this
+// OBSOLETE to work, it may be necessary for the process to have been
+// OBSOLETE previously attached. It *might* work if the program was
+// OBSOLETE started via fork. */
+// OBSOLETE
+// OBSOLETE static void
+// OBSOLETE m3_detach (char *args, int from_tty)
+// OBSOLETE {
+// OBSOLETE int siggnal = 0;
+// OBSOLETE
+// OBSOLETE if (from_tty)
+// OBSOLETE {
+// OBSOLETE char *exec_file = get_exec_file (0);
+// OBSOLETE if (exec_file == 0)
+// OBSOLETE exec_file = "";
+// OBSOLETE printf_unfiltered ("Detaching from program: %s %s\n",
+// OBSOLETE exec_file, target_pid_to_str (inferior_ptid));
+// OBSOLETE gdb_flush (gdb_stdout);
+// OBSOLETE }
+// OBSOLETE if (args)
+// OBSOLETE siggnal = atoi (args);
+// OBSOLETE
+// OBSOLETE m3_do_detach (siggnal);
+// OBSOLETE inferior_ptid = null_ptid;
+// OBSOLETE unpush_target (&m3_ops); /* Pop out of handling an inferior */
+// OBSOLETE }
+// OBSOLETE #endif /* ATTACH_DETACH */
+// OBSOLETE
+// OBSOLETE /* Get ready to modify the registers array. On machines which store
+// OBSOLETE individual registers, this doesn't need to do anything. On machines
+// OBSOLETE which store all the registers in one fell swoop, this makes sure
+// OBSOLETE that registers contains all the registers from the program being
+// OBSOLETE debugged. */
+// OBSOLETE
+// OBSOLETE static void
+// OBSOLETE m3_prepare_to_store (void)
+// OBSOLETE {
+// OBSOLETE #ifdef CHILD_PREPARE_TO_STORE
+// OBSOLETE CHILD_PREPARE_TO_STORE ();
+// OBSOLETE #endif
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE /* Print status information about what we're accessing. */
+// OBSOLETE
+// OBSOLETE static void
+// OBSOLETE m3_files_info (struct target_ops *ignore)
+// OBSOLETE {
+// OBSOLETE /* FIXME: should print MID and all that crap. */
+// OBSOLETE printf_unfiltered ("\tUsing the running image of %s %s.\n",
+// OBSOLETE attach_flag ? "attached" : "child", target_pid_to_str (inferior_ptid));
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE static void
+// OBSOLETE m3_open (char *arg, int from_tty)
+// OBSOLETE {
+// OBSOLETE error ("Use the \"run\" command to start a Unix child process.");
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE #ifdef DUMP_SYSCALL
+// OBSOLETE #define STR(x) #x
+// OBSOLETE
+// OBSOLETE char *bsd1_names[] =
+// OBSOLETE {
+// OBSOLETE "execve",
+// OBSOLETE "fork",
+// OBSOLETE "take_signal",
+// OBSOLETE "sigreturn",
+// OBSOLETE "getrusage",
+// OBSOLETE "chdir",
+// OBSOLETE "chroot",
+// OBSOLETE "open",
+// OBSOLETE "creat",
+// OBSOLETE "mknod",
+// OBSOLETE "link",
+// OBSOLETE "symlink",
+// OBSOLETE "unlink",
+// OBSOLETE "access",
+// OBSOLETE "stat",
+// OBSOLETE "readlink",
+// OBSOLETE "chmod",
+// OBSOLETE "chown",
+// OBSOLETE "utimes",
+// OBSOLETE "truncate",
+// OBSOLETE "rename",
+// OBSOLETE "mkdir",
+// OBSOLETE "rmdir",
+// OBSOLETE "xutimes",
+// OBSOLETE "mount",
+// OBSOLETE "umount",
+// OBSOLETE "acct",
+// OBSOLETE "setquota",
+// OBSOLETE "write_short",
+// OBSOLETE "write_long",
+// OBSOLETE "send_short",
+// OBSOLETE "send_long",
+// OBSOLETE "sendto_short",
+// OBSOLETE "sendto_long",
+// OBSOLETE "select",
+// OBSOLETE "task_by_pid",
+// OBSOLETE "recvfrom_short",
+// OBSOLETE "recvfrom_long",
+// OBSOLETE "setgroups",
+// OBSOLETE "setrlimit",
+// OBSOLETE "sigvec",
+// OBSOLETE "sigstack",
+// OBSOLETE "settimeofday",
+// OBSOLETE "adjtime",
+// OBSOLETE "setitimer",
+// OBSOLETE "sethostname",
+// OBSOLETE "bind",
+// OBSOLETE "accept",
+// OBSOLETE "connect",
+// OBSOLETE "setsockopt",
+// OBSOLETE "getsockopt",
+// OBSOLETE "getsockname",
+// OBSOLETE "getpeername",
+// OBSOLETE "init_process",
+// OBSOLETE "table_set",
+// OBSOLETE "table_get",
+// OBSOLETE "pioctl",
+// OBSOLETE "emulator_error",
+// OBSOLETE "readwrite",
+// OBSOLETE "share_wakeup",
+// OBSOLETE 0,
+// OBSOLETE "maprw_request_it",
+// OBSOLETE "maprw_release_it",
+// OBSOLETE "maprw_remap",
+// OBSOLETE "pid_by_task",
+// OBSOLETE };
+// OBSOLETE
+// OBSOLETE int bsd1_nnames = sizeof (bsd1_names) / sizeof (bsd1_names[0]);
+// OBSOLETE
+// OBSOLETE char *
+// OBSOLETE name_str (int name, char *buf)
+// OBSOLETE {
+// OBSOLETE switch (name)
+// OBSOLETE {
+// OBSOLETE case MACH_MSG_TYPE_BOOLEAN:
+// OBSOLETE return "boolean";
+// OBSOLETE case MACH_MSG_TYPE_INTEGER_16:
+// OBSOLETE return "short";
+// OBSOLETE case MACH_MSG_TYPE_INTEGER_32:
+// OBSOLETE return "long";
+// OBSOLETE case MACH_MSG_TYPE_CHAR:
+// OBSOLETE return "char";
+// OBSOLETE case MACH_MSG_TYPE_BYTE:
+// OBSOLETE return "byte";
+// OBSOLETE case MACH_MSG_TYPE_REAL:
+// OBSOLETE return "real";
+// OBSOLETE case MACH_MSG_TYPE_STRING:
+// OBSOLETE return "string";
+// OBSOLETE default:
+// OBSOLETE sprintf (buf, "%d", name);
+// OBSOLETE return buf;
+// OBSOLETE }
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE char *
+// OBSOLETE id_str (int id, char *buf)
+// OBSOLETE {
+// OBSOLETE char *p;
+// OBSOLETE if (id >= 101000 && id < 101000 + bsd1_nnames)
+// OBSOLETE {
+// OBSOLETE if (p = bsd1_names[id - 101000])
+// OBSOLETE return p;
+// OBSOLETE }
+// OBSOLETE if (id == 102000)
+// OBSOLETE return "psignal_retry";
+// OBSOLETE if (id == 100000)
+// OBSOLETE return "syscall";
+// OBSOLETE sprintf (buf, "%d", id);
+// OBSOLETE return buf;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE print_msg (mach_msg_header_t *mp)
+// OBSOLETE {
+// OBSOLETE char *fmt_x = "%20s : 0x%08x\n";
+// OBSOLETE char *fmt_d = "%20s : %10d\n";
+// OBSOLETE char *fmt_s = "%20s : %s\n";
+// OBSOLETE char buf[100];
+// OBSOLETE
+// OBSOLETE puts_filtered ("\n");
+// OBSOLETE #define pr(fmt,h,x) printf_filtered(fmt,STR(x),(h).x)
+// OBSOLETE pr (fmt_x, (*mp), msgh_bits);
+// OBSOLETE pr (fmt_d, (*mp), msgh_size);
+// OBSOLETE pr (fmt_x, (*mp), msgh_remote_port);
+// OBSOLETE pr (fmt_x, (*mp), msgh_local_port);
+// OBSOLETE pr (fmt_d, (*mp), msgh_kind);
+// OBSOLETE printf_filtered (fmt_s, STR (msgh_id), id_str (mp->msgh_id, buf));
+// OBSOLETE
+// OBSOLETE if (debug_level > 1)
+// OBSOLETE {
+// OBSOLETE char *p, *ep, *dp;
+// OBSOLETE int plen;
+// OBSOLETE p = (char *) mp;
+// OBSOLETE ep = p + mp->msgh_size;
+// OBSOLETE p += sizeof (*mp);
+// OBSOLETE for (; p < ep; p += plen)
+// OBSOLETE {
+// OBSOLETE mach_msg_type_t *tp;
+// OBSOLETE mach_msg_type_long_t *tlp;
+// OBSOLETE int name, size, number;
+// OBSOLETE tp = (mach_msg_type_t *) p;
+// OBSOLETE if (tp->msgt_longform)
+// OBSOLETE {
+// OBSOLETE tlp = (mach_msg_type_long_t *) tp;
+// OBSOLETE name = tlp->msgtl_name;
+// OBSOLETE size = tlp->msgtl_size;
+// OBSOLETE number = tlp->msgtl_number;
+// OBSOLETE plen = sizeof (*tlp);
+// OBSOLETE }
+// OBSOLETE else
+// OBSOLETE {
+// OBSOLETE name = tp->msgt_name;
+// OBSOLETE size = tp->msgt_size;
+// OBSOLETE number = tp->msgt_number;
+// OBSOLETE plen = sizeof (*tp);
+// OBSOLETE }
+// OBSOLETE printf_filtered ("name=%-16s size=%2d number=%7d inline=%d long=%d deal=%d\n",
+// OBSOLETE name_str (name, buf), size, number, tp->msgt_inline,
+// OBSOLETE tp->msgt_longform, tp->msgt_deallocate);
+// OBSOLETE dp = p + plen;
+// OBSOLETE if (tp->msgt_inline)
+// OBSOLETE {
+// OBSOLETE int l;
+// OBSOLETE l = size * number / 8;
+// OBSOLETE l = (l + sizeof (long) - 1) & ~((sizeof (long)) - 1);
+// OBSOLETE plen += l;
+// OBSOLETE print_data (dp, size, number);
+// OBSOLETE }
+// OBSOLETE else
+// OBSOLETE {
+// OBSOLETE plen += sizeof (int *);
+// OBSOLETE }
+// OBSOLETE printf_filtered ("plen=%d\n", plen);
+// OBSOLETE }
+// OBSOLETE }
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE print_data (char *p, int size, int number)
+// OBSOLETE {
+// OBSOLETE int *ip;
+// OBSOLETE short *sp;
+// OBSOLETE int i;
+// OBSOLETE
+// OBSOLETE switch (size)
+// OBSOLETE {
+// OBSOLETE case 8:
+// OBSOLETE for (i = 0; i < number; i++)
+// OBSOLETE {
+// OBSOLETE printf_filtered (" %02x", p[i]);
+// OBSOLETE }
+// OBSOLETE break;
+// OBSOLETE case 16:
+// OBSOLETE sp = (short *) p;
+// OBSOLETE for (i = 0; i < number; i++)
+// OBSOLETE {
+// OBSOLETE printf_filtered (" %04x", sp[i]);
+// OBSOLETE }
+// OBSOLETE break;
+// OBSOLETE case 32:
+// OBSOLETE ip = (int *) p;
+// OBSOLETE for (i = 0; i < number; i++)
+// OBSOLETE {
+// OBSOLETE printf_filtered (" %08x", ip[i]);
+// OBSOLETE }
+// OBSOLETE break;
+// OBSOLETE }
+// OBSOLETE puts_filtered ("\n");
+// OBSOLETE }
+// OBSOLETE #endif /* DUMP_SYSCALL */
+// OBSOLETE
+// OBSOLETE static void
+// OBSOLETE m3_stop (void)
+// OBSOLETE {
+// OBSOLETE error ("to_stop target function not implemented");
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE static char *
+// OBSOLETE m3_pid_to_exec_file (int pid)
+// OBSOLETE {
+// OBSOLETE error ("to_pid_to_exec_file target function not implemented");
+// OBSOLETE return NULL; /* To keep all compilers happy. */
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE static void
+// OBSOLETE init_m3_ops (void)
+// OBSOLETE {
+// OBSOLETE m3_ops.to_shortname = "mach";
+// OBSOLETE m3_ops.to_longname = "Mach child process";
+// OBSOLETE m3_ops.to_doc = "Mach child process (started by the \"run\" command).";
+// OBSOLETE m3_ops.to_open = m3_open;
+// OBSOLETE m3_ops.to_attach = m3_attach;
+// OBSOLETE m3_ops.to_detach = m3_detach;
+// OBSOLETE m3_ops.to_resume = m3_resume;
+// OBSOLETE m3_ops.to_wait = mach_really_wait;
+// OBSOLETE m3_ops.to_fetch_registers = fetch_inferior_registers;
+// OBSOLETE m3_ops.to_store_registers = store_inferior_registers;
+// OBSOLETE m3_ops.to_prepare_to_store = m3_prepare_to_store;
+// OBSOLETE m3_ops.to_xfer_memory = m3_xfer_memory;
+// OBSOLETE m3_ops.to_files_info = m3_files_info;
+// OBSOLETE m3_ops.to_insert_breakpoint = memory_insert_breakpoint;
+// OBSOLETE m3_ops.to_remove_breakpoint = memory_remove_breakpoint;
+// OBSOLETE m3_ops.to_terminal_init = terminal_init_inferior;
+// OBSOLETE m3_ops.to_terminal_inferior = terminal_inferior;
+// OBSOLETE m3_ops.to_terminal_ours_for_output = terminal_ours_for_output;
+// OBSOLETE m3_ops.to_terminal_save_ours = terminal_save_ours;
+// OBSOLETE m3_ops.to_terminal_ours = terminal_ours;
+// OBSOLETE m3_ops.to_terminal_info = child_terminal_info;
+// OBSOLETE m3_ops.to_kill = m3_kill_inferior;
+// OBSOLETE m3_ops.to_create_inferior = m3_create_inferior;
+// OBSOLETE m3_ops.to_mourn_inferior = m3_mourn_inferior;
+// OBSOLETE m3_ops.to_can_run = m3_can_run;
+// OBSOLETE m3_ops.to_stop = m3_stop;
+// OBSOLETE m3_ops.to_pid_to_exec_file = m3_pid_to_exec_file;
+// OBSOLETE m3_ops.to_stratum = process_stratum;
+// OBSOLETE m3_ops.to_has_all_memory = 1;
+// OBSOLETE m3_ops.to_has_memory = 1;
+// OBSOLETE m3_ops.to_has_stack = 1;
+// OBSOLETE m3_ops.to_has_registers = 1;
+// OBSOLETE m3_ops.to_has_execution = 1;
+// OBSOLETE m3_ops.to_magic = OPS_MAGIC;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE void
+// OBSOLETE _initialize_m3_nat (void)
+// OBSOLETE {
+// OBSOLETE kern_return_t ret;
+// OBSOLETE
+// OBSOLETE init_m3_ops ();
+// OBSOLETE add_target (&m3_ops);
+// OBSOLETE
+// OBSOLETE ret = mach_port_allocate (mach_task_self (),
+// OBSOLETE MACH_PORT_RIGHT_PORT_SET,
+// OBSOLETE &inferior_wait_port_set);
+// OBSOLETE if (ret != KERN_SUCCESS)
+// OBSOLETE internal_error (__FILE__, __LINE__,
+// OBSOLETE "initial port set %s", mach_error_string (ret));
+// OBSOLETE
+// OBSOLETE /* mach_really_wait now waits for this */
+// OBSOLETE currently_waiting_for = inferior_wait_port_set;
+// OBSOLETE
+// OBSOLETE ret = netname_look_up (name_server_port, hostname, "MachID", &mid_server);
+// OBSOLETE if (ret != KERN_SUCCESS)
+// OBSOLETE {
+// OBSOLETE mid_server = MACH_PORT_NULL;
+// OBSOLETE
+// OBSOLETE warning ("initialize machid: netname_lookup_up(MachID) : %s",
+// OBSOLETE mach_error_string (ret));
+// OBSOLETE warning ("Some (most?) features disabled...");
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE mid_auth = mach_privileged_host_port ();
+// OBSOLETE if (mid_auth == MACH_PORT_NULL)
+// OBSOLETE mid_auth = mach_task_self ();
+// OBSOLETE
+// OBSOLETE obstack_init (port_chain_obstack);
+// OBSOLETE
+// OBSOLETE ret = mach_port_allocate (mach_task_self (),
+// OBSOLETE MACH_PORT_RIGHT_RECEIVE,
+// OBSOLETE &thread_exception_port);
+// OBSOLETE CHK ("Creating thread_exception_port for single stepping", ret);
+// OBSOLETE
+// OBSOLETE ret = mach_port_insert_right (mach_task_self (),
+// OBSOLETE thread_exception_port,
+// OBSOLETE thread_exception_port,
+// OBSOLETE MACH_MSG_TYPE_MAKE_SEND);
+// OBSOLETE CHK ("Inserting send right to thread_exception_port", ret);
+// OBSOLETE
+// OBSOLETE /* Allocate message port */
+// OBSOLETE ret = mach_port_allocate (mach_task_self (),
+// OBSOLETE MACH_PORT_RIGHT_RECEIVE,
+// OBSOLETE &our_message_port);
+// OBSOLETE if (ret != KERN_SUCCESS)
+// OBSOLETE warning ("Creating message port %s", mach_error_string (ret));
+// OBSOLETE else
+// OBSOLETE {
+// OBSOLETE char buf[MAX_NAME_LEN];
+// OBSOLETE ret = mach_port_move_member (mach_task_self (),
+// OBSOLETE our_message_port,
+// OBSOLETE inferior_wait_port_set);
+// OBSOLETE if (ret != KERN_SUCCESS)
+// OBSOLETE warning ("message move member %s", mach_error_string (ret));
+// OBSOLETE
+// OBSOLETE
+// OBSOLETE /* @@@@ No way to change message port name currently */
+// OBSOLETE /* Foo. This assumes gdb has a unix pid */
+// OBSOLETE sprintf (buf, "gdb-%d", getpid ());
+// OBSOLETE gdb_register_port (buf, our_message_port);
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE /* Heap for thread commands */
+// OBSOLETE obstack_init (cproc_obstack);
+// OBSOLETE
+// OBSOLETE add_mach_specific_commands ();
+// OBSOLETE }
diff --git a/gdb/m68hc11-tdep.c b/gdb/m68hc11-tdep.c
index 6af823e..37d27a5 100644
--- a/gdb/m68hc11-tdep.c
+++ b/gdb/m68hc11-tdep.c
@@ -895,7 +895,7 @@ m68hc11_init_extra_frame_info (int fromleaf, struct frame_info *fi)
frame_extra_info_zalloc (fi, sizeof (struct frame_extra_info));
if (get_next_frame (fi))
- deprecated_update_frame_pc_hack (fi, FRAME_SAVED_PC (get_next_frame (fi)));
+ deprecated_update_frame_pc_hack (fi, DEPRECATED_FRAME_SAVED_PC (get_next_frame (fi)));
m68hc11_frame_init_saved_regs (fi);
@@ -1369,7 +1369,7 @@ m68hc11_gdbarch_init (struct gdbarch_info info,
set_gdbarch_write_pc (gdbarch, generic_target_write_pc);
set_gdbarch_read_fp (gdbarch, generic_target_read_fp);
set_gdbarch_read_sp (gdbarch, generic_target_read_sp);
- set_gdbarch_write_sp (gdbarch, generic_target_write_sp);
+ set_gdbarch_deprecated_dummy_write_sp (gdbarch, generic_target_write_sp);
set_gdbarch_sp_regnum (gdbarch, HARD_SP_REGNUM);
set_gdbarch_fp_regnum (gdbarch, SOFT_FP_REGNUM);
@@ -1380,51 +1380,45 @@ m68hc11_gdbarch_init (struct gdbarch_info info,
set_gdbarch_pseudo_register_read (gdbarch, m68hc11_pseudo_register_read);
set_gdbarch_pseudo_register_write (gdbarch, m68hc11_pseudo_register_write);
- set_gdbarch_call_dummy_length (gdbarch, 0);
set_gdbarch_call_dummy_address (gdbarch, m68hc11_call_dummy_address);
- set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 1); /*???*/
- set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 0);
- set_gdbarch_call_dummy_start_offset (gdbarch, 0);
set_gdbarch_call_dummy_words (gdbarch, m68hc11_call_dummy_words);
set_gdbarch_sizeof_call_dummy_words (gdbarch,
sizeof (m68hc11_call_dummy_words));
- set_gdbarch_call_dummy_p (gdbarch, 1);
- set_gdbarch_call_dummy_stack_adjust_p (gdbarch, 0);
- set_gdbarch_get_saved_register (gdbarch, deprecated_generic_get_saved_register);
- set_gdbarch_fix_call_dummy (gdbarch, generic_fix_call_dummy);
+ set_gdbarch_deprecated_get_saved_register (gdbarch, deprecated_generic_get_saved_register);
set_gdbarch_deprecated_extract_return_value (gdbarch, m68hc11_extract_return_value);
- set_gdbarch_push_arguments (gdbarch, m68hc11_push_arguments);
- set_gdbarch_push_return_address (gdbarch, m68hc11_push_return_address);
+ set_gdbarch_deprecated_push_arguments (gdbarch, m68hc11_push_arguments);
+ set_gdbarch_deprecated_push_return_address (gdbarch, m68hc11_push_return_address);
set_gdbarch_return_value_on_stack (gdbarch, m68hc11_return_value_on_stack);
- set_gdbarch_store_struct_return (gdbarch, m68hc11_store_struct_return);
+ set_gdbarch_deprecated_store_struct_return (gdbarch, m68hc11_store_struct_return);
set_gdbarch_deprecated_store_return_value (gdbarch, m68hc11_store_return_value);
set_gdbarch_deprecated_extract_struct_value_address (gdbarch, m68hc11_extract_struct_value_address);
set_gdbarch_register_convertible (gdbarch, generic_register_convertible_not);
- set_gdbarch_frame_chain (gdbarch, m68hc11_frame_chain);
- set_gdbarch_frame_saved_pc (gdbarch, m68hc11_frame_saved_pc);
+ set_gdbarch_deprecated_frame_chain (gdbarch, m68hc11_frame_chain);
+ set_gdbarch_deprecated_frame_saved_pc (gdbarch, m68hc11_frame_saved_pc);
set_gdbarch_frame_args_address (gdbarch, m68hc11_frame_args_address);
set_gdbarch_frame_locals_address (gdbarch, m68hc11_frame_locals_address);
- set_gdbarch_saved_pc_after_call (gdbarch, m68hc11_saved_pc_after_call);
+ set_gdbarch_deprecated_saved_pc_after_call (gdbarch, m68hc11_saved_pc_after_call);
set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown);
- set_gdbarch_get_saved_register (gdbarch, deprecated_generic_get_saved_register);
+ set_gdbarch_deprecated_get_saved_register (gdbarch, deprecated_generic_get_saved_register);
- set_gdbarch_store_struct_return (gdbarch, m68hc11_store_struct_return);
+ set_gdbarch_deprecated_store_struct_return (gdbarch, m68hc11_store_struct_return);
set_gdbarch_deprecated_store_return_value (gdbarch, m68hc11_store_return_value);
set_gdbarch_deprecated_extract_struct_value_address
(gdbarch, m68hc11_extract_struct_value_address);
set_gdbarch_use_struct_convention (gdbarch, m68hc11_use_struct_convention);
set_gdbarch_deprecated_init_extra_frame_info (gdbarch, m68hc11_init_extra_frame_info);
- set_gdbarch_pop_frame (gdbarch, m68hc11_pop_frame);
+ set_gdbarch_deprecated_pop_frame (gdbarch, m68hc11_pop_frame);
set_gdbarch_skip_prologue (gdbarch, m68hc11_skip_prologue);
set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
set_gdbarch_decr_pc_after_break (gdbarch, 0);
set_gdbarch_function_start_offset (gdbarch, 0);
set_gdbarch_breakpoint_from_pc (gdbarch, m68hc11_breakpoint_from_pc);
set_gdbarch_stack_align (gdbarch, m68hc11_stack_align);
+ set_gdbarch_deprecated_extra_stack_alignment_needed (gdbarch, 1);
set_gdbarch_print_insn (gdbarch, gdb_print_insn_m68hc11);
m68hc11_add_reggroups (gdbarch);
diff --git a/gdb/m68k-tdep.c b/gdb/m68k-tdep.c
index 6008a62..1ad176e 100644
--- a/gdb/m68k-tdep.c
+++ b/gdb/m68k-tdep.c
@@ -245,10 +245,10 @@ m68k_store_return_value (struct type *type, char *valbuf)
/* Describe the pointer in each stack frame to the previous stack frame
(its caller). */
-/* FRAME_CHAIN takes a frame's nominal address and produces the frame's
- chain-pointer.
- In the case of the 68000, the frame's nominal address
- is the address of a 4-byte word containing the calling frame's address. */
+/* DEPRECATED_FRAME_CHAIN takes a frame's nominal address and produces
+ the frame's chain-pointer. In the case of the 68000, the frame's
+ nominal address is the address of a 4-byte word containing the
+ calling frame's address. */
/* If we are chaining from sigtramp, then manufacture a sigtramp frame
(which isn't really on the stack. I'm not sure this is right for anything
@@ -359,7 +359,7 @@ int
isi_frame_num_args (struct frame_info *fi)
{
int val;
- CORE_ADDR pc = FRAME_SAVED_PC (fi);
+ CORE_ADDR pc = DEPRECATED_FRAME_SAVED_PC (fi);
int insn = read_memory_unsigned_integer (pc, 2);
val = 0;
if (insn == 0047757 || insn == 0157374) /* lea W(sp),sp or addaw #W,sp */
@@ -381,7 +381,7 @@ int
delta68_frame_num_args (struct frame_info *fi)
{
int val;
- CORE_ADDR pc = FRAME_SAVED_PC (fi);
+ CORE_ADDR pc = DEPRECATED_FRAME_SAVED_PC (fi);
int insn = read_memory_unsigned_integer (pc, 2);
val = 0;
if (insn == 0047757 || insn == 0157374) /* lea W(sp),sp or addaw #W,sp */
@@ -403,7 +403,7 @@ int
news_frame_num_args (struct frame_info *fi)
{
int val;
- CORE_ADDR pc = FRAME_SAVED_PC (fi);
+ CORE_ADDR pc = DEPRECATED_FRAME_SAVED_PC (fi);
int insn = read_memory_unsigned_integer (pc, 2);
val = 0;
if (insn == 0047757 || insn == 0157374) /* lea W(sp),sp or addaw #W,sp */
@@ -614,7 +614,7 @@ m68k_frame_init_saved_regs (struct frame_info *frame_info)
}
else
{
- pc = get_pc_function_start (get_frame_pc (frame_info));
+ pc = get_frame_func (frame_info);
nextinsn = read_memory_unsigned_integer (pc, 2);
if (P_PEA_FP == nextinsn
@@ -994,24 +994,24 @@ m68k_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_function_start_offset (gdbarch, 0);
set_gdbarch_skip_prologue (gdbarch, m68k_skip_prologue);
- set_gdbarch_saved_pc_after_call (gdbarch, m68k_saved_pc_after_call);
+ set_gdbarch_deprecated_saved_pc_after_call (gdbarch, m68k_saved_pc_after_call);
set_gdbarch_breakpoint_from_pc (gdbarch, m68k_local_breakpoint_from_pc);
/* Stack grows down. */
set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
set_gdbarch_stack_align (gdbarch, m68k_stack_align);
-
+ set_gdbarch_deprecated_extra_stack_alignment_needed (gdbarch, 1);
set_gdbarch_believe_pcc_promotion (gdbarch, 1);
set_gdbarch_decr_pc_after_break (gdbarch, 2);
- set_gdbarch_store_struct_return (gdbarch, m68k_store_struct_return);
+ set_gdbarch_deprecated_store_struct_return (gdbarch, m68k_store_struct_return);
set_gdbarch_deprecated_extract_return_value (gdbarch,
m68k_deprecated_extract_return_value);
set_gdbarch_deprecated_store_return_value (gdbarch, m68k_store_return_value);
- set_gdbarch_frame_chain (gdbarch, m68k_frame_chain);
- set_gdbarch_frame_saved_pc (gdbarch, m68k_frame_saved_pc);
+ set_gdbarch_deprecated_frame_chain (gdbarch, m68k_frame_chain);
+ set_gdbarch_deprecated_frame_saved_pc (gdbarch, m68k_frame_saved_pc);
set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, m68k_frame_init_saved_regs);
set_gdbarch_frameless_function_invocation (gdbarch,
m68k_frameless_function_invocation);
@@ -1038,20 +1038,19 @@ m68k_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_deprecated_use_generic_dummy_frames (gdbarch, 0);
set_gdbarch_call_dummy_location (gdbarch, ON_STACK);
- set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 1);
set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 24);
set_gdbarch_deprecated_pc_in_call_dummy (gdbarch, deprecated_pc_in_call_dummy_on_stack);
- set_gdbarch_call_dummy_p (gdbarch, 1);
- set_gdbarch_call_dummy_stack_adjust_p (gdbarch, 0);
set_gdbarch_call_dummy_length (gdbarch, 28);
set_gdbarch_call_dummy_start_offset (gdbarch, 12);
set_gdbarch_call_dummy_words (gdbarch, call_dummy_words);
set_gdbarch_sizeof_call_dummy_words (gdbarch, sizeof (call_dummy_words));
- set_gdbarch_call_dummy_stack_adjust_p (gdbarch, 0);
set_gdbarch_fix_call_dummy (gdbarch, m68k_fix_call_dummy);
set_gdbarch_deprecated_push_dummy_frame (gdbarch, m68k_push_dummy_frame);
- set_gdbarch_pop_frame (gdbarch, m68k_pop_frame);
+ set_gdbarch_deprecated_pop_frame (gdbarch, m68k_pop_frame);
+
+ /* Should be using push_dummy_call. */
+ set_gdbarch_deprecated_dummy_write_sp (gdbarch, generic_target_write_sp);
return gdbarch;
}
diff --git a/gdb/main.c b/gdb/main.c
index 559c521..fd25750 100644
--- a/gdb/main.c
+++ b/gdb/main.c
@@ -570,11 +570,7 @@ extern int gdbtk_test (char *);
/* Find it. */
struct interp *interp = interp_lookup (interpreter_p);
if (interp == NULL)
- {
- fprintf_unfiltered (gdb_stderr, "Interpreter `%s' unrecognized.\n",
- interpreter_p);
- exit (1);
- }
+ error ("Interpreter `%s' unrecognized", interpreter_p);
/* Install it. */
if (!interp_set (interp))
{
@@ -815,7 +811,9 @@ gdb_main (struct captured_main_args *args)
{
use_windows = args->use_windows;
catch_errors (captured_main, args, "", RETURN_MASK_ALL);
- return 0;
+ /* The only way to end up here is by an error (normal exit is
+ handled by quit_force()), hence always return an error status. */
+ return 1;
}
diff --git a/gdb/maint.c b/gdb/maint.c
index f2dfa68..2eb59ee 100644
--- a/gdb/maint.c
+++ b/gdb/maint.c
@@ -151,17 +151,8 @@ maintenance_demangle (char *args, int from_tty)
}
else
{
- switch (current_language->la_language)
- {
- case language_objc:
- /* Commented out until ObjC handling is enabled. */
- /* demangled = objc_demangle (args); */
- /* break; */
- case language_cplus:
- default:
- demangled = cplus_demangle (args, DMGL_ANSI | DMGL_PARAMS);
- break;
- }
+ demangled = language_demangle (current_language, args,
+ DMGL_ANSI | DMGL_PARAMS);
if (demangled != NULL)
{
printf_unfiltered ("%s\n", demangled);
@@ -443,6 +434,18 @@ maintenance_print_command (char *arg, int from_tty)
help_list (maintenanceprintlist, "maintenance print ", -1, gdb_stdout);
}
+/* The "maintenance list" command is defined as a prefix, with
+ allow_unknown 0. Therefore, its own definition is called only for
+ "maintenance list" with no args. */
+
+/* ARGSUSED */
+static void
+maintenance_list_command (char *arg, int from_tty)
+{
+ printf_unfiltered ("\"maintenance list\" must be followed by the name of a list command.\n");
+ help_list (maintenancelistlist, "maintenance list ", -1, gdb_stdout);
+}
+
/* The "maintenance translate-address" command converts a section and address
to a symbol. This can be called in two ways:
maintenance translate-address <secname> <addr>
@@ -741,6 +744,11 @@ lists all sections from all object files, including shared libraries.",
&maintenanceprintlist, "maintenance print ", 0,
&maintenancelist);
+ add_prefix_cmd ("list", class_maintenance, maintenance_list_command,
+ "Maintenance command for listing GDB internal state.",
+ &maintenancelistlist, "maintenance list ", 0,
+ &maintenancelist);
+
add_prefix_cmd ("set", class_maintenance, maintenance_set_cmd, "\
Set GDB internal variables used by the GDB maintainer.\n\
Configure variables internal to GDB that aid in GDB's maintenance",
@@ -819,6 +827,19 @@ If a SOURCE file is specified, dump only that file's partial symbols.",
"Print dump of current object file definitions.",
&maintenanceprintlist);
+ add_cmd ("symtabs", class_maintenance, maintenance_list_symtabs,
+ "List the full symbol tables for all object files.\n\
+This does not include information about individual symbols, blocks, or\n\
+linetables --- just the symbol table structures themselves.\n\
+With an argument REGEXP, list the symbol tables whose names that match that.",
+ &maintenancelistlist);
+
+ add_cmd ("psymtabs", class_maintenance, maintenance_list_psymtabs,
+ "List the partial symbol tables for all object files.\n\
+This does not include information about individual partial symbols,\n\
+just the symbol table structures themselves.",
+ &maintenancelistlist);
+
add_cmd ("statistics", class_maintenance, maintenance_print_statistics,
"Print statistics about internal gdb state.",
&maintenanceprintlist);
diff --git a/gdb/mcore-tdep.c b/gdb/mcore-tdep.c
index e5b6434..ab03f3a 100644
--- a/gdb/mcore-tdep.c
+++ b/gdb/mcore-tdep.c
@@ -671,7 +671,7 @@ mcore_frame_chain (struct frame_info * fi)
If our caller does not have a frame pointer, then his frame base
is <our base> + -<caller's frame size>. */
- dummy = analyze_dummy_frame (FRAME_SAVED_PC (fi), get_frame_base (fi));
+ dummy = analyze_dummy_frame (DEPRECATED_FRAME_SAVED_PC (fi), get_frame_base (fi));
if (get_frame_extra_info (dummy)->status & MY_FRAME_IN_FP)
{
@@ -803,7 +803,7 @@ mcore_pop_frame (void)
else
{
/* Write out the PC we saved. */
- write_register (PC_REGNUM, FRAME_SAVED_PC (fi));
+ write_register (PC_REGNUM, DEPRECATED_FRAME_SAVED_PC (fi));
/* Restore any saved registers. */
for (rn = 0; rn < NUM_REGS; rn++)
@@ -1047,7 +1047,7 @@ void
mcore_init_extra_frame_info (int fromleaf, struct frame_info *fi)
{
if (fi && get_next_frame (fi))
- deprecated_update_frame_pc_hack (fi, FRAME_SAVED_PC (get_next_frame (fi)));
+ deprecated_update_frame_pc_hack (fi, DEPRECATED_FRAME_SAVED_PC (get_next_frame (fi)));
frame_saved_regs_zalloc (fi);
@@ -1116,34 +1116,26 @@ mcore_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
/* Call Dummies: */
- set_gdbarch_call_dummy_p (gdbarch, 1);
set_gdbarch_call_dummy_words (gdbarch, call_dummy_words);
set_gdbarch_sizeof_call_dummy_words (gdbarch, 0);
- set_gdbarch_call_dummy_start_offset (gdbarch, 0);
- set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 1);
- set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 0);
- set_gdbarch_fix_call_dummy (gdbarch, generic_fix_call_dummy);
- set_gdbarch_call_dummy_address (gdbarch, entry_point_address);
set_gdbarch_save_dummy_frame_tos (gdbarch, generic_save_dummy_frame_tos);
- set_gdbarch_call_dummy_stack_adjust_p (gdbarch, 0);
- set_gdbarch_saved_pc_after_call (gdbarch, mcore_saved_pc_after_call);
+ set_gdbarch_deprecated_saved_pc_after_call (gdbarch, mcore_saved_pc_after_call);
set_gdbarch_function_start_offset (gdbarch, 0);
set_gdbarch_decr_pc_after_break (gdbarch, 0);
set_gdbarch_breakpoint_from_pc (gdbarch, mcore_breakpoint_from_pc);
- set_gdbarch_push_return_address (gdbarch, mcore_push_return_address);
- set_gdbarch_push_arguments (gdbarch, mcore_push_arguments);
- set_gdbarch_call_dummy_length (gdbarch, 0);
+ set_gdbarch_deprecated_push_return_address (gdbarch, mcore_push_return_address);
+ set_gdbarch_deprecated_push_arguments (gdbarch, mcore_push_arguments);
/* Frames: */
set_gdbarch_deprecated_init_extra_frame_info (gdbarch, mcore_init_extra_frame_info);
- set_gdbarch_frame_chain (gdbarch, mcore_frame_chain);
+ set_gdbarch_deprecated_frame_chain (gdbarch, mcore_frame_chain);
set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, mcore_frame_init_saved_regs);
- set_gdbarch_frame_saved_pc (gdbarch, mcore_frame_saved_pc);
+ set_gdbarch_deprecated_frame_saved_pc (gdbarch, mcore_frame_saved_pc);
set_gdbarch_deprecated_store_return_value (gdbarch, mcore_store_return_value);
set_gdbarch_deprecated_extract_return_value (gdbarch,
mcore_extract_return_value);
- set_gdbarch_store_struct_return (gdbarch, mcore_store_struct_return);
+ set_gdbarch_deprecated_store_struct_return (gdbarch, mcore_store_struct_return);
set_gdbarch_deprecated_extract_struct_value_address (gdbarch,
mcore_extract_struct_value_address);
set_gdbarch_skip_prologue (gdbarch, mcore_skip_prologue);
@@ -1151,7 +1143,7 @@ mcore_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_frame_args_address (gdbarch, mcore_frame_args_address);
set_gdbarch_frame_locals_address (gdbarch, mcore_frame_locals_address);
set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown);
- set_gdbarch_pop_frame (gdbarch, mcore_pop_frame);
+ set_gdbarch_deprecated_pop_frame (gdbarch, mcore_pop_frame);
set_gdbarch_virtual_frame_pointer (gdbarch, mcore_virtual_frame_pointer);
/* Misc.: */
@@ -1164,6 +1156,9 @@ mcore_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
between registers and stack. */
set_gdbarch_reg_struct_has_addr (gdbarch, mcore_reg_struct_has_addr);
+ /* Should be using push_dummy_call. */
+ set_gdbarch_deprecated_dummy_write_sp (gdbarch, generic_target_write_sp);
+
return gdbarch;
}
diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c
index a40a548..8642ee8 100644
--- a/gdb/mdebugread.c
+++ b/gdb/mdebugread.c
@@ -914,9 +914,13 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
method whose name is identical to the class name
(in particular constructor method names are different
from the class name). There is therefore no risk that
- this check stops the count on the StEnd of a method. */
- if (strcmp (debug_info->ss + cur_fdr->issBase + tsym.iss,
- name) == 0)
+ this check stops the count on the StEnd of a method.
+
+ Also, assume that we're really at the end when tsym.iss
+ is 0 (issNull). */
+ if (tsym.iss == issNull
+ || strcmp (debug_info->ss + cur_fdr->issBase + tsym.iss,
+ name) == 0)
goto end_of_fields;
break;
diff --git a/gdb/mi/ChangeLog b/gdb/mi/ChangeLog
index 4d137be..069abfb 100644
--- a/gdb/mi/ChangeLog
+++ b/gdb/mi/ChangeLog
@@ -1,3 +1,27 @@
+2003-04-02 Bob Rossi <bob_rossi@cox.net>
+
+ * mi-cmd-file.c: New file to implement mi file commands.
+ * mi-getopt.c (mi_valid_noargs): Added mi_valid_noargs to verify
+ if a set of parameters passed to an MI function has no arguments
+ * mi-getopt.h (mi_valid_noargs): Declare.
+ * mi-cmds.c (mi_cmds): Added -file-list-exec-source-file command.
+ * mi-cmds.h (mi_cmd_file_list_exec_source_file): Declare.
+
+2003-03-27 Andrew Cagney <cagney@redhat.com>
+
+ * gdbmi.texinfo: Delete file. Contents moved to
+ ../doc/gdb.texinfo.
+
+2003-03-12 Andrew Cagney <cagney@redhat.com>
+
+ * mi-main.c (get_register): Use frame_register instead of
+ get_saved_register.
+
+2003-03-08 Andrew Cagney <cagney@redhat.com>
+
+ * mi-out.c: Update copyright.
+ (mi_out_data): Define typedef. Use instead of ui_out_data.
+
2003-03-01 Andrew Cagney <cagney@redhat.com>
* mi-main.c (get_register): Use register_type instead of
diff --git a/gdb/mi/gdbmi.texinfo b/gdb/mi/gdbmi.texinfo
deleted file mode 100644
index da8b77c..0000000
--- a/gdb/mi/gdbmi.texinfo
+++ /dev/null
@@ -1,3902 +0,0 @@
-@c \input texinfo @c -*-texinfo-*-
-@c @c %**start of header
-@c @setfilename gdbmi.info
-@c @settitle GDB/MI Machine Interface
-@c @setchapternewpage off
-@c @c %**end of header
-
-@c @ifinfo
-@c This file documents GDB/MI, a Machine Interface to GDB.
-
-@c Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
-@c Contributed by Cygnus Solutions.
-
-@c Permission is granted to copy, distribute and/or modify this document
-@c under the terms of the GNU Free Documentation License, Version 1.1 or
-@c any later version published by the Free Software Foundation; with no
-@c Invariant Sections, with the Front-Cover Texts being ``A GNU Manual,''
-@c and with the Back-Cover Texts as in (a) below.
-
-@c (a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify
-@c this GNU Manual, like GNU software. Copies published by the Free
-@c Software Foundation raise funds for GNU development.''
-@c @end ifinfo
-
-@c @c This title page illustrates only one of the
-@c @c two methods of forming a title page.
-
-@c @titlepage
-@c @title GDB/MI
-@c @subtitle Version 0.3
-@c @subtitle Apr 2001
-@c @author Andrew Cagney, Fernando Nasser and Elena Zannoni
-
-@c @c The following two commands
-@c @c start the copyright page.
-@c @page
-@c @vskip 0pt plus 1filll
-
-@c Copyright @copyright{} 2000, 2001, 2002 Free Software Foundation, Inc.
-
-@c Permission is granted to copy, distribute and/or modify this document
-@c under the terms of the GNU Free Documentation License, Version 1.1 or
-@c any later version published by the Free Software Foundation; with no
-@c Invariant Sections, with the Front-Cover texts being ``A GNU Manual,''
-@c and with the Back-Cover Texts as in (a) below.
-
-@c (a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify
-@c this GNU Manual, like GNU software. Copies published by the Free
-@c Software Foundation raise funds for GNU development.''
-@c @end titlepage
-
-@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% CHAPTER %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-@node GDB/MI
-@chapter The @sc{gdb/mi} Interface
-
-@unnumberedsec Function and Purpose
-
-@cindex @sc{gdb/mi}, its purpose
-@sc{gdb/mi} is a line based machine oriented text interface to @value{GDBN}. It is
-specifically intended to support the development of systems which use
-the debugger as just one small component of a larger system.
-
-This chapter is a specification of the @sc{gdb/mi} interface. It is written
-in the form of a reference manual.
-
-Note that @sc{gdb/mi} is still under construction, so some of the
-features described below are incomplete and subject to change.
-
-@unnumberedsec Notation and Terminology
-
-@cindex notational conventions, for @sc{gdb/mi}
-This chapter uses the following notation:
-
-@itemize @bullet
-@item
-@code{|} separates two alternatives.
-
-@item
-@code{[ @var{something} ]} indicates that @var{something} is optional:
-it may or may not be given.
-
-@item
-@code{( @var{group} )*} means that @var{group} inside the parentheses
-may repeat zero or more times.
-
-@item
-@code{( @var{group} )+} means that @var{group} inside the parentheses
-may repeat one or more times.
-
-@item
-@code{"@var{string}"} means a literal @var{string}.
-@end itemize
-
-@ignore
-@heading Dependencies
-@end ignore
-
-@heading Acknowledgments
-
-In alphabetic order: Andrew Cagney, Fernando Nasser, Stan Shebs and
-Elena Zannoni.
-
-@menu
-* GDB/MI Command Syntax::
-* GDB/MI Compatibility with CLI::
-* GDB/MI Output Records::
-* GDB/MI Command Description Format::
-* GDB/MI Breakpoint Table Commands::
-* GDB/MI Data Manipulation::
-* GDB/MI Program Control::
-* GDB/MI Miscellaneous Commands::
-@ignore
-* GDB/MI Kod Commands::
-* GDB/MI Memory Overlay Commands::
-* GDB/MI Signal Handling Commands::
-@end ignore
-* GDB/MI Stack Manipulation::
-* GDB/MI Symbol Query::
-* GDB/MI Target Manipulation::
-* GDB/MI Thread Commands::
-* GDB/MI Tracepoint Commands::
-* GDB/MI Variable Objects::
-@end menu
-
-@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-@node GDB/MI Command Syntax
-@section @sc{gdb/mi} Command Syntax
-
-@menu
-* GDB/MI Input Syntax::
-* GDB/MI Output Syntax::
-* GDB/MI Simple Examples::
-@end menu
-
-@node GDB/MI Input Syntax
-@subsection @sc{gdb/mi} Input Syntax
-
-@cindex input syntax for @sc{gdb/mi}
-@cindex @sc{gdb/mi}, input syntax
-@table @code
-@item @var{command} @expansion{}
-@code{@var{cli-command} | @var{mi-command}}
-
-@item @var{cli-command} @expansion{}
-@code{[ @var{token} ] @var{cli-command} @var{nl}}, where
-@var{cli-command} is any existing @value{GDBN} CLI command.
-
-@item @var{mi-command} @expansion{}
-@code{[ @var{token} ] "-" @var{operation} ( " " @var{option} )*
-@code{[} " --" @code{]} ( " " @var{parameter} )* @var{nl}}
-
-@item @var{token} @expansion{}
-"any sequence of digits"
-
-@item @var{option} @expansion{}
-@code{"-" @var{parameter} [ " " @var{parameter} ]}
-
-@item @var{parameter} @expansion{}
-@code{@var{non-blank-sequence} | @var{c-string}}
-
-@item @var{operation} @expansion{}
-@emph{any of the operations described in this chapter}
-
-@item @var{non-blank-sequence} @expansion{}
-@emph{anything, provided it doesn't contain special characters such as
-"-", @var{nl}, """ and of course " "}
-
-@item @var{c-string} @expansion{}
-@code{""" @var{seven-bit-iso-c-string-content} """}
-
-@item @var{nl} @expansion{}
-@code{CR | CR-LF}
-@end table
-
-@noindent
-Notes:
-
-@itemize @bullet
-@item
-The CLI commands are still handled by the @sc{mi} interpreter; their
-output is described below.
-
-@item
-The @code{@var{token}}, when present, is passed back when the command
-finishes.
-
-@item
-Some @sc{mi} commands accept optional arguments as part of the parameter
-list. Each option is identified by a leading @samp{-} (dash) and may be
-followed by an optional argument parameter. Options occur first in the
-parameter list and can be delimited from normal parameters using
-@samp{--} (this is useful when some parameters begin with a dash).
-@end itemize
-
-Pragmatics:
-
-@itemize @bullet
-@item
-We want easy access to the existing CLI syntax (for debugging).
-
-@item
-We want it to be easy to spot a @sc{mi} operation.
-@end itemize
-
-@node GDB/MI Output Syntax
-@subsection @sc{gdb/mi} Output Syntax
-
-@cindex output syntax of @sc{gdb/mi}
-@cindex @sc{gdb/mi}, output syntax
-The output from @sc{gdb/mi} consists of zero or more out-of-band records
-followed, optionally, by a single result record. This result record
-is for the most recent command. The sequence of output records is
-terminated by @samp{(@value{GDBP})}.
-
-If an input command was prefixed with a @code{@var{token}} then the
-corresponding output for that command will also be prefixed by that same
-@var{token}.
-
-@table @code
-@item @var{output} @expansion{}
-@code{( @var{out-of-band-record} )* [ @var{result-record} ] "(gdb)" @var{nl}}
-
-@item @var{result-record} @expansion{}
-@code{ [ @var{token} ] "^" @var{result-class} ( "," @var{result} )* @var{nl}}
-
-@item @var{out-of-band-record} @expansion{}
-@code{@var{async-record} | @var{stream-record}}
-
-@item @var{async-record} @expansion{}
-@code{@var{exec-async-output} | @var{status-async-output} | @var{notify-async-output}}
-
-@item @var{exec-async-output} @expansion{}
-@code{[ @var{token} ] "*" @var{async-output}}
-
-@item @var{status-async-output} @expansion{}
-@code{[ @var{token} ] "+" @var{async-output}}
-
-@item @var{notify-async-output} @expansion{}
-@code{[ @var{token} ] "=" @var{async-output}}
-
-@item @var{async-output} @expansion{}
-@code{@var{async-class} ( "," @var{result} )* @var{nl}}
-
-@item @var{result-class} @expansion{}
-@code{"done" | "running" | "connected" | "error" | "exit"}
-
-@item @var{async-class} @expansion{}
-@code{"stopped" | @var{others}} (where @var{others} will be added
-depending on the needs---this is still in development).
-
-@item @var{result} @expansion{}
-@code{ @var{variable} "=" @var{value}}
-
-@item @var{variable} @expansion{}
-@code{ @var{string} }
-
-@item @var{value} @expansion{}
-@code{ @var{const} | @var{tuple} | @var{list} }
-
-@item @var{const} @expansion{}
-@code{@var{c-string}}
-
-@item @var{tuple} @expansion{}
-@code{ "@{@}" | "@{" @var{result} ( "," @var{result} )* "@}" }
-
-@item @var{list} @expansion{}
-@code{ "[]" | "[" @var{value} ( "," @var{value} )* "]" | "["
-@var{result} ( "," @var{result} )* "]" }
-
-@item @var{stream-record} @expansion{}
-@code{@var{console-stream-output} | @var{target-stream-output} | @var{log-stream-output}}
-
-@item @var{console-stream-output} @expansion{}
-@code{"~" @var{c-string}}
-
-@item @var{target-stream-output} @expansion{}
-@code{"@@" @var{c-string}}
-
-@item @var{log-stream-output} @expansion{}
-@code{"&" @var{c-string}}
-
-@item @var{nl} @expansion{}
-@code{CR | CR-LF}
-
-@item @var{token} @expansion{}
-@emph{any sequence of digits}.
-@end table
-
-@noindent
-Notes:
-
-@itemize @bullet
-@item
-All output sequences end in a single line containing a period.
-
-@item
-The @code{@var{token}} is from the corresponding request. If an execution
-command is interrupted by the @samp{-exec-interrupt} command, the
-@var{token} associated with the @samp{*stopped} message is the one of the
-original execution command, not the one of the interrupt command.
-
-@item
-@cindex status output in @sc{gdb/mi}
-@var{status-async-output} contains on-going status information about the
-progress of a slow operation. It can be discarded. All status output is
-prefixed by @samp{+}.
-
-@item
-@cindex async output in @sc{gdb/mi}
-@var{exec-async-output} contains asynchronous state change on the target
-(stopped, started, disappeared). All async output is prefixed by
-@samp{*}.
-
-@item
-@cindex notify output in @sc{gdb/mi}
-@var{notify-async-output} contains supplementary information that the
-client should handle (e.g., a new breakpoint information). All notify
-output is prefixed by @samp{=}.
-
-@item
-@cindex console output in @sc{gdb/mi}
-@var{console-stream-output} is output that should be displayed as is in the
-console. It is the textual response to a CLI command. All the console
-output is prefixed by @samp{~}.
-
-@item
-@cindex target output in @sc{gdb/mi}
-@var{target-stream-output} is the output produced by the target program.
-All the target output is prefixed by @samp{@@}.
-
-@item
-@cindex log output in @sc{gdb/mi}
-@var{log-stream-output} is output text coming from @value{GDBN}'s internals, for
-instance messages that should be displayed as part of an error log. All
-the log output is prefixed by @samp{&}.
-
-@item
-@cindex list output in @sc{gdb/mi}
-New @sc{gdb/mi} commands should only output @var{lists} containing
-@var{values}.
-
-
-@end itemize
-
-@xref{GDB/MI Stream Records, , @sc{gdb/mi} Stream Records}, for more
-details about the various output records.
-
-@node GDB/MI Simple Examples
-@subsection Simple Examples of @sc{gdb/mi} Interaction
-@cindex @sc{gdb/mi}, simple examples
-
-This subsection presents several simple examples of interaction using
-the @sc{gdb/mi} interface. In these examples, @samp{->} means that the
-following line is passed to @sc{gdb/mi} as input, while @samp{<-} means
-the output received from @sc{gdb/mi}.
-
-@subsubheading Target Stop
-@c Ummm... There is no "-stop" command. This assumes async, no?
-Here's an example of stopping the inferior process:
-
-@example
--> -stop
-<- (@value{GDBP})
-@end example
-
-@noindent
-and later:
-
-@example
-<- *stop,reason="stop",address="0x123",source="a.c:123"
-<- (@value{GDBP})
-@end example
-
-@subsubheading Simple CLI Command
-
-Here's an example of a simple CLI command being passed through
-@sc{gdb/mi} and on to the CLI.
-
-@example
--> print 1+2
-<- &"print 1+2\n"
-<- ~"$1 = 3\n"
-<- ^done
-<- (@value{GDBP})
-@end example
-
-@subsubheading Command With Side Effects
-
-@example
--> -symbol-file xyz.exe
-<- *breakpoint,nr="3",address="0x123",source="a.c:123"
-<- (@value{GDBP})
-@end example
-
-@subsubheading A Bad Command
-
-Here's what happens if you pass a non-existent command:
-
-@example
--> -rubbish
-<- ^error,msg="Undefined MI command: rubbish"
-<- (@value{GDBP})
-@end example
-
-@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-@node GDB/MI Compatibility with CLI
-@section @sc{gdb/mi} Compatibility with CLI
-
-@cindex compatibility, @sc{gdb/mi} and CLI
-@cindex @sc{gdb/mi}, compatibility with CLI
-To help users familiar with @value{GDBN}'s existing CLI interface, @sc{gdb/mi}
-accepts existing CLI commands. As specified by the syntax, such
-commands can be directly entered into the @sc{gdb/mi} interface and @value{GDBN} will
-respond.
-
-This mechanism is provided as an aid to developers of @sc{gdb/mi}
-clients and not as a reliable interface into the CLI. Since the command
-is being interpreteted in an environment that assumes @sc{gdb/mi}
-behaviour, the exact output of such commands is likely to end up being
-an un-supported hybrid of @sc{gdb/mi} and CLI output.
-
-@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-@node GDB/MI Output Records
-@section @sc{gdb/mi} Output Records
-
-@menu
-* GDB/MI Result Records::
-* GDB/MI Stream Records::
-* GDB/MI Out-of-band Records::
-@end menu
-
-@node GDB/MI Result Records
-@subsection @sc{gdb/mi} Result Records
-
-@cindex result records in @sc{gdb/mi}
-@cindex @sc{gdb/mi}, result records
-In addition to a number of out-of-band notifications, the response to a
-@sc{gdb/mi} command includes one of the following result indications:
-
-@table @code
-@findex ^done
-@item "^done" [ "," @var{results} ]
-The synchronous operation was successful, @code{@var{results}} are the return
-values.
-
-@item "^running"
-@findex ^running
-@c Is this one correct? Should it be an out-of-band notification?
-The asynchronous operation was successfully started. The target is
-running.
-
-@item "^error" "," @var{c-string}
-@findex ^error
-The operation failed. The @code{@var{c-string}} contains the corresponding
-error message.
-@end table
-
-@node GDB/MI Stream Records
-@subsection @sc{gdb/mi} Stream Records
-
-@cindex @sc{gdb/mi}, stream records
-@cindex stream records in @sc{gdb/mi}
-@value{GDBN} internally maintains a number of output streams: the console, the
-target, and the log. The output intended for each of these streams is
-funneled through the @sc{gdb/mi} interface using @dfn{stream records}.
-
-Each stream record begins with a unique @dfn{prefix character} which
-identifies its stream (@pxref{GDB/MI Output Syntax, , @sc{gdb/mi} Output
-Syntax}). In addition to the prefix, each stream record contains a
-@code{@var{string-output}}. This is either raw text (with an implicit new
-line) or a quoted C string (which does not contain an implicit newline).
-
-@table @code
-@item "~" @var{string-output}
-The console output stream contains text that should be displayed in the
-CLI console window. It contains the textual responses to CLI commands.
-
-@item "@@" @var{string-output}
-The target output stream contains any textual output from the running
-target.
-
-@item "&" @var{string-output}
-The log stream contains debugging messages being produced by @value{GDBN}'s
-internals.
-@end table
-
-@node GDB/MI Out-of-band Records
-@subsection @sc{gdb/mi} Out-of-band Records
-
-@cindex out-of-band records in @sc{gdb/mi}
-@cindex @sc{gdb/mi}, out-of-band records
-@dfn{Out-of-band} records are used to notify the @sc{gdb/mi} client of
-additional changes that have occurred. Those changes can either be a
-consequence of @sc{gdb/mi} (e.g., a breakpoint modified) or a result of
-target activity (e.g., target stopped).
-
-The following is a preliminary list of possible out-of-band records.
-
-@table @code
-@item "*" "stop"
-@end table
-
-
-@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-@node GDB/MI Command Description Format
-@section @sc{gdb/mi} Command Description Format
-
-The remaining sections describe blocks of commands. Each block of
-commands is laid out in a fashion similar to this section.
-
-Note the the line breaks shown in the examples are here only for
-readability. They don't appear in the real output.
-Also note that the commands with a non-available example (N.A.@:) are
-not yet implemented.
-
-@subheading Motivation
-
-The motivation for this collection of commands.
-
-@subheading Introduction
-
-A brief introduction to this collection of commands as a whole.
-
-@subheading Commands
-
-For each command in the block, the following is described:
-
-@subsubheading Synopsis
-
-@example
- -command @var{args}@dots{}
-@end example
-
-@subsubheading @value{GDBN} Command
-
-The corresponding @value{GDBN} CLI command.
-
-@subsubheading Result
-
-@subsubheading Out-of-band
-
-@subsubheading Notes
-
-@subsubheading Example
-
-
-@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-@node GDB/MI Breakpoint Table Commands
-@section @sc{gdb/mi} Breakpoint table commands
-
-@cindex breakpoint commands for @sc{gdb/mi}
-@cindex @sc{gdb/mi}, breakpoint commands
-This section documents @sc{gdb/mi} commands for manipulating
-breakpoints.
-
-@subheading The @code{-break-after} Command
-@findex -break-after
-
-@subsubheading Synopsis
-
-@example
- -break-after @var{number} @var{count}
-@end example
-
-The breakpoint number @var{number} is not in effect until it has been
-hit @var{count} times. To see how this is reflected in the output of
-the @samp{-break-list} command, see the description of the
-@samp{-break-list} command below.
-
-@subsubheading @value{GDBN} Command
-
-The corresponding @value{GDBN} command is @samp{ignore}.
-
-@subsubheading Example
-
-@smallexample
-(@value{GDBP})
--break-insert main
-^done,bkpt=@{number="1",addr="0x000100d0",file="hello.c",line="5"@}
-(@value{GDBP})
--break-after 1 3
-~
-^done
-(@value{GDBP})
--break-list
-^done,BreakpointTable=@{nr_rows="1",nr_cols="6",
-hdr=[@{width="3",alignment="-1",col_name="number",colhdr="Num"@},
-@{width="14",alignment="-1",col_name="type",colhdr="Type"@},
-@{width="4",alignment="-1",col_name="disp",colhdr="Disp"@},
-@{width="3",alignment="-1",col_name="enabled",colhdr="Enb"@},
-@{width="10",alignment="-1",col_name="addr",colhdr="Address"@},
-@{width="40",alignment="2",col_name="what",colhdr="What"@}],
-body=[bkpt=@{number="1",type="breakpoint",disp="keep",enabled="y",
-addr="0x000100d0",func="main",file="hello.c",line="5",times="0",
-ignore="3"@}]@}
-(@value{GDBP})
-@end smallexample
-
-@ignore
-@subheading The @code{-break-catch} Command
-@findex -break-catch
-
-@subheading The @code{-break-commands} Command
-@findex -break-commands
-@end ignore
-
-
-@subheading The @code{-break-condition} Command
-@findex -break-condition
-
-@subsubheading Synopsis
-
-@example
- -break-condition @var{number} @var{expr}
-@end example
-
-Breakpoint @var{number} will stop the program only if the condition in
-@var{expr} is true. The condition becomes part of the
-@samp{-break-list} output (see the description of the @samp{-break-list}
-command below).
-
-@subsubheading @value{GDBN} Command
-
-The corresponding @value{GDBN} command is @samp{condition}.
-
-@subsubheading Example
-
-@smallexample
-(@value{GDBP})
--break-condition 1 1
-^done
-(@value{GDBP})
--break-list
-^done,BreakpointTable=@{nr_rows="1",nr_cols="6",
-hdr=[@{width="3",alignment="-1",col_name="number",colhdr="Num"@},
-@{width="14",alignment="-1",col_name="type",colhdr="Type"@},
-@{width="4",alignment="-1",col_name="disp",colhdr="Disp"@},
-@{width="3",alignment="-1",col_name="enabled",colhdr="Enb"@},
-@{width="10",alignment="-1",col_name="addr",colhdr="Address"@},
-@{width="40",alignment="2",col_name="what",colhdr="What"@}],
-body=[bkpt=@{number="1",type="breakpoint",disp="keep",enabled="y",
-addr="0x000100d0",func="main",file="hello.c",line="5",cond="1",
-times="0",ignore="3"@}]@}
-(@value{GDBP})
-@end smallexample
-
-@subheading The @code{-break-delete} Command
-@findex -break-delete
-
-@subsubheading Synopsis
-
-@example
- -break-delete ( @var{breakpoint} )+
-@end example
-
-Delete the breakpoint(s) whose number(s) are specified in the argument
-list. This is obviously reflected in the breakpoint list.
-
-@subsubheading @value{GDBN} command
-
-The corresponding @value{GDBN} command is @samp{delete}.
-
-@subsubheading Example
-
-@example
-(@value{GDBP})
--break-delete 1
-^done
-(@value{GDBP})
--break-list
-^done,BreakpointTable=@{nr_rows="0",nr_cols="6",
-hdr=[@{width="3",alignment="-1",col_name="number",colhdr="Num"@},
-@{width="14",alignment="-1",col_name="type",colhdr="Type"@},
-@{width="4",alignment="-1",col_name="disp",colhdr="Disp"@},
-@{width="3",alignment="-1",col_name="enabled",colhdr="Enb"@},
-@{width="10",alignment="-1",col_name="addr",colhdr="Address"@},
-@{width="40",alignment="2",col_name="what",colhdr="What"@}],
-body=[]@}
-(@value{GDBP})
-@end example
-
-@subheading The @code{-break-disable} Command
-@findex -break-disable
-
-@subsubheading Synopsis
-
-@example
- -break-disable ( @var{breakpoint} )+
-@end example
-
-Disable the named @var{breakpoint}(s). The field @samp{enabled} in the
-break list is now set to @samp{n} for the named @var{breakpoint}(s).
-
-@subsubheading @value{GDBN} Command
-
-The corresponding @value{GDBN} command is @samp{disable}.
-
-@subsubheading Example
-
-@smallexample
-(@value{GDBP})
--break-disable 2
-^done
-(@value{GDBP})
--break-list
-^done,BreakpointTable=@{nr_rows="1",nr_cols="6",
-hdr=[@{width="3",alignment="-1",col_name="number",colhdr="Num"@},
-@{width="14",alignment="-1",col_name="type",colhdr="Type"@},
-@{width="4",alignment="-1",col_name="disp",colhdr="Disp"@},
-@{width="3",alignment="-1",col_name="enabled",colhdr="Enb"@},
-@{width="10",alignment="-1",col_name="addr",colhdr="Address"@},
-@{width="40",alignment="2",col_name="what",colhdr="What"@}],
-body=[bkpt=@{number="2",type="breakpoint",disp="keep",enabled="n",
-addr="0x000100d0",func="main",file="hello.c",line="5",times="0"@}]@}
-(@value{GDBP})
-@end smallexample
-
-@subheading The @code{-break-enable} Command
-@findex -break-enable
-
-@subsubheading Synopsis
-
-@example
- -break-enable ( @var{breakpoint} )+
-@end example
-
-Enable (previously disabled) @var{breakpoint}(s).
-
-@subsubheading @value{GDBN} Command
-
-The corresponding @value{GDBN} command is @samp{enable}.
-
-@subsubheading Example
-
-@smallexample
-(@value{GDBP})
--break-enable 2
-^done
-(@value{GDBP})
--break-list
-^done,BreakpointTable=@{nr_rows="1",nr_cols="6",
-hdr=[@{width="3",alignment="-1",col_name="number",colhdr="Num"@},
-@{width="14",alignment="-1",col_name="type",colhdr="Type"@},
-@{width="4",alignment="-1",col_name="disp",colhdr="Disp"@},
-@{width="3",alignment="-1",col_name="enabled",colhdr="Enb"@},
-@{width="10",alignment="-1",col_name="addr",colhdr="Address"@},
-@{width="40",alignment="2",col_name="what",colhdr="What"@}],
-body=[bkpt=@{number="2",type="breakpoint",disp="keep",enabled="y",
-addr="0x000100d0",func="main",file="hello.c",line="5",times="0"@}]@}
-(@value{GDBP})
-@end smallexample
-
-@subheading The @code{-break-info} Command
-@findex -break-info
-
-@subsubheading Synopsis
-
-@example
- -break-info @var{breakpoint}
-@end example
-
-@c REDUNDANT???
-Get information about a single breakpoint.
-
-@subsubheading @value{GDBN} command
-
-The corresponding @value{GDBN} command is @samp{info break @var{breakpoint}}.
-
-@subsubheading Example
-N.A.
-
-@subheading The @code{-break-insert} Command
-@findex -break-insert
-
-@subsubheading Synopsis
-
-@example
- -break-insert [ -t ] [ -h ] [ -r ]
- [ -c @var{condition} ] [ -i @var{ignore-count} ]
- [ -p @var{thread} ] [ @var{line} | @var{addr} ]
-@end example
-
-@noindent
-If specified, @var{line}, can be one of:
-
-@itemize @bullet
-@item function
-@c @item +offset
-@c @item -offset
-@c @item linenum
-@item filename:linenum
-@item filename:function
-@item *address
-@end itemize
-
-The possible optional parameters of this command are:
-
-@table @samp
-@item -t
-Insert a tempoary breakpoint.
-@item -h
-Insert a hardware breakpoint.
-@item -c @var{condition}
-Make the breakpoint conditional on @var{condition}.
-@item -i @var{ignore-count}
-Initialize the @var{ignore-count}.
-@item -r
-Insert a regular breakpoint in all the functions whose names match the
-given regular expression. Other flags are not applicable to regular
-expresson.
-@end table
-
-@subsubheading Result
-
-The result is in the form:
-
-@example
- ^done,bkptno="@var{number}",func="@var{funcname}",
- file="@var{filename}",line="@var{lineno}"
-@end example
-
-@noindent
-where @var{number} is the @value{GDBN} number for this breakpoint, @var{funcname}
-is the name of the function where the breakpoint was inserted,
-@var{filename} is the name of the source file which contains this
-function, and @var{lineno} is the source line number within that file.
-
-Note: this format is open to change.
-@c An out-of-band breakpoint instead of part of the result?
-
-@subsubheading @value{GDBN} Command
-
-The corresponding @value{GDBN} commands are @samp{break}, @samp{tbreak},
-@samp{hbreak}, @samp{thbreak}, and @samp{rbreak}.
-
-@subsubheading Example
-
-@smallexample
-(@value{GDBP})
--break-insert main
-^done,bkpt=@{number="1",addr="0x0001072c",file="recursive2.c",line="4"@}
-(@value{GDBP})
--break-insert -t foo
-^done,bkpt=@{number="2",addr="0x00010774",file="recursive2.c",line="11"@}
-(@value{GDBP})
--break-list
-^done,BreakpointTable=@{nr_rows="2",nr_cols="6",
-hdr=[@{width="3",alignment="-1",col_name="number",colhdr="Num"@},
-@{width="14",alignment="-1",col_name="type",colhdr="Type"@},
-@{width="4",alignment="-1",col_name="disp",colhdr="Disp"@},
-@{width="3",alignment="-1",col_name="enabled",colhdr="Enb"@},
-@{width="10",alignment="-1",col_name="addr",colhdr="Address"@},
-@{width="40",alignment="2",col_name="what",colhdr="What"@}],
-body=[bkpt=@{number="1",type="breakpoint",disp="keep",enabled="y",
-addr="0x0001072c", func="main",file="recursive2.c",line="4",times="0"@},
-bkpt=@{number="2",type="breakpoint",disp="del",enabled="y",
-addr="0x00010774",func="foo",file="recursive2.c",line="11",times="0"@}]@}
-(@value{GDBP})
--break-insert -r foo.*
-~int foo(int, int);
-^done,bkpt=@{number="3",addr="0x00010774",file="recursive2.c",line="11"@}
-(@value{GDBP})
-@end smallexample
-
-@subheading The @code{-break-list} Command
-@findex -break-list
-
-@subsubheading Synopsis
-
-@example
- -break-list
-@end example
-
-Displays the list of inserted breakpoints, showing the following fields:
-
-@table @samp
-@item Number
-number of the breakpoint
-@item Type
-type of the breakpoint: @samp{breakpoint} or @samp{watchpoint}
-@item Disposition
-should the breakpoint be deleted or disabled when it is hit: @samp{keep}
-or @samp{nokeep}
-@item Enabled
-is the breakpoint enabled or no: @samp{y} or @samp{n}
-@item Address
-memory location at which the breakpoint is set
-@item What
-logical location of the breakpoint, expressed by function name, file
-name, line number
-@item Times
-number of times the breakpoint has been hit
-@end table
-
-If there are no breakpoints or watchpoints, the @code{BreakpointTable}
-@code{body} field is an empty list.
-
-@subsubheading @value{GDBN} Command
-
-The corresponding @value{GDBN} command is @samp{info break}.
-
-@subsubheading Example
-
-@smallexample
-(@value{GDBP})
--break-list
-^done,BreakpointTable=@{nr_rows="2",nr_cols="6",
-hdr=[@{width="3",alignment="-1",col_name="number",colhdr="Num"@},
-@{width="14",alignment="-1",col_name="type",colhdr="Type"@},
-@{width="4",alignment="-1",col_name="disp",colhdr="Disp"@},
-@{width="3",alignment="-1",col_name="enabled",colhdr="Enb"@},
-@{width="10",alignment="-1",col_name="addr",colhdr="Address"@},
-@{width="40",alignment="2",col_name="what",colhdr="What"@}],
-body=[bkpt=@{number="1",type="breakpoint",disp="keep",enabled="y",
-addr="0x000100d0",func="main",file="hello.c",line="5",times="0"@},
-bkpt=@{number="2",type="breakpoint",disp="keep",enabled="y",
-addr="0x00010114",func="foo",file="hello.c",line="13",times="0"@}]@}
-(@value{GDBP})
-@end smallexample
-
-Here's an example of the result when there are no breakpoints:
-
-@smallexample
-(@value{GDBP})
--break-list
-^done,BreakpointTable=@{nr_rows="0",nr_cols="6",
-hdr=[@{width="3",alignment="-1",col_name="number",colhdr="Num"@},
-@{width="14",alignment="-1",col_name="type",colhdr="Type"@},
-@{width="4",alignment="-1",col_name="disp",colhdr="Disp"@},
-@{width="3",alignment="-1",col_name="enabled",colhdr="Enb"@},
-@{width="10",alignment="-1",col_name="addr",colhdr="Address"@},
-@{width="40",alignment="2",col_name="what",colhdr="What"@}],
-body=[]@}
-(@value{GDBP})
-@end smallexample
-
-@subheading The @code{-break-watch} Command
-@findex -break-watch
-
-@subsubheading Synopsis
-
-@example
- -break-watch [ -a | -r ]
-@end example
-
-Create a watchpoint. With the @samp{-a} option it will create an
-@dfn{access} watchpoint, i.e. a watchpoint that triggers either on a
-read from or on a write to the memory location. With the @samp{-r}
-option, the watchpoint created is a @dfn{read} watchpoint, i.e. it will
-trigger only when the memory location is accessed for reading. Without
-either of the options, the watchpoint created is a regular watchpoint,
-i.e. it will trigger when the memory location is accessed for writing.
-@xref{Set Watchpoints, , Setting watchpoints}.
-
-Note that @samp{-break-list} will report a single list of watchpoints and
-breakpoints inserted.
-
-@subsubheading @value{GDBN} Command
-
-The corresponding @value{GDBN} commands are @samp{watch}, @samp{awatch}, and
-@samp{rwatch}.
-
-@subsubheading Example
-
-Setting a watchpoint on a variable in the @code{main} function:
-
-@smallexample
-(@value{GDBP})
--break-watch x
-^done,wpt=@{number="2",exp="x"@}
-(@value{GDBP})
--exec-continue
-^running
-^done,reason="watchpoint-trigger",wpt=@{number="2",exp="x"@},
-value=@{old="-268439212",new="55"@},
-frame=@{func="main",args=[],file="recursive2.c",line="5"@}
-(@value{GDBP})
-@end smallexample
-
-Setting a watchpoint on a variable local to a function. @value{GDBN} will stop
-the program execution twice: first for the variable changing value, then
-for the watchpoint going out of scope.
-
-@smallexample
-(@value{GDBP})
--break-watch C
-^done,wpt=@{number="5",exp="C"@}
-(@value{GDBP})
--exec-continue
-^running
-^done,reason="watchpoint-trigger",
-wpt=@{number="5",exp="C"@},value=@{old="-276895068",new="3"@},
-frame=@{func="callee4",args=[],
-file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="13"@}
-(@value{GDBP})
--exec-continue
-^running
-^done,reason="watchpoint-scope",wpnum="5",
-frame=@{func="callee3",args=[@{name="strarg",
-value="0x11940 \"A string argument.\""@}],
-file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="18"@}
-(@value{GDBP})
-@end smallexample
-
-Listing breakpoints and watchpoints, at different points in the program
-execution. Note that once the watchpoint goes out of scope, it is
-deleted.
-
-@smallexample
-(@value{GDBP})
--break-watch C
-^done,wpt=@{number="2",exp="C"@}
-(@value{GDBP})
--break-list
-^done,BreakpointTable=@{nr_rows="2",nr_cols="6",
-hdr=[@{width="3",alignment="-1",col_name="number",colhdr="Num"@},
-@{width="14",alignment="-1",col_name="type",colhdr="Type"@},
-@{width="4",alignment="-1",col_name="disp",colhdr="Disp"@},
-@{width="3",alignment="-1",col_name="enabled",colhdr="Enb"@},
-@{width="10",alignment="-1",col_name="addr",colhdr="Address"@},
-@{width="40",alignment="2",col_name="what",colhdr="What"@}],
-body=[bkpt=@{number="1",type="breakpoint",disp="keep",enabled="y",
-addr="0x00010734",func="callee4",
-file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="8",times="1"@},
-bkpt=@{number="2",type="watchpoint",disp="keep",
-enabled="y",addr="",what="C",times="0"@}]@}
-(@value{GDBP})
--exec-continue
-^running
-^done,reason="watchpoint-trigger",wpt=@{number="2",exp="C"@},
-value=@{old="-276895068",new="3"@},
-frame=@{func="callee4",args=[],
-file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="13"@}
-(@value{GDBP})
--break-list
-^done,BreakpointTable=@{nr_rows="2",nr_cols="6",
-hdr=[@{width="3",alignment="-1",col_name="number",colhdr="Num"@},
-@{width="14",alignment="-1",col_name="type",colhdr="Type"@},
-@{width="4",alignment="-1",col_name="disp",colhdr="Disp"@},
-@{width="3",alignment="-1",col_name="enabled",colhdr="Enb"@},
-@{width="10",alignment="-1",col_name="addr",colhdr="Address"@},
-@{width="40",alignment="2",col_name="what",colhdr="What"@}],
-body=[bkpt=@{number="1",type="breakpoint",disp="keep",enabled="y",
-addr="0x00010734",func="callee4",
-file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="8",times="1"@},
-bkpt=@{number="2",type="watchpoint",disp="keep",
-enabled="y",addr="",what="C",times="-5"@}]@}
-(@value{GDBP})
--exec-continue
-^running
-^done,reason="watchpoint-scope",wpnum="2",
-frame=@{func="callee3",args=[@{name="strarg",
-value="0x11940 \"A string argument.\""@}],
-file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="18"@}
-(@value{GDBP})
--break-list
-^done,BreakpointTable=@{nr_rows="1",nr_cols="6",
-hdr=[@{width="3",alignment="-1",col_name="number",colhdr="Num"@},
-@{width="14",alignment="-1",col_name="type",colhdr="Type"@},
-@{width="4",alignment="-1",col_name="disp",colhdr="Disp"@},
-@{width="3",alignment="-1",col_name="enabled",colhdr="Enb"@},
-@{width="10",alignment="-1",col_name="addr",colhdr="Address"@},
-@{width="40",alignment="2",col_name="what",colhdr="What"@}],
-body=[bkpt=@{number="1",type="breakpoint",disp="keep",enabled="y",
-addr="0x00010734",func="callee4",
-file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="8",times="1"@}]@}
-(@value{GDBP})
-@end smallexample
-
-@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-@node GDB/MI Data Manipulation
-@section @sc{gdb/mi} Data Manipulation
-
-@cindex data manipulation, in @sc{gdb/mi}
-@cindex @sc{gdb/mi}, data manipulation
-This section describes the @sc{gdb/mi} commands that manipulate data:
-examine memory and registers, evaluate expressions, etc.
-
-@c REMOVED FROM THE INTERFACE.
-@c @subheading -data-assign
-@c Change the value of a program variable. Plenty of side effects.
-@c @subsubheading GDB command
-@c set variable
-@c @subsubheading Example
-@c N.A.
-
-@subheading The @code{-data-disassemble} Command
-@findex -data-disassemble
-
-@subsubheading Synopsis
-
-@example
- -data-disassemble
- [ -s @var{start-addr} -e @var{end-addr} ]
- | [ -f @var{filename} -l @var{linenum} [ -n @var{lines} ] ]
- -- @var{mode}
-@end example
-
-@noindent
-Where:
-
-@table @samp
-@item @var{start-addr}
-is the beginning address (or @code{$pc})
-@item @var{end-addr}
-is the end address
-@item @var{filename}
-is the name of the file to disassemble
-@item @var{linenum}
-is the line number to disassemble around
-@item @var{lines}
-is the the number of disassembly lines to be produced. If it is -1,
-the whole function will be disassembled, in case no @var{end-addr} is
-specified. If @var{end-addr} is specified as a non-zero value, and
-@var{lines} is lower than the number of disassembly lines between
-@var{start-addr} and @var{end-addr}, only @var{lines} lines are
-displayed; if @var{lines} is higher than the number of lines between
-@var{start-addr} and @var{end-addr}, only the lines up to @var{end-addr}
-are displayed.
-@item @var{mode}
-is either 0 (meaning only disassembly) or 1 (meaning mixed source and
-disassembly).
-@end table
-
-@subsubheading Result
-
-The output for each instruction is composed of four fields:
-
-@itemize @bullet
-@item Address
-@item Func-name
-@item Offset
-@item Instruction
-@end itemize
-
-Note that whatever included in the instruction field, is not manipulated
-directely by @sc{gdb/mi}, i.e. it is not possible to adjust its format.
-
-@subsubheading @value{GDBN} Command
-
-There's no direct mapping from this command to the CLI.
-
-@subsubheading Example
-
-Disassemble from the current value of @code{$pc} to @code{$pc + 20}:
-
-@smallexample
-(@value{GDBP})
--data-disassemble -s $pc -e "$pc + 20" -- 0
-^done,
-asm_insns=[
-@{address="0x000107c0",func-name="main",offset="4",
-inst="mov 2, %o0"@},
-@{address="0x000107c4",func-name="main",offset="8",
-inst="sethi %hi(0x11800), %o2"@},
-@{address="0x000107c8",func-name="main",offset="12",
-inst="or %o2, 0x140, %o1\t! 0x11940 <_lib_version+8>"@},
-@{address="0x000107cc",func-name="main",offset="16",
-inst="sethi %hi(0x11800), %o2"@},
-@{address="0x000107d0",func-name="main",offset="20",
-inst="or %o2, 0x168, %o4\t! 0x11968 <_lib_version+48>"@}]
-(@value{GDBP})
-@end smallexample
-
-Disassemble the whole @code{main} function. Line 32 is part of
-@code{main}.
-
-@smallexample
--data-disassemble -f basics.c -l 32 -- 0
-^done,asm_insns=[
-@{address="0x000107bc",func-name="main",offset="0",
-inst="save %sp, -112, %sp"@},
-@{address="0x000107c0",func-name="main",offset="4",
-inst="mov 2, %o0"@},
-@{address="0x000107c4",func-name="main",offset="8",
-inst="sethi %hi(0x11800), %o2"@},
-[@dots{}]
-@{address="0x0001081c",func-name="main",offset="96",inst="ret "@},
-@{address="0x00010820",func-name="main",offset="100",inst="restore "@}]
-(@value{GDBP})
-@end smallexample
-
-Disassemble 3 instructions from the start of @code{main}:
-
-@smallexample
-(@value{GDBP})
--data-disassemble -f basics.c -l 32 -n 3 -- 0
-^done,asm_insns=[
-@{address="0x000107bc",func-name="main",offset="0",
-inst="save %sp, -112, %sp"@},
-@{address="0x000107c0",func-name="main",offset="4",
-inst="mov 2, %o0"@},
-@{address="0x000107c4",func-name="main",offset="8",
-inst="sethi %hi(0x11800), %o2"@}]
-(@value{GDBP})
-@end smallexample
-
-Disassemble 3 instructions from the start of @code{main} in mixed mode:
-
-@smallexample
-(@value{GDBP})
--data-disassemble -f basics.c -l 32 -n 3 -- 1
-^done,asm_insns=[
-src_and_asm_line=@{line="31",
-file="/kwikemart/marge/ezannoni/flathead-dev/devo/gdb/ \
- testsuite/gdb.mi/basics.c",line_asm_insn=[
-@{address="0x000107bc",func-name="main",offset="0",
-inst="save %sp, -112, %sp"@}]@},
-src_and_asm_line=@{line="32",
-file="/kwikemart/marge/ezannoni/flathead-dev/devo/gdb/ \
- testsuite/gdb.mi/basics.c",line_asm_insn=[
-@{address="0x000107c0",func-name="main",offset="4",
-inst="mov 2, %o0"@},
-@{address="0x000107c4",func-name="main",offset="8",
-inst="sethi %hi(0x11800), %o2"@}]@}]
-(@value{GDBP})
-@end smallexample
-
-
-@subheading The @code{-data-evaluate-expression} Command
-@findex -data-evaluate-expression
-
-@subsubheading Synopsis
-
-@example
- -data-evaluate-expression @var{expr}
-@end example
-
-Evaluate @var{expr} as an expression. The expression could contain an
-inferior function call. The function call will execute synchronously.
-If the expression contains spaces, it must be enclosed in double quotes.
-
-@subsubheading @value{GDBN} Command
-
-The corresponding @value{GDBN} commands are @samp{print}, @samp{output}, and
-@samp{call}. In @code{gdbtk} only, there's a corresponding
-@samp{gdb_eval} command.
-
-@subsubheading Example
-
-In the following example, the numbers that precede the commands are the
-@dfn{tokens} described in @ref{GDB/MI Command Syntax, ,@sc{gdb/mi}
-Command Syntax}. Notice how @sc{gdb/mi} returns the same tokens in its
-output.
-
-@smallexample
-211-data-evaluate-expression A
-211^done,value="1"
-(@value{GDBP})
-311-data-evaluate-expression &A
-311^done,value="0xefffeb7c"
-(@value{GDBP})
-411-data-evaluate-expression A+3
-411^done,value="4"
-(@value{GDBP})
-511-data-evaluate-expression "A + 3"
-511^done,value="4"
-(@value{GDBP})
-@end smallexample
-
-
-@subheading The @code{-data-list-changed-registers} Command
-@findex -data-list-changed-registers
-
-@subsubheading Synopsis
-
-@example
- -data-list-changed-registers
-@end example
-
-Display a list of the registers that have changed.
-
-@subsubheading @value{GDBN} Command
-
-@value{GDBN} doesn't have a direct analog for this command; @code{gdbtk}
-has the corresponding command @samp{gdb_changed_register_list}.
-
-@subsubheading Example
-
-On a PPC MBX board:
-
-@smallexample
-(@value{GDBP})
--exec-continue
-^running
-
-(@value{GDBP})
-*stopped,reason="breakpoint-hit",bkptno="1",frame=@{func="main",
-args=[],file="try.c",line="5"@}
-(@value{GDBP})
--data-list-changed-registers
-^done,changed-registers=["0","1","2","4","5","6","7","8","9",
-"10","11","13","14","15","16","17","18","19","20","21","22","23",
-"24","25","26","27","28","30","31","64","65","66","67","69"]
-(@value{GDBP})
-@end smallexample
-
-
-@subheading The @code{-data-list-register-names} Command
-@findex -data-list-register-names
-
-@subsubheading Synopsis
-
-@example
- -data-list-register-names [ ( @var{regno} )+ ]
-@end example
-
-Show a list of register names for the current target. If no arguments
-are given, it shows a list of the names of all the registers. If
-integer numbers are given as arguments, it will print a list of the
-names of the registers corresponding to the arguments. To ensure
-consistency between a register name and its number, the output list may
-include empty register names.
-
-@subsubheading @value{GDBN} Command
-
-@value{GDBN} does not have a command which corresponds to
-@samp{-data-list-register-names}. In @code{gdbtk} there is a
-corresponding command @samp{gdb_regnames}.
-
-@subsubheading Example
-
-For the PPC MBX board:
-@smallexample
-(@value{GDBP})
--data-list-register-names
-^done,register-names=["r0","r1","r2","r3","r4","r5","r6","r7",
-"r8","r9","r10","r11","r12","r13","r14","r15","r16","r17","r18",
-"r19","r20","r21","r22","r23","r24","r25","r26","r27","r28","r29",
-"r30","r31","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9",
-"f10","f11","f12","f13","f14","f15","f16","f17","f18","f19","f20",
-"f21","f22","f23","f24","f25","f26","f27","f28","f29","f30","f31",
-"", "pc","ps","cr","lr","ctr","xer"]
-(@value{GDBP})
--data-list-register-names 1 2 3
-^done,register-names=["r1","r2","r3"]
-(@value{GDBP})
-@end smallexample
-
-@subheading The @code{-data-list-register-values} Command
-@findex -data-list-register-values
-
-@subsubheading Synopsis
-
-@example
- -data-list-register-values @var{fmt} [ ( @var{regno} )*]
-@end example
-
-Display the registers' contents. @var{fmt} is the format according to
-which the registers' contents are to be returned, followed by an optional
-list of numbers specifying the registers to display. A missing list of
-numbers indicates that the contents of all the registers must be returned.
-
-Allowed formats for @var{fmt} are:
-
-@table @code
-@item x
-Hexadecimal
-@item o
-Octal
-@item t
-Binary
-@item d
-Decimal
-@item r
-Raw
-@item N
-Natural
-@end table
-
-@subsubheading @value{GDBN} Command
-
-The corresponding @value{GDBN} commands are @samp{info reg}, @samp{info
-all-reg}, and (in @code{gdbtk}) @samp{gdb_fetch_registers}.
-
-@subsubheading Example
-
-For a PPC MBX board (note: line breaks are for readability only, they
-don't appear in the actual output):
-
-@smallexample
-(@value{GDBP})
--data-list-register-values r 64 65
-^done,register-values=[@{number="64",value="0xfe00a300"@},
-@{number="65",value="0x00029002"@}]
-(@value{GDBP})
--data-list-register-values x
-^done,register-values=[@{number="0",value="0xfe0043c8"@},
-@{number="1",value="0x3fff88"@},@{number="2",value="0xfffffffe"@},
-@{number="3",value="0x0"@},@{number="4",value="0xa"@},
-@{number="5",value="0x3fff68"@},@{number="6",value="0x3fff58"@},
-@{number="7",value="0xfe011e98"@},@{number="8",value="0x2"@},
-@{number="9",value="0xfa202820"@},@{number="10",value="0xfa202808"@},
-@{number="11",value="0x1"@},@{number="12",value="0x0"@},
-@{number="13",value="0x4544"@},@{number="14",value="0xffdfffff"@},
-@{number="15",value="0xffffffff"@},@{number="16",value="0xfffffeff"@},
-@{number="17",value="0xefffffed"@},@{number="18",value="0xfffffffe"@},
-@{number="19",value="0xffffffff"@},@{number="20",value="0xffffffff"@},
-@{number="21",value="0xffffffff"@},@{number="22",value="0xfffffff7"@},
-@{number="23",value="0xffffffff"@},@{number="24",value="0xffffffff"@},
-@{number="25",value="0xffffffff"@},@{number="26",value="0xfffffffb"@},
-@{number="27",value="0xffffffff"@},@{number="28",value="0xf7bfffff"@},
-@{number="29",value="0x0"@},@{number="30",value="0xfe010000"@},
-@{number="31",value="0x0"@},@{number="32",value="0x0"@},
-@{number="33",value="0x0"@},@{number="34",value="0x0"@},
-@{number="35",value="0x0"@},@{number="36",value="0x0"@},
-@{number="37",value="0x0"@},@{number="38",value="0x0"@},
-@{number="39",value="0x0"@},@{number="40",value="0x0"@},
-@{number="41",value="0x0"@},@{number="42",value="0x0"@},
-@{number="43",value="0x0"@},@{number="44",value="0x0"@},
-@{number="45",value="0x0"@},@{number="46",value="0x0"@},
-@{number="47",value="0x0"@},@{number="48",value="0x0"@},
-@{number="49",value="0x0"@},@{number="50",value="0x0"@},
-@{number="51",value="0x0"@},@{number="52",value="0x0"@},
-@{number="53",value="0x0"@},@{number="54",value="0x0"@},
-@{number="55",value="0x0"@},@{number="56",value="0x0"@},
-@{number="57",value="0x0"@},@{number="58",value="0x0"@},
-@{number="59",value="0x0"@},@{number="60",value="0x0"@},
-@{number="61",value="0x0"@},@{number="62",value="0x0"@},
-@{number="63",value="0x0"@},@{number="64",value="0xfe00a300"@},
-@{number="65",value="0x29002"@},@{number="66",value="0x202f04b5"@},
-@{number="67",value="0xfe0043b0"@},@{number="68",value="0xfe00b3e4"@},
-@{number="69",value="0x20002b03"@}]
-(@value{GDBP})
-@end smallexample
-
-
-@subheading The @code{-data-read-memory} Command
-@findex -data-read-memory
-
-@subsubheading Synopsis
-
-@example
- -data-read-memory [ -o @var{byte-offset} ]
- @var{address} @var{word-format} @var{word-size}
- @var{nr-rows} @var{nr-cols} [ @var{aschar} ]
-@end example
-
-@noindent
-where:
-
-@table @samp
-@item @var{address}
-An expression specifying the address of the first memory word to be
-read. Complex expressions containing embedded white space should be
-quoted using the C convention.
-
-@item @var{word-format}
-The format to be used to print the memory words. The notation is the
-same as for @value{GDBN}'s @code{print} command (@pxref{Output Formats,
-,Output formats}).
-
-@item @var{word-size}
-The size of each memory word in bytes.
-
-@item @var{nr-rows}
-The number of rows in the output table.
-
-@item @var{nr-cols}
-The number of columns in the output table.
-
-@item @var{aschar}
-If present, indicates that each row should include an @sc{ascii} dump. The
-value of @var{aschar} is used as a padding character when a byte is not a
-member of the printable @sc{ascii} character set (printable @sc{ascii}
-characters are those whose code is between 32 and 126, inclusively).
-
-@item @var{byte-offset}
-An offset to add to the @var{address} before fetching memory.
-@end table
-
-This command displays memory contents as a table of @var{nr-rows} by
-@var{nr-cols} words, each word being @var{word-size} bytes. In total,
-@code{@var{nr-rows} * @var{nr-cols} * @var{word-size}} bytes are read
-(returned as @samp{total-bytes}). Should less than the requested number
-of bytes be returned by the target, the missing words are identified
-using @samp{N/A}. The number of bytes read from the target is returned
-in @samp{nr-bytes} and the starting address used to read memory in
-@samp{addr}.
-
-The address of the next/previous row or page is available in
-@samp{next-row} and @samp{prev-row}, @samp{next-page} and
-@samp{prev-page}.
-
-@subsubheading @value{GDBN} Command
-
-The corresponding @value{GDBN} command is @samp{x}. @code{gdbtk} has
-@samp{gdb_get_mem} memory read command.
-
-@subsubheading Example
-
-Read six bytes of memory starting at @code{bytes+6} but then offset by
-@code{-6} bytes. Format as three rows of two columns. One byte per
-word. Display each word in hex.
-
-@smallexample
-(@value{GDBP})
-9-data-read-memory -o -6 -- bytes+6 x 1 3 2
-9^done,addr="0x00001390",nr-bytes="6",total-bytes="6",
-next-row="0x00001396",prev-row="0x0000138e",next-page="0x00001396",
-prev-page="0x0000138a",memory=[
-@{addr="0x00001390",data=["0x00","0x01"]@},
-@{addr="0x00001392",data=["0x02","0x03"]@},
-@{addr="0x00001394",data=["0x04","0x05"]@}]
-(@value{GDBP})
-@end smallexample
-
-Read two bytes of memory starting at address @code{shorts + 64} and
-display as a single word formatted in decimal.
-
-@smallexample
-(@value{GDBP})
-5-data-read-memory shorts+64 d 2 1 1
-5^done,addr="0x00001510",nr-bytes="2",total-bytes="2",
-next-row="0x00001512",prev-row="0x0000150e",
-next-page="0x00001512",prev-page="0x0000150e",memory=[
-@{addr="0x00001510",data=["128"]@}]
-(@value{GDBP})
-@end smallexample
-
-Read thirty two bytes of memory starting at @code{bytes+16} and format
-as eight rows of four columns. Include a string encoding with @samp{x}
-used as the non-printable character.
-
-@smallexample
-(@value{GDBP})
-4-data-read-memory bytes+16 x 1 8 4 x
-4^done,addr="0x000013a0",nr-bytes="32",total-bytes="32",
-next-row="0x000013c0",prev-row="0x0000139c",
-next-page="0x000013c0",prev-page="0x00001380",memory=[
-@{addr="0x000013a0",data=["0x10","0x11","0x12","0x13"],ascii="xxxx"@},
-@{addr="0x000013a4",data=["0x14","0x15","0x16","0x17"],ascii="xxxx"@},
-@{addr="0x000013a8",data=["0x18","0x19","0x1a","0x1b"],ascii="xxxx"@},
-@{addr="0x000013ac",data=["0x1c","0x1d","0x1e","0x1f"],ascii="xxxx"@},
-@{addr="0x000013b0",data=["0x20","0x21","0x22","0x23"],ascii=" !\"#"@},
-@{addr="0x000013b4",data=["0x24","0x25","0x26","0x27"],ascii="$%&'"@},
-@{addr="0x000013b8",data=["0x28","0x29","0x2a","0x2b"],ascii="()*+"@},
-@{addr="0x000013bc",data=["0x2c","0x2d","0x2e","0x2f"],ascii=",-./"@}]
-(@value{GDBP})
-@end smallexample
-
-@subheading The @code{-display-delete} Command
-@findex -display-delete
-
-@subsubheading Synopsis
-
-@example
- -display-delete @var{number}
-@end example
-
-Delete the display @var{number}.
-
-@subsubheading @value{GDBN} Command
-
-The corresponding @value{GDBN} command is @samp{delete display}.
-
-@subsubheading Example
-N.A.
-
-
-@subheading The @code{-display-disable} Command
-@findex -display-disable
-
-@subsubheading Synopsis
-
-@example
- -display-disable @var{number}
-@end example
-
-Disable display @var{number}.
-
-@subsubheading @value{GDBN} Command
-
-The corresponding @value{GDBN} command is @samp{disable display}.
-
-@subsubheading Example
-N.A.
-
-
-@subheading The @code{-display-enable} Command
-@findex -display-enable
-
-@subsubheading Synopsis
-
-@example
- -display-enable @var{number}
-@end example
-
-Enable display @var{number}.
-
-@subsubheading @value{GDBN} Command
-
-The corresponding @value{GDBN} command is @samp{enable display}.
-
-@subsubheading Example
-N.A.
-
-
-@subheading The @code{-display-insert} Command
-@findex -display-insert
-
-@subsubheading Synopsis
-
-@example
- -display-insert @var{expression}
-@end example
-
-Display @var{expression} every time the program stops.
-
-@subsubheading @value{GDBN} Command
-
-The corresponding @value{GDBN} command is @samp{display}.
-
-@subsubheading Example
-N.A.
-
-
-@subheading The @code{-display-list} Command
-@findex -display-list
-
-@subsubheading Synopsis
-
-@example
- -display-list
-@end example
-
-List the displays. Do not show the current values.
-
-@subsubheading @value{GDBN} Command
-
-The corresponding @value{GDBN} command is @samp{info display}.
-
-@subsubheading Example
-N.A.
-
-
-@subheading The @code{-environment-cd} Command
-@findex -environment-cd
-
-@subsubheading Synopsis
-
-@example
- -environment-cd @var{pathdir}
-@end example
-
-Set @value{GDBN}'s working directory.
-
-@subsubheading @value{GDBN} Command
-
-The corresponding @value{GDBN} command is @samp{cd}.
-
-@subsubheading Example
-
-@smallexample
-(@value{GDBP})
--environment-cd /kwikemart/marge/ezannoni/flathead-dev/devo/gdb
-^done
-(@value{GDBP})
-@end smallexample
-
-
-@subheading The @code{-environment-directory} Command
-@findex -environment-directory
-
-@subsubheading Synopsis
-
-@example
- -environment-directory [ -r ] [ @var{pathdir} ]+
-@end example
-
-Add directories @var{pathdir} to beginning of search path for source files.
-If the @samp{-r} option is used, the search path is reset to the default
-search path. If directories @var{pathdir} are supplied in addition to the
-@samp{-r} option, the search path is first reset and then addition
-occurs as normal.
-Multiple directories may be specified, separated by blanks. Specifying
-multiple directories in a single command
-results in the directories added to the beginning of the
-search path in the same order they were presented in the command.
-If blanks are needed as
-part of a directory name, double-quotes should be used around
-the name. In the command output, the path will show up separated
-by the system directory-separator character. The directory-seperator
-character must not be used
-in any directory name.
-If no directories are specified, the current search path is displayed.
-
-@subsubheading @value{GDBN} Command
-
-The corresponding @value{GDBN} command is @samp{dir}.
-
-@subsubheading Example
-
-@smallexample
-(@value{GDBP})
--environment-directory /kwikemart/marge/ezannoni/flathead-dev/devo/gdb
-^done,source-path="/kwikemart/marge/ezannoni/flathead-dev/devo/gdb:$cdir:$cwd"
-(@value{GDBP})
--environment-directory ""
-^done,source-path="/kwikemart/marge/ezannoni/flathead-dev/devo/gdb:$cdir:$cwd"
-(@value{GDBP})
--environment-directory -r /home/jjohnstn/src/gdb /usr/src
-^done,source-path="/home/jjohnstn/src/gdb:/usr/src:$cdir:$cwd"
-(@value{GDBP})
--environment-directory -r
-^done,source-path="$cdir:$cwd"
-(@value{GDBP})
-@end smallexample
-
-
-@subheading The @code{-environment-path} Command
-@findex -environment-path
-
-@subsubheading Synopsis
-
-@example
- -environment-path [ -r ] [ @var{pathdir} ]+
-@end example
-
-Add directories @var{pathdir} to beginning of search path for object files.
-If the @samp{-r} option is used, the search path is reset to the original
-search path that existed at gdb start-up. If directories @var{pathdir} are
-supplied in addition to the
-@samp{-r} option, the search path is first reset and then addition
-occurs as normal.
-Multiple directories may be specified, separated by blanks. Specifying
-multiple directories in a single command
-results in the directories added to the beginning of the
-search path in the same order they were presented in the command.
-If blanks are needed as
-part of a directory name, double-quotes should be used around
-the name. In the command output, the path will show up separated
-by the system directory-separator character. The directory-seperator
-character must not be used
-in any directory name.
-If no directories are specified, the current path is displayed.
-
-
-@subsubheading @value{GDBN} Command
-
-The corresponding @value{GDBN} command is @samp{path}.
-
-@subsubheading Example
-
-@smallexample
-(@value{GDBP})
--environment-path
-^done,path="/usr/bin"
-(@value{GDBP})
--environment-path /kwikemart/marge/ezannoni/flathead-dev/ppc-eabi/gdb /bin
-^done,path="/kwikemart/marge/ezannoni/flathead-dev/ppc-eabi/gdb:/bin:/usr/bin"
-(@value{GDBP})
--environment-path -r /usr/local/bin
-^done,path="/usr/local/bin:/usr/bin"
-(@value{GDBP})
-@end smallexample
-
-
-@subheading The @code{-environment-pwd} Command
-@findex -environment-pwd
-
-@subsubheading Synopsis
-
-@example
- -environment-pwd
-@end example
-
-Show the current working directory.
-
-@subsubheading @value{GDBN} command
-
-The corresponding @value{GDBN} command is @samp{pwd}.
-
-@subsubheading Example
-
-@smallexample
-(@value{GDBP})
--environment-pwd
-^done,cwd="/kwikemart/marge/ezannoni/flathead-dev/devo/gdb"
-(@value{GDBP})
-@end smallexample
-
-@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-@node GDB/MI Program Control
-@section @sc{gdb/mi} Program control
-
-@subsubheading Program termination
-
-As a result of execution, the inferior program can run to completion, if
-it doesn't encounter any breakpoints. In this case the output will
-include an exit code, if the program has exited exceptionally.
-
-@subsubheading Examples
-
-@noindent
-Program exited normally:
-
-@smallexample
-(@value{GDBP})
--exec-run
-^running
-(@value{GDBP})
-x = 55
-*stopped,reason="exited-normally"
-(@value{GDBP})
-@end smallexample
-
-@noindent
-Program exited exceptionally:
-
-@smallexample
-(@value{GDBP})
--exec-run
-^running
-(@value{GDBP})
-x = 55
-*stopped,reason="exited",exit-code="01"
-(@value{GDBP})
-@end smallexample
-
-Another way the program can terminate is if it receives a signal such as
-@code{SIGINT}. In this case, @sc{gdb/mi} displays this:
-
-@smallexample
-(@value{GDBP})
-*stopped,reason="exited-signalled",signal-name="SIGINT",
-signal-meaning="Interrupt"
-@end smallexample
-
-
-@subheading The @code{-exec-abort} Command
-@findex -exec-abort
-
-@subsubheading Synopsis
-
-@example
- -exec-abort
-@end example
-
-Kill the inferior running program.
-
-@subsubheading @value{GDBN} Command
-
-The corresponding @value{GDBN} command is @samp{kill}.
-
-@subsubheading Example
-N.A.
-
-
-@subheading The @code{-exec-arguments} Command
-@findex -exec-arguments
-
-@subsubheading Synopsis
-
-@example
- -exec-arguments @var{args}
-@end example
-
-Set the inferior program arguments, to be used in the next
-@samp{-exec-run}.
-
-@subsubheading @value{GDBN} Command
-
-The corresponding @value{GDBN} command is @samp{set args}.
-
-@subsubheading Example
-
-@c FIXME!
-Don't have one around.
-
-
-@subheading The @code{-exec-continue} Command
-@findex -exec-continue
-
-@subsubheading Synopsis
-
-@example
- -exec-continue
-@end example
-
-Asynchronous command. Resumes the execution of the inferior program
-until a breakpoint is encountered, or until the inferior exits.
-
-@subsubheading @value{GDBN} Command
-
-The corresponding @value{GDBN} corresponding is @samp{continue}.
-
-@subsubheading Example
-
-@smallexample
--exec-continue
-^running
-(@value{GDBP})
-@@Hello world
-*stopped,reason="breakpoint-hit",bkptno="2",frame=@{func="foo",args=[],
-file="hello.c",line="13"@}
-(@value{GDBP})
-@end smallexample
-
-
-@subheading The @code{-exec-finish} Command
-@findex -exec-finish
-
-@subsubheading Synopsis
-
-@example
- -exec-finish
-@end example
-
-Asynchronous command. Resumes the execution of the inferior program
-until the current function is exited. Displays the results returned by
-the function.
-
-@subsubheading @value{GDBN} Command
-
-The corresponding @value{GDBN} command is @samp{finish}.
-
-@subsubheading Example
-
-Function returning @code{void}.
-
-@smallexample
--exec-finish
-^running
-(@value{GDBP})
-@@hello from foo
-*stopped,reason="function-finished",frame=@{func="main",args=[],
-file="hello.c",line="7"@}
-(@value{GDBP})
-@end smallexample
-
-Function returning other than @code{void}. The name of the internal
-@value{GDBN} variable storing the result is printed, together with the
-value itself.
-
-@smallexample
--exec-finish
-^running
-(@value{GDBP})
-*stopped,reason="function-finished",frame=@{addr="0x000107b0",func="foo",
-args=[@{name="a",value="1"],@{name="b",value="9"@}@},
-file="recursive2.c",line="14"@},
-gdb-result-var="$1",return-value="0"
-(@value{GDBP})
-@end smallexample
-
-
-@subheading The @code{-exec-interrupt} Command
-@findex -exec-interrupt
-
-@subsubheading Synopsis
-
-@example
- -exec-interrupt
-@end example
-
-Asynchronous command. Interrupts the background execution of the target.
-Note how the token associated with the stop message is the one for the
-execution command that has been interrupted. The token for the interrupt
-itself only appears in the @samp{^done} output. If the user is trying to
-interrupt a non-running program, an error message will be printed.
-
-@subsubheading @value{GDBN} Command
-
-The corresponding @value{GDBN} command is @samp{interrupt}.
-
-@subsubheading Example
-
-@smallexample
-(@value{GDBP})
-111-exec-continue
-111^running
-
-(@value{GDBP})
-222-exec-interrupt
-222^done
-(@value{GDBP})
-111*stopped,signal-name="SIGINT",signal-meaning="Interrupt",
-frame=@{addr="0x00010140",func="foo",args=[],file="try.c",line="13"@}
-(@value{GDBP})
-
-(@value{GDBP})
--exec-interrupt
-^error,msg="mi_cmd_exec_interrupt: Inferior not executing."
-(@value{GDBP})
-@end smallexample
-
-
-@subheading The @code{-exec-next} Command
-@findex -exec-next
-
-@subsubheading Synopsis
-
-@example
- -exec-next
-@end example
-
-Asynchronous command. Resumes execution of the inferior program, stopping
-when the beginning of the next source line is reached.
-
-@subsubheading @value{GDBN} Command
-
-The corresponding @value{GDBN} command is @samp{next}.
-
-@subsubheading Example
-
-@smallexample
--exec-next
-^running
-(@value{GDBP})
-*stopped,reason="end-stepping-range",line="8",file="hello.c"
-(@value{GDBP})
-@end smallexample
-
-
-@subheading The @code{-exec-next-instruction} Command
-@findex -exec-next-instruction
-
-@subsubheading Synopsis
-
-@example
- -exec-next-instruction
-@end example
-
-Asynchronous command. Executes one machine instruction. If the
-instruction is a function call continues until the function returns. If
-the program stops at an instruction in the middle of a source line, the
-address will be printed as well.
-
-@subsubheading @value{GDBN} Command
-
-The corresponding @value{GDBN} command is @samp{nexti}.
-
-@subsubheading Example
-
-@smallexample
-(@value{GDBP})
--exec-next-instruction
-^running
-
-(@value{GDBP})
-*stopped,reason="end-stepping-range",
-addr="0x000100d4",line="5",file="hello.c"
-(@value{GDBP})
-@end smallexample
-
-
-@subheading The @code{-exec-return} Command
-@findex -exec-return
-
-@subsubheading Synopsis
-
-@example
- -exec-return
-@end example
-
-Makes current function return immediately. Doesn't execute the inferior.
-Displays the new current frame.
-
-@subsubheading @value{GDBN} Command
-
-The corresponding @value{GDBN} command is @samp{return}.
-
-@subsubheading Example
-
-@smallexample
-(@value{GDBP})
-200-break-insert callee4
-200^done,bkpt=@{number="1",addr="0x00010734",
-file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="8"@}
-(@value{GDBP})
-000-exec-run
-000^running
-(@value{GDBP})
-000*stopped,reason="breakpoint-hit",bkptno="1",
-frame=@{func="callee4",args=[],
-file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="8"@}
-(@value{GDBP})
-205-break-delete
-205^done
-(@value{GDBP})
-111-exec-return
-111^done,frame=@{level="0",func="callee3",
-args=[@{name="strarg",
-value="0x11940 \"A string argument.\""@}],
-file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="18"@}
-(@value{GDBP})
-@end smallexample
-
-
-@subheading The @code{-exec-run} Command
-@findex -exec-run
-
-@subsubheading Synopsis
-
-@example
- -exec-run
-@end example
-
-Asynchronous command. Starts execution of the inferior from the
-beginning. The inferior executes until either a breakpoint is
-encountered or the program exits.
-
-@subsubheading @value{GDBN} Command
-
-The corresponding @value{GDBN} command is @samp{run}.
-
-@subsubheading Example
-
-@smallexample
-(@value{GDBP})
--break-insert main
-^done,bkpt=@{number="1",addr="0x0001072c",file="recursive2.c",line="4"@}
-(@value{GDBP})
--exec-run
-^running
-(@value{GDBP})
-*stopped,reason="breakpoint-hit",bkptno="1",
-frame=@{func="main",args=[],file="recursive2.c",line="4"@}
-(@value{GDBP})
-@end smallexample
-
-
-@subheading The @code{-exec-show-arguments} Command
-@findex -exec-show-arguments
-
-@subsubheading Synopsis
-
-@example
- -exec-show-arguments
-@end example
-
-Print the arguments of the program.
-
-@subsubheading @value{GDBN} Command
-
-The corresponding @value{GDBN} command is @samp{show args}.
-
-@subsubheading Example
-N.A.
-
-@c @subheading -exec-signal
-
-@subheading The @code{-exec-step} Command
-@findex -exec-step
-
-@subsubheading Synopsis
-
-@example
- -exec-step
-@end example
-
-Asynchronous command. Resumes execution of the inferior program, stopping
-when the beginning of the next source line is reached, if the next
-source line is not a function call. If it is, stop at the first
-instruction of the called function.
-
-@subsubheading @value{GDBN} Command
-
-The corresponding @value{GDBN} command is @samp{step}.
-
-@subsubheading Example
-
-Stepping into a function:
-
-@smallexample
--exec-step
-^running
-(@value{GDBP})
-*stopped,reason="end-stepping-range",
-frame=@{func="foo",args=[@{name="a",value="10"@},
-@{name="b",value="0"@}],file="recursive2.c",line="11"@}
-(@value{GDBP})
-@end smallexample
-
-Regular stepping:
-
-@smallexample
--exec-step
-^running
-(@value{GDBP})
-*stopped,reason="end-stepping-range",line="14",file="recursive2.c"
-(@value{GDBP})
-@end smallexample
-
-
-@subheading The @code{-exec-step-instruction} Command
-@findex -exec-step-instruction
-
-@subsubheading Synopsis
-
-@example
- -exec-step-instruction
-@end example
-
-Asynchronous command. Resumes the inferior which executes one machine
-instruction. The output, once @value{GDBN} has stopped, will vary depending on
-whether we have stopped in the middle of a source line or not. In the
-former case, the address at which the program stopped will be printed as
-well.
-
-@subsubheading @value{GDBN} Command
-
-The corresponding @value{GDBN} command is @samp{stepi}.
-
-@subsubheading Example
-
-@smallexample
-(@value{GDBP})
--exec-step-instruction
-^running
-
-(@value{GDBP})
-*stopped,reason="end-stepping-range",
-frame=@{func="foo",args=[],file="try.c",line="10"@}
-(@value{GDBP})
--exec-step-instruction
-^running
-
-(@value{GDBP})
-*stopped,reason="end-stepping-range",
-frame=@{addr="0x000100f4",func="foo",args=[],file="try.c",line="10"@}
-(@value{GDBP})
-@end smallexample
-
-
-@subheading The @code{-exec-until} Command
-@findex -exec-until
-
-@subsubheading Synopsis
-
-@example
- -exec-until [ @var{location} ]
-@end example
-
-Asynchronous command. Executes the inferior until the @var{location}
-specified in the argument is reached. If there is no argument, the inferior
-executes until a source line greater than the current one is reached.
-The reason for stopping in this case will be @samp{location-reached}.
-
-@subsubheading @value{GDBN} Command
-
-The corresponding @value{GDBN} command is @samp{until}.
-
-@subsubheading Example
-
-@smallexample
-(@value{GDBP})
--exec-until recursive2.c:6
-^running
-(@value{GDBP})
-x = 55
-*stopped,reason="location-reached",frame=@{func="main",args=[],
-file="recursive2.c",line="6"@}
-(@value{GDBP})
-@end smallexample
-
-@ignore
-@subheading -file-clear
-Is this going away????
-@end ignore
-
-
-@subheading The @code{-file-exec-and-symbols} Command
-@findex -file-exec-and-symbols
-
-@subsubheading Synopsis
-
-@example
- -file-exec-and-symbols @var{file}
-@end example
-
-Specify the executable file to be debugged. This file is the one from
-which the symbol table is also read. If no file is specified, the
-command clears the executable and symbol information. If breakpoints
-are set when using this command with no arguments, @value{GDBN} will produce
-error messages. Otherwise, no output is produced, except a completion
-notification.
-
-@subsubheading @value{GDBN} Command
-
-The corresponding @value{GDBN} command is @samp{file}.
-
-@subsubheading Example
-
-@smallexample
-(@value{GDBP})
--file-exec-and-symbols /kwikemart/marge/ezannoni/TRUNK/mbx/hello.mbx
-^done
-(@value{GDBP})
-@end smallexample
-
-
-@subheading The @code{-file-exec-file} Command
-@findex -file-exec-file
-
-@subsubheading Synopsis
-
-@example
- -file-exec-file @var{file}
-@end example
-
-Specify the executable file to be debugged. Unlike
-@samp{-file-exec-and-symbols}, the symbol table is @emph{not} read
-from this file. If used without argument, @value{GDBN} clears the information
-about the executable file. No output is produced, except a completion
-notification.
-
-@subsubheading @value{GDBN} Command
-
-The corresponding @value{GDBN} command is @samp{exec-file}.
-
-@subsubheading Example
-
-@smallexample
-(@value{GDBP})
--file-exec-file /kwikemart/marge/ezannoni/TRUNK/mbx/hello.mbx
-^done
-(@value{GDBP})
-@end smallexample
-
-
-@subheading The @code{-file-list-exec-sections} Command
-@findex -file-list-exec-sections
-
-@subsubheading Synopsis
-
-@example
- -file-list-exec-sections
-@end example
-
-List the sections of the current executable file.
-
-@subsubheading @value{GDBN} Command
-
-The @value{GDBN} command @samp{info file} shows, among the rest, the same
-information as this command. @code{gdbtk} has a corresponding command
-@samp{gdb_load_info}.
-
-@subsubheading Example
-N.A.
-
-
-@subheading The @code{-file-list-exec-source-files} Command
-@findex -file-list-exec-source-files
-
-@subsubheading Synopsis
-
-@example
- -file-list-exec-source-files
-@end example
-
-List the source files for the current executable.
-
-@subsubheading @value{GDBN} Command
-
-There's no @value{GDBN} command which directly corresponds to this one.
-@code{gdbtk} has an analogous command @samp{gdb_listfiles}.
-
-@subsubheading Example
-N.A.
-
-
-@subheading The @code{-file-list-shared-libraries} Command
-@findex -file-list-shared-libraries
-
-@subsubheading Synopsis
-
-@example
- -file-list-shared-libraries
-@end example
-
-List the shared libraries in the program.
-
-@subsubheading @value{GDBN} Command
-
-The corresponding @value{GDBN} command is @samp{info shared}.
-
-@subsubheading Example
-N.A.
-
-
-@subheading The @code{-file-list-symbol-files} Command
-@findex -file-list-symbol-files
-
-@subsubheading Synopsis
-
-@example
- -file-list-symbol-files
-@end example
-
-List symbol files.
-
-@subsubheading @value{GDBN} Command
-
-The corresponding @value{GDBN} command is @samp{info file} (part of it).
-
-@subsubheading Example
-N.A.
-
-
-@subheading The @code{-file-symbol-file} Command
-@findex -file-symbol-file
-
-@subsubheading Synopsis
-
-@example
- -file-symbol-file @var{file}
-@end example
-
-Read symbol table info from the specified @var{file} argument. When
-used without arguments, clears @value{GDBN}'s symbol table info. No output is
-produced, except for a completion notification.
-
-@subsubheading @value{GDBN} Command
-
-The corresponding @value{GDBN} command is @samp{symbol-file}.
-
-@subsubheading Example
-
-@smallexample
-(@value{GDBP})
--file-symbol-file /kwikemart/marge/ezannoni/TRUNK/mbx/hello.mbx
-^done
-(@value{GDBP})
-@end smallexample
-
-@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-@node GDB/MI Miscellaneous Commands
-@section Miscellaneous @value{GDBN} commands in @sc{gdb/mi}
-
-@c @subheading -gdb-complete
-
-@subheading The @code{-gdb-exit} Command
-@findex -gdb-exit
-
-@subsubheading Synopsis
-
-@example
- -gdb-exit
-@end example
-
-Exit @value{GDBN} immediately.
-
-@subsubheading @value{GDBN} Command
-
-Approximately corresponds to @samp{quit}.
-
-@subsubheading Example
-
-@smallexample
-(@value{GDBP})
--gdb-exit
-@end smallexample
-
-@subheading The @code{-gdb-set} Command
-@findex -gdb-set
-
-@subsubheading Synopsis
-
-@example
- -gdb-set
-@end example
-
-Set an internal @value{GDBN} variable.
-@c IS THIS A DOLLAR VARIABLE? OR SOMETHING LIKE ANNOTATE ?????
-
-@subsubheading @value{GDBN} Command
-
-The corresponding @value{GDBN} command is @samp{set}.
-
-@subsubheading Example
-
-@smallexample
-(@value{GDBP})
--gdb-set $foo=3
-^done
-(@value{GDBP})
-@end smallexample
-
-
-@subheading The @code{-gdb-show} Command
-@findex -gdb-show
-
-@subsubheading Synopsis
-
-@example
- -gdb-show
-@end example
-
-Show the current value of a @value{GDBN} variable.
-
-@subsubheading @value{GDBN} command
-
-The corresponding @value{GDBN} command is @samp{show}.
-
-@subsubheading Example
-
-@smallexample
-(@value{GDBP})
--gdb-show annotate
-^done,value="0"
-(@value{GDBP})
-@end smallexample
-
-@c @subheading -gdb-source
-
-
-@subheading The @code{-gdb-version} Command
-@findex -gdb-version
-
-@subsubheading Synopsis
-
-@example
- -gdb-version
-@end example
-
-Show version information for @value{GDBN}. Used mostly in testing.
-
-@subsubheading @value{GDBN} Command
-
-There's no equivalent @value{GDBN} command. @value{GDBN} by default shows this
-information when you start an interactive session.
-
-@subsubheading Example
-
-@c This example modifies the actual output from GDB to avoid overfull
-@c box in TeX.
-@smallexample
-(@value{GDBP})
--gdb-version
-~GNU gdb 5.2.1
-~Copyright 2000 Free Software Foundation, Inc.
-~GDB is free software, covered by the GNU General Public License, and
-~you are welcome to change it and/or distribute copies of it under
-~ certain conditions.
-~Type "show copying" to see the conditions.
-~There is absolutely no warranty for GDB. Type "show warranty" for
-~ details.
-~This GDB was configured as
- "--host=sparc-sun-solaris2.5.1 --target=ppc-eabi".
-^done
-(@value{GDBP})
-@end smallexample
-
-@subheading The @code{-interpreter-exec} Command
-@findex -interpreter-exec
-
-@subheading Synopsis
-
-@smallexample
--interpreter-exec @var{interpreter} @var{command}
-@end smallexample
-
-Execute the specified @var{command} in the given @var{interpreter}.
-
-@subheading @value{GDBN} Command
-
-The corresponding @value{GDBN} command is @samp{interpreter-exec}.
-
-@subheading Example
-
-@smallexample
-(@value{GDBP})
--interpreter-exec console "break main"
-&"During symbol reading, couldn't parse type; debugger out of date?.\n"
-&"During symbol reading, bad structure-type format.\n"
-~"Breakpoint 1 at 0x8074fc6: file ../../src/gdb/main.c, line 743.\n"
-^done
-(@value{GDBP})
-@end smallexample
-
-@ignore
-@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-@node GDB/MI Kod Commands
-@section @sc{gdb/mi} Kod Commands
-
-The Kod commands are not implemented.
-
-@c @subheading -kod-info
-
-@c @subheading -kod-list
-
-@c @subheading -kod-list-object-types
-
-@c @subheading -kod-show
-
-@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-@node GDB/MI Memory Overlay Commands
-@section @sc{gdb/mi} Memory Overlay Commands
-
-The memory overlay commands are not implemented.
-
-@c @subheading -overlay-auto
-
-@c @subheading -overlay-list-mapping-state
-
-@c @subheading -overlay-list-overlays
-
-@c @subheading -overlay-map
-
-@c @subheading -overlay-off
-
-@c @subheading -overlay-on
-
-@c @subheading -overlay-unmap
-
-@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-@node GDB/MI Signal Handling Commands
-@section @sc{gdb/mi} Signal Handling Commands
-
-Signal handling commands are not implemented.
-
-@c @subheading -signal-handle
-
-@c @subheading -signal-list-handle-actions
-
-@c @subheading -signal-list-signal-types
-@end ignore
-
-
-@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-@node GDB/MI Stack Manipulation
-@section @sc{gdb/mi} Stack Manipulation Commands
-
-
-@subheading The @code{-stack-info-frame} Command
-@findex -stack-info-frame
-
-@subsubheading Synopsis
-
-@example
- -stack-info-frame
-@end example
-
-Get info on the current frame.
-
-@subsubheading @value{GDBN} Command
-
-The corresponding @value{GDBN} command is @samp{info frame} or @samp{frame}
-(without arguments).
-
-@subsubheading Example
-N.A.
-
-@subheading The @code{-stack-info-depth} Command
-@findex -stack-info-depth
-
-@subsubheading Synopsis
-
-@example
- -stack-info-depth [ @var{max-depth} ]
-@end example
-
-Return the depth of the stack. If the integer argument @var{max-depth}
-is specified, do not count beyond @var{max-depth} frames.
-
-@subsubheading @value{GDBN} Command
-
-There's no equivalent @value{GDBN} command.
-
-@subsubheading Example
-
-For a stack with frame levels 0 through 11:
-
-@smallexample
-(@value{GDBP})
--stack-info-depth
-^done,depth="12"
-(@value{GDBP})
--stack-info-depth 4
-^done,depth="4"
-(@value{GDBP})
--stack-info-depth 12
-^done,depth="12"
-(@value{GDBP})
--stack-info-depth 11
-^done,depth="11"
-(@value{GDBP})
--stack-info-depth 13
-^done,depth="12"
-(@value{GDBP})
-@end smallexample
-
-@subheading The @code{-stack-list-arguments} Command
-@findex -stack-list-arguments
-
-@subsubheading Synopsis
-
-@example
- -stack-list-arguments @var{show-values}
- [ @var{low-frame} @var{high-frame} ]
-@end example
-
-Display a list of the arguments for the frames between @var{low-frame}
-and @var{high-frame} (inclusive). If @var{low-frame} and
-@var{high-frame} are not provided, list the arguments for the whole call
-stack.
-
-The @var{show-values} argument must have a value of 0 or 1. A value of
-0 means that only the names of the arguments are listed, a value of 1
-means that both names and values of the arguments are printed.
-
-@subsubheading @value{GDBN} Command
-
-@value{GDBN} does not have an equivalent command. @code{gdbtk} has a
-@samp{gdb_get_args} command which partially overlaps with the
-functionality of @samp{-stack-list-arguments}.
-
-@subsubheading Example
-
-@smallexample
-(@value{GDBP})
--stack-list-frames
-^done,
-stack=[
-frame=@{level="0",addr="0x00010734",func="callee4",
-file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="8"@},
-frame=@{level="1",addr="0x0001076c",func="callee3",
-file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="17"@},
-frame=@{level="2",addr="0x0001078c",func="callee2",
-file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="22"@},
-frame=@{level="3",addr="0x000107b4",func="callee1",
-file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="27"@},
-frame=@{level="4",addr="0x000107e0",func="main",
-file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="32"@}]
-(@value{GDBP})
--stack-list-arguments 0
-^done,
-stack-args=[
-frame=@{level="0",args=[]@},
-frame=@{level="1",args=[name="strarg"]@},
-frame=@{level="2",args=[name="intarg",name="strarg"]@},
-frame=@{level="3",args=[name="intarg",name="strarg",name="fltarg"]@},
-frame=@{level="4",args=[]@}]
-(@value{GDBP})
--stack-list-arguments 1
-^done,
-stack-args=[
-frame=@{level="0",args=[]@},
-frame=@{level="1",
- args=[@{name="strarg",value="0x11940 \"A string argument.\""@}]@},
-frame=@{level="2",args=[
-@{name="intarg",value="2"@},
-@{name="strarg",value="0x11940 \"A string argument.\""@}]@},
-@{frame=@{level="3",args=[
-@{name="intarg",value="2"@},
-@{name="strarg",value="0x11940 \"A string argument.\""@},
-@{name="fltarg",value="3.5"@}]@},
-frame=@{level="4",args=[]@}]
-(@value{GDBP})
--stack-list-arguments 0 2 2
-^done,stack-args=[frame=@{level="2",args=[name="intarg",name="strarg"]@}]
-(@value{GDBP})
--stack-list-arguments 1 2 2
-^done,stack-args=[frame=@{level="2",
-args=[@{name="intarg",value="2"@},
-@{name="strarg",value="0x11940 \"A string argument.\""@}]@}]
-(@value{GDBP})
-@end smallexample
-
-@c @subheading -stack-list-exception-handlers
-
-
-@subheading The @code{-stack-list-frames} Command
-@findex -stack-list-frames
-
-@subsubheading Synopsis
-
-@example
- -stack-list-frames [ @var{low-frame} @var{high-frame} ]
-@end example
-
-List the frames currently on the stack. For each frame it displays the
-following info:
-
-@table @samp
-@item @var{level}
-The frame number, 0 being the topmost frame, i.e. the innermost function.
-@item @var{addr}
-The @code{$pc} value for that frame.
-@item @var{func}
-Function name.
-@item @var{file}
-File name of the source file where the function lives.
-@item @var{line}
-Line number corresponding to the @code{$pc}.
-@end table
-
-If invoked without arguments, this command prints a backtrace for the
-whole stack. If given two integer arguments, it shows the frames whose
-levels are between the two arguments (inclusive). If the two arguments
-are equal, it shows the single frame at the corresponding level.
-
-@subsubheading @value{GDBN} Command
-
-The corresponding @value{GDBN} commands are @samp{backtrace} and @samp{where}.
-
-@subsubheading Example
-
-Full stack backtrace:
-
-@smallexample
-(@value{GDBP})
--stack-list-frames
-^done,stack=
-[frame=@{level="0",addr="0x0001076c",func="foo",
- file="recursive2.c",line="11"@},
-frame=@{level="1",addr="0x000107a4",func="foo",
- file="recursive2.c",line="14"@},
-frame=@{level="2",addr="0x000107a4",func="foo",
- file="recursive2.c",line="14"@},
-frame=@{level="3",addr="0x000107a4",func="foo",
- file="recursive2.c",line="14"@},
-frame=@{level="4",addr="0x000107a4",func="foo",
- file="recursive2.c",line="14"@},
-frame=@{level="5",addr="0x000107a4",func="foo",
- file="recursive2.c",line="14"@},
-frame=@{level="6",addr="0x000107a4",func="foo",
- file="recursive2.c",line="14"@},
-frame=@{level="7",addr="0x000107a4",func="foo",
- file="recursive2.c",line="14"@},
-frame=@{level="8",addr="0x000107a4",func="foo",
- file="recursive2.c",line="14"@},
-frame=@{level="9",addr="0x000107a4",func="foo",
- file="recursive2.c",line="14"@},
-frame=@{level="10",addr="0x000107a4",func="foo",
- file="recursive2.c",line="14"@},
-frame=@{level="11",addr="0x00010738",func="main",
- file="recursive2.c",line="4"@}]
-(@value{GDBP})
-@end smallexample
-
-Show frames between @var{low_frame} and @var{high_frame}:
-
-@smallexample
-(@value{GDBP})
--stack-list-frames 3 5
-^done,stack=
-[frame=@{level="3",addr="0x000107a4",func="foo",
- file="recursive2.c",line="14"@},
-frame=@{level="4",addr="0x000107a4",func="foo",
- file="recursive2.c",line="14"@},
-frame=@{level="5",addr="0x000107a4",func="foo",
- file="recursive2.c",line="14"@}]
-(@value{GDBP})
-@end smallexample
-
-Show a single frame:
-
-@smallexample
-(@value{GDBP})
--stack-list-frames 3 3
-^done,stack=
-[frame=@{level="3",addr="0x000107a4",func="foo",
- file="recursive2.c",line="14"@}]
-(@value{GDBP})
-@end smallexample
-
-
-@subheading The @code{-stack-list-locals} Command
-@findex -stack-list-locals
-
-@subsubheading Synopsis
-
-@example
- -stack-list-locals @var{print-values}
-@end example
-
-Display the local variable names for the current frame. With an
-argument of 0 prints only the names of the variables, with argument of 1
-prints also their values.
-
-@subsubheading @value{GDBN} Command
-
-@samp{info locals} in @value{GDBN}, @samp{gdb_get_locals} in @code{gdbtk}.
-
-@subsubheading Example
-
-@smallexample
-(@value{GDBP})
--stack-list-locals 0
-^done,locals=[name="A",name="B",name="C"]
-(@value{GDBP})
--stack-list-locals 1
-^done,locals=[@{name="A",value="1"@},@{name="B",value="2"@},
- @{name="C",value="3"@}]
-(@value{GDBP})
-@end smallexample
-
-
-@subheading The @code{-stack-select-frame} Command
-@findex -stack-select-frame
-
-@subsubheading Synopsis
-
-@example
- -stack-select-frame @var{framenum}
-@end example
-
-Change the current frame. Select a different frame @var{framenum} on
-the stack.
-
-@subsubheading @value{GDBN} Command
-
-The corresponding @value{GDBN} commands are @samp{frame}, @samp{up},
-@samp{down}, @samp{select-frame}, @samp{up-silent}, and @samp{down-silent}.
-
-@subsubheading Example
-
-@smallexample
-(@value{GDBP})
--stack-select-frame 2
-^done
-(@value{GDBP})
-@end smallexample
-
-@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-@node GDB/MI Symbol Query
-@section @sc{gdb/mi} Symbol Query Commands
-
-
-@subheading The @code{-symbol-info-address} Command
-@findex -symbol-info-address
-
-@subsubheading Synopsis
-
-@example
- -symbol-info-address @var{symbol}
-@end example
-
-Describe where @var{symbol} is stored.
-
-@subsubheading @value{GDBN} Command
-
-The corresponding @value{GDBN} command is @samp{info address}.
-
-@subsubheading Example
-N.A.
-
-
-@subheading The @code{-symbol-info-file} Command
-@findex -symbol-info-file
-
-@subsubheading Synopsis
-
-@example
- -symbol-info-file
-@end example
-
-Show the file for the symbol.
-
-@subsubheading @value{GDBN} Command
-
-There's no equivalent @value{GDBN} command. @code{gdbtk} has
-@samp{gdb_find_file}.
-
-@subsubheading Example
-N.A.
-
-
-@subheading The @code{-symbol-info-function} Command
-@findex -symbol-info-function
-
-@subsubheading Synopsis
-
-@example
- -symbol-info-function
-@end example
-
-Show which function the symbol lives in.
-
-@subsubheading @value{GDBN} Command
-
-@samp{gdb_get_function} in @code{gdbtk}.
-
-@subsubheading Example
-N.A.
-
-
-@subheading The @code{-symbol-info-line} Command
-@findex -symbol-info-line
-
-@subsubheading Synopsis
-
-@example
- -symbol-info-line
-@end example
-
-Show the core addresses of the code for a source line.
-
-@subsubheading @value{GDBN} Command
-
-The corresponding @value{GDBN} comamnd is @samp{info line}.
-@code{gdbtk} has the @samp{gdb_get_line} and @samp{gdb_get_file} commands.
-
-@subsubheading Example
-N.A.
-
-
-@subheading The @code{-symbol-info-symbol} Command
-@findex -symbol-info-symbol
-
-@subsubheading Synopsis
-
-@example
- -symbol-info-symbol @var{addr}
-@end example
-
-Describe what symbol is at location @var{addr}.
-
-@subsubheading @value{GDBN} Command
-
-The corresponding @value{GDBN} command is @samp{info symbol}.
-
-@subsubheading Example
-N.A.
-
-
-@subheading The @code{-symbol-list-functions} Command
-@findex -symbol-list-functions
-
-@subsubheading Synopsis
-
-@example
- -symbol-list-functions
-@end example
-
-List the functions in the executable.
-
-@subsubheading @value{GDBN} Command
-
-@samp{info functions} in @value{GDBN}, @samp{gdb_listfunc} and
-@samp{gdb_search} in @code{gdbtk}.
-
-@subsubheading Example
-N.A.
-
-
-@subheading The @code{-symbol-list-types} Command
-@findex -symbol-list-types
-
-@subsubheading Synopsis
-
-@example
- -symbol-list-types
-@end example
-
-List all the type names.
-
-@subsubheading @value{GDBN} Command
-
-The corresponding commands are @samp{info types} in @value{GDBN},
-@samp{gdb_search} in @code{gdbtk}.
-
-@subsubheading Example
-N.A.
-
-
-@subheading The @code{-symbol-list-variables} Command
-@findex -symbol-list-variables
-
-@subsubheading Synopsis
-
-@example
- -symbol-list-variables
-@end example
-
-List all the global and static variable names.
-
-@subsubheading @value{GDBN} Command
-
-@samp{info variables} in @value{GDBN}, @samp{gdb_search} in @code{gdbtk}.
-
-@subsubheading Example
-N.A.
-
-
-@subheading The @code{-symbol-locate} Command
-@findex -symbol-locate
-
-@subsubheading Synopsis
-
-@example
- -symbol-locate
-@end example
-
-@subsubheading @value{GDBN} Command
-
-@samp{gdb_loc} in @code{gdbtk}.
-
-@subsubheading Example
-N.A.
-
-
-@subheading The @code{-symbol-type} Command
-@findex -symbol-type
-
-@subsubheading Synopsis
-
-@example
- -symbol-type @var{variable}
-@end example
-
-Show type of @var{variable}.
-
-@subsubheading @value{GDBN} Command
-
-The corresponding @value{GDBN} command is @samp{ptype}, @code{gdbtk} has
-@samp{gdb_obj_variable}.
-
-@subsubheading Example
-N.A.
-
-
-@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-@node GDB/MI Target Manipulation
-@section @sc{gdb/mi} Target Manipulation Commands
-
-
-@subheading The @code{-target-attach} Command
-@findex -target-attach
-
-@subsubheading Synopsis
-
-@example
- -target-attach @var{pid} | @var{file}
-@end example
-
-Attach to a process @var{pid} or a file @var{file} outside of @value{GDBN}.
-
-@subsubheading @value{GDBN} command
-
-The corresponding @value{GDBN} command is @samp{attach}.
-
-@subsubheading Example
-N.A.
-
-
-@subheading The @code{-target-compare-sections} Command
-@findex -target-compare-sections
-
-@subsubheading Synopsis
-
-@example
- -target-compare-sections [ @var{section} ]
-@end example
-
-Compare data of section @var{section} on target to the exec file.
-Without the argument, all sections are compared.
-
-@subsubheading @value{GDBN} Command
-
-The @value{GDBN} equivalent is @samp{compare-sections}.
-
-@subsubheading Example
-N.A.
-
-
-@subheading The @code{-target-detach} Command
-@findex -target-detach
-
-@subsubheading Synopsis
-
-@example
- -target-detach
-@end example
-
-Disconnect from the remote target. There's no output.
-
-@subsubheading @value{GDBN} command
-
-The corresponding @value{GDBN} command is @samp{detach}.
-
-@subsubheading Example
-
-@smallexample
-(@value{GDBP})
--target-detach
-^done
-(@value{GDBP})
-@end smallexample
-
-
-@subheading The @code{-target-download} Command
-@findex -target-download
-
-@subsubheading Synopsis
-
-@example
- -target-download
-@end example
-
-Loads the executable onto the remote target.
-It prints out an update message every half second, which includes the fields:
-
-@table @samp
-@item section
-The name of the section.
-@item section-sent
-The size of what has been sent so far for that section.
-@item section-size
-The size of the section.
-@item total-sent
-The total size of what was sent so far (the current and the previous sections).
-@item total-size
-The size of the overall executable to download.
-@end table
-
-@noindent
-Each message is sent as status record (@pxref{GDB/MI Output Syntax, ,
-@sc{gdb/mi} Output Syntax}).
-
-In addition, it prints the name and size of the sections, as they are
-downloaded. These messages include the following fields:
-
-@table @samp
-@item section
-The name of the section.
-@item section-size
-The size of the section.
-@item total-size
-The size of the overall executable to download.
-@end table
-
-@noindent
-At the end, a summary is printed.
-
-@subsubheading @value{GDBN} Command
-
-The corresponding @value{GDBN} command is @samp{load}.
-
-@subsubheading Example
-
-Note: each status message appears on a single line. Here the messages
-have been broken down so that they can fit onto a page.
-
-@smallexample
-(@value{GDBP})
--target-download
-+download,@{section=".text",section-size="6668",total-size="9880"@}
-+download,@{section=".text",section-sent="512",section-size="6668",
-total-sent="512",total-size="9880"@}
-+download,@{section=".text",section-sent="1024",section-size="6668",
-total-sent="1024",total-size="9880"@}
-+download,@{section=".text",section-sent="1536",section-size="6668",
-total-sent="1536",total-size="9880"@}
-+download,@{section=".text",section-sent="2048",section-size="6668",
-total-sent="2048",total-size="9880"@}
-+download,@{section=".text",section-sent="2560",section-size="6668",
-total-sent="2560",total-size="9880"@}
-+download,@{section=".text",section-sent="3072",section-size="6668",
-total-sent="3072",total-size="9880"@}
-+download,@{section=".text",section-sent="3584",section-size="6668",
-total-sent="3584",total-size="9880"@}
-+download,@{section=".text",section-sent="4096",section-size="6668",
-total-sent="4096",total-size="9880"@}
-+download,@{section=".text",section-sent="4608",section-size="6668",
-total-sent="4608",total-size="9880"@}
-+download,@{section=".text",section-sent="5120",section-size="6668",
-total-sent="5120",total-size="9880"@}
-+download,@{section=".text",section-sent="5632",section-size="6668",
-total-sent="5632",total-size="9880"@}
-+download,@{section=".text",section-sent="6144",section-size="6668",
-total-sent="6144",total-size="9880"@}
-+download,@{section=".text",section-sent="6656",section-size="6668",
-total-sent="6656",total-size="9880"@}
-+download,@{section=".init",section-size="28",total-size="9880"@}
-+download,@{section=".fini",section-size="28",total-size="9880"@}
-+download,@{section=".data",section-size="3156",total-size="9880"@}
-+download,@{section=".data",section-sent="512",section-size="3156",
-total-sent="7236",total-size="9880"@}
-+download,@{section=".data",section-sent="1024",section-size="3156",
-total-sent="7748",total-size="9880"@}
-+download,@{section=".data",section-sent="1536",section-size="3156",
-total-sent="8260",total-size="9880"@}
-+download,@{section=".data",section-sent="2048",section-size="3156",
-total-sent="8772",total-size="9880"@}
-+download,@{section=".data",section-sent="2560",section-size="3156",
-total-sent="9284",total-size="9880"@}
-+download,@{section=".data",section-sent="3072",section-size="3156",
-total-sent="9796",total-size="9880"@}
-^done,address="0x10004",load-size="9880",transfer-rate="6586",
-write-rate="429"
-(@value{GDBP})
-@end smallexample
-
-
-@subheading The @code{-target-exec-status} Command
-@findex -target-exec-status
-
-@subsubheading Synopsis
-
-@example
- -target-exec-status
-@end example
-
-Provide information on the state of the target (whether it is running or
-not, for instance).
-
-@subsubheading @value{GDBN} Command
-
-There's no equivalent @value{GDBN} command.
-
-@subsubheading Example
-N.A.
-
-
-@subheading The @code{-target-list-available-targets} Command
-@findex -target-list-available-targets
-
-@subsubheading Synopsis
-
-@example
- -target-list-available-targets
-@end example
-
-List the possible targets to connect to.
-
-@subsubheading @value{GDBN} Command
-
-The corresponding @value{GDBN} command is @samp{help target}.
-
-@subsubheading Example
-N.A.
-
-
-@subheading The @code{-target-list-current-targets} Command
-@findex -target-list-current-targets
-
-@subsubheading Synopsis
-
-@example
- -target-list-current-targets
-@end example
-
-Describe the current target.
-
-@subsubheading @value{GDBN} Command
-
-The corresponding information is printed by @samp{info file} (among
-other things).
-
-@subsubheading Example
-N.A.
-
-
-@subheading The @code{-target-list-parameters} Command
-@findex -target-list-parameters
-
-@subsubheading Synopsis
-
-@example
- -target-list-parameters
-@end example
-
-@c ????
-
-@subsubheading @value{GDBN} Command
-
-No equivalent.
-
-@subsubheading Example
-N.A.
-
-
-@subheading The @code{-target-select} Command
-@findex -target-select
-
-@subsubheading Synopsis
-
-@example
- -target-select @var{type} @var{parameters @dots{}}
-@end example
-
-Connect @value{GDBN} to the remote target. This command takes two args:
-
-@table @samp
-@item @var{type}
-The type of target, for instance @samp{async}, @samp{remote}, etc.
-@item @var{parameters}
-Device names, host names and the like. @xref{Target Commands, ,
-Commands for managing targets}, for more details.
-@end table
-
-The output is a connection notification, followed by the address at
-which the target program is, in the following form:
-
-@smallexample
-^connected,addr="@var{address}",func="@var{function name}",
- args=[@var{arg list}]
-@end smallexample
-
-@subsubheading @value{GDBN} Command
-
-The corresponding @value{GDBN} command is @samp{target}.
-
-@subsubheading Example
-
-@smallexample
-(@value{GDBP})
--target-select async /dev/ttya
-^connected,addr="0xfe00a300",func="??",args=[]
-(@value{GDBP})
-@end smallexample
-
-@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-@node GDB/MI Thread Commands
-@section @sc{gdb/mi} Thread Commands
-
-
-@subheading The @code{-thread-info} Command
-@findex -thread-info
-
-@subsubheading Synopsis
-
-@example
- -thread-info
-@end example
-
-@subsubheading @value{GDBN} command
-
-No equivalent.
-
-@subsubheading Example
-N.A.
-
-
-@subheading The @code{-thread-list-all-threads} Command
-@findex -thread-list-all-threads
-
-@subsubheading Synopsis
-
-@example
- -thread-list-all-threads
-@end example
-
-@subsubheading @value{GDBN} Command
-
-The equivalent @value{GDBN} command is @samp{info threads}.
-
-@subsubheading Example
-N.A.
-
-
-@subheading The @code{-thread-list-ids} Command
-@findex -thread-list-ids
-
-@subsubheading Synopsis
-
-@example
- -thread-list-ids
-@end example
-
-Produces a list of the currently known @value{GDBN} thread ids. At the
-end of the list it also prints the total number of such threads.
-
-@subsubheading @value{GDBN} Command
-
-Part of @samp{info threads} supplies the same information.
-
-@subsubheading Example
-
-No threads present, besides the main process:
-
-@smallexample
-(@value{GDBP})
--thread-list-ids
-^done,thread-ids=@{@},number-of-threads="0"
-(@value{GDBP})
-@end smallexample
-
-
-Several threads:
-
-@smallexample
-(@value{GDBP})
--thread-list-ids
-^done,thread-ids=@{thread-id="3",thread-id="2",thread-id="1"@},
-number-of-threads="3"
-(@value{GDBP})
-@end smallexample
-
-
-@subheading The @code{-thread-select} Command
-@findex -thread-select
-
-@subsubheading Synopsis
-
-@example
- -thread-select @var{threadnum}
-@end example
-
-Make @var{threadnum} the current thread. It prints the number of the new
-current thread, and the topmost frame for that thread.
-
-@subsubheading @value{GDBN} Command
-
-The corresponding @value{GDBN} command is @samp{thread}.
-
-@subsubheading Example
-
-@smallexample
-(@value{GDBP})
--exec-next
-^running
-(@value{GDBP})
-*stopped,reason="end-stepping-range",thread-id="2",line="187",
-file="../../../devo/gdb/testsuite/gdb.threads/linux-dp.c"
-(@value{GDBP})
--thread-list-ids
-^done,
-thread-ids=@{thread-id="3",thread-id="2",thread-id="1"@},
-number-of-threads="3"
-(@value{GDBP})
--thread-select 3
-^done,new-thread-id="3",
-frame=@{level="0",func="vprintf",
-args=[@{name="format",value="0x8048e9c \"%*s%c %d %c\\n\""@},
-@{name="arg",value="0x2"@}],file="vprintf.c",line="31"@}
-(@value{GDBP})
-@end smallexample
-
-@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-@node GDB/MI Tracepoint Commands
-@section @sc{gdb/mi} Tracepoint Commands
-
-The tracepoint commands are not yet implemented.
-
-@c @subheading -trace-actions
-
-@c @subheading -trace-delete
-
-@c @subheading -trace-disable
-
-@c @subheading -trace-dump
-
-@c @subheading -trace-enable
-
-@c @subheading -trace-exists
-
-@c @subheading -trace-find
-
-@c @subheading -trace-frame-number
-
-@c @subheading -trace-info
-
-@c @subheading -trace-insert
-
-@c @subheading -trace-list
-
-@c @subheading -trace-pass-count
-
-@c @subheading -trace-save
-
-@c @subheading -trace-start
-
-@c @subheading -trace-stop
-
-
-@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-@node GDB/MI Variable Objects
-@section @sc{gdb/mi} Variable Objects
-
-
-@subheading Motivation for Variable Objects in @sc{gdb/mi}
-
-For the implementation of a variable debugger window (locals, watched
-expressions, etc.), we are proposing the adaptation of the existing code
-used by @code{Insight}.
-
-The two main reasons for that are:
-
-@enumerate 1
-@item
-It has been proven in practice (it is already on its second generation).
-
-@item
-It will shorten development time (needless to say how important it is
-now).
-@end enumerate
-
-The original interface was designed to be used by Tcl code, so it was
-slightly changed so it could be used through @sc{gdb/mi}. This section
-describes the @sc{gdb/mi} operations that will be available and gives some
-hints about their use.
-
-@emph{Note}: In addition to the set of operations described here, we
-expect the @sc{gui} implementation of a variable window to require, at
-least, the following operations:
-
-@itemize @bullet
-@item @code{-gdb-show} @code{output-radix}
-@item @code{-stack-list-arguments}
-@item @code{-stack-list-locals}
-@item @code{-stack-select-frame}
-@end itemize
-
-@subheading Introduction to Variable Objects in @sc{gdb/mi}
-
-@cindex variable objects in @sc{gdb/mi}
-The basic idea behind variable objects is the creation of a named object
-to represent a variable, an expression, a memory location or even a CPU
-register. For each object created, a set of operations is available for
-examining or changing its properties.
-
-Furthermore, complex data types, such as C structures, are represented
-in a tree format. For instance, the @code{struct} type variable is the
-root and the children will represent the struct members. If a child
-is itself of a complex type, it will also have children of its own.
-Appropriate language differences are handled for C, C@t{++} and Java.
-
-When returning the actual values of the objects, this facility allows
-for the individual selection of the display format used in the result
-creation. It can be chosen among: binary, decimal, hexadecimal, octal
-and natural. Natural refers to a default format automatically
-chosen based on the variable type (like decimal for an @code{int}, hex
-for pointers, etc.).
-
-The following is the complete set of @sc{gdb/mi} operations defined to
-access this functionality:
-
-@multitable @columnfractions .4 .6
-@item @strong{Operation}
-@tab @strong{Description}
-
-@item @code{-var-create}
-@tab create a variable object
-@item @code{-var-delete}
-@tab delete the variable object and its children
-@item @code{-var-set-format}
-@tab set the display format of this variable
-@item @code{-var-show-format}
-@tab show the display format of this variable
-@item @code{-var-info-num-children}
-@tab tells how many children this object has
-@item @code{-var-list-children}
-@tab return a list of the object's children
-@item @code{-var-info-type}
-@tab show the type of this variable object
-@item @code{-var-info-expression}
-@tab print what this variable object represents
-@item @code{-var-show-attributes}
-@tab is this variable editable? does it exist here?
-@item @code{-var-evaluate-expression}
-@tab get the value of this variable
-@item @code{-var-assign}
-@tab set the value of this variable
-@item @code{-var-update}
-@tab update the variable and its children
-@end multitable
-
-In the next subsection we describe each operation in detail and suggest
-how it can be used.
-
-@subheading Description And Use of Operations on Variable Objects
-
-@subheading The @code{-var-create} Command
-@findex -var-create
-
-@subsubheading Synopsis
-
-@example
- -var-create @{@var{name} | "-"@}
- @{@var{frame-addr} | "*"@} @var{expression}
-@end example
-
-This operation creates a variable object, which allows the monitoring of
-a variable, the result of an expression, a memory cell or a CPU
-register.
-
-The @var{name} parameter is the string by which the object can be
-referenced. It must be unique. If @samp{-} is specified, the varobj
-system will generate a string ``varNNNNNN'' automatically. It will be
-unique provided that one does not specify @var{name} on that format.
-The command fails if a duplicate name is found.
-
-The frame under which the expression should be evaluated can be
-specified by @var{frame-addr}. A @samp{*} indicates that the current
-frame should be used.
-
-@var{expression} is any expression valid on the current language set (must not
-begin with a @samp{*}), or one of the following:
-
-@itemize @bullet
-@item
-@samp{*@var{addr}}, where @var{addr} is the address of a memory cell
-
-@item
-@samp{*@var{addr}-@var{addr}} --- a memory address range (TBD)
-
-@item
-@samp{$@var{regname}} --- a CPU register name
-@end itemize
-
-@subsubheading Result
-
-This operation returns the name, number of children and the type of the
-object created. Type is returned as a string as the ones generated by
-the @value{GDBN} CLI:
-
-@example
- name="@var{name}",numchild="N",type="@var{type}"
-@end example
-
-
-@subheading The @code{-var-delete} Command
-@findex -var-delete
-
-@subsubheading Synopsis
-
-@example
- -var-delete @var{name}
-@end example
-
-Deletes a previously created variable object and all of its children.
-
-Returns an error if the object @var{name} is not found.
-
-
-@subheading The @code{-var-set-format} Command
-@findex -var-set-format
-
-@subsubheading Synopsis
-
-@example
- -var-set-format @var{name} @var{format-spec}
-@end example
-
-Sets the output format for the value of the object @var{name} to be
-@var{format-spec}.
-
-The syntax for the @var{format-spec} is as follows:
-
-@example
- @var{format-spec} @expansion{}
- @{binary | decimal | hexadecimal | octal | natural@}
-@end example
-
-
-@subheading The @code{-var-show-format} Command
-@findex -var-show-format
-
-@subsubheading Synopsis
-
-@example
- -var-show-format @var{name}
-@end example
-
-Returns the format used to display the value of the object @var{name}.
-
-@example
- @var{format} @expansion{}
- @var{format-spec}
-@end example
-
-
-@subheading The @code{-var-info-num-children} Command
-@findex -var-info-num-children
-
-@subsubheading Synopsis
-
-@example
- -var-info-num-children @var{name}
-@end example
-
-Returns the number of children of a variable object @var{name}:
-
-@example
- numchild=@var{n}
-@end example
-
-
-@subheading The @code{-var-list-children} Command
-@findex -var-list-children
-
-@subsubheading Synopsis
-
-@example
- -var-list-children @var{name}
-@end example
-
-Returns a list of the children of the specified variable object:
-
-@example
- numchild=@var{n},children=[@{name=@var{name},
- numchild=@var{n},type=@var{type}@},@r{(repeats N times)}]
-@end example
-
-
-@subheading The @code{-var-info-type} Command
-@findex -var-info-type
-
-@subsubheading Synopsis
-
-@example
- -var-info-type @var{name}
-@end example
-
-Returns the type of the specified variable @var{name}. The type is
-returned as a string in the same format as it is output by the
-@value{GDBN} CLI:
-
-@example
- type=@var{typename}
-@end example
-
-
-@subheading The @code{-var-info-expression} Command
-@findex -var-info-expression
-
-@subsubheading Synopsis
-
-@example
- -var-info-expression @var{name}
-@end example
-
-Returns what is represented by the variable object @var{name}:
-
-@example
- lang=@var{lang-spec},exp=@var{expression}
-@end example
-
-@noindent
-where @var{lang-spec} is @code{@{"C" | "C++" | "Java"@}}.
-
-@subheading The @code{-var-show-attributes} Command
-@findex -var-show-attributes
-
-@subsubheading Synopsis
-
-@example
- -var-show-attributes @var{name}
-@end example
-
-List attributes of the specified variable object @var{name}:
-
-@example
- status=@var{attr} [ ( ,@var{attr} )* ]
-@end example
-
-@noindent
-where @var{attr} is @code{@{ @{ editable | noneditable @} | TBD @}}.
-
-@subheading The @code{-var-evaluate-expression} Command
-@findex -var-evaluate-expression
-
-@subsubheading Synopsis
-
-@example
- -var-evaluate-expression @var{name}
-@end example
-
-Evaluates the expression that is represented by the specified variable
-object and returns its value as a string in the current format specified
-for the object:
-
-@example
- value=@var{value}
-@end example
-
-Note that one must invoke @code{-var-list-children} for a variable
-before the value of a child variable can be evaluated.
-
-@subheading The @code{-var-assign} Command
-@findex -var-assign
-
-@subsubheading Synopsis
-
-@example
- -var-assign @var{name} @var{expression}
-@end example
-
-Assigns the value of @var{expression} to the variable object specified
-by @var{name}. The object must be @samp{editable}. If the variable's
-value is altered by the assign, the variable will show up in any
-subsequent @code{-var-update} list.
-
-@subsubheading Example
-
-@example
-(@value{GDBP})
--var-assign var1 3
-^done,value="3"
-(@value{GDBP})
--var-update *
-^done,changelist=[@{name="var1",in_scope="true",type_changed="false"@}]
-(@value{GDBP})
-@end example
-
-@subheading The @code{-var-update} Command
-@findex -var-update
-
-@subsubheading Synopsis
-
-@example
- -var-update @{@var{name} | "*"@}
-@end example
-
-Update the value of the variable object @var{name} by evaluating its
-expression after fetching all the new values from memory or registers.
-A @samp{*} causes all existing variable objects to be updated.
diff --git a/gdb/mi/mi-cmds.c b/gdb/mi/mi-cmds.c
index 5a0bf50..d677842 100644
--- a/gdb/mi/mi-cmds.c
+++ b/gdb/mi/mi-cmds.c
@@ -80,6 +80,7 @@ struct mi_cmd mi_cmds[] =
{"file-exec-and-symbols", "file %s", 0},
{"file-exec-file", "exec-file %s", 0},
{"file-list-exec-sections", 0, 0},
+ {"file-list-exec-source-file", 0, 0, mi_cmd_file_list_exec_source_file},
{"file-list-exec-source-files", 0, 0},
{"file-list-shared-libraries", 0, 0},
{"file-list-symbol-files", 0, 0},
diff --git a/gdb/mi/mi-cmds.h b/gdb/mi/mi-cmds.h
index 3eb6153..47e1bbf 100644
--- a/gdb/mi/mi-cmds.h
+++ b/gdb/mi/mi-cmds.h
@@ -80,6 +80,7 @@ extern mi_cmd_args_ftype mi_cmd_exec_step;
extern mi_cmd_args_ftype mi_cmd_exec_step_instruction;
extern mi_cmd_args_ftype mi_cmd_exec_until;
extern mi_cmd_args_ftype mi_cmd_exec_interrupt;
+extern mi_cmd_argv_ftype mi_cmd_file_list_exec_source_file;
extern mi_cmd_argv_ftype mi_cmd_gdb_exit;
extern mi_cmd_argv_ftype mi_cmd_interpreter_exec;
extern mi_cmd_argv_ftype mi_cmd_stack_info_depth;
diff --git a/gdb/mi/mi-getopt.c b/gdb/mi/mi-getopt.c
index 59ccdf3..3f2a902 100644
--- a/gdb/mi/mi-getopt.c
+++ b/gdb/mi/mi-getopt.c
@@ -74,3 +74,19 @@ mi_getopt (const char *prefix,
}
error ("%s: Unknown option ``%s''", prefix, arg + 1);
}
+
+int
+mi_valid_noargs (const char *prefix, int argc, char **argv)
+{
+ int optind = 0;
+ char *optarg;
+ static struct mi_opt opts[] =
+ {
+ 0
+ };
+
+ if (mi_getopt (prefix, argc, argv, opts, &optind, &optarg) == -1)
+ return 1;
+ else
+ return 0;
+}
diff --git a/gdb/mi/mi-getopt.h b/gdb/mi/mi-getopt.h
index 6b31adf..17d66fb 100644
--- a/gdb/mi/mi-getopt.h
+++ b/gdb/mi/mi-getopt.h
@@ -57,4 +57,24 @@ struct mi_opt
struct mi_opt;
+/* mi_valid_noargs
+
+ Determines if ARGC/ARGV are a valid set of parameters to satisfy
+ an MI function that is not supposed to recieve any arguments.
+
+ An MI function that should not recieve arguments can still be
+ passed parameters after the special option '--' such as below.
+
+ Example: The MI function -exec-run takes no args.
+ However, the client may pass '-exec-run -- -a ...'
+ See PR-783
+
+ PREFIX is passed to mi_getopt for an error message.
+
+ This function Returns 1 if the parameter pair ARGC/ARGV are valid
+ for an MI function that takes no arguments. Otherwise, it returns 0
+ and the appropriate error message is displayed by mi_getopt. */
+
+extern int mi_valid_noargs (const char *prefix, int argc, char **argv);
+
#endif
diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c
index f08bd3f..6ba0698 100644
--- a/gdb/mi/mi-main.c
+++ b/gdb/mi/mi-main.c
@@ -514,6 +514,9 @@ get_register (int regnum, int format)
char *raw_buffer = alloca (MAX_REGISTER_RAW_SIZE);
char *virtual_buffer = alloca (MAX_REGISTER_VIRTUAL_SIZE);
int optim;
+ int realnum;
+ CORE_ADDR addr;
+ enum lval_type lval;
static struct ui_stream *stb = NULL;
stb = ui_out_stream_new (uiout);
@@ -521,9 +524,9 @@ get_register (int regnum, int format)
if (format == 'N')
format = 0;
- get_saved_register (raw_buffer, &optim, (CORE_ADDR *) NULL,
- deprecated_selected_frame,
- regnum, (enum lval_type *) NULL);
+ frame_register (deprecated_selected_frame, regnum, &optim, &lval, &addr,
+ &realnum, raw_buffer);
+
if (optim)
{
xasprintf (&mi_error_message, "Optimized out");
diff --git a/gdb/mi/mi-out.c b/gdb/mi/mi-out.c
index f7156ca..2aac528 100644
--- a/gdb/mi/mi-out.c
+++ b/gdb/mi/mi-out.c
@@ -1,6 +1,6 @@
/* MI Command Set - output generating routines.
- Copyright 2000, 2002 Free Software Foundation, Inc.
+ Copyright 2000, 2002, 2003 Free Software Foundation, Inc.
Contributed by Cygnus Solutions (a Red Hat company).
@@ -32,6 +32,7 @@ struct ui_out_data
int mi_version;
struct ui_file *buffer;
};
+typedef struct ui_out_data mi_out_data;
/* These are the MI output functions */
@@ -107,7 +108,7 @@ mi_table_begin (struct ui_out *uiout,
int nr_rows,
const char *tblid)
{
- struct ui_out_data *data = ui_out_data (uiout);
+ mi_out_data *data = ui_out_data (uiout);
mi_open (uiout, tblid, ui_out_type_tuple);
mi_field_int (uiout, -1/*fldno*/, -1/*width*/, -1/*alin*/,
"nr_rows", nr_rows);
@@ -121,7 +122,7 @@ mi_table_begin (struct ui_out *uiout,
void
mi_table_body (struct ui_out *uiout)
{
- struct ui_out_data *data = ui_out_data (uiout);
+ mi_out_data *data = ui_out_data (uiout);
if (data->suppress_output)
return;
/* close the table header line if there were any headers */
@@ -134,7 +135,7 @@ mi_table_body (struct ui_out *uiout)
void
mi_table_end (struct ui_out *uiout)
{
- struct ui_out_data *data = ui_out_data (uiout);
+ mi_out_data *data = ui_out_data (uiout);
data->suppress_output = 0;
mi_close (uiout, ui_out_type_list); /* body */
mi_close (uiout, ui_out_type_tuple);
@@ -147,7 +148,7 @@ mi_table_header (struct ui_out *uiout, int width, enum ui_align alignment,
const char *col_name,
const char *colhdr)
{
- struct ui_out_data *data = ui_out_data (uiout);
+ mi_out_data *data = ui_out_data (uiout);
if (data->suppress_output)
return;
mi_open (uiout, NULL, ui_out_type_tuple);
@@ -166,7 +167,7 @@ mi_begin (struct ui_out *uiout,
int level,
const char *id)
{
- struct ui_out_data *data = ui_out_data (uiout);
+ mi_out_data *data = ui_out_data (uiout);
if (data->suppress_output)
return;
mi_open (uiout, id, type);
@@ -179,7 +180,7 @@ mi_end (struct ui_out *uiout,
enum ui_out_type type,
int level)
{
- struct ui_out_data *data = ui_out_data (uiout);
+ mi_out_data *data = ui_out_data (uiout);
if (data->suppress_output)
return;
mi_close (uiout, type);
@@ -192,7 +193,7 @@ mi_field_int (struct ui_out *uiout, int fldno, int width,
enum ui_align alignment, const char *fldname, int value)
{
char buffer[20]; /* FIXME: how many chars long a %d can become? */
- struct ui_out_data *data = ui_out_data (uiout);
+ mi_out_data *data = ui_out_data (uiout);
if (data->suppress_output)
return;
@@ -206,7 +207,7 @@ void
mi_field_skip (struct ui_out *uiout, int fldno, int width,
enum ui_align alignment, const char *fldname)
{
- struct ui_out_data *data = ui_out_data (uiout);
+ mi_out_data *data = ui_out_data (uiout);
if (data->suppress_output)
return;
mi_field_string (uiout, fldno, width, alignment, fldname, "");
@@ -223,7 +224,7 @@ mi_field_string (struct ui_out *uiout,
const char *fldname,
const char *string)
{
- struct ui_out_data *data = ui_out_data (uiout);
+ mi_out_data *data = ui_out_data (uiout);
if (data->suppress_output)
return;
field_separator (uiout);
@@ -244,7 +245,7 @@ mi_field_fmt (struct ui_out *uiout, int fldno,
const char *format,
va_list args)
{
- struct ui_out_data *data = ui_out_data (uiout);
+ mi_out_data *data = ui_out_data (uiout);
if (data->suppress_output)
return;
field_separator (uiout);
@@ -282,7 +283,7 @@ mi_wrap_hint (struct ui_out *uiout, char *identstring)
void
mi_flush (struct ui_out *uiout)
{
- struct ui_out_data *data = ui_out_data (uiout);
+ mi_out_data *data = ui_out_data (uiout);
gdb_flush (data->buffer);
}
@@ -296,7 +297,7 @@ static void
out_field_fmt (struct ui_out *uiout, int fldno, char *fldname,
char *format,...)
{
- struct ui_out_data *data = ui_out_data (uiout);
+ mi_out_data *data = ui_out_data (uiout);
va_list args;
field_separator (uiout);
@@ -318,7 +319,7 @@ out_field_fmt (struct ui_out *uiout, int fldno, char *fldname,
static void
field_separator (struct ui_out *uiout)
{
- struct ui_out_data *data = ui_out_data (uiout);
+ mi_out_data *data = ui_out_data (uiout);
if (data->suppress_field_separator)
data->suppress_field_separator = 0;
else
@@ -330,7 +331,7 @@ mi_open (struct ui_out *uiout,
const char *name,
enum ui_out_type type)
{
- struct ui_out_data *data = ui_out_data (uiout);
+ mi_out_data *data = ui_out_data (uiout);
field_separator (uiout);
data->suppress_field_separator = 1;
if (name)
@@ -352,7 +353,7 @@ static void
mi_close (struct ui_out *uiout,
enum ui_out_type type)
{
- struct ui_out_data *data = ui_out_data (uiout);
+ mi_out_data *data = ui_out_data (uiout);
switch (type)
{
case ui_out_type_tuple:
@@ -372,7 +373,7 @@ mi_close (struct ui_out *uiout,
void
mi_out_buffered (struct ui_out *uiout, char *string)
{
- struct ui_out_data *data = ui_out_data (uiout);
+ mi_out_data *data = ui_out_data (uiout);
fprintf_unfiltered (data->buffer, "%s", string);
}
@@ -381,7 +382,7 @@ mi_out_buffered (struct ui_out *uiout, char *string)
void
mi_out_rewind (struct ui_out *uiout)
{
- struct ui_out_data *data = ui_out_data (uiout);
+ mi_out_data *data = ui_out_data (uiout);
ui_file_rewind (data->buffer);
}
@@ -397,7 +398,7 @@ void
mi_out_put (struct ui_out *uiout,
struct ui_file *stream)
{
- struct ui_out_data *data = ui_out_data (uiout);
+ mi_out_data *data = ui_out_data (uiout);
ui_file_put (data->buffer, do_write, stream);
ui_file_rewind (data->buffer);
}
@@ -407,7 +408,7 @@ mi_out_put (struct ui_out *uiout,
int
mi_version (struct ui_out *uiout)
{
- struct ui_out_data *data = ui_out_data (uiout);
+ mi_out_data *data = ui_out_data (uiout);
return data->mi_version;
}
@@ -417,7 +418,7 @@ struct ui_out *
mi_out_new (int mi_version)
{
int flags = 0;
- struct ui_out_data *data = XMALLOC (struct ui_out_data);
+ mi_out_data *data = XMALLOC (mi_out_data);
data->suppress_field_separator = 0;
data->suppress_output = 0;
data->mi_version = mi_version;
diff --git a/gdb/minsyms.c b/gdb/minsyms.c
index 6f6deeb..7739381 100644
--- a/gdb/minsyms.c
+++ b/gdb/minsyms.c
@@ -986,8 +986,14 @@ install_minimal_symbols (struct objfile *objfile)
for (i = 0; i < mcount; i++)
{
+ /* If a symbol's name starts with _Z and was successfully
+ demangled, then we can assume we've found a GNU v3 symbol.
+ For now we set the C++ ABI globally; if the user is
+ mixing ABIs then the user will need to "set cp-abi"
+ manually. */
const char *name = SYMBOL_LINKAGE_NAME (&objfile->msymbols[i]);
- if (name[0] == '_' && name[1] == 'Z')
+ if (name[0] == '_' && name[1] == 'Z'
+ && SYMBOL_DEMANGLED_NAME (&objfile->msymbols[i]) != NULL)
{
set_cp_abi_as_auto_default ("gnu-v3");
break;
diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c
index 7ade6a2..7956be49 100644
--- a/gdb/mips-tdep.c
+++ b/gdb/mips-tdep.c
@@ -25,6 +25,7 @@
#include "defs.h"
#include "gdb_string.h"
+#include "gdb_assert.h"
#include "frame.h"
#include "inferior.h"
#include "symtab.h"
@@ -361,23 +362,57 @@ static struct cmd_list_element *showmipscmdlist = NULL;
/* A set of original names, to be used when restoring back to generic
registers from a specific set. */
+static char *mips_generic_reg_names[] = MIPS_REGISTER_NAMES;
-char *mips_generic_reg_names[] = MIPS_REGISTER_NAMES;
-char **mips_processor_reg_names = mips_generic_reg_names;
+/* Integer registers 0 thru 31 are handled explicitly by
+ mips_register_name(). Processor specific registers 32 and above
+ are listed in the sets of register names assigned to
+ mips_processor_reg_names. */
+static char **mips_processor_reg_names = mips_generic_reg_names;
+/* Return the name of the register corresponding to REGNO. */
static const char *
-mips_register_name (int i)
-{
- return mips_processor_reg_names[i];
+mips_register_name (int regno)
+{
+ /* GPR names for all ABIs other than n32/n64. */
+ static char *mips_gpr_names[] = {
+ "zero", "at", "v0", "v1", "a0", "a1", "a2", "a3",
+ "t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7",
+ "s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7",
+ "t8", "t9", "k0", "k1", "gp", "sp", "s8", "ra",
+ };
+
+ /* GPR names for n32 and n64 ABIs. */
+ static char *mips_n32_n64_gpr_names[] = {
+ "zero", "at", "v0", "v1", "a0", "a1", "a2", "a3",
+ "a4", "a5", "a6", "a7", "t0", "t1", "t2", "t3",
+ "s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7",
+ "t8", "t9", "k0", "k1", "gp", "sp", "s8", "ra"
+ };
+
+ enum mips_abi abi = mips_abi (current_gdbarch);
+
+ /* The MIPS integer registers are always mapped from 0 to 31. The
+ names of the registers (which reflects the conventions regarding
+ register use) vary depending on the ABI. */
+ if (0 <= regno && regno < 32)
+ {
+ if (abi == MIPS_ABI_N32 || abi == MIPS_ABI_N64)
+ return mips_n32_n64_gpr_names[regno];
+ else
+ return mips_gpr_names[regno];
+ }
+ else if (32 <= regno && regno < NUM_REGS)
+ return mips_processor_reg_names[regno - 32];
+ else
+ internal_error (__FILE__, __LINE__,
+ "mips_register_name: bad register number %d", regno);
}
+
/* *INDENT-OFF* */
/* Names of IDT R3041 registers. */
char *mips_r3041_reg_names[] = {
- "zero", "at", "v0", "v1", "a0", "a1", "a2", "a3",
- "t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7",
- "s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7",
- "t8", "t9", "k0", "k1", "gp", "sp", "s8", "ra",
"sr", "lo", "hi", "bad", "cause","pc",
"f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7",
"f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15",
@@ -391,10 +426,6 @@ char *mips_r3041_reg_names[] = {
/* Names of IDT R3051 registers. */
char *mips_r3051_reg_names[] = {
- "zero", "at", "v0", "v1", "a0", "a1", "a2", "a3",
- "t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7",
- "s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7",
- "t8", "t9", "k0", "k1", "gp", "sp", "s8", "ra",
"sr", "lo", "hi", "bad", "cause","pc",
"f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7",
"f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15",
@@ -408,10 +439,6 @@ char *mips_r3051_reg_names[] = {
/* Names of IDT R3081 registers. */
char *mips_r3081_reg_names[] = {
- "zero", "at", "v0", "v1", "a0", "a1", "a2", "a3",
- "t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7",
- "s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7",
- "t8", "t9", "k0", "k1", "gp", "sp", "s8", "ra",
"sr", "lo", "hi", "bad", "cause","pc",
"f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7",
"f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15",
@@ -425,10 +452,6 @@ char *mips_r3081_reg_names[] = {
/* Names of LSI 33k registers. */
char *mips_lsi33k_reg_names[] = {
- "zero", "at", "v0", "v1", "a0", "a1", "a2", "a3",
- "t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7",
- "s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7",
- "t8", "t9", "k0", "k1", "gp", "sp", "s8", "ra",
"epc", "hi", "lo", "sr", "cause","badvaddr",
"dcic", "bpc", "bda", "", "", "", "", "",
"", "", "", "", "", "", "", "",
@@ -636,7 +659,7 @@ mips_register_virtual_type (int reg)
static CORE_ADDR
mips_read_sp (void)
{
- return ADDR_BITS_REMOVE (read_register (SP_REGNUM));
+ return read_signed_register (SP_REGNUM);
}
/* Should the upper word of 64-bit addresses be zeroed? */
@@ -1692,9 +1715,9 @@ mips_init_frame_pc_first (int fromleaf, struct frame_info *prev)
CORE_ADDR pc, tmp;
pc = ((fromleaf)
- ? SAVED_PC_AFTER_CALL (get_next_frame (prev))
+ ? DEPRECATED_SAVED_PC_AFTER_CALL (get_next_frame (prev))
: get_next_frame (prev)
- ? FRAME_SAVED_PC (get_next_frame (prev))
+ ? DEPRECATED_FRAME_SAVED_PC (get_next_frame (prev))
: read_pc ());
tmp = SKIP_TRAMPOLINE_CODE (pc);
return tmp ? tmp : pc;
@@ -1795,10 +1818,10 @@ heuristic_proc_start (CORE_ADDR pc)
if (start_pc < fence)
{
/* It's not clear to me why we reach this point when
- stop_soon_quietly, but with this test, at least we
+ stop_soon, but with this test, at least we
don't print out warnings for every child forked (eg, on
decstation). 22apr93 rich@cygnus.com. */
- if (!stop_soon_quietly)
+ if (stop_soon == NO_STOP_QUIETLY)
{
static int blurb_printed = 0;
@@ -2419,10 +2442,9 @@ static CORE_ADDR
get_frame_pointer (struct frame_info *frame,
mips_extra_func_info_t proc_desc)
{
- return ADDR_BITS_REMOVE (read_next_frame_reg (frame,
- PROC_FRAME_REG (proc_desc)) +
- PROC_FRAME_OFFSET (proc_desc) -
- PROC_FRAME_ADJUST (proc_desc));
+ return (read_next_frame_reg (frame, PROC_FRAME_REG (proc_desc))
+ + PROC_FRAME_OFFSET (proc_desc)
+ - PROC_FRAME_ADJUST (proc_desc));
}
static mips_extra_func_info_t cached_proc_desc;
@@ -2432,7 +2454,7 @@ mips_frame_chain (struct frame_info *frame)
{
mips_extra_func_info_t proc_desc;
CORE_ADDR tmp;
- CORE_ADDR saved_pc = FRAME_SAVED_PC (frame);
+ CORE_ADDR saved_pc = DEPRECATED_FRAME_SAVED_PC (frame);
if (saved_pc == 0 || inside_entry_file (saved_pc))
return 0;
@@ -3725,117 +3747,12 @@ mips_push_return_address (CORE_ADDR pc, CORE_ADDR sp)
}
static void
-mips_push_register (CORE_ADDR * sp, int regno)
-{
- char *buffer = alloca (MAX_REGISTER_RAW_SIZE);
- int regsize;
- int offset;
- if (MIPS_SAVED_REGSIZE < REGISTER_RAW_SIZE (regno))
- {
- regsize = MIPS_SAVED_REGSIZE;
- offset = (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG
- ? REGISTER_RAW_SIZE (regno) - MIPS_SAVED_REGSIZE
- : 0);
- }
- else
- {
- regsize = REGISTER_RAW_SIZE (regno);
- offset = 0;
- }
- *sp -= regsize;
- deprecated_read_register_gen (regno, buffer);
- write_memory (*sp, buffer + offset, regsize);
-}
-
-/* MASK(i,j) == (1<<i) + (1<<(i+1)) + ... + (1<<j)). Assume i<=j<(MIPS_NUMREGS-1). */
-#define MASK(i,j) (((1 << ((j)+1))-1) ^ ((1 << (i))-1))
-
-static void
-mips_push_dummy_frame (void)
-{
- int ireg;
- struct linked_proc_info *link = (struct linked_proc_info *)
- xmalloc (sizeof (struct linked_proc_info));
- mips_extra_func_info_t proc_desc = &link->info;
- CORE_ADDR sp = ADDR_BITS_REMOVE (read_signed_register (SP_REGNUM));
- CORE_ADDR old_sp = sp;
- link->next = linked_proc_desc_table;
- linked_proc_desc_table = link;
-
-/* FIXME! are these correct ? */
-#define PUSH_FP_REGNUM 16 /* must be a register preserved across calls */
-#define GEN_REG_SAVE_MASK MASK(1,16)|MASK(24,28)|(1<<(MIPS_NUMREGS-1))
-#define FLOAT_REG_SAVE_MASK MASK(0,19)
-#define FLOAT_SINGLE_REG_SAVE_MASK \
- ((1<<18)|(1<<16)|(1<<14)|(1<<12)|(1<<10)|(1<<8)|(1<<6)|(1<<4)|(1<<2)|(1<<0))
- /*
- * The registers we must save are all those not preserved across
- * procedure calls. Dest_Reg (see tm-mips.h) must also be saved.
- * In addition, we must save the PC, PUSH_FP_REGNUM, MMLO/-HI
- * and FP Control/Status registers.
- *
- *
- * Dummy frame layout:
- * (high memory)
- * Saved PC
- * Saved MMHI, MMLO, FPC_CSR
- * Saved R31
- * Saved R28
- * ...
- * Saved R1
- * Saved D18 (i.e. F19, F18)
- * ...
- * Saved D0 (i.e. F1, F0)
- * Argument build area and stack arguments written via mips_push_arguments
- * (low memory)
- */
-
- /* Save special registers (PC, MMHI, MMLO, FPC_CSR) */
- PROC_FRAME_REG (proc_desc) = PUSH_FP_REGNUM;
- PROC_FRAME_OFFSET (proc_desc) = 0;
- PROC_FRAME_ADJUST (proc_desc) = 0;
- mips_push_register (&sp, PC_REGNUM);
- mips_push_register (&sp, HI_REGNUM);
- mips_push_register (&sp, LO_REGNUM);
- mips_push_register (&sp, MIPS_FPU_TYPE == MIPS_FPU_NONE ? 0 : FCRCS_REGNUM);
-
- /* Save general CPU registers */
- PROC_REG_MASK (proc_desc) = GEN_REG_SAVE_MASK;
- /* PROC_REG_OFFSET is the offset of the first saved register from FP. */
- PROC_REG_OFFSET (proc_desc) = sp - old_sp - MIPS_SAVED_REGSIZE;
- for (ireg = 32; --ireg >= 0;)
- if (PROC_REG_MASK (proc_desc) & (1 << ireg))
- mips_push_register (&sp, ireg);
-
- /* Save floating point registers starting with high order word */
- PROC_FREG_MASK (proc_desc) =
- MIPS_FPU_TYPE == MIPS_FPU_DOUBLE ? FLOAT_REG_SAVE_MASK
- : MIPS_FPU_TYPE == MIPS_FPU_SINGLE ? FLOAT_SINGLE_REG_SAVE_MASK : 0;
- /* PROC_FREG_OFFSET is the offset of the first saved *double* register
- from FP. */
- PROC_FREG_OFFSET (proc_desc) = sp - old_sp - 8;
- for (ireg = 32; --ireg >= 0;)
- if (PROC_FREG_MASK (proc_desc) & (1 << ireg))
- mips_push_register (&sp, ireg + FP0_REGNUM);
-
- /* Update the frame pointer for the call dummy and the stack pointer.
- Set the procedure's starting and ending addresses to point to the
- call dummy address at the entry point. */
- write_register (PUSH_FP_REGNUM, old_sp);
- write_register (SP_REGNUM, sp);
- PROC_LOW_ADDR (proc_desc) = CALL_DUMMY_ADDRESS ();
- PROC_HIGH_ADDR (proc_desc) = CALL_DUMMY_ADDRESS () + 4;
- SET_PROC_DESC_IS_DUMMY (proc_desc);
- PROC_PC_REG (proc_desc) = RA_REGNUM;
-}
-
-static void
mips_pop_frame (void)
{
register int regnum;
struct frame_info *frame = get_current_frame ();
CORE_ADDR new_sp = get_frame_base (frame);
- mips_extra_func_info_t proc_desc = get_frame_extra_info (frame)->proc_desc;
+ mips_extra_func_info_t proc_desc;
if (DEPRECATED_PC_IN_CALL_DUMMY (get_frame_pc (frame), 0, 0))
{
@@ -3844,7 +3761,8 @@ mips_pop_frame (void)
return;
}
- write_register (PC_REGNUM, FRAME_SAVED_PC (frame));
+ proc_desc = get_frame_extra_info (frame)->proc_desc;
+ write_register (PC_REGNUM, DEPRECATED_FRAME_SAVED_PC (frame));
if (get_frame_saved_regs (frame) == NULL)
DEPRECATED_FRAME_INIT_SAVED_REGS (frame);
for (regnum = 0; regnum < NUM_REGS; regnum++)
@@ -4026,154 +3944,126 @@ mips_read_fp_register_double (int regno, char *rare_buffer)
}
static void
-mips_print_register (int regnum, int all)
-{
- char *raw_buffer = alloca (MAX_REGISTER_RAW_SIZE);
-
- /* Get the data in raw format. */
- if (!frame_register_read (deprecated_selected_frame, regnum, raw_buffer))
- {
- printf_filtered ("%s: [Invalid]", REGISTER_NAME (regnum));
- return;
- }
-
- /* If we have a actual 32-bit floating point register (or we are in
- 32-bit compatibility mode), and the register is even-numbered,
- also print it as a double (spanning two registers). */
- if (TYPE_CODE (REGISTER_VIRTUAL_TYPE (regnum)) == TYPE_CODE_FLT
- && (REGISTER_RAW_SIZE (regnum) == 4
- || mips2_fp_compat ())
- && !((regnum - FP0_REGNUM) & 1))
- {
- char *dbuffer = alloca (2 * MAX_REGISTER_RAW_SIZE);
-
- mips_read_fp_register_double (regnum, dbuffer);
-
- printf_filtered ("(d%d: ", regnum - FP0_REGNUM);
- val_print (mips_double_register_type (), dbuffer, 0, 0,
- gdb_stdout, 0, 1, 0, Val_pretty_default);
- printf_filtered ("); ");
- }
- fputs_filtered (REGISTER_NAME (regnum), gdb_stdout);
-
- /* The problem with printing numeric register names (r26, etc.) is that
- the user can't use them on input. Probably the best solution is to
- fix it so that either the numeric or the funky (a2, etc.) names
- are accepted on input. */
- if (regnum < MIPS_NUMREGS)
- printf_filtered ("(r%d): ", regnum);
- else
- printf_filtered (": ");
-
- /* If virtual format is floating, print it that way. */
- if (TYPE_CODE (REGISTER_VIRTUAL_TYPE (regnum)) == TYPE_CODE_FLT)
- if (REGISTER_RAW_SIZE (regnum) == 8 && !mips2_fp_compat ())
- {
- /* We have a meaningful 64-bit value in this register. Show
- it as a 32-bit float and a 64-bit double. */
- int offset = 4 * (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG);
-
- printf_filtered (" (float) ");
- val_print (mips_float_register_type (), raw_buffer + offset, 0, 0,
- gdb_stdout, 0, 1, 0, Val_pretty_default);
- printf_filtered (", (double) ");
- val_print (mips_double_register_type (), raw_buffer, 0, 0,
- gdb_stdout, 0, 1, 0, Val_pretty_default);
- }
- else
- val_print (REGISTER_VIRTUAL_TYPE (regnum), raw_buffer, 0, 0,
- gdb_stdout, 0, 1, 0, Val_pretty_default);
- /* Else print as integer in hex. */
- else
- {
- int offset;
-
- if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
- offset = REGISTER_RAW_SIZE (regnum) - REGISTER_VIRTUAL_SIZE (regnum);
- else
- offset = 0;
-
- print_scalar_formatted (raw_buffer + offset,
- REGISTER_VIRTUAL_TYPE (regnum),
- 'x', 0, gdb_stdout);
- }
-}
-
-/* Replacement for generic do_registers_info.
- Print regs in pretty columns. */
-
-static int
-do_fp_register_row (int regnum)
+mips_print_fp_register (int regnum)
{ /* do values for FP (float) regs */
char *raw_buffer;
double doub, flt1, flt2; /* doubles extracted from raw hex data */
- int inv1, inv2, inv3;
+ int inv1, inv2, namelen;
raw_buffer = (char *) alloca (2 * REGISTER_RAW_SIZE (FP0_REGNUM));
+ printf_filtered ("%s:", REGISTER_NAME (regnum));
+ printf_filtered ("%*s", 4 - (int) strlen (REGISTER_NAME (regnum)), "");
+
if (REGISTER_RAW_SIZE (regnum) == 4 || mips2_fp_compat ())
{
- /* 4-byte registers: we can fit two registers per row. */
- /* Also print every pair of 4-byte regs as an 8-byte double. */
+ /* 4-byte registers: Print hex and floating. Also print even
+ numbered registers as doubles. */
mips_read_fp_register_single (regnum, raw_buffer);
flt1 = unpack_double (mips_float_register_type (), raw_buffer, &inv1);
- mips_read_fp_register_single (regnum + 1, raw_buffer);
- flt2 = unpack_double (mips_float_register_type (), raw_buffer, &inv2);
-
- mips_read_fp_register_double (regnum, raw_buffer);
- doub = unpack_double (mips_double_register_type (), raw_buffer, &inv3);
+ print_scalar_formatted (raw_buffer, builtin_type_uint32, 'x', 'w',
+ gdb_stdout);
- printf_filtered (" %-5s", REGISTER_NAME (regnum));
+ printf_filtered (" flt: ");
if (inv1)
- printf_filtered (": <invalid float>");
+ printf_filtered (" <invalid float> ");
else
printf_filtered ("%-17.9g", flt1);
- printf_filtered (" %-5s", REGISTER_NAME (regnum + 1));
- if (inv2)
- printf_filtered (": <invalid float>");
- else
- printf_filtered ("%-17.9g", flt2);
-
- printf_filtered (" dbl: ");
- if (inv3)
- printf_filtered ("<invalid double>");
- else
- printf_filtered ("%-24.17g", doub);
- printf_filtered ("\n");
+ if (regnum % 2 == 0)
+ {
+ mips_read_fp_register_double (regnum, raw_buffer);
+ doub = unpack_double (mips_double_register_type (), raw_buffer,
+ &inv2);
- /* may want to do hex display here (future enhancement) */
- regnum += 2;
+ printf_filtered (" dbl: ");
+ if (inv2)
+ printf_filtered ("<invalid double>");
+ else
+ printf_filtered ("%-24.17g", doub);
+ }
}
else
{
- /* Eight byte registers: print each one as float AND as double. */
+ /* Eight byte registers: print each one as hex, float and double. */
mips_read_fp_register_single (regnum, raw_buffer);
- flt1 = unpack_double (mips_double_register_type (), raw_buffer, &inv1);
+ flt1 = unpack_double (mips_float_register_type (), raw_buffer, &inv1);
mips_read_fp_register_double (regnum, raw_buffer);
- doub = unpack_double (mips_double_register_type (), raw_buffer, &inv3);
+ doub = unpack_double (mips_double_register_type (), raw_buffer, &inv2);
- printf_filtered (" %-5s: ", REGISTER_NAME (regnum));
+
+ print_scalar_formatted (raw_buffer, builtin_type_uint64, 'x', 'g',
+ gdb_stdout);
+
+ printf_filtered (" flt: ");
if (inv1)
printf_filtered ("<invalid float>");
else
- printf_filtered ("flt: %-17.9g", flt1);
+ printf_filtered ("%-17.9g", flt1);
printf_filtered (" dbl: ");
- if (inv3)
+ if (inv2)
printf_filtered ("<invalid double>");
else
printf_filtered ("%-24.17g", doub);
+ }
+}
- printf_filtered ("\n");
- /* may want to do hex display here (future enhancement) */
- regnum++;
+static void
+mips_print_register (int regnum, int all)
+{
+ char *raw_buffer = alloca (MAX_REGISTER_RAW_SIZE);
+ int offset;
+
+ if (TYPE_CODE (REGISTER_VIRTUAL_TYPE (regnum)) == TYPE_CODE_FLT)
+ {
+ mips_print_fp_register (regnum);
+ return;
}
- return regnum;
+
+ /* Get the data in raw format. */
+ if (!frame_register_read (deprecated_selected_frame, regnum, raw_buffer))
+ {
+ printf_filtered ("%s: [Invalid]", REGISTER_NAME (regnum));
+ return;
+ }
+
+ fputs_filtered (REGISTER_NAME (regnum), gdb_stdout);
+
+ /* The problem with printing numeric register names (r26, etc.) is that
+ the user can't use them on input. Probably the best solution is to
+ fix it so that either the numeric or the funky (a2, etc.) names
+ are accepted on input. */
+ if (regnum < MIPS_NUMREGS)
+ printf_filtered ("(r%d): ", regnum);
+ else
+ printf_filtered (": ");
+
+ if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
+ offset = REGISTER_RAW_SIZE (regnum) - REGISTER_VIRTUAL_SIZE (regnum);
+ else
+ offset = 0;
+
+ print_scalar_formatted (raw_buffer + offset,
+ REGISTER_VIRTUAL_TYPE (regnum),
+ 'x', 0, gdb_stdout);
}
+/* Replacement for generic do_registers_info.
+ Print regs in pretty columns. */
+
+static int
+do_fp_register_row (int regnum)
+{
+ printf_filtered (" ");
+ mips_print_fp_register (regnum);
+ printf_filtered ("\n");
+ return regnum + 1;
+}
+
+
/* Print a row's worth of GP (int) registers, with name labels above */
static int
@@ -5546,23 +5436,45 @@ mips_saved_pc_after_call (struct frame_info *frame)
static int
mips_stab_reg_to_regnum (int num)
{
- if (num < 32)
+ if (num >= 0 && num < 32)
return num;
- else
+ else if (num >= 38 && num < 70)
return num + FP0_REGNUM - 38;
+ else if (num == 70)
+ return HI_REGNUM;
+ else if (num == 71)
+ return LO_REGNUM;
+ else
+ {
+ /* This will hopefully (eventually) provoke a warning. Should
+ we be calling complaint() here? */
+ return NUM_REGS + NUM_PSEUDO_REGS;
+ }
}
-/* Convert a ecoff register number to a gdb REGNUM */
+
+/* Convert a dwarf, dwarf2, or ecoff register number to a gdb REGNUM */
static int
-mips_ecoff_reg_to_regnum (int num)
+mips_dwarf_dwarf2_ecoff_reg_to_regnum (int num)
{
- if (num < 32)
+ if (num >= 0 && num < 32)
return num;
- else
+ else if (num >= 32 && num < 64)
return num + FP0_REGNUM - 32;
+ else if (num == 64)
+ return HI_REGNUM;
+ else if (num == 65)
+ return LO_REGNUM;
+ else
+ {
+ /* This will hopefully (eventually) provoke a warning. Should
+ we be calling complaint() here? */
+ return NUM_REGS + NUM_PSEUDO_REGS;
+ }
}
+
/* Convert an integer into an address. By first converting the value
into a pointer and then extracting it signed, the address is
guarenteed to be correctly sign extended. */
@@ -5714,6 +5626,34 @@ mips_gdbarch_init (struct gdbarch_info info,
if (wanted_abi != MIPS_ABI_UNKNOWN)
mips_abi = wanted_abi;
+ /* We have to set tm_print_insn_info before looking for a
+ pre-existing architecture, otherwise we may return before we get
+ a chance to set it up. */
+ if (mips_abi == MIPS_ABI_N32 || mips_abi == MIPS_ABI_N64)
+ {
+ /* Set up the disassembler info, so that we get the right
+ register names from libopcodes. */
+ if (mips_abi == MIPS_ABI_N32)
+ tm_print_insn_info.disassembler_options = "gpr-names=n32";
+ else
+ tm_print_insn_info.disassembler_options = "gpr-names=64";
+ tm_print_insn_info.flavour = bfd_target_elf_flavour;
+ tm_print_insn_info.arch = bfd_arch_mips;
+ if (info.bfd_arch_info != NULL
+ && info.bfd_arch_info->arch == bfd_arch_mips
+ && info.bfd_arch_info->mach)
+ tm_print_insn_info.mach = info.bfd_arch_info->mach;
+ else
+ tm_print_insn_info.mach = bfd_mach_mips8000;
+ }
+ else
+ /* This string is not recognized explicitly by the disassembler,
+ but it tells the disassembler to not try to guess the ABI from
+ the bfd elf headers, such that, if the user overrides the ABI
+ of a program linked as NewABI, the disassembly will follow the
+ register naming conventions specified by the user. */
+ tm_print_insn_info.disassembler_options = "gpr-names=32";
+
if (gdbarch_debug)
{
fprintf_unfiltered (gdb_stdlog,
@@ -5769,7 +5709,7 @@ mips_gdbarch_init (struct gdbarch_info info,
switch (mips_abi)
{
case MIPS_ABI_O32:
- set_gdbarch_push_arguments (gdbarch, mips_o32_push_arguments);
+ set_gdbarch_deprecated_push_arguments (gdbarch, mips_o32_push_arguments);
set_gdbarch_deprecated_store_return_value (gdbarch, mips_o32_store_return_value);
set_gdbarch_extract_return_value (gdbarch, mips_o32_extract_return_value);
tdep->mips_default_saved_regsize = 4;
@@ -5788,7 +5728,7 @@ mips_gdbarch_init (struct gdbarch_info info,
mips_o32_use_struct_convention);
break;
case MIPS_ABI_O64:
- set_gdbarch_push_arguments (gdbarch, mips_o64_push_arguments);
+ set_gdbarch_deprecated_push_arguments (gdbarch, mips_o64_push_arguments);
set_gdbarch_deprecated_store_return_value (gdbarch, mips_o64_store_return_value);
set_gdbarch_deprecated_extract_return_value (gdbarch, mips_o64_extract_return_value);
tdep->mips_default_saved_regsize = 8;
@@ -5807,7 +5747,7 @@ mips_gdbarch_init (struct gdbarch_info info,
mips_o32_use_struct_convention);
break;
case MIPS_ABI_EABI32:
- set_gdbarch_push_arguments (gdbarch, mips_eabi_push_arguments);
+ set_gdbarch_deprecated_push_arguments (gdbarch, mips_eabi_push_arguments);
set_gdbarch_deprecated_store_return_value (gdbarch, mips_eabi_store_return_value);
set_gdbarch_deprecated_extract_return_value (gdbarch, mips_eabi_extract_return_value);
tdep->mips_default_saved_regsize = 4;
@@ -5826,7 +5766,7 @@ mips_gdbarch_init (struct gdbarch_info info,
mips_eabi_use_struct_convention);
break;
case MIPS_ABI_EABI64:
- set_gdbarch_push_arguments (gdbarch, mips_eabi_push_arguments);
+ set_gdbarch_deprecated_push_arguments (gdbarch, mips_eabi_push_arguments);
set_gdbarch_deprecated_store_return_value (gdbarch, mips_eabi_store_return_value);
set_gdbarch_deprecated_extract_return_value (gdbarch, mips_eabi_extract_return_value);
tdep->mips_default_saved_regsize = 8;
@@ -5845,7 +5785,7 @@ mips_gdbarch_init (struct gdbarch_info info,
mips_eabi_use_struct_convention);
break;
case MIPS_ABI_N32:
- set_gdbarch_push_arguments (gdbarch, mips_n32n64_push_arguments);
+ set_gdbarch_deprecated_push_arguments (gdbarch, mips_n32n64_push_arguments);
set_gdbarch_deprecated_store_return_value (gdbarch, mips_n32n64_store_return_value);
set_gdbarch_extract_return_value (gdbarch, mips_n32n64_extract_return_value);
tdep->mips_default_saved_regsize = 8;
@@ -5858,25 +5798,13 @@ mips_gdbarch_init (struct gdbarch_info info,
set_gdbarch_long_bit (gdbarch, 32);
set_gdbarch_ptr_bit (gdbarch, 32);
set_gdbarch_long_long_bit (gdbarch, 64);
-
- /* Set up the disassembler info, so that we get the right
- register names from libopcodes. */
- tm_print_insn_info.flavour = bfd_target_elf_flavour;
- tm_print_insn_info.arch = bfd_arch_mips;
- if (info.bfd_arch_info != NULL
- && info.bfd_arch_info->arch == bfd_arch_mips
- && info.bfd_arch_info->mach)
- tm_print_insn_info.mach = info.bfd_arch_info->mach;
- else
- tm_print_insn_info.mach = bfd_mach_mips8000;
-
set_gdbarch_use_struct_convention (gdbarch,
mips_n32n64_use_struct_convention);
set_gdbarch_reg_struct_has_addr (gdbarch,
mips_n32n64_reg_struct_has_addr);
break;
case MIPS_ABI_N64:
- set_gdbarch_push_arguments (gdbarch, mips_n32n64_push_arguments);
+ set_gdbarch_deprecated_push_arguments (gdbarch, mips_n32n64_push_arguments);
set_gdbarch_deprecated_store_return_value (gdbarch, mips_n32n64_store_return_value);
set_gdbarch_extract_return_value (gdbarch, mips_n32n64_extract_return_value);
tdep->mips_default_saved_regsize = 8;
@@ -5889,18 +5817,6 @@ mips_gdbarch_init (struct gdbarch_info info,
set_gdbarch_long_bit (gdbarch, 64);
set_gdbarch_ptr_bit (gdbarch, 64);
set_gdbarch_long_long_bit (gdbarch, 64);
-
- /* Set up the disassembler info, so that we get the right
- register names from libopcodes. */
- tm_print_insn_info.flavour = bfd_target_elf_flavour;
- tm_print_insn_info.arch = bfd_arch_mips;
- if (info.bfd_arch_info != NULL
- && info.bfd_arch_info->arch == bfd_arch_mips
- && info.bfd_arch_info->mach)
- tm_print_insn_info.mach = info.bfd_arch_info->mach;
- else
- tm_print_insn_info.mach = bfd_mach_mips8000;
-
set_gdbarch_use_struct_convention (gdbarch,
mips_n32n64_use_struct_convention);
set_gdbarch_reg_struct_has_addr (gdbarch,
@@ -5966,7 +5882,7 @@ mips_gdbarch_init (struct gdbarch_info info,
set_gdbarch_write_pc (gdbarch, generic_target_write_pc);
set_gdbarch_read_fp (gdbarch, mips_read_sp); /* Draft FRAME base. */
set_gdbarch_read_sp (gdbarch, mips_read_sp);
- set_gdbarch_write_sp (gdbarch, generic_target_write_sp);
+ set_gdbarch_deprecated_dummy_write_sp (gdbarch, generic_target_write_sp);
/* Add/remove bits from an address. The MIPS needs be careful to
ensure that all 32 bit addresses are sign extended to 64 bits. */
@@ -5979,7 +5895,9 @@ mips_gdbarch_init (struct gdbarch_info info,
/* Map debug register numbers onto internal register numbers. */
set_gdbarch_stab_reg_to_regnum (gdbarch, mips_stab_reg_to_regnum);
- set_gdbarch_ecoff_reg_to_regnum (gdbarch, mips_ecoff_reg_to_regnum);
+ set_gdbarch_ecoff_reg_to_regnum (gdbarch, mips_dwarf_dwarf2_ecoff_reg_to_regnum);
+ set_gdbarch_dwarf_reg_to_regnum (gdbarch, mips_dwarf_dwarf2_ecoff_reg_to_regnum);
+ set_gdbarch_dwarf2_reg_to_regnum (gdbarch, mips_dwarf_dwarf2_ecoff_reg_to_regnum);
/* Initialize a frame */
set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, mips_frame_init_saved_regs);
@@ -5987,19 +5905,13 @@ mips_gdbarch_init (struct gdbarch_info info,
/* MIPS version of CALL_DUMMY */
- set_gdbarch_call_dummy_p (gdbarch, 1);
- set_gdbarch_call_dummy_stack_adjust_p (gdbarch, 0);
set_gdbarch_call_dummy_address (gdbarch, mips_call_dummy_address);
- set_gdbarch_push_return_address (gdbarch, mips_push_return_address);
- set_gdbarch_pop_frame (gdbarch, mips_pop_frame);
- set_gdbarch_call_dummy_start_offset (gdbarch, 0);
- set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 1);
- set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 0);
- set_gdbarch_call_dummy_length (gdbarch, 0);
+ set_gdbarch_deprecated_push_return_address (gdbarch, mips_push_return_address);
+ set_gdbarch_deprecated_pop_frame (gdbarch, mips_pop_frame);
set_gdbarch_fix_call_dummy (gdbarch, mips_fix_call_dummy);
set_gdbarch_call_dummy_words (gdbarch, mips_call_dummy_words);
set_gdbarch_sizeof_call_dummy_words (gdbarch, sizeof (mips_call_dummy_words));
- set_gdbarch_push_return_address (gdbarch, mips_push_return_address);
+ set_gdbarch_deprecated_push_return_address (gdbarch, mips_push_return_address);
set_gdbarch_frame_align (gdbarch, mips_frame_align);
set_gdbarch_save_dummy_frame_tos (gdbarch, generic_save_dummy_frame_tos);
set_gdbarch_register_convertible (gdbarch, mips_register_convertible);
@@ -6008,21 +5920,21 @@ mips_gdbarch_init (struct gdbarch_info info,
set_gdbarch_register_convert_to_raw (gdbarch,
mips_register_convert_to_raw);
- set_gdbarch_frame_chain (gdbarch, mips_frame_chain);
+ set_gdbarch_deprecated_frame_chain (gdbarch, mips_frame_chain);
set_gdbarch_frameless_function_invocation (gdbarch,
generic_frameless_function_invocation_not);
- set_gdbarch_frame_saved_pc (gdbarch, mips_frame_saved_pc);
+ set_gdbarch_deprecated_frame_saved_pc (gdbarch, mips_frame_saved_pc);
set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown);
set_gdbarch_frame_args_skip (gdbarch, 0);
- set_gdbarch_get_saved_register (gdbarch, mips_get_saved_register);
+ set_gdbarch_deprecated_get_saved_register (gdbarch, mips_get_saved_register);
set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
set_gdbarch_breakpoint_from_pc (gdbarch, mips_breakpoint_from_pc);
set_gdbarch_decr_pc_after_break (gdbarch, 0);
set_gdbarch_skip_prologue (gdbarch, mips_skip_prologue);
- set_gdbarch_saved_pc_after_call (gdbarch, mips_saved_pc_after_call);
+ set_gdbarch_deprecated_saved_pc_after_call (gdbarch, mips_saved_pc_after_call);
set_gdbarch_pointer_to_address (gdbarch, signed_pointer_to_address);
set_gdbarch_address_to_pointer (gdbarch, address_to_signed_pointer);
@@ -6041,7 +5953,7 @@ mips_gdbarch_init (struct gdbarch_info info,
/* Hook in OS ABI-specific overrides, if they have been registered. */
gdbarch_init_osabi (info, gdbarch);
- set_gdbarch_store_struct_return (gdbarch, mips_store_struct_return);
+ set_gdbarch_deprecated_store_struct_return (gdbarch, mips_store_struct_return);
set_gdbarch_extract_struct_value_address (gdbarch,
mips_extract_struct_value_address);
@@ -6222,9 +6134,6 @@ mips_dump_tdep (struct gdbarch *current_gdbarch, struct ui_file *file)
"mips_dump_tdep: GDB_TARGET_IS_MIPS64 = %d\n",
GDB_TARGET_IS_MIPS64);
fprintf_unfiltered (file,
- "mips_dump_tdep: GEN_REG_SAVE_MASK = %d\n",
- GEN_REG_SAVE_MASK);
- fprintf_unfiltered (file,
"mips_dump_tdep: HAVE_NONSTEPPABLE_WATCHPOINT # %s\n",
XSTRING (HAVE_NONSTEPPABLE_WATCHPOINT));
fprintf_unfiltered (file,
@@ -6338,9 +6247,6 @@ mips_dump_tdep (struct gdbarch *current_gdbarch, struct ui_file *file)
"mips_dump_tdep: PS_REGNUM = %d\n",
PS_REGNUM);
fprintf_unfiltered (file,
- "mips_dump_tdep: PUSH_FP_REGNUM = %d\n",
- PUSH_FP_REGNUM);
- fprintf_unfiltered (file,
"mips_dump_tdep: RA_REGNUM = %d\n",
RA_REGNUM);
fprintf_unfiltered (file,
diff --git a/gdb/mips-tdep.h b/gdb/mips-tdep.h
index 92202e2..8e19bcd 100644
--- a/gdb/mips-tdep.h
+++ b/gdb/mips-tdep.h
@@ -22,6 +22,8 @@
#ifndef MIPS_TDEP_H
#define MIPS_TDEP_H
+struct gdbarch;
+
/* All the possible MIPS ABIs. */
enum mips_abi
{
diff --git a/gdb/mipsm3-nat.c b/gdb/mipsm3-nat.c
index 22f947f..f1fd859 100644
--- a/gdb/mipsm3-nat.c
+++ b/gdb/mipsm3-nat.c
@@ -1,386 +1,386 @@
-/* Definitions to make GDB run on a mips box under Mach 3.0
- Copyright 1992, 1993, 1998, 2000, 2001 Free Software Foundation, Inc.
-
- This file is part of GDB.
-
- 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.
-
- 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.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-
-/* Mach specific routines for little endian mips (e.g. pmax)
- * running Mach 3.0
- *
- * Author: Jukka Virtanen <jtv@hut.fi>
- */
-
-#include "defs.h"
-#include "inferior.h"
-#include "regcache.h"
-
-#include <stdio.h>
-
-#include <mach.h>
-#include <mach/message.h>
-#include <mach/exception.h>
-#include <mach_error.h>
-
-/* Find offsets to thread states at compile time.
- * If your compiler does not grok this, check the hand coded
- * offsets and use them.
- */
-
-#if 1
-
-#define REG_OFFSET(reg) (int)(&((struct mips_thread_state *)0)->reg)
-#define CREG_OFFSET(reg) (int)(&((struct mips_float_state *)0)->reg)
-#define EREG_OFFSET(reg) (int)(&((struct mips_exc_state *)0)->reg)
-
-/* at reg_offset[i] is the offset to the mips_thread_state
- * location where the gdb registers[i] is stored.
- *
- * -1 means mach does not save it anywhere.
- */
-static int reg_offset[] =
-{
- /* zero at v0 v1 */
- -1, REG_OFFSET (r1), REG_OFFSET (r2), REG_OFFSET (r3),
-
- /* a0 a1 a2 a3 */
- REG_OFFSET (r4), REG_OFFSET (r5), REG_OFFSET (r6), REG_OFFSET (r7),
-
- /* t0 t1 t2 t3 */
- REG_OFFSET (r8), REG_OFFSET (r9), REG_OFFSET (r10), REG_OFFSET (r11),
-
- /* t4 t5 t6 t7 */
- REG_OFFSET (r12), REG_OFFSET (r13), REG_OFFSET (r14), REG_OFFSET (r15),
-
- /* s0 s1 s2 s3 */
- REG_OFFSET (r16), REG_OFFSET (r17), REG_OFFSET (r18), REG_OFFSET (r19),
-
- /* s4 s5 s6 s7 */
- REG_OFFSET (r20), REG_OFFSET (r21), REG_OFFSET (r22), REG_OFFSET (r23),
-
- /* t8 t9 k0 k1 */
- REG_OFFSET (r24), REG_OFFSET (r25), REG_OFFSET (r26), REG_OFFSET (r27),
-
- /* gp sp s8(30) == fp(72) ra */
- REG_OFFSET (r28), REG_OFFSET (r29), REG_OFFSET (r30), REG_OFFSET (r31),
-
- /* sr(32) PS_REGNUM */
- EREG_OFFSET (coproc_state),
-
- /* lo(33) hi(34) */
- REG_OFFSET (mdlo), REG_OFFSET (mdhi),
-
- /* bad(35) cause(36) pc(37) */
- EREG_OFFSET (address), EREG_OFFSET (cause), REG_OFFSET (pc),
-
- /* f0(38) f1(39) f2(40) f3(41) */
- CREG_OFFSET (r0), CREG_OFFSET (r1), CREG_OFFSET (r2), CREG_OFFSET (r3),
- CREG_OFFSET (r4), CREG_OFFSET (r5), CREG_OFFSET (r6), CREG_OFFSET (r7),
- CREG_OFFSET (r8), CREG_OFFSET (r9), CREG_OFFSET (r10), CREG_OFFSET (r11),
- CREG_OFFSET (r12), CREG_OFFSET (r13), CREG_OFFSET (r14), CREG_OFFSET (r15),
- CREG_OFFSET (r16), CREG_OFFSET (r17), CREG_OFFSET (r18), CREG_OFFSET (r19),
- CREG_OFFSET (r20), CREG_OFFSET (r21), CREG_OFFSET (r22), CREG_OFFSET (r23),
- CREG_OFFSET (r24), CREG_OFFSET (r25), CREG_OFFSET (r26), CREG_OFFSET (r27),
- CREG_OFFSET (r28), CREG_OFFSET (r29), CREG_OFFSET (r30), CREG_OFFSET (r31),
-
- /* fsr(70) fir(71) fp(72) == s8(30) */
- CREG_OFFSET (csr), CREG_OFFSET (esr), REG_OFFSET (r30)
-};
-#else
-/* If the compiler does not grok the above defines */
-static int reg_offset[] =
-{
-/* mach_thread_state offsets: */
- -1, 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56,
- 60, 64, 68, 72, 76, 80, 84, 88, 92, 96, 100, 104, 108, 112, 116, 120,
-/*sr, lo, hi,addr,cause,pc */
- 8, 124, 128, 4, 0, 132,
-/* mach_float_state offsets: */
- 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60,
- 64, 68, 72, 76, 80, 84, 88, 92, 96, 100, 104, 108, 112, 116, 120, 124,
-/*fsr,fir */
- 128, 132,
-/* FP_REGNUM pseudo maps to s8==r30 in mach_thread_state */
- 116
-};
-#endif
-
-/* Fetch COUNT contiguous registers from thread STATE starting from REGNUM
- * Caller knows that the regs handled in one transaction are of same size.
- */
-#define FETCH_REGS(state, regnum, count) \
- memcpy (&deprecated_registers[REGISTER_BYTE (regnum)], \
- (char *)state+reg_offset[ regnum ], \
- count*REGISTER_SIZE)
-
-/* Store COUNT contiguous registers to thread STATE starting from REGNUM */
-#define STORE_REGS(state, regnum, count) \
- memcpy ((char *)state+reg_offset[ regnum ], \
- &deprecated_registers[REGISTER_BYTE (regnum)], \
- count*REGISTER_SIZE)
-
-#define REGS_ALL -1
-#define REGS_NORMAL 1
-#define REGS_EXC 2
-#define REGS_COP1 4
-
-/* Hardware regs that matches FP_REGNUM */
-#define MACH_FP_REGNUM 30
-
-/* Fech thread's registers. if regno == -1, fetch all regs */
-void
-fetch_inferior_registers (int regno)
-{
- kern_return_t ret;
-
- thread_state_data_t state;
- struct mips_exc_state exc_state;
-
- int stateCnt = MIPS_THREAD_STATE_COUNT;
-
- int which_regs = 0; /* A bit mask */
-
- if (!MACH_PORT_VALID (current_thread))
- error ("fetch inferior registers: Invalid thread");
-
- if (regno < -1 || regno >= NUM_REGS)
- error ("invalid register %d supplied to fetch_inferior_registers", regno);
-
- if (regno == -1)
- which_regs = REGS_ALL;
- else if (regno == ZERO_REGNUM)
- {
- int zero = 0;
- supply_register (ZERO_REGNUM, &zero);
- return;
- }
- else if ((ZERO_REGNUM < regno && regno < PS_REGNUM)
- || regno == FP_REGNUM
- || regno == LO_REGNUM
- || regno == HI_REGNUM
- || regno == PC_REGNUM)
- which_regs = REGS_NORMAL;
- else if (FP0_REGNUM <= regno && regno <= FCRIR_REGNUM)
- which_regs = REGS_COP1 | REGS_EXC;
- else
- which_regs = REGS_EXC;
-
- /* fetch regs saved to mips_thread_state */
- if (which_regs & REGS_NORMAL)
- {
- ret = thread_get_state (current_thread,
- MIPS_THREAD_STATE,
- state,
- &stateCnt);
- CHK ("fetch inferior registers: thread_get_state", ret);
-
- if (which_regs == REGS_NORMAL)
- {
- /* Fetch also FP_REGNUM if fetching MACH_FP_REGNUM and vice versa */
- if (regno == MACH_FP_REGNUM || regno == FP_REGNUM)
- {
- supply_register (FP_REGNUM,
- (char *) state + reg_offset[MACH_FP_REGNUM]);
- supply_register (MACH_FP_REGNUM,
- (char *) state + reg_offset[MACH_FP_REGNUM]);
- }
- else
- supply_register (regno,
- (char *) state + reg_offset[regno]);
- return;
- }
-
- /* ZERO_REGNUM is always zero */
- *(int *) deprecated_registers = 0;
-
- /* Copy thread saved regs 1..31 to gdb's reg value array
- * Luckily, they are contiquous
- */
- FETCH_REGS (state, 1, 31);
-
- /* Copy mdlo and mdhi */
- FETCH_REGS (state, LO_REGNUM, 2);
-
- /* Copy PC */
- FETCH_REGS (state, PC_REGNUM, 1);
-
- /* Mach 3.0 saves FP to MACH_FP_REGNUM.
- * For some reason gdb wants to assign a pseudo register for it.
- */
- FETCH_REGS (state, FP_REGNUM, 1);
- }
-
- /* Read exc state. Also read if need to fetch floats */
- if (which_regs & REGS_EXC)
- {
- stateCnt = MIPS_EXC_STATE_COUNT;
- ret = thread_get_state (current_thread,
- MIPS_EXC_STATE,
- (thread_state_t) & exc_state,
- &stateCnt);
- CHK ("fetch inferior regs (exc): thread_get_state", ret);
-
- /* We need to fetch exc_state to see if the floating
- * state is valid for the thread.
- */
-
- /* cproc_state: Which coprocessors the thread uses */
- supply_register (PS_REGNUM,
- (char *) &exc_state + reg_offset[PS_REGNUM]);
-
- if (which_regs == REGS_EXC || which_regs == REGS_ALL)
- {
- supply_register (BADVADDR_REGNUM,
- (char *) &exc_state + reg_offset[BADVADDR_REGNUM]);
-
- supply_register (CAUSE_REGNUM,
- (char *) &exc_state + reg_offset[CAUSE_REGNUM]);
- if (which_regs == REGS_EXC)
- return;
- }
- }
-
-
- if (which_regs & REGS_COP1)
- {
- /* If the thread does not have saved COPROC1, set regs to zero */
-
- if (!(exc_state.coproc_state & MIPS_STATUS_USE_COP1))
- bzero (&deprecated_registers[REGISTER_BYTE (FP0_REGNUM)],
- sizeof (struct mips_float_state));
- else
- {
- stateCnt = MIPS_FLOAT_STATE_COUNT;
- ret = thread_get_state (current_thread,
- MIPS_FLOAT_STATE,
- state,
- &stateCnt);
- CHK ("fetch inferior regs (floats): thread_get_state", ret);
-
- if (regno != -1)
- {
- supply_register (regno,
- (char *) state + reg_offset[regno]);
- return;
- }
-
- FETCH_REGS (state, FP0_REGNUM, 34);
- }
- }
-
- /* All registers are valid, if not returned yet */
- deprecated_registers_fetched ();
-}
-
-/* Store gdb's view of registers to the thread.
- * All registers are always valid when entering here.
- * @@ ahem, maybe that is too strict, we could validate the necessary ones
- * here.
- *
- * Hmm. It seems that gdb set $reg=value command first reads everything,
- * then sets the reg and then stores everything. -> we must make sure
- * that the immutable registers are not changed by reading them first.
- */
-
-void
-store_inferior_registers (register int regno)
-{
- thread_state_data_t state;
- kern_return_t ret;
-
- if (!MACH_PORT_VALID (current_thread))
- error ("store inferior registers: Invalid thread");
-
- /* Check for read only regs.
- * @@ If some of these is can be changed, fix this
- */
- if (regno == ZERO_REGNUM ||
- regno == PS_REGNUM ||
- regno == BADVADDR_REGNUM ||
- regno == CAUSE_REGNUM ||
- regno == FCRIR_REGNUM)
- {
- message ("You can not alter read-only register `%s'",
- REGISTER_NAME (regno));
- fetch_inferior_registers (regno);
- return;
- }
-
- if (regno == -1)
- {
- /* Don't allow these to change */
-
- /* ZERO_REGNUM */
- *(int *) deprecated_registers = 0;
-
- fetch_inferior_registers (PS_REGNUM);
- fetch_inferior_registers (BADVADDR_REGNUM);
- fetch_inferior_registers (CAUSE_REGNUM);
- fetch_inferior_registers (FCRIR_REGNUM);
- }
-
- if (regno == -1 || (ZERO_REGNUM < regno && regno <= PC_REGNUM))
- {
-#if 1
- /* Mach 3.0 saves thread's FP to MACH_FP_REGNUM.
- * GDB wants assigns a pseudo register FP_REGNUM for frame pointer.
- *
- * @@@ Here I assume (!) that gdb's FP has the value that
- * should go to threads frame pointer. If not true, this
- * fails badly!!!!!
- */
- memcpy (&deprecated_registers[REGISTER_BYTE (MACH_FP_REGNUM)],
- &deprecated_registers[REGISTER_BYTE (FP_REGNUM)],
- REGISTER_RAW_SIZE (FP_REGNUM));
-#endif
-
- /* Save gdb's regs 1..31 to thread saved regs 1..31
- * Luckily, they are contiquous
- */
- STORE_REGS (state, 1, 31);
-
- /* Save mdlo, mdhi */
- STORE_REGS (state, LO_REGNUM, 2);
-
- /* Save PC */
- STORE_REGS (state, PC_REGNUM, 1);
-
- ret = thread_set_state (current_thread,
- MIPS_THREAD_STATE,
- state,
- MIPS_FLOAT_STATE_COUNT);
- CHK ("store inferior regs : thread_set_state", ret);
- }
-
- if (regno == -1 || regno >= FP0_REGNUM)
- {
- /* If thread has floating state, save it */
- if (read_register (PS_REGNUM) & MIPS_STATUS_USE_COP1)
- {
- /* Do NOT save FCRIR_REGNUM */
- STORE_REGS (state, FP0_REGNUM, 33);
-
- ret = thread_set_state (current_thread,
- MIPS_FLOAT_STATE,
- state,
- MIPS_FLOAT_STATE_COUNT);
- CHK ("store inferior registers (floats): thread_set_state", ret);
- }
- else if (regno != -1)
- message
- ("Thread does not use floating point unit, floating regs not saved");
- }
-}
+// OBSOLETE /* Definitions to make GDB run on a mips box under Mach 3.0
+// OBSOLETE Copyright 1992, 1993, 1998, 2000, 2001 Free Software Foundation, Inc.
+// OBSOLETE
+// OBSOLETE This file is part of GDB.
+// OBSOLETE
+// OBSOLETE This program is free software; you can redistribute it and/or modify
+// OBSOLETE it under the terms of the GNU General Public License as published by
+// OBSOLETE the Free Software Foundation; either version 2 of the License, or
+// OBSOLETE (at your option) any later version.
+// OBSOLETE
+// OBSOLETE This program is distributed in the hope that it will be useful,
+// OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of
+// OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// OBSOLETE GNU General Public License for more details.
+// OBSOLETE
+// OBSOLETE You should have received a copy of the GNU General Public License
+// OBSOLETE along with this program; if not, write to the Free Software
+// OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330,
+// OBSOLETE Boston, MA 02111-1307, USA. */
+// OBSOLETE
+// OBSOLETE /* Mach specific routines for little endian mips (e.g. pmax)
+// OBSOLETE * running Mach 3.0
+// OBSOLETE *
+// OBSOLETE * Author: Jukka Virtanen <jtv@hut.fi>
+// OBSOLETE */
+// OBSOLETE
+// OBSOLETE #include "defs.h"
+// OBSOLETE #include "inferior.h"
+// OBSOLETE #include "regcache.h"
+// OBSOLETE
+// OBSOLETE #include <stdio.h>
+// OBSOLETE
+// OBSOLETE #include <mach.h>
+// OBSOLETE #include <mach/message.h>
+// OBSOLETE #include <mach/exception.h>
+// OBSOLETE #include <mach_error.h>
+// OBSOLETE
+// OBSOLETE /* Find offsets to thread states at compile time.
+// OBSOLETE * If your compiler does not grok this, check the hand coded
+// OBSOLETE * offsets and use them.
+// OBSOLETE */
+// OBSOLETE
+// OBSOLETE #if 1
+// OBSOLETE
+// OBSOLETE #define REG_OFFSET(reg) (int)(&((struct mips_thread_state *)0)->reg)
+// OBSOLETE #define CREG_OFFSET(reg) (int)(&((struct mips_float_state *)0)->reg)
+// OBSOLETE #define EREG_OFFSET(reg) (int)(&((struct mips_exc_state *)0)->reg)
+// OBSOLETE
+// OBSOLETE /* at reg_offset[i] is the offset to the mips_thread_state
+// OBSOLETE * location where the gdb registers[i] is stored.
+// OBSOLETE *
+// OBSOLETE * -1 means mach does not save it anywhere.
+// OBSOLETE */
+// OBSOLETE static int reg_offset[] =
+// OBSOLETE {
+// OBSOLETE /* zero at v0 v1 */
+// OBSOLETE -1, REG_OFFSET (r1), REG_OFFSET (r2), REG_OFFSET (r3),
+// OBSOLETE
+// OBSOLETE /* a0 a1 a2 a3 */
+// OBSOLETE REG_OFFSET (r4), REG_OFFSET (r5), REG_OFFSET (r6), REG_OFFSET (r7),
+// OBSOLETE
+// OBSOLETE /* t0 t1 t2 t3 */
+// OBSOLETE REG_OFFSET (r8), REG_OFFSET (r9), REG_OFFSET (r10), REG_OFFSET (r11),
+// OBSOLETE
+// OBSOLETE /* t4 t5 t6 t7 */
+// OBSOLETE REG_OFFSET (r12), REG_OFFSET (r13), REG_OFFSET (r14), REG_OFFSET (r15),
+// OBSOLETE
+// OBSOLETE /* s0 s1 s2 s3 */
+// OBSOLETE REG_OFFSET (r16), REG_OFFSET (r17), REG_OFFSET (r18), REG_OFFSET (r19),
+// OBSOLETE
+// OBSOLETE /* s4 s5 s6 s7 */
+// OBSOLETE REG_OFFSET (r20), REG_OFFSET (r21), REG_OFFSET (r22), REG_OFFSET (r23),
+// OBSOLETE
+// OBSOLETE /* t8 t9 k0 k1 */
+// OBSOLETE REG_OFFSET (r24), REG_OFFSET (r25), REG_OFFSET (r26), REG_OFFSET (r27),
+// OBSOLETE
+// OBSOLETE /* gp sp s8(30) == fp(72) ra */
+// OBSOLETE REG_OFFSET (r28), REG_OFFSET (r29), REG_OFFSET (r30), REG_OFFSET (r31),
+// OBSOLETE
+// OBSOLETE /* sr(32) PS_REGNUM */
+// OBSOLETE EREG_OFFSET (coproc_state),
+// OBSOLETE
+// OBSOLETE /* lo(33) hi(34) */
+// OBSOLETE REG_OFFSET (mdlo), REG_OFFSET (mdhi),
+// OBSOLETE
+// OBSOLETE /* bad(35) cause(36) pc(37) */
+// OBSOLETE EREG_OFFSET (address), EREG_OFFSET (cause), REG_OFFSET (pc),
+// OBSOLETE
+// OBSOLETE /* f0(38) f1(39) f2(40) f3(41) */
+// OBSOLETE CREG_OFFSET (r0), CREG_OFFSET (r1), CREG_OFFSET (r2), CREG_OFFSET (r3),
+// OBSOLETE CREG_OFFSET (r4), CREG_OFFSET (r5), CREG_OFFSET (r6), CREG_OFFSET (r7),
+// OBSOLETE CREG_OFFSET (r8), CREG_OFFSET (r9), CREG_OFFSET (r10), CREG_OFFSET (r11),
+// OBSOLETE CREG_OFFSET (r12), CREG_OFFSET (r13), CREG_OFFSET (r14), CREG_OFFSET (r15),
+// OBSOLETE CREG_OFFSET (r16), CREG_OFFSET (r17), CREG_OFFSET (r18), CREG_OFFSET (r19),
+// OBSOLETE CREG_OFFSET (r20), CREG_OFFSET (r21), CREG_OFFSET (r22), CREG_OFFSET (r23),
+// OBSOLETE CREG_OFFSET (r24), CREG_OFFSET (r25), CREG_OFFSET (r26), CREG_OFFSET (r27),
+// OBSOLETE CREG_OFFSET (r28), CREG_OFFSET (r29), CREG_OFFSET (r30), CREG_OFFSET (r31),
+// OBSOLETE
+// OBSOLETE /* fsr(70) fir(71) fp(72) == s8(30) */
+// OBSOLETE CREG_OFFSET (csr), CREG_OFFSET (esr), REG_OFFSET (r30)
+// OBSOLETE };
+// OBSOLETE #else
+// OBSOLETE /* If the compiler does not grok the above defines */
+// OBSOLETE static int reg_offset[] =
+// OBSOLETE {
+// OBSOLETE /* mach_thread_state offsets: */
+// OBSOLETE -1, 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56,
+// OBSOLETE 60, 64, 68, 72, 76, 80, 84, 88, 92, 96, 100, 104, 108, 112, 116, 120,
+// OBSOLETE /*sr, lo, hi,addr,cause,pc */
+// OBSOLETE 8, 124, 128, 4, 0, 132,
+// OBSOLETE /* mach_float_state offsets: */
+// OBSOLETE 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60,
+// OBSOLETE 64, 68, 72, 76, 80, 84, 88, 92, 96, 100, 104, 108, 112, 116, 120, 124,
+// OBSOLETE /*fsr,fir */
+// OBSOLETE 128, 132,
+// OBSOLETE /* FP_REGNUM pseudo maps to s8==r30 in mach_thread_state */
+// OBSOLETE 116
+// OBSOLETE };
+// OBSOLETE #endif
+// OBSOLETE
+// OBSOLETE /* Fetch COUNT contiguous registers from thread STATE starting from REGNUM
+// OBSOLETE * Caller knows that the regs handled in one transaction are of same size.
+// OBSOLETE */
+// OBSOLETE #define FETCH_REGS(state, regnum, count) \
+// OBSOLETE memcpy (&deprecated_registers[REGISTER_BYTE (regnum)], \
+// OBSOLETE (char *)state+reg_offset[ regnum ], \
+// OBSOLETE count*REGISTER_SIZE)
+// OBSOLETE
+// OBSOLETE /* Store COUNT contiguous registers to thread STATE starting from REGNUM */
+// OBSOLETE #define STORE_REGS(state, regnum, count) \
+// OBSOLETE memcpy ((char *)state+reg_offset[ regnum ], \
+// OBSOLETE &deprecated_registers[REGISTER_BYTE (regnum)], \
+// OBSOLETE count*REGISTER_SIZE)
+// OBSOLETE
+// OBSOLETE #define REGS_ALL -1
+// OBSOLETE #define REGS_NORMAL 1
+// OBSOLETE #define REGS_EXC 2
+// OBSOLETE #define REGS_COP1 4
+// OBSOLETE
+// OBSOLETE /* Hardware regs that matches FP_REGNUM */
+// OBSOLETE #define MACH_FP_REGNUM 30
+// OBSOLETE
+// OBSOLETE /* Fech thread's registers. if regno == -1, fetch all regs */
+// OBSOLETE void
+// OBSOLETE fetch_inferior_registers (int regno)
+// OBSOLETE {
+// OBSOLETE kern_return_t ret;
+// OBSOLETE
+// OBSOLETE thread_state_data_t state;
+// OBSOLETE struct mips_exc_state exc_state;
+// OBSOLETE
+// OBSOLETE int stateCnt = MIPS_THREAD_STATE_COUNT;
+// OBSOLETE
+// OBSOLETE int which_regs = 0; /* A bit mask */
+// OBSOLETE
+// OBSOLETE if (!MACH_PORT_VALID (current_thread))
+// OBSOLETE error ("fetch inferior registers: Invalid thread");
+// OBSOLETE
+// OBSOLETE if (regno < -1 || regno >= NUM_REGS)
+// OBSOLETE error ("invalid register %d supplied to fetch_inferior_registers", regno);
+// OBSOLETE
+// OBSOLETE if (regno == -1)
+// OBSOLETE which_regs = REGS_ALL;
+// OBSOLETE else if (regno == ZERO_REGNUM)
+// OBSOLETE {
+// OBSOLETE int zero = 0;
+// OBSOLETE supply_register (ZERO_REGNUM, &zero);
+// OBSOLETE return;
+// OBSOLETE }
+// OBSOLETE else if ((ZERO_REGNUM < regno && regno < PS_REGNUM)
+// OBSOLETE || regno == FP_REGNUM
+// OBSOLETE || regno == LO_REGNUM
+// OBSOLETE || regno == HI_REGNUM
+// OBSOLETE || regno == PC_REGNUM)
+// OBSOLETE which_regs = REGS_NORMAL;
+// OBSOLETE else if (FP0_REGNUM <= regno && regno <= FCRIR_REGNUM)
+// OBSOLETE which_regs = REGS_COP1 | REGS_EXC;
+// OBSOLETE else
+// OBSOLETE which_regs = REGS_EXC;
+// OBSOLETE
+// OBSOLETE /* fetch regs saved to mips_thread_state */
+// OBSOLETE if (which_regs & REGS_NORMAL)
+// OBSOLETE {
+// OBSOLETE ret = thread_get_state (current_thread,
+// OBSOLETE MIPS_THREAD_STATE,
+// OBSOLETE state,
+// OBSOLETE &stateCnt);
+// OBSOLETE CHK ("fetch inferior registers: thread_get_state", ret);
+// OBSOLETE
+// OBSOLETE if (which_regs == REGS_NORMAL)
+// OBSOLETE {
+// OBSOLETE /* Fetch also FP_REGNUM if fetching MACH_FP_REGNUM and vice versa */
+// OBSOLETE if (regno == MACH_FP_REGNUM || regno == FP_REGNUM)
+// OBSOLETE {
+// OBSOLETE supply_register (FP_REGNUM,
+// OBSOLETE (char *) state + reg_offset[MACH_FP_REGNUM]);
+// OBSOLETE supply_register (MACH_FP_REGNUM,
+// OBSOLETE (char *) state + reg_offset[MACH_FP_REGNUM]);
+// OBSOLETE }
+// OBSOLETE else
+// OBSOLETE supply_register (regno,
+// OBSOLETE (char *) state + reg_offset[regno]);
+// OBSOLETE return;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE /* ZERO_REGNUM is always zero */
+// OBSOLETE *(int *) deprecated_registers = 0;
+// OBSOLETE
+// OBSOLETE /* Copy thread saved regs 1..31 to gdb's reg value array
+// OBSOLETE * Luckily, they are contiquous
+// OBSOLETE */
+// OBSOLETE FETCH_REGS (state, 1, 31);
+// OBSOLETE
+// OBSOLETE /* Copy mdlo and mdhi */
+// OBSOLETE FETCH_REGS (state, LO_REGNUM, 2);
+// OBSOLETE
+// OBSOLETE /* Copy PC */
+// OBSOLETE FETCH_REGS (state, PC_REGNUM, 1);
+// OBSOLETE
+// OBSOLETE /* Mach 3.0 saves FP to MACH_FP_REGNUM.
+// OBSOLETE * For some reason gdb wants to assign a pseudo register for it.
+// OBSOLETE */
+// OBSOLETE FETCH_REGS (state, FP_REGNUM, 1);
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE /* Read exc state. Also read if need to fetch floats */
+// OBSOLETE if (which_regs & REGS_EXC)
+// OBSOLETE {
+// OBSOLETE stateCnt = MIPS_EXC_STATE_COUNT;
+// OBSOLETE ret = thread_get_state (current_thread,
+// OBSOLETE MIPS_EXC_STATE,
+// OBSOLETE (thread_state_t) & exc_state,
+// OBSOLETE &stateCnt);
+// OBSOLETE CHK ("fetch inferior regs (exc): thread_get_state", ret);
+// OBSOLETE
+// OBSOLETE /* We need to fetch exc_state to see if the floating
+// OBSOLETE * state is valid for the thread.
+// OBSOLETE */
+// OBSOLETE
+// OBSOLETE /* cproc_state: Which coprocessors the thread uses */
+// OBSOLETE supply_register (PS_REGNUM,
+// OBSOLETE (char *) &exc_state + reg_offset[PS_REGNUM]);
+// OBSOLETE
+// OBSOLETE if (which_regs == REGS_EXC || which_regs == REGS_ALL)
+// OBSOLETE {
+// OBSOLETE supply_register (BADVADDR_REGNUM,
+// OBSOLETE (char *) &exc_state + reg_offset[BADVADDR_REGNUM]);
+// OBSOLETE
+// OBSOLETE supply_register (CAUSE_REGNUM,
+// OBSOLETE (char *) &exc_state + reg_offset[CAUSE_REGNUM]);
+// OBSOLETE if (which_regs == REGS_EXC)
+// OBSOLETE return;
+// OBSOLETE }
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE
+// OBSOLETE if (which_regs & REGS_COP1)
+// OBSOLETE {
+// OBSOLETE /* If the thread does not have saved COPROC1, set regs to zero */
+// OBSOLETE
+// OBSOLETE if (!(exc_state.coproc_state & MIPS_STATUS_USE_COP1))
+// OBSOLETE bzero (&deprecated_registers[REGISTER_BYTE (FP0_REGNUM)],
+// OBSOLETE sizeof (struct mips_float_state));
+// OBSOLETE else
+// OBSOLETE {
+// OBSOLETE stateCnt = MIPS_FLOAT_STATE_COUNT;
+// OBSOLETE ret = thread_get_state (current_thread,
+// OBSOLETE MIPS_FLOAT_STATE,
+// OBSOLETE state,
+// OBSOLETE &stateCnt);
+// OBSOLETE CHK ("fetch inferior regs (floats): thread_get_state", ret);
+// OBSOLETE
+// OBSOLETE if (regno != -1)
+// OBSOLETE {
+// OBSOLETE supply_register (regno,
+// OBSOLETE (char *) state + reg_offset[regno]);
+// OBSOLETE return;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE FETCH_REGS (state, FP0_REGNUM, 34);
+// OBSOLETE }
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE /* All registers are valid, if not returned yet */
+// OBSOLETE deprecated_registers_fetched ();
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE /* Store gdb's view of registers to the thread.
+// OBSOLETE * All registers are always valid when entering here.
+// OBSOLETE * @@ ahem, maybe that is too strict, we could validate the necessary ones
+// OBSOLETE * here.
+// OBSOLETE *
+// OBSOLETE * Hmm. It seems that gdb set $reg=value command first reads everything,
+// OBSOLETE * then sets the reg and then stores everything. -> we must make sure
+// OBSOLETE * that the immutable registers are not changed by reading them first.
+// OBSOLETE */
+// OBSOLETE
+// OBSOLETE void
+// OBSOLETE store_inferior_registers (register int regno)
+// OBSOLETE {
+// OBSOLETE thread_state_data_t state;
+// OBSOLETE kern_return_t ret;
+// OBSOLETE
+// OBSOLETE if (!MACH_PORT_VALID (current_thread))
+// OBSOLETE error ("store inferior registers: Invalid thread");
+// OBSOLETE
+// OBSOLETE /* Check for read only regs.
+// OBSOLETE * @@ If some of these is can be changed, fix this
+// OBSOLETE */
+// OBSOLETE if (regno == ZERO_REGNUM ||
+// OBSOLETE regno == PS_REGNUM ||
+// OBSOLETE regno == BADVADDR_REGNUM ||
+// OBSOLETE regno == CAUSE_REGNUM ||
+// OBSOLETE regno == FCRIR_REGNUM)
+// OBSOLETE {
+// OBSOLETE message ("You can not alter read-only register `%s'",
+// OBSOLETE REGISTER_NAME (regno));
+// OBSOLETE fetch_inferior_registers (regno);
+// OBSOLETE return;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE if (regno == -1)
+// OBSOLETE {
+// OBSOLETE /* Don't allow these to change */
+// OBSOLETE
+// OBSOLETE /* ZERO_REGNUM */
+// OBSOLETE *(int *) deprecated_registers = 0;
+// OBSOLETE
+// OBSOLETE fetch_inferior_registers (PS_REGNUM);
+// OBSOLETE fetch_inferior_registers (BADVADDR_REGNUM);
+// OBSOLETE fetch_inferior_registers (CAUSE_REGNUM);
+// OBSOLETE fetch_inferior_registers (FCRIR_REGNUM);
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE if (regno == -1 || (ZERO_REGNUM < regno && regno <= PC_REGNUM))
+// OBSOLETE {
+// OBSOLETE #if 1
+// OBSOLETE /* Mach 3.0 saves thread's FP to MACH_FP_REGNUM.
+// OBSOLETE * GDB wants assigns a pseudo register FP_REGNUM for frame pointer.
+// OBSOLETE *
+// OBSOLETE * @@@ Here I assume (!) that gdb's FP has the value that
+// OBSOLETE * should go to threads frame pointer. If not true, this
+// OBSOLETE * fails badly!!!!!
+// OBSOLETE */
+// OBSOLETE memcpy (&deprecated_registers[REGISTER_BYTE (MACH_FP_REGNUM)],
+// OBSOLETE &deprecated_registers[REGISTER_BYTE (FP_REGNUM)],
+// OBSOLETE REGISTER_RAW_SIZE (FP_REGNUM));
+// OBSOLETE #endif
+// OBSOLETE
+// OBSOLETE /* Save gdb's regs 1..31 to thread saved regs 1..31
+// OBSOLETE * Luckily, they are contiquous
+// OBSOLETE */
+// OBSOLETE STORE_REGS (state, 1, 31);
+// OBSOLETE
+// OBSOLETE /* Save mdlo, mdhi */
+// OBSOLETE STORE_REGS (state, LO_REGNUM, 2);
+// OBSOLETE
+// OBSOLETE /* Save PC */
+// OBSOLETE STORE_REGS (state, PC_REGNUM, 1);
+// OBSOLETE
+// OBSOLETE ret = thread_set_state (current_thread,
+// OBSOLETE MIPS_THREAD_STATE,
+// OBSOLETE state,
+// OBSOLETE MIPS_FLOAT_STATE_COUNT);
+// OBSOLETE CHK ("store inferior regs : thread_set_state", ret);
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE if (regno == -1 || regno >= FP0_REGNUM)
+// OBSOLETE {
+// OBSOLETE /* If thread has floating state, save it */
+// OBSOLETE if (read_register (PS_REGNUM) & MIPS_STATUS_USE_COP1)
+// OBSOLETE {
+// OBSOLETE /* Do NOT save FCRIR_REGNUM */
+// OBSOLETE STORE_REGS (state, FP0_REGNUM, 33);
+// OBSOLETE
+// OBSOLETE ret = thread_set_state (current_thread,
+// OBSOLETE MIPS_FLOAT_STATE,
+// OBSOLETE state,
+// OBSOLETE MIPS_FLOAT_STATE_COUNT);
+// OBSOLETE CHK ("store inferior registers (floats): thread_set_state", ret);
+// OBSOLETE }
+// OBSOLETE else if (regno != -1)
+// OBSOLETE message
+// OBSOLETE ("Thread does not use floating point unit, floating regs not saved");
+// OBSOLETE }
+// OBSOLETE }
diff --git a/gdb/mn10300-tdep.c b/gdb/mn10300-tdep.c
index bcd96ad..22f3b67 100644
--- a/gdb/mn10300-tdep.c
+++ b/gdb/mn10300-tdep.c
@@ -688,7 +688,7 @@ mn10300_frame_chain (struct frame_info *fi)
/* The easiest way to get that info is to analyze our caller's frame.
So we set up a dummy frame and call mn10300_analyze_prologue to
find stuff for us. */
- dummy = analyze_dummy_frame (FRAME_SAVED_PC (fi), get_frame_base (fi));
+ dummy = analyze_dummy_frame (DEPRECATED_FRAME_SAVED_PC (fi), get_frame_base (fi));
if (get_frame_extra_info (dummy)->status & MY_FRAME_IN_FP)
{
@@ -728,7 +728,7 @@ mn10300_pop_frame_regular (struct frame_info *frame)
{
int regnum;
- write_register (PC_REGNUM, FRAME_SAVED_PC (frame));
+ write_register (PC_REGNUM, DEPRECATED_FRAME_SAVED_PC (frame));
/* Restore any saved registers. */
for (regnum = 0; regnum < NUM_REGS; regnum++)
@@ -900,7 +900,7 @@ static void
mn10300_init_extra_frame_info (int fromleaf, struct frame_info *fi)
{
if (get_next_frame (fi))
- deprecated_update_frame_pc_hack (fi, FRAME_SAVED_PC (get_next_frame (fi)));
+ deprecated_update_frame_pc_hack (fi, DEPRECATED_FRAME_SAVED_PC (get_next_frame (fi)));
frame_saved_regs_zalloc (fi);
frame_extra_info_zalloc (fi, sizeof (struct frame_extra_info));
@@ -1166,18 +1166,18 @@ mn10300_gdbarch_init (struct gdbarch_info info,
/* Stack unwinding. */
set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
- set_gdbarch_saved_pc_after_call (gdbarch, mn10300_saved_pc_after_call);
+ set_gdbarch_deprecated_saved_pc_after_call (gdbarch, mn10300_saved_pc_after_call);
set_gdbarch_deprecated_init_extra_frame_info (gdbarch, mn10300_init_extra_frame_info);
set_gdbarch_deprecated_init_frame_pc (gdbarch, init_frame_pc_noop);
set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, mn10300_frame_init_saved_regs);
- set_gdbarch_frame_chain (gdbarch, mn10300_frame_chain);
- set_gdbarch_frame_saved_pc (gdbarch, mn10300_frame_saved_pc);
+ set_gdbarch_deprecated_frame_chain (gdbarch, mn10300_frame_chain);
+ set_gdbarch_deprecated_frame_saved_pc (gdbarch, mn10300_frame_saved_pc);
set_gdbarch_deprecated_extract_return_value (gdbarch, mn10300_extract_return_value);
set_gdbarch_deprecated_extract_struct_value_address
(gdbarch, mn10300_extract_struct_value_address);
set_gdbarch_deprecated_store_return_value (gdbarch, mn10300_store_return_value);
- set_gdbarch_store_struct_return (gdbarch, mn10300_store_struct_return);
- set_gdbarch_pop_frame (gdbarch, mn10300_pop_frame);
+ set_gdbarch_deprecated_store_struct_return (gdbarch, mn10300_store_struct_return);
+ set_gdbarch_deprecated_pop_frame (gdbarch, mn10300_pop_frame);
set_gdbarch_skip_prologue (gdbarch, mn10300_skip_prologue);
set_gdbarch_frame_args_skip (gdbarch, 0);
set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown);
@@ -1185,26 +1185,21 @@ mn10300_gdbarch_init (struct gdbarch_info info,
set_gdbarch_read_fp (gdbarch, generic_target_read_sp);
/* Calling functions in the inferior from GDB. */
- set_gdbarch_call_dummy_p (gdbarch, 1);
- set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 1);
- set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 0);
- set_gdbarch_call_dummy_stack_adjust_p (gdbarch, 0);
- set_gdbarch_call_dummy_address (gdbarch, entry_point_address);
set_gdbarch_call_dummy_words (gdbarch, mn10300_call_dummy_words);
set_gdbarch_sizeof_call_dummy_words (gdbarch,
sizeof (mn10300_call_dummy_words));
- set_gdbarch_call_dummy_length (gdbarch, 0);
- set_gdbarch_fix_call_dummy (gdbarch, generic_fix_call_dummy);
- set_gdbarch_call_dummy_start_offset (gdbarch, 0);
set_gdbarch_deprecated_pc_in_call_dummy (gdbarch, deprecated_pc_in_call_dummy_at_entry_point);
- set_gdbarch_push_arguments (gdbarch, mn10300_push_arguments);
+ set_gdbarch_deprecated_push_arguments (gdbarch, mn10300_push_arguments);
set_gdbarch_reg_struct_has_addr (gdbarch, mn10300_reg_struct_has_addr);
- set_gdbarch_push_return_address (gdbarch, mn10300_push_return_address);
+ set_gdbarch_deprecated_push_return_address (gdbarch, mn10300_push_return_address);
set_gdbarch_save_dummy_frame_tos (gdbarch, generic_save_dummy_frame_tos);
set_gdbarch_use_struct_convention (gdbarch, mn10300_use_struct_convention);
tdep->am33_mode = am33_mode;
+ /* Should be using push_dummy_call. */
+ set_gdbarch_deprecated_dummy_write_sp (gdbarch, generic_target_write_sp);
+
return gdbarch;
}
diff --git a/gdb/monitor.h b/gdb/monitor.h
index 7b87f95..9141450 100644
--- a/gdb/monitor.h
+++ b/gdb/monitor.h
@@ -24,6 +24,7 @@
#ifndef MONITOR_H
#define MONITOR_H
+struct target_waitstatus;
struct serial;
/* This structure describes the strings necessary to give small command
diff --git a/gdb/ns32k-tdep.c b/gdb/ns32k-tdep.c
index 36ccadc..3a31ddb 100644
--- a/gdb/ns32k-tdep.c
+++ b/gdb/ns32k-tdep.c
@@ -190,8 +190,8 @@ umax_frame_num_args (struct frame_info *fi)
if (enter_addr > 0)
{
pc = ((enter_addr == 1)
- ? SAVED_PC_AFTER_CALL (fi)
- : FRAME_SAVED_PC (fi));
+ ? DEPRECATED_SAVED_PC_AFTER_CALL (fi)
+ : DEPRECATED_FRAME_SAVED_PC (fi));
insn = read_memory_integer (pc, 2);
addr_mode = (insn >> 11) & 0x1f;
insn = insn & 0x7ff;
@@ -566,14 +566,14 @@ ns32k_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
/* Frame and stack info */
set_gdbarch_skip_prologue (gdbarch, umax_skip_prologue);
- set_gdbarch_saved_pc_after_call (gdbarch, ns32k_saved_pc_after_call);
+ set_gdbarch_deprecated_saved_pc_after_call (gdbarch, ns32k_saved_pc_after_call);
set_gdbarch_frame_num_args (gdbarch, umax_frame_num_args);
set_gdbarch_frameless_function_invocation (gdbarch,
generic_frameless_function_invocation_not);
- set_gdbarch_frame_chain (gdbarch, ns32k_frame_chain);
- set_gdbarch_frame_saved_pc (gdbarch, ns32k_frame_saved_pc);
+ set_gdbarch_deprecated_frame_chain (gdbarch, ns32k_frame_chain);
+ set_gdbarch_deprecated_frame_saved_pc (gdbarch, ns32k_frame_saved_pc);
set_gdbarch_frame_args_address (gdbarch, ns32k_frame_args_address);
set_gdbarch_frame_locals_address (gdbarch, ns32k_frame_locals_address);
@@ -585,7 +585,7 @@ ns32k_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
/* Return value info */
- set_gdbarch_store_struct_return (gdbarch, ns32k_store_struct_return);
+ set_gdbarch_deprecated_store_struct_return (gdbarch, ns32k_store_struct_return);
set_gdbarch_deprecated_extract_return_value (gdbarch, ns32k_extract_return_value);
set_gdbarch_deprecated_store_return_value (gdbarch, ns32k_store_return_value);
set_gdbarch_deprecated_extract_struct_value_address (gdbarch,
@@ -593,17 +593,15 @@ ns32k_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
/* Call dummy info */
set_gdbarch_deprecated_push_dummy_frame (gdbarch, ns32k_push_dummy_frame);
- set_gdbarch_pop_frame (gdbarch, ns32k_pop_frame);
+ set_gdbarch_deprecated_pop_frame (gdbarch, ns32k_pop_frame);
set_gdbarch_call_dummy_location (gdbarch, ON_STACK);
- set_gdbarch_call_dummy_p (gdbarch, 1);
set_gdbarch_call_dummy_words (gdbarch, ns32k_call_dummy_words);
set_gdbarch_sizeof_call_dummy_words (gdbarch, sizeof_ns32k_call_dummy_words);
set_gdbarch_fix_call_dummy (gdbarch, ns32k_fix_call_dummy);
set_gdbarch_call_dummy_start_offset (gdbarch, 3);
- set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 0);
+ set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 15);
set_gdbarch_deprecated_use_generic_dummy_frames (gdbarch, 0);
set_gdbarch_deprecated_pc_in_call_dummy (gdbarch, deprecated_pc_in_call_dummy_on_stack);
- set_gdbarch_call_dummy_stack_adjust_p (gdbarch, 0);
/* Breakpoint info */
set_gdbarch_decr_pc_after_break (gdbarch, 0);
@@ -612,6 +610,9 @@ ns32k_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
/* Misc info */
set_gdbarch_function_start_offset (gdbarch, 0);
+ /* Should be using push_dummy_call. */
+ set_gdbarch_deprecated_dummy_write_sp (gdbarch, generic_target_write_sp);
+
/* Hook in OS ABI-specific overrides, if they have been registered. */
gdbarch_init_osabi (info, gdbarch);
diff --git a/gdb/ns32knbsd-nat.c b/gdb/ns32knbsd-nat.c
index bf5250f..24e422d 100644
--- a/gdb/ns32knbsd-nat.c
+++ b/gdb/ns32knbsd-nat.c
@@ -295,7 +295,9 @@ frame_num_args (struct frame_info *fi)
enter_addr = ns32k_get_enter_addr (fi->pc);
if (enter_addr = 0)
return (-1);
- argp = enter_addr == 1 ? SAVED_PC_AFTER_CALL (fi) : FRAME_SAVED_PC (fi);
+ argp = (enter_addr == 1
+ ? DEPRECATED_SAVED_PC_AFTER_CALL (fi)
+ : DEPRECATED_FRAME_SAVED_PC (fi));
for (i = 0; i < 16; i++)
{
/*
diff --git a/gdb/objc-exp.y b/gdb/objc-exp.y
index e6155ba..329ddde 100644
--- a/gdb/objc-exp.y
+++ b/gdb/objc-exp.y
@@ -247,9 +247,11 @@ exp1 : exp
/* Expressions, not including the comma operator. */
exp : '*' exp %prec UNARY
{ write_exp_elt_opcode (UNOP_IND); }
+ ;
exp : '&' exp %prec UNARY
{ write_exp_elt_opcode (UNOP_ADDR); }
+ ;
exp : '-' exp %prec UNARY
{ write_exp_elt_opcode (UNOP_NEG); }
@@ -570,6 +572,7 @@ exp : SELECTOR
write_exp_elt_opcode (OP_OBJC_SELECTOR);
write_exp_string ($1);
write_exp_elt_opcode (OP_OBJC_SELECTOR); }
+ ;
exp : SIZEOF '(' type ')' %prec UNARY
{ write_exp_elt_opcode (OP_LONG);
@@ -666,7 +669,7 @@ qualified_name: typebase COLONCOLON name
write_exp_elt_opcode (OP_SCOPE);
write_exp_elt_type (type);
- write_exp_block (NULL);
+ write_exp_elt_block (NULL);
write_exp_string ($3);
write_exp_elt_opcode (OP_SCOPE);
}
diff --git a/gdb/objc-lang.c b/gdb/objc-lang.c
index 2292685..bbb1422 100644
--- a/gdb/objc-lang.c
+++ b/gdb/objc-lang.c
@@ -199,8 +199,10 @@ value_nsstring (char *ptr, int len)
if (!target_has_execution)
return 0; /* Can't call into inferior to create NSString. */
- if (!(sym = lookup_struct_typedef("NSString", 0, 1)) &&
- !(sym = lookup_struct_typedef("NXString", 0, 1)))
+ sym = lookup_struct_typedef("NSString", 0, 1);
+ if (sym == NULL)
+ sym = lookup_struct_typedef("NXString", 0, 1);
+ if (sym == NULL)
type = lookup_pointer_type(builtin_type_void);
else
type = lookup_pointer_type(SYMBOL_TYPE (sym));
@@ -237,7 +239,7 @@ value_nsstring (char *ptr, int len)
/* Objective-C name demangling. */
char *
-objc_demangle (const char *mangled)
+objc_demangle (const char *mangled, int options)
{
char *demangled, *cp;
@@ -369,8 +371,6 @@ objc_printstr (struct ui_file *stream, char *string,
int in_quotes = 0;
int need_comma = 0;
extern int inspect_it;
- extern int repeat_count_threshold;
- extern int print_max;
/* If the string was not truncated due to `set print elements', and
the last byte of it is a null, we don't print that, in
@@ -593,6 +593,35 @@ objc_create_fundamental_type (struct objfile *objfile, int typeid)
return (type);
}
+/* Determine if we are currently in the Objective-C dispatch function.
+ If so, get the address of the method function that the dispatcher
+ would call and use that as the function to step into instead. Also
+ skip over the trampoline for the function (if any). This is better
+ for the user since they are only interested in stepping into the
+ method function anyway. */
+static CORE_ADDR
+objc_skip_trampoline (CORE_ADDR stop_pc)
+{
+ CORE_ADDR real_stop_pc;
+ CORE_ADDR method_stop_pc;
+
+ real_stop_pc = SKIP_TRAMPOLINE_CODE (stop_pc);
+
+ if (real_stop_pc != 0)
+ find_objc_msgcall (real_stop_pc, &method_stop_pc);
+ else
+ find_objc_msgcall (stop_pc, &method_stop_pc);
+
+ if (method_stop_pc)
+ {
+ real_stop_pc = SKIP_TRAMPOLINE_CODE (method_stop_pc);
+ if (real_stop_pc == 0)
+ real_stop_pc = method_stop_pc;
+ }
+
+ return real_stop_pc;
+}
+
/* Table mapping opcodes into strings for printing operators
and precedences of the operators. */
@@ -670,6 +699,8 @@ const struct language_defn objc_language_defn = {
c_print_type, /* Print a type using appropriate syntax */
c_val_print, /* Print a value using appropriate syntax */
c_value_print, /* Print a top-level value */
+ objc_skip_trampoline, /* Language specific skip_trampoline */
+ objc_demangle, /* Language specific symbol demangler */
{"", "", "", ""}, /* Binary format info */
{"0%lo", "0", "o", ""}, /* Octal format info */
{"%ld", "", "d", ""}, /* Decimal format info */
@@ -859,16 +890,17 @@ selectors_info (char *regexp, int from_tty)
}
if (regexp != NULL)
- if (0 != (val = re_comp (myregexp)))
- error ("Invalid regexp (%s): %s", val, regexp);
+ {
+ val = re_comp (myregexp);
+ if (val != 0)
+ error ("Invalid regexp (%s): %s", val, regexp);
+ }
/* First time thru is JUST to get max length and count. */
ALL_MSYMBOLS (objfile, msymbol)
{
QUIT;
- name = SYMBOL_DEMANGLED_NAME (msymbol);
- if (name == NULL)
- name = DEPRECATED_SYMBOL_NAME (msymbol);
+ name = SYMBOL_NATURAL_NAME (msymbol);
if (name &&
(name[0] == '-' || name[0] == '+') &&
name[1] == '[') /* Got a method name. */
@@ -899,9 +931,7 @@ selectors_info (char *regexp, int from_tty)
ALL_MSYMBOLS (objfile, msymbol)
{
QUIT;
- name = SYMBOL_DEMANGLED_NAME (msymbol);
- if (name == NULL)
- name = DEPRECATED_SYMBOL_NAME (msymbol);
+ name = SYMBOL_NATURAL_NAME (msymbol);
if (name &&
(name[0] == '-' || name[0] == '+') &&
name[1] == '[') /* Got a method name. */
@@ -925,9 +955,7 @@ selectors_info (char *regexp, int from_tty)
char *p = asel;
QUIT;
- name = SYMBOL_DEMANGLED_NAME (sym_arr[ix]);
- if (name == NULL)
- name = DEPRECATED_SYMBOL_NAME (sym_arr[ix]);
+ name = SYMBOL_NATURAL_NAME (sym_arr[ix]);
name = strchr (name, ' ') + 1;
if (p[0] && specialcmp(name, p) == 0)
continue; /* Seen this one already (not unique). */
@@ -1002,16 +1030,17 @@ classes_info (char *regexp, int from_tty)
}
if (regexp != NULL)
- if (0 != (val = re_comp (myregexp)))
- error ("Invalid regexp (%s): %s", val, regexp);
+ {
+ val = re_comp (myregexp);
+ if (val != 0)
+ error ("Invalid regexp (%s): %s", val, regexp);
+ }
/* First time thru is JUST to get max length and count. */
ALL_MSYMBOLS (objfile, msymbol)
{
QUIT;
- name = SYMBOL_DEMANGLED_NAME (msymbol);
- if (name == NULL)
- name = DEPRECATED_SYMBOL_NAME (msymbol);
+ name = SYMBOL_NATURAL_NAME (msymbol);
if (name &&
(name[0] == '-' || name[0] == '+') &&
name[1] == '[') /* Got a method name. */
@@ -1035,9 +1064,7 @@ classes_info (char *regexp, int from_tty)
ALL_MSYMBOLS (objfile, msymbol)
{
QUIT;
- name = SYMBOL_DEMANGLED_NAME (msymbol);
- if (name == NULL)
- name = DEPRECATED_SYMBOL_NAME (msymbol);
+ name = SYMBOL_NATURAL_NAME (msymbol);
if (name &&
(name[0] == '-' || name[0] == '+') &&
name[1] == '[') /* Got a method name. */
@@ -1054,9 +1081,7 @@ classes_info (char *regexp, int from_tty)
char *p = aclass;
QUIT;
- name = SYMBOL_DEMANGLED_NAME (sym_arr[ix]);
- if (name == NULL)
- name = DEPRECATED_SYMBOL_NAME (sym_arr[ix]);
+ name = SYMBOL_NATURAL_NAME (sym_arr[ix]);
name += 2;
if (p[0] && specialcmp(name, p) == 0)
continue; /* Seen this one already (not unique). */
@@ -1317,9 +1342,7 @@ find_methods (struct symtab *symtab, char type,
/* Not in the specified symtab. */
continue;
- symname = SYMBOL_DEMANGLED_NAME (msymbol);
- if (symname == NULL)
- symname = DEPRECATED_SYMBOL_NAME (msymbol);
+ symname = SYMBOL_NATURAL_NAME (msymbol);
if (symname == NULL)
continue;
@@ -1355,10 +1378,8 @@ find_methods (struct symtab *symtab, char type,
sym = find_pc_function (SYMBOL_VALUE_ADDRESS (msymbol));
if (sym != NULL)
{
- const char *newsymname = SYMBOL_DEMANGLED_NAME (sym);
+ const char *newsymname = SYMBOL_NATURAL_NAME (sym);
- if (newsymname == NULL)
- newsymname = DEPRECATED_SYMBOL_NAME (sym);
if (strcmp (symname, newsymname) == 0)
{
/* Found a high-level method sym: swap it into the
@@ -1701,7 +1722,10 @@ find_objc_msgcall (CORE_ADDR pc, CORE_ADDR *new_pc)
unsigned int i;
find_objc_msgsend ();
- if (new_pc != NULL) { *new_pc = 0; }
+ if (new_pc != NULL)
+ {
+ *new_pc = 0;
+ }
for (i = 0; i < nmethcalls; i++)
if ((pc >= methcalls[i].begin) && (pc < methcalls[i].end))
diff --git a/gdb/objc-lang.h b/gdb/objc-lang.h
index 8506818..0c49bac 100644
--- a/gdb/objc-lang.h
+++ b/gdb/objc-lang.h
@@ -19,6 +19,11 @@
Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
+#if !defined(OBJC_LANG_H)
+#define OBJC_LANG_H
+
+struct stoken;
+
struct value;
struct block;
@@ -36,7 +41,7 @@ extern int c_value_print (struct value *, struct ui_file *,
extern CORE_ADDR lookup_objc_class (char *classname);
extern int lookup_child_selector (char *methodname);
-extern char *objc_demangle (const char *mangled);
+extern char *objc_demangle (const char *mangled, int options);
extern int find_objc_msgcall (CORE_ADDR pc, CORE_ADDR *new_pc);
@@ -51,3 +56,10 @@ extern char *find_imps (struct symtab *symtab, struct block *block,
unsigned int *nsym, unsigned int *ndebug);
extern struct value *value_nsstring (char *ptr, int len);
+
+/* for parsing Objective C */
+extern void start_msglist (void);
+extern void add_msglist (struct stoken *str, int addcolon);
+extern int end_msglist (void);
+
+#endif
diff --git a/gdb/objfiles.h b/gdb/objfiles.h
index e710263..f747a68 100644
--- a/gdb/objfiles.h
+++ b/gdb/objfiles.h
@@ -65,14 +65,15 @@ struct htab;
confused. However, we almost always have debugging information
available for main().
- These variables are used to save the range of PC values which are valid
- within the main() function and within the function containing the process
- entry point. If we always consider the frame for main() as the outermost
- frame when debugging user code, and the frame for the process entry
- point function as the outermost frame when debugging startup code, then
- all we have to do is have FRAME_CHAIN_VALID return false whenever a
- frame's current PC is within the range specified by these variables.
- In essence, we set "ceilings" in the frame chain beyond which we will
+ These variables are used to save the range of PC values which are
+ valid within the main() function and within the function containing
+ the process entry point. If we always consider the frame for
+ main() as the outermost frame when debugging user code, and the
+ frame for the process entry point function as the outermost frame
+ when debugging startup code, then all we have to do is have
+ DEPRECATED_FRAME_CHAIN_VALID return false whenever a frame's
+ current PC is within the range specified by these variables. In
+ essence, we set "ceilings" in the frame chain beyond which we will
not proceed when following the frame chain back up the stack.
A nice side effect is that we can still debug startup code without
@@ -83,9 +84,10 @@ struct htab;
information but we do have usable information for main(), backtraces
from user code don't go wandering off into the startup code.
- To use this method, define your FRAME_CHAIN_VALID macro like:
+ To use this method, define your DEPRECATED_FRAME_CHAIN_VALID macro
+ like:
- #define FRAME_CHAIN_VALID(chain, thisframe) \
+ #define DEPRECATED_FRAME_CHAIN_VALID(chain, thisframe) \
(chain != 0 \
&& !(inside_main_func ((thisframe)->pc)) \
&& !(inside_entry_func ((thisframe)->pc)))
diff --git a/gdb/observer.c b/gdb/observer.c
index 92ec48e..6815d0f 100644
--- a/gdb/observer.c
+++ b/gdb/observer.c
@@ -190,3 +190,33 @@ observer_notify_normal_stop (void)
{
generic_observer_notify (normal_stop_subject, NULL);
}
+
+/* The following code is only used to unit-test the observers from
+ our testsuite. DO NOT USE IT within observer.c! */
+
+/* Since this code will not be used within GDB, it will trigger
+ a warning if we decide to compile with -Wunused-function.
+ This is ok for now. (brobecker 2003-03-18) */
+
+static int observer_test_first_observer = 0;
+static int observer_test_second_observer = 0;
+static int observer_test_third_observer = 0;
+
+static void
+observer_test_first_notification_function (void)
+{
+ observer_test_first_observer++;
+}
+
+static void
+observer_test_second_notification_function (void)
+{
+ observer_test_second_observer++;
+}
+
+static void
+observer_test_third_notification_function (void)
+{
+ observer_test_third_observer++;
+}
+
diff --git a/gdb/ocd.h b/gdb/ocd.h
index 5fa1fb9..64d695a 100644
--- a/gdb/ocd.h
+++ b/gdb/ocd.h
@@ -21,6 +21,9 @@
#ifndef OCD_H
#define OCD_H
+struct mem_attrib;
+struct target_ops;
+
/* Wiggler serial protocol definitions */
#define DLE 020 /* Quote char */
diff --git a/gdb/osabi.c b/gdb/osabi.c
index ab49f9a..2241406 100644
--- a/gdb/osabi.c
+++ b/gdb/osabi.c
@@ -74,6 +74,8 @@ static const char * const gdb_osabi_names[] =
"ARM APCS",
"QNX Neutrino",
+ "Cygwin",
+
"<invalid>"
};
diff --git a/gdb/p-lang.c b/gdb/p-lang.c
index 88c8cc0..827fa0e 100644
--- a/gdb/p-lang.c
+++ b/gdb/p-lang.c
@@ -461,6 +461,8 @@ const struct language_defn pascal_language_defn =
pascal_print_type, /* Print a type using appropriate syntax */
pascal_val_print, /* Print a value using appropriate syntax */
pascal_value_print, /* Print a top-level value */
+ NULL, /* Language specific skip_trampoline */
+ NULL, /* Language specific symbol demangler */
{"", "%", "b", ""}, /* Binary format info */
{"0%lo", "0", "o", ""}, /* Octal format info */
{"%ld", "", "d", ""}, /* Decimal format info */
diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c
index f02581b..9284751 100644
--- a/gdb/ppc-linux-tdep.c
+++ b/gdb/ppc-linux-tdep.c
@@ -347,14 +347,17 @@ ppc_linux_frame_saved_pc (struct frame_info *fi)
if ((get_frame_type (fi) == SIGTRAMP_FRAME))
{
CORE_ADDR regs_addr =
- read_memory_integer (fi->frame + PPC_LINUX_REGS_PTR_OFFSET, 4);
+ read_memory_integer (get_frame_base (fi)
+ + PPC_LINUX_REGS_PTR_OFFSET, 4);
/* return the NIP in the regs array */
return read_memory_integer (regs_addr + 4 * PPC_LINUX_PT_NIP, 4);
}
- else if (fi->next && (get_frame_type (fi->next) == SIGTRAMP_FRAME))
+ else if (get_next_frame (fi)
+ && (get_frame_type (get_next_frame (fi)) == SIGTRAMP_FRAME))
{
CORE_ADDR regs_addr =
- read_memory_integer (fi->next->frame + PPC_LINUX_REGS_PTR_OFFSET, 4);
+ read_memory_integer (get_frame_base (get_next_frame (fi))
+ + PPC_LINUX_REGS_PTR_OFFSET, 4);
/* return LNK in the regs array */
return read_memory_integer (regs_addr + 4 * PPC_LINUX_PT_LNK, 4);
}
@@ -367,12 +370,12 @@ ppc_linux_init_extra_frame_info (int fromleaf, struct frame_info *fi)
{
rs6000_init_extra_frame_info (fromleaf, fi);
- if (fi->next != 0)
+ if (get_next_frame (fi) != 0)
{
/* We're called from get_prev_frame_info; check to see if
this is a signal frame by looking to see if the pc points
at trampoline code */
- if (ppc_linux_at_sigtramp_return_path (fi->pc))
+ if (ppc_linux_at_sigtramp_return_path (get_frame_pc (fi)))
deprecated_set_frame_type (fi, SIGTRAMP_FRAME);
else
/* FIXME: cagney/2002-11-10: Is this double bogus? What
@@ -386,7 +389,7 @@ ppc_linux_frameless_function_invocation (struct frame_info *fi)
{
/* We'll find the wrong thing if we let
rs6000_frameless_function_invocation () search for a signal trampoline */
- if (ppc_linux_at_sigtramp_return_path (fi->pc))
+ if (ppc_linux_at_sigtramp_return_path (get_frame_pc (fi)))
return 0;
else
return rs6000_frameless_function_invocation (fi);
@@ -399,31 +402,32 @@ ppc_linux_frame_init_saved_regs (struct frame_info *fi)
{
CORE_ADDR regs_addr;
int i;
- if (fi->saved_regs)
+ if (get_frame_saved_regs (fi))
return;
frame_saved_regs_zalloc (fi);
regs_addr =
- read_memory_integer (fi->frame + PPC_LINUX_REGS_PTR_OFFSET, 4);
- fi->saved_regs[PC_REGNUM] = regs_addr + 4 * PPC_LINUX_PT_NIP;
- fi->saved_regs[gdbarch_tdep (current_gdbarch)->ppc_ps_regnum] =
+ read_memory_integer (get_frame_base (fi)
+ + PPC_LINUX_REGS_PTR_OFFSET, 4);
+ get_frame_saved_regs (fi)[PC_REGNUM] = regs_addr + 4 * PPC_LINUX_PT_NIP;
+ get_frame_saved_regs (fi)[gdbarch_tdep (current_gdbarch)->ppc_ps_regnum] =
regs_addr + 4 * PPC_LINUX_PT_MSR;
- fi->saved_regs[gdbarch_tdep (current_gdbarch)->ppc_cr_regnum] =
+ get_frame_saved_regs (fi)[gdbarch_tdep (current_gdbarch)->ppc_cr_regnum] =
regs_addr + 4 * PPC_LINUX_PT_CCR;
- fi->saved_regs[gdbarch_tdep (current_gdbarch)->ppc_lr_regnum] =
+ get_frame_saved_regs (fi)[gdbarch_tdep (current_gdbarch)->ppc_lr_regnum] =
regs_addr + 4 * PPC_LINUX_PT_LNK;
- fi->saved_regs[gdbarch_tdep (current_gdbarch)->ppc_ctr_regnum] =
+ get_frame_saved_regs (fi)[gdbarch_tdep (current_gdbarch)->ppc_ctr_regnum] =
regs_addr + 4 * PPC_LINUX_PT_CTR;
- fi->saved_regs[gdbarch_tdep (current_gdbarch)->ppc_xer_regnum] =
+ get_frame_saved_regs (fi)[gdbarch_tdep (current_gdbarch)->ppc_xer_regnum] =
regs_addr + 4 * PPC_LINUX_PT_XER;
- fi->saved_regs[gdbarch_tdep (current_gdbarch)->ppc_mq_regnum] =
+ get_frame_saved_regs (fi)[gdbarch_tdep (current_gdbarch)->ppc_mq_regnum] =
regs_addr + 4 * PPC_LINUX_PT_MQ;
for (i = 0; i < 32; i++)
- fi->saved_regs[gdbarch_tdep (current_gdbarch)->ppc_gp0_regnum + i] =
+ get_frame_saved_regs (fi)[gdbarch_tdep (current_gdbarch)->ppc_gp0_regnum + i] =
regs_addr + 4 * PPC_LINUX_PT_R0 + 4 * i;
for (i = 0; i < 32; i++)
- fi->saved_regs[FP0_REGNUM + i] = regs_addr + 4 * PPC_LINUX_PT_FPR0 + 8 * i;
+ get_frame_saved_regs (fi)[FP0_REGNUM + i] = regs_addr + 4 * PPC_LINUX_PT_FPR0 + 8 * i;
}
else
rs6000_frame_init_saved_regs (fi);
@@ -434,7 +438,7 @@ ppc_linux_frame_chain (struct frame_info *thisframe)
{
/* Kernel properly constructs the frame chain for the handler */
if ((get_frame_type (thisframe) == SIGTRAMP_FRAME))
- return read_memory_integer ((thisframe)->frame, 4);
+ return read_memory_integer (get_frame_base (thisframe), 4);
else
return rs6000_frame_chain (thisframe);
}
@@ -729,8 +733,8 @@ ppc_linux_init_abi (struct gdbarch_info info,
*_push_arguments(). The same remarks hold for the methods below. */
set_gdbarch_frameless_function_invocation (gdbarch,
ppc_linux_frameless_function_invocation);
- set_gdbarch_frame_chain (gdbarch, ppc_linux_frame_chain);
- set_gdbarch_frame_saved_pc (gdbarch, ppc_linux_frame_saved_pc);
+ set_gdbarch_deprecated_frame_chain (gdbarch, ppc_linux_frame_chain);
+ set_gdbarch_deprecated_frame_saved_pc (gdbarch, ppc_linux_frame_saved_pc);
set_gdbarch_deprecated_frame_init_saved_regs (gdbarch,
ppc_linux_frame_init_saved_regs);
diff --git a/gdb/ppc-sysv-tdep.c b/gdb/ppc-sysv-tdep.c
index 1f01706..9894a58 100644
--- a/gdb/ppc-sysv-tdep.c
+++ b/gdb/ppc-sysv-tdep.c
@@ -61,11 +61,11 @@ ppc_sysv_abi_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
int structstkspace;
int argoffset;
int structoffset;
- struct value *arg;
struct type *type;
int len;
char old_sp_buf[4];
CORE_ADDR saved_sp;
+ struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
greg = struct_return ? 4 : 3;
freg = 1;
@@ -79,11 +79,12 @@ ppc_sysv_abi_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
are put in registers. */
for (argno = 0; argno < nargs; argno++)
{
- arg = args[argno];
+ struct value *arg = args[argno];
type = check_typedef (VALUE_TYPE (arg));
len = TYPE_LENGTH (type);
- if (TYPE_CODE (type) == TYPE_CODE_FLT)
+ if (TYPE_CODE (type) == TYPE_CODE_FLT
+ && ppc_floating_point_unit_p (current_gdbarch))
{
if (freg <= 8)
freg++;
@@ -96,7 +97,10 @@ ppc_sysv_abi_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
argstkspace += 8;
}
}
- else if (TYPE_CODE (type) == TYPE_CODE_INT && len == 8) /* long long */
+ else if (len == 8
+ && (TYPE_CODE (type) == TYPE_CODE_INT /* long long */
+ || (!ppc_floating_point_unit_p (current_gdbarch)
+ && TYPE_CODE (type) == TYPE_CODE_FLT))) /* double */
{
if (greg > 9)
{
@@ -144,6 +148,20 @@ ppc_sysv_abi_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
argstkspace += 16;
}
}
+ else if (len == 8
+ && TYPE_CODE (type) == TYPE_CODE_ARRAY
+ && TYPE_VECTOR (type))
+ {
+ if (greg <= 10)
+ greg++;
+ else
+ {
+ /* Vector arguments must be aligned to 8 bytes on
+ the stack. */
+ argstkspace += round2 (argstkspace, 8);
+ argstkspace += 8;
+ }
+ }
}
}
@@ -170,30 +188,33 @@ ppc_sysv_abi_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
freg = 1;
greg = 3;
vreg = 2;
+
/* Fill in r3 with the return structure, if any */
if (struct_return)
{
- char val_buf[4];
- store_address (val_buf, 4, struct_addr);
- memcpy (&deprecated_registers[REGISTER_BYTE (greg)], val_buf, 4);
+ write_register (tdep->ppc_gp0_regnum + greg, struct_addr);
greg++;
}
+
/* Now fill in the registers and stack... */
for (argno = 0; argno < nargs; argno++)
{
- arg = args[argno];
+ struct value *arg = args[argno];
+ char *val = VALUE_CONTENTS (arg);
type = check_typedef (VALUE_TYPE (arg));
len = TYPE_LENGTH (type);
- if (TYPE_CODE (type) == TYPE_CODE_FLT)
+ if (TYPE_CODE (type) == TYPE_CODE_FLT
+ && ppc_floating_point_unit_p (current_gdbarch))
{
if (freg <= 8)
{
+ ULONGEST regval;
if (len > 8)
printf_unfiltered (
"Fatal Error: a floating point parameter #%d with a size > 8 is found!\n", argno);
- memcpy (&deprecated_registers[REGISTER_BYTE (FP0_REGNUM + freg)],
- VALUE_CONTENTS (arg), len);
+ regval = extract_unsigned_integer (val, len);
+ write_register (FP0_REGNUM + freg, regval);
freg++;
}
else
@@ -203,29 +224,32 @@ ppc_sysv_abi_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
/* FIXME: Convert floats to doubles */
if (argoffset & 0x4)
argoffset += 4;
- write_memory (sp + argoffset, (char *) VALUE_CONTENTS (arg), len);
+ write_memory (sp + argoffset, val, len);
argoffset += 8;
}
}
- else if (TYPE_CODE (type) == TYPE_CODE_INT && len == 8) /* long long */
+ else if (len == 8
+ && (TYPE_CODE (type) == TYPE_CODE_INT /* long long */
+ || (!ppc_floating_point_unit_p (current_gdbarch)
+ && TYPE_CODE (type) == TYPE_CODE_FLT))) /* double */
{
if (greg > 9)
{
greg = 11;
if (argoffset & 0x4)
argoffset += 4;
- write_memory (sp + argoffset, (char *) VALUE_CONTENTS (arg), len);
+ write_memory (sp + argoffset, val, len);
argoffset += 8;
}
else
{
+ ULONGEST regval;
if ((greg & 1) == 0)
greg++;
-
- memcpy (&deprecated_registers[REGISTER_BYTE (greg)],
- VALUE_CONTENTS (arg), 4);
- memcpy (&deprecated_registers[REGISTER_BYTE (greg + 1)],
- VALUE_CONTENTS (arg) + 4, 4);
+ regval = extract_unsigned_integer (val, 4);
+ write_register (tdep->ppc_gp0_regnum + greg, regval);
+ regval = extract_unsigned_integer (val + 4, 4);
+ write_register (tdep->ppc_gp0_regnum + greg + 1, regval);
greg += 2;
}
}
@@ -236,18 +260,19 @@ ppc_sysv_abi_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
|| TYPE_CODE (type) == TYPE_CODE_STRUCT
|| TYPE_CODE (type) == TYPE_CODE_UNION)
{
- write_memory (sp + structoffset, VALUE_CONTENTS (arg), len);
+ write_memory (sp + structoffset, val, len);
store_address (val_buf, 4, sp + structoffset);
structoffset += round2 (len, 8);
}
else
{
memset (val_buf, 0, 4);
- memcpy (val_buf, VALUE_CONTENTS (arg), len);
+ memcpy (val_buf, val, len);
}
if (greg <= 10)
{
- memcpy (&deprecated_registers[REGISTER_BYTE (greg)], val_buf, 4);
+ ULONGEST regval = extract_unsigned_integer (val_buf, 4);
+ write_register (tdep->ppc_gp0_regnum + greg, regval);
greg++;
}
else
@@ -262,15 +287,14 @@ ppc_sysv_abi_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
&& TYPE_CODE (type) == TYPE_CODE_ARRAY
&& TYPE_VECTOR (type))
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
char *v_val_buf = alloca (16);
memset (v_val_buf, 0, 16);
- memcpy (v_val_buf, VALUE_CONTENTS (arg), len);
+ memcpy (v_val_buf, val, len);
if (vreg <= 13)
{
- memcpy (&deprecated_registers[REGISTER_BYTE (tdep->ppc_vr0_regnum
- + vreg)],
- v_val_buf, 16);
+ regcache_cooked_write (current_regcache,
+ tdep->ppc_vr0_regnum + vreg,
+ v_val_buf);
vreg++;
}
else
@@ -279,6 +303,26 @@ ppc_sysv_abi_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
argoffset += 16;
}
}
+ else if (len == 8
+ && TYPE_CODE (type) == TYPE_CODE_ARRAY
+ && TYPE_VECTOR (type))
+ {
+ char *v_val_buf = alloca (8);
+ memset (v_val_buf, 0, 8);
+ memcpy (v_val_buf, val, len);
+ if (greg <= 10)
+ {
+ regcache_cooked_write (current_regcache,
+ tdep->ppc_ev0_regnum + greg,
+ v_val_buf);
+ greg++;
+ }
+ else
+ {
+ write_memory (sp + argoffset, v_val_buf, 8);
+ argoffset += 8;
+ }
+ }
}
}
@@ -293,7 +337,7 @@ ppc_sysv_abi_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
int
ppc_sysv_abi_broken_use_struct_convention (int gcc_p, struct type *value_type)
{
- if (TYPE_LENGTH (value_type) == 16
+ if ((TYPE_LENGTH (value_type) == 16 || TYPE_LENGTH (value_type) == 8)
&& TYPE_VECTOR (value_type))
return 0;
@@ -305,7 +349,7 @@ ppc_sysv_abi_broken_use_struct_convention (int gcc_p, struct type *value_type)
int
ppc_sysv_abi_use_struct_convention (int gcc_p, struct type *value_type)
{
- if (TYPE_LENGTH (value_type) == 16
+ if ((TYPE_LENGTH (value_type) == 16 || TYPE_LENGTH (value_type) == 8)
&& TYPE_VECTOR (value_type))
return 0;
diff --git a/gdb/ppc-tdep.h b/gdb/ppc-tdep.h
index cf81eb9..066cd99 100644
--- a/gdb/ppc-tdep.h
+++ b/gdb/ppc-tdep.h
@@ -22,6 +22,7 @@
#ifndef PPC_TDEP_H
#define PPC_TDEP_H
+struct gdbarch;
struct frame_info;
struct value;
@@ -49,6 +50,11 @@ void rs6000_frame_init_saved_regs (struct frame_info *);
CORE_ADDR rs6000_frame_chain (struct frame_info *);
int altivec_register_p (int regno);
+
+/* Return non-zero when the architecture has an FPU (or at least when
+ the ABI is using the FPU). */
+int ppc_floating_point_unit_p (struct gdbarch *gdbarch);
+
/* Private data that this module attaches to struct gdbarch. */
struct gdbarch_tdep
diff --git a/gdb/printcmd.c b/gdb/printcmd.c
index 167abba..8eea0db 100644
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -345,7 +345,7 @@ print_formatted (struct value *val, register int format, int size,
with a format. */
void
-print_scalar_formatted (char *valaddr, struct type *type, int format, int size,
+print_scalar_formatted (void *valaddr, struct type *type, int format, int size,
struct ui_file *stream)
{
LONGEST val_long;
@@ -1955,28 +1955,13 @@ print_frame_nameless_args (struct frame_info *fi, long start, int num,
for (i = 0; i < num; i++)
{
QUIT;
-#ifdef NAMELESS_ARG_VALUE
- NAMELESS_ARG_VALUE (fi, start, &arg_value);
-#else
- argsaddr = FRAME_ARGS_ADDRESS (fi);
+ argsaddr = get_frame_args_address (fi);
if (!argsaddr)
return;
-
arg_value = read_memory_integer (argsaddr + start, sizeof (int));
-#endif
-
if (!first)
fprintf_filtered (stream, ", ");
-
-#ifdef PRINT_NAMELESS_INTEGER
- PRINT_NAMELESS_INTEGER (stream, arg_value);
-#else
-#ifdef PRINT_TYPELESS_INTEGER
- PRINT_TYPELESS_INTEGER (stream, builtin_type_int, (LONGEST) arg_value);
-#else
fprintf_filtered (stream, "%ld", arg_value);
-#endif /* PRINT_TYPELESS_INTEGER */
-#endif /* PRINT_NAMELESS_INTEGER */
first = 0;
start += sizeof (int);
}
diff --git a/gdb/regcache.c b/gdb/regcache.c
index 3f2be7b..70af06f 100644
--- a/gdb/regcache.c
+++ b/gdb/regcache.c
@@ -389,59 +389,79 @@ register_buffer (struct regcache *regcache, int regnum)
}
void
-regcache_save (struct regcache *dst, struct regcache *src)
+regcache_save (struct regcache *dst, regcache_cooked_read_ftype *cooked_read,
+ void *src)
{
struct gdbarch *gdbarch = dst->descr->gdbarch;
+ void *buf = alloca (max_register_size (gdbarch));
int regnum;
- /* The SRC and DST register caches had better belong to the same
- architecture. */
- gdb_assert (src->descr->gdbarch == dst->descr->gdbarch);
/* The DST should be `read-only', if it wasn't then the save would
- end up trying to write the register values out through to the
+ end up trying to write the register values back out to the
target. */
- gdb_assert (!src->readonly_p);
gdb_assert (dst->readonly_p);
/* Clear the dest. */
memset (dst->registers, 0, dst->descr->sizeof_cooked_registers);
memset (dst->register_valid_p, 0, dst->descr->sizeof_cooked_register_valid_p);
/* Copy over any registers (identified by their membership in the
- save_reggroup) and mark them as valid. The full [0
- .. NUM_REGS+NUM_PSEUDO_REGS) range is checked since some
- architectures need to save/restore `cooked' registers that live
- in memory. */
+ save_reggroup) and mark them as valid. The full [0 .. NUM_REGS +
+ NUM_PSEUDO_REGS) range is checked since some architectures need
+ to save/restore `cooked' registers that live in memory. */
for (regnum = 0; regnum < dst->descr->nr_cooked_registers; regnum++)
{
if (gdbarch_register_reggroup_p (gdbarch, regnum, save_reggroup))
{
- regcache_cooked_read (src, regnum, register_buffer (dst, regnum));
- dst->register_valid_p[regnum] = 1;
+ int valid = cooked_read (src, regnum, buf);
+ if (valid)
+ {
+ memcpy (register_buffer (dst, regnum), buf,
+ register_size (gdbarch, regnum));
+ dst->register_valid_p[regnum] = 1;
+ }
}
}
}
void
-regcache_restore (struct regcache *dst, struct regcache *src)
+regcache_restore (struct regcache *dst,
+ regcache_cooked_read_ftype *cooked_read,
+ void *src)
{
struct gdbarch *gdbarch = dst->descr->gdbarch;
+ void *buf = alloca (max_register_size (gdbarch));
int regnum;
- gdb_assert (src->descr->gdbarch == dst->descr->gdbarch);
+ /* The dst had better not be read-only. If it is, the `restore'
+ doesn't make much sense. */
gdb_assert (!dst->readonly_p);
- gdb_assert (src->readonly_p);
/* Copy over any registers, being careful to only restore those that
- were both saved and need to be restored. The full [0
- .. NUM_REGS+NUM_PSEUDO_REGS) range is checked since some
- architectures need to save/restore `cooked' registers that live
- in memory. */
- for (regnum = 0; regnum < src->descr->nr_cooked_registers; regnum++)
+ were both saved and need to be restored. The full [0 .. NUM_REGS
+ + NUM_PSEUDO_REGS) range is checked since some architectures need
+ to save/restore `cooked' registers that live in memory. */
+ for (regnum = 0; regnum < dst->descr->nr_cooked_registers; regnum++)
{
- if (gdbarch_register_reggroup_p (gdbarch, regnum, restore_reggroup)
- && src->register_valid_p[regnum])
+ if (gdbarch_register_reggroup_p (gdbarch, regnum, restore_reggroup))
{
- regcache_cooked_write (dst, regnum, register_buffer (src, regnum));
+ int valid = cooked_read (src, regnum, buf);
+ if (valid)
+ regcache_cooked_write (dst, regnum, buf);
}
}
}
+static int
+do_cooked_read (void *src, int regnum, void *buf)
+{
+ struct regcache *regcache = src;
+ if (!regcache_valid_p (regcache, regnum)
+ && regcache->readonly_p)
+ /* Don't even think about fetching a register from a read-only
+ cache when the register isn't yet valid. There isn't a target
+ from which the register value can be fetched. */
+ return 0;
+ regcache_cooked_read (regcache, regnum, buf);
+ return 1;
+}
+
+
void
regcache_cpy (struct regcache *dst, struct regcache *src)
{
@@ -452,9 +472,9 @@ regcache_cpy (struct regcache *dst, struct regcache *src)
gdb_assert (src != dst);
gdb_assert (src->readonly_p || dst->readonly_p);
if (!src->readonly_p)
- regcache_save (dst, src);
+ regcache_save (dst, do_cooked_read, src);
else if (!dst->readonly_p)
- regcache_restore (dst, src);
+ regcache_restore (dst, do_cooked_read, src);
else
regcache_cpy_no_passthrough (dst, src);
}
@@ -864,7 +884,7 @@ regcache_cooked_read_signed (struct regcache *regcache, int regnum,
{
char *buf;
gdb_assert (regcache != NULL);
- gdb_assert (regnum >= 0 && regnum < regcache->descr->nr_raw_registers);
+ gdb_assert (regnum >= 0 && regnum < regcache->descr->nr_cooked_registers);
buf = alloca (regcache->descr->sizeof_register[regnum]);
regcache_cooked_read (regcache, regnum, buf);
(*val) = extract_signed_integer (buf,
@@ -877,13 +897,37 @@ regcache_cooked_read_unsigned (struct regcache *regcache, int regnum,
{
char *buf;
gdb_assert (regcache != NULL);
- gdb_assert (regnum >= 0 && regnum < regcache->descr->nr_raw_registers);
+ gdb_assert (regnum >= 0 && regnum < regcache->descr->nr_cooked_registers);
buf = alloca (regcache->descr->sizeof_register[regnum]);
regcache_cooked_read (regcache, regnum, buf);
(*val) = extract_unsigned_integer (buf,
regcache->descr->sizeof_register[regnum]);
}
+void
+regcache_cooked_write_signed (struct regcache *regcache, int regnum,
+ LONGEST val)
+{
+ void *buf;
+ gdb_assert (regcache != NULL);
+ gdb_assert (regnum >=0 && regnum < regcache->descr->nr_cooked_registers);
+ buf = alloca (regcache->descr->sizeof_register[regnum]);
+ store_signed_integer (buf, regcache->descr->sizeof_register[regnum], val);
+ regcache_cooked_write (regcache, regnum, buf);
+}
+
+void
+regcache_cooked_write_unsigned (struct regcache *regcache, int regnum,
+ ULONGEST val)
+{
+ void *buf;
+ gdb_assert (regcache != NULL);
+ gdb_assert (regnum >=0 && regnum < regcache->descr->nr_cooked_registers);
+ buf = alloca (regcache->descr->sizeof_register[regnum]);
+ store_unsigned_integer (buf, regcache->descr->sizeof_register[regnum], val);
+ regcache_cooked_write (regcache, regnum, buf);
+}
+
/* Write register REGNUM at MYADDR to the target. MYADDR points at
REGISTER_RAW_BYTES(REGNUM), which must be in target byte-order. */
@@ -1284,16 +1328,16 @@ regcache_collect (int regnum, void *buf)
}
-/* read_pc, write_pc, read_sp, write_sp, read_fp, etc. Special
- handling for registers PC, SP, and FP. */
+/* read_pc, write_pc, read_sp, read_fp, etc. Special handling for
+ registers PC, SP, and FP. */
/* NOTE: cagney/2001-02-18: The functions generic_target_read_pc(),
read_pc_pid(), read_pc(), generic_target_write_pc(),
write_pc_pid(), write_pc(), generic_target_read_sp(), read_sp(),
- generic_target_write_sp(), write_sp(), generic_target_read_fp() and
- read_fp(), will eventually be moved out of the reg-cache into
- either frame.[hc] or to the multi-arch framework. The are not part
- of the raw register cache. */
+ generic_target_write_sp(), generic_target_read_fp() and read_fp(),
+ will eventually be moved out of the reg-cache into either
+ frame.[hc] or to the multi-arch framework. The are not part of the
+ raw register cache. */
/* This routine is getting awfully cluttered with #if's. It's probably
time to turn this into READ_PC and define it in the tm.h file.
@@ -1412,12 +1456,6 @@ generic_target_write_sp (CORE_ADDR val)
"generic_target_write_sp");
}
-void
-write_sp (CORE_ADDR val)
-{
- TARGET_WRITE_SP (val);
-}
-
CORE_ADDR
generic_target_read_fp (void)
{
diff --git a/gdb/regcache.h b/gdb/regcache.h
index ee10505..3fb43c4 100644
--- a/gdb/regcache.h
+++ b/gdb/regcache.h
@@ -75,6 +75,10 @@ extern void regcache_cooked_read_signed (struct regcache *regcache,
int regnum, LONGEST *val);
extern void regcache_cooked_read_unsigned (struct regcache *regcache,
int regnum, ULONGEST *val);
+extern void regcache_cooked_write_signed (struct regcache *regcache,
+ int regnum, LONGEST val);
+extern void regcache_cooked_write_unsigned (struct regcache *regcache,
+ int regnum, ULONGEST val);
/* Partial transfer of a cooked register. These perform read, modify,
write style operations. */
@@ -94,7 +98,7 @@ extern void regcache_collect (int regnum, void *buf);
/* The register's ``offset''.
- FIXME: cagney/2002-11-07: The get_saved_register() function, when
+ FIXME: cagney/2002-11-07: The frame_register() function, when
specifying the real location of a register, does so using that
registers offset in the register cache. That offset is then used
by valops.c to determine the location of the register. The code
@@ -155,15 +159,19 @@ extern int max_register_size (struct gdbarch *gdbarch);
extern int register_size (struct gdbarch *gdbarch, int regnum);
-/* Save/restore a register cache. The registers saved/restored is
- determined by the save_reggroup and restore_reggroup (although you
- can't restore a register that wasn't saved as well :-). You can
- only save to a read-only cache (default from regcache_xmalloc())
- from a live cache and you can only restore from a read-only cache
- to a live cache. */
+/* Save/restore a register cache. The set of registers saved /
+ restored into the DST regcache determined by the save_reggroup /
+ restore_reggroup respectively. COOKED_READ returns zero iff the
+ register's value can't be returned. */
-extern void regcache_save (struct regcache *dst, struct regcache *src);
-extern void regcache_restore (struct regcache *dst, struct regcache *src);
+typedef int (regcache_cooked_read_ftype) (void *src, int regnum, void *buf);
+
+extern void regcache_save (struct regcache *dst,
+ regcache_cooked_read_ftype *cooked_read,
+ void *src);
+extern void regcache_restore (struct regcache *dst,
+ regcache_cooked_read_ftype *cooked_read,
+ void *src);
/* Copy/duplicate the contents of a register cache. By default, the
operation is pass-through. Writes to DST and reads from SRC will
diff --git a/gdb/reggroups.c b/gdb/reggroups.c
index 8c3cbb7..b72140e 100644
--- a/gdb/reggroups.c
+++ b/gdb/reggroups.c
@@ -149,7 +149,9 @@ default_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
return 1;
vector_p = TYPE_VECTOR (register_type (gdbarch, regnum));
float_p = TYPE_CODE (register_type (gdbarch, regnum)) == TYPE_CODE_FLT;
- raw_p = regnum < gdbarch_num_regs (gdbarch);
+ /* FIXME: cagney/2003-04-13: Can't yet use gdbarch_num_regs
+ (gdbarch), as not all architectures are multi-arch. */
+ raw_p = regnum < NUM_REGS;
if (group == float_reggroup)
return float_p;
if (group == vector_reggroup)
diff --git a/gdb/remote-utils.h b/gdb/remote-utils.h
index 3ca3bb4..cae5d5e 100644
--- a/gdb/remote-utils.h
+++ b/gdb/remote-utils.h
@@ -22,6 +22,8 @@
#ifndef REMOTE_UTILS_H
#define REMOTE_UTILS_H
+struct target_ops;
+
#include "target.h"
struct serial;
diff --git a/gdb/remote-vx.c b/gdb/remote-vx.c
index 19153cf..d9650e3 100644
--- a/gdb/remote-vx.c
+++ b/gdb/remote-vx.c
@@ -67,7 +67,7 @@
extern void vx_read_register ();
extern void vx_write_register ();
extern void symbol_file_command ();
-extern int stop_soon_quietly; /* for wait_for_inferior */
+extern enum stop_kind stop_soon; /* for wait_for_inferior */
static int net_step ();
static int net_ptrace_clnt_call (); /* Forward decl */
@@ -243,9 +243,9 @@ vx_create_inferior (char *exec_file, char *args, char **env)
/* Install inferior's terminal modes. */
target_terminal_inferior ();
- stop_soon_quietly = 1;
+ stop_soon = STOP_QUIETLY;
wait_for_inferior (); /* Get the task spawn event */
- stop_soon_quietly = 0;
+ stop_soon = NO_STOP_QUIETLY;
/* insert_step_breakpoint (); FIXME, do we need this? */
proceed (-1, TARGET_SIGNAL_DEFAULT, 0);
diff --git a/gdb/remote-vxsparc.c b/gdb/remote-vxsparc.c
index eb59b9f..a97c18e 100644
--- a/gdb/remote-vxsparc.c
+++ b/gdb/remote-vxsparc.c
@@ -97,10 +97,9 @@ vx_read_register (int regno)
bcopy (&sparc_greg_packet[SPARC_R_Y],
&deprecated_registers[REGISTER_BYTE (Y_REGNUM)], 6 * SPARC_GREG_SIZE);
- /* Now write the local and in registers to the register window
- spill area in the frame. VxWorks does not do this for the
- active frame automatically; it greatly simplifies debugging
- (FRAME_FIND_SAVED_REGS, in particular, depends on this). */
+ /* Now write the local and in registers to the register window spill
+ area in the frame. VxWorks does not do this for the active frame
+ automatically; it greatly simplifies debugging. */
sp = extract_address (&deprecated_registers[REGISTER_BYTE (SP_REGNUM)],
REGISTER_RAW_SIZE (SP_REGNUM));
diff --git a/gdb/remote.h b/gdb/remote.h
index e2171b2..4477148 100644
--- a/gdb/remote.h
+++ b/gdb/remote.h
@@ -54,4 +54,7 @@ extern void remote_cisco_objfile_relocate (bfd_signed_vma text_off,
extern void async_remote_interrupt_twice (void *arg);
+extern void (*target_resume_hook) (void);
+extern void (*target_wait_loop_hook) (void);
+
#endif
diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c
index ac33578..b70917e 100644
--- a/gdb/rs6000-tdep.c
+++ b/gdb/rs6000-tdep.c
@@ -137,6 +137,18 @@ altivec_register_p (int regno)
return (regno >= tdep->ppc_vr0_regnum && regno <= tdep->ppc_vrsave_regnum);
}
+/* Use the architectures FP registers? */
+int
+ppc_floating_point_unit_p (struct gdbarch *gdbarch)
+{
+ const struct bfd_arch_info *info = gdbarch_bfd_arch_info (gdbarch);
+ if (info->arch == bfd_arch_powerpc)
+ return (info->mach != bfd_mach_ppc_e500);
+ if (info->arch == bfd_arch_rs6000)
+ return 1;
+ return 0;
+}
+
/* Read a LEN-byte address from debugged memory address MEMADDR. */
static CORE_ADDR
@@ -978,7 +990,7 @@ rs6000_pop_frame (void)
still in the link register, otherwise walk the frames and retrieve the
saved %pc value in the previous frame. */
- addr = get_pc_function_start (get_frame_pc (frame));
+ addr = get_frame_func (frame);
(void) skip_prologue (addr, get_frame_pc (frame), &fdata);
wordsize = gdbarch_tdep (current_gdbarch)->wordsize;
@@ -1487,7 +1499,7 @@ rs6000_frameless_function_invocation (struct frame_info *fi)
&& !(get_frame_type (get_next_frame (fi)) == SIGTRAMP_FRAME))
return 0;
- func_start = get_pc_function_start (get_frame_pc (fi));
+ func_start = get_frame_func (fi);
/* If we failed to find the start of the function, it is a mistake
to inspect the instructions. */
@@ -1528,7 +1540,7 @@ rs6000_frame_saved_pc (struct frame_info *fi)
return deprecated_read_register_dummy (get_frame_pc (fi),
get_frame_base (fi), PC_REGNUM);
- func_start = get_pc_function_start (get_frame_pc (fi));
+ func_start = get_frame_func (fi);
/* If we failed to find the start of the function, it is a mistake
to inspect the instructions. */
@@ -1554,14 +1566,16 @@ rs6000_frame_saved_pc (struct frame_info *fi)
return lr;
}
else
- return read_memory_addr (FRAME_CHAIN (fi) + tdep->lr_frame_offset,
+ return read_memory_addr (DEPRECATED_FRAME_CHAIN (fi)
+ + tdep->lr_frame_offset,
wordsize);
}
if (fdata.lr_offset == 0)
return read_register (gdbarch_tdep (current_gdbarch)->ppc_lr_regnum);
- return read_memory_addr (FRAME_CHAIN (fi) + fdata.lr_offset, wordsize);
+ return read_memory_addr (DEPRECATED_FRAME_CHAIN (fi) + fdata.lr_offset,
+ wordsize);
}
/* If saved registers of frame FI are not known yet, read and cache them.
@@ -1582,8 +1596,7 @@ frame_get_saved_regs (struct frame_info *fi, struct rs6000_framedata *fdatap)
if (fdatap == NULL)
{
fdatap = &work_fdata;
- (void) skip_prologue (get_pc_function_start (get_frame_pc (fi)),
- get_frame_pc (fi), fdatap);
+ (void) skip_prologue (get_frame_func (fi), get_frame_pc (fi), fdatap);
}
frame_saved_regs_zalloc (fi);
@@ -1608,7 +1621,7 @@ frame_get_saved_regs (struct frame_info *fi, struct rs6000_framedata *fdatap)
->frame pointed to the outer-most address of the frame. In the
mean time, the address of the prev frame is used as the base
address of this frame. */
- frame_addr = FRAME_CHAIN (fi);
+ frame_addr = DEPRECATED_FRAME_CHAIN (fi);
/* if != -1, fdatap->saved_fpr is the smallest number of saved_fpr.
All fpr's from saved_fpr to fp31 are saved. */
@@ -1633,7 +1646,7 @@ frame_get_saved_regs (struct frame_info *fi, struct rs6000_framedata *fdatap)
CORE_ADDR gpr_addr = frame_addr + fdatap->gpr_offset;
for (i = fdatap->saved_gpr; i < 32; i++)
{
- get_frame_saved_regs (fi)[i] = gpr_addr;
+ get_frame_saved_regs (fi)[tdep->ppc_gp0_regnum + i] = gpr_addr;
gpr_addr += wordsize;
}
}
@@ -1706,8 +1719,7 @@ frame_initial_stack_address (struct frame_info *fi)
/* Find out if this function is using an alloca register. */
- (void) skip_prologue (get_pc_function_start (get_frame_pc (fi)),
- get_frame_pc (fi), &fdata);
+ (void) skip_prologue (get_frame_func (fi), get_frame_pc (fi), &fdata);
/* If saved registers of this frame are not known yet, read and
cache them. */
@@ -1746,8 +1758,8 @@ frame_initial_stack_address (struct frame_info *fi)
/* Describe the pointer in each stack frame to the previous stack frame
(its caller). */
-/* FRAME_CHAIN takes a frame's nominal address
- and produces the frame's chain-pointer. */
+/* DEPRECATED_FRAME_CHAIN takes a frame's nominal address and produces
+ the frame's chain-pointer. */
/* In the case of the RS/6000, the frame's nominal address
is the address of a 4-byte word containing the calling frame's address. */
@@ -1880,8 +1892,8 @@ rs6000_register_convert_to_virtual (int n, struct type *type,
{
if (TYPE_LENGTH (type) != REGISTER_RAW_SIZE (n))
{
- double val = extract_floating (from, REGISTER_RAW_SIZE (n));
- store_floating (to, TYPE_LENGTH (type), val);
+ double val = deprecated_extract_floating (from, REGISTER_RAW_SIZE (n));
+ deprecated_store_floating (to, TYPE_LENGTH (type), val);
}
else
memcpy (to, from, REGISTER_RAW_SIZE (n));
@@ -1896,8 +1908,8 @@ rs6000_register_convert_to_raw (struct type *type, int n,
{
if (TYPE_LENGTH (type) != REGISTER_RAW_SIZE (n))
{
- double val = extract_floating (from, TYPE_LENGTH (type));
- store_floating (to, REGISTER_RAW_SIZE (n), val);
+ double val = deprecated_extract_floating (from, TYPE_LENGTH (type));
+ deprecated_store_floating (to, REGISTER_RAW_SIZE (n), val);
}
else
memcpy (to, from, REGISTER_RAW_SIZE (n));
@@ -2062,10 +2074,10 @@ rs6000_extract_struct_value_address (struct regcache *regcache)
/* FIXME: cagney/2002-09-26: PR gdb/724: When making an inferior
function call GDB knows the address of the struct return value
and hence, should not need to call this function. Unfortunately,
- the current hand_function_call() code only saves the most recent
- struct address leading to occasional calls. The code should
- instead maintain a stack of such addresses (in the dummy frame
- object). */
+ the current call_function_by_hand() code only saves the most
+ recent struct address leading to occasional calls. The code
+ should instead maintain a stack of such addresses (in the dummy
+ frame object). */
/* NOTE: cagney/2002-09-26: Return 0 which indicates that we've
really got no idea where the return value is being stored. While
r3, on function entry, contained the address it will have since
@@ -2727,9 +2739,9 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
else
{
arch = bfd_arch_powerpc;
- mach = 0;
- bfd_default_set_arch_mach (&abfd, arch, mach);
+ bfd_default_set_arch_mach (&abfd, arch, 0);
info.bfd_arch_info = bfd_get_arch_info (&abfd);
+ mach = info.bfd_arch_info->mach;
}
tdep = xmalloc (sizeof (struct gdbarch_tdep));
tdep->wordsize = wordsize;
@@ -2862,7 +2874,7 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_write_pc (gdbarch, generic_target_write_pc);
set_gdbarch_read_fp (gdbarch, generic_target_read_fp);
set_gdbarch_read_sp (gdbarch, generic_target_read_sp);
- set_gdbarch_write_sp (gdbarch, generic_target_write_sp);
+ set_gdbarch_deprecated_dummy_write_sp (gdbarch, generic_target_write_sp);
set_gdbarch_num_regs (gdbarch, v->nregs);
set_gdbarch_num_pseudo_regs (gdbarch, v->npregs);
@@ -2886,17 +2898,10 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_long_double_bit (gdbarch, 8 * TARGET_CHAR_BIT);
set_gdbarch_char_signed (gdbarch, 0);
- set_gdbarch_call_dummy_length (gdbarch, 0);
- set_gdbarch_call_dummy_address (gdbarch, entry_point_address);
- set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 1);
- set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 0);
- set_gdbarch_call_dummy_start_offset (gdbarch, 0);
- set_gdbarch_call_dummy_p (gdbarch, 1);
- set_gdbarch_call_dummy_stack_adjust_p (gdbarch, 0);
set_gdbarch_fix_call_dummy (gdbarch, rs6000_fix_call_dummy);
set_gdbarch_frame_align (gdbarch, rs6000_frame_align);
set_gdbarch_save_dummy_frame_tos (gdbarch, generic_save_dummy_frame_tos);
- set_gdbarch_push_return_address (gdbarch, ppc_push_return_address);
+ set_gdbarch_deprecated_push_return_address (gdbarch, ppc_push_return_address);
set_gdbarch_believe_pcc_promotion (gdbarch, 1);
set_gdbarch_register_convertible (gdbarch, rs6000_register_convertible);
@@ -2911,13 +2916,13 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
64-bit code. At some point in the future, this matter needs to be
revisited. */
if (sysv_abi && wordsize == 4)
- set_gdbarch_push_arguments (gdbarch, ppc_sysv_abi_push_arguments);
+ set_gdbarch_deprecated_push_arguments (gdbarch, ppc_sysv_abi_push_arguments);
else
- set_gdbarch_push_arguments (gdbarch, rs6000_push_arguments);
+ set_gdbarch_deprecated_push_arguments (gdbarch, rs6000_push_arguments);
- set_gdbarch_store_struct_return (gdbarch, rs6000_store_struct_return);
+ set_gdbarch_deprecated_store_struct_return (gdbarch, rs6000_store_struct_return);
set_gdbarch_extract_struct_value_address (gdbarch, rs6000_extract_struct_value_address);
- set_gdbarch_pop_frame (gdbarch, rs6000_pop_frame);
+ set_gdbarch_deprecated_pop_frame (gdbarch, rs6000_pop_frame);
set_gdbarch_skip_prologue (gdbarch, rs6000_skip_prologue);
set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
@@ -2937,8 +2942,8 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_frameless_function_invocation (gdbarch,
rs6000_frameless_function_invocation);
- set_gdbarch_frame_chain (gdbarch, rs6000_frame_chain);
- set_gdbarch_frame_saved_pc (gdbarch, rs6000_frame_saved_pc);
+ set_gdbarch_deprecated_frame_chain (gdbarch, rs6000_frame_chain);
+ set_gdbarch_deprecated_frame_saved_pc (gdbarch, rs6000_frame_saved_pc);
set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, rs6000_frame_init_saved_regs);
set_gdbarch_deprecated_init_extra_frame_info (gdbarch, rs6000_init_extra_frame_info);
@@ -2952,7 +2957,7 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
}
set_gdbarch_frame_args_address (gdbarch, rs6000_frame_args_address);
set_gdbarch_frame_locals_address (gdbarch, rs6000_frame_args_address);
- set_gdbarch_saved_pc_after_call (gdbarch, rs6000_saved_pc_after_call);
+ set_gdbarch_deprecated_saved_pc_after_call (gdbarch, rs6000_saved_pc_after_call);
/* We can't tell how many args there are
now that the C compiler delays popping them. */
diff --git a/gdb/s390-nat.c b/gdb/s390-nat.c
index b7f5918..63e779b 100644
--- a/gdb/s390-nat.c
+++ b/gdb/s390-nat.c
@@ -25,6 +25,7 @@
#include <asm/ptrace.h>
#include <sys/ptrace.h>
#include <asm/processor.h>
+#include <asm/types.h>
#include <sys/procfs.h>
#include <sys/user.h>
#include <value.h>
diff --git a/gdb/s390-tdep.c b/gdb/s390-tdep.c
index 9ad34c8..e50a46d 100644
--- a/gdb/s390-tdep.c
+++ b/gdb/s390-tdep.c
@@ -775,7 +775,7 @@ s390_function_start (struct frame_info *fi)
if (get_frame_extra_info (fi) && get_frame_extra_info (fi)->initialised)
function_start = get_frame_extra_info (fi)->function_start;
else if (get_frame_pc (fi))
- function_start = get_pc_function_start (get_frame_pc (fi));
+ function_start = get_frame_func (fi);
return function_start;
}
@@ -1221,7 +1221,7 @@ s390_pop_frame_regular (struct frame_info *frame)
{
int regnum;
- write_register (S390_PC_REGNUM, FRAME_SAVED_PC (frame));
+ write_register (S390_PC_REGNUM, DEPRECATED_FRAME_SAVED_PC (frame));
/* Restore any saved registers. */
if (get_frame_saved_regs (frame))
@@ -1808,19 +1808,19 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_frame_args_skip (gdbarch, 0);
set_gdbarch_frame_args_address (gdbarch, s390_frame_args_address);
- set_gdbarch_frame_chain (gdbarch, s390_frame_chain);
+ set_gdbarch_deprecated_frame_chain (gdbarch, s390_frame_chain);
set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, s390_frame_init_saved_regs);
set_gdbarch_frame_locals_address (gdbarch, s390_frame_args_address);
/* We can't do this */
set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown);
- set_gdbarch_store_struct_return (gdbarch, s390_store_struct_return);
+ set_gdbarch_deprecated_store_struct_return (gdbarch, s390_store_struct_return);
set_gdbarch_deprecated_extract_return_value (gdbarch, s390_extract_return_value);
set_gdbarch_deprecated_store_return_value (gdbarch, s390_store_return_value);
/* Amount PC must be decremented by after a breakpoint.
This is often the number of bytes in BREAKPOINT
but not always. */
set_gdbarch_decr_pc_after_break (gdbarch, 2);
- set_gdbarch_pop_frame (gdbarch, s390_pop_frame);
+ set_gdbarch_deprecated_pop_frame (gdbarch, s390_pop_frame);
/* Stack grows downward. */
set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
/* Offset from address of function to start of its code.
@@ -1839,11 +1839,11 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_frameless_function_invocation (gdbarch,
s390_frameless_function_invocation);
/* Return saved PC from a frame */
- set_gdbarch_frame_saved_pc (gdbarch, s390_frame_saved_pc);
- /* FRAME_CHAIN takes a frame's nominal address
- and produces the frame's chain-pointer. */
- set_gdbarch_frame_chain (gdbarch, s390_frame_chain);
- set_gdbarch_saved_pc_after_call (gdbarch, s390_saved_pc_after_call);
+ set_gdbarch_deprecated_frame_saved_pc (gdbarch, s390_frame_saved_pc);
+ /* DEPRECATED_FRAME_CHAIN takes a frame's nominal address and
+ produces the frame's chain-pointer. */
+ set_gdbarch_deprecated_frame_chain (gdbarch, s390_frame_chain);
+ set_gdbarch_deprecated_saved_pc_after_call (gdbarch, s390_saved_pc_after_call);
set_gdbarch_register_byte (gdbarch, s390_register_byte);
set_gdbarch_pc_regnum (gdbarch, S390_PC_REGNUM);
set_gdbarch_sp_regnum (gdbarch, S390_SP_REGNUM);
@@ -1861,18 +1861,11 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
(gdbarch, generic_cannot_extract_struct_value_address);
/* Parameters for inferior function calls. */
- set_gdbarch_call_dummy_p (gdbarch, 1);
- set_gdbarch_call_dummy_length (gdbarch, 0);
- set_gdbarch_call_dummy_address (gdbarch, entry_point_address);
- set_gdbarch_call_dummy_start_offset (gdbarch, 0);
set_gdbarch_deprecated_pc_in_call_dummy (gdbarch, deprecated_pc_in_call_dummy_at_entry_point);
- set_gdbarch_push_arguments (gdbarch, s390_push_arguments);
+ set_gdbarch_deprecated_push_arguments (gdbarch, s390_push_arguments);
set_gdbarch_save_dummy_frame_tos (gdbarch, generic_save_dummy_frame_tos);
- set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 1);
- set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 0);
- set_gdbarch_call_dummy_stack_adjust_p (gdbarch, 0);
- set_gdbarch_fix_call_dummy (gdbarch, generic_fix_call_dummy);
- set_gdbarch_push_return_address (gdbarch, s390_push_return_address);
+ set_gdbarch_deprecated_push_return_address (gdbarch,
+ s390_push_return_address);
set_gdbarch_sizeof_call_dummy_words (gdbarch,
sizeof (s390_call_dummy_words));
set_gdbarch_call_dummy_words (gdbarch, s390_call_dummy_words);
@@ -1908,6 +1901,9 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
break;
}
+ /* Should be using push_dummy_call. */
+ set_gdbarch_deprecated_dummy_write_sp (gdbarch, generic_target_write_sp);
+
return gdbarch;
}
diff --git a/gdb/scm-lang.c b/gdb/scm-lang.c
index 4bbcd8e..99a1fd5 100644
--- a/gdb/scm-lang.c
+++ b/gdb/scm-lang.c
@@ -250,6 +250,8 @@ const struct language_defn scm_language_defn =
c_print_type, /* Print a type using appropriate syntax */
scm_val_print, /* Print a value using appropriate syntax */
scm_value_print, /* Print a top-level value */
+ NULL, /* Language specific skip_trampoline */
+ NULL, /* Language specific symbol demangler */
{"", "", "", ""}, /* Binary format info */
{"#o%lo", "#o", "o", ""}, /* Octal format info */
{"%ld", "", "d", ""}, /* Decimal format info */
diff --git a/gdb/sentinel-frame.c b/gdb/sentinel-frame.c
index fe11d8a..dab1647 100644
--- a/gdb/sentinel-frame.c
+++ b/gdb/sentinel-frame.c
@@ -45,13 +45,13 @@ sentinel_frame_cache (struct regcache *regcache)
/* Here the register value is taken direct from the register cache. */
void
-sentinel_frame_register_unwind (struct frame_info *frame,
- void **unwind_cache,
- int regnum, int *optimized,
- enum lval_type *lvalp, CORE_ADDR *addrp,
- int *realnum, void *bufferp)
+sentinel_frame_prev_register (struct frame_info *next_frame,
+ void **this_prologue_cache,
+ int regnum, int *optimized,
+ enum lval_type *lvalp, CORE_ADDR *addrp,
+ int *realnum, void *bufferp)
{
- struct frame_unwind_cache *cache = *unwind_cache;
+ struct frame_unwind_cache *cache = *this_prologue_cache;
/* Describe the register's location. A reg-frame maps all registers
onto the corresponding hardware register. */
*optimized = 0;
@@ -70,44 +70,23 @@ sentinel_frame_register_unwind (struct frame_info *frame,
}
}
-CORE_ADDR
-sentinel_frame_pc_unwind (struct frame_info *frame,
- void **cache)
-{
- /* FIXME: cagney/2003-01-08: This should be using a per-architecture
- method that doesn't suffer from DECR_PC_AFTER_BREAK problems.
- Such a method would take unwind_cache, regcache and stop reason
- parameters. */
- return read_pc ();
-}
-
void
-sentinel_frame_id_unwind (struct frame_info *frame,
- void **cache,
- struct frame_id *id)
-{
- /* FIXME: cagney/2003-01-08: This should be using a per-architecture
- method that doesn't suffer from DECR_PC_AFTER_BREAK problems.
- Such a method would take unwind_cache, regcache and stop reason
- parameters. */
- id->base = read_fp ();
- id->pc = read_pc ();
-}
-
-static void
-sentinel_frame_pop (struct frame_info *frame,
- void **cache,
- struct regcache *regcache)
+sentinel_frame_this_id (struct frame_info *next_frame,
+ void **this_prologue_cache,
+ struct frame_id *this_id)
{
- internal_error (__FILE__, __LINE__, "Function sentinal_frame_pop called");
+ /* The sentinel frame is used as a starting point for creating the
+ previous (inner most) frame. That frame's THIS_ID method will be
+ called to determine the inner most frame's ID. Not this one. */
+ internal_error (__FILE__, __LINE__, "sentinel_frame_this_id called");
}
const struct frame_unwind sentinel_frame_unwinder =
{
- sentinel_frame_pop,
- sentinel_frame_pc_unwind,
- sentinel_frame_id_unwind,
- sentinel_frame_register_unwind
+ /* Should the sentinel frame be given a special type? */
+ NORMAL_FRAME,
+ sentinel_frame_this_id,
+ sentinel_frame_prev_register
};
const struct frame_unwind *const sentinel_frame_unwind = &sentinel_frame_unwinder;
diff --git a/gdb/ser-unix.h b/gdb/ser-unix.h
index f7be059..3bdf0bc 100644
--- a/gdb/ser-unix.h
+++ b/gdb/ser-unix.h
@@ -22,6 +22,9 @@
#ifndef SER_UNIX_H
#define SER_UNIX_H
+struct serial;
+struct ui_file;
+
/* Generic UNIX/FD functions */
extern int ser_unix_nop_flush_output (struct serial *scb);
diff --git a/gdb/serial.h b/gdb/serial.h
index 97d68f3..7495b70 100644
--- a/gdb/serial.h
+++ b/gdb/serial.h
@@ -22,6 +22,8 @@
#ifndef SERIAL_H
#define SERIAL_H
+struct ui_file;
+
/* For most routines, if a failure is indicated, then errno should be
examined. */
diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c
index 91f3f62..0390e95 100644
--- a/gdb/sh-tdep.c
+++ b/gdb/sh-tdep.c
@@ -1116,7 +1116,7 @@ sh_nofp_frame_init_saved_regs (struct frame_info *fi)
that does not appear to be part of the prologue. But give up
after 20 of them, since we're getting silly then. */
- pc = get_pc_function_start (get_frame_pc (fi));
+ pc = get_frame_func (fi);
if (!pc)
{
deprecated_update_frame_pc_hack (fi, 0);
@@ -1456,7 +1456,7 @@ sh64_nofp_frame_init_saved_regs (struct frame_info *fi)
that does not appear to be part of the prologue. But give up
after 20 of them, since we're getting silly then. */
- pc = get_pc_function_start (get_frame_pc (fi));
+ pc = get_frame_func (fi);
if (!pc)
{
deprecated_update_frame_pc_hack (fi, 0);
@@ -1657,7 +1657,7 @@ sh_fp_frame_init_saved_regs (struct frame_info *fi)
that does not appear to be part of the prologue. But give up
after 20 of them, since we're getting silly then. */
- pc = get_pc_function_start (get_frame_pc (fi));
+ pc = get_frame_func (fi);
if (!pc)
{
deprecated_update_frame_pc_hack (fi, 0);
@@ -1758,7 +1758,7 @@ sh_init_extra_frame_info (int fromleaf, struct frame_info *fi)
frame_extra_info_zalloc (fi, sizeof (struct frame_extra_info));
if (get_next_frame (fi))
- deprecated_update_frame_pc_hack (fi, FRAME_SAVED_PC (get_next_frame (fi)));
+ deprecated_update_frame_pc_hack (fi, DEPRECATED_FRAME_SAVED_PC (get_next_frame (fi)));
if (DEPRECATED_PC_IN_CALL_DUMMY (get_frame_pc (fi), get_frame_base (fi),
get_frame_base (fi)))
@@ -1790,7 +1790,7 @@ sh64_init_extra_frame_info (int fromleaf, struct frame_info *fi)
frame_extra_info_zalloc (fi, sizeof (struct frame_extra_info));
if (get_next_frame (fi))
- deprecated_update_frame_pc_hack (fi, FRAME_SAVED_PC (get_next_frame (fi)));
+ deprecated_update_frame_pc_hack (fi, DEPRECATED_FRAME_SAVED_PC (get_next_frame (fi)));
if (DEPRECATED_PC_IN_CALL_DUMMY (get_frame_pc (fi), get_frame_base (fi),
get_frame_base (fi)))
@@ -2414,7 +2414,7 @@ sh3e_sh4_extract_return_value (struct type *type, char *regbuf, char *valbuf)
floatformat_to_doublest (&floatformat_ieee_double_big,
(char *) regbuf + REGISTER_BYTE (return_register),
&val);
- store_floating (valbuf, len, val);
+ deprecated_store_floating (valbuf, len, val);
}
else if (len <= 4)
{
@@ -2467,7 +2467,7 @@ sh64_extract_return_value (struct type *type, char *regbuf, char *valbuf)
else
floatformat_to_doublest (&floatformat_ieee_double_big,
(char *) regbuf + offset, &val);
- store_floating (valbuf, len, val);
+ deprecated_store_floating (valbuf, len, val);
}
}
else
@@ -3403,7 +3403,7 @@ sh_sh4_register_convert_to_virtual (int regnum, struct type *type,
{
DOUBLEST val;
floatformat_to_doublest (&floatformat_ieee_double_littlebyte_bigword, from, &val);
- store_floating (to, TYPE_LENGTH (type), val);
+ deprecated_store_floating (to, TYPE_LENGTH (type), val);
}
else
error ("sh_register_convert_to_virtual called with non DR register number");
@@ -3429,7 +3429,7 @@ sh_sh64_register_convert_to_virtual (int regnum, struct type *type,
{
DOUBLEST val;
floatformat_to_doublest (&floatformat_ieee_double_littlebyte_bigword, from, &val);
- store_floating(to, TYPE_LENGTH(type), val);
+ deprecated_store_floating(to, TYPE_LENGTH(type), val);
}
else
error("sh_register_convert_to_virtual called with non DR register number");
@@ -3444,7 +3444,7 @@ sh_sh4_register_convert_to_raw (struct type *type, int regnum,
if (regnum >= tdep->DR0_REGNUM
&& regnum <= tdep->DR_LAST_REGNUM)
{
- DOUBLEST val = extract_floating (from, TYPE_LENGTH(type));
+ DOUBLEST val = deprecated_extract_floating (from, TYPE_LENGTH(type));
floatformat_from_doublest (&floatformat_ieee_double_littlebyte_bigword, &val, to);
}
else
@@ -3469,7 +3469,7 @@ sh_sh64_register_convert_to_raw (struct type *type, int regnum,
|| (regnum >= tdep->DR0_C_REGNUM
&& regnum <= tdep->DR_LAST_C_REGNUM))
{
- DOUBLEST val = extract_floating (from, TYPE_LENGTH(type));
+ DOUBLEST val = deprecated_extract_floating (from, TYPE_LENGTH(type));
floatformat_from_doublest (&floatformat_ieee_double_littlebyte_bigword, &val, to);
}
else
@@ -4371,15 +4371,15 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_register_bytes (gdbarch, SH_DEFAULT_NUM_REGS * 4);
set_gdbarch_deprecated_do_registers_info (gdbarch, sh_do_registers_info);
set_gdbarch_breakpoint_from_pc (gdbarch, sh_breakpoint_from_pc);
- set_gdbarch_frame_chain (gdbarch, sh_frame_chain);
- set_gdbarch_get_saved_register (gdbarch, deprecated_generic_get_saved_register);
+ set_gdbarch_deprecated_frame_chain (gdbarch, sh_frame_chain);
+ set_gdbarch_deprecated_get_saved_register (gdbarch, deprecated_generic_get_saved_register);
set_gdbarch_deprecated_init_extra_frame_info (gdbarch, sh_init_extra_frame_info);
set_gdbarch_deprecated_extract_return_value (gdbarch, sh_extract_return_value);
- set_gdbarch_push_arguments (gdbarch, sh_push_arguments);
- set_gdbarch_store_struct_return (gdbarch, sh_store_struct_return);
+ set_gdbarch_deprecated_push_arguments (gdbarch, sh_push_arguments);
+ set_gdbarch_deprecated_store_struct_return (gdbarch, sh_store_struct_return);
set_gdbarch_use_struct_convention (gdbarch, sh_use_struct_convention);
set_gdbarch_deprecated_extract_struct_value_address (gdbarch, sh_extract_struct_value_address);
- set_gdbarch_pop_frame (gdbarch, sh_pop_frame);
+ set_gdbarch_deprecated_pop_frame (gdbarch, sh_pop_frame);
set_gdbarch_print_insn (gdbarch, gdb_print_insn_sh);
set_gdbarch_register_sim_regno (gdbarch, legacy_register_sim_regno);
skip_prologue_hard_way = sh_skip_prologue_hard_way;
@@ -4614,14 +4614,14 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, sh64_nofp_frame_init_saved_regs);
set_gdbarch_breakpoint_from_pc (gdbarch, sh_sh64_breakpoint_from_pc);
set_gdbarch_deprecated_init_extra_frame_info (gdbarch, sh64_init_extra_frame_info);
- set_gdbarch_frame_chain (gdbarch, sh64_frame_chain);
- set_gdbarch_get_saved_register (gdbarch, sh64_get_saved_register);
+ set_gdbarch_deprecated_frame_chain (gdbarch, sh64_frame_chain);
+ set_gdbarch_deprecated_get_saved_register (gdbarch, sh64_get_saved_register);
set_gdbarch_deprecated_extract_return_value (gdbarch, sh64_extract_return_value);
- set_gdbarch_push_arguments (gdbarch, sh64_push_arguments);
- /*set_gdbarch_store_struct_return (gdbarch, sh64_store_struct_return);*/
+ set_gdbarch_deprecated_push_arguments (gdbarch, sh64_push_arguments);
+ /*set_gdbarch_deprecated_store_struct_return (gdbarch, sh64_store_struct_return);*/
set_gdbarch_deprecated_extract_struct_value_address (gdbarch, sh64_extract_struct_value_address);
set_gdbarch_use_struct_convention (gdbarch, sh64_use_struct_convention);
- set_gdbarch_pop_frame (gdbarch, sh64_pop_frame);
+ set_gdbarch_deprecated_pop_frame (gdbarch, sh64_pop_frame);
set_gdbarch_elf_make_msymbol_special (gdbarch,
sh64_elf_make_msymbol_special);
break;
@@ -4641,7 +4641,7 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_write_pc (gdbarch, generic_target_write_pc);
set_gdbarch_read_fp (gdbarch, generic_target_read_fp);
set_gdbarch_read_sp (gdbarch, generic_target_read_sp);
- set_gdbarch_write_sp (gdbarch, generic_target_write_sp);
+ set_gdbarch_deprecated_dummy_write_sp (gdbarch, generic_target_write_sp);
set_gdbarch_register_name (gdbarch, sh_register_name);
set_gdbarch_register_virtual_type (gdbarch, sh_register_virtual_type);
@@ -4653,18 +4653,10 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_double_bit (gdbarch, 8 * TARGET_CHAR_BIT);
set_gdbarch_long_double_bit (gdbarch, 8 * TARGET_CHAR_BIT);
- set_gdbarch_call_dummy_length (gdbarch, 0);
- set_gdbarch_call_dummy_address (gdbarch, entry_point_address);
- set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 1); /*???*/
- set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 0);
- set_gdbarch_call_dummy_start_offset (gdbarch, 0);
set_gdbarch_call_dummy_words (gdbarch, sh_call_dummy_words);
set_gdbarch_sizeof_call_dummy_words (gdbarch, sizeof (sh_call_dummy_words));
- set_gdbarch_call_dummy_p (gdbarch, 1);
- set_gdbarch_call_dummy_stack_adjust_p (gdbarch, 0);
- set_gdbarch_fix_call_dummy (gdbarch, generic_fix_call_dummy);
- set_gdbarch_push_return_address (gdbarch, sh_push_return_address);
+ set_gdbarch_deprecated_push_return_address (gdbarch, sh_push_return_address);
set_gdbarch_deprecated_store_return_value (gdbarch, sh_store_return_value);
set_gdbarch_skip_prologue (gdbarch, sh_skip_prologue);
@@ -4674,8 +4666,8 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_frame_args_skip (gdbarch, 0);
set_gdbarch_frameless_function_invocation (gdbarch, frameless_look_for_prologue);
- set_gdbarch_frame_saved_pc (gdbarch, sh_frame_saved_pc);
- set_gdbarch_saved_pc_after_call (gdbarch, sh_saved_pc_after_call);
+ set_gdbarch_deprecated_frame_saved_pc (gdbarch, sh_frame_saved_pc);
+ set_gdbarch_deprecated_saved_pc_after_call (gdbarch, sh_saved_pc_after_call);
set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown);
set_gdbarch_believe_pcc_promotion (gdbarch, 1);
diff --git a/gdb/signals/signals.c b/gdb/signals/signals.c
index 82c63d8..ca46a9e 100644
--- a/gdb/signals/signals.c
+++ b/gdb/signals/signals.c
@@ -30,6 +30,20 @@
#include <signal.h>
+/* Always use __SIGRTMIN if it's available. SIGRTMIN is the lowest
+ _available_ realtime signal, not the lowest supported; glibc takes
+ several for its own use. */
+
+#ifndef REALTIME_LO
+# if defined(__SIGRTMIN)
+# define REALTIME_LO __SIGRTMIN
+# define REALTIME_HI __SIGRTMAX
+# elif defined(SIGRTMIN)
+# define REALTIME_LO SIGRTMIN
+# define REALTIME_HI SIGRTMAX
+# endif
+#endif
+
/* This table must match in order and size the signals in enum target_signal
in target.h. */
/* *INDENT-OFF* */
@@ -492,22 +506,6 @@ target_signal_from_host (int hostsig)
}
#endif
-#if defined (SIGRTMIN)
- if (hostsig >= SIGRTMIN && hostsig <= SIGRTMAX)
- {
- /* This block of TARGET_SIGNAL_REALTIME value is in order. */
- if (33 <= hostsig && hostsig <= 63)
- return (enum target_signal)
- (hostsig - 33 + (int) TARGET_SIGNAL_REALTIME_33);
- else if (hostsig == 32)
- return TARGET_SIGNAL_REALTIME_32;
- else if (64 <= hostsig && hostsig <= 127)
- return (enum target_signal)
- (hostsig - 64 + (int) TARGET_SIGNAL_REALTIME_64);
- else
- error ("GDB bug: target.c (target_signal_from_host): unrecognized real-time signal");
- }
-#endif
return TARGET_SIGNAL_UNKNOWN;
}
@@ -520,6 +518,8 @@ static int
do_target_signal_to_host (enum target_signal oursig,
int *oursig_ok)
{
+ int retsig;
+
*oursig_ok = 1;
switch (oursig)
{
@@ -744,66 +744,33 @@ do_target_signal_to_host (enum target_signal oursig,
default:
#if defined (REALTIME_LO)
- if (oursig >= TARGET_SIGNAL_REALTIME_33
- && oursig <= TARGET_SIGNAL_REALTIME_63)
- {
- /* This block of signals is continuous, and
- TARGET_SIGNAL_REALTIME_33 is 33 by definition. */
- int retsig =
- (int) oursig - (int) TARGET_SIGNAL_REALTIME_33 + 33;
- if (retsig >= REALTIME_LO && retsig < REALTIME_HI)
- return retsig;
- }
-#if (REALTIME_LO < 33)
- else if (oursig == TARGET_SIGNAL_REALTIME_32)
- {
- /* TARGET_SIGNAL_REALTIME_32 isn't contiguous with
- TARGET_SIGNAL_REALTIME_33. It is 32 by definition. */
- return 32;
- }
-#endif
-#if (REALTIME_HI > 64)
- if (oursig >= TARGET_SIGNAL_REALTIME_64
- && oursig <= TARGET_SIGNAL_REALTIME_127)
- {
- /* This block of signals is continuous, and
- TARGET_SIGNAL_REALTIME_64 is 64 by definition. */
- int retsig =
- (int) oursig - (int) TARGET_SIGNAL_REALTIME_64 + 64;
- if (retsig >= REALTIME_LO && retsig < REALTIME_HI)
- return retsig;
- }
-
-#endif
-#endif
+ retsig = 0;
-#if defined (SIGRTMIN)
if (oursig >= TARGET_SIGNAL_REALTIME_33
&& oursig <= TARGET_SIGNAL_REALTIME_63)
{
/* This block of signals is continuous, and
TARGET_SIGNAL_REALTIME_33 is 33 by definition. */
- int retsig =
- (int) oursig - (int) TARGET_SIGNAL_REALTIME_33 + 33;
- if (retsig >= SIGRTMIN && retsig <= SIGRTMAX)
- return retsig;
+ retsig = (int) oursig - (int) TARGET_SIGNAL_REALTIME_33 + 33;
}
else if (oursig == TARGET_SIGNAL_REALTIME_32)
{
/* TARGET_SIGNAL_REALTIME_32 isn't contiguous with
TARGET_SIGNAL_REALTIME_33. It is 32 by definition. */
- return 32;
+ retsig = 32;
}
else if (oursig >= TARGET_SIGNAL_REALTIME_64
&& oursig <= TARGET_SIGNAL_REALTIME_127)
{
/* This block of signals is continuous, and
TARGET_SIGNAL_REALTIME_64 is 64 by definition. */
- int retsig =
- (int) oursig - (int) TARGET_SIGNAL_REALTIME_64 + 64;
- return retsig;
+ retsig = (int) oursig - (int) TARGET_SIGNAL_REALTIME_64 + 64;
}
+
+ if (retsig >= REALTIME_LO && retsig < REALTIME_HI)
+ return retsig;
#endif
+
*oursig_ok = 0;
return 0;
}
diff --git a/gdb/solib-irix.c b/gdb/solib-irix.c
index 1cfa452..26a776f 100644
--- a/gdb/solib-irix.c
+++ b/gdb/solib-irix.c
@@ -436,7 +436,7 @@ irix_solib_create_inferior_hook (void)
out what we need to know about them. */
clear_proceed_status ();
- stop_soon_quietly = 1;
+ stop_soon = STOP_QUIETLY;
stop_signal = TARGET_SIGNAL_0;
do
{
@@ -459,10 +459,10 @@ irix_solib_create_inferior_hook (void)
But we are stopped in the startup code and we might not have symbols
for the startup code, so heuristic_proc_start could be called
and will put out an annoying warning.
- Delaying the resetting of stop_soon_quietly until after symbol loading
+ Delaying the resetting of stop_soon until after symbol loading
suppresses the warning. */
solib_add ((char *) 0, 0, (struct target_ops *) 0, auto_solib_add);
- stop_soon_quietly = 0;
+ stop_soon = NO_STOP_QUIETLY;
re_enable_breakpoints_in_shlibs ();
}
diff --git a/gdb/solib-osf.c b/gdb/solib-osf.c
index 6f43a8f..b5dca60 100644
--- a/gdb/solib-osf.c
+++ b/gdb/solib-osf.c
@@ -321,7 +321,7 @@ osf_solib_create_inferior_hook (void)
out what we need to know about them. */
clear_proceed_status ();
- stop_soon_quietly = 1;
+ stop_soon = STOP_QUIETLY;
stop_signal = TARGET_SIGNAL_0;
do
{
@@ -334,10 +334,10 @@ osf_solib_create_inferior_hook (void)
But we are stopped in the runtime loader and we do not have symbols
for the runtime loader. So heuristic_proc_start will be called
and will put out an annoying warning.
- Delaying the resetting of stop_soon_quietly until after symbol loading
+ Delaying the resetting of stop_soon until after symbol loading
suppresses the warning. */
solib_add ((char *) 0, 0, (struct target_ops *) 0, auto_solib_add);
- stop_soon_quietly = 0;
+ stop_soon = NO_STOP_QUIETLY;
/* Enable breakpoints disabled (unnecessarily) by clear_solib(). */
re_enable_breakpoints_in_shlibs ();
diff --git a/gdb/solib-sunos.c b/gdb/solib-sunos.c
index 25682e0..4072fab 100644
--- a/gdb/solib-sunos.c
+++ b/gdb/solib-sunos.c
@@ -829,7 +829,7 @@ sunos_solib_create_inferior_hook (void)
out what we need to know about them. */
clear_proceed_status ();
- stop_soon_quietly = 1;
+ stop_soon = STOP_QUIETLY;
stop_signal = TARGET_SIGNAL_0;
do
{
@@ -837,7 +837,7 @@ sunos_solib_create_inferior_hook (void)
wait_for_inferior ();
}
while (stop_signal != TARGET_SIGNAL_TRAP);
- stop_soon_quietly = 0;
+ stop_soon = NO_STOP_QUIETLY;
/* We are now either at the "mapping complete" breakpoint (or somewhere
else, a condition we aren't prepared to deal with anyway), so adjust
diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
index 7831108..6c4c10a 100644
--- a/gdb/solib-svr4.c
+++ b/gdb/solib-svr4.c
@@ -43,6 +43,7 @@
static struct link_map_offsets *svr4_fetch_link_map_offsets (void);
static struct link_map_offsets *legacy_fetch_link_map_offsets (void);
+static int svr4_have_link_map_offsets (void);
/* fetch_link_map_offsets_gdbarch_data is a handle used to obtain the
architecture specific link map offsets fetching function. */
@@ -542,9 +543,10 @@ locate_base (void)
/* Check to see if we have a currently valid address, and if so, avoid
doing all this work again and just return the cached address. If
we have no cached address, try to locate it in the dynamic info
- section for ELF executables. */
+ section for ELF executables. There's no point in doing any of this
+ though if we don't have some link map offsets to work with. */
- if (debug_base == 0)
+ if (debug_base == 0 && svr4_have_link_map_offsets ())
{
if (exec_bfd != NULL
&& bfd_get_flavour (exec_bfd) == bfd_target_elf_flavour)
@@ -1273,6 +1275,13 @@ svr4_solib_create_inferior_hook (void)
/* Relocate the main executable if necessary. */
svr4_relocate_main_executable ();
+ if (!svr4_have_link_map_offsets ())
+ {
+ warning ("no shared library support for this OS / ABI");
+ return;
+
+ }
+
if (!enable_break ())
{
warning ("shared library handler failed to enable breakpoint");
@@ -1290,7 +1299,7 @@ svr4_solib_create_inferior_hook (void)
out what we need to know about them. */
clear_proceed_status ();
- stop_soon_quietly = 1;
+ stop_soon = STOP_QUIETLY;
stop_signal = TARGET_SIGNAL_0;
do
{
@@ -1298,7 +1307,7 @@ svr4_solib_create_inferior_hook (void)
wait_for_inferior ();
}
while (stop_signal != TARGET_SIGNAL_TRAP);
- stop_soon_quietly = 0;
+ stop_soon = NO_STOP_QUIETLY;
#endif /* defined(_SCO_DS) */
}
@@ -1392,6 +1401,20 @@ svr4_fetch_link_map_offsets (void)
return (flmo ());
}
+/* Return 1 if a link map offset fetcher has been defined, 0 otherwise. */
+static int
+svr4_have_link_map_offsets (void)
+{
+ struct link_map_offsets *(*flmo)(void) =
+ gdbarch_data (current_gdbarch, fetch_link_map_offsets_gdbarch_data);
+ if (flmo == NULL
+ || (flmo == legacy_fetch_link_map_offsets
+ && legacy_svr4_fetch_link_map_offsets_hook == NULL))
+ return 0;
+ else
+ return 1;
+}
+
/* set_solib_svr4_fetch_link_map_offsets() is intended to be called by
a <arch>_gdbarch_init() function. It is used to establish an
architecture specific link_map_offsets fetcher for the architecture
diff --git a/gdb/solib-svr4.h b/gdb/solib-svr4.h
index e41c240..d9d3217 100644
--- a/gdb/solib-svr4.h
+++ b/gdb/solib-svr4.h
@@ -19,6 +19,8 @@
Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
+struct objfile;
+
/* Critical offsets and sizes which describe struct r_debug and
struct link_map on SVR4-like targets. All offsets and sizes are
in bytes unless otherwise specified. */
diff --git a/gdb/somread.c b/gdb/somread.c
index 85d4f0a..654ae06 100644
--- a/gdb/somread.c
+++ b/gdb/somread.c
@@ -37,6 +37,8 @@
/* Various things we might complain about... */
+static int init_import_symbols (struct objfile *objfile);
+
static void som_symfile_init (struct objfile *);
static void som_new_init (struct objfile *);
@@ -466,7 +468,7 @@ som_symfile_offsets (struct objfile *objfile, struct section_addr_info *addrs)
not defined there. (Variables that are imported are dealt
with as "loc_indirect" vars.)
Return value = number of import symbols read in. */
-int
+static int
init_import_symbols (struct objfile *objfile)
{
unsigned int import_list;
diff --git a/gdb/somsolib.c b/gdb/somsolib.c
index 08d3e1c..c496752 100644
--- a/gdb/somsolib.c
+++ b/gdb/somsolib.c
@@ -41,6 +41,7 @@
#include "gdbcmd.h"
#include "language.h"
#include "regcache.h"
+#include "gdb_assert.h"
#include <fcntl.h>
diff --git a/gdb/somsolib.h b/gdb/somsolib.h
index 0840067..c241411 100644
--- a/gdb/somsolib.h
+++ b/gdb/somsolib.h
@@ -23,6 +23,9 @@
Written by the Center for Software Science at the Univerity of Utah
and by Cygnus Support. */
+#ifndef SOMSOLIB_H
+#define SOMSOLIB_H
+
/* Forward decl's for prototypes */
struct target_ops;
struct objfile;
@@ -164,3 +167,12 @@ extern char *som_solib_address (CORE_ADDR); /* somsolib.c */
/* If ADDR lies in a shared library, return its name. */
#define PC_SOLIB(addr) som_solib_address (addr)
+
+extern CORE_ADDR som_solib_get_solib_by_pc (CORE_ADDR addr);
+
+struct so_list;
+extern CORE_ADDR so_lib_thread_start_addr (struct so_list *so);
+
+extern void no_shared_libraries (char *ignored, int from_tty);
+
+#endif
diff --git a/gdb/source.h b/gdb/source.h
index ba7d45f..7cfed1a 100644
--- a/gdb/source.h
+++ b/gdb/source.h
@@ -21,6 +21,8 @@
#ifndef SOURCE_H
#define SOURCE_H
+struct symtab;
+
/* Open a source file given a symtab S. Returns a file descriptor or
negative number for error. */
extern int open_source_file (struct symtab *s);
diff --git a/gdb/sparc-tdep.c b/gdb/sparc-tdep.c
index b22474a..e1a0089 100644
--- a/gdb/sparc-tdep.c
+++ b/gdb/sparc-tdep.c
@@ -41,6 +41,7 @@
#endif
#include "gdbcore.h"
+#include "gdb_assert.h"
#include "symfile.h" /* for 'entry_point_address' */
@@ -65,11 +66,14 @@
/* Does the target have Floating Point registers? */
-#if defined(TARGET_SPARCLET) || defined(TARGET_SPARCLITE)
-#define SPARC_HAS_FPU 0
-#else
-#define SPARC_HAS_FPU 1
+#if 0
+// OBSOLETE #if defined(TARGET_SPARCLET) || defined(TARGET_SPARCLITE)
+// OBSOLETE #define SPARC_HAS_FPU 0
+// OBSOLETE #else
+// OBSOLETE #define SPARC_HAS_FPU 1
+// OBSOLETE #endif
#endif
+#define SPARC_HAS_FPU 1
/* Number of bytes devoted to Floating Point registers: */
#if (GDB_TARGET_IS_SPARC64)
@@ -103,7 +107,9 @@
struct gdbarch_tdep
{
- int has_fpu;
+#if 0
+ // OBSOLETE int has_fpu;
+#endif
int fp_register_bytes;
int y_regnum;
int fp_max_regnum;
@@ -133,11 +139,13 @@ extern int stop_after_trap;
int deferred_stores = 0; /* Accumulated stores we want to do eventually. */
-/* Some machines, such as Fujitsu SPARClite 86x, have a bi-endian mode
- where instructions are big-endian and data are little-endian.
- This flag is set when we detect that the target is of this type. */
-
-int bi_endian = 0;
+#if 0
+// OBSOLETE /* Some machines, such as Fujitsu SPARClite 86x, have a bi-endian mode
+// OBSOLETE where instructions are big-endian and data are little-endian.
+// OBSOLETE This flag is set when we detect that the target is of this type. */
+// OBSOLETE
+// OBSOLETE int bi_endian = 0;
+#endif
/* Fetch a single instruction. Even on bi-endian machines
@@ -326,9 +334,9 @@ sparc_init_extra_frame_info (int fromleaf, struct frame_info *fi)
else
{
/* Should we adjust for stack bias here? */
- get_saved_register (buf, 0, 0, fi, FP_REGNUM, 0);
- deprecated_update_frame_base_hack (fi, extract_address (buf, REGISTER_RAW_SIZE (FP_REGNUM)));
-
+ ULONGEST tmp;
+ frame_read_unsigned_register (fi, FP_REGNUM, &tmp);
+ deprecated_update_frame_base_hack (fi, tmp);
if (GDB_TARGET_IS_SPARC64 && (get_frame_base (fi) & 1))
deprecated_update_frame_base_hack (fi, get_frame_base (fi) + 2047);
}
@@ -367,8 +375,11 @@ sparc_init_extra_frame_info (int fromleaf, struct frame_info *fi)
get_frame_extra_info (fi)->sp_offset = offset;
/* Overwrite the frame's address with the value in %i7. */
- get_saved_register (buf, 0, 0, fi, I7_REGNUM, 0);
- deprecated_update_frame_base_hack (fi, extract_address (buf, REGISTER_RAW_SIZE (I7_REGNUM)));
+ {
+ ULONGEST tmp;
+ frame_read_unsigned_register (fi, I7_REGNUM, &tmp);
+ deprecated_update_frame_base_hack (fi, tmp);
+ }
if (GDB_TARGET_IS_SPARC64 && (get_frame_base (fi) & 1))
deprecated_update_frame_base_hack (fi, get_frame_base (fi) + 2047);
@@ -429,20 +440,21 @@ sparc_init_extra_frame_info (int fromleaf, struct frame_info *fi)
CORE_ADDR
sparc_frame_chain (struct frame_info *frame)
{
- /* Value that will cause FRAME_CHAIN_VALID to not worry about the chain
- value. If it really is zero, we detect it later in
- sparc_init_prev_frame.
+ /* Value that will cause DEPRECATED_FRAME_CHAIN_VALID to not worry
+ about the chain value. If it really is zero, we detect it later
+ in sparc_init_prev_frame.
- Note: kevinb/2003-02-18: The constant 1 used to be returned
- here, but, after some recent changes to frame_chain_valid(),
- this value is no longer suitable for causing frame_chain_valid()
- to "not worry about the chain value." The constant ~0 (i.e,
- 0xfff...) causes the failing test in frame_chain_valid() to
- succeed thus preserving the "not worry" property. I had considered
- using something like ``get_frame_base (frame) + 1''. However, I think
- a constant value is better, because when debugging this problem,
- I knew that something funny was going on as soon as I saw the
- constant 1 being used as the frame chain elsewhere in GDB. */
+ Note: kevinb/2003-02-18: The constant 1 used to be returned here,
+ but, after some recent changes to legacy_frame_chain_valid(),
+ this value is no longer suitable for causing
+ legacy_frame_chain_valid() to "not worry about the chain value."
+ The constant ~0 (i.e, 0xfff...) causes the failing test in
+ legacy_frame_chain_valid() to succeed thus preserving the "not
+ worry" property. I had considered using something like
+ ``get_frame_base (frame) + 1''. However, I think a constant
+ value is better, because when debugging this problem, I knew that
+ something funny was going on as soon as I saw the constant 1
+ being used as the frame chain elsewhere in GDB. */
return ~ (CORE_ADDR) 0;
}
@@ -487,9 +499,11 @@ sparc_frame_saved_pc (struct frame_info *frame)
saved_pc_offset = 12;
/* The sigcontext address is contained in register O2. */
- get_saved_register (buf, (int *) NULL, (CORE_ADDR *) NULL,
- frame, O0_REGNUM + 2, (enum lval_type *) NULL);
- sigcontext_addr = extract_address (buf, REGISTER_RAW_SIZE (O0_REGNUM + 2));
+ {
+ ULONGEST tmp;
+ frame_read_unsigned_register (frame, O0_REGNUM + 2, &tmp);
+ sigcontext_addr = tmp;
+ }
/* Don't cause a memory_error when accessing sigcontext in case the
stack layout has changed or the stack is corrupt. */
@@ -505,9 +519,9 @@ sparc_frame_saved_pc (struct frame_info *frame)
{
/* A frameless function interrupted by a signal did not save
the PC, it is still in %o7. */
- get_saved_register (buf, (int *) NULL, (CORE_ADDR *) NULL,
- frame, O7_REGNUM, (enum lval_type *) NULL);
- return PC_ADJUST (extract_address (buf, SPARC_INTREG_SIZE));
+ ULONGEST tmp;
+ frame_read_unsigned_register (frame, O7_REGNUM, &tmp);
+ return PC_ADJUST (tmp);
}
if (get_frame_extra_info (frame)->flat)
addr = get_frame_extra_info (frame)->pc_addr;
@@ -547,7 +561,7 @@ setup_arbitrary_frame (int argc, CORE_ADDR *argv)
"create_new_frame returned invalid frame");
get_frame_extra_info (frame)->bottom = argv[1];
- deprecated_update_frame_pc_hack (frame, FRAME_SAVED_PC (frame));
+ deprecated_update_frame_pc_hack (frame, DEPRECATED_FRAME_SAVED_PC (frame));
return frame;
}
@@ -936,8 +950,9 @@ sparc_get_saved_register (char *raw_buffer, int *optimized, CORE_ADDR *addrp,
else if (regnum >= O0_REGNUM && regnum < O0_REGNUM + 8)
{
/* Outs become ins. */
- get_saved_register (raw_buffer, optimized, addrp, frame1,
- (regnum - O0_REGNUM + I0_REGNUM), lval);
+ int realnum;
+ frame_register (frame1, (regnum - O0_REGNUM + I0_REGNUM),
+ optimized, lval, addrp, &realnum, raw_buffer);
return;
}
}
@@ -1034,7 +1049,7 @@ sparc_push_dummy_frame (void)
sp -= DUMMY_STACK_SIZE;
- write_sp (sp);
+ DEPRECATED_DUMMY_WRITE_SP (sp);
write_memory (sp + DUMMY_REG_SAVE_OFFSET, &register_temp[0],
DUMMY_STACK_REG_BUF_SIZE);
@@ -1090,10 +1105,10 @@ sparc_push_dummy_frame (void)
I think few ports of GDB get right--if you are popping a frame
which does not save some register that *is* saved by a more inner
frame (such a frame will never be a dummy frame because dummy
- frames save all registers). Rewriting pop_frame to use
- get_saved_register would solve this problem and also get rid of the
- ugly duplication between sparc_frame_find_saved_regs and
- get_saved_register.
+ frames save all registers).
+
+ NOTE: cagney/2003-03-12: Since pop_frame has been rewritten to use
+ frame_unwind_register() the need for this function is questionable.
Stores, into an array of CORE_ADDR,
the addresses of the saved registers of frame described by FRAME_INFO.
@@ -1127,9 +1142,7 @@ sparc_frame_find_saved_regs (struct frame_info *fi, CORE_ADDR *saved_regs_addr)
register int regnum;
CORE_ADDR frame_addr = get_frame_base (fi);
- if (!fi)
- internal_error (__FILE__, __LINE__,
- "Bad frame info struct in FRAME_FIND_SAVED_REGS");
+ gdb_assert (fi != NULL);
memset (saved_regs_addr, 0, NUM_REGS * sizeof (CORE_ADDR));
@@ -1304,7 +1317,7 @@ sparc_pop_frame (void)
read_memory_integer (fsr[O0_REGNUM + 7],
SPARC_INTREG_SIZE));
- write_sp (get_frame_base (frame));
+ DEPRECATED_DUMMY_WRITE_SP (get_frame_base (frame));
}
else if (fsr[I0_REGNUM])
{
@@ -1369,12 +1382,9 @@ sparc_pop_frame (void)
/* I think this happens only in the innermost frame, if so then
it is a complicated way of saying
"pc = read_register (O7_REGNUM);". */
- char *buf;
-
- buf = alloca (MAX_REGISTER_RAW_SIZE);
- get_saved_register (buf, 0, 0, frame, O7_REGNUM, 0);
- pc = PC_ADJUST (extract_address
- (buf, REGISTER_RAW_SIZE (O7_REGNUM)));
+ ULONGEST tmp;
+ frame_read_unsigned_register (frame, O7_REGNUM, &tmp);
+ pc = PC_ADJUST (tmp);
}
write_register (PC_REGNUM, pc);
@@ -2171,21 +2181,23 @@ sparc_do_registers_info (int regnum, int all)
regnum, all);
}
-static void
-sparclet_print_registers_info (struct gdbarch *gdbarch,
- struct ui_file *file,
- struct frame_info *frame,
- int regnum, int print_all)
-{
- sparc_print_registers (gdbarch, file, frame, regnum, print_all, NULL);
-}
-
-void
-sparclet_do_registers_info (int regnum, int all)
-{
- sparclet_print_registers_info (current_gdbarch, gdb_stdout,
- deprecated_selected_frame, regnum, all);
-}
+#if 0
+// OBSOLETE static void
+// OBSOLETE sparclet_print_registers_info (struct gdbarch *gdbarch,
+// OBSOLETE struct ui_file *file,
+// OBSOLETE struct frame_info *frame,
+// OBSOLETE int regnum, int print_all)
+// OBSOLETE {
+// OBSOLETE sparc_print_registers (gdbarch, file, frame, regnum, print_all, NULL);
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE void
+// OBSOLETE sparclet_do_registers_info (int regnum, int all)
+// OBSOLETE {
+// OBSOLETE sparclet_print_registers_info (current_gdbarch, gdb_stdout,
+// OBSOLETE deprecated_selected_frame, regnum, all);
+// OBSOLETE }
+#endif
int
@@ -2246,8 +2258,8 @@ sparc32_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
}
/* Make room for the arguments on the stack. */
- accumulate_size += CALL_DUMMY_STACK_ADJUST;
- sp = ((sp - accumulate_size) & ~7) + CALL_DUMMY_STACK_ADJUST;
+ accumulate_size += DEPRECATED_CALL_DUMMY_STACK_ADJUST;
+ sp = ((sp - accumulate_size) & ~7) + DEPRECATED_CALL_DUMMY_STACK_ADJUST;
/* `Push' arguments on the stack. */
for (i = 0, oregnum = 0, m_arg = sparc_args;
@@ -2321,13 +2333,15 @@ sparc_store_return_value (struct type *type, char *valbuf)
TYPE_LENGTH (type));
}
-extern void
-sparclet_store_return_value (struct type *type, char *valbuf)
-{
- /* Other values are returned in register %o0. */
- deprecated_write_register_bytes (REGISTER_BYTE (O0_REGNUM), valbuf,
- TYPE_LENGTH (type));
-}
+#if 0
+// OBSOLETE extern void
+// OBSOLETE sparclet_store_return_value (struct type *type, char *valbuf)
+// OBSOLETE {
+// OBSOLETE /* Other values are returned in register %o0. */
+// OBSOLETE deprecated_write_register_bytes (REGISTER_BYTE (O0_REGNUM), valbuf,
+// OBSOLETE TYPE_LENGTH (type));
+// OBSOLETE }
+#endif
#ifndef CALL_DUMMY_CALL_OFFSET
@@ -2393,40 +2407,43 @@ sparc_fix_call_dummy (char *dummy, CORE_ADDR pc, CORE_ADDR fun,
}
}
- /* If this is a bi-endian target, GDB has written the call dummy
- in little-endian order. We must byte-swap it back to big-endian. */
- if (bi_endian)
- {
- for (i = 0; i < CALL_DUMMY_LENGTH; i += 4)
- {
- char tmp = dummy[i];
- dummy[i] = dummy[i + 3];
- dummy[i + 3] = tmp;
- tmp = dummy[i + 1];
- dummy[i + 1] = dummy[i + 2];
- dummy[i + 2] = tmp;
- }
- }
+#if 0
+// OBSOLETE /* If this is a bi-endian target, GDB has written the call dummy
+// OBSOLETE in little-endian order. We must byte-swap it back to big-endian. */
+// OBSOLETE if (bi_endian)
+// OBSOLETE {
+// OBSOLETE for (i = 0; i < CALL_DUMMY_LENGTH; i += 4)
+// OBSOLETE {
+// OBSOLETE char tmp = dummy[i];
+// OBSOLETE dummy[i] = dummy[i + 3];
+// OBSOLETE dummy[i + 3] = tmp;
+// OBSOLETE tmp = dummy[i + 1];
+// OBSOLETE dummy[i + 1] = dummy[i + 2];
+// OBSOLETE dummy[i + 2] = tmp;
+// OBSOLETE }
+// OBSOLETE }
+#endif
}
-/* Set target byte order based on machine type. */
-
-static int
-sparc_target_architecture_hook (const bfd_arch_info_type *ap)
-{
- int i, j;
-
- if (ap->mach == bfd_mach_sparc_sparclite_le)
- {
- target_byte_order = BFD_ENDIAN_LITTLE;
- bi_endian = 1;
- }
- else
- bi_endian = 0;
- return 1;
-}
-
+#if 0
+// OBSOLETE /* Set target byte order based on machine type. */
+// OBSOLETE
+// OBSOLETE static int
+// OBSOLETE sparc_target_architecture_hook (const bfd_arch_info_type *ap)
+// OBSOLETE {
+// OBSOLETE int i, j;
+// OBSOLETE
+// OBSOLETE if (ap->mach == bfd_mach_sparc_sparclite_le)
+// OBSOLETE {
+// OBSOLETE target_byte_order = BFD_ENDIAN_LITTLE;
+// OBSOLETE bi_endian = 1;
+// OBSOLETE }
+// OBSOLETE else
+// OBSOLETE bi_endian = 0;
+// OBSOLETE return 1;
+// OBSOLETE }
+#endif
/*
* Module "constructor" function.
@@ -2444,7 +2461,7 @@ _initialize_sparc_tdep (void)
tm_print_insn = gdb_print_insn_sparc;
tm_print_insn_info.mach = TM_PRINT_INSN_MACH; /* Selects sparc/sparclite */
- target_architecture_hook = sparc_target_architecture_hook;
+ /* OBSOLETE target_architecture_hook = sparc_target_architecture_hook; */
}
/* Compensate for stack bias. Note that we currently don't handle
@@ -2674,18 +2691,19 @@ sparc64_extract_return_value (struct type *type, char *regbuf, char *valbuf)
sp64_extract_return_value (type, regbuf, valbuf, 0);
}
-extern void
-sparclet_extract_return_value (struct type *type,
- char *regbuf,
- char *valbuf)
-{
- regbuf += REGISTER_RAW_SIZE (O0_REGNUM) * 8;
- if (TYPE_LENGTH (type) < REGISTER_RAW_SIZE (O0_REGNUM))
- regbuf += REGISTER_RAW_SIZE (O0_REGNUM) - TYPE_LENGTH (type);
-
- memcpy ((void *) valbuf, regbuf, TYPE_LENGTH (type));
-}
-
+#if 0
+// OBSOLETE extern void
+// OBSOLETE sparclet_extract_return_value (struct type *type,
+// OBSOLETE char *regbuf,
+// OBSOLETE char *valbuf)
+// OBSOLETE {
+// OBSOLETE regbuf += REGISTER_RAW_SIZE (O0_REGNUM) * 8;
+// OBSOLETE if (TYPE_LENGTH (type) < REGISTER_RAW_SIZE (O0_REGNUM))
+// OBSOLETE regbuf += REGISTER_RAW_SIZE (O0_REGNUM) - TYPE_LENGTH (type);
+// OBSOLETE
+// OBSOLETE memcpy ((void *) valbuf, regbuf, TYPE_LENGTH (type));
+// OBSOLETE }
+#endif
extern CORE_ADDR
sparc32_stack_align (CORE_ADDR addr)
@@ -2766,66 +2784,70 @@ sparc64_register_name (int regno)
return register_names[regno];
}
-static const char *
-sparclite_register_name (int regno)
-{
- static char *register_names[] =
- { "g0", "g1", "g2", "g3", "g4", "g5", "g6", "g7",
- "o0", "o1", "o2", "o3", "o4", "o5", "sp", "o7",
- "l0", "l1", "l2", "l3", "l4", "l5", "l6", "l7",
- "i0", "i1", "i2", "i3", "i4", "i5", "fp", "i7",
-
- "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7",
- "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15",
- "f16", "f17", "f18", "f19", "f20", "f21", "f22", "f23",
- "f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31",
-
- "y", "psr", "wim", "tbr", "pc", "npc", "fpsr", "cpsr",
- "dia1", "dia2", "dda1", "dda2", "ddv1", "ddv2", "dcr", "dsr"
- };
-
- if (regno < 0 ||
- regno >= (sizeof (register_names) / sizeof (register_names[0])))
- return NULL;
- else
- return register_names[regno];
-}
-
-static const char *
-sparclet_register_name (int regno)
-{
- static char *register_names[] =
- { "g0", "g1", "g2", "g3", "g4", "g5", "g6", "g7",
- "o0", "o1", "o2", "o3", "o4", "o5", "sp", "o7",
- "l0", "l1", "l2", "l3", "l4", "l5", "l6", "l7",
- "i0", "i1", "i2", "i3", "i4", "i5", "fp", "i7",
-
- "", "", "", "", "", "", "", "", /* no floating point registers */
- "", "", "", "", "", "", "", "",
- "", "", "", "", "", "", "", "",
- "", "", "", "", "", "", "", "",
-
- "y", "psr", "wim", "tbr", "pc", "npc", "", "", /* no FPSR or CPSR */
- "ccsr", "ccpr", "cccrcr", "ccor", "ccobr", "ccibr", "ccir", "",
-
- /* ASR15 ASR19 (don't display them) */
- "asr1", "", "asr17", "asr18", "", "asr20", "asr21", "asr22"
- /* None of the rest get displayed */
#if 0
- "awr0", "awr1", "awr2", "awr3", "awr4", "awr5", "awr6", "awr7",
- "awr8", "awr9", "awr10", "awr11", "awr12", "awr13", "awr14", "awr15",
- "awr16", "awr17", "awr18", "awr19", "awr20", "awr21", "awr22", "awr23",
- "awr24", "awr25", "awr26", "awr27", "awr28", "awr29", "awr30", "awr31",
- "apsr"
-#endif /* 0 */
- };
+// OBSOLETE static const char *
+// OBSOLETE sparclite_register_name (int regno)
+// OBSOLETE {
+// OBSOLETE static char *register_names[] =
+// OBSOLETE { "g0", "g1", "g2", "g3", "g4", "g5", "g6", "g7",
+// OBSOLETE "o0", "o1", "o2", "o3", "o4", "o5", "sp", "o7",
+// OBSOLETE "l0", "l1", "l2", "l3", "l4", "l5", "l6", "l7",
+// OBSOLETE "i0", "i1", "i2", "i3", "i4", "i5", "fp", "i7",
+// OBSOLETE
+// OBSOLETE "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7",
+// OBSOLETE "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15",
+// OBSOLETE "f16", "f17", "f18", "f19", "f20", "f21", "f22", "f23",
+// OBSOLETE "f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31",
+// OBSOLETE
+// OBSOLETE "y", "psr", "wim", "tbr", "pc", "npc", "fpsr", "cpsr",
+// OBSOLETE "dia1", "dia2", "dda1", "dda2", "ddv1", "ddv2", "dcr", "dsr"
+// OBSOLETE };
+// OBSOLETE
+// OBSOLETE if (regno < 0 ||
+// OBSOLETE regno >= (sizeof (register_names) / sizeof (register_names[0])))
+// OBSOLETE return NULL;
+// OBSOLETE else
+// OBSOLETE return register_names[regno];
+// OBSOLETE }
+#endif
- if (regno < 0 ||
- regno >= (sizeof (register_names) / sizeof (register_names[0])))
- return NULL;
- else
- return register_names[regno];
-}
+#if 0
+// OBSOLETE static const char *
+// OBSOLETE sparclet_register_name (int regno)
+// OBSOLETE {
+// OBSOLETE static char *register_names[] =
+// OBSOLETE { "g0", "g1", "g2", "g3", "g4", "g5", "g6", "g7",
+// OBSOLETE "o0", "o1", "o2", "o3", "o4", "o5", "sp", "o7",
+// OBSOLETE "l0", "l1", "l2", "l3", "l4", "l5", "l6", "l7",
+// OBSOLETE "i0", "i1", "i2", "i3", "i4", "i5", "fp", "i7",
+// OBSOLETE
+// OBSOLETE "", "", "", "", "", "", "", "", /* no floating point registers */
+// OBSOLETE "", "", "", "", "", "", "", "",
+// OBSOLETE "", "", "", "", "", "", "", "",
+// OBSOLETE "", "", "", "", "", "", "", "",
+// OBSOLETE
+// OBSOLETE "y", "psr", "wim", "tbr", "pc", "npc", "", "", /* no FPSR or CPSR */
+// OBSOLETE "ccsr", "ccpr", "cccrcr", "ccor", "ccobr", "ccibr", "ccir", "",
+// OBSOLETE
+// OBSOLETE /* ASR15 ASR19 (don't display them) */
+// OBSOLETE "asr1", "", "asr17", "asr18", "", "asr20", "asr21", "asr22"
+// OBSOLETE /* None of the rest get displayed */
+// OBSOLETE #if 0
+// OBSOLETE "awr0", "awr1", "awr2", "awr3", "awr4", "awr5", "awr6", "awr7",
+// OBSOLETE "awr8", "awr9", "awr10", "awr11", "awr12", "awr13", "awr14", "awr15",
+// OBSOLETE "awr16", "awr17", "awr18", "awr19", "awr20", "awr21", "awr22", "awr23",
+// OBSOLETE "awr24", "awr25", "awr26", "awr27", "awr28", "awr29", "awr30", "awr31",
+// OBSOLETE "apsr"
+// OBSOLETE #endif /* 0 */
+// OBSOLETE };
+// OBSOLETE
+// OBSOLETE if (regno < 0 ||
+// OBSOLETE regno >= (sizeof (register_names) / sizeof (register_names[0])))
+// OBSOLETE return NULL;
+// OBSOLETE else
+// OBSOLETE return register_names[regno];
+// OBSOLETE }
+#endif
CORE_ADDR
sparc_push_return_address (CORE_ADDR pc_unused, CORE_ADDR sp)
@@ -3134,9 +3156,6 @@ sparc_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
/* First set settings that are common for all sparc architectures. */
set_gdbarch_believe_pcc_promotion (gdbarch, 1);
set_gdbarch_breakpoint_from_pc (gdbarch, memory_breakpoint_from_pc);
- set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 1);
- set_gdbarch_call_dummy_p (gdbarch, 1);
- set_gdbarch_call_dummy_stack_adjust_p (gdbarch, 1);
set_gdbarch_decr_pc_after_break (gdbarch, 0);
set_gdbarch_double_bit (gdbarch, 8 * TARGET_CHAR_BIT);
set_gdbarch_deprecated_extract_struct_value_address (gdbarch, sparc_extract_struct_value_address);
@@ -3144,13 +3163,13 @@ sparc_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_float_bit (gdbarch, 4 * TARGET_CHAR_BIT);
set_gdbarch_fp_regnum (gdbarch, SPARC_FP_REGNUM);
set_gdbarch_fp0_regnum (gdbarch, SPARC_FP0_REGNUM);
- set_gdbarch_frame_chain (gdbarch, sparc_frame_chain);
+ set_gdbarch_deprecated_frame_chain (gdbarch, sparc_frame_chain);
set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, sparc_frame_init_saved_regs);
set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown);
- set_gdbarch_frame_saved_pc (gdbarch, sparc_frame_saved_pc);
+ set_gdbarch_deprecated_frame_saved_pc (gdbarch, sparc_frame_saved_pc);
set_gdbarch_frameless_function_invocation (gdbarch,
frameless_look_for_prologue);
- set_gdbarch_get_saved_register (gdbarch, sparc_get_saved_register);
+ set_gdbarch_deprecated_get_saved_register (gdbarch, sparc_get_saved_register);
set_gdbarch_deprecated_init_extra_frame_info (gdbarch, sparc_init_extra_frame_info);
set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
set_gdbarch_int_bit (gdbarch, 4 * TARGET_CHAR_BIT);
@@ -3158,8 +3177,8 @@ sparc_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_long_long_bit (gdbarch, 8 * TARGET_CHAR_BIT);
set_gdbarch_deprecated_max_register_raw_size (gdbarch, 8);
set_gdbarch_deprecated_max_register_virtual_size (gdbarch, 8);
- set_gdbarch_pop_frame (gdbarch, sparc_pop_frame);
- set_gdbarch_push_return_address (gdbarch, sparc_push_return_address);
+ set_gdbarch_deprecated_pop_frame (gdbarch, sparc_pop_frame);
+ set_gdbarch_deprecated_push_return_address (gdbarch, sparc_push_return_address);
set_gdbarch_deprecated_push_dummy_frame (gdbarch, sparc_push_dummy_frame);
set_gdbarch_read_pc (gdbarch, generic_target_read_pc);
set_gdbarch_register_convert_to_raw (gdbarch, sparc_convert_to_raw);
@@ -3169,7 +3188,7 @@ sparc_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
generic_register_convertible_not);
set_gdbarch_reg_struct_has_addr (gdbarch, sparc_reg_struct_has_addr);
set_gdbarch_return_value_on_stack (gdbarch, sparc_return_value_on_stack);
- set_gdbarch_saved_pc_after_call (gdbarch, sparc_saved_pc_after_call);
+ set_gdbarch_deprecated_saved_pc_after_call (gdbarch, sparc_saved_pc_after_call);
set_gdbarch_prologue_frameless_p (gdbarch, sparc_prologue_frameless_p);
set_gdbarch_short_bit (gdbarch, 2 * TARGET_CHAR_BIT);
set_gdbarch_skip_prologue (gdbarch, sparc_skip_prologue);
@@ -3184,11 +3203,15 @@ sparc_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
switch (info.bfd_arch_info->mach)
{
case bfd_mach_sparc:
- case bfd_mach_sparc_sparclet:
- case bfd_mach_sparc_sparclite:
+#if 0
+ // OBSOLETE case bfd_mach_sparc_sparclet:
+ // OBSOLETE case bfd_mach_sparc_sparclite:
+#endif
case bfd_mach_sparc_v8plus:
case bfd_mach_sparc_v8plusa:
- case bfd_mach_sparc_sparclite_le:
+#if 0
+ // OBSOLETE case bfd_mach_sparc_sparclite_le:
+#endif
/* 32-bit machine types: */
#ifdef SPARC32_CALL_DUMMY_ON_STACK
@@ -3244,20 +3267,16 @@ sparc_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_call_dummy_words (gdbarch, call_dummy_32);
#else
set_gdbarch_deprecated_pc_in_call_dummy (gdbarch, deprecated_pc_in_call_dummy_at_entry_point);
- set_gdbarch_call_dummy_address (gdbarch, entry_point_address);
- set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 0);
- set_gdbarch_call_dummy_length (gdbarch, 0);
set_gdbarch_call_dummy_words (gdbarch, call_dummy_nil);
#endif
- set_gdbarch_call_dummy_stack_adjust (gdbarch, 68);
- set_gdbarch_call_dummy_start_offset (gdbarch, 0);
+ set_gdbarch_deprecated_call_dummy_stack_adjust (gdbarch, 68);
set_gdbarch_frame_args_skip (gdbarch, 68);
set_gdbarch_function_start_offset (gdbarch, 0);
set_gdbarch_long_bit (gdbarch, 4 * TARGET_CHAR_BIT);
set_gdbarch_npc_regnum (gdbarch, SPARC32_NPC_REGNUM);
set_gdbarch_pc_regnum (gdbarch, SPARC32_PC_REGNUM);
set_gdbarch_ptr_bit (gdbarch, 4 * TARGET_CHAR_BIT);
- set_gdbarch_push_arguments (gdbarch, sparc32_push_arguments);
+ set_gdbarch_deprecated_push_arguments (gdbarch, sparc32_push_arguments);
set_gdbarch_read_fp (gdbarch, generic_target_read_fp);
set_gdbarch_read_sp (gdbarch, generic_target_read_sp);
@@ -3273,10 +3292,11 @@ sparc_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_sizeof_call_dummy_words (gdbarch, 0);
#endif
set_gdbarch_stack_align (gdbarch, sparc32_stack_align);
- set_gdbarch_store_struct_return (gdbarch, sparc32_store_struct_return);
+ set_gdbarch_deprecated_extra_stack_alignment_needed (gdbarch, 1);
+ set_gdbarch_deprecated_store_struct_return (gdbarch, sparc32_store_struct_return);
set_gdbarch_use_struct_convention (gdbarch,
generic_use_struct_convention);
- set_gdbarch_write_sp (gdbarch, generic_target_write_sp);
+ set_gdbarch_deprecated_dummy_write_sp (gdbarch, generic_target_write_sp);
tdep->y_regnum = SPARC32_Y_REGNUM;
tdep->fp_max_regnum = SPARC_FP0_REGNUM + 32;
tdep->intreg_size = 4;
@@ -3299,20 +3319,16 @@ sparc_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_call_dummy_words (gdbarch, call_dummy_64);
#else
set_gdbarch_deprecated_pc_in_call_dummy (gdbarch, deprecated_pc_in_call_dummy_at_entry_point);
- set_gdbarch_call_dummy_address (gdbarch, entry_point_address);
- set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 0);
- set_gdbarch_call_dummy_length (gdbarch, 0);
- set_gdbarch_call_dummy_start_offset (gdbarch, 0);
set_gdbarch_call_dummy_words (gdbarch, call_dummy_nil);
#endif
- set_gdbarch_call_dummy_stack_adjust (gdbarch, 128);
+ set_gdbarch_deprecated_call_dummy_stack_adjust (gdbarch, 128);
set_gdbarch_frame_args_skip (gdbarch, 136);
set_gdbarch_function_start_offset (gdbarch, 0);
set_gdbarch_long_bit (gdbarch, 8 * TARGET_CHAR_BIT);
set_gdbarch_npc_regnum (gdbarch, SPARC64_NPC_REGNUM);
set_gdbarch_pc_regnum (gdbarch, SPARC64_PC_REGNUM);
set_gdbarch_ptr_bit (gdbarch, 8 * TARGET_CHAR_BIT);
- set_gdbarch_push_arguments (gdbarch, sparc64_push_arguments);
+ set_gdbarch_deprecated_push_arguments (gdbarch, sparc64_push_arguments);
/* NOTE different for at_entry */
set_gdbarch_read_fp (gdbarch, sparc64_read_fp);
set_gdbarch_read_sp (gdbarch, sparc64_read_sp);
@@ -3330,10 +3346,11 @@ sparc_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_sizeof_call_dummy_words (gdbarch, 0);
#endif
set_gdbarch_stack_align (gdbarch, sparc64_stack_align);
- set_gdbarch_store_struct_return (gdbarch, sparc64_store_struct_return);
+ set_gdbarch_deprecated_extra_stack_alignment_needed (gdbarch, 1);
+ set_gdbarch_deprecated_store_struct_return (gdbarch, sparc64_store_struct_return);
set_gdbarch_use_struct_convention (gdbarch,
sparc64_use_struct_convention);
- set_gdbarch_write_sp (gdbarch, sparc64_write_sp);
+ set_gdbarch_deprecated_dummy_write_sp (gdbarch, sparc64_write_sp);
tdep->y_regnum = SPARC64_Y_REGNUM;
tdep->fp_max_regnum = SPARC_FP0_REGNUM + 48;
tdep->intreg_size = 8;
@@ -3354,30 +3371,36 @@ sparc_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_register_bytes (gdbarch, 32*4 + 32*4 + 8*4);
set_gdbarch_register_name (gdbarch, sparc32_register_name);
set_gdbarch_deprecated_store_return_value (gdbarch, sparc_store_return_value);
- tdep->has_fpu = 1; /* (all but sparclet and sparclite) */
+#if 0
+ // OBSOLETE tdep->has_fpu = 1; /* (all but sparclet and sparclite) */
+#endif
tdep->fp_register_bytes = 32 * 4;
tdep->print_insn_mach = bfd_mach_sparc;
break;
- case bfd_mach_sparc_sparclet:
- set_gdbarch_deprecated_extract_return_value (gdbarch, sparclet_extract_return_value);
- set_gdbarch_num_regs (gdbarch, 32 + 32 + 8 + 8 + 8);
- set_gdbarch_register_bytes (gdbarch, 32*4 + 32*4 + 8*4 + 8*4 + 8*4);
- set_gdbarch_register_name (gdbarch, sparclet_register_name);
- set_gdbarch_deprecated_store_return_value (gdbarch, sparclet_store_return_value);
- tdep->has_fpu = 0; /* (all but sparclet and sparclite) */
- tdep->fp_register_bytes = 0;
- tdep->print_insn_mach = bfd_mach_sparc_sparclet;
- break;
- case bfd_mach_sparc_sparclite:
- set_gdbarch_deprecated_extract_return_value (gdbarch, sparc32_extract_return_value);
- set_gdbarch_num_regs (gdbarch, 80);
- set_gdbarch_register_bytes (gdbarch, 32*4 + 32*4 + 8*4 + 8*4);
- set_gdbarch_register_name (gdbarch, sparclite_register_name);
- set_gdbarch_deprecated_store_return_value (gdbarch, sparc_store_return_value);
- tdep->has_fpu = 0; /* (all but sparclet and sparclite) */
- tdep->fp_register_bytes = 0;
- tdep->print_insn_mach = bfd_mach_sparc_sparclite;
- break;
+#if 0
+ // OBSOLETE case bfd_mach_sparc_sparclet:
+ // OBSOLETE set_gdbarch_deprecated_extract_return_value (gdbarch, sparclet_extract_return_value);
+ // OBSOLETE set_gdbarch_num_regs (gdbarch, 32 + 32 + 8 + 8 + 8);
+ // OBSOLETE set_gdbarch_register_bytes (gdbarch, 32*4 + 32*4 + 8*4 + 8*4 + 8*4);
+ // OBSOLETE set_gdbarch_register_name (gdbarch, sparclet_register_name);
+ // OBSOLETE set_gdbarch_deprecated_store_return_value (gdbarch, sparclet_store_return_value);
+ // OBSOLETE tdep->has_fpu = 0; /* (all but sparclet and sparclite) */
+ // OBSOLETE tdep->fp_register_bytes = 0;
+ // OBSOLETE tdep->print_insn_mach = bfd_mach_sparc_sparclet;
+ // OBSOLETE break;
+#endif
+#if 0
+ // OBSOLETE case bfd_mach_sparc_sparclite:
+ // OBSOLETE set_gdbarch_deprecated_extract_return_value (gdbarch, sparc32_extract_return_value);
+ // OBSOLETE set_gdbarch_num_regs (gdbarch, 80);
+ // OBSOLETE set_gdbarch_register_bytes (gdbarch, 32*4 + 32*4 + 8*4 + 8*4);
+ // OBSOLETE set_gdbarch_register_name (gdbarch, sparclite_register_name);
+ // OBSOLETE set_gdbarch_deprecated_store_return_value (gdbarch, sparc_store_return_value);
+ // OBSOLETE tdep->has_fpu = 0; /* (all but sparclet and sparclite) */
+ // OBSOLETE tdep->fp_register_bytes = 0;
+ // OBSOLETE tdep->print_insn_mach = bfd_mach_sparc_sparclite;
+ // OBSOLETE break;
+#endif
case bfd_mach_sparc_v8plus:
set_gdbarch_deprecated_extract_return_value (gdbarch, sparc32_extract_return_value);
set_gdbarch_num_regs (gdbarch, 72);
@@ -3386,7 +3409,9 @@ sparc_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_deprecated_store_return_value (gdbarch, sparc_store_return_value);
tdep->print_insn_mach = bfd_mach_sparc;
tdep->fp_register_bytes = 32 * 4;
- tdep->has_fpu = 1; /* (all but sparclet and sparclite) */
+#if 0
+ // OBSOLETE tdep->has_fpu = 1; /* (all but sparclet and sparclite) */
+#endif
break;
case bfd_mach_sparc_v8plusa:
set_gdbarch_deprecated_extract_return_value (gdbarch, sparc32_extract_return_value);
@@ -3394,27 +3419,33 @@ sparc_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_register_bytes (gdbarch, 32*4 + 32*4 + 8*4);
set_gdbarch_register_name (gdbarch, sparc32_register_name);
set_gdbarch_deprecated_store_return_value (gdbarch, sparc_store_return_value);
- tdep->has_fpu = 1; /* (all but sparclet and sparclite) */
+#if 0
+ // OBSOLETE tdep->has_fpu = 1; /* (all but sparclet and sparclite) */
+#endif
tdep->fp_register_bytes = 32 * 4;
tdep->print_insn_mach = bfd_mach_sparc;
break;
- case bfd_mach_sparc_sparclite_le:
- set_gdbarch_deprecated_extract_return_value (gdbarch, sparc32_extract_return_value);
- set_gdbarch_num_regs (gdbarch, 80);
- set_gdbarch_register_bytes (gdbarch, 32*4 + 32*4 + 8*4 + 8*4);
- set_gdbarch_register_name (gdbarch, sparclite_register_name);
- set_gdbarch_deprecated_store_return_value (gdbarch, sparc_store_return_value);
- tdep->has_fpu = 0; /* (all but sparclet and sparclite) */
- tdep->fp_register_bytes = 0;
- tdep->print_insn_mach = bfd_mach_sparc_sparclite;
- break;
+#if 0
+// OBSOLETE case bfd_mach_sparc_sparclite_le:
+// OBSOLETE set_gdbarch_deprecated_extract_return_value (gdbarch, sparc32_extract_return_value);
+// OBSOLETE set_gdbarch_num_regs (gdbarch, 80);
+// OBSOLETE set_gdbarch_register_bytes (gdbarch, 32*4 + 32*4 + 8*4 + 8*4);
+// OBSOLETE set_gdbarch_register_name (gdbarch, sparclite_register_name);
+// OBSOLETE set_gdbarch_deprecated_store_return_value (gdbarch, sparc_store_return_value);
+// OBSOLETE tdep->has_fpu = 0; /* (all but sparclet and sparclite) */
+// OBSOLETE tdep->fp_register_bytes = 0;
+// OBSOLETE tdep->print_insn_mach = bfd_mach_sparc_sparclite;
+// OBSOLETE break;
+#endif
case bfd_mach_sparc_v9:
set_gdbarch_deprecated_extract_return_value (gdbarch, sparc64_extract_return_value);
set_gdbarch_num_regs (gdbarch, 125);
set_gdbarch_register_bytes (gdbarch, 32*8 + 32*8 + 45*8);
set_gdbarch_register_name (gdbarch, sparc64_register_name);
set_gdbarch_deprecated_store_return_value (gdbarch, sparc_store_return_value);
- tdep->has_fpu = 1; /* (all but sparclet and sparclite) */
+#if 0
+ // OBSOLETE tdep->has_fpu = 1; /* (all but sparclet and sparclite) */
+#endif
tdep->fp_register_bytes = 64 * 4;
tdep->print_insn_mach = bfd_mach_sparc_v9a;
break;
@@ -3424,7 +3455,9 @@ sparc_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_register_bytes (gdbarch, 32*8 + 32*8 + 45*8);
set_gdbarch_register_name (gdbarch, sparc64_register_name);
set_gdbarch_deprecated_store_return_value (gdbarch, sparc_store_return_value);
- tdep->has_fpu = 1; /* (all but sparclet and sparclite) */
+#if 0
+ // OBSOLETE tdep->has_fpu = 1; /* (all but sparclet and sparclite) */
+#endif
tdep->fp_register_bytes = 64 * 4;
tdep->print_insn_mach = bfd_mach_sparc_v9a;
break;
@@ -3444,8 +3477,10 @@ sparc_dump_tdep (struct gdbarch *current_gdbarch, struct ui_file *file)
if (tdep == NULL)
return;
- fprintf_unfiltered (file, "sparc_dump_tdep: has_fpu = %d\n",
- tdep->has_fpu);
+#if 0
+ // OBSOLETE fprintf_unfiltered (file, "sparc_dump_tdep: has_fpu = %d\n",
+ // OBSOLETE tdep->has_fpu);
+#endif
fprintf_unfiltered (file, "sparc_dump_tdep: fp_register_bytes = %d\n",
tdep->fp_register_bytes);
fprintf_unfiltered (file, "sparc_dump_tdep: y_regnum = %d\n",
diff --git a/gdb/sparcl-stub.c b/gdb/sparcl-stub.c
index 3fcdc0a..6ba55a0 100644
--- a/gdb/sparcl-stub.c
+++ b/gdb/sparcl-stub.c
@@ -1,946 +1,946 @@
-/****************************************************************************
-
- THIS SOFTWARE IS NOT COPYRIGHTED
-
- HP offers the following for use in the public domain. HP makes no
- warranty with regard to the software or it's performance and the
- user accepts the software "AS IS" with all faults.
-
- HP DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED, WITH REGARD
- TO THIS SOFTWARE INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-
-****************************************************************************/
-
-/****************************************************************************
- * Header: remcom.c,v 1.34 91/03/09 12:29:49 glenne Exp $
- *
- * Module name: remcom.c $
- * Revision: 1.34 $
- * Date: 91/03/09 12:29:49 $
- * Contributor: Lake Stevens Instrument Division$
- *
- * Description: low level support for gdb debugger. $
- *
- * Considerations: only works on target hardware $
- *
- * Written by: Glenn Engel $
- * ModuleState: Experimental $
- *
- * NOTES: See Below $
- *
- * Modified for SPARC by Stu Grossman, Cygnus Support.
- * Based on sparc-stub.c, it's modified for SPARClite Debug Unit hardware
- * breakpoint support to create sparclite-stub.c, by Kung Hsu, Cygnus Support.
- *
- * This code has been extensively tested on the Fujitsu SPARClite demo board.
- *
- * To enable debugger support, two things need to happen. One, a
- * call to set_debug_traps() is necessary in order to allow any breakpoints
- * or error conditions to be properly intercepted and reported to gdb.
- * Two, a breakpoint needs to be generated to begin communication. This
- * is most easily accomplished by a call to breakpoint(). Breakpoint()
- * simulates a breakpoint by executing a trap #1.
- *
- *************
- *
- * The following gdb commands are supported:
- *
- * command function Return value
- *
- * g return the value of the CPU registers hex data or ENN
- * G set the value of the CPU registers OK or ENN
- * P set the value of a single CPU register OK or ENN
- *
- * mAA..AA,LLLL Read LLLL bytes at address AA..AA hex data or ENN
- * MAA..AA,LLLL: Write LLLL bytes at address AA.AA OK or ENN
- *
- * c Resume at current address SNN ( signal NN)
- * cAA..AA Continue at address AA..AA SNN
- *
- * s Step one instruction SNN
- * sAA..AA Step one instruction from AA..AA SNN
- *
- * k kill
- *
- * ? What was the last sigval ? SNN (signal NN)
- *
- * All commands and responses are sent with a packet which includes a
- * checksum. A packet consists of
- *
- * $<packet info>#<checksum>.
- *
- * where
- * <packet info> :: <characters representing the command or response>
- * <checksum> :: < two hex digits computed as modulo 256 sum of <packetinfo>>
- *
- * When a packet is received, it is first acknowledged with either '+' or '-'.
- * '+' indicates a successful transfer. '-' indicates a failed transfer.
- *
- * Example:
- *
- * Host: Reply:
- * $m0,10#2a +$00010203040506070809101112131415#42
- *
- ****************************************************************************/
-
-#include <string.h>
-#include <signal.h>
-#include <sparclite.h>
-
-/************************************************************************
- *
- * external low-level support routines
- */
-
-extern void putDebugChar (int c); /* write a single character */
-extern int getDebugChar (void); /* read and return a single char */
-
-/************************************************************************/
-/* BUFMAX defines the maximum number of characters in inbound/outbound buffers*/
-/* at least NUMREGBYTES*2 are needed for register packets */
-#define BUFMAX 2048
-
-static int initialized = 0; /* !0 means we've been initialized */
-
-extern void breakinst ();
-static void set_mem_fault_trap (int enable);
-static void get_in_break_mode (void);
-
-static const char hexchars[]="0123456789abcdef";
-
-#define NUMREGS 80
-
-/* Number of bytes of registers. */
-#define NUMREGBYTES (NUMREGS * 4)
-enum regnames {G0, G1, G2, G3, G4, G5, G6, G7,
- O0, O1, O2, O3, O4, O5, SP, O7,
- L0, L1, L2, L3, L4, L5, L6, L7,
- I0, I1, I2, I3, I4, I5, FP, I7,
-
- F0, F1, F2, F3, F4, F5, F6, F7,
- F8, F9, F10, F11, F12, F13, F14, F15,
- F16, F17, F18, F19, F20, F21, F22, F23,
- F24, F25, F26, F27, F28, F29, F30, F31,
- Y, PSR, WIM, TBR, PC, NPC, FPSR, CPSR,
- DIA1, DIA2, DDA1, DDA2, DDV1, DDV2, DCR, DSR };
-
-/*************************** ASSEMBLY CODE MACROS *************************/
-/* */
-
-extern void trap_low();
-
-/* Create private copies of common functions used by the stub. This prevents
- nasty interactions between app code and the stub (for instance if user steps
- into strlen, etc..) */
-
-static char *
-strcpy (char *dst, const char *src)
-{
- char *retval = dst;
-
- while ((*dst++ = *src++) != '\000');
-
- return retval;
-}
-
-static void *
-memcpy (void *vdst, const void *vsrc, int n)
-{
- char *dst = vdst;
- const char *src = vsrc;
- char *retval = dst;
-
- while (n-- > 0)
- *dst++ = *src++;
-
- return retval;
-}
-
-asm("
- .reserve trapstack, 1000 * 4, \"bss\", 8
-
- .data
- .align 4
-
-in_trap_handler:
- .word 0
-
- .text
- .align 4
-
-! This function is called when any SPARC trap (except window overflow or
-! underflow) occurs. It makes sure that the invalid register window is still
-! available before jumping into C code. It will also restore the world if you
-! return from handle_exception.
-!
-! On entry, trap_low expects l1 and l2 to contain pc and npc respectivly.
-! Register usage throughout the routine is as follows:
-!
-! l0 - psr
-! l1 - pc
-! l2 - npc
-! l3 - wim
-! l4 - scratch and y reg
-! l5 - scratch and tbr
-! l6 - unused
-! l7 - unused
-
- .globl _trap_low
-_trap_low:
- mov %psr, %l0
- mov %wim, %l3
-
- srl %l3, %l0, %l4 ! wim >> cwp
- cmp %l4, 1
- bne window_fine ! Branch if not in the invalid window
- nop
-
-! Handle window overflow
-
- mov %g1, %l4 ! Save g1, we use it to hold the wim
- srl %l3, 1, %g1 ! Rotate wim right
- tst %g1
- bg good_wim ! Branch if new wim is non-zero
- nop
-
-! At this point, we need to bring a 1 into the high order bit of the wim.
-! Since we don't want to make any assumptions about the number of register
-! windows, we figure it out dynamically so as to setup the wim correctly.
-
- not %g1 ! Fill g1 with ones
- mov %g1, %wim ! Fill the wim with ones
- nop
- nop
- nop
- mov %wim, %g1 ! Read back the wim
- inc %g1 ! Now g1 has 1 just to left of wim
- srl %g1, 1, %g1 ! Now put 1 at top of wim
- mov %g0, %wim ! Clear wim so that subsequent save
- nop ! won't trap
- nop
- nop
-
-good_wim:
- save %g0, %g0, %g0 ! Slip into next window
- mov %g1, %wim ! Install the new wim
-
- std %l0, [%sp + 0 * 4] ! save L & I registers
- std %l2, [%sp + 2 * 4]
- std %l4, [%sp + 4 * 4]
- std %l6, [%sp + 6 * 4]
-
- std %i0, [%sp + 8 * 4]
- std %i2, [%sp + 10 * 4]
- std %i4, [%sp + 12 * 4]
- std %i6, [%sp + 14 * 4]
-
- restore ! Go back to trap window.
- mov %l4, %g1 ! Restore %g1
-
-window_fine:
- sethi %hi(in_trap_handler), %l4
- ld [%lo(in_trap_handler) + %l4], %l5
- tst %l5
- bg recursive_trap
- inc %l5
-
- set trapstack+1000*4, %sp ! Switch to trap stack
-
-recursive_trap:
- st %l5, [%lo(in_trap_handler) + %l4]
- sub %sp,(16+1+6+1+80)*4,%sp ! Make room for input & locals
- ! + hidden arg + arg spill
- ! + doubleword alignment
- ! + registers[72] local var
-
- std %g0, [%sp + (24 + 0) * 4] ! registers[Gx]
- std %g2, [%sp + (24 + 2) * 4]
- std %g4, [%sp + (24 + 4) * 4]
- std %g6, [%sp + (24 + 6) * 4]
-
- std %i0, [%sp + (24 + 8) * 4] ! registers[Ox]
- std %i2, [%sp + (24 + 10) * 4]
- std %i4, [%sp + (24 + 12) * 4]
- std %i6, [%sp + (24 + 14) * 4]
-
- mov %y, %l4
- mov %tbr, %l5
- st %l4, [%sp + (24 + 64) * 4] ! Y
- st %l0, [%sp + (24 + 65) * 4] ! PSR
- st %l3, [%sp + (24 + 66) * 4] ! WIM
- st %l5, [%sp + (24 + 67) * 4] ! TBR
- st %l1, [%sp + (24 + 68) * 4] ! PC
- st %l2, [%sp + (24 + 69) * 4] ! NPC
-
- or %l0, 0xf20, %l4
- mov %l4, %psr ! Turn on traps, disable interrupts
-
- set 0x1000, %l1
- btst %l1, %l0 ! FP enabled?
- be no_fpstore
- nop
-
-! Must save fsr first, to flush the FQ. This may cause a deferred fp trap, so
-! traps must be enabled to allow the trap handler to clean things up.
-
- st %fsr, [%sp + (24 + 70) * 4]
-
- std %f0, [%sp + (24 + 32) * 4]
- std %f2, [%sp + (24 + 34) * 4]
- std %f4, [%sp + (24 + 36) * 4]
- std %f6, [%sp + (24 + 38) * 4]
- std %f8, [%sp + (24 + 40) * 4]
- std %f10, [%sp + (24 + 42) * 4]
- std %f12, [%sp + (24 + 44) * 4]
- std %f14, [%sp + (24 + 46) * 4]
- std %f16, [%sp + (24 + 48) * 4]
- std %f18, [%sp + (24 + 50) * 4]
- std %f20, [%sp + (24 + 52) * 4]
- std %f22, [%sp + (24 + 54) * 4]
- std %f24, [%sp + (24 + 56) * 4]
- std %f26, [%sp + (24 + 58) * 4]
- std %f28, [%sp + (24 + 60) * 4]
- std %f30, [%sp + (24 + 62) * 4]
-no_fpstore:
-
- call _handle_exception
- add %sp, 24 * 4, %o0 ! Pass address of registers
-
-! Reload all of the registers that aren't on the stack
-
- ld [%sp + (24 + 1) * 4], %g1 ! registers[Gx]
- ldd [%sp + (24 + 2) * 4], %g2
- ldd [%sp + (24 + 4) * 4], %g4
- ldd [%sp + (24 + 6) * 4], %g6
-
- ldd [%sp + (24 + 8) * 4], %i0 ! registers[Ox]
- ldd [%sp + (24 + 10) * 4], %i2
- ldd [%sp + (24 + 12) * 4], %i4
- ldd [%sp + (24 + 14) * 4], %i6
-
-
- ldd [%sp + (24 + 64) * 4], %l0 ! Y & PSR
- ldd [%sp + (24 + 68) * 4], %l2 ! PC & NPC
-
- set 0x1000, %l5
- btst %l5, %l1 ! FP enabled?
- be no_fpreload
- nop
-
- ldd [%sp + (24 + 32) * 4], %f0
- ldd [%sp + (24 + 34) * 4], %f2
- ldd [%sp + (24 + 36) * 4], %f4
- ldd [%sp + (24 + 38) * 4], %f6
- ldd [%sp + (24 + 40) * 4], %f8
- ldd [%sp + (24 + 42) * 4], %f10
- ldd [%sp + (24 + 44) * 4], %f12
- ldd [%sp + (24 + 46) * 4], %f14
- ldd [%sp + (24 + 48) * 4], %f16
- ldd [%sp + (24 + 50) * 4], %f18
- ldd [%sp + (24 + 52) * 4], %f20
- ldd [%sp + (24 + 54) * 4], %f22
- ldd [%sp + (24 + 56) * 4], %f24
- ldd [%sp + (24 + 58) * 4], %f26
- ldd [%sp + (24 + 60) * 4], %f28
- ldd [%sp + (24 + 62) * 4], %f30
-
- ld [%sp + (24 + 70) * 4], %fsr
-no_fpreload:
-
- restore ! Ensure that previous window is valid
- save %g0, %g0, %g0 ! by causing a window_underflow trap
-
- mov %l0, %y
- mov %l1, %psr ! Make sure that traps are disabled
- ! for rett
- sethi %hi(in_trap_handler), %l4
- ld [%lo(in_trap_handler) + %l4], %l5
- dec %l5
- st %l5, [%lo(in_trap_handler) + %l4]
-
- jmpl %l2, %g0 ! Restore old PC
- rett %l3 ! Restore old nPC
-");
-
-/* Convert ch from a hex digit to an int */
-
-static int
-hex (unsigned char ch)
-{
- if (ch >= 'a' && ch <= 'f')
- return ch-'a'+10;
- if (ch >= '0' && ch <= '9')
- return ch-'0';
- if (ch >= 'A' && ch <= 'F')
- return ch-'A'+10;
- return -1;
-}
-
-static char remcomInBuffer[BUFMAX];
-static char remcomOutBuffer[BUFMAX];
-
-/* scan for the sequence $<data>#<checksum> */
-
-unsigned char *
-getpacket (void)
-{
- unsigned char *buffer = &remcomInBuffer[0];
- unsigned char checksum;
- unsigned char xmitcsum;
- int count;
- char ch;
-
- while (1)
- {
- /* wait around for the start character, ignore all other characters */
- while ((ch = getDebugChar ()) != '$')
- ;
-
-retry:
- checksum = 0;
- xmitcsum = -1;
- count = 0;
-
- /* now, read until a # or end of buffer is found */
- while (count < BUFMAX)
- {
- ch = getDebugChar ();
- if (ch == '$')
- goto retry;
- if (ch == '#')
- break;
- checksum = checksum + ch;
- buffer[count] = ch;
- count = count + 1;
- }
- buffer[count] = 0;
-
- if (ch == '#')
- {
- ch = getDebugChar ();
- xmitcsum = hex (ch) << 4;
- ch = getDebugChar ();
- xmitcsum += hex (ch);
-
- if (checksum != xmitcsum)
- {
- putDebugChar ('-'); /* failed checksum */
- }
- else
- {
- putDebugChar ('+'); /* successful transfer */
-
- /* if a sequence char is present, reply the sequence ID */
- if (buffer[2] == ':')
- {
- putDebugChar (buffer[0]);
- putDebugChar (buffer[1]);
-
- return &buffer[3];
- }
-
- return &buffer[0];
- }
- }
- }
-}
-
-/* send the packet in buffer. */
-
-static void
-putpacket (unsigned char *buffer)
-{
- unsigned char checksum;
- int count;
- unsigned char ch;
-
- /* $<packet info>#<checksum>. */
- do
- {
- putDebugChar('$');
- checksum = 0;
- count = 0;
-
- while (ch = buffer[count])
- {
- putDebugChar (ch);
- checksum += ch;
- count += 1;
- }
-
- putDebugChar('#');
- putDebugChar(hexchars[checksum >> 4]);
- putDebugChar(hexchars[checksum & 0xf]);
-
- }
- while (getDebugChar() != '+');
-}
-
-/* Indicate to caller of mem2hex or hex2mem that there has been an
- error. */
-static volatile int mem_err = 0;
-
-/* Convert the memory pointed to by mem into hex, placing result in buf.
- * Return a pointer to the last char put in buf (null), in case of mem fault,
- * return 0.
- * If MAY_FAULT is non-zero, then we will handle memory faults by returning
- * a 0, else treat a fault like any other fault in the stub.
- */
-
-static unsigned char *
-mem2hex (unsigned char *mem, unsigned char *buf, int count, int may_fault)
-{
- unsigned char ch;
-
- set_mem_fault_trap(may_fault);
-
- while (count-- > 0)
- {
- ch = *mem++;
- if (mem_err)
- return 0;
- *buf++ = hexchars[ch >> 4];
- *buf++ = hexchars[ch & 0xf];
- }
-
- *buf = 0;
-
- set_mem_fault_trap(0);
-
- return buf;
-}
-
-/* convert the hex array pointed to by buf into binary to be placed in mem
- * return a pointer to the character AFTER the last byte written */
-
-static char *
-hex2mem (unsigned char *buf, unsigned char *mem, int count, int may_fault)
-{
- int i;
- unsigned char ch;
-
- set_mem_fault_trap(may_fault);
-
- for (i=0; i<count; i++)
- {
- ch = hex(*buf++) << 4;
- ch |= hex(*buf++);
- *mem++ = ch;
- if (mem_err)
- return 0;
- }
-
- set_mem_fault_trap(0);
-
- return mem;
-}
-
-/* This table contains the mapping between SPARC hardware trap types, and
- signals, which are primarily what GDB understands. It also indicates
- which hardware traps we need to commandeer when initializing the stub. */
-
-static struct hard_trap_info
-{
- unsigned char tt; /* Trap type code for SPARClite */
- unsigned char signo; /* Signal that we map this trap into */
-} hard_trap_info[] = {
- {0x01, SIGSEGV}, /* instruction access error */
- {0x02, SIGILL}, /* privileged instruction */
- {0x03, SIGILL}, /* illegal instruction */
- {0x04, SIGEMT}, /* fp disabled */
- {0x07, SIGBUS}, /* mem address not aligned */
- {0x09, SIGSEGV}, /* data access exception */
- {0x0a, SIGEMT}, /* tag overflow */
- {0x20, SIGBUS}, /* r register access error */
- {0x21, SIGBUS}, /* instruction access error */
- {0x24, SIGEMT}, /* cp disabled */
- {0x29, SIGBUS}, /* data access error */
- {0x2a, SIGFPE}, /* divide by zero */
- {0x2b, SIGBUS}, /* data store error */
- {0x80+1, SIGTRAP}, /* ta 1 - normal breakpoint instruction */
- {0xff, SIGTRAP}, /* hardware breakpoint */
- {0, 0} /* Must be last */
-};
-
-/* Set up exception handlers for tracing and breakpoints */
-
-void
-set_debug_traps (void)
-{
- struct hard_trap_info *ht;
-
-/* Only setup fp traps if the FP is disabled. */
-
- for (ht = hard_trap_info;
- ht->tt != 0 && ht->signo != 0;
- ht++)
- if (ht->tt != 4 || ! (read_psr () & 0x1000))
- exceptionHandler(ht->tt, trap_low);
-
- initialized = 1;
-}
-
-asm ("
-! Trap handler for memory errors. This just sets mem_err to be non-zero. It
-! assumes that %l1 is non-zero. This should be safe, as it is doubtful that
-! 0 would ever contain code that could mem fault. This routine will skip
-! past the faulting instruction after setting mem_err.
-
- .text
- .align 4
-
-_fltr_set_mem_err:
- sethi %hi(_mem_err), %l0
- st %l1, [%l0 + %lo(_mem_err)]
- jmpl %l2, %g0
- rett %l2+4
-");
-
-static void
-set_mem_fault_trap (int enable)
-{
- extern void fltr_set_mem_err();
- mem_err = 0;
-
- if (enable)
- exceptionHandler(9, fltr_set_mem_err);
- else
- exceptionHandler(9, trap_low);
-}
-
-asm ("
- .text
- .align 4
-
-_dummy_hw_breakpoint:
- jmpl %l2, %g0
- rett %l2+4
- nop
- nop
-");
-
-static void
-get_in_break_mode (void)
-{
- extern void dummy_hw_breakpoint();
-
- exceptionHandler (255, dummy_hw_breakpoint);
-
- asm ("ta 255");
-
- exceptionHandler (255, trap_low);
-}
-
-/* Convert the SPARC hardware trap type code to a unix signal number. */
-
-static int
-computeSignal (int tt)
-{
- struct hard_trap_info *ht;
-
- for (ht = hard_trap_info; ht->tt && ht->signo; ht++)
- if (ht->tt == tt)
- return ht->signo;
-
- return SIGHUP; /* default for things we don't know about */
-}
-
-/*
- * While we find nice hex chars, build an int.
- * Return number of chars processed.
- */
-
-static int
-hexToInt(char **ptr, int *intValue)
-{
- int numChars = 0;
- int hexValue;
-
- *intValue = 0;
-
- while (**ptr)
- {
- hexValue = hex(**ptr);
- if (hexValue < 0)
- break;
-
- *intValue = (*intValue << 4) | hexValue;
- numChars ++;
-
- (*ptr)++;
- }
-
- return (numChars);
-}
-
-/*
- * This function does all command procesing for interfacing to gdb. It
- * returns 1 if you should skip the instruction at the trap address, 0
- * otherwise.
- */
-
-static void
-handle_exception (unsigned long *registers)
-{
- int tt; /* Trap type */
- int sigval;
- int addr;
- int length;
- char *ptr;
- unsigned long *sp;
- unsigned long dsr;
-
-/* First, we must force all of the windows to be spilled out */
-
- asm(" save %sp, -64, %sp
- save %sp, -64, %sp
- save %sp, -64, %sp
- save %sp, -64, %sp
- save %sp, -64, %sp
- save %sp, -64, %sp
- save %sp, -64, %sp
- save %sp, -64, %sp
- restore
- restore
- restore
- restore
- restore
- restore
- restore
- restore
-");
-
- get_in_break_mode (); /* Enable DSU register writes */
-
- registers[DIA1] = read_asi (1, 0xff00);
- registers[DIA2] = read_asi (1, 0xff04);
- registers[DDA1] = read_asi (1, 0xff08);
- registers[DDA2] = read_asi (1, 0xff0c);
- registers[DDV1] = read_asi (1, 0xff10);
- registers[DDV2] = read_asi (1, 0xff14);
- registers[DCR] = read_asi (1, 0xff18);
- registers[DSR] = read_asi (1, 0xff1c);
-
- if (registers[PC] == (unsigned long)breakinst)
- {
- registers[PC] = registers[NPC];
- registers[NPC] += 4;
- }
- sp = (unsigned long *)registers[SP];
-
- dsr = (unsigned long)registers[DSR];
- if (dsr & 0x3c)
- tt = 255;
- else
- tt = (registers[TBR] >> 4) & 0xff;
-
- /* reply to host that an exception has occurred */
- sigval = computeSignal(tt);
- ptr = remcomOutBuffer;
-
- *ptr++ = 'T';
- *ptr++ = hexchars[sigval >> 4];
- *ptr++ = hexchars[sigval & 0xf];
-
- *ptr++ = hexchars[PC >> 4];
- *ptr++ = hexchars[PC & 0xf];
- *ptr++ = ':';
- ptr = mem2hex((char *)&registers[PC], ptr, 4, 0);
- *ptr++ = ';';
-
- *ptr++ = hexchars[FP >> 4];
- *ptr++ = hexchars[FP & 0xf];
- *ptr++ = ':';
- ptr = mem2hex(sp + 8 + 6, ptr, 4, 0); /* FP */
- *ptr++ = ';';
-
- *ptr++ = hexchars[SP >> 4];
- *ptr++ = hexchars[SP & 0xf];
- *ptr++ = ':';
- ptr = mem2hex((char *)&sp, ptr, 4, 0);
- *ptr++ = ';';
-
- *ptr++ = hexchars[NPC >> 4];
- *ptr++ = hexchars[NPC & 0xf];
- *ptr++ = ':';
- ptr = mem2hex((char *)&registers[NPC], ptr, 4, 0);
- *ptr++ = ';';
-
- *ptr++ = hexchars[O7 >> 4];
- *ptr++ = hexchars[O7 & 0xf];
- *ptr++ = ':';
- ptr = mem2hex((char *)&registers[O7], ptr, 4, 0);
- *ptr++ = ';';
-
- *ptr++ = 0;
-
- putpacket(remcomOutBuffer);
-
- while (1)
- {
- remcomOutBuffer[0] = 0;
-
- ptr = getpacket();
- switch (*ptr++)
- {
- case '?':
- remcomOutBuffer[0] = 'S';
- remcomOutBuffer[1] = hexchars[sigval >> 4];
- remcomOutBuffer[2] = hexchars[sigval & 0xf];
- remcomOutBuffer[3] = 0;
- break;
-
- case 'd':
- /* toggle debug flag */
- break;
-
- case 'g': /* return the value of the CPU registers */
- memcpy (&registers[L0], sp, 16 * 4); /* Copy L & I regs from stack */
- mem2hex ((char *)registers, remcomOutBuffer, NUMREGBYTES, 0);
- break;
-
- case 'G': /* Set the value of all registers */
- case 'P': /* Set the value of one register */
- {
- unsigned long *newsp, psr;
-
- psr = registers[PSR];
-
- if (ptr[-1] == 'P')
- {
- int regno;
-
- if (hexToInt (&ptr, &regno)
- && *ptr++ == '=')
- if (regno >= L0 && regno <= I7)
- hex2mem (ptr, sp + regno - L0, 4, 0);
- else
- hex2mem (ptr, (char *)&registers[regno], 4, 0);
- else
- {
- strcpy (remcomOutBuffer, "E01");
- break;
- }
- }
- else
- {
- hex2mem (ptr, (char *)registers, NUMREGBYTES, 0);
- memcpy (sp, &registers[L0], 16 * 4); /* Copy L & I regs to stack */
- }
-
- /* See if the stack pointer has moved. If so, then copy the saved
- locals and ins to the new location. This keeps the window
- overflow and underflow routines happy. */
-
- newsp = (unsigned long *)registers[SP];
- if (sp != newsp)
- sp = memcpy(newsp, sp, 16 * 4);
-
- /* Don't allow CWP to be modified. */
-
- if (psr != registers[PSR])
- registers[PSR] = (psr & 0x1f) | (registers[PSR] & ~0x1f);
-
- strcpy(remcomOutBuffer,"OK");
- }
- break;
-
- case 'm': /* mAA..AA,LLLL Read LLLL bytes at address AA..AA */
- /* Try to read %x,%x. */
-
- if (hexToInt(&ptr, &addr)
- && *ptr++ == ','
- && hexToInt(&ptr, &length))
- {
- if (mem2hex((char *)addr, remcomOutBuffer, length, 1))
- break;
-
- strcpy (remcomOutBuffer, "E03");
- }
- else
- strcpy(remcomOutBuffer,"E01");
- break;
-
- case 'M': /* MAA..AA,LLLL: Write LLLL bytes at address AA.AA return OK */
- /* Try to read '%x,%x:'. */
-
- if (hexToInt(&ptr, &addr)
- && *ptr++ == ','
- && hexToInt(&ptr, &length)
- && *ptr++ == ':')
- {
- if (hex2mem(ptr, (char *)addr, length, 1))
- strcpy(remcomOutBuffer, "OK");
- else
- strcpy(remcomOutBuffer, "E03");
- }
- else
- strcpy(remcomOutBuffer, "E02");
- break;
-
- case 'c': /* cAA..AA Continue at address AA..AA(optional) */
- /* try to read optional parameter, pc unchanged if no parm */
- if (hexToInt(&ptr, &addr))
- {
- registers[PC] = addr;
- registers[NPC] = addr + 4;
- }
-
-/* Need to flush the instruction cache here, as we may have deposited a
- breakpoint, and the icache probably has no way of knowing that a data ref to
- some location may have changed something that is in the instruction cache.
- */
-
- flush_i_cache ();
-
- if (!(registers[DSR] & 0x1) /* DSU enabled? */
- && !(registers[DCR] & 0x200)) /* Are we in break state? */
- { /* Yes, set the DSU regs */
- write_asi (1, 0xff00, registers[DIA1]);
- write_asi (1, 0xff04, registers[DIA2]);
- write_asi (1, 0xff08, registers[DDA1]);
- write_asi (1, 0xff0c, registers[DDA2]);
- write_asi (1, 0xff10, registers[DDV1]);
- write_asi (1, 0xff14, registers[DDV2]);
- write_asi (1, 0xff1c, registers[DSR]);
- write_asi (1, 0xff18, registers[DCR] | 0x200); /* Clear break */
- }
-
- return;
-
- /* kill the program */
- case 'k' : /* do nothing */
- break;
-#if 0
- case 't': /* Test feature */
- asm (" std %f30,[%sp]");
- break;
-#endif
- case 'r': /* Reset */
- asm ("call 0
- nop ");
- break;
- } /* switch */
-
- /* reply to the request */
- putpacket(remcomOutBuffer);
- }
-}
-
-/* This function will generate a breakpoint exception. It is used at the
- beginning of a program to sync up with a debugger and can be used
- otherwise as a quick means to stop program execution and "break" into
- the debugger. */
-
-void
-breakpoint (void)
-{
- if (!initialized)
- return;
-
- asm(" .globl _breakinst
-
- _breakinst: ta 1
- ");
-}
+// OBSOLETE /****************************************************************************
+// OBSOLETE
+// OBSOLETE THIS SOFTWARE IS NOT COPYRIGHTED
+// OBSOLETE
+// OBSOLETE HP offers the following for use in the public domain. HP makes no
+// OBSOLETE warranty with regard to the software or it's performance and the
+// OBSOLETE user accepts the software "AS IS" with all faults.
+// OBSOLETE
+// OBSOLETE HP DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED, WITH REGARD
+// OBSOLETE TO THIS SOFTWARE INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+// OBSOLETE OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+// OBSOLETE
+// OBSOLETE ****************************************************************************/
+// OBSOLETE
+// OBSOLETE /****************************************************************************
+// OBSOLETE * Header: remcom.c,v 1.34 91/03/09 12:29:49 glenne Exp $
+// OBSOLETE *
+// OBSOLETE * Module name: remcom.c $
+// OBSOLETE * Revision: 1.34 $
+// OBSOLETE * Date: 91/03/09 12:29:49 $
+// OBSOLETE * Contributor: Lake Stevens Instrument Division$
+// OBSOLETE *
+// OBSOLETE * Description: low level support for gdb debugger. $
+// OBSOLETE *
+// OBSOLETE * Considerations: only works on target hardware $
+// OBSOLETE *
+// OBSOLETE * Written by: Glenn Engel $
+// OBSOLETE * ModuleState: Experimental $
+// OBSOLETE *
+// OBSOLETE * NOTES: See Below $
+// OBSOLETE *
+// OBSOLETE * Modified for SPARC by Stu Grossman, Cygnus Support.
+// OBSOLETE * Based on sparc-stub.c, it's modified for SPARClite Debug Unit hardware
+// OBSOLETE * breakpoint support to create sparclite-stub.c, by Kung Hsu, Cygnus Support.
+// OBSOLETE *
+// OBSOLETE * This code has been extensively tested on the Fujitsu SPARClite demo board.
+// OBSOLETE *
+// OBSOLETE * To enable debugger support, two things need to happen. One, a
+// OBSOLETE * call to set_debug_traps() is necessary in order to allow any breakpoints
+// OBSOLETE * or error conditions to be properly intercepted and reported to gdb.
+// OBSOLETE * Two, a breakpoint needs to be generated to begin communication. This
+// OBSOLETE * is most easily accomplished by a call to breakpoint(). Breakpoint()
+// OBSOLETE * simulates a breakpoint by executing a trap #1.
+// OBSOLETE *
+// OBSOLETE *************
+// OBSOLETE *
+// OBSOLETE * The following gdb commands are supported:
+// OBSOLETE *
+// OBSOLETE * command function Return value
+// OBSOLETE *
+// OBSOLETE * g return the value of the CPU registers hex data or ENN
+// OBSOLETE * G set the value of the CPU registers OK or ENN
+// OBSOLETE * P set the value of a single CPU register OK or ENN
+// OBSOLETE *
+// OBSOLETE * mAA..AA,LLLL Read LLLL bytes at address AA..AA hex data or ENN
+// OBSOLETE * MAA..AA,LLLL: Write LLLL bytes at address AA.AA OK or ENN
+// OBSOLETE *
+// OBSOLETE * c Resume at current address SNN ( signal NN)
+// OBSOLETE * cAA..AA Continue at address AA..AA SNN
+// OBSOLETE *
+// OBSOLETE * s Step one instruction SNN
+// OBSOLETE * sAA..AA Step one instruction from AA..AA SNN
+// OBSOLETE *
+// OBSOLETE * k kill
+// OBSOLETE *
+// OBSOLETE * ? What was the last sigval ? SNN (signal NN)
+// OBSOLETE *
+// OBSOLETE * All commands and responses are sent with a packet which includes a
+// OBSOLETE * checksum. A packet consists of
+// OBSOLETE *
+// OBSOLETE * $<packet info>#<checksum>.
+// OBSOLETE *
+// OBSOLETE * where
+// OBSOLETE * <packet info> :: <characters representing the command or response>
+// OBSOLETE * <checksum> :: < two hex digits computed as modulo 256 sum of <packetinfo>>
+// OBSOLETE *
+// OBSOLETE * When a packet is received, it is first acknowledged with either '+' or '-'.
+// OBSOLETE * '+' indicates a successful transfer. '-' indicates a failed transfer.
+// OBSOLETE *
+// OBSOLETE * Example:
+// OBSOLETE *
+// OBSOLETE * Host: Reply:
+// OBSOLETE * $m0,10#2a +$00010203040506070809101112131415#42
+// OBSOLETE *
+// OBSOLETE ****************************************************************************/
+// OBSOLETE
+// OBSOLETE #include <string.h>
+// OBSOLETE #include <signal.h>
+// OBSOLETE #include <sparclite.h>
+// OBSOLETE
+// OBSOLETE /************************************************************************
+// OBSOLETE *
+// OBSOLETE * external low-level support routines
+// OBSOLETE */
+// OBSOLETE
+// OBSOLETE extern void putDebugChar (int c); /* write a single character */
+// OBSOLETE extern int getDebugChar (void); /* read and return a single char */
+// OBSOLETE
+// OBSOLETE /************************************************************************/
+// OBSOLETE /* BUFMAX defines the maximum number of characters in inbound/outbound buffers*/
+// OBSOLETE /* at least NUMREGBYTES*2 are needed for register packets */
+// OBSOLETE #define BUFMAX 2048
+// OBSOLETE
+// OBSOLETE static int initialized = 0; /* !0 means we've been initialized */
+// OBSOLETE
+// OBSOLETE extern void breakinst ();
+// OBSOLETE static void set_mem_fault_trap (int enable);
+// OBSOLETE static void get_in_break_mode (void);
+// OBSOLETE
+// OBSOLETE static const char hexchars[]="0123456789abcdef";
+// OBSOLETE
+// OBSOLETE #define NUMREGS 80
+// OBSOLETE
+// OBSOLETE /* Number of bytes of registers. */
+// OBSOLETE #define NUMREGBYTES (NUMREGS * 4)
+// OBSOLETE enum regnames {G0, G1, G2, G3, G4, G5, G6, G7,
+// OBSOLETE O0, O1, O2, O3, O4, O5, SP, O7,
+// OBSOLETE L0, L1, L2, L3, L4, L5, L6, L7,
+// OBSOLETE I0, I1, I2, I3, I4, I5, FP, I7,
+// OBSOLETE
+// OBSOLETE F0, F1, F2, F3, F4, F5, F6, F7,
+// OBSOLETE F8, F9, F10, F11, F12, F13, F14, F15,
+// OBSOLETE F16, F17, F18, F19, F20, F21, F22, F23,
+// OBSOLETE F24, F25, F26, F27, F28, F29, F30, F31,
+// OBSOLETE Y, PSR, WIM, TBR, PC, NPC, FPSR, CPSR,
+// OBSOLETE DIA1, DIA2, DDA1, DDA2, DDV1, DDV2, DCR, DSR };
+// OBSOLETE
+// OBSOLETE /*************************** ASSEMBLY CODE MACROS *************************/
+// OBSOLETE /* */
+// OBSOLETE
+// OBSOLETE extern void trap_low();
+// OBSOLETE
+// OBSOLETE /* Create private copies of common functions used by the stub. This prevents
+// OBSOLETE nasty interactions between app code and the stub (for instance if user steps
+// OBSOLETE into strlen, etc..) */
+// OBSOLETE
+// OBSOLETE static char *
+// OBSOLETE strcpy (char *dst, const char *src)
+// OBSOLETE {
+// OBSOLETE char *retval = dst;
+// OBSOLETE
+// OBSOLETE while ((*dst++ = *src++) != '\000');
+// OBSOLETE
+// OBSOLETE return retval;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE static void *
+// OBSOLETE memcpy (void *vdst, const void *vsrc, int n)
+// OBSOLETE {
+// OBSOLETE char *dst = vdst;
+// OBSOLETE const char *src = vsrc;
+// OBSOLETE char *retval = dst;
+// OBSOLETE
+// OBSOLETE while (n-- > 0)
+// OBSOLETE *dst++ = *src++;
+// OBSOLETE
+// OBSOLETE return retval;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE asm("
+// OBSOLETE .reserve trapstack, 1000 * 4, \"bss\", 8
+// OBSOLETE
+// OBSOLETE .data
+// OBSOLETE .align 4
+// OBSOLETE
+// OBSOLETE in_trap_handler:
+// OBSOLETE .word 0
+// OBSOLETE
+// OBSOLETE .text
+// OBSOLETE .align 4
+// OBSOLETE
+// OBSOLETE ! This function is called when any SPARC trap (except window overflow or
+// OBSOLETE ! underflow) occurs. It makes sure that the invalid register window is still
+// OBSOLETE ! available before jumping into C code. It will also restore the world if you
+// OBSOLETE ! return from handle_exception.
+// OBSOLETE !
+// OBSOLETE ! On entry, trap_low expects l1 and l2 to contain pc and npc respectivly.
+// OBSOLETE ! Register usage throughout the routine is as follows:
+// OBSOLETE !
+// OBSOLETE ! l0 - psr
+// OBSOLETE ! l1 - pc
+// OBSOLETE ! l2 - npc
+// OBSOLETE ! l3 - wim
+// OBSOLETE ! l4 - scratch and y reg
+// OBSOLETE ! l5 - scratch and tbr
+// OBSOLETE ! l6 - unused
+// OBSOLETE ! l7 - unused
+// OBSOLETE
+// OBSOLETE .globl _trap_low
+// OBSOLETE _trap_low:
+// OBSOLETE mov %psr, %l0
+// OBSOLETE mov %wim, %l3
+// OBSOLETE
+// OBSOLETE srl %l3, %l0, %l4 ! wim >> cwp
+// OBSOLETE cmp %l4, 1
+// OBSOLETE bne window_fine ! Branch if not in the invalid window
+// OBSOLETE nop
+// OBSOLETE
+// OBSOLETE ! Handle window overflow
+// OBSOLETE
+// OBSOLETE mov %g1, %l4 ! Save g1, we use it to hold the wim
+// OBSOLETE srl %l3, 1, %g1 ! Rotate wim right
+// OBSOLETE tst %g1
+// OBSOLETE bg good_wim ! Branch if new wim is non-zero
+// OBSOLETE nop
+// OBSOLETE
+// OBSOLETE ! At this point, we need to bring a 1 into the high order bit of the wim.
+// OBSOLETE ! Since we don't want to make any assumptions about the number of register
+// OBSOLETE ! windows, we figure it out dynamically so as to setup the wim correctly.
+// OBSOLETE
+// OBSOLETE not %g1 ! Fill g1 with ones
+// OBSOLETE mov %g1, %wim ! Fill the wim with ones
+// OBSOLETE nop
+// OBSOLETE nop
+// OBSOLETE nop
+// OBSOLETE mov %wim, %g1 ! Read back the wim
+// OBSOLETE inc %g1 ! Now g1 has 1 just to left of wim
+// OBSOLETE srl %g1, 1, %g1 ! Now put 1 at top of wim
+// OBSOLETE mov %g0, %wim ! Clear wim so that subsequent save
+// OBSOLETE nop ! won't trap
+// OBSOLETE nop
+// OBSOLETE nop
+// OBSOLETE
+// OBSOLETE good_wim:
+// OBSOLETE save %g0, %g0, %g0 ! Slip into next window
+// OBSOLETE mov %g1, %wim ! Install the new wim
+// OBSOLETE
+// OBSOLETE std %l0, [%sp + 0 * 4] ! save L & I registers
+// OBSOLETE std %l2, [%sp + 2 * 4]
+// OBSOLETE std %l4, [%sp + 4 * 4]
+// OBSOLETE std %l6, [%sp + 6 * 4]
+// OBSOLETE
+// OBSOLETE std %i0, [%sp + 8 * 4]
+// OBSOLETE std %i2, [%sp + 10 * 4]
+// OBSOLETE std %i4, [%sp + 12 * 4]
+// OBSOLETE std %i6, [%sp + 14 * 4]
+// OBSOLETE
+// OBSOLETE restore ! Go back to trap window.
+// OBSOLETE mov %l4, %g1 ! Restore %g1
+// OBSOLETE
+// OBSOLETE window_fine:
+// OBSOLETE sethi %hi(in_trap_handler), %l4
+// OBSOLETE ld [%lo(in_trap_handler) + %l4], %l5
+// OBSOLETE tst %l5
+// OBSOLETE bg recursive_trap
+// OBSOLETE inc %l5
+// OBSOLETE
+// OBSOLETE set trapstack+1000*4, %sp ! Switch to trap stack
+// OBSOLETE
+// OBSOLETE recursive_trap:
+// OBSOLETE st %l5, [%lo(in_trap_handler) + %l4]
+// OBSOLETE sub %sp,(16+1+6+1+80)*4,%sp ! Make room for input & locals
+// OBSOLETE ! + hidden arg + arg spill
+// OBSOLETE ! + doubleword alignment
+// OBSOLETE ! + registers[72] local var
+// OBSOLETE
+// OBSOLETE std %g0, [%sp + (24 + 0) * 4] ! registers[Gx]
+// OBSOLETE std %g2, [%sp + (24 + 2) * 4]
+// OBSOLETE std %g4, [%sp + (24 + 4) * 4]
+// OBSOLETE std %g6, [%sp + (24 + 6) * 4]
+// OBSOLETE
+// OBSOLETE std %i0, [%sp + (24 + 8) * 4] ! registers[Ox]
+// OBSOLETE std %i2, [%sp + (24 + 10) * 4]
+// OBSOLETE std %i4, [%sp + (24 + 12) * 4]
+// OBSOLETE std %i6, [%sp + (24 + 14) * 4]
+// OBSOLETE
+// OBSOLETE mov %y, %l4
+// OBSOLETE mov %tbr, %l5
+// OBSOLETE st %l4, [%sp + (24 + 64) * 4] ! Y
+// OBSOLETE st %l0, [%sp + (24 + 65) * 4] ! PSR
+// OBSOLETE st %l3, [%sp + (24 + 66) * 4] ! WIM
+// OBSOLETE st %l5, [%sp + (24 + 67) * 4] ! TBR
+// OBSOLETE st %l1, [%sp + (24 + 68) * 4] ! PC
+// OBSOLETE st %l2, [%sp + (24 + 69) * 4] ! NPC
+// OBSOLETE
+// OBSOLETE or %l0, 0xf20, %l4
+// OBSOLETE mov %l4, %psr ! Turn on traps, disable interrupts
+// OBSOLETE
+// OBSOLETE set 0x1000, %l1
+// OBSOLETE btst %l1, %l0 ! FP enabled?
+// OBSOLETE be no_fpstore
+// OBSOLETE nop
+// OBSOLETE
+// OBSOLETE ! Must save fsr first, to flush the FQ. This may cause a deferred fp trap, so
+// OBSOLETE ! traps must be enabled to allow the trap handler to clean things up.
+// OBSOLETE
+// OBSOLETE st %fsr, [%sp + (24 + 70) * 4]
+// OBSOLETE
+// OBSOLETE std %f0, [%sp + (24 + 32) * 4]
+// OBSOLETE std %f2, [%sp + (24 + 34) * 4]
+// OBSOLETE std %f4, [%sp + (24 + 36) * 4]
+// OBSOLETE std %f6, [%sp + (24 + 38) * 4]
+// OBSOLETE std %f8, [%sp + (24 + 40) * 4]
+// OBSOLETE std %f10, [%sp + (24 + 42) * 4]
+// OBSOLETE std %f12, [%sp + (24 + 44) * 4]
+// OBSOLETE std %f14, [%sp + (24 + 46) * 4]
+// OBSOLETE std %f16, [%sp + (24 + 48) * 4]
+// OBSOLETE std %f18, [%sp + (24 + 50) * 4]
+// OBSOLETE std %f20, [%sp + (24 + 52) * 4]
+// OBSOLETE std %f22, [%sp + (24 + 54) * 4]
+// OBSOLETE std %f24, [%sp + (24 + 56) * 4]
+// OBSOLETE std %f26, [%sp + (24 + 58) * 4]
+// OBSOLETE std %f28, [%sp + (24 + 60) * 4]
+// OBSOLETE std %f30, [%sp + (24 + 62) * 4]
+// OBSOLETE no_fpstore:
+// OBSOLETE
+// OBSOLETE call _handle_exception
+// OBSOLETE add %sp, 24 * 4, %o0 ! Pass address of registers
+// OBSOLETE
+// OBSOLETE ! Reload all of the registers that aren't on the stack
+// OBSOLETE
+// OBSOLETE ld [%sp + (24 + 1) * 4], %g1 ! registers[Gx]
+// OBSOLETE ldd [%sp + (24 + 2) * 4], %g2
+// OBSOLETE ldd [%sp + (24 + 4) * 4], %g4
+// OBSOLETE ldd [%sp + (24 + 6) * 4], %g6
+// OBSOLETE
+// OBSOLETE ldd [%sp + (24 + 8) * 4], %i0 ! registers[Ox]
+// OBSOLETE ldd [%sp + (24 + 10) * 4], %i2
+// OBSOLETE ldd [%sp + (24 + 12) * 4], %i4
+// OBSOLETE ldd [%sp + (24 + 14) * 4], %i6
+// OBSOLETE
+// OBSOLETE
+// OBSOLETE ldd [%sp + (24 + 64) * 4], %l0 ! Y & PSR
+// OBSOLETE ldd [%sp + (24 + 68) * 4], %l2 ! PC & NPC
+// OBSOLETE
+// OBSOLETE set 0x1000, %l5
+// OBSOLETE btst %l5, %l1 ! FP enabled?
+// OBSOLETE be no_fpreload
+// OBSOLETE nop
+// OBSOLETE
+// OBSOLETE ldd [%sp + (24 + 32) * 4], %f0
+// OBSOLETE ldd [%sp + (24 + 34) * 4], %f2
+// OBSOLETE ldd [%sp + (24 + 36) * 4], %f4
+// OBSOLETE ldd [%sp + (24 + 38) * 4], %f6
+// OBSOLETE ldd [%sp + (24 + 40) * 4], %f8
+// OBSOLETE ldd [%sp + (24 + 42) * 4], %f10
+// OBSOLETE ldd [%sp + (24 + 44) * 4], %f12
+// OBSOLETE ldd [%sp + (24 + 46) * 4], %f14
+// OBSOLETE ldd [%sp + (24 + 48) * 4], %f16
+// OBSOLETE ldd [%sp + (24 + 50) * 4], %f18
+// OBSOLETE ldd [%sp + (24 + 52) * 4], %f20
+// OBSOLETE ldd [%sp + (24 + 54) * 4], %f22
+// OBSOLETE ldd [%sp + (24 + 56) * 4], %f24
+// OBSOLETE ldd [%sp + (24 + 58) * 4], %f26
+// OBSOLETE ldd [%sp + (24 + 60) * 4], %f28
+// OBSOLETE ldd [%sp + (24 + 62) * 4], %f30
+// OBSOLETE
+// OBSOLETE ld [%sp + (24 + 70) * 4], %fsr
+// OBSOLETE no_fpreload:
+// OBSOLETE
+// OBSOLETE restore ! Ensure that previous window is valid
+// OBSOLETE save %g0, %g0, %g0 ! by causing a window_underflow trap
+// OBSOLETE
+// OBSOLETE mov %l0, %y
+// OBSOLETE mov %l1, %psr ! Make sure that traps are disabled
+// OBSOLETE ! for rett
+// OBSOLETE sethi %hi(in_trap_handler), %l4
+// OBSOLETE ld [%lo(in_trap_handler) + %l4], %l5
+// OBSOLETE dec %l5
+// OBSOLETE st %l5, [%lo(in_trap_handler) + %l4]
+// OBSOLETE
+// OBSOLETE jmpl %l2, %g0 ! Restore old PC
+// OBSOLETE rett %l3 ! Restore old nPC
+// OBSOLETE ");
+// OBSOLETE
+// OBSOLETE /* Convert ch from a hex digit to an int */
+// OBSOLETE
+// OBSOLETE static int
+// OBSOLETE hex (unsigned char ch)
+// OBSOLETE {
+// OBSOLETE if (ch >= 'a' && ch <= 'f')
+// OBSOLETE return ch-'a'+10;
+// OBSOLETE if (ch >= '0' && ch <= '9')
+// OBSOLETE return ch-'0';
+// OBSOLETE if (ch >= 'A' && ch <= 'F')
+// OBSOLETE return ch-'A'+10;
+// OBSOLETE return -1;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE static char remcomInBuffer[BUFMAX];
+// OBSOLETE static char remcomOutBuffer[BUFMAX];
+// OBSOLETE
+// OBSOLETE /* scan for the sequence $<data>#<checksum> */
+// OBSOLETE
+// OBSOLETE unsigned char *
+// OBSOLETE getpacket (void)
+// OBSOLETE {
+// OBSOLETE unsigned char *buffer = &remcomInBuffer[0];
+// OBSOLETE unsigned char checksum;
+// OBSOLETE unsigned char xmitcsum;
+// OBSOLETE int count;
+// OBSOLETE char ch;
+// OBSOLETE
+// OBSOLETE while (1)
+// OBSOLETE {
+// OBSOLETE /* wait around for the start character, ignore all other characters */
+// OBSOLETE while ((ch = getDebugChar ()) != '$')
+// OBSOLETE ;
+// OBSOLETE
+// OBSOLETE retry:
+// OBSOLETE checksum = 0;
+// OBSOLETE xmitcsum = -1;
+// OBSOLETE count = 0;
+// OBSOLETE
+// OBSOLETE /* now, read until a # or end of buffer is found */
+// OBSOLETE while (count < BUFMAX)
+// OBSOLETE {
+// OBSOLETE ch = getDebugChar ();
+// OBSOLETE if (ch == '$')
+// OBSOLETE goto retry;
+// OBSOLETE if (ch == '#')
+// OBSOLETE break;
+// OBSOLETE checksum = checksum + ch;
+// OBSOLETE buffer[count] = ch;
+// OBSOLETE count = count + 1;
+// OBSOLETE }
+// OBSOLETE buffer[count] = 0;
+// OBSOLETE
+// OBSOLETE if (ch == '#')
+// OBSOLETE {
+// OBSOLETE ch = getDebugChar ();
+// OBSOLETE xmitcsum = hex (ch) << 4;
+// OBSOLETE ch = getDebugChar ();
+// OBSOLETE xmitcsum += hex (ch);
+// OBSOLETE
+// OBSOLETE if (checksum != xmitcsum)
+// OBSOLETE {
+// OBSOLETE putDebugChar ('-'); /* failed checksum */
+// OBSOLETE }
+// OBSOLETE else
+// OBSOLETE {
+// OBSOLETE putDebugChar ('+'); /* successful transfer */
+// OBSOLETE
+// OBSOLETE /* if a sequence char is present, reply the sequence ID */
+// OBSOLETE if (buffer[2] == ':')
+// OBSOLETE {
+// OBSOLETE putDebugChar (buffer[0]);
+// OBSOLETE putDebugChar (buffer[1]);
+// OBSOLETE
+// OBSOLETE return &buffer[3];
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE return &buffer[0];
+// OBSOLETE }
+// OBSOLETE }
+// OBSOLETE }
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE /* send the packet in buffer. */
+// OBSOLETE
+// OBSOLETE static void
+// OBSOLETE putpacket (unsigned char *buffer)
+// OBSOLETE {
+// OBSOLETE unsigned char checksum;
+// OBSOLETE int count;
+// OBSOLETE unsigned char ch;
+// OBSOLETE
+// OBSOLETE /* $<packet info>#<checksum>. */
+// OBSOLETE do
+// OBSOLETE {
+// OBSOLETE putDebugChar('$');
+// OBSOLETE checksum = 0;
+// OBSOLETE count = 0;
+// OBSOLETE
+// OBSOLETE while (ch = buffer[count])
+// OBSOLETE {
+// OBSOLETE putDebugChar (ch);
+// OBSOLETE checksum += ch;
+// OBSOLETE count += 1;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE putDebugChar('#');
+// OBSOLETE putDebugChar(hexchars[checksum >> 4]);
+// OBSOLETE putDebugChar(hexchars[checksum & 0xf]);
+// OBSOLETE
+// OBSOLETE }
+// OBSOLETE while (getDebugChar() != '+');
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE /* Indicate to caller of mem2hex or hex2mem that there has been an
+// OBSOLETE error. */
+// OBSOLETE static volatile int mem_err = 0;
+// OBSOLETE
+// OBSOLETE /* Convert the memory pointed to by mem into hex, placing result in buf.
+// OBSOLETE * Return a pointer to the last char put in buf (null), in case of mem fault,
+// OBSOLETE * return 0.
+// OBSOLETE * If MAY_FAULT is non-zero, then we will handle memory faults by returning
+// OBSOLETE * a 0, else treat a fault like any other fault in the stub.
+// OBSOLETE */
+// OBSOLETE
+// OBSOLETE static unsigned char *
+// OBSOLETE mem2hex (unsigned char *mem, unsigned char *buf, int count, int may_fault)
+// OBSOLETE {
+// OBSOLETE unsigned char ch;
+// OBSOLETE
+// OBSOLETE set_mem_fault_trap(may_fault);
+// OBSOLETE
+// OBSOLETE while (count-- > 0)
+// OBSOLETE {
+// OBSOLETE ch = *mem++;
+// OBSOLETE if (mem_err)
+// OBSOLETE return 0;
+// OBSOLETE *buf++ = hexchars[ch >> 4];
+// OBSOLETE *buf++ = hexchars[ch & 0xf];
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE *buf = 0;
+// OBSOLETE
+// OBSOLETE set_mem_fault_trap(0);
+// OBSOLETE
+// OBSOLETE return buf;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE /* convert the hex array pointed to by buf into binary to be placed in mem
+// OBSOLETE * return a pointer to the character AFTER the last byte written */
+// OBSOLETE
+// OBSOLETE static char *
+// OBSOLETE hex2mem (unsigned char *buf, unsigned char *mem, int count, int may_fault)
+// OBSOLETE {
+// OBSOLETE int i;
+// OBSOLETE unsigned char ch;
+// OBSOLETE
+// OBSOLETE set_mem_fault_trap(may_fault);
+// OBSOLETE
+// OBSOLETE for (i=0; i<count; i++)
+// OBSOLETE {
+// OBSOLETE ch = hex(*buf++) << 4;
+// OBSOLETE ch |= hex(*buf++);
+// OBSOLETE *mem++ = ch;
+// OBSOLETE if (mem_err)
+// OBSOLETE return 0;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE set_mem_fault_trap(0);
+// OBSOLETE
+// OBSOLETE return mem;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE /* This table contains the mapping between SPARC hardware trap types, and
+// OBSOLETE signals, which are primarily what GDB understands. It also indicates
+// OBSOLETE which hardware traps we need to commandeer when initializing the stub. */
+// OBSOLETE
+// OBSOLETE static struct hard_trap_info
+// OBSOLETE {
+// OBSOLETE unsigned char tt; /* Trap type code for SPARClite */
+// OBSOLETE unsigned char signo; /* Signal that we map this trap into */
+// OBSOLETE } hard_trap_info[] = {
+// OBSOLETE {0x01, SIGSEGV}, /* instruction access error */
+// OBSOLETE {0x02, SIGILL}, /* privileged instruction */
+// OBSOLETE {0x03, SIGILL}, /* illegal instruction */
+// OBSOLETE {0x04, SIGEMT}, /* fp disabled */
+// OBSOLETE {0x07, SIGBUS}, /* mem address not aligned */
+// OBSOLETE {0x09, SIGSEGV}, /* data access exception */
+// OBSOLETE {0x0a, SIGEMT}, /* tag overflow */
+// OBSOLETE {0x20, SIGBUS}, /* r register access error */
+// OBSOLETE {0x21, SIGBUS}, /* instruction access error */
+// OBSOLETE {0x24, SIGEMT}, /* cp disabled */
+// OBSOLETE {0x29, SIGBUS}, /* data access error */
+// OBSOLETE {0x2a, SIGFPE}, /* divide by zero */
+// OBSOLETE {0x2b, SIGBUS}, /* data store error */
+// OBSOLETE {0x80+1, SIGTRAP}, /* ta 1 - normal breakpoint instruction */
+// OBSOLETE {0xff, SIGTRAP}, /* hardware breakpoint */
+// OBSOLETE {0, 0} /* Must be last */
+// OBSOLETE };
+// OBSOLETE
+// OBSOLETE /* Set up exception handlers for tracing and breakpoints */
+// OBSOLETE
+// OBSOLETE void
+// OBSOLETE set_debug_traps (void)
+// OBSOLETE {
+// OBSOLETE struct hard_trap_info *ht;
+// OBSOLETE
+// OBSOLETE /* Only setup fp traps if the FP is disabled. */
+// OBSOLETE
+// OBSOLETE for (ht = hard_trap_info;
+// OBSOLETE ht->tt != 0 && ht->signo != 0;
+// OBSOLETE ht++)
+// OBSOLETE if (ht->tt != 4 || ! (read_psr () & 0x1000))
+// OBSOLETE exceptionHandler(ht->tt, trap_low);
+// OBSOLETE
+// OBSOLETE initialized = 1;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE asm ("
+// OBSOLETE ! Trap handler for memory errors. This just sets mem_err to be non-zero. It
+// OBSOLETE ! assumes that %l1 is non-zero. This should be safe, as it is doubtful that
+// OBSOLETE ! 0 would ever contain code that could mem fault. This routine will skip
+// OBSOLETE ! past the faulting instruction after setting mem_err.
+// OBSOLETE
+// OBSOLETE .text
+// OBSOLETE .align 4
+// OBSOLETE
+// OBSOLETE _fltr_set_mem_err:
+// OBSOLETE sethi %hi(_mem_err), %l0
+// OBSOLETE st %l1, [%l0 + %lo(_mem_err)]
+// OBSOLETE jmpl %l2, %g0
+// OBSOLETE rett %l2+4
+// OBSOLETE ");
+// OBSOLETE
+// OBSOLETE static void
+// OBSOLETE set_mem_fault_trap (int enable)
+// OBSOLETE {
+// OBSOLETE extern void fltr_set_mem_err();
+// OBSOLETE mem_err = 0;
+// OBSOLETE
+// OBSOLETE if (enable)
+// OBSOLETE exceptionHandler(9, fltr_set_mem_err);
+// OBSOLETE else
+// OBSOLETE exceptionHandler(9, trap_low);
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE asm ("
+// OBSOLETE .text
+// OBSOLETE .align 4
+// OBSOLETE
+// OBSOLETE _dummy_hw_breakpoint:
+// OBSOLETE jmpl %l2, %g0
+// OBSOLETE rett %l2+4
+// OBSOLETE nop
+// OBSOLETE nop
+// OBSOLETE ");
+// OBSOLETE
+// OBSOLETE static void
+// OBSOLETE get_in_break_mode (void)
+// OBSOLETE {
+// OBSOLETE extern void dummy_hw_breakpoint();
+// OBSOLETE
+// OBSOLETE exceptionHandler (255, dummy_hw_breakpoint);
+// OBSOLETE
+// OBSOLETE asm ("ta 255");
+// OBSOLETE
+// OBSOLETE exceptionHandler (255, trap_low);
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE /* Convert the SPARC hardware trap type code to a unix signal number. */
+// OBSOLETE
+// OBSOLETE static int
+// OBSOLETE computeSignal (int tt)
+// OBSOLETE {
+// OBSOLETE struct hard_trap_info *ht;
+// OBSOLETE
+// OBSOLETE for (ht = hard_trap_info; ht->tt && ht->signo; ht++)
+// OBSOLETE if (ht->tt == tt)
+// OBSOLETE return ht->signo;
+// OBSOLETE
+// OBSOLETE return SIGHUP; /* default for things we don't know about */
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE /*
+// OBSOLETE * While we find nice hex chars, build an int.
+// OBSOLETE * Return number of chars processed.
+// OBSOLETE */
+// OBSOLETE
+// OBSOLETE static int
+// OBSOLETE hexToInt(char **ptr, int *intValue)
+// OBSOLETE {
+// OBSOLETE int numChars = 0;
+// OBSOLETE int hexValue;
+// OBSOLETE
+// OBSOLETE *intValue = 0;
+// OBSOLETE
+// OBSOLETE while (**ptr)
+// OBSOLETE {
+// OBSOLETE hexValue = hex(**ptr);
+// OBSOLETE if (hexValue < 0)
+// OBSOLETE break;
+// OBSOLETE
+// OBSOLETE *intValue = (*intValue << 4) | hexValue;
+// OBSOLETE numChars ++;
+// OBSOLETE
+// OBSOLETE (*ptr)++;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE return (numChars);
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE /*
+// OBSOLETE * This function does all command procesing for interfacing to gdb. It
+// OBSOLETE * returns 1 if you should skip the instruction at the trap address, 0
+// OBSOLETE * otherwise.
+// OBSOLETE */
+// OBSOLETE
+// OBSOLETE static void
+// OBSOLETE handle_exception (unsigned long *registers)
+// OBSOLETE {
+// OBSOLETE int tt; /* Trap type */
+// OBSOLETE int sigval;
+// OBSOLETE int addr;
+// OBSOLETE int length;
+// OBSOLETE char *ptr;
+// OBSOLETE unsigned long *sp;
+// OBSOLETE unsigned long dsr;
+// OBSOLETE
+// OBSOLETE /* First, we must force all of the windows to be spilled out */
+// OBSOLETE
+// OBSOLETE asm(" save %sp, -64, %sp
+// OBSOLETE save %sp, -64, %sp
+// OBSOLETE save %sp, -64, %sp
+// OBSOLETE save %sp, -64, %sp
+// OBSOLETE save %sp, -64, %sp
+// OBSOLETE save %sp, -64, %sp
+// OBSOLETE save %sp, -64, %sp
+// OBSOLETE save %sp, -64, %sp
+// OBSOLETE restore
+// OBSOLETE restore
+// OBSOLETE restore
+// OBSOLETE restore
+// OBSOLETE restore
+// OBSOLETE restore
+// OBSOLETE restore
+// OBSOLETE restore
+// OBSOLETE ");
+// OBSOLETE
+// OBSOLETE get_in_break_mode (); /* Enable DSU register writes */
+// OBSOLETE
+// OBSOLETE registers[DIA1] = read_asi (1, 0xff00);
+// OBSOLETE registers[DIA2] = read_asi (1, 0xff04);
+// OBSOLETE registers[DDA1] = read_asi (1, 0xff08);
+// OBSOLETE registers[DDA2] = read_asi (1, 0xff0c);
+// OBSOLETE registers[DDV1] = read_asi (1, 0xff10);
+// OBSOLETE registers[DDV2] = read_asi (1, 0xff14);
+// OBSOLETE registers[DCR] = read_asi (1, 0xff18);
+// OBSOLETE registers[DSR] = read_asi (1, 0xff1c);
+// OBSOLETE
+// OBSOLETE if (registers[PC] == (unsigned long)breakinst)
+// OBSOLETE {
+// OBSOLETE registers[PC] = registers[NPC];
+// OBSOLETE registers[NPC] += 4;
+// OBSOLETE }
+// OBSOLETE sp = (unsigned long *)registers[SP];
+// OBSOLETE
+// OBSOLETE dsr = (unsigned long)registers[DSR];
+// OBSOLETE if (dsr & 0x3c)
+// OBSOLETE tt = 255;
+// OBSOLETE else
+// OBSOLETE tt = (registers[TBR] >> 4) & 0xff;
+// OBSOLETE
+// OBSOLETE /* reply to host that an exception has occurred */
+// OBSOLETE sigval = computeSignal(tt);
+// OBSOLETE ptr = remcomOutBuffer;
+// OBSOLETE
+// OBSOLETE *ptr++ = 'T';
+// OBSOLETE *ptr++ = hexchars[sigval >> 4];
+// OBSOLETE *ptr++ = hexchars[sigval & 0xf];
+// OBSOLETE
+// OBSOLETE *ptr++ = hexchars[PC >> 4];
+// OBSOLETE *ptr++ = hexchars[PC & 0xf];
+// OBSOLETE *ptr++ = ':';
+// OBSOLETE ptr = mem2hex((char *)&registers[PC], ptr, 4, 0);
+// OBSOLETE *ptr++ = ';';
+// OBSOLETE
+// OBSOLETE *ptr++ = hexchars[FP >> 4];
+// OBSOLETE *ptr++ = hexchars[FP & 0xf];
+// OBSOLETE *ptr++ = ':';
+// OBSOLETE ptr = mem2hex(sp + 8 + 6, ptr, 4, 0); /* FP */
+// OBSOLETE *ptr++ = ';';
+// OBSOLETE
+// OBSOLETE *ptr++ = hexchars[SP >> 4];
+// OBSOLETE *ptr++ = hexchars[SP & 0xf];
+// OBSOLETE *ptr++ = ':';
+// OBSOLETE ptr = mem2hex((char *)&sp, ptr, 4, 0);
+// OBSOLETE *ptr++ = ';';
+// OBSOLETE
+// OBSOLETE *ptr++ = hexchars[NPC >> 4];
+// OBSOLETE *ptr++ = hexchars[NPC & 0xf];
+// OBSOLETE *ptr++ = ':';
+// OBSOLETE ptr = mem2hex((char *)&registers[NPC], ptr, 4, 0);
+// OBSOLETE *ptr++ = ';';
+// OBSOLETE
+// OBSOLETE *ptr++ = hexchars[O7 >> 4];
+// OBSOLETE *ptr++ = hexchars[O7 & 0xf];
+// OBSOLETE *ptr++ = ':';
+// OBSOLETE ptr = mem2hex((char *)&registers[O7], ptr, 4, 0);
+// OBSOLETE *ptr++ = ';';
+// OBSOLETE
+// OBSOLETE *ptr++ = 0;
+// OBSOLETE
+// OBSOLETE putpacket(remcomOutBuffer);
+// OBSOLETE
+// OBSOLETE while (1)
+// OBSOLETE {
+// OBSOLETE remcomOutBuffer[0] = 0;
+// OBSOLETE
+// OBSOLETE ptr = getpacket();
+// OBSOLETE switch (*ptr++)
+// OBSOLETE {
+// OBSOLETE case '?':
+// OBSOLETE remcomOutBuffer[0] = 'S';
+// OBSOLETE remcomOutBuffer[1] = hexchars[sigval >> 4];
+// OBSOLETE remcomOutBuffer[2] = hexchars[sigval & 0xf];
+// OBSOLETE remcomOutBuffer[3] = 0;
+// OBSOLETE break;
+// OBSOLETE
+// OBSOLETE case 'd':
+// OBSOLETE /* toggle debug flag */
+// OBSOLETE break;
+// OBSOLETE
+// OBSOLETE case 'g': /* return the value of the CPU registers */
+// OBSOLETE memcpy (&registers[L0], sp, 16 * 4); /* Copy L & I regs from stack */
+// OBSOLETE mem2hex ((char *)registers, remcomOutBuffer, NUMREGBYTES, 0);
+// OBSOLETE break;
+// OBSOLETE
+// OBSOLETE case 'G': /* Set the value of all registers */
+// OBSOLETE case 'P': /* Set the value of one register */
+// OBSOLETE {
+// OBSOLETE unsigned long *newsp, psr;
+// OBSOLETE
+// OBSOLETE psr = registers[PSR];
+// OBSOLETE
+// OBSOLETE if (ptr[-1] == 'P')
+// OBSOLETE {
+// OBSOLETE int regno;
+// OBSOLETE
+// OBSOLETE if (hexToInt (&ptr, &regno)
+// OBSOLETE && *ptr++ == '=')
+// OBSOLETE if (regno >= L0 && regno <= I7)
+// OBSOLETE hex2mem (ptr, sp + regno - L0, 4, 0);
+// OBSOLETE else
+// OBSOLETE hex2mem (ptr, (char *)&registers[regno], 4, 0);
+// OBSOLETE else
+// OBSOLETE {
+// OBSOLETE strcpy (remcomOutBuffer, "E01");
+// OBSOLETE break;
+// OBSOLETE }
+// OBSOLETE }
+// OBSOLETE else
+// OBSOLETE {
+// OBSOLETE hex2mem (ptr, (char *)registers, NUMREGBYTES, 0);
+// OBSOLETE memcpy (sp, &registers[L0], 16 * 4); /* Copy L & I regs to stack */
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE /* See if the stack pointer has moved. If so, then copy the saved
+// OBSOLETE locals and ins to the new location. This keeps the window
+// OBSOLETE overflow and underflow routines happy. */
+// OBSOLETE
+// OBSOLETE newsp = (unsigned long *)registers[SP];
+// OBSOLETE if (sp != newsp)
+// OBSOLETE sp = memcpy(newsp, sp, 16 * 4);
+// OBSOLETE
+// OBSOLETE /* Don't allow CWP to be modified. */
+// OBSOLETE
+// OBSOLETE if (psr != registers[PSR])
+// OBSOLETE registers[PSR] = (psr & 0x1f) | (registers[PSR] & ~0x1f);
+// OBSOLETE
+// OBSOLETE strcpy(remcomOutBuffer,"OK");
+// OBSOLETE }
+// OBSOLETE break;
+// OBSOLETE
+// OBSOLETE case 'm': /* mAA..AA,LLLL Read LLLL bytes at address AA..AA */
+// OBSOLETE /* Try to read %x,%x. */
+// OBSOLETE
+// OBSOLETE if (hexToInt(&ptr, &addr)
+// OBSOLETE && *ptr++ == ','
+// OBSOLETE && hexToInt(&ptr, &length))
+// OBSOLETE {
+// OBSOLETE if (mem2hex((char *)addr, remcomOutBuffer, length, 1))
+// OBSOLETE break;
+// OBSOLETE
+// OBSOLETE strcpy (remcomOutBuffer, "E03");
+// OBSOLETE }
+// OBSOLETE else
+// OBSOLETE strcpy(remcomOutBuffer,"E01");
+// OBSOLETE break;
+// OBSOLETE
+// OBSOLETE case 'M': /* MAA..AA,LLLL: Write LLLL bytes at address AA.AA return OK */
+// OBSOLETE /* Try to read '%x,%x:'. */
+// OBSOLETE
+// OBSOLETE if (hexToInt(&ptr, &addr)
+// OBSOLETE && *ptr++ == ','
+// OBSOLETE && hexToInt(&ptr, &length)
+// OBSOLETE && *ptr++ == ':')
+// OBSOLETE {
+// OBSOLETE if (hex2mem(ptr, (char *)addr, length, 1))
+// OBSOLETE strcpy(remcomOutBuffer, "OK");
+// OBSOLETE else
+// OBSOLETE strcpy(remcomOutBuffer, "E03");
+// OBSOLETE }
+// OBSOLETE else
+// OBSOLETE strcpy(remcomOutBuffer, "E02");
+// OBSOLETE break;
+// OBSOLETE
+// OBSOLETE case 'c': /* cAA..AA Continue at address AA..AA(optional) */
+// OBSOLETE /* try to read optional parameter, pc unchanged if no parm */
+// OBSOLETE if (hexToInt(&ptr, &addr))
+// OBSOLETE {
+// OBSOLETE registers[PC] = addr;
+// OBSOLETE registers[NPC] = addr + 4;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE /* Need to flush the instruction cache here, as we may have deposited a
+// OBSOLETE breakpoint, and the icache probably has no way of knowing that a data ref to
+// OBSOLETE some location may have changed something that is in the instruction cache.
+// OBSOLETE */
+// OBSOLETE
+// OBSOLETE flush_i_cache ();
+// OBSOLETE
+// OBSOLETE if (!(registers[DSR] & 0x1) /* DSU enabled? */
+// OBSOLETE && !(registers[DCR] & 0x200)) /* Are we in break state? */
+// OBSOLETE { /* Yes, set the DSU regs */
+// OBSOLETE write_asi (1, 0xff00, registers[DIA1]);
+// OBSOLETE write_asi (1, 0xff04, registers[DIA2]);
+// OBSOLETE write_asi (1, 0xff08, registers[DDA1]);
+// OBSOLETE write_asi (1, 0xff0c, registers[DDA2]);
+// OBSOLETE write_asi (1, 0xff10, registers[DDV1]);
+// OBSOLETE write_asi (1, 0xff14, registers[DDV2]);
+// OBSOLETE write_asi (1, 0xff1c, registers[DSR]);
+// OBSOLETE write_asi (1, 0xff18, registers[DCR] | 0x200); /* Clear break */
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE return;
+// OBSOLETE
+// OBSOLETE /* kill the program */
+// OBSOLETE case 'k' : /* do nothing */
+// OBSOLETE break;
+// OBSOLETE #if 0
+// OBSOLETE case 't': /* Test feature */
+// OBSOLETE asm (" std %f30,[%sp]");
+// OBSOLETE break;
+// OBSOLETE #endif
+// OBSOLETE case 'r': /* Reset */
+// OBSOLETE asm ("call 0
+// OBSOLETE nop ");
+// OBSOLETE break;
+// OBSOLETE } /* switch */
+// OBSOLETE
+// OBSOLETE /* reply to the request */
+// OBSOLETE putpacket(remcomOutBuffer);
+// OBSOLETE }
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE /* This function will generate a breakpoint exception. It is used at the
+// OBSOLETE beginning of a program to sync up with a debugger and can be used
+// OBSOLETE otherwise as a quick means to stop program execution and "break" into
+// OBSOLETE the debugger. */
+// OBSOLETE
+// OBSOLETE void
+// OBSOLETE breakpoint (void)
+// OBSOLETE {
+// OBSOLETE if (!initialized)
+// OBSOLETE return;
+// OBSOLETE
+// OBSOLETE asm(" .globl _breakinst
+// OBSOLETE
+// OBSOLETE _breakinst: ta 1
+// OBSOLETE ");
+// OBSOLETE }
diff --git a/gdb/sparcl-tdep.c b/gdb/sparcl-tdep.c
index aa06747..8c376c5 100644
--- a/gdb/sparcl-tdep.c
+++ b/gdb/sparcl-tdep.c
@@ -1,869 +1,869 @@
-/* Target dependent code for the Fujitsu SPARClite for GDB, the GNU debugger.
- Copyright 1994, 1995, 1996, 1998, 1999, 2000, 2001
- Free Software Foundation, Inc.
-
- This file is part of GDB.
-
- 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.
-
- 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.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-
-#include "defs.h"
-#include "gdbcore.h"
-#include "breakpoint.h"
-#include "target.h"
-#include "serial.h"
-#include "regcache.h"
-#include <sys/types.h>
-
-#if (!defined(__GO32__) && !defined(_WIN32)) || defined(__CYGWIN__)
-#define HAVE_SOCKETS
-#include <sys/time.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <netdb.h>
-#endif
-
-static struct target_ops sparclite_ops;
-
-static char *remote_target_name = NULL;
-static struct serial *remote_desc = NULL;
-static int serial_flag;
-#ifdef HAVE_SOCKETS
-static int udp_fd = -1;
-#endif
-
-static struct serial *open_tty (char *name);
-static int send_resp (struct serial *desc, char c);
-static void close_tty (void * ignore);
-#ifdef HAVE_SOCKETS
-static int recv_udp_buf (int fd, unsigned char *buf, int len, int timeout);
-static int send_udp_buf (int fd, unsigned char *buf, int len);
-#endif
-static void sparclite_open (char *name, int from_tty);
-static void sparclite_close (int quitting);
-static void download (char *target_name, char *args, int from_tty,
- void (*write_routine) (bfd * from_bfd,
- asection * from_sec,
- file_ptr from_addr,
- bfd_vma to_addr, int len),
- void (*start_routine) (bfd_vma entry));
-static void sparclite_serial_start (bfd_vma entry);
-static void sparclite_serial_write (bfd * from_bfd, asection * from_sec,
- file_ptr from_addr,
- bfd_vma to_addr, int len);
-#ifdef HAVE_SOCKETS
-static unsigned short calc_checksum (unsigned char *buffer, int count);
-static void sparclite_udp_start (bfd_vma entry);
-static void sparclite_udp_write (bfd * from_bfd, asection * from_sec,
- file_ptr from_addr, bfd_vma to_addr,
- int len);
-#endif
-static void sparclite_download (char *filename, int from_tty);
-
-#define DDA2_SUP_ASI 0xb000000
-#define DDA1_SUP_ASI 0xb0000
-
-#define DDA2_ASI_MASK 0xff000000
-#define DDA1_ASI_MASK 0xff0000
-#define DIA2_SUP_MODE 0x8000
-#define DIA1_SUP_MODE 0x4000
-#define DDA2_ENABLE 0x100
-#define DDA1_ENABLE 0x80
-#define DIA2_ENABLE 0x40
-#define DIA1_ENABLE 0x20
-#define DSINGLE_STEP 0x10 /* not used */
-#define DDV_TYPE_MASK 0xc
-#define DDV_TYPE_LOAD 0x0
-#define DDV_TYPE_STORE 0x4
-#define DDV_TYPE_ACCESS 0x8
-#define DDV_TYPE_ALWAYS 0xc
-#define DDV_COND 0x2
-#define DDV_MASK 0x1
-
-int
-sparclite_insert_watchpoint (CORE_ADDR addr, int len, int type)
-{
- CORE_ADDR dcr;
-
- dcr = read_register (DCR_REGNUM);
-
- if (!(dcr & DDA1_ENABLE))
- {
- write_register (DDA1_REGNUM, addr);
- dcr &= ~(DDA1_ASI_MASK | DDV_TYPE_MASK);
- dcr |= (DDA1_SUP_ASI | DDA1_ENABLE);
- if (type == 1)
- {
- write_register (DDV1_REGNUM, 0);
- write_register (DDV2_REGNUM, 0xffffffff);
- dcr |= (DDV_TYPE_LOAD & (~DDV_COND & ~DDV_MASK));
- }
- else if (type == 0)
- {
- write_register (DDV1_REGNUM, 0);
- write_register (DDV2_REGNUM, 0xffffffff);
- dcr |= (DDV_TYPE_STORE & (~DDV_COND & ~DDV_MASK));
- }
- else
- {
- write_register (DDV1_REGNUM, 0);
- write_register (DDV2_REGNUM, 0xffffffff);
- dcr |= (DDV_TYPE_ACCESS);
- }
- write_register (DCR_REGNUM, dcr);
- }
- else if (!(dcr & DDA2_ENABLE))
- {
- write_register (DDA2_REGNUM, addr);
- dcr &= ~(DDA2_ASI_MASK & DDV_TYPE_MASK);
- dcr |= (DDA2_SUP_ASI | DDA2_ENABLE);
- if (type == 1)
- {
- write_register (DDV1_REGNUM, 0);
- write_register (DDV2_REGNUM, 0xffffffff);
- dcr |= (DDV_TYPE_LOAD & ~DDV_COND & ~DDV_MASK);
- }
- else if (type == 0)
- {
- write_register (DDV1_REGNUM, 0);
- write_register (DDV2_REGNUM, 0xffffffff);
- dcr |= (DDV_TYPE_STORE & ~DDV_COND & ~DDV_MASK);
- }
- else
- {
- write_register (DDV1_REGNUM, 0);
- write_register (DDV2_REGNUM, 0xffffffff);
- dcr |= (DDV_TYPE_ACCESS);
- }
- write_register (DCR_REGNUM, dcr);
- }
- else
- return -1;
-
- return 0;
-}
-
-int
-sparclite_remove_watchpoint (CORE_ADDR addr, int len, int type)
-{
- CORE_ADDR dcr, dda1, dda2;
-
- dcr = read_register (DCR_REGNUM);
- dda1 = read_register (DDA1_REGNUM);
- dda2 = read_register (DDA2_REGNUM);
-
- if ((dcr & DDA1_ENABLE) && addr == dda1)
- write_register (DCR_REGNUM, (dcr & ~DDA1_ENABLE));
- else if ((dcr & DDA2_ENABLE) && addr == dda2)
- write_register (DCR_REGNUM, (dcr & ~DDA2_ENABLE));
- else
- return -1;
-
- return 0;
-}
-
-int
-sparclite_insert_hw_breakpoint (CORE_ADDR addr, int len)
-{
- CORE_ADDR dcr;
-
- dcr = read_register (DCR_REGNUM);
-
- if (!(dcr & DIA1_ENABLE))
- {
- write_register (DIA1_REGNUM, addr);
- write_register (DCR_REGNUM, (dcr | DIA1_ENABLE | DIA1_SUP_MODE));
- }
- else if (!(dcr & DIA2_ENABLE))
- {
- write_register (DIA2_REGNUM, addr);
- write_register (DCR_REGNUM, (dcr | DIA2_ENABLE | DIA2_SUP_MODE));
- }
- else
- return -1;
-
- return 0;
-}
-
-int
-sparclite_remove_hw_breakpoint (CORE_ADDR addr, int shadow)
-{
- CORE_ADDR dcr, dia1, dia2;
-
- dcr = read_register (DCR_REGNUM);
- dia1 = read_register (DIA1_REGNUM);
- dia2 = read_register (DIA2_REGNUM);
-
- if ((dcr & DIA1_ENABLE) && addr == dia1)
- write_register (DCR_REGNUM, (dcr & ~DIA1_ENABLE));
- else if ((dcr & DIA2_ENABLE) && addr == dia2)
- write_register (DCR_REGNUM, (dcr & ~DIA2_ENABLE));
- else
- return -1;
-
- return 0;
-}
-
-int
-sparclite_check_watch_resources (int type, int cnt, int ot)
-{
- /* Watchpoints not supported on simulator. */
- if (strcmp (target_shortname, "sim") == 0)
- return 0;
-
- if (type == bp_hardware_breakpoint)
- {
- if (TARGET_HW_BREAK_LIMIT == 0)
- return 0;
- else if (cnt <= TARGET_HW_BREAK_LIMIT)
- return 1;
- }
- else
- {
- if (TARGET_HW_WATCH_LIMIT == 0)
- return 0;
- else if (ot)
- return -1;
- else if (cnt <= TARGET_HW_WATCH_LIMIT)
- return 1;
- }
- return -1;
-}
-
-CORE_ADDR
-sparclite_stopped_data_address (void)
-{
- CORE_ADDR dsr, dda1, dda2;
-
- dsr = read_register (DSR_REGNUM);
- dda1 = read_register (DDA1_REGNUM);
- dda2 = read_register (DDA2_REGNUM);
-
- if (dsr & 0x10)
- return dda1;
- else if (dsr & 0x20)
- return dda2;
- else
- return 0;
-}
-
-static struct serial *
-open_tty (char *name)
-{
- struct serial *desc;
-
- desc = serial_open (name);
- if (!desc)
- perror_with_name (name);
-
- if (baud_rate != -1)
- {
- if (serial_setbaudrate (desc, baud_rate))
- {
- serial_close (desc);
- perror_with_name (name);
- }
- }
-
- serial_raw (desc);
-
- serial_flush_input (desc);
-
- return desc;
-}
-
-/* Read a single character from the remote end, masking it down to 7 bits. */
-
-static int
-readchar (struct serial *desc, int timeout)
-{
- int ch;
- char s[10];
-
- ch = serial_readchar (desc, timeout);
-
- switch (ch)
- {
- case SERIAL_EOF:
- error ("SPARClite remote connection closed");
- case SERIAL_ERROR:
- perror_with_name ("SPARClite communication error");
- case SERIAL_TIMEOUT:
- error ("SPARClite remote timeout");
- default:
- if (remote_debug > 0)
- {
- sprintf (s, "[%02x]", ch & 0xff);
- puts_debug ("read -->", s, "<--");
- }
- return ch;
- }
-}
-
-static void
-debug_serial_write (struct serial *desc, char *buf, int len)
-{
- char s[10];
-
- serial_write (desc, buf, len);
- if (remote_debug > 0)
- {
- while (len-- > 0)
- {
- sprintf (s, "[%02x]", *buf & 0xff);
- puts_debug ("Sent -->", s, "<--");
- buf++;
- }
- }
-}
-
-
-static int
-send_resp (struct serial *desc, char c)
-{
- debug_serial_write (desc, &c, 1);
- return readchar (desc, remote_timeout);
-}
-
-static void
-close_tty (void *ignore)
-{
- if (!remote_desc)
- return;
-
- serial_close (remote_desc);
-
- remote_desc = NULL;
-}
-
-#ifdef HAVE_SOCKETS
-static int
-recv_udp_buf (int fd, unsigned char *buf, int len, int timeout)
-{
- int cc;
- fd_set readfds;
-
- FD_ZERO (&readfds);
- FD_SET (fd, &readfds);
-
- if (timeout >= 0)
- {
- struct timeval timebuf;
-
- timebuf.tv_sec = timeout;
- timebuf.tv_usec = 0;
- cc = select (fd + 1, &readfds, 0, 0, &timebuf);
- }
- else
- cc = select (fd + 1, &readfds, 0, 0, 0);
-
- if (cc == 0)
- return 0;
-
- if (cc != 1)
- perror_with_name ("recv_udp_buf: Bad return value from select:");
-
- cc = recv (fd, buf, len, 0);
-
- if (cc < 0)
- perror_with_name ("Got an error from recv: ");
-}
-
-static int
-send_udp_buf (int fd, unsigned char *buf, int len)
-{
- int cc;
-
- cc = send (fd, buf, len, 0);
-
- if (cc == len)
- return;
-
- if (cc < 0)
- perror_with_name ("Got an error from send: ");
-
- error ("Short count in send: tried %d, sent %d\n", len, cc);
-}
-#endif /* HAVE_SOCKETS */
-
-static void
-sparclite_open (char *name, int from_tty)
-{
- struct cleanup *old_chain;
- int c;
- char *p;
-
- if (!name)
- error ("You need to specify what device or hostname is associated with the SparcLite board.");
-
- target_preopen (from_tty);
-
- unpush_target (&sparclite_ops);
-
- if (remote_target_name)
- xfree (remote_target_name);
-
- remote_target_name = xstrdup (name);
-
- /* We need a 'serial' or 'udp' keyword to disambiguate host:port, which can
- mean either a serial port on a terminal server, or the IP address of a
- SPARClite demo board. If there's no colon, then it pretty much has to be
- a local device (except for DOS... grrmble) */
-
- p = strchr (name, ' ');
-
- if (p)
- {
- *p++ = '\000';
- while ((*p != '\000') && isspace (*p))
- p++;
-
- if (strncmp (name, "serial", strlen (name)) == 0)
- serial_flag = 1;
- else if (strncmp (name, "udp", strlen (name)) == 0)
- serial_flag = 0;
- else
- error ("Must specify either `serial' or `udp'.");
- }
- else
- {
- p = name;
-
- if (!strchr (name, ':'))
- serial_flag = 1; /* No colon is unambiguous (local device) */
- else
- error ("Usage: target sparclite serial /dev/ttyb\n\
-or: target sparclite udp host");
- }
-
- if (serial_flag)
- {
- remote_desc = open_tty (p);
-
- old_chain = make_cleanup (close_tty, 0 /*ignore*/);
-
- c = send_resp (remote_desc, 0x00);
-
- if (c != 0xaa)
- error ("Unknown response (0x%x) from SparcLite. Try resetting the board.",
- c);
-
- c = send_resp (remote_desc, 0x55);
-
- if (c != 0x55)
- error ("Sparclite appears to be ill.");
- }
- else
- {
-#ifdef HAVE_SOCKETS
- struct hostent *he;
- struct sockaddr_in sockaddr;
- unsigned char buffer[100];
- int cc;
-
- /* Setup the socket. Must be raw UDP. */
-
- he = gethostbyname (p);
-
- if (!he)
- error ("No such host %s.", p);
-
- udp_fd = socket (PF_INET, SOCK_DGRAM, 0);
-
- old_chain = make_cleanup (close, udp_fd);
-
- sockaddr.sin_family = PF_INET;
- sockaddr.sin_port = htons (7000);
- memcpy (&sockaddr.sin_addr.s_addr, he->h_addr, sizeof (struct in_addr));
-
- if (connect (udp_fd, &sockaddr, sizeof (sockaddr)))
- perror_with_name ("Connect failed");
-
- buffer[0] = 0x5;
- buffer[1] = 0;
-
- send_udp_buf (udp_fd, buffer, 2); /* Request version */
- cc = recv_udp_buf (udp_fd, buffer, sizeof (buffer), 5); /* Get response */
- if (cc == 0)
- error ("SPARClite isn't responding.");
-
- if (cc < 3)
- error ("SPARClite appears to be ill.");
-#else
- error ("UDP downloading is not supported for DOS hosts.");
-#endif /* HAVE_SOCKETS */
- }
-
- printf_unfiltered ("[SPARClite appears to be alive]\n");
-
- push_target (&sparclite_ops);
-
- discard_cleanups (old_chain);
-
- return;
-}
-
-static void
-sparclite_close (int quitting)
-{
- if (serial_flag)
- close_tty (0);
-#ifdef HAVE_SOCKETS
- else if (udp_fd != -1)
- close (udp_fd);
-#endif
-}
-
-#define LOAD_ADDRESS 0x40000000
-
-static void
-download (char *target_name, char *args, int from_tty,
- void (*write_routine) (bfd *from_bfd, asection *from_sec,
- file_ptr from_addr, bfd_vma to_addr, int len),
- void (*start_routine) (bfd_vma entry))
-{
- struct cleanup *old_chain;
- asection *section;
- bfd *pbfd;
- bfd_vma entry;
- int i;
-#define WRITESIZE 1024
- char *filename;
- int quiet;
- int nostart;
-
- quiet = 0;
- nostart = 0;
- filename = NULL;
-
- while (*args != '\000')
- {
- char *arg;
-
- while (isspace (*args))
- args++;
-
- arg = args;
-
- while ((*args != '\000') && !isspace (*args))
- args++;
-
- if (*args != '\000')
- *args++ = '\000';
-
- if (*arg != '-')
- filename = arg;
- else if (strncmp (arg, "-quiet", strlen (arg)) == 0)
- quiet = 1;
- else if (strncmp (arg, "-nostart", strlen (arg)) == 0)
- nostart = 1;
- else
- error ("unknown option `%s'", arg);
- }
-
- if (!filename)
- filename = get_exec_file (1);
-
- pbfd = bfd_openr (filename, gnutarget);
- if (pbfd == NULL)
- {
- perror_with_name (filename);
- return;
- }
- old_chain = make_cleanup_bfd_close (pbfd);
-
- if (!bfd_check_format (pbfd, bfd_object))
- error ("\"%s\" is not an object file: %s", filename,
- bfd_errmsg (bfd_get_error ()));
-
- for (section = pbfd->sections; section; section = section->next)
- {
- if (bfd_get_section_flags (pbfd, section) & SEC_LOAD)
- {
- bfd_vma section_address;
- bfd_size_type section_size;
- file_ptr fptr;
- const char *section_name;
-
- section_name = bfd_get_section_name (pbfd, section);
-
- section_address = bfd_get_section_vma (pbfd, section);
-
- /* Adjust sections from a.out files, since they don't
- carry their addresses with. */
- if (bfd_get_flavour (pbfd) == bfd_target_aout_flavour)
- {
- if (strcmp (section_name, ".text") == 0)
- section_address = bfd_get_start_address (pbfd);
- else if (strcmp (section_name, ".data") == 0)
- {
- /* Read the first 8 bytes of the data section.
- There should be the string 'DaTa' followed by
- a word containing the actual section address. */
- struct data_marker
- {
- char signature[4]; /* 'DaTa' */
- unsigned char sdata[4]; /* &sdata */
- }
- marker;
- bfd_get_section_contents (pbfd, section, &marker, 0,
- sizeof (marker));
- if (strncmp (marker.signature, "DaTa", 4) == 0)
- {
- if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
- section_address = bfd_getb32 (marker.sdata);
- else
- section_address = bfd_getl32 (marker.sdata);
- }
- }
- }
-
- section_size = bfd_get_section_size_before_reloc (section);
-
- if (!quiet)
- printf_filtered ("[Loading section %s at 0x%x (%d bytes)]\n",
- bfd_get_section_name (pbfd, section),
- section_address,
- section_size);
-
- fptr = 0;
- while (section_size > 0)
- {
- int count;
- static char inds[] = "|/-\\";
- static int k = 0;
-
- QUIT;
-
- count = min (section_size, WRITESIZE);
-
- write_routine (pbfd, section, fptr, section_address, count);
-
- if (!quiet)
- {
- printf_unfiltered ("\r%c", inds[k++ % 4]);
- gdb_flush (gdb_stdout);
- }
-
- section_address += count;
- fptr += count;
- section_size -= count;
- }
- }
- }
-
- if (!nostart)
- {
- entry = bfd_get_start_address (pbfd);
-
- if (!quiet)
- printf_unfiltered ("[Starting %s at 0x%x]\n", filename, entry);
-
- start_routine (entry);
- }
-
- do_cleanups (old_chain);
-}
-
-static void
-sparclite_serial_start (bfd_vma entry)
-{
- char buffer[5];
- int i;
-
- buffer[0] = 0x03;
- store_unsigned_integer (buffer + 1, 4, entry);
-
- debug_serial_write (remote_desc, buffer, 1 + 4);
- i = readchar (remote_desc, remote_timeout);
- if (i != 0x55)
- error ("Can't start SparcLite. Error code %d\n", i);
-}
-
-static void
-sparclite_serial_write (bfd *from_bfd, asection *from_sec, file_ptr from_addr,
- bfd_vma to_addr, int len)
-{
- char buffer[4 + 4 + WRITESIZE]; /* addr + len + data */
- unsigned char checksum;
- int i;
-
- store_unsigned_integer (buffer, 4, to_addr); /* Address */
- store_unsigned_integer (buffer + 4, 4, len); /* Length */
-
- bfd_get_section_contents (from_bfd, from_sec, buffer + 8, from_addr, len);
-
- checksum = 0;
- for (i = 0; i < len; i++)
- checksum += buffer[8 + i];
-
- i = send_resp (remote_desc, 0x01);
-
- if (i != 0x5a)
- error ("Bad response from load command (0x%x)", i);
-
- debug_serial_write (remote_desc, buffer, 4 + 4 + len);
- i = readchar (remote_desc, remote_timeout);
-
- if (i != checksum)
- error ("Bad checksum from load command (0x%x)", i);
-}
-
-#ifdef HAVE_SOCKETS
-
-static unsigned short
-calc_checksum (unsigned char *buffer, int count)
-{
- unsigned short checksum;
-
- checksum = 0;
- for (; count > 0; count -= 2, buffer += 2)
- checksum += (*buffer << 8) | *(buffer + 1);
-
- if (count != 0)
- checksum += *buffer << 8;
-
- return checksum;
-}
-
-static void
-sparclite_udp_start (bfd_vma entry)
-{
- unsigned char buffer[6];
- int i;
-
- buffer[0] = 0x3;
- buffer[1] = 0;
- buffer[2] = entry >> 24;
- buffer[3] = entry >> 16;
- buffer[4] = entry >> 8;
- buffer[5] = entry;
-
- send_udp_buf (udp_fd, buffer, 6); /* Send start addr */
- i = recv_udp_buf (udp_fd, buffer, sizeof (buffer), -1); /* Get response */
-
- if (i < 1 || buffer[0] != 0x55)
- error ("Failed to take start address.");
-}
-
-static void
-sparclite_udp_write (bfd *from_bfd, asection *from_sec, file_ptr from_addr,
- bfd_vma to_addr, int len)
-{
- unsigned char buffer[2000];
- unsigned short checksum;
- static int pkt_num = 0;
- static unsigned long old_addr = -1;
- int i;
-
- while (1)
- {
- if (to_addr != old_addr)
- {
- buffer[0] = 0x1; /* Load command */
- buffer[1] = 0x1; /* Loading address */
- buffer[2] = to_addr >> 24;
- buffer[3] = to_addr >> 16;
- buffer[4] = to_addr >> 8;
- buffer[5] = to_addr;
-
- checksum = 0;
- for (i = 0; i < 6; i++)
- checksum += buffer[i];
- checksum &= 0xff;
-
- send_udp_buf (udp_fd, buffer, 6);
- i = recv_udp_buf (udp_fd, buffer, sizeof buffer, -1);
-
- if (i < 1)
- error ("Got back short checksum for load addr.");
-
- if (checksum != buffer[0])
- error ("Got back bad checksum for load addr.");
-
- pkt_num = 0; /* Load addr resets packet seq # */
- old_addr = to_addr;
- }
-
- bfd_get_section_contents (from_bfd, from_sec, buffer + 6, from_addr,
- len);
-
- checksum = calc_checksum (buffer + 6, len);
-
- buffer[0] = 0x1; /* Load command */
- buffer[1] = 0x2; /* Loading data */
- buffer[2] = pkt_num >> 8;
- buffer[3] = pkt_num;
- buffer[4] = checksum >> 8;
- buffer[5] = checksum;
-
- send_udp_buf (udp_fd, buffer, len + 6);
- i = recv_udp_buf (udp_fd, buffer, sizeof buffer, 3);
-
- if (i == 0)
- {
- fprintf_unfiltered (gdb_stderr, "send_data: timeout sending %d bytes to address 0x%x retrying\n", len, to_addr);
- continue;
- }
-
- if (buffer[0] != 0xff)
- error ("Got back bad response for load data.");
-
- old_addr += len;
- pkt_num++;
-
- return;
- }
-}
-
-#endif /* HAVE_SOCKETS */
-
-static void
-sparclite_download (char *filename, int from_tty)
-{
- if (!serial_flag)
-#ifdef HAVE_SOCKETS
- download (remote_target_name, filename, from_tty, sparclite_udp_write,
- sparclite_udp_start);
-#else
- internal_error (__FILE__, __LINE__, "failed internal consistency check"); /* sparclite_open should prevent this! */
-#endif
- else
- download (remote_target_name, filename, from_tty, sparclite_serial_write,
- sparclite_serial_start);
-}
-
-/* Set up the sparclite target vector. */
-
-static void
-init_sparclite_ops (void)
-{
- sparclite_ops.to_shortname = "sparclite";
- sparclite_ops.to_longname = "SPARClite download target";
- sparclite_ops.to_doc = "Download to a remote SPARClite target board via serial of UDP.\n\
-Specify the device it is connected to (e.g. /dev/ttya).";
- sparclite_ops.to_open = sparclite_open;
- sparclite_ops.to_close = sparclite_close;
- sparclite_ops.to_load = sparclite_download;
- sparclite_ops.to_stratum = download_stratum;
- sparclite_ops.to_magic = OPS_MAGIC;
-}
-
-void
-_initialize_sparcl_tdep (void)
-{
- init_sparclite_ops ();
- add_target (&sparclite_ops);
-}
+// OBSOLETE /* Target dependent code for the Fujitsu SPARClite for GDB, the GNU debugger.
+// OBSOLETE Copyright 1994, 1995, 1996, 1998, 1999, 2000, 2001
+// OBSOLETE Free Software Foundation, Inc.
+// OBSOLETE
+// OBSOLETE This file is part of GDB.
+// OBSOLETE
+// OBSOLETE This program is free software; you can redistribute it and/or modify
+// OBSOLETE it under the terms of the GNU General Public License as published by
+// OBSOLETE the Free Software Foundation; either version 2 of the License, or
+// OBSOLETE (at your option) any later version.
+// OBSOLETE
+// OBSOLETE This program is distributed in the hope that it will be useful,
+// OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of
+// OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// OBSOLETE GNU General Public License for more details.
+// OBSOLETE
+// OBSOLETE You should have received a copy of the GNU General Public License
+// OBSOLETE along with this program; if not, write to the Free Software
+// OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330,
+// OBSOLETE Boston, MA 02111-1307, USA. */
+// OBSOLETE
+// OBSOLETE #include "defs.h"
+// OBSOLETE #include "gdbcore.h"
+// OBSOLETE #include "breakpoint.h"
+// OBSOLETE #include "target.h"
+// OBSOLETE #include "serial.h"
+// OBSOLETE #include "regcache.h"
+// OBSOLETE #include <sys/types.h>
+// OBSOLETE
+// OBSOLETE #if (!defined(__GO32__) && !defined(_WIN32)) || defined(__CYGWIN__)
+// OBSOLETE #define HAVE_SOCKETS
+// OBSOLETE #include <sys/time.h>
+// OBSOLETE #include <sys/socket.h>
+// OBSOLETE #include <netinet/in.h>
+// OBSOLETE #include <netdb.h>
+// OBSOLETE #endif
+// OBSOLETE
+// OBSOLETE static struct target_ops sparclite_ops;
+// OBSOLETE
+// OBSOLETE static char *remote_target_name = NULL;
+// OBSOLETE static struct serial *remote_desc = NULL;
+// OBSOLETE static int serial_flag;
+// OBSOLETE #ifdef HAVE_SOCKETS
+// OBSOLETE static int udp_fd = -1;
+// OBSOLETE #endif
+// OBSOLETE
+// OBSOLETE static struct serial *open_tty (char *name);
+// OBSOLETE static int send_resp (struct serial *desc, char c);
+// OBSOLETE static void close_tty (void * ignore);
+// OBSOLETE #ifdef HAVE_SOCKETS
+// OBSOLETE static int recv_udp_buf (int fd, unsigned char *buf, int len, int timeout);
+// OBSOLETE static int send_udp_buf (int fd, unsigned char *buf, int len);
+// OBSOLETE #endif
+// OBSOLETE static void sparclite_open (char *name, int from_tty);
+// OBSOLETE static void sparclite_close (int quitting);
+// OBSOLETE static void download (char *target_name, char *args, int from_tty,
+// OBSOLETE void (*write_routine) (bfd * from_bfd,
+// OBSOLETE asection * from_sec,
+// OBSOLETE file_ptr from_addr,
+// OBSOLETE bfd_vma to_addr, int len),
+// OBSOLETE void (*start_routine) (bfd_vma entry));
+// OBSOLETE static void sparclite_serial_start (bfd_vma entry);
+// OBSOLETE static void sparclite_serial_write (bfd * from_bfd, asection * from_sec,
+// OBSOLETE file_ptr from_addr,
+// OBSOLETE bfd_vma to_addr, int len);
+// OBSOLETE #ifdef HAVE_SOCKETS
+// OBSOLETE static unsigned short calc_checksum (unsigned char *buffer, int count);
+// OBSOLETE static void sparclite_udp_start (bfd_vma entry);
+// OBSOLETE static void sparclite_udp_write (bfd * from_bfd, asection * from_sec,
+// OBSOLETE file_ptr from_addr, bfd_vma to_addr,
+// OBSOLETE int len);
+// OBSOLETE #endif
+// OBSOLETE static void sparclite_download (char *filename, int from_tty);
+// OBSOLETE
+// OBSOLETE #define DDA2_SUP_ASI 0xb000000
+// OBSOLETE #define DDA1_SUP_ASI 0xb0000
+// OBSOLETE
+// OBSOLETE #define DDA2_ASI_MASK 0xff000000
+// OBSOLETE #define DDA1_ASI_MASK 0xff0000
+// OBSOLETE #define DIA2_SUP_MODE 0x8000
+// OBSOLETE #define DIA1_SUP_MODE 0x4000
+// OBSOLETE #define DDA2_ENABLE 0x100
+// OBSOLETE #define DDA1_ENABLE 0x80
+// OBSOLETE #define DIA2_ENABLE 0x40
+// OBSOLETE #define DIA1_ENABLE 0x20
+// OBSOLETE #define DSINGLE_STEP 0x10 /* not used */
+// OBSOLETE #define DDV_TYPE_MASK 0xc
+// OBSOLETE #define DDV_TYPE_LOAD 0x0
+// OBSOLETE #define DDV_TYPE_STORE 0x4
+// OBSOLETE #define DDV_TYPE_ACCESS 0x8
+// OBSOLETE #define DDV_TYPE_ALWAYS 0xc
+// OBSOLETE #define DDV_COND 0x2
+// OBSOLETE #define DDV_MASK 0x1
+// OBSOLETE
+// OBSOLETE int
+// OBSOLETE sparclite_insert_watchpoint (CORE_ADDR addr, int len, int type)
+// OBSOLETE {
+// OBSOLETE CORE_ADDR dcr;
+// OBSOLETE
+// OBSOLETE dcr = read_register (DCR_REGNUM);
+// OBSOLETE
+// OBSOLETE if (!(dcr & DDA1_ENABLE))
+// OBSOLETE {
+// OBSOLETE write_register (DDA1_REGNUM, addr);
+// OBSOLETE dcr &= ~(DDA1_ASI_MASK | DDV_TYPE_MASK);
+// OBSOLETE dcr |= (DDA1_SUP_ASI | DDA1_ENABLE);
+// OBSOLETE if (type == 1)
+// OBSOLETE {
+// OBSOLETE write_register (DDV1_REGNUM, 0);
+// OBSOLETE write_register (DDV2_REGNUM, 0xffffffff);
+// OBSOLETE dcr |= (DDV_TYPE_LOAD & (~DDV_COND & ~DDV_MASK));
+// OBSOLETE }
+// OBSOLETE else if (type == 0)
+// OBSOLETE {
+// OBSOLETE write_register (DDV1_REGNUM, 0);
+// OBSOLETE write_register (DDV2_REGNUM, 0xffffffff);
+// OBSOLETE dcr |= (DDV_TYPE_STORE & (~DDV_COND & ~DDV_MASK));
+// OBSOLETE }
+// OBSOLETE else
+// OBSOLETE {
+// OBSOLETE write_register (DDV1_REGNUM, 0);
+// OBSOLETE write_register (DDV2_REGNUM, 0xffffffff);
+// OBSOLETE dcr |= (DDV_TYPE_ACCESS);
+// OBSOLETE }
+// OBSOLETE write_register (DCR_REGNUM, dcr);
+// OBSOLETE }
+// OBSOLETE else if (!(dcr & DDA2_ENABLE))
+// OBSOLETE {
+// OBSOLETE write_register (DDA2_REGNUM, addr);
+// OBSOLETE dcr &= ~(DDA2_ASI_MASK & DDV_TYPE_MASK);
+// OBSOLETE dcr |= (DDA2_SUP_ASI | DDA2_ENABLE);
+// OBSOLETE if (type == 1)
+// OBSOLETE {
+// OBSOLETE write_register (DDV1_REGNUM, 0);
+// OBSOLETE write_register (DDV2_REGNUM, 0xffffffff);
+// OBSOLETE dcr |= (DDV_TYPE_LOAD & ~DDV_COND & ~DDV_MASK);
+// OBSOLETE }
+// OBSOLETE else if (type == 0)
+// OBSOLETE {
+// OBSOLETE write_register (DDV1_REGNUM, 0);
+// OBSOLETE write_register (DDV2_REGNUM, 0xffffffff);
+// OBSOLETE dcr |= (DDV_TYPE_STORE & ~DDV_COND & ~DDV_MASK);
+// OBSOLETE }
+// OBSOLETE else
+// OBSOLETE {
+// OBSOLETE write_register (DDV1_REGNUM, 0);
+// OBSOLETE write_register (DDV2_REGNUM, 0xffffffff);
+// OBSOLETE dcr |= (DDV_TYPE_ACCESS);
+// OBSOLETE }
+// OBSOLETE write_register (DCR_REGNUM, dcr);
+// OBSOLETE }
+// OBSOLETE else
+// OBSOLETE return -1;
+// OBSOLETE
+// OBSOLETE return 0;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE int
+// OBSOLETE sparclite_remove_watchpoint (CORE_ADDR addr, int len, int type)
+// OBSOLETE {
+// OBSOLETE CORE_ADDR dcr, dda1, dda2;
+// OBSOLETE
+// OBSOLETE dcr = read_register (DCR_REGNUM);
+// OBSOLETE dda1 = read_register (DDA1_REGNUM);
+// OBSOLETE dda2 = read_register (DDA2_REGNUM);
+// OBSOLETE
+// OBSOLETE if ((dcr & DDA1_ENABLE) && addr == dda1)
+// OBSOLETE write_register (DCR_REGNUM, (dcr & ~DDA1_ENABLE));
+// OBSOLETE else if ((dcr & DDA2_ENABLE) && addr == dda2)
+// OBSOLETE write_register (DCR_REGNUM, (dcr & ~DDA2_ENABLE));
+// OBSOLETE else
+// OBSOLETE return -1;
+// OBSOLETE
+// OBSOLETE return 0;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE int
+// OBSOLETE sparclite_insert_hw_breakpoint (CORE_ADDR addr, int len)
+// OBSOLETE {
+// OBSOLETE CORE_ADDR dcr;
+// OBSOLETE
+// OBSOLETE dcr = read_register (DCR_REGNUM);
+// OBSOLETE
+// OBSOLETE if (!(dcr & DIA1_ENABLE))
+// OBSOLETE {
+// OBSOLETE write_register (DIA1_REGNUM, addr);
+// OBSOLETE write_register (DCR_REGNUM, (dcr | DIA1_ENABLE | DIA1_SUP_MODE));
+// OBSOLETE }
+// OBSOLETE else if (!(dcr & DIA2_ENABLE))
+// OBSOLETE {
+// OBSOLETE write_register (DIA2_REGNUM, addr);
+// OBSOLETE write_register (DCR_REGNUM, (dcr | DIA2_ENABLE | DIA2_SUP_MODE));
+// OBSOLETE }
+// OBSOLETE else
+// OBSOLETE return -1;
+// OBSOLETE
+// OBSOLETE return 0;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE int
+// OBSOLETE sparclite_remove_hw_breakpoint (CORE_ADDR addr, int shadow)
+// OBSOLETE {
+// OBSOLETE CORE_ADDR dcr, dia1, dia2;
+// OBSOLETE
+// OBSOLETE dcr = read_register (DCR_REGNUM);
+// OBSOLETE dia1 = read_register (DIA1_REGNUM);
+// OBSOLETE dia2 = read_register (DIA2_REGNUM);
+// OBSOLETE
+// OBSOLETE if ((dcr & DIA1_ENABLE) && addr == dia1)
+// OBSOLETE write_register (DCR_REGNUM, (dcr & ~DIA1_ENABLE));
+// OBSOLETE else if ((dcr & DIA2_ENABLE) && addr == dia2)
+// OBSOLETE write_register (DCR_REGNUM, (dcr & ~DIA2_ENABLE));
+// OBSOLETE else
+// OBSOLETE return -1;
+// OBSOLETE
+// OBSOLETE return 0;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE int
+// OBSOLETE sparclite_check_watch_resources (int type, int cnt, int ot)
+// OBSOLETE {
+// OBSOLETE /* Watchpoints not supported on simulator. */
+// OBSOLETE if (strcmp (target_shortname, "sim") == 0)
+// OBSOLETE return 0;
+// OBSOLETE
+// OBSOLETE if (type == bp_hardware_breakpoint)
+// OBSOLETE {
+// OBSOLETE if (TARGET_HW_BREAK_LIMIT == 0)
+// OBSOLETE return 0;
+// OBSOLETE else if (cnt <= TARGET_HW_BREAK_LIMIT)
+// OBSOLETE return 1;
+// OBSOLETE }
+// OBSOLETE else
+// OBSOLETE {
+// OBSOLETE if (TARGET_HW_WATCH_LIMIT == 0)
+// OBSOLETE return 0;
+// OBSOLETE else if (ot)
+// OBSOLETE return -1;
+// OBSOLETE else if (cnt <= TARGET_HW_WATCH_LIMIT)
+// OBSOLETE return 1;
+// OBSOLETE }
+// OBSOLETE return -1;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE CORE_ADDR
+// OBSOLETE sparclite_stopped_data_address (void)
+// OBSOLETE {
+// OBSOLETE CORE_ADDR dsr, dda1, dda2;
+// OBSOLETE
+// OBSOLETE dsr = read_register (DSR_REGNUM);
+// OBSOLETE dda1 = read_register (DDA1_REGNUM);
+// OBSOLETE dda2 = read_register (DDA2_REGNUM);
+// OBSOLETE
+// OBSOLETE if (dsr & 0x10)
+// OBSOLETE return dda1;
+// OBSOLETE else if (dsr & 0x20)
+// OBSOLETE return dda2;
+// OBSOLETE else
+// OBSOLETE return 0;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE static struct serial *
+// OBSOLETE open_tty (char *name)
+// OBSOLETE {
+// OBSOLETE struct serial *desc;
+// OBSOLETE
+// OBSOLETE desc = serial_open (name);
+// OBSOLETE if (!desc)
+// OBSOLETE perror_with_name (name);
+// OBSOLETE
+// OBSOLETE if (baud_rate != -1)
+// OBSOLETE {
+// OBSOLETE if (serial_setbaudrate (desc, baud_rate))
+// OBSOLETE {
+// OBSOLETE serial_close (desc);
+// OBSOLETE perror_with_name (name);
+// OBSOLETE }
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE serial_raw (desc);
+// OBSOLETE
+// OBSOLETE serial_flush_input (desc);
+// OBSOLETE
+// OBSOLETE return desc;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE /* Read a single character from the remote end, masking it down to 7 bits. */
+// OBSOLETE
+// OBSOLETE static int
+// OBSOLETE readchar (struct serial *desc, int timeout)
+// OBSOLETE {
+// OBSOLETE int ch;
+// OBSOLETE char s[10];
+// OBSOLETE
+// OBSOLETE ch = serial_readchar (desc, timeout);
+// OBSOLETE
+// OBSOLETE switch (ch)
+// OBSOLETE {
+// OBSOLETE case SERIAL_EOF:
+// OBSOLETE error ("SPARClite remote connection closed");
+// OBSOLETE case SERIAL_ERROR:
+// OBSOLETE perror_with_name ("SPARClite communication error");
+// OBSOLETE case SERIAL_TIMEOUT:
+// OBSOLETE error ("SPARClite remote timeout");
+// OBSOLETE default:
+// OBSOLETE if (remote_debug > 0)
+// OBSOLETE {
+// OBSOLETE sprintf (s, "[%02x]", ch & 0xff);
+// OBSOLETE puts_debug ("read -->", s, "<--");
+// OBSOLETE }
+// OBSOLETE return ch;
+// OBSOLETE }
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE static void
+// OBSOLETE debug_serial_write (struct serial *desc, char *buf, int len)
+// OBSOLETE {
+// OBSOLETE char s[10];
+// OBSOLETE
+// OBSOLETE serial_write (desc, buf, len);
+// OBSOLETE if (remote_debug > 0)
+// OBSOLETE {
+// OBSOLETE while (len-- > 0)
+// OBSOLETE {
+// OBSOLETE sprintf (s, "[%02x]", *buf & 0xff);
+// OBSOLETE puts_debug ("Sent -->", s, "<--");
+// OBSOLETE buf++;
+// OBSOLETE }
+// OBSOLETE }
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE
+// OBSOLETE static int
+// OBSOLETE send_resp (struct serial *desc, char c)
+// OBSOLETE {
+// OBSOLETE debug_serial_write (desc, &c, 1);
+// OBSOLETE return readchar (desc, remote_timeout);
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE static void
+// OBSOLETE close_tty (void *ignore)
+// OBSOLETE {
+// OBSOLETE if (!remote_desc)
+// OBSOLETE return;
+// OBSOLETE
+// OBSOLETE serial_close (remote_desc);
+// OBSOLETE
+// OBSOLETE remote_desc = NULL;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE #ifdef HAVE_SOCKETS
+// OBSOLETE static int
+// OBSOLETE recv_udp_buf (int fd, unsigned char *buf, int len, int timeout)
+// OBSOLETE {
+// OBSOLETE int cc;
+// OBSOLETE fd_set readfds;
+// OBSOLETE
+// OBSOLETE FD_ZERO (&readfds);
+// OBSOLETE FD_SET (fd, &readfds);
+// OBSOLETE
+// OBSOLETE if (timeout >= 0)
+// OBSOLETE {
+// OBSOLETE struct timeval timebuf;
+// OBSOLETE
+// OBSOLETE timebuf.tv_sec = timeout;
+// OBSOLETE timebuf.tv_usec = 0;
+// OBSOLETE cc = select (fd + 1, &readfds, 0, 0, &timebuf);
+// OBSOLETE }
+// OBSOLETE else
+// OBSOLETE cc = select (fd + 1, &readfds, 0, 0, 0);
+// OBSOLETE
+// OBSOLETE if (cc == 0)
+// OBSOLETE return 0;
+// OBSOLETE
+// OBSOLETE if (cc != 1)
+// OBSOLETE perror_with_name ("recv_udp_buf: Bad return value from select:");
+// OBSOLETE
+// OBSOLETE cc = recv (fd, buf, len, 0);
+// OBSOLETE
+// OBSOLETE if (cc < 0)
+// OBSOLETE perror_with_name ("Got an error from recv: ");
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE static int
+// OBSOLETE send_udp_buf (int fd, unsigned char *buf, int len)
+// OBSOLETE {
+// OBSOLETE int cc;
+// OBSOLETE
+// OBSOLETE cc = send (fd, buf, len, 0);
+// OBSOLETE
+// OBSOLETE if (cc == len)
+// OBSOLETE return;
+// OBSOLETE
+// OBSOLETE if (cc < 0)
+// OBSOLETE perror_with_name ("Got an error from send: ");
+// OBSOLETE
+// OBSOLETE error ("Short count in send: tried %d, sent %d\n", len, cc);
+// OBSOLETE }
+// OBSOLETE #endif /* HAVE_SOCKETS */
+// OBSOLETE
+// OBSOLETE static void
+// OBSOLETE sparclite_open (char *name, int from_tty)
+// OBSOLETE {
+// OBSOLETE struct cleanup *old_chain;
+// OBSOLETE int c;
+// OBSOLETE char *p;
+// OBSOLETE
+// OBSOLETE if (!name)
+// OBSOLETE error ("You need to specify what device or hostname is associated with the SparcLite board.");
+// OBSOLETE
+// OBSOLETE target_preopen (from_tty);
+// OBSOLETE
+// OBSOLETE unpush_target (&sparclite_ops);
+// OBSOLETE
+// OBSOLETE if (remote_target_name)
+// OBSOLETE xfree (remote_target_name);
+// OBSOLETE
+// OBSOLETE remote_target_name = xstrdup (name);
+// OBSOLETE
+// OBSOLETE /* We need a 'serial' or 'udp' keyword to disambiguate host:port, which can
+// OBSOLETE mean either a serial port on a terminal server, or the IP address of a
+// OBSOLETE SPARClite demo board. If there's no colon, then it pretty much has to be
+// OBSOLETE a local device (except for DOS... grrmble) */
+// OBSOLETE
+// OBSOLETE p = strchr (name, ' ');
+// OBSOLETE
+// OBSOLETE if (p)
+// OBSOLETE {
+// OBSOLETE *p++ = '\000';
+// OBSOLETE while ((*p != '\000') && isspace (*p))
+// OBSOLETE p++;
+// OBSOLETE
+// OBSOLETE if (strncmp (name, "serial", strlen (name)) == 0)
+// OBSOLETE serial_flag = 1;
+// OBSOLETE else if (strncmp (name, "udp", strlen (name)) == 0)
+// OBSOLETE serial_flag = 0;
+// OBSOLETE else
+// OBSOLETE error ("Must specify either `serial' or `udp'.");
+// OBSOLETE }
+// OBSOLETE else
+// OBSOLETE {
+// OBSOLETE p = name;
+// OBSOLETE
+// OBSOLETE if (!strchr (name, ':'))
+// OBSOLETE serial_flag = 1; /* No colon is unambiguous (local device) */
+// OBSOLETE else
+// OBSOLETE error ("Usage: target sparclite serial /dev/ttyb\n\
+// OBSOLETE or: target sparclite udp host");
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE if (serial_flag)
+// OBSOLETE {
+// OBSOLETE remote_desc = open_tty (p);
+// OBSOLETE
+// OBSOLETE old_chain = make_cleanup (close_tty, 0 /*ignore*/);
+// OBSOLETE
+// OBSOLETE c = send_resp (remote_desc, 0x00);
+// OBSOLETE
+// OBSOLETE if (c != 0xaa)
+// OBSOLETE error ("Unknown response (0x%x) from SparcLite. Try resetting the board.",
+// OBSOLETE c);
+// OBSOLETE
+// OBSOLETE c = send_resp (remote_desc, 0x55);
+// OBSOLETE
+// OBSOLETE if (c != 0x55)
+// OBSOLETE error ("Sparclite appears to be ill.");
+// OBSOLETE }
+// OBSOLETE else
+// OBSOLETE {
+// OBSOLETE #ifdef HAVE_SOCKETS
+// OBSOLETE struct hostent *he;
+// OBSOLETE struct sockaddr_in sockaddr;
+// OBSOLETE unsigned char buffer[100];
+// OBSOLETE int cc;
+// OBSOLETE
+// OBSOLETE /* Setup the socket. Must be raw UDP. */
+// OBSOLETE
+// OBSOLETE he = gethostbyname (p);
+// OBSOLETE
+// OBSOLETE if (!he)
+// OBSOLETE error ("No such host %s.", p);
+// OBSOLETE
+// OBSOLETE udp_fd = socket (PF_INET, SOCK_DGRAM, 0);
+// OBSOLETE
+// OBSOLETE old_chain = make_cleanup (close, udp_fd);
+// OBSOLETE
+// OBSOLETE sockaddr.sin_family = PF_INET;
+// OBSOLETE sockaddr.sin_port = htons (7000);
+// OBSOLETE memcpy (&sockaddr.sin_addr.s_addr, he->h_addr, sizeof (struct in_addr));
+// OBSOLETE
+// OBSOLETE if (connect (udp_fd, &sockaddr, sizeof (sockaddr)))
+// OBSOLETE perror_with_name ("Connect failed");
+// OBSOLETE
+// OBSOLETE buffer[0] = 0x5;
+// OBSOLETE buffer[1] = 0;
+// OBSOLETE
+// OBSOLETE send_udp_buf (udp_fd, buffer, 2); /* Request version */
+// OBSOLETE cc = recv_udp_buf (udp_fd, buffer, sizeof (buffer), 5); /* Get response */
+// OBSOLETE if (cc == 0)
+// OBSOLETE error ("SPARClite isn't responding.");
+// OBSOLETE
+// OBSOLETE if (cc < 3)
+// OBSOLETE error ("SPARClite appears to be ill.");
+// OBSOLETE #else
+// OBSOLETE error ("UDP downloading is not supported for DOS hosts.");
+// OBSOLETE #endif /* HAVE_SOCKETS */
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE printf_unfiltered ("[SPARClite appears to be alive]\n");
+// OBSOLETE
+// OBSOLETE push_target (&sparclite_ops);
+// OBSOLETE
+// OBSOLETE discard_cleanups (old_chain);
+// OBSOLETE
+// OBSOLETE return;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE static void
+// OBSOLETE sparclite_close (int quitting)
+// OBSOLETE {
+// OBSOLETE if (serial_flag)
+// OBSOLETE close_tty (0);
+// OBSOLETE #ifdef HAVE_SOCKETS
+// OBSOLETE else if (udp_fd != -1)
+// OBSOLETE close (udp_fd);
+// OBSOLETE #endif
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE #define LOAD_ADDRESS 0x40000000
+// OBSOLETE
+// OBSOLETE static void
+// OBSOLETE download (char *target_name, char *args, int from_tty,
+// OBSOLETE void (*write_routine) (bfd *from_bfd, asection *from_sec,
+// OBSOLETE file_ptr from_addr, bfd_vma to_addr, int len),
+// OBSOLETE void (*start_routine) (bfd_vma entry))
+// OBSOLETE {
+// OBSOLETE struct cleanup *old_chain;
+// OBSOLETE asection *section;
+// OBSOLETE bfd *pbfd;
+// OBSOLETE bfd_vma entry;
+// OBSOLETE int i;
+// OBSOLETE #define WRITESIZE 1024
+// OBSOLETE char *filename;
+// OBSOLETE int quiet;
+// OBSOLETE int nostart;
+// OBSOLETE
+// OBSOLETE quiet = 0;
+// OBSOLETE nostart = 0;
+// OBSOLETE filename = NULL;
+// OBSOLETE
+// OBSOLETE while (*args != '\000')
+// OBSOLETE {
+// OBSOLETE char *arg;
+// OBSOLETE
+// OBSOLETE while (isspace (*args))
+// OBSOLETE args++;
+// OBSOLETE
+// OBSOLETE arg = args;
+// OBSOLETE
+// OBSOLETE while ((*args != '\000') && !isspace (*args))
+// OBSOLETE args++;
+// OBSOLETE
+// OBSOLETE if (*args != '\000')
+// OBSOLETE *args++ = '\000';
+// OBSOLETE
+// OBSOLETE if (*arg != '-')
+// OBSOLETE filename = arg;
+// OBSOLETE else if (strncmp (arg, "-quiet", strlen (arg)) == 0)
+// OBSOLETE quiet = 1;
+// OBSOLETE else if (strncmp (arg, "-nostart", strlen (arg)) == 0)
+// OBSOLETE nostart = 1;
+// OBSOLETE else
+// OBSOLETE error ("unknown option `%s'", arg);
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE if (!filename)
+// OBSOLETE filename = get_exec_file (1);
+// OBSOLETE
+// OBSOLETE pbfd = bfd_openr (filename, gnutarget);
+// OBSOLETE if (pbfd == NULL)
+// OBSOLETE {
+// OBSOLETE perror_with_name (filename);
+// OBSOLETE return;
+// OBSOLETE }
+// OBSOLETE old_chain = make_cleanup_bfd_close (pbfd);
+// OBSOLETE
+// OBSOLETE if (!bfd_check_format (pbfd, bfd_object))
+// OBSOLETE error ("\"%s\" is not an object file: %s", filename,
+// OBSOLETE bfd_errmsg (bfd_get_error ()));
+// OBSOLETE
+// OBSOLETE for (section = pbfd->sections; section; section = section->next)
+// OBSOLETE {
+// OBSOLETE if (bfd_get_section_flags (pbfd, section) & SEC_LOAD)
+// OBSOLETE {
+// OBSOLETE bfd_vma section_address;
+// OBSOLETE bfd_size_type section_size;
+// OBSOLETE file_ptr fptr;
+// OBSOLETE const char *section_name;
+// OBSOLETE
+// OBSOLETE section_name = bfd_get_section_name (pbfd, section);
+// OBSOLETE
+// OBSOLETE section_address = bfd_get_section_vma (pbfd, section);
+// OBSOLETE
+// OBSOLETE /* Adjust sections from a.out files, since they don't
+// OBSOLETE carry their addresses with. */
+// OBSOLETE if (bfd_get_flavour (pbfd) == bfd_target_aout_flavour)
+// OBSOLETE {
+// OBSOLETE if (strcmp (section_name, ".text") == 0)
+// OBSOLETE section_address = bfd_get_start_address (pbfd);
+// OBSOLETE else if (strcmp (section_name, ".data") == 0)
+// OBSOLETE {
+// OBSOLETE /* Read the first 8 bytes of the data section.
+// OBSOLETE There should be the string 'DaTa' followed by
+// OBSOLETE a word containing the actual section address. */
+// OBSOLETE struct data_marker
+// OBSOLETE {
+// OBSOLETE char signature[4]; /* 'DaTa' */
+// OBSOLETE unsigned char sdata[4]; /* &sdata */
+// OBSOLETE }
+// OBSOLETE marker;
+// OBSOLETE bfd_get_section_contents (pbfd, section, &marker, 0,
+// OBSOLETE sizeof (marker));
+// OBSOLETE if (strncmp (marker.signature, "DaTa", 4) == 0)
+// OBSOLETE {
+// OBSOLETE if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
+// OBSOLETE section_address = bfd_getb32 (marker.sdata);
+// OBSOLETE else
+// OBSOLETE section_address = bfd_getl32 (marker.sdata);
+// OBSOLETE }
+// OBSOLETE }
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE section_size = bfd_get_section_size_before_reloc (section);
+// OBSOLETE
+// OBSOLETE if (!quiet)
+// OBSOLETE printf_filtered ("[Loading section %s at 0x%x (%d bytes)]\n",
+// OBSOLETE bfd_get_section_name (pbfd, section),
+// OBSOLETE section_address,
+// OBSOLETE section_size);
+// OBSOLETE
+// OBSOLETE fptr = 0;
+// OBSOLETE while (section_size > 0)
+// OBSOLETE {
+// OBSOLETE int count;
+// OBSOLETE static char inds[] = "|/-\\";
+// OBSOLETE static int k = 0;
+// OBSOLETE
+// OBSOLETE QUIT;
+// OBSOLETE
+// OBSOLETE count = min (section_size, WRITESIZE);
+// OBSOLETE
+// OBSOLETE write_routine (pbfd, section, fptr, section_address, count);
+// OBSOLETE
+// OBSOLETE if (!quiet)
+// OBSOLETE {
+// OBSOLETE printf_unfiltered ("\r%c", inds[k++ % 4]);
+// OBSOLETE gdb_flush (gdb_stdout);
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE section_address += count;
+// OBSOLETE fptr += count;
+// OBSOLETE section_size -= count;
+// OBSOLETE }
+// OBSOLETE }
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE if (!nostart)
+// OBSOLETE {
+// OBSOLETE entry = bfd_get_start_address (pbfd);
+// OBSOLETE
+// OBSOLETE if (!quiet)
+// OBSOLETE printf_unfiltered ("[Starting %s at 0x%x]\n", filename, entry);
+// OBSOLETE
+// OBSOLETE start_routine (entry);
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE do_cleanups (old_chain);
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE static void
+// OBSOLETE sparclite_serial_start (bfd_vma entry)
+// OBSOLETE {
+// OBSOLETE char buffer[5];
+// OBSOLETE int i;
+// OBSOLETE
+// OBSOLETE buffer[0] = 0x03;
+// OBSOLETE store_unsigned_integer (buffer + 1, 4, entry);
+// OBSOLETE
+// OBSOLETE debug_serial_write (remote_desc, buffer, 1 + 4);
+// OBSOLETE i = readchar (remote_desc, remote_timeout);
+// OBSOLETE if (i != 0x55)
+// OBSOLETE error ("Can't start SparcLite. Error code %d\n", i);
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE static void
+// OBSOLETE sparclite_serial_write (bfd *from_bfd, asection *from_sec, file_ptr from_addr,
+// OBSOLETE bfd_vma to_addr, int len)
+// OBSOLETE {
+// OBSOLETE char buffer[4 + 4 + WRITESIZE]; /* addr + len + data */
+// OBSOLETE unsigned char checksum;
+// OBSOLETE int i;
+// OBSOLETE
+// OBSOLETE store_unsigned_integer (buffer, 4, to_addr); /* Address */
+// OBSOLETE store_unsigned_integer (buffer + 4, 4, len); /* Length */
+// OBSOLETE
+// OBSOLETE bfd_get_section_contents (from_bfd, from_sec, buffer + 8, from_addr, len);
+// OBSOLETE
+// OBSOLETE checksum = 0;
+// OBSOLETE for (i = 0; i < len; i++)
+// OBSOLETE checksum += buffer[8 + i];
+// OBSOLETE
+// OBSOLETE i = send_resp (remote_desc, 0x01);
+// OBSOLETE
+// OBSOLETE if (i != 0x5a)
+// OBSOLETE error ("Bad response from load command (0x%x)", i);
+// OBSOLETE
+// OBSOLETE debug_serial_write (remote_desc, buffer, 4 + 4 + len);
+// OBSOLETE i = readchar (remote_desc, remote_timeout);
+// OBSOLETE
+// OBSOLETE if (i != checksum)
+// OBSOLETE error ("Bad checksum from load command (0x%x)", i);
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE #ifdef HAVE_SOCKETS
+// OBSOLETE
+// OBSOLETE static unsigned short
+// OBSOLETE calc_checksum (unsigned char *buffer, int count)
+// OBSOLETE {
+// OBSOLETE unsigned short checksum;
+// OBSOLETE
+// OBSOLETE checksum = 0;
+// OBSOLETE for (; count > 0; count -= 2, buffer += 2)
+// OBSOLETE checksum += (*buffer << 8) | *(buffer + 1);
+// OBSOLETE
+// OBSOLETE if (count != 0)
+// OBSOLETE checksum += *buffer << 8;
+// OBSOLETE
+// OBSOLETE return checksum;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE static void
+// OBSOLETE sparclite_udp_start (bfd_vma entry)
+// OBSOLETE {
+// OBSOLETE unsigned char buffer[6];
+// OBSOLETE int i;
+// OBSOLETE
+// OBSOLETE buffer[0] = 0x3;
+// OBSOLETE buffer[1] = 0;
+// OBSOLETE buffer[2] = entry >> 24;
+// OBSOLETE buffer[3] = entry >> 16;
+// OBSOLETE buffer[4] = entry >> 8;
+// OBSOLETE buffer[5] = entry;
+// OBSOLETE
+// OBSOLETE send_udp_buf (udp_fd, buffer, 6); /* Send start addr */
+// OBSOLETE i = recv_udp_buf (udp_fd, buffer, sizeof (buffer), -1); /* Get response */
+// OBSOLETE
+// OBSOLETE if (i < 1 || buffer[0] != 0x55)
+// OBSOLETE error ("Failed to take start address.");
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE static void
+// OBSOLETE sparclite_udp_write (bfd *from_bfd, asection *from_sec, file_ptr from_addr,
+// OBSOLETE bfd_vma to_addr, int len)
+// OBSOLETE {
+// OBSOLETE unsigned char buffer[2000];
+// OBSOLETE unsigned short checksum;
+// OBSOLETE static int pkt_num = 0;
+// OBSOLETE static unsigned long old_addr = -1;
+// OBSOLETE int i;
+// OBSOLETE
+// OBSOLETE while (1)
+// OBSOLETE {
+// OBSOLETE if (to_addr != old_addr)
+// OBSOLETE {
+// OBSOLETE buffer[0] = 0x1; /* Load command */
+// OBSOLETE buffer[1] = 0x1; /* Loading address */
+// OBSOLETE buffer[2] = to_addr >> 24;
+// OBSOLETE buffer[3] = to_addr >> 16;
+// OBSOLETE buffer[4] = to_addr >> 8;
+// OBSOLETE buffer[5] = to_addr;
+// OBSOLETE
+// OBSOLETE checksum = 0;
+// OBSOLETE for (i = 0; i < 6; i++)
+// OBSOLETE checksum += buffer[i];
+// OBSOLETE checksum &= 0xff;
+// OBSOLETE
+// OBSOLETE send_udp_buf (udp_fd, buffer, 6);
+// OBSOLETE i = recv_udp_buf (udp_fd, buffer, sizeof buffer, -1);
+// OBSOLETE
+// OBSOLETE if (i < 1)
+// OBSOLETE error ("Got back short checksum for load addr.");
+// OBSOLETE
+// OBSOLETE if (checksum != buffer[0])
+// OBSOLETE error ("Got back bad checksum for load addr.");
+// OBSOLETE
+// OBSOLETE pkt_num = 0; /* Load addr resets packet seq # */
+// OBSOLETE old_addr = to_addr;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE bfd_get_section_contents (from_bfd, from_sec, buffer + 6, from_addr,
+// OBSOLETE len);
+// OBSOLETE
+// OBSOLETE checksum = calc_checksum (buffer + 6, len);
+// OBSOLETE
+// OBSOLETE buffer[0] = 0x1; /* Load command */
+// OBSOLETE buffer[1] = 0x2; /* Loading data */
+// OBSOLETE buffer[2] = pkt_num >> 8;
+// OBSOLETE buffer[3] = pkt_num;
+// OBSOLETE buffer[4] = checksum >> 8;
+// OBSOLETE buffer[5] = checksum;
+// OBSOLETE
+// OBSOLETE send_udp_buf (udp_fd, buffer, len + 6);
+// OBSOLETE i = recv_udp_buf (udp_fd, buffer, sizeof buffer, 3);
+// OBSOLETE
+// OBSOLETE if (i == 0)
+// OBSOLETE {
+// OBSOLETE fprintf_unfiltered (gdb_stderr, "send_data: timeout sending %d bytes to address 0x%x retrying\n", len, to_addr);
+// OBSOLETE continue;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE if (buffer[0] != 0xff)
+// OBSOLETE error ("Got back bad response for load data.");
+// OBSOLETE
+// OBSOLETE old_addr += len;
+// OBSOLETE pkt_num++;
+// OBSOLETE
+// OBSOLETE return;
+// OBSOLETE }
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE #endif /* HAVE_SOCKETS */
+// OBSOLETE
+// OBSOLETE static void
+// OBSOLETE sparclite_download (char *filename, int from_tty)
+// OBSOLETE {
+// OBSOLETE if (!serial_flag)
+// OBSOLETE #ifdef HAVE_SOCKETS
+// OBSOLETE download (remote_target_name, filename, from_tty, sparclite_udp_write,
+// OBSOLETE sparclite_udp_start);
+// OBSOLETE #else
+// OBSOLETE internal_error (__FILE__, __LINE__, "failed internal consistency check"); /* sparclite_open should prevent this! */
+// OBSOLETE #endif
+// OBSOLETE else
+// OBSOLETE download (remote_target_name, filename, from_tty, sparclite_serial_write,
+// OBSOLETE sparclite_serial_start);
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE /* Set up the sparclite target vector. */
+// OBSOLETE
+// OBSOLETE static void
+// OBSOLETE init_sparclite_ops (void)
+// OBSOLETE {
+// OBSOLETE sparclite_ops.to_shortname = "sparclite";
+// OBSOLETE sparclite_ops.to_longname = "SPARClite download target";
+// OBSOLETE sparclite_ops.to_doc = "Download to a remote SPARClite target board via serial of UDP.\n\
+// OBSOLETE Specify the device it is connected to (e.g. /dev/ttya).";
+// OBSOLETE sparclite_ops.to_open = sparclite_open;
+// OBSOLETE sparclite_ops.to_close = sparclite_close;
+// OBSOLETE sparclite_ops.to_load = sparclite_download;
+// OBSOLETE sparclite_ops.to_stratum = download_stratum;
+// OBSOLETE sparclite_ops.to_magic = OPS_MAGIC;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE void
+// OBSOLETE _initialize_sparcl_tdep (void)
+// OBSOLETE {
+// OBSOLETE init_sparclite_ops ();
+// OBSOLETE add_target (&sparclite_ops);
+// OBSOLETE }
diff --git a/gdb/sparclet-rom.c b/gdb/sparclet-rom.c
index fa2ca1e..9247131 100644
--- a/gdb/sparclet-rom.c
+++ b/gdb/sparclet-rom.c
@@ -1,316 +1,316 @@
-/* Remote target glue for the SPARC Sparclet ROM monitor.
-
- Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free
- Software Foundation, Inc.
-
- This file is part of GDB.
-
- 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.
-
- 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.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-
-
-#include "defs.h"
-#include "gdbcore.h"
-#include "target.h"
-#include "monitor.h"
-#include "serial.h"
-#include "srec.h"
-#include "symtab.h"
-#include "symfile.h" /* for generic_load */
-#include "regcache.h"
-#include <time.h>
-
-extern void report_transfer_performance (unsigned long, time_t, time_t);
-
-static struct target_ops sparclet_ops;
-
-static void sparclet_open (char *args, int from_tty);
-
-/* This array of registers need to match the indexes used by GDB.
- This exists because the various ROM monitors use different strings
- than does GDB, and don't necessarily support all the registers
- either. So, typing "info reg sp" becomes a "r30". */
-
-/*PSR 0x00000080 impl ver icc AW LE EE EC EF PIL S PS ET CWP WIM
- 0x0 0x0 0x0 0 0 0 0 0 0x0 1 0 0 0x00 0x2
- 0000010
- INS LOCALS OUTS GLOBALS
- 0 0x00000000 0x00000000 0x00000000 0x00000000
- 1 0x00000000 0x00000000 0x00000000 0x00000000
- 2 0x00000000 0x00000000 0x00000000 0x00000000
- 3 0x00000000 0x00000000 0x00000000 0x00000000
- 4 0x00000000 0x00000000 0x00000000 0x00000000
- 5 0x00000000 0x00001000 0x00000000 0x00000000
- 6 0x00000000 0x00000000 0x123f0000 0x00000000
- 7 0x00000000 0x00000000 0x00000000 0x00000000
- pc: 0x12010000 0x00000000 unimp
- npc: 0x12010004 0x00001000 unimp 0x1000
- tbr: 0x00000000
- y: 0x00000000
- */
-/* these correspond to the offsets from tm-* files from config directories */
-
-/* is wim part of psr?? */
-/* monitor wants lower case */
-static char *sparclet_regnames[] = {
- "g0", "g1", "g2", "g3", "g4", "g5", "g6", "g7",
- "o0", "o1", "o2", "o3", "o4", "o5", "o6", "o7",
- "l0", "l1", "l2", "l3", "l4", "l5", "l6", "l7",
- "i0", "i1", "i2", "i3", "i4", "i5", "i6", "i7",
-
- "", "", "", "", "", "", "", "", /* no FPU regs */
- "", "", "", "", "", "", "", "",
- "", "", "", "", "", "", "", "",
- "", "", "", "", "", "", "", "",
- /* no CPSR, FPSR */
- "y", "psr", "wim", "tbr", "pc", "npc", "", "",
-
- "ccsr", "ccpr", "cccrcr", "ccor", "ccobr", "ccibr", "ccir", "",
-
- /* ASR15 ASR19 (don't display them) */
- "asr1", "", "asr17", "asr18", "", "asr20", "asr21", "asr22",
-/*
- "awr0", "awr1", "awr2", "awr3", "awr4", "awr5", "awr6", "awr7",
- "awr8", "awr9", "awr10", "awr11", "awr12", "awr13", "awr14", "awr15",
- "awr16", "awr17", "awr18", "awr19", "awr20", "awr21", "awr22", "awr23",
- "awr24", "awr25", "awr26", "awr27", "awr28", "awr29", "awr30", "awr31",
- "apsr",
- */
-};
-
-
-
-/* Function: sparclet_supply_register
- Just returns with no action.
- This function is required, because parse_register_dump (monitor.c)
- expects to be able to call it. If we don't supply something, it will
- call a null pointer and core-dump. Since this function does not
- actually do anything, GDB will request the registers individually. */
-
-static void
-sparclet_supply_register (char *regname, int regnamelen, char *val, int vallen)
-{
- return;
-}
-
-static void
-sparclet_load (struct serial *desc, char *file, int hashmark)
-{
- bfd *abfd;
- asection *s;
- int i;
- CORE_ADDR load_offset;
- time_t start_time, end_time;
- unsigned long data_count = 0;
-
- /* enable user to specify address for downloading as 2nd arg to load */
-
- i = sscanf (file, "%*s 0x%lx", &load_offset);
- if (i >= 1)
- {
- char *p;
-
- for (p = file; *p != '\000' && !isspace (*p); p++);
-
- *p = '\000';
- }
- else
- load_offset = 0;
-
- abfd = bfd_openr (file, 0);
- if (!abfd)
- {
- printf_filtered ("Unable to open file %s\n", file);
- return;
- }
-
- if (bfd_check_format (abfd, bfd_object) == 0)
- {
- printf_filtered ("File is not an object file\n");
- return;
- }
-
- start_time = time (NULL);
-
- for (s = abfd->sections; s; s = s->next)
- if (s->flags & SEC_LOAD)
- {
- bfd_size_type section_size;
- bfd_vma vma;
-
- vma = bfd_get_section_vma (abfd, s) + load_offset;
- section_size = bfd_section_size (abfd, s);
-
- data_count += section_size;
-
- printf_filtered ("%s\t: 0x%4x .. 0x%4x ",
- bfd_get_section_name (abfd, s), vma,
- vma + section_size);
- gdb_flush (gdb_stdout);
-
- monitor_printf ("load c r %x %x\r", vma, section_size);
-
- monitor_expect ("load: loading ", NULL, 0);
- monitor_expect ("\r", NULL, 0);
-
- for (i = 0; i < section_size; i += 2048)
- {
- int numbytes;
- char buf[2048];
-
- numbytes = min (sizeof buf, section_size - i);
-
- bfd_get_section_contents (abfd, s, buf, i, numbytes);
-
- serial_write (desc, buf, numbytes);
-
- if (hashmark)
- {
- putchar_unfiltered ('#');
- gdb_flush (gdb_stdout);
- }
- } /* Per-packet (or S-record) loop */
-
- monitor_expect_prompt (NULL, 0);
-
- putchar_unfiltered ('\n');
- } /* Loadable sections */
-
- monitor_printf ("reg pc %x\r", bfd_get_start_address (abfd));
- monitor_expect_prompt (NULL, 0);
- monitor_printf ("reg npc %x\r", bfd_get_start_address (abfd) + 4);
- monitor_expect_prompt (NULL, 0);
-
- monitor_printf ("run\r");
-
- end_time = time (NULL);
-
- if (hashmark)
- putchar_unfiltered ('\n');
-
- report_transfer_performance (data_count, start_time, end_time);
-
- pop_target ();
- push_remote_target (monitor_get_dev_name (), 1);
-
- throw_exception (RETURN_QUIT);
-}
-
-/* Define the monitor command strings. Since these are passed directly
- through to a printf style function, we may include formatting
- strings. We also need a CR or LF on the end. */
-
-/* need to pause the monitor for timing reasons, so slow it down */
-
-static char *sparclet_inits[] =
-{"\n\r\r\n", NULL};
-
-static struct monitor_ops sparclet_cmds;
-
-static void
-init_sparclet_cmds (void)
-{
- sparclet_cmds.flags = MO_CLR_BREAK_USES_ADDR |
- MO_HEX_PREFIX |
- MO_NO_ECHO_ON_OPEN |
- MO_NO_ECHO_ON_SETMEM |
- MO_RUN_FIRST_TIME |
- MO_GETMEM_READ_SINGLE; /* flags */
- sparclet_cmds.init = sparclet_inits; /* Init strings */
- sparclet_cmds.cont = "cont\r"; /* continue command */
- sparclet_cmds.step = "step\r"; /* single step */
- sparclet_cmds.stop = "\r"; /* break interrupts the program */
- sparclet_cmds.set_break = "+bp %x\r"; /* set a breakpoint */
- sparclet_cmds.clr_break = "-bp %x\r"; /* can't use "br" because only 2 hw bps are supported */
- sparclet_cmds.clr_all_break = "-bp %x\r"; /* clear a breakpoint */
- "-bp\r"; /* clear all breakpoints */
- sparclet_cmds.fill = "fill %x -n %x -v %x -b\r"; /* fill (start length val) */
- /* can't use "fi" because it takes words, not bytes */
- /* ex [addr] [-n count] [-b|-s|-l] default: ex cur -n 1 -b */
- sparclet_cmds.setmem.cmdb = "ex %x -b\r%x\rq\r"; /* setmem.cmdb (addr, value) */
- sparclet_cmds.setmem.cmdw = "ex %x -s\r%x\rq\r"; /* setmem.cmdw (addr, value) */
- sparclet_cmds.setmem.cmdl = "ex %x -l\r%x\rq\r"; /* setmem.cmdl (addr, value) */
- sparclet_cmds.setmem.cmdll = NULL; /* setmem.cmdll (addr, value) */
- sparclet_cmds.setmem.resp_delim = NULL; /*": " *//* setmem.resp_delim */
- sparclet_cmds.setmem.term = NULL; /*"? " *//* setmem.term */
- sparclet_cmds.setmem.term_cmd = NULL; /*"q\r" *//* setmem.term_cmd */
- /* since the parsing of multiple bytes is difficult due to
- interspersed addresses, we'll only read 1 value at a time,
- even tho these can handle a count */
- /* we can use -n to set count to read, but may have to parse? */
- sparclet_cmds.getmem.cmdb = "ex %x -n 1 -b\r"; /* getmem.cmdb (addr, #bytes) */
- sparclet_cmds.getmem.cmdw = "ex %x -n 1 -s\r"; /* getmem.cmdw (addr, #swords) */
- sparclet_cmds.getmem.cmdl = "ex %x -n 1 -l\r"; /* getmem.cmdl (addr, #words) */
- sparclet_cmds.getmem.cmdll = NULL; /* getmem.cmdll (addr, #dwords) */
- sparclet_cmds.getmem.resp_delim = ": "; /* getmem.resp_delim */
- sparclet_cmds.getmem.term = NULL; /* getmem.term */
- sparclet_cmds.getmem.term_cmd = NULL; /* getmem.term_cmd */
- sparclet_cmds.setreg.cmd = "reg %s 0x%x\r"; /* setreg.cmd (name, value) */
- sparclet_cmds.setreg.resp_delim = NULL; /* setreg.resp_delim */
- sparclet_cmds.setreg.term = NULL; /* setreg.term */
- sparclet_cmds.setreg.term_cmd = NULL; /* setreg.term_cmd */
- sparclet_cmds.getreg.cmd = "reg %s\r"; /* getreg.cmd (name) */
- sparclet_cmds.getreg.resp_delim = " "; /* getreg.resp_delim */
- sparclet_cmds.getreg.term = NULL; /* getreg.term */
- sparclet_cmds.getreg.term_cmd = NULL; /* getreg.term_cmd */
- sparclet_cmds.dump_registers = "reg\r"; /* dump_registers */
- sparclet_cmds.register_pattern = "\\(\\w+\\)=\\([0-9a-fA-F]+\\)"; /* register_pattern */
- sparclet_cmds.supply_register = sparclet_supply_register; /* supply_register */
- sparclet_cmds.load_routine = sparclet_load; /* load_routine */
- sparclet_cmds.load = NULL; /* download command (srecs on console) */
- sparclet_cmds.loadresp = NULL; /* load response */
- sparclet_cmds.prompt = "monitor>"; /* monitor command prompt */
- /* yikes! gdb core dumps without this delimitor!! */
- sparclet_cmds.line_term = "\r"; /* end-of-command delimitor */
- sparclet_cmds.cmd_end = NULL; /* optional command terminator */
- sparclet_cmds.target = &sparclet_ops; /* target operations */
- sparclet_cmds.stopbits = SERIAL_1_STOPBITS; /* number of stop bits */
- sparclet_cmds.regnames = sparclet_regnames; /* registers names */
- sparclet_cmds.magic = MONITOR_OPS_MAGIC; /* magic */
-};
-
-static void
-sparclet_open (char *args, int from_tty)
-{
- monitor_open (args, &sparclet_cmds, from_tty);
-}
-
-void
-_initialize_sparclet (void)
-{
- int i;
- init_sparclet_cmds ();
-
- for (i = 0; i < NUM_REGS; i++)
- if (sparclet_regnames[i][0] == 'c' ||
- sparclet_regnames[i][0] == 'a')
- sparclet_regnames[i] = 0; /* mon can't report c* or a* regs */
-
- sparclet_regnames[0] = 0; /* mon won't report %G0 */
-
- init_monitor_ops (&sparclet_ops);
- sparclet_ops.to_shortname = "sparclet"; /* for the target command */
- sparclet_ops.to_longname = "SPARC Sparclet monitor";
- /* use SW breaks; target only supports 2 HW breakpoints */
- sparclet_ops.to_insert_breakpoint = memory_insert_breakpoint;
- sparclet_ops.to_remove_breakpoint = memory_remove_breakpoint;
-
- sparclet_ops.to_doc =
- "Use a board running the Sparclet debug monitor.\n\
-Specify the serial device it is connected to (e.g. /dev/ttya).";
-
- sparclet_ops.to_open = sparclet_open;
- add_target (&sparclet_ops);
-}
+// OBSOLETE /* Remote target glue for the SPARC Sparclet ROM monitor.
+// OBSOLETE
+// OBSOLETE Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free
+// OBSOLETE Software Foundation, Inc.
+// OBSOLETE
+// OBSOLETE This file is part of GDB.
+// OBSOLETE
+// OBSOLETE This program is free software; you can redistribute it and/or modify
+// OBSOLETE it under the terms of the GNU General Public License as published by
+// OBSOLETE the Free Software Foundation; either version 2 of the License, or
+// OBSOLETE (at your option) any later version.
+// OBSOLETE
+// OBSOLETE This program is distributed in the hope that it will be useful,
+// OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of
+// OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// OBSOLETE GNU General Public License for more details.
+// OBSOLETE
+// OBSOLETE You should have received a copy of the GNU General Public License
+// OBSOLETE along with this program; if not, write to the Free Software
+// OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330,
+// OBSOLETE Boston, MA 02111-1307, USA. */
+// OBSOLETE
+// OBSOLETE
+// OBSOLETE #include "defs.h"
+// OBSOLETE #include "gdbcore.h"
+// OBSOLETE #include "target.h"
+// OBSOLETE #include "monitor.h"
+// OBSOLETE #include "serial.h"
+// OBSOLETE #include "srec.h"
+// OBSOLETE #include "symtab.h"
+// OBSOLETE #include "symfile.h" /* for generic_load */
+// OBSOLETE #include "regcache.h"
+// OBSOLETE #include <time.h>
+// OBSOLETE
+// OBSOLETE extern void report_transfer_performance (unsigned long, time_t, time_t);
+// OBSOLETE
+// OBSOLETE static struct target_ops sparclet_ops;
+// OBSOLETE
+// OBSOLETE static void sparclet_open (char *args, int from_tty);
+// OBSOLETE
+// OBSOLETE /* This array of registers need to match the indexes used by GDB.
+// OBSOLETE This exists because the various ROM monitors use different strings
+// OBSOLETE than does GDB, and don't necessarily support all the registers
+// OBSOLETE either. So, typing "info reg sp" becomes a "r30". */
+// OBSOLETE
+// OBSOLETE /*PSR 0x00000080 impl ver icc AW LE EE EC EF PIL S PS ET CWP WIM
+// OBSOLETE 0x0 0x0 0x0 0 0 0 0 0 0x0 1 0 0 0x00 0x2
+// OBSOLETE 0000010
+// OBSOLETE INS LOCALS OUTS GLOBALS
+// OBSOLETE 0 0x00000000 0x00000000 0x00000000 0x00000000
+// OBSOLETE 1 0x00000000 0x00000000 0x00000000 0x00000000
+// OBSOLETE 2 0x00000000 0x00000000 0x00000000 0x00000000
+// OBSOLETE 3 0x00000000 0x00000000 0x00000000 0x00000000
+// OBSOLETE 4 0x00000000 0x00000000 0x00000000 0x00000000
+// OBSOLETE 5 0x00000000 0x00001000 0x00000000 0x00000000
+// OBSOLETE 6 0x00000000 0x00000000 0x123f0000 0x00000000
+// OBSOLETE 7 0x00000000 0x00000000 0x00000000 0x00000000
+// OBSOLETE pc: 0x12010000 0x00000000 unimp
+// OBSOLETE npc: 0x12010004 0x00001000 unimp 0x1000
+// OBSOLETE tbr: 0x00000000
+// OBSOLETE y: 0x00000000
+// OBSOLETE */
+// OBSOLETE /* these correspond to the offsets from tm-* files from config directories */
+// OBSOLETE
+// OBSOLETE /* is wim part of psr?? */
+// OBSOLETE /* monitor wants lower case */
+// OBSOLETE static char *sparclet_regnames[] = {
+// OBSOLETE "g0", "g1", "g2", "g3", "g4", "g5", "g6", "g7",
+// OBSOLETE "o0", "o1", "o2", "o3", "o4", "o5", "o6", "o7",
+// OBSOLETE "l0", "l1", "l2", "l3", "l4", "l5", "l6", "l7",
+// OBSOLETE "i0", "i1", "i2", "i3", "i4", "i5", "i6", "i7",
+// OBSOLETE
+// OBSOLETE "", "", "", "", "", "", "", "", /* no FPU regs */
+// OBSOLETE "", "", "", "", "", "", "", "",
+// OBSOLETE "", "", "", "", "", "", "", "",
+// OBSOLETE "", "", "", "", "", "", "", "",
+// OBSOLETE /* no CPSR, FPSR */
+// OBSOLETE "y", "psr", "wim", "tbr", "pc", "npc", "", "",
+// OBSOLETE
+// OBSOLETE "ccsr", "ccpr", "cccrcr", "ccor", "ccobr", "ccibr", "ccir", "",
+// OBSOLETE
+// OBSOLETE /* ASR15 ASR19 (don't display them) */
+// OBSOLETE "asr1", "", "asr17", "asr18", "", "asr20", "asr21", "asr22",
+// OBSOLETE /*
+// OBSOLETE "awr0", "awr1", "awr2", "awr3", "awr4", "awr5", "awr6", "awr7",
+// OBSOLETE "awr8", "awr9", "awr10", "awr11", "awr12", "awr13", "awr14", "awr15",
+// OBSOLETE "awr16", "awr17", "awr18", "awr19", "awr20", "awr21", "awr22", "awr23",
+// OBSOLETE "awr24", "awr25", "awr26", "awr27", "awr28", "awr29", "awr30", "awr31",
+// OBSOLETE "apsr",
+// OBSOLETE */
+// OBSOLETE };
+// OBSOLETE
+// OBSOLETE
+// OBSOLETE
+// OBSOLETE /* Function: sparclet_supply_register
+// OBSOLETE Just returns with no action.
+// OBSOLETE This function is required, because parse_register_dump (monitor.c)
+// OBSOLETE expects to be able to call it. If we don't supply something, it will
+// OBSOLETE call a null pointer and core-dump. Since this function does not
+// OBSOLETE actually do anything, GDB will request the registers individually. */
+// OBSOLETE
+// OBSOLETE static void
+// OBSOLETE sparclet_supply_register (char *regname, int regnamelen, char *val, int vallen)
+// OBSOLETE {
+// OBSOLETE return;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE static void
+// OBSOLETE sparclet_load (struct serial *desc, char *file, int hashmark)
+// OBSOLETE {
+// OBSOLETE bfd *abfd;
+// OBSOLETE asection *s;
+// OBSOLETE int i;
+// OBSOLETE CORE_ADDR load_offset;
+// OBSOLETE time_t start_time, end_time;
+// OBSOLETE unsigned long data_count = 0;
+// OBSOLETE
+// OBSOLETE /* enable user to specify address for downloading as 2nd arg to load */
+// OBSOLETE
+// OBSOLETE i = sscanf (file, "%*s 0x%lx", &load_offset);
+// OBSOLETE if (i >= 1)
+// OBSOLETE {
+// OBSOLETE char *p;
+// OBSOLETE
+// OBSOLETE for (p = file; *p != '\000' && !isspace (*p); p++);
+// OBSOLETE
+// OBSOLETE *p = '\000';
+// OBSOLETE }
+// OBSOLETE else
+// OBSOLETE load_offset = 0;
+// OBSOLETE
+// OBSOLETE abfd = bfd_openr (file, 0);
+// OBSOLETE if (!abfd)
+// OBSOLETE {
+// OBSOLETE printf_filtered ("Unable to open file %s\n", file);
+// OBSOLETE return;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE if (bfd_check_format (abfd, bfd_object) == 0)
+// OBSOLETE {
+// OBSOLETE printf_filtered ("File is not an object file\n");
+// OBSOLETE return;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE start_time = time (NULL);
+// OBSOLETE
+// OBSOLETE for (s = abfd->sections; s; s = s->next)
+// OBSOLETE if (s->flags & SEC_LOAD)
+// OBSOLETE {
+// OBSOLETE bfd_size_type section_size;
+// OBSOLETE bfd_vma vma;
+// OBSOLETE
+// OBSOLETE vma = bfd_get_section_vma (abfd, s) + load_offset;
+// OBSOLETE section_size = bfd_section_size (abfd, s);
+// OBSOLETE
+// OBSOLETE data_count += section_size;
+// OBSOLETE
+// OBSOLETE printf_filtered ("%s\t: 0x%4x .. 0x%4x ",
+// OBSOLETE bfd_get_section_name (abfd, s), vma,
+// OBSOLETE vma + section_size);
+// OBSOLETE gdb_flush (gdb_stdout);
+// OBSOLETE
+// OBSOLETE monitor_printf ("load c r %x %x\r", vma, section_size);
+// OBSOLETE
+// OBSOLETE monitor_expect ("load: loading ", NULL, 0);
+// OBSOLETE monitor_expect ("\r", NULL, 0);
+// OBSOLETE
+// OBSOLETE for (i = 0; i < section_size; i += 2048)
+// OBSOLETE {
+// OBSOLETE int numbytes;
+// OBSOLETE char buf[2048];
+// OBSOLETE
+// OBSOLETE numbytes = min (sizeof buf, section_size - i);
+// OBSOLETE
+// OBSOLETE bfd_get_section_contents (abfd, s, buf, i, numbytes);
+// OBSOLETE
+// OBSOLETE serial_write (desc, buf, numbytes);
+// OBSOLETE
+// OBSOLETE if (hashmark)
+// OBSOLETE {
+// OBSOLETE putchar_unfiltered ('#');
+// OBSOLETE gdb_flush (gdb_stdout);
+// OBSOLETE }
+// OBSOLETE } /* Per-packet (or S-record) loop */
+// OBSOLETE
+// OBSOLETE monitor_expect_prompt (NULL, 0);
+// OBSOLETE
+// OBSOLETE putchar_unfiltered ('\n');
+// OBSOLETE } /* Loadable sections */
+// OBSOLETE
+// OBSOLETE monitor_printf ("reg pc %x\r", bfd_get_start_address (abfd));
+// OBSOLETE monitor_expect_prompt (NULL, 0);
+// OBSOLETE monitor_printf ("reg npc %x\r", bfd_get_start_address (abfd) + 4);
+// OBSOLETE monitor_expect_prompt (NULL, 0);
+// OBSOLETE
+// OBSOLETE monitor_printf ("run\r");
+// OBSOLETE
+// OBSOLETE end_time = time (NULL);
+// OBSOLETE
+// OBSOLETE if (hashmark)
+// OBSOLETE putchar_unfiltered ('\n');
+// OBSOLETE
+// OBSOLETE report_transfer_performance (data_count, start_time, end_time);
+// OBSOLETE
+// OBSOLETE pop_target ();
+// OBSOLETE push_remote_target (monitor_get_dev_name (), 1);
+// OBSOLETE
+// OBSOLETE throw_exception (RETURN_QUIT);
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE /* Define the monitor command strings. Since these are passed directly
+// OBSOLETE through to a printf style function, we may include formatting
+// OBSOLETE strings. We also need a CR or LF on the end. */
+// OBSOLETE
+// OBSOLETE /* need to pause the monitor for timing reasons, so slow it down */
+// OBSOLETE
+// OBSOLETE static char *sparclet_inits[] =
+// OBSOLETE {"\n\r\r\n", NULL};
+// OBSOLETE
+// OBSOLETE static struct monitor_ops sparclet_cmds;
+// OBSOLETE
+// OBSOLETE static void
+// OBSOLETE init_sparclet_cmds (void)
+// OBSOLETE {
+// OBSOLETE sparclet_cmds.flags = MO_CLR_BREAK_USES_ADDR |
+// OBSOLETE MO_HEX_PREFIX |
+// OBSOLETE MO_NO_ECHO_ON_OPEN |
+// OBSOLETE MO_NO_ECHO_ON_SETMEM |
+// OBSOLETE MO_RUN_FIRST_TIME |
+// OBSOLETE MO_GETMEM_READ_SINGLE; /* flags */
+// OBSOLETE sparclet_cmds.init = sparclet_inits; /* Init strings */
+// OBSOLETE sparclet_cmds.cont = "cont\r"; /* continue command */
+// OBSOLETE sparclet_cmds.step = "step\r"; /* single step */
+// OBSOLETE sparclet_cmds.stop = "\r"; /* break interrupts the program */
+// OBSOLETE sparclet_cmds.set_break = "+bp %x\r"; /* set a breakpoint */
+// OBSOLETE sparclet_cmds.clr_break = "-bp %x\r"; /* can't use "br" because only 2 hw bps are supported */
+// OBSOLETE sparclet_cmds.clr_all_break = "-bp %x\r"; /* clear a breakpoint */
+// OBSOLETE "-bp\r"; /* clear all breakpoints */
+// OBSOLETE sparclet_cmds.fill = "fill %x -n %x -v %x -b\r"; /* fill (start length val) */
+// OBSOLETE /* can't use "fi" because it takes words, not bytes */
+// OBSOLETE /* ex [addr] [-n count] [-b|-s|-l] default: ex cur -n 1 -b */
+// OBSOLETE sparclet_cmds.setmem.cmdb = "ex %x -b\r%x\rq\r"; /* setmem.cmdb (addr, value) */
+// OBSOLETE sparclet_cmds.setmem.cmdw = "ex %x -s\r%x\rq\r"; /* setmem.cmdw (addr, value) */
+// OBSOLETE sparclet_cmds.setmem.cmdl = "ex %x -l\r%x\rq\r"; /* setmem.cmdl (addr, value) */
+// OBSOLETE sparclet_cmds.setmem.cmdll = NULL; /* setmem.cmdll (addr, value) */
+// OBSOLETE sparclet_cmds.setmem.resp_delim = NULL; /*": " *//* setmem.resp_delim */
+// OBSOLETE sparclet_cmds.setmem.term = NULL; /*"? " *//* setmem.term */
+// OBSOLETE sparclet_cmds.setmem.term_cmd = NULL; /*"q\r" *//* setmem.term_cmd */
+// OBSOLETE /* since the parsing of multiple bytes is difficult due to
+// OBSOLETE interspersed addresses, we'll only read 1 value at a time,
+// OBSOLETE even tho these can handle a count */
+// OBSOLETE /* we can use -n to set count to read, but may have to parse? */
+// OBSOLETE sparclet_cmds.getmem.cmdb = "ex %x -n 1 -b\r"; /* getmem.cmdb (addr, #bytes) */
+// OBSOLETE sparclet_cmds.getmem.cmdw = "ex %x -n 1 -s\r"; /* getmem.cmdw (addr, #swords) */
+// OBSOLETE sparclet_cmds.getmem.cmdl = "ex %x -n 1 -l\r"; /* getmem.cmdl (addr, #words) */
+// OBSOLETE sparclet_cmds.getmem.cmdll = NULL; /* getmem.cmdll (addr, #dwords) */
+// OBSOLETE sparclet_cmds.getmem.resp_delim = ": "; /* getmem.resp_delim */
+// OBSOLETE sparclet_cmds.getmem.term = NULL; /* getmem.term */
+// OBSOLETE sparclet_cmds.getmem.term_cmd = NULL; /* getmem.term_cmd */
+// OBSOLETE sparclet_cmds.setreg.cmd = "reg %s 0x%x\r"; /* setreg.cmd (name, value) */
+// OBSOLETE sparclet_cmds.setreg.resp_delim = NULL; /* setreg.resp_delim */
+// OBSOLETE sparclet_cmds.setreg.term = NULL; /* setreg.term */
+// OBSOLETE sparclet_cmds.setreg.term_cmd = NULL; /* setreg.term_cmd */
+// OBSOLETE sparclet_cmds.getreg.cmd = "reg %s\r"; /* getreg.cmd (name) */
+// OBSOLETE sparclet_cmds.getreg.resp_delim = " "; /* getreg.resp_delim */
+// OBSOLETE sparclet_cmds.getreg.term = NULL; /* getreg.term */
+// OBSOLETE sparclet_cmds.getreg.term_cmd = NULL; /* getreg.term_cmd */
+// OBSOLETE sparclet_cmds.dump_registers = "reg\r"; /* dump_registers */
+// OBSOLETE sparclet_cmds.register_pattern = "\\(\\w+\\)=\\([0-9a-fA-F]+\\)"; /* register_pattern */
+// OBSOLETE sparclet_cmds.supply_register = sparclet_supply_register; /* supply_register */
+// OBSOLETE sparclet_cmds.load_routine = sparclet_load; /* load_routine */
+// OBSOLETE sparclet_cmds.load = NULL; /* download command (srecs on console) */
+// OBSOLETE sparclet_cmds.loadresp = NULL; /* load response */
+// OBSOLETE sparclet_cmds.prompt = "monitor>"; /* monitor command prompt */
+// OBSOLETE /* yikes! gdb core dumps without this delimitor!! */
+// OBSOLETE sparclet_cmds.line_term = "\r"; /* end-of-command delimitor */
+// OBSOLETE sparclet_cmds.cmd_end = NULL; /* optional command terminator */
+// OBSOLETE sparclet_cmds.target = &sparclet_ops; /* target operations */
+// OBSOLETE sparclet_cmds.stopbits = SERIAL_1_STOPBITS; /* number of stop bits */
+// OBSOLETE sparclet_cmds.regnames = sparclet_regnames; /* registers names */
+// OBSOLETE sparclet_cmds.magic = MONITOR_OPS_MAGIC; /* magic */
+// OBSOLETE };
+// OBSOLETE
+// OBSOLETE static void
+// OBSOLETE sparclet_open (char *args, int from_tty)
+// OBSOLETE {
+// OBSOLETE monitor_open (args, &sparclet_cmds, from_tty);
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE void
+// OBSOLETE _initialize_sparclet (void)
+// OBSOLETE {
+// OBSOLETE int i;
+// OBSOLETE init_sparclet_cmds ();
+// OBSOLETE
+// OBSOLETE for (i = 0; i < NUM_REGS; i++)
+// OBSOLETE if (sparclet_regnames[i][0] == 'c' ||
+// OBSOLETE sparclet_regnames[i][0] == 'a')
+// OBSOLETE sparclet_regnames[i] = 0; /* mon can't report c* or a* regs */
+// OBSOLETE
+// OBSOLETE sparclet_regnames[0] = 0; /* mon won't report %G0 */
+// OBSOLETE
+// OBSOLETE init_monitor_ops (&sparclet_ops);
+// OBSOLETE sparclet_ops.to_shortname = "sparclet"; /* for the target command */
+// OBSOLETE sparclet_ops.to_longname = "SPARC Sparclet monitor";
+// OBSOLETE /* use SW breaks; target only supports 2 HW breakpoints */
+// OBSOLETE sparclet_ops.to_insert_breakpoint = memory_insert_breakpoint;
+// OBSOLETE sparclet_ops.to_remove_breakpoint = memory_remove_breakpoint;
+// OBSOLETE
+// OBSOLETE sparclet_ops.to_doc =
+// OBSOLETE "Use a board running the Sparclet debug monitor.\n\
+// OBSOLETE Specify the serial device it is connected to (e.g. /dev/ttya).";
+// OBSOLETE
+// OBSOLETE sparclet_ops.to_open = sparclet_open;
+// OBSOLETE add_target (&sparclet_ops);
+// OBSOLETE }
diff --git a/gdb/sparclet-stub.c b/gdb/sparclet-stub.c
index f593df7..88740f2 100644
--- a/gdb/sparclet-stub.c
+++ b/gdb/sparclet-stub.c
@@ -1,1167 +1,1167 @@
-/****************************************************************************
-
- THIS SOFTWARE IS NOT COPYRIGHTED
-
- HP offers the following for use in the public domain. HP makes no
- warranty with regard to the software or it's performance and the
- user accepts the software "AS IS" with all faults.
-
- HP DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED, WITH REGARD
- TO THIS SOFTWARE INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-
-****************************************************************************/
-
-/****************************************************************************
- * Header: remcom.c,v 1.34 91/03/09 12:29:49 glenne Exp $
- *
- * Module name: remcom.c $
- * Revision: 1.34 $
- * Date: 91/03/09 12:29:49 $
- * Contributor: Lake Stevens Instrument Division$
- *
- * Description: low level support for gdb debugger. $
- *
- * Considerations: only works on target hardware $
- *
- * Written by: Glenn Engel $
- * ModuleState: Experimental $
- *
- * NOTES: See Below $
- *
- * Modified for SPARC by Stu Grossman, Cygnus Support.
- * Based on sparc-stub.c, it's modified for SPARClite Debug Unit hardware
- * breakpoint support to create sparclite-stub.c, by Kung Hsu, Cygnus Support.
- *
- * This code has been extensively tested on the Fujitsu SPARClite demo board.
- *
- * To enable debugger support, two things need to happen. One, a
- * call to set_debug_traps() is necessary in order to allow any breakpoints
- * or error conditions to be properly intercepted and reported to gdb.
- * Two, a breakpoint needs to be generated to begin communication. This
- * is most easily accomplished by a call to breakpoint(). Breakpoint()
- * simulates a breakpoint by executing a trap #1.
- *
- *************
- *
- * The following gdb commands are supported:
- *
- * command function Return value
- *
- * g return the value of the CPU registers hex data or ENN
- * G set the value of the CPU registers OK or ENN
- * P set the value of a single CPU register OK or ENN
- *
- * mAA..AA,LLLL Read LLLL bytes at address AA..AA hex data or ENN
- * MAA..AA,LLLL: Write LLLL bytes at address AA.AA OK or ENN
- *
- * c Resume at current address SNN ( signal NN)
- * cAA..AA Continue at address AA..AA SNN
- *
- * s Step one instruction SNN
- * sAA..AA Step one instruction from AA..AA SNN
- *
- * k kill
- *
- * ? What was the last sigval ? SNN (signal NN)
- *
- * All commands and responses are sent with a packet which includes a
- * checksum. A packet consists of
- *
- * $<packet info>#<checksum>.
- *
- * where
- * <packet info> :: <characters representing the command or response>
- * <checksum> :: <two hex digits computed as modulo 256 sum of <packetinfo>>
- *
- * When a packet is received, it is first acknowledged with either '+' or '-'.
- * '+' indicates a successful transfer. '-' indicates a failed transfer.
- *
- * Example:
- *
- * Host: Reply:
- * $m0,10#2a +$00010203040506070809101112131415#42
- *
- ****************************************************************************/
-
-#include <string.h>
-#include <signal.h>
-
-/************************************************************************
- *
- * external low-level support routines
- */
-
-extern void putDebugChar(); /* write a single character */
-extern int getDebugChar(); /* read and return a single char */
-
-/************************************************************************/
-/* BUFMAX defines the maximum number of characters in inbound/outbound buffers*/
-/* at least NUMREGBYTES*2 are needed for register packets */
-#define BUFMAX 2048
-
-static int initialized = 0; /* !0 means we've been initialized */
-static int remote_debug = 0; /* turn on verbose debugging */
-
-extern void breakinst();
-void _cprint();
-static void hw_breakpoint();
-static void set_mem_fault_trap();
-static void get_in_break_mode();
-static unsigned char *mem2hex();
-
-static const char hexchars[]="0123456789abcdef";
-
-#define NUMREGS 121
-
-static unsigned long saved_stack_pointer;
-
-/* Number of bytes of registers. */
-#define NUMREGBYTES (NUMREGS * 4)
-enum regnames { G0, G1, G2, G3, G4, G5, G6, G7,
- O0, O1, O2, O3, O4, O5, SP, O7,
- L0, L1, L2, L3, L4, L5, L6, L7,
- I0, I1, I2, I3, I4, I5, FP, I7,
-
- F0, F1, F2, F3, F4, F5, F6, F7,
- F8, F9, F10, F11, F12, F13, F14, F15,
- F16, F17, F18, F19, F20, F21, F22, F23,
- F24, F25, F26, F27, F28, F29, F30, F31,
-
- Y, PSR, WIM, TBR, PC, NPC, FPSR, CPSR,
- CCSR, CCPR, CCCRCR, CCOR, CCOBR, CCIBR, CCIR, UNUSED1,
-
- ASR1, ASR15, ASR17, ASR18, ASR19, ASR20, ASR21, ASR22,
- /* the following not actually implemented */
- AWR0, AWR1, AWR2, AWR3, AWR4, AWR5, AWR6, AWR7,
- AWR8, AWR9, AWR10, AWR11, AWR12, AWR13, AWR14, AWR15,
- AWR16, AWR17, AWR18, AWR19, AWR20, AWR21, AWR22, AWR23,
- AWR24, AWR25, AWR26, AWR27, AWR28, AWR29, AWR30, AWR31,
- APSR
-};
-
-/*************************** ASSEMBLY CODE MACROS *************************/
-/* */
-
-extern void trap_low();
-
-asm("
- .reserve trapstack, 1000 * 4, \"bss\", 8
-
- .data
- .align 4
-
-in_trap_handler:
- .word 0
-
- .text
- .align 4
-
-! This function is called when any SPARC trap (except window overflow or
-! underflow) occurs. It makes sure that the invalid register window is still
-! available before jumping into C code. It will also restore the world if you
-! return from handle_exception.
-!
-! On entry, trap_low expects l1 and l2 to contain pc and npc respectivly.
-
- .globl _trap_low
-_trap_low:
- mov %psr, %l0
- mov %wim, %l3
-
- srl %l3, %l0, %l4 ! wim >> cwp
- and %l4, 0xff, %l4 ! Mask off windows 28, 29
- cmp %l4, 1
- bne window_fine ! Branch if not in the invalid window
- nop
-
-! Handle window overflow
-
- mov %g1, %l4 ! Save g1, we use it to hold the wim
- srl %l3, 1, %g1 ! Rotate wim right
- and %g1, 0xff, %g1 ! Mask off windows 28, 29
- tst %g1
- bg good_wim ! Branch if new wim is non-zero
- nop
-
-! At this point, we need to bring a 1 into the high order bit of the wim.
-! Since we don't want to make any assumptions about the number of register
-! windows, we figure it out dynamically so as to setup the wim correctly.
-
- ! The normal way doesn't work on the sparclet as register windows
- ! 28 and 29 are special purpose windows.
- !not %g1 ! Fill g1 with ones
- !mov %g1, %wim ! Fill the wim with ones
- !nop
- !nop
- !nop
- !mov %wim, %g1 ! Read back the wim
- !inc %g1 ! Now g1 has 1 just to left of wim
- !srl %g1, 1, %g1 ! Now put 1 at top of wim
-
- mov 0x80, %g1 ! Hack for sparclet
-
- ! This doesn't work on the sparclet.
- !mov %g0, %wim ! Clear wim so that subsequent save
- ! won't trap
- andn %l3, 0xff, %l5 ! Clear wim but not windows 28, 29
- mov %l5, %wim
- nop
- nop
- nop
-
-good_wim:
- save %g0, %g0, %g0 ! Slip into next window
- mov %g1, %wim ! Install the new wim
-
- std %l0, [%sp + 0 * 4] ! save L & I registers
- std %l2, [%sp + 2 * 4]
- std %l4, [%sp + 4 * 4]
- std %l6, [%sp + 6 * 4]
-
- std %i0, [%sp + 8 * 4]
- std %i2, [%sp + 10 * 4]
- std %i4, [%sp + 12 * 4]
- std %i6, [%sp + 14 * 4]
-
- restore ! Go back to trap window.
- mov %l4, %g1 ! Restore %g1
-
-window_fine:
- sethi %hi(in_trap_handler), %l4
- ld [%lo(in_trap_handler) + %l4], %l5
- tst %l5
- bg recursive_trap
- inc %l5
-
- set trapstack+1000*4, %sp ! Switch to trap stack
-
-recursive_trap:
- st %l5, [%lo(in_trap_handler) + %l4]
- sub %sp,(16+1+6+1+88)*4,%sp ! Make room for input & locals
- ! + hidden arg + arg spill
- ! + doubleword alignment
- ! + registers[121]
-
- std %g0, [%sp + (24 + 0) * 4] ! registers[Gx]
- std %g2, [%sp + (24 + 2) * 4]
- std %g4, [%sp + (24 + 4) * 4]
- std %g6, [%sp + (24 + 6) * 4]
-
- std %i0, [%sp + (24 + 8) * 4] ! registers[Ox]
- std %i2, [%sp + (24 + 10) * 4]
- std %i4, [%sp + (24 + 12) * 4]
- std %i6, [%sp + (24 + 14) * 4]
-
- ! FP regs (sparclet doesn't have fpu)
-
- mov %y, %l4
- mov %tbr, %l5
- st %l4, [%sp + (24 + 64) * 4] ! Y
- st %l0, [%sp + (24 + 65) * 4] ! PSR
- st %l3, [%sp + (24 + 66) * 4] ! WIM
- st %l5, [%sp + (24 + 67) * 4] ! TBR
- st %l1, [%sp + (24 + 68) * 4] ! PC
- st %l2, [%sp + (24 + 69) * 4] ! NPC
- ! CPSR and FPSR not impl
- or %l0, 0xf20, %l4
- mov %l4, %psr ! Turn on traps, disable interrupts
- nop
- nop
- nop
-
-! Save coprocessor state.
-! See SK/demo/hdlc_demo/ldc_swap_context.S.
-
- mov %psr, %l0
- sethi %hi(0x2000), %l5 ! EC bit in PSR
- or %l5, %l0, %l5
- mov %l5, %psr ! enable coprocessor
- nop ! 3 nops after write to %psr (needed?)
- nop
- nop
- crdcxt %ccsr, %l1 ! capture CCSR
- mov 0x6, %l2
- cwrcxt %l2, %ccsr ! set CCP state machine for CCFR
- crdcxt %ccfr, %l2 ! capture CCOR
- cwrcxt %l2, %ccfr ! tickle CCFR
- crdcxt %ccfr, %l3 ! capture CCOBR
- cwrcxt %l3, %ccfr ! tickle CCFR
- crdcxt %ccfr, %l4 ! capture CCIBR
- cwrcxt %l4, %ccfr ! tickle CCFR
- crdcxt %ccfr, %l5 ! capture CCIR
- cwrcxt %l5, %ccfr ! tickle CCFR
- crdcxt %ccpr, %l6 ! capture CCPR
- crdcxt %cccrcr, %l7 ! capture CCCRCR
- st %l1, [%sp + (24 + 72) * 4] ! save CCSR
- st %l2, [%sp + (24 + 75) * 4] ! save CCOR
- st %l3, [%sp + (24 + 76) * 4] ! save CCOBR
- st %l4, [%sp + (24 + 77) * 4] ! save CCIBR
- st %l5, [%sp + (24 + 78) * 4] ! save CCIR
- st %l6, [%sp + (24 + 73) * 4] ! save CCPR
- st %l7, [%sp + (24 + 74) * 4] ! save CCCRCR
- mov %l0, %psr ! restore original PSR
- nop ! 3 nops after write to %psr (needed?)
- nop
- nop
-
-! End of saving coprocessor state.
-! Save asr regs
-
-! Part of this is silly -- we should not display ASR15 or ASR19 at all.
-
- sethi %hi(0x01000000), %l6
- st %l6, [%sp + (24 + 81) * 4] ! ASR15 == NOP
- sethi %hi(0xdeadc0de), %l6
- or %l6, %lo(0xdeadc0de), %l6
- st %l6, [%sp + (24 + 84) * 4] ! ASR19 == DEADC0DE
-
- rd %asr1, %l4
- st %l4, [%sp + (24 + 80) * 4]
-! rd %asr15, %l4 ! must not read ASR15
-! st %l4, [%sp + (24 + 81) * 4] ! (illegal instr trap)
- rd %asr17, %l4
- st %l4, [%sp + (24 + 82) * 4]
- rd %asr18, %l4
- st %l4, [%sp + (24 + 83) * 4]
-! rd %asr19, %l4 ! must not read asr19
-! st %l4, [%sp + (24 + 84) * 4] ! (halts the CPU)
- rd %asr20, %l4
- st %l4, [%sp + (24 + 85) * 4]
- rd %asr21, %l4
- st %l4, [%sp + (24 + 86) * 4]
- rd %asr22, %l4
- st %l4, [%sp + (24 + 87) * 4]
-
-! End of saving asr regs
-
- call _handle_exception
- add %sp, 24 * 4, %o0 ! Pass address of registers
-
-! Reload all of the registers that aren't on the stack
-
- ld [%sp + (24 + 1) * 4], %g1 ! registers[Gx]
- ldd [%sp + (24 + 2) * 4], %g2
- ldd [%sp + (24 + 4) * 4], %g4
- ldd [%sp + (24 + 6) * 4], %g6
-
- ldd [%sp + (24 + 8) * 4], %i0 ! registers[Ox]
- ldd [%sp + (24 + 10) * 4], %i2
- ldd [%sp + (24 + 12) * 4], %i4
- ldd [%sp + (24 + 14) * 4], %i6
-
- ! FP regs (sparclet doesn't have fpu)
-
-! Update the coprocessor registers.
-! See SK/demo/hdlc_demo/ldc_swap_context.S.
-
- mov %psr, %l0
- sethi %hi(0x2000), %l5 ! EC bit in PSR
- or %l5, %l0, %l5
- mov %l5, %psr ! enable coprocessor
- nop ! 3 nops after write to %psr (needed?)
- nop
- nop
-
- mov 0x6, %l2
- cwrcxt %l2, %ccsr ! set CCP state machine for CCFR
-
- ld [%sp + (24 + 72) * 4], %l1 ! saved CCSR
- ld [%sp + (24 + 75) * 4], %l2 ! saved CCOR
- ld [%sp + (24 + 76) * 4], %l3 ! saved CCOBR
- ld [%sp + (24 + 77) * 4], %l4 ! saved CCIBR
- ld [%sp + (24 + 78) * 4], %l5 ! saved CCIR
- ld [%sp + (24 + 73) * 4], %l6 ! saved CCPR
- ld [%sp + (24 + 74) * 4], %l7 ! saved CCCRCR
-
- cwrcxt %l2, %ccfr ! restore CCOR
- cwrcxt %l3, %ccfr ! restore CCOBR
- cwrcxt %l4, %ccfr ! restore CCIBR
- cwrcxt %l5, %ccfr ! restore CCIR
- cwrcxt %l6, %ccpr ! restore CCPR
- cwrcxt %l7, %cccrcr ! restore CCCRCR
- cwrcxt %l1, %ccsr ! restore CCSR
-
- mov %l0, %psr ! restore PSR
- nop ! 3 nops after write to %psr (needed?)
- nop
- nop
-
-! End of coprocessor handling stuff.
-! Update asr regs
-
- ld [%sp + (24 + 80) * 4], %l4
- wr %l4, %asr1
-! ld [%sp + (24 + 81) * 4], %l4 ! can't write asr15
-! wr %l4, %asr15
- ld [%sp + (24 + 82) * 4], %l4
- wr %l4, %asr17
- ld [%sp + (24 + 83) * 4], %l4
- wr %l4, %asr18
-! ld [%sp + (24 + 84) * 4], %l4 ! can't write asr19
-! wr %l4, %asr19
-! ld [%sp + (24 + 85) * 4], %l4 ! can't write asr20
-! wr %l4, %asr20
-! ld [%sp + (24 + 86) * 4], %l4 ! can't write asr21
-! wr %l4, %asr21
- ld [%sp + (24 + 87) * 4], %l4
- wr %l4, %asr22
-
-! End of restoring asr regs
-
-
- ldd [%sp + (24 + 64) * 4], %l0 ! Y & PSR
- ldd [%sp + (24 + 68) * 4], %l2 ! PC & NPC
-
- restore ! Ensure that previous window is valid
- save %g0, %g0, %g0 ! by causing a window_underflow trap
-
- mov %l0, %y
- mov %l1, %psr ! Make sure that traps are disabled
- ! for rett
- nop ! 3 nops after write to %psr (needed?)
- nop
- nop
-
- sethi %hi(in_trap_handler), %l4
- ld [%lo(in_trap_handler) + %l4], %l5
- dec %l5
- st %l5, [%lo(in_trap_handler) + %l4]
-
- jmpl %l2, %g0 ! Restore old PC
- rett %l3 ! Restore old nPC
-");
-
-/* Convert ch from a hex digit to an int */
-
-static int
-hex (unsigned char ch)
-{
- if (ch >= 'a' && ch <= 'f')
- return ch-'a'+10;
- if (ch >= '0' && ch <= '9')
- return ch-'0';
- if (ch >= 'A' && ch <= 'F')
- return ch-'A'+10;
- return -1;
-}
-
-static char remcomInBuffer[BUFMAX];
-static char remcomOutBuffer[BUFMAX];
-
-/* scan for the sequence $<data>#<checksum> */
-
-unsigned char *
-getpacket (void)
-{
- unsigned char *buffer = &remcomInBuffer[0];
- unsigned char checksum;
- unsigned char xmitcsum;
- int count;
- char ch;
-
- while (1)
- {
- /* wait around for the start character, ignore all other characters */
- while ((ch = getDebugChar ()) != '$')
- ;
-
-retry:
- checksum = 0;
- xmitcsum = -1;
- count = 0;
-
- /* now, read until a # or end of buffer is found */
- while (count < BUFMAX)
- {
- ch = getDebugChar ();
- if (ch == '$')
- goto retry;
- if (ch == '#')
- break;
- checksum = checksum + ch;
- buffer[count] = ch;
- count = count + 1;
- }
- buffer[count] = 0;
-
- if (ch == '#')
- {
- ch = getDebugChar ();
- xmitcsum = hex (ch) << 4;
- ch = getDebugChar ();
- xmitcsum += hex (ch);
-
- if (checksum != xmitcsum)
- {
- putDebugChar ('-'); /* failed checksum */
- }
- else
- {
- putDebugChar ('+'); /* successful transfer */
-
- /* if a sequence char is present, reply the sequence ID */
- if (buffer[2] == ':')
- {
- putDebugChar (buffer[0]);
- putDebugChar (buffer[1]);
-
- return &buffer[3];
- }
-
- return &buffer[0];
- }
- }
- }
-}
-
-/* send the packet in buffer. */
-
-static void
-putpacket (unsigned char *buffer)
-{
- unsigned char checksum;
- int count;
- unsigned char ch;
-
- /* $<packet info>#<checksum>. */
- do
- {
- putDebugChar('$');
- checksum = 0;
- count = 0;
-
- while (ch = buffer[count])
- {
- putDebugChar(ch);
- checksum += ch;
- count += 1;
- }
-
- putDebugChar('#');
- putDebugChar(hexchars[checksum >> 4]);
- putDebugChar(hexchars[checksum & 0xf]);
-
- }
- while (getDebugChar() != '+');
-}
-
-/* Indicate to caller of mem2hex or hex2mem that there has been an
- error. */
-static volatile int mem_err = 0;
-
-/* Convert the memory pointed to by mem into hex, placing result in buf.
- * Return a pointer to the last char put in buf (null), in case of mem fault,
- * return 0.
- * If MAY_FAULT is non-zero, then we will handle memory faults by returning
- * a 0, else treat a fault like any other fault in the stub.
- */
-
-static unsigned char *
-mem2hex (unsigned char *mem, unsigned char *buf, int count, int may_fault)
-{
- unsigned char ch;
-
- set_mem_fault_trap(may_fault);
-
- while (count-- > 0)
- {
- ch = *mem++;
- if (mem_err)
- return 0;
- *buf++ = hexchars[ch >> 4];
- *buf++ = hexchars[ch & 0xf];
- }
-
- *buf = 0;
-
- set_mem_fault_trap(0);
-
- return buf;
-}
-
-/* convert the hex array pointed to by buf into binary to be placed in mem
- * return a pointer to the character AFTER the last byte written */
-
-static char *
-hex2mem (unsigned char *buf, unsigned char *mem, int count, int may_fault)
-{
- int i;
- unsigned char ch;
-
- set_mem_fault_trap(may_fault);
-
- for (i=0; i<count; i++)
- {
- ch = hex(*buf++) << 4;
- ch |= hex(*buf++);
- *mem++ = ch;
- if (mem_err)
- return 0;
- }
-
- set_mem_fault_trap(0);
-
- return mem;
-}
-
-/* This table contains the mapping between SPARC hardware trap types, and
- signals, which are primarily what GDB understands. It also indicates
- which hardware traps we need to commandeer when initializing the stub. */
-
-static struct hard_trap_info
-{
- unsigned char tt; /* Trap type code for SPARClite */
- unsigned char signo; /* Signal that we map this trap into */
-} hard_trap_info[] = {
- {1, SIGSEGV}, /* instruction access exception */
- {0x3b, SIGSEGV}, /* instruction access error */
- {2, SIGILL}, /* illegal instruction */
- {3, SIGILL}, /* privileged instruction */
- {4, SIGEMT}, /* fp disabled */
- {0x24, SIGEMT}, /* cp disabled */
- {7, SIGBUS}, /* mem address not aligned */
- {0x29, SIGSEGV}, /* data access exception */
- {10, SIGEMT}, /* tag overflow */
- {128+1, SIGTRAP}, /* ta 1 - normal breakpoint instruction */
- {0, 0} /* Must be last */
-};
-
-/* Set up exception handlers for tracing and breakpoints */
-
-void
-set_debug_traps (void)
-{
- struct hard_trap_info *ht;
-
- for (ht = hard_trap_info; ht->tt && ht->signo; ht++)
- exceptionHandler(ht->tt, trap_low);
-
- initialized = 1;
-}
-
-asm ("
-! Trap handler for memory errors. This just sets mem_err to be non-zero. It
-! assumes that %l1 is non-zero. This should be safe, as it is doubtful that
-! 0 would ever contain code that could mem fault. This routine will skip
-! past the faulting instruction after setting mem_err.
-
- .text
- .align 4
-
-_fltr_set_mem_err:
- sethi %hi(_mem_err), %l0
- st %l1, [%l0 + %lo(_mem_err)]
- jmpl %l2, %g0
- rett %l2+4
-");
-
-static void
-set_mem_fault_trap (int enable)
-{
- extern void fltr_set_mem_err();
- mem_err = 0;
-
- if (enable)
- exceptionHandler(0x29, fltr_set_mem_err);
- else
- exceptionHandler(0x29, trap_low);
-}
-
-asm ("
- .text
- .align 4
-
-_dummy_hw_breakpoint:
- jmpl %l2, %g0
- rett %l2+4
- nop
- nop
-");
-
-static void
-set_hw_breakpoint_trap (int enable)
-{
- extern void dummy_hw_breakpoint();
-
- if (enable)
- exceptionHandler(255, dummy_hw_breakpoint);
- else
- exceptionHandler(255, trap_low);
-}
-
-static void
-get_in_break_mode (void)
-{
-#if 0
- int x;
- mesg("get_in_break_mode, sp = ");
- phex(&x);
-#endif
- set_hw_breakpoint_trap(1);
-
- asm("
- sethi %hi(0xff10), %l4
- or %l4, %lo(0xff10), %l4
- sta %g0, [%l4]0x1
- nop
- nop
- nop
- ");
-
- set_hw_breakpoint_trap(0);
-}
-
-/* Convert the SPARC hardware trap type code to a unix signal number. */
-
-static int
-computeSignal (int tt)
-{
- struct hard_trap_info *ht;
-
- for (ht = hard_trap_info; ht->tt && ht->signo; ht++)
- if (ht->tt == tt)
- return ht->signo;
-
- return SIGHUP; /* default for things we don't know about */
-}
-
-/*
- * While we find nice hex chars, build an int.
- * Return number of chars processed.
- */
-
-static int
-hexToInt(char **ptr, int *intValue)
-{
- int numChars = 0;
- int hexValue;
-
- *intValue = 0;
-
- while (**ptr)
- {
- hexValue = hex(**ptr);
- if (hexValue < 0)
- break;
-
- *intValue = (*intValue << 4) | hexValue;
- numChars ++;
-
- (*ptr)++;
- }
-
- return (numChars);
-}
-
-/*
- * This function does all command procesing for interfacing to gdb. It
- * returns 1 if you should skip the instruction at the trap address, 0
- * otherwise.
- */
-
-static void
-handle_exception (unsigned long *registers)
-{
- int tt; /* Trap type */
- int sigval;
- int addr;
- int length;
- char *ptr;
- unsigned long *sp;
- unsigned long dsr;
-
-/* First, we must force all of the windows to be spilled out */
-
- asm("
- ! Ugh. sparclet has broken save
- !save %sp, -64, %sp
- save
- add %fp,-64,%sp
- !save %sp, -64, %sp
- save
- add %fp,-64,%sp
- !save %sp, -64, %sp
- save
- add %fp,-64,%sp
- !save %sp, -64, %sp
- save
- add %fp,-64,%sp
- !save %sp, -64, %sp
- save
- add %fp,-64,%sp
- !save %sp, -64, %sp
- save
- add %fp,-64,%sp
- !save %sp, -64, %sp
- save
- add %fp,-64,%sp
- !save %sp, -64, %sp
- save
- add %fp,-64,%sp
- restore
- restore
- restore
- restore
- restore
- restore
- restore
- restore
-");
-
- if (registers[PC] == (unsigned long)breakinst)
- {
- registers[PC] = registers[NPC];
- registers[NPC] += 4;
- }
- sp = (unsigned long *)registers[SP];
-
- tt = (registers[TBR] >> 4) & 0xff;
-
- /* reply to host that an exception has occurred */
- sigval = computeSignal(tt);
- ptr = remcomOutBuffer;
-
- *ptr++ = 'T';
- *ptr++ = hexchars[sigval >> 4];
- *ptr++ = hexchars[sigval & 0xf];
-
- *ptr++ = hexchars[PC >> 4];
- *ptr++ = hexchars[PC & 0xf];
- *ptr++ = ':';
- ptr = mem2hex((char *)&registers[PC], ptr, 4, 0);
- *ptr++ = ';';
-
- *ptr++ = hexchars[FP >> 4];
- *ptr++ = hexchars[FP & 0xf];
- *ptr++ = ':';
- ptr = mem2hex(sp + 8 + 6, ptr, 4, 0); /* FP */
- *ptr++ = ';';
-
- *ptr++ = hexchars[SP >> 4];
- *ptr++ = hexchars[SP & 0xf];
- *ptr++ = ':';
- ptr = mem2hex((char *)&sp, ptr, 4, 0);
- *ptr++ = ';';
-
- *ptr++ = hexchars[NPC >> 4];
- *ptr++ = hexchars[NPC & 0xf];
- *ptr++ = ':';
- ptr = mem2hex((char *)&registers[NPC], ptr, 4, 0);
- *ptr++ = ';';
-
- *ptr++ = hexchars[O7 >> 4];
- *ptr++ = hexchars[O7 & 0xf];
- *ptr++ = ':';
- ptr = mem2hex((char *)&registers[O7], ptr, 4, 0);
- *ptr++ = ';';
-
- *ptr++ = 0;
-
- putpacket(remcomOutBuffer);
-
- while (1)
- {
- remcomOutBuffer[0] = 0;
-
- ptr = getpacket();
- switch (*ptr++)
- {
- case '?':
- remcomOutBuffer[0] = 'S';
- remcomOutBuffer[1] = hexchars[sigval >> 4];
- remcomOutBuffer[2] = hexchars[sigval & 0xf];
- remcomOutBuffer[3] = 0;
- break;
-
- case 'd':
- remote_debug = !(remote_debug); /* toggle debug flag */
- break;
-
- case 'g': /* return the value of the CPU registers */
- {
- ptr = remcomOutBuffer;
- ptr = mem2hex((char *)registers, ptr, 16 * 4, 0); /* G & O regs */
- ptr = mem2hex(sp + 0, ptr, 16 * 4, 0); /* L & I regs */
- memset(ptr, '0', 32 * 8); /* Floating point */
- ptr = mem2hex((char *)&registers[Y],
- ptr + 32 * 4 * 2,
- 8 * 4,
- 0); /* Y, PSR, WIM, TBR, PC, NPC, FPSR, CPSR */
- ptr = mem2hex((char *)&registers[CCSR],
- ptr,
- 8 * 4,
- 0); /* CCSR, CCPR, CCCRCR, CCOR, CCOBR, CCIBR, CCIR */
- ptr = mem2hex((char *)&registers[ASR1],
- ptr,
- 8 * 4,
- 0); /* ASR1,ASR15,ASR17,ASR18,ASR19,ASR20,ASR21,ASR22 */
-#if 0 /* not implemented */
- ptr = mem2hex((char *) &registers[AWR0],
- ptr,
- 32 * 4,
- 0); /* Alternate Window Registers */
-#endif
- }
- break;
-
- case 'G': /* set value of all the CPU registers - return OK */
- case 'P': /* set value of one CPU register - return OK */
- {
- unsigned long *newsp, psr;
-
- psr = registers[PSR];
-
- if (ptr[-1] == 'P') /* do a single register */
- {
- int regno;
-
- if (hexToInt (&ptr, &regno)
- && *ptr++ == '=')
- if (regno >= L0 && regno <= I7)
- hex2mem (ptr, sp + regno - L0, 4, 0);
- else
- hex2mem (ptr, (char *)&registers[regno], 4, 0);
- else
- {
- strcpy (remcomOutBuffer, "E01");
- break;
- }
- }
- else
- {
- hex2mem(ptr, (char *)registers, 16 * 4, 0); /* G & O regs */
- hex2mem(ptr + 16 * 4 * 2, sp + 0, 16 * 4, 0); /* L & I regs */
- hex2mem(ptr + 64 * 4 * 2, (char *)&registers[Y],
- 8 * 4, 0); /* Y,PSR,WIM,TBR,PC,NPC,FPSR,CPSR */
- hex2mem(ptr + 72 * 4 * 2, (char *)&registers[CCSR],
- 8 * 4, 0); /* CCSR,CCPR,CCCRCR,CCOR,CCOBR,CCIBR,CCIR */
- hex2mem(ptr + 80 * 4 * 2, (char *)&registers[ASR1],
- 8 * 4, 0); /* ASR1 ... ASR22 */
-#if 0 /* not implemented */
- hex2mem(ptr + 88 * 4 * 2, (char *)&registers[AWR0],
- 8 * 4, 0); /* Alternate Window Registers */
-#endif
- }
- /* See if the stack pointer has moved. If so, then copy the saved
- locals and ins to the new location. This keeps the window
- overflow and underflow routines happy. */
-
- newsp = (unsigned long *)registers[SP];
- if (sp != newsp)
- sp = memcpy(newsp, sp, 16 * 4);
-
- /* Don't allow CWP to be modified. */
-
- if (psr != registers[PSR])
- registers[PSR] = (psr & 0x1f) | (registers[PSR] & ~0x1f);
-
- strcpy(remcomOutBuffer,"OK");
- }
- break;
-
- case 'm': /* mAA..AA,LLLL Read LLLL bytes at address AA..AA */
- /* Try to read %x,%x. */
-
- if (hexToInt(&ptr, &addr)
- && *ptr++ == ','
- && hexToInt(&ptr, &length))
- {
- if (mem2hex((char *)addr, remcomOutBuffer, length, 1))
- break;
-
- strcpy (remcomOutBuffer, "E03");
- }
- else
- strcpy(remcomOutBuffer,"E01");
- break;
-
- case 'M': /* MAA..AA,LLLL: Write LLLL bytes at address AA.AA return OK */
- /* Try to read '%x,%x:'. */
-
- if (hexToInt(&ptr, &addr)
- && *ptr++ == ','
- && hexToInt(&ptr, &length)
- && *ptr++ == ':')
- {
- if (hex2mem(ptr, (char *)addr, length, 1))
- strcpy(remcomOutBuffer, "OK");
- else
- strcpy(remcomOutBuffer, "E03");
- }
- else
- strcpy(remcomOutBuffer, "E02");
- break;
-
- case 'c': /* cAA..AA Continue at address AA..AA(optional) */
- /* try to read optional parameter, pc unchanged if no parm */
-
- if (hexToInt(&ptr, &addr))
- {
- registers[PC] = addr;
- registers[NPC] = addr + 4;
- }
-
-/* Need to flush the instruction cache here, as we may have deposited a
- breakpoint, and the icache probably has no way of knowing that a data ref to
- some location may have changed something that is in the instruction cache.
- */
-
- flush_i_cache();
- return;
-
- /* kill the program */
- case 'k' : /* do nothing */
- break;
-#if 0
- case 't': /* Test feature */
- asm (" std %f30,[%sp]");
- break;
-#endif
- case 'r': /* Reset */
- asm ("call 0
- nop ");
- break;
- } /* switch */
-
- /* reply to the request */
- putpacket(remcomOutBuffer);
- }
-}
-
-/* This function will generate a breakpoint exception. It is used at the
- beginning of a program to sync up with a debugger and can be used
- otherwise as a quick means to stop program execution and "break" into
- the debugger. */
-
-void
-breakpoint (void)
-{
- if (!initialized)
- return;
-
- asm(" .globl _breakinst
-
- _breakinst: ta 1
- ");
-}
-
-static void
-hw_breakpoint (void)
-{
- asm("
- ta 127
- ");
-}
-
-#if 0 /* experimental and never finished, left here for reference */
-static void
-splet_temp(void)
-{
- asm(" sub %sp,(16+1+6+1+121)*4,%sp ! Make room for input & locals
- ! + hidden arg + arg spill
- ! + doubleword alignment
- ! + registers[121]
-
-! Leave a trail of breadcrumbs! (save register save area for debugging)
- mov %sp, %l0
- add %l0, 24*4, %l0
- sethi %hi(_debug_registers), %l1
- st %l0, [%lo(_debug_registers) + %l1]
-
-! Save the Alternate Register Set: (not implemented yet)
-! To save the Alternate Register set, we must:
-! 1) Save the current SP in some global location.
-! 2) Swap the register sets.
-! 3) Save the Alternate SP in the Y register
-! 4) Fetch the SP that we saved in step 1.
-! 5) Use that to save the rest of the regs (not forgetting ASP in Y)
-! 6) Restore the Alternate SP from Y
-! 7) Swap the registers back.
-
-! 1) Copy the current stack pointer to global _SAVED_STACK_POINTER:
- sethi %hi(_saved_stack_pointer), %l0
- st %sp, [%lo(_saved_stack_pointer) + %l0]
-
-! 2) Swap the register sets:
- mov %psr, %l1
- sethi %hi(0x10000), %l2
- xor %l1, %l2, %l1
- mov %l1, %psr
- nop ! 3 nops after write to %psr (needed?)
- nop
- nop
-
-! 3) Save Alternate L0 in Y
- wr %l0, 0, %y
-
-! 4) Load former SP into alternate SP, using L0
- sethi %hi(_saved_stack_pointer), %l0
- or %lo(_saved_stack_pointer), %l0, %l0
- swap [%l0], %sp
-
-! 4.5) Restore alternate L0
- rd %y, %l0
-
-! 5) Save the Alternate Window Registers
- st %r0, [%sp + (24 + 88) * 4] ! AWR0
- st %r1, [%sp + (24 + 89) * 4] ! AWR1
- st %r2, [%sp + (24 + 90) * 4] ! AWR2
- st %r3, [%sp + (24 + 91) * 4] ! AWR3
- st %r4, [%sp + (24 + 92) * 4] ! AWR4
- st %r5, [%sp + (24 + 93) * 4] ! AWR5
- st %r6, [%sp + (24 + 94) * 4] ! AWR6
- st %r7, [%sp + (24 + 95) * 4] ! AWR7
- st %r8, [%sp + (24 + 96) * 4] ! AWR8
- st %r9, [%sp + (24 + 97) * 4] ! AWR9
- st %r10, [%sp + (24 + 98) * 4] ! AWR10
- st %r11, [%sp + (24 + 99) * 4] ! AWR11
- st %r12, [%sp + (24 + 100) * 4] ! AWR12
- st %r13, [%sp + (24 + 101) * 4] ! AWR13
-! st %r14, [%sp + (24 + 102) * 4] ! AWR14 (SP)
- st %r15, [%sp + (24 + 103) * 4] ! AWR15
- st %r16, [%sp + (24 + 104) * 4] ! AWR16
- st %r17, [%sp + (24 + 105) * 4] ! AWR17
- st %r18, [%sp + (24 + 106) * 4] ! AWR18
- st %r19, [%sp + (24 + 107) * 4] ! AWR19
- st %r20, [%sp + (24 + 108) * 4] ! AWR20
- st %r21, [%sp + (24 + 109) * 4] ! AWR21
- st %r22, [%sp + (24 + 110) * 4] ! AWR22
- st %r23, [%sp + (24 + 111) * 4] ! AWR23
- st %r24, [%sp + (24 + 112) * 4] ! AWR24
- st %r25, [%sp + (24 + 113) * 4] ! AWR25
- st %r26, [%sp + (24 + 114) * 4] ! AWR26
- st %r27, [%sp + (24 + 115) * 4] ! AWR27
- st %r28, [%sp + (24 + 116) * 4] ! AWR28
- st %r29, [%sp + (24 + 117) * 4] ! AWR29
- st %r30, [%sp + (24 + 118) * 4] ! AWR30
- st %r31, [%sp + (24 + 119) * 4] ! AWR21
-
-! Get the Alternate PSR (I hope...)
-
- rd %psr, %l2
- st %l2, [%sp + (24 + 120) * 4] ! APSR
-
-! Don't forget the alternate stack pointer
-
- rd %y, %l3
- st %l3, [%sp + (24 + 102) * 4] ! AWR14 (SP)
-
-! 6) Restore the Alternate SP (saved in Y)
-
- rd %y, %o6
-
-
-! 7) Swap the registers back:
-
- mov %psr, %l1
- sethi %hi(0x10000), %l2
- xor %l1, %l2, %l1
- mov %l1, %psr
- nop ! 3 nops after write to %psr (needed?)
- nop
- nop
-");
-}
-
-#endif
+// OBSOLETE /****************************************************************************
+// OBSOLETE
+// OBSOLETE THIS SOFTWARE IS NOT COPYRIGHTED
+// OBSOLETE
+// OBSOLETE HP offers the following for use in the public domain. HP makes no
+// OBSOLETE warranty with regard to the software or it's performance and the
+// OBSOLETE user accepts the software "AS IS" with all faults.
+// OBSOLETE
+// OBSOLETE HP DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED, WITH REGARD
+// OBSOLETE TO THIS SOFTWARE INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+// OBSOLETE OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+// OBSOLETE
+// OBSOLETE ****************************************************************************/
+// OBSOLETE
+// OBSOLETE /****************************************************************************
+// OBSOLETE * Header: remcom.c,v 1.34 91/03/09 12:29:49 glenne Exp $
+// OBSOLETE *
+// OBSOLETE * Module name: remcom.c $
+// OBSOLETE * Revision: 1.34 $
+// OBSOLETE * Date: 91/03/09 12:29:49 $
+// OBSOLETE * Contributor: Lake Stevens Instrument Division$
+// OBSOLETE *
+// OBSOLETE * Description: low level support for gdb debugger. $
+// OBSOLETE *
+// OBSOLETE * Considerations: only works on target hardware $
+// OBSOLETE *
+// OBSOLETE * Written by: Glenn Engel $
+// OBSOLETE * ModuleState: Experimental $
+// OBSOLETE *
+// OBSOLETE * NOTES: See Below $
+// OBSOLETE *
+// OBSOLETE * Modified for SPARC by Stu Grossman, Cygnus Support.
+// OBSOLETE * Based on sparc-stub.c, it's modified for SPARClite Debug Unit hardware
+// OBSOLETE * breakpoint support to create sparclite-stub.c, by Kung Hsu, Cygnus Support.
+// OBSOLETE *
+// OBSOLETE * This code has been extensively tested on the Fujitsu SPARClite demo board.
+// OBSOLETE *
+// OBSOLETE * To enable debugger support, two things need to happen. One, a
+// OBSOLETE * call to set_debug_traps() is necessary in order to allow any breakpoints
+// OBSOLETE * or error conditions to be properly intercepted and reported to gdb.
+// OBSOLETE * Two, a breakpoint needs to be generated to begin communication. This
+// OBSOLETE * is most easily accomplished by a call to breakpoint(). Breakpoint()
+// OBSOLETE * simulates a breakpoint by executing a trap #1.
+// OBSOLETE *
+// OBSOLETE *************
+// OBSOLETE *
+// OBSOLETE * The following gdb commands are supported:
+// OBSOLETE *
+// OBSOLETE * command function Return value
+// OBSOLETE *
+// OBSOLETE * g return the value of the CPU registers hex data or ENN
+// OBSOLETE * G set the value of the CPU registers OK or ENN
+// OBSOLETE * P set the value of a single CPU register OK or ENN
+// OBSOLETE *
+// OBSOLETE * mAA..AA,LLLL Read LLLL bytes at address AA..AA hex data or ENN
+// OBSOLETE * MAA..AA,LLLL: Write LLLL bytes at address AA.AA OK or ENN
+// OBSOLETE *
+// OBSOLETE * c Resume at current address SNN ( signal NN)
+// OBSOLETE * cAA..AA Continue at address AA..AA SNN
+// OBSOLETE *
+// OBSOLETE * s Step one instruction SNN
+// OBSOLETE * sAA..AA Step one instruction from AA..AA SNN
+// OBSOLETE *
+// OBSOLETE * k kill
+// OBSOLETE *
+// OBSOLETE * ? What was the last sigval ? SNN (signal NN)
+// OBSOLETE *
+// OBSOLETE * All commands and responses are sent with a packet which includes a
+// OBSOLETE * checksum. A packet consists of
+// OBSOLETE *
+// OBSOLETE * $<packet info>#<checksum>.
+// OBSOLETE *
+// OBSOLETE * where
+// OBSOLETE * <packet info> :: <characters representing the command or response>
+// OBSOLETE * <checksum> :: <two hex digits computed as modulo 256 sum of <packetinfo>>
+// OBSOLETE *
+// OBSOLETE * When a packet is received, it is first acknowledged with either '+' or '-'.
+// OBSOLETE * '+' indicates a successful transfer. '-' indicates a failed transfer.
+// OBSOLETE *
+// OBSOLETE * Example:
+// OBSOLETE *
+// OBSOLETE * Host: Reply:
+// OBSOLETE * $m0,10#2a +$00010203040506070809101112131415#42
+// OBSOLETE *
+// OBSOLETE ****************************************************************************/
+// OBSOLETE
+// OBSOLETE #include <string.h>
+// OBSOLETE #include <signal.h>
+// OBSOLETE
+// OBSOLETE /************************************************************************
+// OBSOLETE *
+// OBSOLETE * external low-level support routines
+// OBSOLETE */
+// OBSOLETE
+// OBSOLETE extern void putDebugChar(); /* write a single character */
+// OBSOLETE extern int getDebugChar(); /* read and return a single char */
+// OBSOLETE
+// OBSOLETE /************************************************************************/
+// OBSOLETE /* BUFMAX defines the maximum number of characters in inbound/outbound buffers*/
+// OBSOLETE /* at least NUMREGBYTES*2 are needed for register packets */
+// OBSOLETE #define BUFMAX 2048
+// OBSOLETE
+// OBSOLETE static int initialized = 0; /* !0 means we've been initialized */
+// OBSOLETE static int remote_debug = 0; /* turn on verbose debugging */
+// OBSOLETE
+// OBSOLETE extern void breakinst();
+// OBSOLETE void _cprint();
+// OBSOLETE static void hw_breakpoint();
+// OBSOLETE static void set_mem_fault_trap();
+// OBSOLETE static void get_in_break_mode();
+// OBSOLETE static unsigned char *mem2hex();
+// OBSOLETE
+// OBSOLETE static const char hexchars[]="0123456789abcdef";
+// OBSOLETE
+// OBSOLETE #define NUMREGS 121
+// OBSOLETE
+// OBSOLETE static unsigned long saved_stack_pointer;
+// OBSOLETE
+// OBSOLETE /* Number of bytes of registers. */
+// OBSOLETE #define NUMREGBYTES (NUMREGS * 4)
+// OBSOLETE enum regnames { G0, G1, G2, G3, G4, G5, G6, G7,
+// OBSOLETE O0, O1, O2, O3, O4, O5, SP, O7,
+// OBSOLETE L0, L1, L2, L3, L4, L5, L6, L7,
+// OBSOLETE I0, I1, I2, I3, I4, I5, FP, I7,
+// OBSOLETE
+// OBSOLETE F0, F1, F2, F3, F4, F5, F6, F7,
+// OBSOLETE F8, F9, F10, F11, F12, F13, F14, F15,
+// OBSOLETE F16, F17, F18, F19, F20, F21, F22, F23,
+// OBSOLETE F24, F25, F26, F27, F28, F29, F30, F31,
+// OBSOLETE
+// OBSOLETE Y, PSR, WIM, TBR, PC, NPC, FPSR, CPSR,
+// OBSOLETE CCSR, CCPR, CCCRCR, CCOR, CCOBR, CCIBR, CCIR, UNUSED1,
+// OBSOLETE
+// OBSOLETE ASR1, ASR15, ASR17, ASR18, ASR19, ASR20, ASR21, ASR22,
+// OBSOLETE /* the following not actually implemented */
+// OBSOLETE AWR0, AWR1, AWR2, AWR3, AWR4, AWR5, AWR6, AWR7,
+// OBSOLETE AWR8, AWR9, AWR10, AWR11, AWR12, AWR13, AWR14, AWR15,
+// OBSOLETE AWR16, AWR17, AWR18, AWR19, AWR20, AWR21, AWR22, AWR23,
+// OBSOLETE AWR24, AWR25, AWR26, AWR27, AWR28, AWR29, AWR30, AWR31,
+// OBSOLETE APSR
+// OBSOLETE };
+// OBSOLETE
+// OBSOLETE /*************************** ASSEMBLY CODE MACROS *************************/
+// OBSOLETE /* */
+// OBSOLETE
+// OBSOLETE extern void trap_low();
+// OBSOLETE
+// OBSOLETE asm("
+// OBSOLETE .reserve trapstack, 1000 * 4, \"bss\", 8
+// OBSOLETE
+// OBSOLETE .data
+// OBSOLETE .align 4
+// OBSOLETE
+// OBSOLETE in_trap_handler:
+// OBSOLETE .word 0
+// OBSOLETE
+// OBSOLETE .text
+// OBSOLETE .align 4
+// OBSOLETE
+// OBSOLETE ! This function is called when any SPARC trap (except window overflow or
+// OBSOLETE ! underflow) occurs. It makes sure that the invalid register window is still
+// OBSOLETE ! available before jumping into C code. It will also restore the world if you
+// OBSOLETE ! return from handle_exception.
+// OBSOLETE !
+// OBSOLETE ! On entry, trap_low expects l1 and l2 to contain pc and npc respectivly.
+// OBSOLETE
+// OBSOLETE .globl _trap_low
+// OBSOLETE _trap_low:
+// OBSOLETE mov %psr, %l0
+// OBSOLETE mov %wim, %l3
+// OBSOLETE
+// OBSOLETE srl %l3, %l0, %l4 ! wim >> cwp
+// OBSOLETE and %l4, 0xff, %l4 ! Mask off windows 28, 29
+// OBSOLETE cmp %l4, 1
+// OBSOLETE bne window_fine ! Branch if not in the invalid window
+// OBSOLETE nop
+// OBSOLETE
+// OBSOLETE ! Handle window overflow
+// OBSOLETE
+// OBSOLETE mov %g1, %l4 ! Save g1, we use it to hold the wim
+// OBSOLETE srl %l3, 1, %g1 ! Rotate wim right
+// OBSOLETE and %g1, 0xff, %g1 ! Mask off windows 28, 29
+// OBSOLETE tst %g1
+// OBSOLETE bg good_wim ! Branch if new wim is non-zero
+// OBSOLETE nop
+// OBSOLETE
+// OBSOLETE ! At this point, we need to bring a 1 into the high order bit of the wim.
+// OBSOLETE ! Since we don't want to make any assumptions about the number of register
+// OBSOLETE ! windows, we figure it out dynamically so as to setup the wim correctly.
+// OBSOLETE
+// OBSOLETE ! The normal way doesn't work on the sparclet as register windows
+// OBSOLETE ! 28 and 29 are special purpose windows.
+// OBSOLETE !not %g1 ! Fill g1 with ones
+// OBSOLETE !mov %g1, %wim ! Fill the wim with ones
+// OBSOLETE !nop
+// OBSOLETE !nop
+// OBSOLETE !nop
+// OBSOLETE !mov %wim, %g1 ! Read back the wim
+// OBSOLETE !inc %g1 ! Now g1 has 1 just to left of wim
+// OBSOLETE !srl %g1, 1, %g1 ! Now put 1 at top of wim
+// OBSOLETE
+// OBSOLETE mov 0x80, %g1 ! Hack for sparclet
+// OBSOLETE
+// OBSOLETE ! This doesn't work on the sparclet.
+// OBSOLETE !mov %g0, %wim ! Clear wim so that subsequent save
+// OBSOLETE ! won't trap
+// OBSOLETE andn %l3, 0xff, %l5 ! Clear wim but not windows 28, 29
+// OBSOLETE mov %l5, %wim
+// OBSOLETE nop
+// OBSOLETE nop
+// OBSOLETE nop
+// OBSOLETE
+// OBSOLETE good_wim:
+// OBSOLETE save %g0, %g0, %g0 ! Slip into next window
+// OBSOLETE mov %g1, %wim ! Install the new wim
+// OBSOLETE
+// OBSOLETE std %l0, [%sp + 0 * 4] ! save L & I registers
+// OBSOLETE std %l2, [%sp + 2 * 4]
+// OBSOLETE std %l4, [%sp + 4 * 4]
+// OBSOLETE std %l6, [%sp + 6 * 4]
+// OBSOLETE
+// OBSOLETE std %i0, [%sp + 8 * 4]
+// OBSOLETE std %i2, [%sp + 10 * 4]
+// OBSOLETE std %i4, [%sp + 12 * 4]
+// OBSOLETE std %i6, [%sp + 14 * 4]
+// OBSOLETE
+// OBSOLETE restore ! Go back to trap window.
+// OBSOLETE mov %l4, %g1 ! Restore %g1
+// OBSOLETE
+// OBSOLETE window_fine:
+// OBSOLETE sethi %hi(in_trap_handler), %l4
+// OBSOLETE ld [%lo(in_trap_handler) + %l4], %l5
+// OBSOLETE tst %l5
+// OBSOLETE bg recursive_trap
+// OBSOLETE inc %l5
+// OBSOLETE
+// OBSOLETE set trapstack+1000*4, %sp ! Switch to trap stack
+// OBSOLETE
+// OBSOLETE recursive_trap:
+// OBSOLETE st %l5, [%lo(in_trap_handler) + %l4]
+// OBSOLETE sub %sp,(16+1+6+1+88)*4,%sp ! Make room for input & locals
+// OBSOLETE ! + hidden arg + arg spill
+// OBSOLETE ! + doubleword alignment
+// OBSOLETE ! + registers[121]
+// OBSOLETE
+// OBSOLETE std %g0, [%sp + (24 + 0) * 4] ! registers[Gx]
+// OBSOLETE std %g2, [%sp + (24 + 2) * 4]
+// OBSOLETE std %g4, [%sp + (24 + 4) * 4]
+// OBSOLETE std %g6, [%sp + (24 + 6) * 4]
+// OBSOLETE
+// OBSOLETE std %i0, [%sp + (24 + 8) * 4] ! registers[Ox]
+// OBSOLETE std %i2, [%sp + (24 + 10) * 4]
+// OBSOLETE std %i4, [%sp + (24 + 12) * 4]
+// OBSOLETE std %i6, [%sp + (24 + 14) * 4]
+// OBSOLETE
+// OBSOLETE ! FP regs (sparclet doesn't have fpu)
+// OBSOLETE
+// OBSOLETE mov %y, %l4
+// OBSOLETE mov %tbr, %l5
+// OBSOLETE st %l4, [%sp + (24 + 64) * 4] ! Y
+// OBSOLETE st %l0, [%sp + (24 + 65) * 4] ! PSR
+// OBSOLETE st %l3, [%sp + (24 + 66) * 4] ! WIM
+// OBSOLETE st %l5, [%sp + (24 + 67) * 4] ! TBR
+// OBSOLETE st %l1, [%sp + (24 + 68) * 4] ! PC
+// OBSOLETE st %l2, [%sp + (24 + 69) * 4] ! NPC
+// OBSOLETE ! CPSR and FPSR not impl
+// OBSOLETE or %l0, 0xf20, %l4
+// OBSOLETE mov %l4, %psr ! Turn on traps, disable interrupts
+// OBSOLETE nop
+// OBSOLETE nop
+// OBSOLETE nop
+// OBSOLETE
+// OBSOLETE ! Save coprocessor state.
+// OBSOLETE ! See SK/demo/hdlc_demo/ldc_swap_context.S.
+// OBSOLETE
+// OBSOLETE mov %psr, %l0
+// OBSOLETE sethi %hi(0x2000), %l5 ! EC bit in PSR
+// OBSOLETE or %l5, %l0, %l5
+// OBSOLETE mov %l5, %psr ! enable coprocessor
+// OBSOLETE nop ! 3 nops after write to %psr (needed?)
+// OBSOLETE nop
+// OBSOLETE nop
+// OBSOLETE crdcxt %ccsr, %l1 ! capture CCSR
+// OBSOLETE mov 0x6, %l2
+// OBSOLETE cwrcxt %l2, %ccsr ! set CCP state machine for CCFR
+// OBSOLETE crdcxt %ccfr, %l2 ! capture CCOR
+// OBSOLETE cwrcxt %l2, %ccfr ! tickle CCFR
+// OBSOLETE crdcxt %ccfr, %l3 ! capture CCOBR
+// OBSOLETE cwrcxt %l3, %ccfr ! tickle CCFR
+// OBSOLETE crdcxt %ccfr, %l4 ! capture CCIBR
+// OBSOLETE cwrcxt %l4, %ccfr ! tickle CCFR
+// OBSOLETE crdcxt %ccfr, %l5 ! capture CCIR
+// OBSOLETE cwrcxt %l5, %ccfr ! tickle CCFR
+// OBSOLETE crdcxt %ccpr, %l6 ! capture CCPR
+// OBSOLETE crdcxt %cccrcr, %l7 ! capture CCCRCR
+// OBSOLETE st %l1, [%sp + (24 + 72) * 4] ! save CCSR
+// OBSOLETE st %l2, [%sp + (24 + 75) * 4] ! save CCOR
+// OBSOLETE st %l3, [%sp + (24 + 76) * 4] ! save CCOBR
+// OBSOLETE st %l4, [%sp + (24 + 77) * 4] ! save CCIBR
+// OBSOLETE st %l5, [%sp + (24 + 78) * 4] ! save CCIR
+// OBSOLETE st %l6, [%sp + (24 + 73) * 4] ! save CCPR
+// OBSOLETE st %l7, [%sp + (24 + 74) * 4] ! save CCCRCR
+// OBSOLETE mov %l0, %psr ! restore original PSR
+// OBSOLETE nop ! 3 nops after write to %psr (needed?)
+// OBSOLETE nop
+// OBSOLETE nop
+// OBSOLETE
+// OBSOLETE ! End of saving coprocessor state.
+// OBSOLETE ! Save asr regs
+// OBSOLETE
+// OBSOLETE ! Part of this is silly -- we should not display ASR15 or ASR19 at all.
+// OBSOLETE
+// OBSOLETE sethi %hi(0x01000000), %l6
+// OBSOLETE st %l6, [%sp + (24 + 81) * 4] ! ASR15 == NOP
+// OBSOLETE sethi %hi(0xdeadc0de), %l6
+// OBSOLETE or %l6, %lo(0xdeadc0de), %l6
+// OBSOLETE st %l6, [%sp + (24 + 84) * 4] ! ASR19 == DEADC0DE
+// OBSOLETE
+// OBSOLETE rd %asr1, %l4
+// OBSOLETE st %l4, [%sp + (24 + 80) * 4]
+// OBSOLETE ! rd %asr15, %l4 ! must not read ASR15
+// OBSOLETE ! st %l4, [%sp + (24 + 81) * 4] ! (illegal instr trap)
+// OBSOLETE rd %asr17, %l4
+// OBSOLETE st %l4, [%sp + (24 + 82) * 4]
+// OBSOLETE rd %asr18, %l4
+// OBSOLETE st %l4, [%sp + (24 + 83) * 4]
+// OBSOLETE ! rd %asr19, %l4 ! must not read asr19
+// OBSOLETE ! st %l4, [%sp + (24 + 84) * 4] ! (halts the CPU)
+// OBSOLETE rd %asr20, %l4
+// OBSOLETE st %l4, [%sp + (24 + 85) * 4]
+// OBSOLETE rd %asr21, %l4
+// OBSOLETE st %l4, [%sp + (24 + 86) * 4]
+// OBSOLETE rd %asr22, %l4
+// OBSOLETE st %l4, [%sp + (24 + 87) * 4]
+// OBSOLETE
+// OBSOLETE ! End of saving asr regs
+// OBSOLETE
+// OBSOLETE call _handle_exception
+// OBSOLETE add %sp, 24 * 4, %o0 ! Pass address of registers
+// OBSOLETE
+// OBSOLETE ! Reload all of the registers that aren't on the stack
+// OBSOLETE
+// OBSOLETE ld [%sp + (24 + 1) * 4], %g1 ! registers[Gx]
+// OBSOLETE ldd [%sp + (24 + 2) * 4], %g2
+// OBSOLETE ldd [%sp + (24 + 4) * 4], %g4
+// OBSOLETE ldd [%sp + (24 + 6) * 4], %g6
+// OBSOLETE
+// OBSOLETE ldd [%sp + (24 + 8) * 4], %i0 ! registers[Ox]
+// OBSOLETE ldd [%sp + (24 + 10) * 4], %i2
+// OBSOLETE ldd [%sp + (24 + 12) * 4], %i4
+// OBSOLETE ldd [%sp + (24 + 14) * 4], %i6
+// OBSOLETE
+// OBSOLETE ! FP regs (sparclet doesn't have fpu)
+// OBSOLETE
+// OBSOLETE ! Update the coprocessor registers.
+// OBSOLETE ! See SK/demo/hdlc_demo/ldc_swap_context.S.
+// OBSOLETE
+// OBSOLETE mov %psr, %l0
+// OBSOLETE sethi %hi(0x2000), %l5 ! EC bit in PSR
+// OBSOLETE or %l5, %l0, %l5
+// OBSOLETE mov %l5, %psr ! enable coprocessor
+// OBSOLETE nop ! 3 nops after write to %psr (needed?)
+// OBSOLETE nop
+// OBSOLETE nop
+// OBSOLETE
+// OBSOLETE mov 0x6, %l2
+// OBSOLETE cwrcxt %l2, %ccsr ! set CCP state machine for CCFR
+// OBSOLETE
+// OBSOLETE ld [%sp + (24 + 72) * 4], %l1 ! saved CCSR
+// OBSOLETE ld [%sp + (24 + 75) * 4], %l2 ! saved CCOR
+// OBSOLETE ld [%sp + (24 + 76) * 4], %l3 ! saved CCOBR
+// OBSOLETE ld [%sp + (24 + 77) * 4], %l4 ! saved CCIBR
+// OBSOLETE ld [%sp + (24 + 78) * 4], %l5 ! saved CCIR
+// OBSOLETE ld [%sp + (24 + 73) * 4], %l6 ! saved CCPR
+// OBSOLETE ld [%sp + (24 + 74) * 4], %l7 ! saved CCCRCR
+// OBSOLETE
+// OBSOLETE cwrcxt %l2, %ccfr ! restore CCOR
+// OBSOLETE cwrcxt %l3, %ccfr ! restore CCOBR
+// OBSOLETE cwrcxt %l4, %ccfr ! restore CCIBR
+// OBSOLETE cwrcxt %l5, %ccfr ! restore CCIR
+// OBSOLETE cwrcxt %l6, %ccpr ! restore CCPR
+// OBSOLETE cwrcxt %l7, %cccrcr ! restore CCCRCR
+// OBSOLETE cwrcxt %l1, %ccsr ! restore CCSR
+// OBSOLETE
+// OBSOLETE mov %l0, %psr ! restore PSR
+// OBSOLETE nop ! 3 nops after write to %psr (needed?)
+// OBSOLETE nop
+// OBSOLETE nop
+// OBSOLETE
+// OBSOLETE ! End of coprocessor handling stuff.
+// OBSOLETE ! Update asr regs
+// OBSOLETE
+// OBSOLETE ld [%sp + (24 + 80) * 4], %l4
+// OBSOLETE wr %l4, %asr1
+// OBSOLETE ! ld [%sp + (24 + 81) * 4], %l4 ! can't write asr15
+// OBSOLETE ! wr %l4, %asr15
+// OBSOLETE ld [%sp + (24 + 82) * 4], %l4
+// OBSOLETE wr %l4, %asr17
+// OBSOLETE ld [%sp + (24 + 83) * 4], %l4
+// OBSOLETE wr %l4, %asr18
+// OBSOLETE ! ld [%sp + (24 + 84) * 4], %l4 ! can't write asr19
+// OBSOLETE ! wr %l4, %asr19
+// OBSOLETE ! ld [%sp + (24 + 85) * 4], %l4 ! can't write asr20
+// OBSOLETE ! wr %l4, %asr20
+// OBSOLETE ! ld [%sp + (24 + 86) * 4], %l4 ! can't write asr21
+// OBSOLETE ! wr %l4, %asr21
+// OBSOLETE ld [%sp + (24 + 87) * 4], %l4
+// OBSOLETE wr %l4, %asr22
+// OBSOLETE
+// OBSOLETE ! End of restoring asr regs
+// OBSOLETE
+// OBSOLETE
+// OBSOLETE ldd [%sp + (24 + 64) * 4], %l0 ! Y & PSR
+// OBSOLETE ldd [%sp + (24 + 68) * 4], %l2 ! PC & NPC
+// OBSOLETE
+// OBSOLETE restore ! Ensure that previous window is valid
+// OBSOLETE save %g0, %g0, %g0 ! by causing a window_underflow trap
+// OBSOLETE
+// OBSOLETE mov %l0, %y
+// OBSOLETE mov %l1, %psr ! Make sure that traps are disabled
+// OBSOLETE ! for rett
+// OBSOLETE nop ! 3 nops after write to %psr (needed?)
+// OBSOLETE nop
+// OBSOLETE nop
+// OBSOLETE
+// OBSOLETE sethi %hi(in_trap_handler), %l4
+// OBSOLETE ld [%lo(in_trap_handler) + %l4], %l5
+// OBSOLETE dec %l5
+// OBSOLETE st %l5, [%lo(in_trap_handler) + %l4]
+// OBSOLETE
+// OBSOLETE jmpl %l2, %g0 ! Restore old PC
+// OBSOLETE rett %l3 ! Restore old nPC
+// OBSOLETE ");
+// OBSOLETE
+// OBSOLETE /* Convert ch from a hex digit to an int */
+// OBSOLETE
+// OBSOLETE static int
+// OBSOLETE hex (unsigned char ch)
+// OBSOLETE {
+// OBSOLETE if (ch >= 'a' && ch <= 'f')
+// OBSOLETE return ch-'a'+10;
+// OBSOLETE if (ch >= '0' && ch <= '9')
+// OBSOLETE return ch-'0';
+// OBSOLETE if (ch >= 'A' && ch <= 'F')
+// OBSOLETE return ch-'A'+10;
+// OBSOLETE return -1;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE static char remcomInBuffer[BUFMAX];
+// OBSOLETE static char remcomOutBuffer[BUFMAX];
+// OBSOLETE
+// OBSOLETE /* scan for the sequence $<data>#<checksum> */
+// OBSOLETE
+// OBSOLETE unsigned char *
+// OBSOLETE getpacket (void)
+// OBSOLETE {
+// OBSOLETE unsigned char *buffer = &remcomInBuffer[0];
+// OBSOLETE unsigned char checksum;
+// OBSOLETE unsigned char xmitcsum;
+// OBSOLETE int count;
+// OBSOLETE char ch;
+// OBSOLETE
+// OBSOLETE while (1)
+// OBSOLETE {
+// OBSOLETE /* wait around for the start character, ignore all other characters */
+// OBSOLETE while ((ch = getDebugChar ()) != '$')
+// OBSOLETE ;
+// OBSOLETE
+// OBSOLETE retry:
+// OBSOLETE checksum = 0;
+// OBSOLETE xmitcsum = -1;
+// OBSOLETE count = 0;
+// OBSOLETE
+// OBSOLETE /* now, read until a # or end of buffer is found */
+// OBSOLETE while (count < BUFMAX)
+// OBSOLETE {
+// OBSOLETE ch = getDebugChar ();
+// OBSOLETE if (ch == '$')
+// OBSOLETE goto retry;
+// OBSOLETE if (ch == '#')
+// OBSOLETE break;
+// OBSOLETE checksum = checksum + ch;
+// OBSOLETE buffer[count] = ch;
+// OBSOLETE count = count + 1;
+// OBSOLETE }
+// OBSOLETE buffer[count] = 0;
+// OBSOLETE
+// OBSOLETE if (ch == '#')
+// OBSOLETE {
+// OBSOLETE ch = getDebugChar ();
+// OBSOLETE xmitcsum = hex (ch) << 4;
+// OBSOLETE ch = getDebugChar ();
+// OBSOLETE xmitcsum += hex (ch);
+// OBSOLETE
+// OBSOLETE if (checksum != xmitcsum)
+// OBSOLETE {
+// OBSOLETE putDebugChar ('-'); /* failed checksum */
+// OBSOLETE }
+// OBSOLETE else
+// OBSOLETE {
+// OBSOLETE putDebugChar ('+'); /* successful transfer */
+// OBSOLETE
+// OBSOLETE /* if a sequence char is present, reply the sequence ID */
+// OBSOLETE if (buffer[2] == ':')
+// OBSOLETE {
+// OBSOLETE putDebugChar (buffer[0]);
+// OBSOLETE putDebugChar (buffer[1]);
+// OBSOLETE
+// OBSOLETE return &buffer[3];
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE return &buffer[0];
+// OBSOLETE }
+// OBSOLETE }
+// OBSOLETE }
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE /* send the packet in buffer. */
+// OBSOLETE
+// OBSOLETE static void
+// OBSOLETE putpacket (unsigned char *buffer)
+// OBSOLETE {
+// OBSOLETE unsigned char checksum;
+// OBSOLETE int count;
+// OBSOLETE unsigned char ch;
+// OBSOLETE
+// OBSOLETE /* $<packet info>#<checksum>. */
+// OBSOLETE do
+// OBSOLETE {
+// OBSOLETE putDebugChar('$');
+// OBSOLETE checksum = 0;
+// OBSOLETE count = 0;
+// OBSOLETE
+// OBSOLETE while (ch = buffer[count])
+// OBSOLETE {
+// OBSOLETE putDebugChar(ch);
+// OBSOLETE checksum += ch;
+// OBSOLETE count += 1;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE putDebugChar('#');
+// OBSOLETE putDebugChar(hexchars[checksum >> 4]);
+// OBSOLETE putDebugChar(hexchars[checksum & 0xf]);
+// OBSOLETE
+// OBSOLETE }
+// OBSOLETE while (getDebugChar() != '+');
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE /* Indicate to caller of mem2hex or hex2mem that there has been an
+// OBSOLETE error. */
+// OBSOLETE static volatile int mem_err = 0;
+// OBSOLETE
+// OBSOLETE /* Convert the memory pointed to by mem into hex, placing result in buf.
+// OBSOLETE * Return a pointer to the last char put in buf (null), in case of mem fault,
+// OBSOLETE * return 0.
+// OBSOLETE * If MAY_FAULT is non-zero, then we will handle memory faults by returning
+// OBSOLETE * a 0, else treat a fault like any other fault in the stub.
+// OBSOLETE */
+// OBSOLETE
+// OBSOLETE static unsigned char *
+// OBSOLETE mem2hex (unsigned char *mem, unsigned char *buf, int count, int may_fault)
+// OBSOLETE {
+// OBSOLETE unsigned char ch;
+// OBSOLETE
+// OBSOLETE set_mem_fault_trap(may_fault);
+// OBSOLETE
+// OBSOLETE while (count-- > 0)
+// OBSOLETE {
+// OBSOLETE ch = *mem++;
+// OBSOLETE if (mem_err)
+// OBSOLETE return 0;
+// OBSOLETE *buf++ = hexchars[ch >> 4];
+// OBSOLETE *buf++ = hexchars[ch & 0xf];
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE *buf = 0;
+// OBSOLETE
+// OBSOLETE set_mem_fault_trap(0);
+// OBSOLETE
+// OBSOLETE return buf;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE /* convert the hex array pointed to by buf into binary to be placed in mem
+// OBSOLETE * return a pointer to the character AFTER the last byte written */
+// OBSOLETE
+// OBSOLETE static char *
+// OBSOLETE hex2mem (unsigned char *buf, unsigned char *mem, int count, int may_fault)
+// OBSOLETE {
+// OBSOLETE int i;
+// OBSOLETE unsigned char ch;
+// OBSOLETE
+// OBSOLETE set_mem_fault_trap(may_fault);
+// OBSOLETE
+// OBSOLETE for (i=0; i<count; i++)
+// OBSOLETE {
+// OBSOLETE ch = hex(*buf++) << 4;
+// OBSOLETE ch |= hex(*buf++);
+// OBSOLETE *mem++ = ch;
+// OBSOLETE if (mem_err)
+// OBSOLETE return 0;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE set_mem_fault_trap(0);
+// OBSOLETE
+// OBSOLETE return mem;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE /* This table contains the mapping between SPARC hardware trap types, and
+// OBSOLETE signals, which are primarily what GDB understands. It also indicates
+// OBSOLETE which hardware traps we need to commandeer when initializing the stub. */
+// OBSOLETE
+// OBSOLETE static struct hard_trap_info
+// OBSOLETE {
+// OBSOLETE unsigned char tt; /* Trap type code for SPARClite */
+// OBSOLETE unsigned char signo; /* Signal that we map this trap into */
+// OBSOLETE } hard_trap_info[] = {
+// OBSOLETE {1, SIGSEGV}, /* instruction access exception */
+// OBSOLETE {0x3b, SIGSEGV}, /* instruction access error */
+// OBSOLETE {2, SIGILL}, /* illegal instruction */
+// OBSOLETE {3, SIGILL}, /* privileged instruction */
+// OBSOLETE {4, SIGEMT}, /* fp disabled */
+// OBSOLETE {0x24, SIGEMT}, /* cp disabled */
+// OBSOLETE {7, SIGBUS}, /* mem address not aligned */
+// OBSOLETE {0x29, SIGSEGV}, /* data access exception */
+// OBSOLETE {10, SIGEMT}, /* tag overflow */
+// OBSOLETE {128+1, SIGTRAP}, /* ta 1 - normal breakpoint instruction */
+// OBSOLETE {0, 0} /* Must be last */
+// OBSOLETE };
+// OBSOLETE
+// OBSOLETE /* Set up exception handlers for tracing and breakpoints */
+// OBSOLETE
+// OBSOLETE void
+// OBSOLETE set_debug_traps (void)
+// OBSOLETE {
+// OBSOLETE struct hard_trap_info *ht;
+// OBSOLETE
+// OBSOLETE for (ht = hard_trap_info; ht->tt && ht->signo; ht++)
+// OBSOLETE exceptionHandler(ht->tt, trap_low);
+// OBSOLETE
+// OBSOLETE initialized = 1;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE asm ("
+// OBSOLETE ! Trap handler for memory errors. This just sets mem_err to be non-zero. It
+// OBSOLETE ! assumes that %l1 is non-zero. This should be safe, as it is doubtful that
+// OBSOLETE ! 0 would ever contain code that could mem fault. This routine will skip
+// OBSOLETE ! past the faulting instruction after setting mem_err.
+// OBSOLETE
+// OBSOLETE .text
+// OBSOLETE .align 4
+// OBSOLETE
+// OBSOLETE _fltr_set_mem_err:
+// OBSOLETE sethi %hi(_mem_err), %l0
+// OBSOLETE st %l1, [%l0 + %lo(_mem_err)]
+// OBSOLETE jmpl %l2, %g0
+// OBSOLETE rett %l2+4
+// OBSOLETE ");
+// OBSOLETE
+// OBSOLETE static void
+// OBSOLETE set_mem_fault_trap (int enable)
+// OBSOLETE {
+// OBSOLETE extern void fltr_set_mem_err();
+// OBSOLETE mem_err = 0;
+// OBSOLETE
+// OBSOLETE if (enable)
+// OBSOLETE exceptionHandler(0x29, fltr_set_mem_err);
+// OBSOLETE else
+// OBSOLETE exceptionHandler(0x29, trap_low);
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE asm ("
+// OBSOLETE .text
+// OBSOLETE .align 4
+// OBSOLETE
+// OBSOLETE _dummy_hw_breakpoint:
+// OBSOLETE jmpl %l2, %g0
+// OBSOLETE rett %l2+4
+// OBSOLETE nop
+// OBSOLETE nop
+// OBSOLETE ");
+// OBSOLETE
+// OBSOLETE static void
+// OBSOLETE set_hw_breakpoint_trap (int enable)
+// OBSOLETE {
+// OBSOLETE extern void dummy_hw_breakpoint();
+// OBSOLETE
+// OBSOLETE if (enable)
+// OBSOLETE exceptionHandler(255, dummy_hw_breakpoint);
+// OBSOLETE else
+// OBSOLETE exceptionHandler(255, trap_low);
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE static void
+// OBSOLETE get_in_break_mode (void)
+// OBSOLETE {
+// OBSOLETE #if 0
+// OBSOLETE int x;
+// OBSOLETE mesg("get_in_break_mode, sp = ");
+// OBSOLETE phex(&x);
+// OBSOLETE #endif
+// OBSOLETE set_hw_breakpoint_trap(1);
+// OBSOLETE
+// OBSOLETE asm("
+// OBSOLETE sethi %hi(0xff10), %l4
+// OBSOLETE or %l4, %lo(0xff10), %l4
+// OBSOLETE sta %g0, [%l4]0x1
+// OBSOLETE nop
+// OBSOLETE nop
+// OBSOLETE nop
+// OBSOLETE ");
+// OBSOLETE
+// OBSOLETE set_hw_breakpoint_trap(0);
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE /* Convert the SPARC hardware trap type code to a unix signal number. */
+// OBSOLETE
+// OBSOLETE static int
+// OBSOLETE computeSignal (int tt)
+// OBSOLETE {
+// OBSOLETE struct hard_trap_info *ht;
+// OBSOLETE
+// OBSOLETE for (ht = hard_trap_info; ht->tt && ht->signo; ht++)
+// OBSOLETE if (ht->tt == tt)
+// OBSOLETE return ht->signo;
+// OBSOLETE
+// OBSOLETE return SIGHUP; /* default for things we don't know about */
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE /*
+// OBSOLETE * While we find nice hex chars, build an int.
+// OBSOLETE * Return number of chars processed.
+// OBSOLETE */
+// OBSOLETE
+// OBSOLETE static int
+// OBSOLETE hexToInt(char **ptr, int *intValue)
+// OBSOLETE {
+// OBSOLETE int numChars = 0;
+// OBSOLETE int hexValue;
+// OBSOLETE
+// OBSOLETE *intValue = 0;
+// OBSOLETE
+// OBSOLETE while (**ptr)
+// OBSOLETE {
+// OBSOLETE hexValue = hex(**ptr);
+// OBSOLETE if (hexValue < 0)
+// OBSOLETE break;
+// OBSOLETE
+// OBSOLETE *intValue = (*intValue << 4) | hexValue;
+// OBSOLETE numChars ++;
+// OBSOLETE
+// OBSOLETE (*ptr)++;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE return (numChars);
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE /*
+// OBSOLETE * This function does all command procesing for interfacing to gdb. It
+// OBSOLETE * returns 1 if you should skip the instruction at the trap address, 0
+// OBSOLETE * otherwise.
+// OBSOLETE */
+// OBSOLETE
+// OBSOLETE static void
+// OBSOLETE handle_exception (unsigned long *registers)
+// OBSOLETE {
+// OBSOLETE int tt; /* Trap type */
+// OBSOLETE int sigval;
+// OBSOLETE int addr;
+// OBSOLETE int length;
+// OBSOLETE char *ptr;
+// OBSOLETE unsigned long *sp;
+// OBSOLETE unsigned long dsr;
+// OBSOLETE
+// OBSOLETE /* First, we must force all of the windows to be spilled out */
+// OBSOLETE
+// OBSOLETE asm("
+// OBSOLETE ! Ugh. sparclet has broken save
+// OBSOLETE !save %sp, -64, %sp
+// OBSOLETE save
+// OBSOLETE add %fp,-64,%sp
+// OBSOLETE !save %sp, -64, %sp
+// OBSOLETE save
+// OBSOLETE add %fp,-64,%sp
+// OBSOLETE !save %sp, -64, %sp
+// OBSOLETE save
+// OBSOLETE add %fp,-64,%sp
+// OBSOLETE !save %sp, -64, %sp
+// OBSOLETE save
+// OBSOLETE add %fp,-64,%sp
+// OBSOLETE !save %sp, -64, %sp
+// OBSOLETE save
+// OBSOLETE add %fp,-64,%sp
+// OBSOLETE !save %sp, -64, %sp
+// OBSOLETE save
+// OBSOLETE add %fp,-64,%sp
+// OBSOLETE !save %sp, -64, %sp
+// OBSOLETE save
+// OBSOLETE add %fp,-64,%sp
+// OBSOLETE !save %sp, -64, %sp
+// OBSOLETE save
+// OBSOLETE add %fp,-64,%sp
+// OBSOLETE restore
+// OBSOLETE restore
+// OBSOLETE restore
+// OBSOLETE restore
+// OBSOLETE restore
+// OBSOLETE restore
+// OBSOLETE restore
+// OBSOLETE restore
+// OBSOLETE ");
+// OBSOLETE
+// OBSOLETE if (registers[PC] == (unsigned long)breakinst)
+// OBSOLETE {
+// OBSOLETE registers[PC] = registers[NPC];
+// OBSOLETE registers[NPC] += 4;
+// OBSOLETE }
+// OBSOLETE sp = (unsigned long *)registers[SP];
+// OBSOLETE
+// OBSOLETE tt = (registers[TBR] >> 4) & 0xff;
+// OBSOLETE
+// OBSOLETE /* reply to host that an exception has occurred */
+// OBSOLETE sigval = computeSignal(tt);
+// OBSOLETE ptr = remcomOutBuffer;
+// OBSOLETE
+// OBSOLETE *ptr++ = 'T';
+// OBSOLETE *ptr++ = hexchars[sigval >> 4];
+// OBSOLETE *ptr++ = hexchars[sigval & 0xf];
+// OBSOLETE
+// OBSOLETE *ptr++ = hexchars[PC >> 4];
+// OBSOLETE *ptr++ = hexchars[PC & 0xf];
+// OBSOLETE *ptr++ = ':';
+// OBSOLETE ptr = mem2hex((char *)&registers[PC], ptr, 4, 0);
+// OBSOLETE *ptr++ = ';';
+// OBSOLETE
+// OBSOLETE *ptr++ = hexchars[FP >> 4];
+// OBSOLETE *ptr++ = hexchars[FP & 0xf];
+// OBSOLETE *ptr++ = ':';
+// OBSOLETE ptr = mem2hex(sp + 8 + 6, ptr, 4, 0); /* FP */
+// OBSOLETE *ptr++ = ';';
+// OBSOLETE
+// OBSOLETE *ptr++ = hexchars[SP >> 4];
+// OBSOLETE *ptr++ = hexchars[SP & 0xf];
+// OBSOLETE *ptr++ = ':';
+// OBSOLETE ptr = mem2hex((char *)&sp, ptr, 4, 0);
+// OBSOLETE *ptr++ = ';';
+// OBSOLETE
+// OBSOLETE *ptr++ = hexchars[NPC >> 4];
+// OBSOLETE *ptr++ = hexchars[NPC & 0xf];
+// OBSOLETE *ptr++ = ':';
+// OBSOLETE ptr = mem2hex((char *)&registers[NPC], ptr, 4, 0);
+// OBSOLETE *ptr++ = ';';
+// OBSOLETE
+// OBSOLETE *ptr++ = hexchars[O7 >> 4];
+// OBSOLETE *ptr++ = hexchars[O7 & 0xf];
+// OBSOLETE *ptr++ = ':';
+// OBSOLETE ptr = mem2hex((char *)&registers[O7], ptr, 4, 0);
+// OBSOLETE *ptr++ = ';';
+// OBSOLETE
+// OBSOLETE *ptr++ = 0;
+// OBSOLETE
+// OBSOLETE putpacket(remcomOutBuffer);
+// OBSOLETE
+// OBSOLETE while (1)
+// OBSOLETE {
+// OBSOLETE remcomOutBuffer[0] = 0;
+// OBSOLETE
+// OBSOLETE ptr = getpacket();
+// OBSOLETE switch (*ptr++)
+// OBSOLETE {
+// OBSOLETE case '?':
+// OBSOLETE remcomOutBuffer[0] = 'S';
+// OBSOLETE remcomOutBuffer[1] = hexchars[sigval >> 4];
+// OBSOLETE remcomOutBuffer[2] = hexchars[sigval & 0xf];
+// OBSOLETE remcomOutBuffer[3] = 0;
+// OBSOLETE break;
+// OBSOLETE
+// OBSOLETE case 'd':
+// OBSOLETE remote_debug = !(remote_debug); /* toggle debug flag */
+// OBSOLETE break;
+// OBSOLETE
+// OBSOLETE case 'g': /* return the value of the CPU registers */
+// OBSOLETE {
+// OBSOLETE ptr = remcomOutBuffer;
+// OBSOLETE ptr = mem2hex((char *)registers, ptr, 16 * 4, 0); /* G & O regs */
+// OBSOLETE ptr = mem2hex(sp + 0, ptr, 16 * 4, 0); /* L & I regs */
+// OBSOLETE memset(ptr, '0', 32 * 8); /* Floating point */
+// OBSOLETE ptr = mem2hex((char *)&registers[Y],
+// OBSOLETE ptr + 32 * 4 * 2,
+// OBSOLETE 8 * 4,
+// OBSOLETE 0); /* Y, PSR, WIM, TBR, PC, NPC, FPSR, CPSR */
+// OBSOLETE ptr = mem2hex((char *)&registers[CCSR],
+// OBSOLETE ptr,
+// OBSOLETE 8 * 4,
+// OBSOLETE 0); /* CCSR, CCPR, CCCRCR, CCOR, CCOBR, CCIBR, CCIR */
+// OBSOLETE ptr = mem2hex((char *)&registers[ASR1],
+// OBSOLETE ptr,
+// OBSOLETE 8 * 4,
+// OBSOLETE 0); /* ASR1,ASR15,ASR17,ASR18,ASR19,ASR20,ASR21,ASR22 */
+// OBSOLETE #if 0 /* not implemented */
+// OBSOLETE ptr = mem2hex((char *) &registers[AWR0],
+// OBSOLETE ptr,
+// OBSOLETE 32 * 4,
+// OBSOLETE 0); /* Alternate Window Registers */
+// OBSOLETE #endif
+// OBSOLETE }
+// OBSOLETE break;
+// OBSOLETE
+// OBSOLETE case 'G': /* set value of all the CPU registers - return OK */
+// OBSOLETE case 'P': /* set value of one CPU register - return OK */
+// OBSOLETE {
+// OBSOLETE unsigned long *newsp, psr;
+// OBSOLETE
+// OBSOLETE psr = registers[PSR];
+// OBSOLETE
+// OBSOLETE if (ptr[-1] == 'P') /* do a single register */
+// OBSOLETE {
+// OBSOLETE int regno;
+// OBSOLETE
+// OBSOLETE if (hexToInt (&ptr, &regno)
+// OBSOLETE && *ptr++ == '=')
+// OBSOLETE if (regno >= L0 && regno <= I7)
+// OBSOLETE hex2mem (ptr, sp + regno - L0, 4, 0);
+// OBSOLETE else
+// OBSOLETE hex2mem (ptr, (char *)&registers[regno], 4, 0);
+// OBSOLETE else
+// OBSOLETE {
+// OBSOLETE strcpy (remcomOutBuffer, "E01");
+// OBSOLETE break;
+// OBSOLETE }
+// OBSOLETE }
+// OBSOLETE else
+// OBSOLETE {
+// OBSOLETE hex2mem(ptr, (char *)registers, 16 * 4, 0); /* G & O regs */
+// OBSOLETE hex2mem(ptr + 16 * 4 * 2, sp + 0, 16 * 4, 0); /* L & I regs */
+// OBSOLETE hex2mem(ptr + 64 * 4 * 2, (char *)&registers[Y],
+// OBSOLETE 8 * 4, 0); /* Y,PSR,WIM,TBR,PC,NPC,FPSR,CPSR */
+// OBSOLETE hex2mem(ptr + 72 * 4 * 2, (char *)&registers[CCSR],
+// OBSOLETE 8 * 4, 0); /* CCSR,CCPR,CCCRCR,CCOR,CCOBR,CCIBR,CCIR */
+// OBSOLETE hex2mem(ptr + 80 * 4 * 2, (char *)&registers[ASR1],
+// OBSOLETE 8 * 4, 0); /* ASR1 ... ASR22 */
+// OBSOLETE #if 0 /* not implemented */
+// OBSOLETE hex2mem(ptr + 88 * 4 * 2, (char *)&registers[AWR0],
+// OBSOLETE 8 * 4, 0); /* Alternate Window Registers */
+// OBSOLETE #endif
+// OBSOLETE }
+// OBSOLETE /* See if the stack pointer has moved. If so, then copy the saved
+// OBSOLETE locals and ins to the new location. This keeps the window
+// OBSOLETE overflow and underflow routines happy. */
+// OBSOLETE
+// OBSOLETE newsp = (unsigned long *)registers[SP];
+// OBSOLETE if (sp != newsp)
+// OBSOLETE sp = memcpy(newsp, sp, 16 * 4);
+// OBSOLETE
+// OBSOLETE /* Don't allow CWP to be modified. */
+// OBSOLETE
+// OBSOLETE if (psr != registers[PSR])
+// OBSOLETE registers[PSR] = (psr & 0x1f) | (registers[PSR] & ~0x1f);
+// OBSOLETE
+// OBSOLETE strcpy(remcomOutBuffer,"OK");
+// OBSOLETE }
+// OBSOLETE break;
+// OBSOLETE
+// OBSOLETE case 'm': /* mAA..AA,LLLL Read LLLL bytes at address AA..AA */
+// OBSOLETE /* Try to read %x,%x. */
+// OBSOLETE
+// OBSOLETE if (hexToInt(&ptr, &addr)
+// OBSOLETE && *ptr++ == ','
+// OBSOLETE && hexToInt(&ptr, &length))
+// OBSOLETE {
+// OBSOLETE if (mem2hex((char *)addr, remcomOutBuffer, length, 1))
+// OBSOLETE break;
+// OBSOLETE
+// OBSOLETE strcpy (remcomOutBuffer, "E03");
+// OBSOLETE }
+// OBSOLETE else
+// OBSOLETE strcpy(remcomOutBuffer,"E01");
+// OBSOLETE break;
+// OBSOLETE
+// OBSOLETE case 'M': /* MAA..AA,LLLL: Write LLLL bytes at address AA.AA return OK */
+// OBSOLETE /* Try to read '%x,%x:'. */
+// OBSOLETE
+// OBSOLETE if (hexToInt(&ptr, &addr)
+// OBSOLETE && *ptr++ == ','
+// OBSOLETE && hexToInt(&ptr, &length)
+// OBSOLETE && *ptr++ == ':')
+// OBSOLETE {
+// OBSOLETE if (hex2mem(ptr, (char *)addr, length, 1))
+// OBSOLETE strcpy(remcomOutBuffer, "OK");
+// OBSOLETE else
+// OBSOLETE strcpy(remcomOutBuffer, "E03");
+// OBSOLETE }
+// OBSOLETE else
+// OBSOLETE strcpy(remcomOutBuffer, "E02");
+// OBSOLETE break;
+// OBSOLETE
+// OBSOLETE case 'c': /* cAA..AA Continue at address AA..AA(optional) */
+// OBSOLETE /* try to read optional parameter, pc unchanged if no parm */
+// OBSOLETE
+// OBSOLETE if (hexToInt(&ptr, &addr))
+// OBSOLETE {
+// OBSOLETE registers[PC] = addr;
+// OBSOLETE registers[NPC] = addr + 4;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE /* Need to flush the instruction cache here, as we may have deposited a
+// OBSOLETE breakpoint, and the icache probably has no way of knowing that a data ref to
+// OBSOLETE some location may have changed something that is in the instruction cache.
+// OBSOLETE */
+// OBSOLETE
+// OBSOLETE flush_i_cache();
+// OBSOLETE return;
+// OBSOLETE
+// OBSOLETE /* kill the program */
+// OBSOLETE case 'k' : /* do nothing */
+// OBSOLETE break;
+// OBSOLETE #if 0
+// OBSOLETE case 't': /* Test feature */
+// OBSOLETE asm (" std %f30,[%sp]");
+// OBSOLETE break;
+// OBSOLETE #endif
+// OBSOLETE case 'r': /* Reset */
+// OBSOLETE asm ("call 0
+// OBSOLETE nop ");
+// OBSOLETE break;
+// OBSOLETE } /* switch */
+// OBSOLETE
+// OBSOLETE /* reply to the request */
+// OBSOLETE putpacket(remcomOutBuffer);
+// OBSOLETE }
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE /* This function will generate a breakpoint exception. It is used at the
+// OBSOLETE beginning of a program to sync up with a debugger and can be used
+// OBSOLETE otherwise as a quick means to stop program execution and "break" into
+// OBSOLETE the debugger. */
+// OBSOLETE
+// OBSOLETE void
+// OBSOLETE breakpoint (void)
+// OBSOLETE {
+// OBSOLETE if (!initialized)
+// OBSOLETE return;
+// OBSOLETE
+// OBSOLETE asm(" .globl _breakinst
+// OBSOLETE
+// OBSOLETE _breakinst: ta 1
+// OBSOLETE ");
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE static void
+// OBSOLETE hw_breakpoint (void)
+// OBSOLETE {
+// OBSOLETE asm("
+// OBSOLETE ta 127
+// OBSOLETE ");
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE #if 0 /* experimental and never finished, left here for reference */
+// OBSOLETE static void
+// OBSOLETE splet_temp(void)
+// OBSOLETE {
+// OBSOLETE asm(" sub %sp,(16+1+6+1+121)*4,%sp ! Make room for input & locals
+// OBSOLETE ! + hidden arg + arg spill
+// OBSOLETE ! + doubleword alignment
+// OBSOLETE ! + registers[121]
+// OBSOLETE
+// OBSOLETE ! Leave a trail of breadcrumbs! (save register save area for debugging)
+// OBSOLETE mov %sp, %l0
+// OBSOLETE add %l0, 24*4, %l0
+// OBSOLETE sethi %hi(_debug_registers), %l1
+// OBSOLETE st %l0, [%lo(_debug_registers) + %l1]
+// OBSOLETE
+// OBSOLETE ! Save the Alternate Register Set: (not implemented yet)
+// OBSOLETE ! To save the Alternate Register set, we must:
+// OBSOLETE ! 1) Save the current SP in some global location.
+// OBSOLETE ! 2) Swap the register sets.
+// OBSOLETE ! 3) Save the Alternate SP in the Y register
+// OBSOLETE ! 4) Fetch the SP that we saved in step 1.
+// OBSOLETE ! 5) Use that to save the rest of the regs (not forgetting ASP in Y)
+// OBSOLETE ! 6) Restore the Alternate SP from Y
+// OBSOLETE ! 7) Swap the registers back.
+// OBSOLETE
+// OBSOLETE ! 1) Copy the current stack pointer to global _SAVED_STACK_POINTER:
+// OBSOLETE sethi %hi(_saved_stack_pointer), %l0
+// OBSOLETE st %sp, [%lo(_saved_stack_pointer) + %l0]
+// OBSOLETE
+// OBSOLETE ! 2) Swap the register sets:
+// OBSOLETE mov %psr, %l1
+// OBSOLETE sethi %hi(0x10000), %l2
+// OBSOLETE xor %l1, %l2, %l1
+// OBSOLETE mov %l1, %psr
+// OBSOLETE nop ! 3 nops after write to %psr (needed?)
+// OBSOLETE nop
+// OBSOLETE nop
+// OBSOLETE
+// OBSOLETE ! 3) Save Alternate L0 in Y
+// OBSOLETE wr %l0, 0, %y
+// OBSOLETE
+// OBSOLETE ! 4) Load former SP into alternate SP, using L0
+// OBSOLETE sethi %hi(_saved_stack_pointer), %l0
+// OBSOLETE or %lo(_saved_stack_pointer), %l0, %l0
+// OBSOLETE swap [%l0], %sp
+// OBSOLETE
+// OBSOLETE ! 4.5) Restore alternate L0
+// OBSOLETE rd %y, %l0
+// OBSOLETE
+// OBSOLETE ! 5) Save the Alternate Window Registers
+// OBSOLETE st %r0, [%sp + (24 + 88) * 4] ! AWR0
+// OBSOLETE st %r1, [%sp + (24 + 89) * 4] ! AWR1
+// OBSOLETE st %r2, [%sp + (24 + 90) * 4] ! AWR2
+// OBSOLETE st %r3, [%sp + (24 + 91) * 4] ! AWR3
+// OBSOLETE st %r4, [%sp + (24 + 92) * 4] ! AWR4
+// OBSOLETE st %r5, [%sp + (24 + 93) * 4] ! AWR5
+// OBSOLETE st %r6, [%sp + (24 + 94) * 4] ! AWR6
+// OBSOLETE st %r7, [%sp + (24 + 95) * 4] ! AWR7
+// OBSOLETE st %r8, [%sp + (24 + 96) * 4] ! AWR8
+// OBSOLETE st %r9, [%sp + (24 + 97) * 4] ! AWR9
+// OBSOLETE st %r10, [%sp + (24 + 98) * 4] ! AWR10
+// OBSOLETE st %r11, [%sp + (24 + 99) * 4] ! AWR11
+// OBSOLETE st %r12, [%sp + (24 + 100) * 4] ! AWR12
+// OBSOLETE st %r13, [%sp + (24 + 101) * 4] ! AWR13
+// OBSOLETE ! st %r14, [%sp + (24 + 102) * 4] ! AWR14 (SP)
+// OBSOLETE st %r15, [%sp + (24 + 103) * 4] ! AWR15
+// OBSOLETE st %r16, [%sp + (24 + 104) * 4] ! AWR16
+// OBSOLETE st %r17, [%sp + (24 + 105) * 4] ! AWR17
+// OBSOLETE st %r18, [%sp + (24 + 106) * 4] ! AWR18
+// OBSOLETE st %r19, [%sp + (24 + 107) * 4] ! AWR19
+// OBSOLETE st %r20, [%sp + (24 + 108) * 4] ! AWR20
+// OBSOLETE st %r21, [%sp + (24 + 109) * 4] ! AWR21
+// OBSOLETE st %r22, [%sp + (24 + 110) * 4] ! AWR22
+// OBSOLETE st %r23, [%sp + (24 + 111) * 4] ! AWR23
+// OBSOLETE st %r24, [%sp + (24 + 112) * 4] ! AWR24
+// OBSOLETE st %r25, [%sp + (24 + 113) * 4] ! AWR25
+// OBSOLETE st %r26, [%sp + (24 + 114) * 4] ! AWR26
+// OBSOLETE st %r27, [%sp + (24 + 115) * 4] ! AWR27
+// OBSOLETE st %r28, [%sp + (24 + 116) * 4] ! AWR28
+// OBSOLETE st %r29, [%sp + (24 + 117) * 4] ! AWR29
+// OBSOLETE st %r30, [%sp + (24 + 118) * 4] ! AWR30
+// OBSOLETE st %r31, [%sp + (24 + 119) * 4] ! AWR21
+// OBSOLETE
+// OBSOLETE ! Get the Alternate PSR (I hope...)
+// OBSOLETE
+// OBSOLETE rd %psr, %l2
+// OBSOLETE st %l2, [%sp + (24 + 120) * 4] ! APSR
+// OBSOLETE
+// OBSOLETE ! Don't forget the alternate stack pointer
+// OBSOLETE
+// OBSOLETE rd %y, %l3
+// OBSOLETE st %l3, [%sp + (24 + 102) * 4] ! AWR14 (SP)
+// OBSOLETE
+// OBSOLETE ! 6) Restore the Alternate SP (saved in Y)
+// OBSOLETE
+// OBSOLETE rd %y, %o6
+// OBSOLETE
+// OBSOLETE
+// OBSOLETE ! 7) Swap the registers back:
+// OBSOLETE
+// OBSOLETE mov %psr, %l1
+// OBSOLETE sethi %hi(0x10000), %l2
+// OBSOLETE xor %l1, %l2, %l1
+// OBSOLETE mov %l1, %psr
+// OBSOLETE nop ! 3 nops after write to %psr (needed?)
+// OBSOLETE nop
+// OBSOLETE nop
+// OBSOLETE ");
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE #endif
diff --git a/gdb/srec.h b/gdb/srec.h
index d2d9876..8189a9b 100644
--- a/gdb/srec.h
+++ b/gdb/srec.h
@@ -18,6 +18,8 @@
Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
+struct serial;
+
void load_srec (struct serial *desc, const char *file, bfd_vma load_offset,
int maxrecsize, int flags, int hashmark,
int (*waitack) (void));
diff --git a/gdb/stabsread.h b/gdb/stabsread.h
index 62fd776..b70f162 100644
--- a/gdb/stabsread.h
+++ b/gdb/stabsread.h
@@ -19,6 +19,8 @@
Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
+struct objfile;
+
/* Definitions, prototypes, etc for stabs debugging format support
functions.
diff --git a/gdb/stack.c b/gdb/stack.c
index d8ac980..d0dbc59 100644
--- a/gdb/stack.c
+++ b/gdb/stack.c
@@ -217,7 +217,7 @@ print_frame_info (struct frame_info *fi, int level, int source, int args)
if (ui_out_is_mi_like_p (uiout))
{
annotate_frame_address ();
- ui_out_field_core_addr (uiout, "addr", fi->pc);
+ ui_out_field_core_addr (uiout, "addr", get_frame_pc (fi));
annotate_frame_address_end ();
}
@@ -601,16 +601,6 @@ parse_frame_specification (char *frame_exp)
/* NOTREACHED */
}
-/* FRAME_ARGS_ADDRESS_CORRECT is just like FRAME_ARGS_ADDRESS except
- that if it is unsure about the answer, it returns 0
- instead of guessing (this happens on the VAX and i960, for example).
-
- On most machines, we never have to guess about the args address,
- so FRAME_ARGS_ADDRESS{,_CORRECT} are the same. */
-#if !defined (FRAME_ARGS_ADDRESS_CORRECT)
-#define FRAME_ARGS_ADDRESS_CORRECT FRAME_ARGS_ADDRESS
-#endif
-
/* Print verbosely the selected frame or the frame at address ADDR.
This means absolutely all information in the frame is printed. */
@@ -744,7 +734,7 @@ frame_info (char *addr_exp, int from_tty)
{
/* Address of the argument list for this frame, or 0. */
- CORE_ADDR arg_list = FRAME_ARGS_ADDRESS_CORRECT (fi);
+ CORE_ADDR arg_list = get_frame_args_address (fi);
/* Number of args for this frame, or -1 if unknown. */
int numargs;
@@ -771,7 +761,7 @@ frame_info (char *addr_exp, int from_tty)
}
{
/* Address of the local variables for this frame, or 0. */
- CORE_ADDR arg_list = FRAME_LOCALS_ADDRESS (fi);
+ CORE_ADDR arg_list = get_frame_locals_address (fi);
if (arg_list == 0)
printf_filtered (" Locals at unknown address,");
@@ -1641,9 +1631,13 @@ return_command (char *retval_exp, int from_tty)
that. */
/* Do the real work. Pop until the specified frame is current. We
- use this method because the deprecated_selected_frame is not valid after
- a POP_FRAME. The pc comparison makes this work even if the
- selected frame shares its fp with another frame. */
+ use this method because the deprecated_selected_frame is not
+ valid after a frame_pop(). The pc comparison makes this work
+ even if the selected frame shares its fp with another frame. */
+
+ /* FIXME: cagney/32003-03-12: This code should use frame_id_eq().
+ Unfortunatly, that function doesn't yet include the PC in any
+ frame ID comparison. */
while (selected_frame_addr != get_frame_base (frame = get_current_frame ())
|| selected_frame_pc != get_frame_pc (frame))
diff --git a/gdb/symfile.c b/gdb/symfile.c
index 69c07f0..aa831fb 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -3550,7 +3550,7 @@ symfile_relocate_debug_section (bfd *abfd, asection *sectp, bfd_byte *buf)
all sections begin at 0. */
bfd_map_over_sections (abfd, symfile_dummy_outputs, NULL);
- return bfd_simple_get_relocated_section_contents (abfd, sectp, buf);
+ return bfd_simple_get_relocated_section_contents (abfd, sectp, buf, NULL);
}
void
diff --git a/gdb/symfile.h b/gdb/symfile.h
index 3c055c0..06dfd7d 100644
--- a/gdb/symfile.h
+++ b/gdb/symfile.h
@@ -26,7 +26,7 @@
/* This file requires that you first include "bfd.h" and "symtab.h". */
/* Opaque declarations. */
-
+struct objfile;
struct obstack;
struct block;
diff --git a/gdb/symm-nat.c b/gdb/symm-nat.c
index 79caf5a..c4b2c9a 100644
--- a/gdb/symm-nat.c
+++ b/gdb/symm-nat.c
@@ -1,902 +1,902 @@
-/* Sequent Symmetry host interface, for GDB when running under Unix.
-
- Copyright 1986, 1987, 1989, 1991, 1992, 1993, 1994, 1995, 1999,
- 2000, 2001, 2003 Free Software Foundation, Inc.
-
- This file is part of GDB.
-
- 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.
-
- 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.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-
-/* FIXME, some 387-specific items of use taken from i387-tdep.c -- ought to be
- merged back in. */
-
-#include "defs.h"
-#include "frame.h"
-#include "inferior.h"
-#include "symtab.h"
-#include "target.h"
-#include "regcache.h"
-
-/* FIXME: What is the _INKERNEL define for? */
-#define _INKERNEL
-#include <signal.h>
-#undef _INKERNEL
-#include "gdb_wait.h"
-#include <sys/param.h>
-#include <sys/user.h>
-#include <sys/proc.h>
-#include <sys/dir.h>
-#include <sys/ioctl.h>
-#include "gdb_stat.h"
-#ifdef _SEQUENT_
-#include <sys/ptrace.h>
-#else
-/* Dynix has only machine/ptrace.h, which is already included by sys/user.h */
-/* Dynix has no mptrace call */
-#define mptrace ptrace
-#endif
-#include "gdbcore.h"
-#include <fcntl.h>
-#include <sgtty.h>
-#define TERMINAL struct sgttyb
-
-#include "gdbcore.h"
-
-void
-store_inferior_registers (int regno)
-{
- struct pt_regset regs;
- int i;
-
- /* FIXME: Fetching the registers is a kludge to initialize all elements
- in the fpu and fpa status. This works for normal debugging, but
- might cause problems when calling functions in the inferior.
- At least fpu_control and fpa_pcr (probably more) should be added
- to the registers array to solve this properly. */
- mptrace (XPT_RREGS, PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) & regs, 0);
-
- regs.pr_eax = *(int *) &deprecated_registers[REGISTER_BYTE (0)];
- regs.pr_ebx = *(int *) &deprecated_registers[REGISTER_BYTE (5)];
- regs.pr_ecx = *(int *) &deprecated_registers[REGISTER_BYTE (2)];
- regs.pr_edx = *(int *) &deprecated_registers[REGISTER_BYTE (1)];
- regs.pr_esi = *(int *) &deprecated_registers[REGISTER_BYTE (6)];
- regs.pr_edi = *(int *) &deprecated_registers[REGISTER_BYTE (7)];
- regs.pr_esp = *(int *) &deprecated_registers[REGISTER_BYTE (14)];
- regs.pr_ebp = *(int *) &deprecated_registers[REGISTER_BYTE (15)];
- regs.pr_eip = *(int *) &deprecated_registers[REGISTER_BYTE (16)];
- regs.pr_flags = *(int *) &deprecated_registers[REGISTER_BYTE (17)];
- for (i = 0; i < 31; i++)
- {
- regs.pr_fpa.fpa_regs[i] =
- *(int *) &deprecated_registers[REGISTER_BYTE (FP1_REGNUM + i)];
- }
- memcpy (regs.pr_fpu.fpu_stack[0], &deprecated_registers[REGISTER_BYTE (ST0_REGNUM)], 10);
- memcpy (regs.pr_fpu.fpu_stack[1], &deprecated_registers[REGISTER_BYTE (ST1_REGNUM)], 10);
- memcpy (regs.pr_fpu.fpu_stack[2], &deprecated_registers[REGISTER_BYTE (ST2_REGNUM)], 10);
- memcpy (regs.pr_fpu.fpu_stack[3], &deprecated_registers[REGISTER_BYTE (ST3_REGNUM)], 10);
- memcpy (regs.pr_fpu.fpu_stack[4], &deprecated_registers[REGISTER_BYTE (ST4_REGNUM)], 10);
- memcpy (regs.pr_fpu.fpu_stack[5], &deprecated_registers[REGISTER_BYTE (ST5_REGNUM)], 10);
- memcpy (regs.pr_fpu.fpu_stack[6], &deprecated_registers[REGISTER_BYTE (ST6_REGNUM)], 10);
- memcpy (regs.pr_fpu.fpu_stack[7], &deprecated_registers[REGISTER_BYTE (ST7_REGNUM)], 10);
- mptrace (XPT_WREGS, PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) & regs, 0);
-}
-
-void
-fetch_inferior_registers (int regno)
-{
- int i;
- struct pt_regset regs;
-
- deprecated_registers_fetched ();
-
- mptrace (XPT_RREGS, PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) & regs, 0);
- *(int *) &deprecated_registers[REGISTER_BYTE (EAX_REGNUM)] = regs.pr_eax;
- *(int *) &rdeprecated_egisters[REGISTER_BYTE (EBX_REGNUM)] = regs.pr_ebx;
- *(int *) &deprecated_registers[REGISTER_BYTE (ECX_REGNUM)] = regs.pr_ecx;
- *(int *) &deprecated_registers[REGISTER_BYTE (EDX_REGNUM)] = regs.pr_edx;
- *(int *) &deprecated_registers[REGISTER_BYTE (ESI_REGNUM)] = regs.pr_esi;
- *(int *) &deprecated_registers[REGISTER_BYTE (EDI_REGNUM)] = regs.pr_edi;
- *(int *) &deprecated_registers[REGISTER_BYTE (EBP_REGNUM)] = regs.pr_ebp;
- *(int *) &deprecated_registers[REGISTER_BYTE (ESP_REGNUM)] = regs.pr_esp;
- *(int *) &deprecated_registers[REGISTER_BYTE (EIP_REGNUM)] = regs.pr_eip;
- *(int *) &deprecated_registers[REGISTER_BYTE (EFLAGS_REGNUM)] = regs.pr_flags;
- for (i = 0; i < FPA_NREGS; i++)
- {
- *(int *) &deprecated_registers[REGISTER_BYTE (FP1_REGNUM + i)] =
- regs.pr_fpa.fpa_regs[i];
- }
- memcpy (&deprecated_registers[REGISTER_BYTE (ST0_REGNUM)], regs.pr_fpu.fpu_stack[0], 10);
- memcpy (&deprecated_registers[REGISTER_BYTE (ST1_REGNUM)], regs.pr_fpu.fpu_stack[1], 10);
- memcpy (&deprecated_registers[REGISTER_BYTE (ST2_REGNUM)], regs.pr_fpu.fpu_stack[2], 10);
- memcpy (&deprecated_registers[REGISTER_BYTE (ST3_REGNUM)], regs.pr_fpu.fpu_stack[3], 10);
- memcpy (&deprecated_registers[REGISTER_BYTE (ST4_REGNUM)], regs.pr_fpu.fpu_stack[4], 10);
- memcpy (&deprecated_registers[REGISTER_BYTE (ST5_REGNUM)], regs.pr_fpu.fpu_stack[5], 10);
- memcpy (&deprecated_registers[REGISTER_BYTE (ST6_REGNUM)], regs.pr_fpu.fpu_stack[6], 10);
- memcpy (&deprecated_registers[REGISTER_BYTE (ST7_REGNUM)], regs.pr_fpu.fpu_stack[7], 10);
-}
-
-/* FIXME: This should be merged with i387-tdep.c as well. */
-static
-print_fpu_status (struct pt_regset ep)
-{
- int i;
- int bothstatus;
- int top;
- int fpreg;
- unsigned char *p;
-
- printf_unfiltered ("80387:");
- if (ep.pr_fpu.fpu_ip == 0)
- {
- printf_unfiltered (" not in use.\n");
- return;
- }
- else
- {
- printf_unfiltered ("\n");
- }
- if (ep.pr_fpu.fpu_status != 0)
- {
- print_387_status_word (ep.pr_fpu.fpu_status);
- }
- print_387_control_word (ep.pr_fpu.fpu_control);
- printf_unfiltered ("last exception: ");
- printf_unfiltered ("opcode 0x%x; ", ep.pr_fpu.fpu_rsvd4);
- printf_unfiltered ("pc 0x%x:0x%x; ", ep.pr_fpu.fpu_cs, ep.pr_fpu.fpu_ip);
- printf_unfiltered ("operand 0x%x:0x%x\n", ep.pr_fpu.fpu_data_offset, ep.pr_fpu.fpu_op_sel);
-
- top = (ep.pr_fpu.fpu_status >> 11) & 7;
-
- printf_unfiltered ("regno tag msb lsb value\n");
- for (fpreg = 7; fpreg >= 0; fpreg--)
- {
- double val;
-
- printf_unfiltered ("%s %d: ", fpreg == top ? "=>" : " ", fpreg);
-
- switch ((ep.pr_fpu.fpu_tag >> (fpreg * 2)) & 3)
- {
- case 0:
- printf_unfiltered ("valid ");
- break;
- case 1:
- printf_unfiltered ("zero ");
- break;
- case 2:
- printf_unfiltered ("trap ");
- break;
- case 3:
- printf_unfiltered ("empty ");
- break;
- }
- for (i = 9; i >= 0; i--)
- printf_unfiltered ("%02x", ep.pr_fpu.fpu_stack[fpreg][i]);
-
- i387_to_double ((char *) ep.pr_fpu.fpu_stack[fpreg], (char *) &val);
- printf_unfiltered (" %g\n", val);
- }
- if (ep.pr_fpu.fpu_rsvd1)
- warning ("rsvd1 is 0x%x\n", ep.pr_fpu.fpu_rsvd1);
- if (ep.pr_fpu.fpu_rsvd2)
- warning ("rsvd2 is 0x%x\n", ep.pr_fpu.fpu_rsvd2);
- if (ep.pr_fpu.fpu_rsvd3)
- warning ("rsvd3 is 0x%x\n", ep.pr_fpu.fpu_rsvd3);
- if (ep.pr_fpu.fpu_rsvd5)
- warning ("rsvd5 is 0x%x\n", ep.pr_fpu.fpu_rsvd5);
-}
-
-
-print_1167_control_word (unsigned int pcr)
-{
- int pcr_tmp;
-
- pcr_tmp = pcr & FPA_PCR_MODE;
- printf_unfiltered ("\tMODE= %#x; RND= %#x ", pcr_tmp, pcr_tmp & 12);
- switch (pcr_tmp & 12)
- {
- case 0:
- printf_unfiltered ("RN (Nearest Value)");
- break;
- case 1:
- printf_unfiltered ("RZ (Zero)");
- break;
- case 2:
- printf_unfiltered ("RP (Positive Infinity)");
- break;
- case 3:
- printf_unfiltered ("RM (Negative Infinity)");
- break;
- }
- printf_unfiltered ("; IRND= %d ", pcr_tmp & 2);
- if (0 == pcr_tmp & 2)
- {
- printf_unfiltered ("(same as RND)\n");
- }
- else
- {
- printf_unfiltered ("(toward zero)\n");
- }
- pcr_tmp = pcr & FPA_PCR_EM;
- printf_unfiltered ("\tEM= %#x", pcr_tmp);
- if (pcr_tmp & FPA_PCR_EM_DM)
- printf_unfiltered (" DM");
- if (pcr_tmp & FPA_PCR_EM_UOM)
- printf_unfiltered (" UOM");
- if (pcr_tmp & FPA_PCR_EM_PM)
- printf_unfiltered (" PM");
- if (pcr_tmp & FPA_PCR_EM_UM)
- printf_unfiltered (" UM");
- if (pcr_tmp & FPA_PCR_EM_OM)
- printf_unfiltered (" OM");
- if (pcr_tmp & FPA_PCR_EM_ZM)
- printf_unfiltered (" ZM");
- if (pcr_tmp & FPA_PCR_EM_IM)
- printf_unfiltered (" IM");
- printf_unfiltered ("\n");
- pcr_tmp = FPA_PCR_CC;
- printf_unfiltered ("\tCC= %#x", pcr_tmp);
- if (pcr_tmp & FPA_PCR_20MHZ)
- printf_unfiltered (" 20MHZ");
- if (pcr_tmp & FPA_PCR_CC_Z)
- printf_unfiltered (" Z");
- if (pcr_tmp & FPA_PCR_CC_C2)
- printf_unfiltered (" C2");
-
- /* Dynix defines FPA_PCR_CC_C0 to 0x100 and ptx defines
- FPA_PCR_CC_C1 to 0x100. Use whichever is defined and assume
- the OS knows what it is doing. */
-#ifdef FPA_PCR_CC_C1
- if (pcr_tmp & FPA_PCR_CC_C1)
- printf_unfiltered (" C1");
-#else
- if (pcr_tmp & FPA_PCR_CC_C0)
- printf_unfiltered (" C0");
-#endif
-
- switch (pcr_tmp)
- {
- case FPA_PCR_CC_Z:
- printf_unfiltered (" (Equal)");
- break;
-#ifdef FPA_PCR_CC_C1
- case FPA_PCR_CC_C1:
-#else
- case FPA_PCR_CC_C0:
-#endif
- printf_unfiltered (" (Less than)");
- break;
- case 0:
- printf_unfiltered (" (Greater than)");
- break;
- case FPA_PCR_CC_Z |
-#ifdef FPA_PCR_CC_C1
- FPA_PCR_CC_C1
-#else
- FPA_PCR_CC_C0
-#endif
- | FPA_PCR_CC_C2:
- printf_unfiltered (" (Unordered)");
- break;
- default:
- printf_unfiltered (" (Undefined)");
- break;
- }
- printf_unfiltered ("\n");
- pcr_tmp = pcr & FPA_PCR_AE;
- printf_unfiltered ("\tAE= %#x", pcr_tmp);
- if (pcr_tmp & FPA_PCR_AE_DE)
- printf_unfiltered (" DE");
- if (pcr_tmp & FPA_PCR_AE_UOE)
- printf_unfiltered (" UOE");
- if (pcr_tmp & FPA_PCR_AE_PE)
- printf_unfiltered (" PE");
- if (pcr_tmp & FPA_PCR_AE_UE)
- printf_unfiltered (" UE");
- if (pcr_tmp & FPA_PCR_AE_OE)
- printf_unfiltered (" OE");
- if (pcr_tmp & FPA_PCR_AE_ZE)
- printf_unfiltered (" ZE");
- if (pcr_tmp & FPA_PCR_AE_EE)
- printf_unfiltered (" EE");
- if (pcr_tmp & FPA_PCR_AE_IE)
- printf_unfiltered (" IE");
- printf_unfiltered ("\n");
-}
-
-print_1167_regs (long regs[FPA_NREGS])
-{
- int i;
-
- union
- {
- double d;
- long l[2];
- }
- xd;
- union
- {
- float f;
- long l;
- }
- xf;
-
-
- for (i = 0; i < FPA_NREGS; i++)
- {
- xf.l = regs[i];
- printf_unfiltered ("%%fp%d: raw= %#x, single= %f", i + 1, regs[i], xf.f);
- if (!(i & 1))
- {
- printf_unfiltered ("\n");
- }
- else
- {
- xd.l[1] = regs[i];
- xd.l[0] = regs[i + 1];
- printf_unfiltered (", double= %f\n", xd.d);
- }
- }
-}
-
-print_fpa_status (struct pt_regset ep)
-{
-
- printf_unfiltered ("WTL 1167:");
- if (ep.pr_fpa.fpa_pcr != 0)
- {
- printf_unfiltered ("\n");
- print_1167_control_word (ep.pr_fpa.fpa_pcr);
- print_1167_regs (ep.pr_fpa.fpa_regs);
- }
- else
- {
- printf_unfiltered (" not in use.\n");
- }
-}
-
-#if 0 /* disabled because it doesn't go through the target vector. */
-i386_float_info (void)
-{
- char ubuf[UPAGES * NBPG];
- struct pt_regset regset;
-
- if (have_inferior_p ())
- {
- PTRACE_READ_REGS (PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) & regset);
- }
- else
- {
- int corechan = bfd_cache_lookup (core_bfd);
- if (lseek (corechan, 0, 0) < 0)
- {
- perror ("seek on core file");
- }
- if (myread (corechan, ubuf, UPAGES * NBPG) < 0)
- {
- perror ("read on core file");
- }
- /* only interested in the floating point registers */
- regset.pr_fpu = ((struct user *) ubuf)->u_fpusave;
- regset.pr_fpa = ((struct user *) ubuf)->u_fpasave;
- }
- print_fpu_status (regset);
- print_fpa_status (regset);
-}
-#endif
-
-static volatile int got_sigchld;
-
-/*ARGSUSED */
-/* This will eventually be more interesting. */
-void
-sigchld_handler (int signo)
-{
- got_sigchld++;
-}
-
-/*
- * Signals for which the default action does not cause the process
- * to die. See <sys/signal.h> for where this came from (alas, we
- * can't use those macros directly)
- */
-#ifndef sigmask
-#define sigmask(s) (1 << ((s) - 1))
-#endif
-#define SIGNALS_DFL_SAFE sigmask(SIGSTOP) | sigmask(SIGTSTP) | \
- sigmask(SIGTTIN) | sigmask(SIGTTOU) | sigmask(SIGCHLD) | \
- sigmask(SIGCONT) | sigmask(SIGWINCH) | sigmask(SIGPWR) | \
- sigmask(SIGURG) | sigmask(SIGPOLL)
-
-#ifdef ATTACH_DETACH
-/*
- * Thanks to XPT_MPDEBUGGER, we have to mange child_wait().
- */
-ptid_t
-child_wait (ptid_t ptid, struct target_waitstatus *status)
-{
- int save_errno, rv, xvaloff, saoff, sa_hand;
- struct pt_stop pt;
- struct user u;
- sigset_t set;
- /* Host signal number for a signal which the inferior terminates with, or
- 0 if it hasn't terminated due to a signal. */
- static int death_by_signal = 0;
-#ifdef SVR4_SHARED_LIBS /* use this to distinguish ptx 2 vs ptx 4 */
- prstatus_t pstatus;
-#endif
- int pid = PIDGET (ptid);
-
- do
- {
- set_sigint_trap (); /* Causes SIGINT to be passed on to the
- attached process. */
- save_errno = errno;
-
- got_sigchld = 0;
-
- sigemptyset (&set);
-
- while (got_sigchld == 0)
- {
- sigsuspend (&set);
- }
-
- clear_sigint_trap ();
-
- rv = mptrace (XPT_STOPSTAT, 0, (char *) &pt, 0);
- if (-1 == rv)
- {
- printf ("XPT_STOPSTAT: errno %d\n", errno); /* DEBUG */
- continue;
- }
-
- pid = pt.ps_pid;
-
- if (pid != PIDGET (inferior_ptid))
- {
- /* NOTE: the mystery fork in csh/tcsh needs to be ignored.
- * We should not return new children for the initial run
- * of a process until it has done the exec.
- */
- /* inferior probably forked; send it on its way */
- rv = mptrace (XPT_UNDEBUG, pid, 0, 0);
- if (-1 == rv)
- {
- printf ("child_wait: XPT_UNDEBUG: pid %d: %s\n", pid,
- safe_strerror (errno));
- }
- continue;
- }
- /* FIXME: Do we deal with fork notification correctly? */
- switch (pt.ps_reason)
- {
- case PTS_FORK:
- /* multi proc: treat like PTS_EXEC */
- /*
- * Pretend this didn't happen, since gdb isn't set up
- * to deal with stops on fork.
- */
- rv = ptrace (PT_CONTSIG, pid, 1, 0);
- if (-1 == rv)
- {
- printf ("PTS_FORK: PT_CONTSIG: error %d\n", errno);
- }
- continue;
- case PTS_EXEC:
- /*
- * Pretend this is a SIGTRAP.
- */
- status->kind = TARGET_WAITKIND_STOPPED;
- status->value.sig = TARGET_SIGNAL_TRAP;
- break;
- case PTS_EXIT:
- /*
- * Note: we stop before the exit actually occurs. Extract
- * the exit code from the uarea. If we're stopped in the
- * exit() system call, the exit code will be in
- * u.u_ap[0]. An exit due to an uncaught signal will have
- * something else in here, see the comment in the default:
- * case, below. Finally,let the process exit.
- */
- if (death_by_signal)
- {
- status->kind = TARGET_WAITKIND_SIGNALED;
- status->value.sig = target_signal_from_host (death_by_signal);
- death_by_signal = 0;
- break;
- }
- xvaloff = (unsigned long) &u.u_ap[0] - (unsigned long) &u;
- errno = 0;
- rv = ptrace (PT_RUSER, pid, (char *) xvaloff, 0);
- status->kind = TARGET_WAITKIND_EXITED;
- status->value.integer = rv;
- /*
- * addr & data to mptrace() don't matter here, since
- * the process is already dead.
- */
- rv = mptrace (XPT_UNDEBUG, pid, 0, 0);
- if (-1 == rv)
- {
- printf ("child_wait: PTS_EXIT: XPT_UNDEBUG: pid %d error %d\n", pid,
- errno);
- }
- break;
- case PTS_WATCHPT_HIT:
- internal_error (__FILE__, __LINE__,
- "PTS_WATCHPT_HIT\n");
- break;
- default:
- /* stopped by signal */
- status->kind = TARGET_WAITKIND_STOPPED;
- status->value.sig = target_signal_from_host (pt.ps_reason);
- death_by_signal = 0;
-
- if (0 == (SIGNALS_DFL_SAFE & sigmask (pt.ps_reason)))
- {
- break;
- }
- /* else default action of signal is to die */
-#ifdef SVR4_SHARED_LIBS
- rv = ptrace (PT_GET_PRSTATUS, pid, (char *) &pstatus, 0);
- if (-1 == rv)
- error ("child_wait: signal %d PT_GET_PRSTATUS: %s\n",
- pt.ps_reason, safe_strerror (errno));
- if (pstatus.pr_cursig != pt.ps_reason)
- {
- printf ("pstatus signal %d, pt signal %d\n",
- pstatus.pr_cursig, pt.ps_reason);
- }
- sa_hand = (int) pstatus.pr_action.sa_handler;
-#else
- saoff = (unsigned long) &u.u_sa[0] - (unsigned long) &u;
- saoff += sizeof (struct sigaction) * (pt.ps_reason - 1);
- errno = 0;
- sa_hand = ptrace (PT_RUSER, pid, (char *) saoff, 0);
- if (errno)
- error ("child_wait: signal %d: RUSER: %s\n",
- pt.ps_reason, safe_strerror (errno));
-#endif
- if ((int) SIG_DFL == sa_hand)
- {
- /* we will be dying */
- death_by_signal = pt.ps_reason;
- }
- break;
- }
-
- }
- while (pid != PIDGET (inferior_ptid)); /* Some other child died or stopped */
-
- return pid_to_ptid (pid);
-}
-#else /* !ATTACH_DETACH */
-/*
- * Simple child_wait() based on inftarg.c child_wait() for use until
- * the MPDEBUGGER child_wait() works properly. This will go away when
- * that is fixed.
- */
-ptid_t
-child_wait (ptid_t ptid, struct target_waitstatus *ourstatus)
-{
- int save_errno;
- int status;
- int pid = PIDGET (ptid);
-
- do
- {
- pid = wait (&status);
- save_errno = errno;
-
- if (pid == -1)
- {
- if (save_errno == EINTR)
- continue;
- fprintf (stderr, "Child process unexpectedly missing: %s.\n",
- safe_strerror (save_errno));
- ourstatus->kind = TARGET_WAITKIND_SIGNALLED;
- ourstatus->value.sig = TARGET_SIGNAL_UNKNOWN;
- return pid_to_ptid (-1);
- }
- }
- while (pid != PIDGET (inferior_ptid)); /* Some other child died or stopped */
- store_waitstatus (ourstatus, status);
- return pid_to_ptid (pid);
-}
-#endif /* ATTACH_DETACH */
-
-
-
-/* This function simply calls ptrace with the given arguments.
- It exists so that all calls to ptrace are isolated in this
- machine-dependent file. */
-int
-call_ptrace (int request, int pid, PTRACE_ARG3_TYPE addr, int data)
-{
- return ptrace (request, pid, addr, data);
-}
-
-int
-call_mptrace (int request, int pid, PTRACE_ARG3_TYPE addr, int data)
-{
- return mptrace (request, pid, addr, data);
-}
-
-#if defined (DEBUG_PTRACE)
-/* For the rest of the file, use an extra level of indirection */
-/* This lets us breakpoint usefully on call_ptrace. */
-#define ptrace call_ptrace
-#define mptrace call_mptrace
-#endif
-
-void
-kill_inferior (void)
-{
- if (ptid_equal (inferior_ptid, null_ptid))
- return;
-
- /* For MPDEBUGGER, don't use PT_KILL, since the child will stop
- again with a PTS_EXIT. Just hit him with SIGKILL (so he stops)
- and detach. */
-
- kill (PIDGET (inferior_ptid), SIGKILL);
-#ifdef ATTACH_DETACH
- detach (SIGKILL);
-#else /* ATTACH_DETACH */
- ptrace (PT_KILL, PIDGET (inferior_ptid), 0, 0);
- wait ((int *) NULL);
-#endif /* ATTACH_DETACH */
- target_mourn_inferior ();
-}
-
-/* Resume execution of the inferior process.
- If STEP is nonzero, single-step it.
- If SIGNAL is nonzero, give it that signal. */
-
-void
-child_resume (ptid_t ptid, int step, enum target_signal signal)
-{
- int pid = PIDGET (ptid);
-
- errno = 0;
-
- if (pid == -1)
- pid = PIDGET (inferior_ptid);
-
- /* An address of (PTRACE_ARG3_TYPE)1 tells ptrace to continue from where
- it was. (If GDB wanted it to start some other way, we have already
- written a new PC value to the child.)
-
- If this system does not support PT_SSTEP, a higher level function will
- have called single_step() to transmute the step request into a
- continue request (by setting breakpoints on all possible successor
- instructions), so we don't have to worry about that here. */
-
- if (step)
- ptrace (PT_SSTEP, pid, (PTRACE_ARG3_TYPE) 1, signal);
- else
- ptrace (PT_CONTSIG, pid, (PTRACE_ARG3_TYPE) 1, signal);
-
- if (errno)
- perror_with_name ("ptrace");
-}
-
-#ifdef ATTACH_DETACH
-/* Start debugging the process whose number is PID. */
-int
-attach (int pid)
-{
- sigset_t set;
- int rv;
-
- rv = mptrace (XPT_DEBUG, pid, 0, 0);
- if (-1 == rv)
- {
- error ("mptrace(XPT_DEBUG): %s", safe_strerror (errno));
- }
- rv = mptrace (XPT_SIGNAL, pid, 0, SIGSTOP);
- if (-1 == rv)
- {
- error ("mptrace(XPT_SIGNAL): %s", safe_strerror (errno));
- }
- attach_flag = 1;
- return pid;
-}
-
-void
-detach (int signo)
-{
- int rv;
-
- rv = mptrace (XPT_UNDEBUG, PIDGET (inferior_ptid), 1, signo);
- if (-1 == rv)
- {
- error ("mptrace(XPT_UNDEBUG): %s", safe_strerror (errno));
- }
- attach_flag = 0;
-}
-
-#endif /* ATTACH_DETACH */
-
-/* Default the type of the ptrace transfer to int. */
-#ifndef PTRACE_XFER_TYPE
-#define PTRACE_XFER_TYPE int
-#endif
-
-
-/* NOTE! I tried using PTRACE_READDATA, etc., to read and write memory
- in the NEW_SUN_PTRACE case.
- It ought to be straightforward. But it appears that writing did
- not write the data that I specified. I cannot understand where
- it got the data that it actually did write. */
-
-/* Copy LEN bytes to or from inferior's memory starting at MEMADDR
- to debugger memory starting at MYADDR. Copy to inferior if
- WRITE is nonzero. TARGET is ignored.
-
- Returns the length copied, which is either the LEN argument or zero.
- This xfer function does not do partial moves, since child_ops
- doesn't allow memory operations to cross below us in the target stack
- anyway. */
-
-int
-child_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write,
- struct mem_attrib *attrib,
- struct target_ops *target)
-{
- register int i;
- /* Round starting address down to longword boundary. */
- register CORE_ADDR addr = memaddr & -(CORE_ADDR) sizeof (PTRACE_XFER_TYPE);
- /* Round ending address up; get number of longwords that makes. */
- register int count
- = (((memaddr + len) - addr) + sizeof (PTRACE_XFER_TYPE) - 1)
- / sizeof (PTRACE_XFER_TYPE);
- /* Allocate buffer of that many longwords. */
- /* FIXME (alloca): This code, cloned from infptrace.c, is unsafe
- because it uses alloca to allocate a buffer of arbitrary size.
- For very large xfers, this could crash GDB's stack. */
- register PTRACE_XFER_TYPE *buffer
- = (PTRACE_XFER_TYPE *) alloca (count * sizeof (PTRACE_XFER_TYPE));
-
- if (write)
- {
- /* Fill start and end extra bytes of buffer with existing memory data. */
-
- if (addr != memaddr || len < (int) sizeof (PTRACE_XFER_TYPE))
- {
- /* Need part of initial word -- fetch it. */
- buffer[0] = ptrace (PT_RTEXT, PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) addr,
- 0);
- }
-
- if (count > 1) /* FIXME, avoid if even boundary */
- {
- buffer[count - 1]
- = ptrace (PT_RTEXT, PIDGET (inferior_ptid),
- ((PTRACE_ARG3_TYPE)
- (addr + (count - 1) * sizeof (PTRACE_XFER_TYPE))),
- 0);
- }
-
- /* Copy data to be written over corresponding part of buffer */
-
- memcpy ((char *) buffer + (memaddr & (sizeof (PTRACE_XFER_TYPE) - 1)),
- myaddr,
- len);
-
- /* Write the entire buffer. */
-
- for (i = 0; i < count; i++, addr += sizeof (PTRACE_XFER_TYPE))
- {
- errno = 0;
- ptrace (PT_WDATA, PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) addr,
- buffer[i]);
- if (errno)
- {
- /* Using the appropriate one (I or D) is necessary for
- Gould NP1, at least. */
- errno = 0;
- ptrace (PT_WTEXT, PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) addr,
- buffer[i]);
- }
- if (errno)
- return 0;
- }
- }
- else
- {
- /* Read all the longwords */
- for (i = 0; i < count; i++, addr += sizeof (PTRACE_XFER_TYPE))
- {
- errno = 0;
- buffer[i] = ptrace (PT_RTEXT, PIDGET (inferior_ptid),
- (PTRACE_ARG3_TYPE) addr, 0);
- if (errno)
- return 0;
- QUIT;
- }
-
- /* Copy appropriate bytes out of the buffer. */
- memcpy (myaddr,
- (char *) buffer + (memaddr & (sizeof (PTRACE_XFER_TYPE) - 1)),
- len);
- }
- return len;
-}
-
-
-void
-_initialize_symm_nat (void)
-{
-#ifdef ATTACH_DETACH
-/*
- * the MPDEBUGGER is necessary for process tree debugging and attach
- * to work, but it alters the behavior of debugged processes, so other
- * things (at least child_wait()) will have to change to accomodate
- * that.
- *
- * Note that attach is not implemented in dynix 3, and not in ptx
- * until version 2.1 of the OS.
- */
- int rv;
- sigset_t set;
- struct sigaction sact;
-
- rv = mptrace (XPT_MPDEBUGGER, 0, 0, 0);
- if (-1 == rv)
- {
- internal_error (__FILE__, __LINE__,
- "_initialize_symm_nat(): mptrace(XPT_MPDEBUGGER): %s",
- safe_strerror (errno));
- }
-
- /*
- * Under MPDEBUGGER, we get SIGCLHD when a traced process does
- * anything of interest.
- */
-
- /*
- * Block SIGCHLD. We leave it blocked all the time, and then
- * call sigsuspend() in child_wait() to wait for the child
- * to do something. None of these ought to fail, but check anyway.
- */
- sigemptyset (&set);
- rv = sigaddset (&set, SIGCHLD);
- if (-1 == rv)
- {
- internal_error (__FILE__, __LINE__,
- "_initialize_symm_nat(): sigaddset(SIGCHLD): %s",
- safe_strerror (errno));
- }
- rv = sigprocmask (SIG_BLOCK, &set, (sigset_t *) NULL);
- if (-1 == rv)
- {
- internal_error (__FILE__, __LINE__,
- "_initialize_symm_nat(): sigprocmask(SIG_BLOCK): %s",
- safe_strerror (errno));
- }
-
- sact.sa_handler = sigchld_handler;
- sigemptyset (&sact.sa_mask);
- sact.sa_flags = SA_NOCLDWAIT; /* keep the zombies away */
- rv = sigaction (SIGCHLD, &sact, (struct sigaction *) NULL);
- if (-1 == rv)
- {
- internal_error (__FILE__, __LINE__,
- "_initialize_symm_nat(): sigaction(SIGCHLD): %s",
- safe_strerror (errno));
- }
-#endif
-}
+// OBSOLETE /* Sequent Symmetry host interface, for GDB when running under Unix.
+// OBSOLETE
+// OBSOLETE Copyright 1986, 1987, 1989, 1991, 1992, 1993, 1994, 1995, 1999,
+// OBSOLETE 2000, 2001, 2003 Free Software Foundation, Inc.
+// OBSOLETE
+// OBSOLETE This file is part of GDB.
+// OBSOLETE
+// OBSOLETE This program is free software; you can redistribute it and/or modify
+// OBSOLETE it under the terms of the GNU General Public License as published by
+// OBSOLETE the Free Software Foundation; either version 2 of the License, or
+// OBSOLETE (at your option) any later version.
+// OBSOLETE
+// OBSOLETE This program is distributed in the hope that it will be useful,
+// OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of
+// OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// OBSOLETE GNU General Public License for more details.
+// OBSOLETE
+// OBSOLETE You should have received a copy of the GNU General Public License
+// OBSOLETE along with this program; if not, write to the Free Software
+// OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330,
+// OBSOLETE Boston, MA 02111-1307, USA. */
+// OBSOLETE
+// OBSOLETE /* FIXME, some 387-specific items of use taken from i387-tdep.c -- ought to be
+// OBSOLETE merged back in. */
+// OBSOLETE
+// OBSOLETE #include "defs.h"
+// OBSOLETE #include "frame.h"
+// OBSOLETE #include "inferior.h"
+// OBSOLETE #include "symtab.h"
+// OBSOLETE #include "target.h"
+// OBSOLETE #include "regcache.h"
+// OBSOLETE
+// OBSOLETE /* FIXME: What is the _INKERNEL define for? */
+// OBSOLETE #define _INKERNEL
+// OBSOLETE #include <signal.h>
+// OBSOLETE #undef _INKERNEL
+// OBSOLETE #include "gdb_wait.h"
+// OBSOLETE #include <sys/param.h>
+// OBSOLETE #include <sys/user.h>
+// OBSOLETE #include <sys/proc.h>
+// OBSOLETE #include <sys/dir.h>
+// OBSOLETE #include <sys/ioctl.h>
+// OBSOLETE #include "gdb_stat.h"
+// OBSOLETE #ifdef _SEQUENT_
+// OBSOLETE #include <sys/ptrace.h>
+// OBSOLETE #else
+// OBSOLETE /* Dynix has only machine/ptrace.h, which is already included by sys/user.h */
+// OBSOLETE /* Dynix has no mptrace call */
+// OBSOLETE #define mptrace ptrace
+// OBSOLETE #endif
+// OBSOLETE #include "gdbcore.h"
+// OBSOLETE #include <fcntl.h>
+// OBSOLETE #include <sgtty.h>
+// OBSOLETE #define TERMINAL struct sgttyb
+// OBSOLETE
+// OBSOLETE #include "gdbcore.h"
+// OBSOLETE
+// OBSOLETE void
+// OBSOLETE store_inferior_registers (int regno)
+// OBSOLETE {
+// OBSOLETE struct pt_regset regs;
+// OBSOLETE int i;
+// OBSOLETE
+// OBSOLETE /* FIXME: Fetching the registers is a kludge to initialize all elements
+// OBSOLETE in the fpu and fpa status. This works for normal debugging, but
+// OBSOLETE might cause problems when calling functions in the inferior.
+// OBSOLETE At least fpu_control and fpa_pcr (probably more) should be added
+// OBSOLETE to the registers array to solve this properly. */
+// OBSOLETE mptrace (XPT_RREGS, PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) & regs, 0);
+// OBSOLETE
+// OBSOLETE regs.pr_eax = *(int *) &deprecated_registers[REGISTER_BYTE (0)];
+// OBSOLETE regs.pr_ebx = *(int *) &deprecated_registers[REGISTER_BYTE (5)];
+// OBSOLETE regs.pr_ecx = *(int *) &deprecated_registers[REGISTER_BYTE (2)];
+// OBSOLETE regs.pr_edx = *(int *) &deprecated_registers[REGISTER_BYTE (1)];
+// OBSOLETE regs.pr_esi = *(int *) &deprecated_registers[REGISTER_BYTE (6)];
+// OBSOLETE regs.pr_edi = *(int *) &deprecated_registers[REGISTER_BYTE (7)];
+// OBSOLETE regs.pr_esp = *(int *) &deprecated_registers[REGISTER_BYTE (14)];
+// OBSOLETE regs.pr_ebp = *(int *) &deprecated_registers[REGISTER_BYTE (15)];
+// OBSOLETE regs.pr_eip = *(int *) &deprecated_registers[REGISTER_BYTE (16)];
+// OBSOLETE regs.pr_flags = *(int *) &deprecated_registers[REGISTER_BYTE (17)];
+// OBSOLETE for (i = 0; i < 31; i++)
+// OBSOLETE {
+// OBSOLETE regs.pr_fpa.fpa_regs[i] =
+// OBSOLETE *(int *) &deprecated_registers[REGISTER_BYTE (FP1_REGNUM + i)];
+// OBSOLETE }
+// OBSOLETE memcpy (regs.pr_fpu.fpu_stack[0], &deprecated_registers[REGISTER_BYTE (ST0_REGNUM)], 10);
+// OBSOLETE memcpy (regs.pr_fpu.fpu_stack[1], &deprecated_registers[REGISTER_BYTE (ST1_REGNUM)], 10);
+// OBSOLETE memcpy (regs.pr_fpu.fpu_stack[2], &deprecated_registers[REGISTER_BYTE (ST2_REGNUM)], 10);
+// OBSOLETE memcpy (regs.pr_fpu.fpu_stack[3], &deprecated_registers[REGISTER_BYTE (ST3_REGNUM)], 10);
+// OBSOLETE memcpy (regs.pr_fpu.fpu_stack[4], &deprecated_registers[REGISTER_BYTE (ST4_REGNUM)], 10);
+// OBSOLETE memcpy (regs.pr_fpu.fpu_stack[5], &deprecated_registers[REGISTER_BYTE (ST5_REGNUM)], 10);
+// OBSOLETE memcpy (regs.pr_fpu.fpu_stack[6], &deprecated_registers[REGISTER_BYTE (ST6_REGNUM)], 10);
+// OBSOLETE memcpy (regs.pr_fpu.fpu_stack[7], &deprecated_registers[REGISTER_BYTE (ST7_REGNUM)], 10);
+// OBSOLETE mptrace (XPT_WREGS, PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) & regs, 0);
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE void
+// OBSOLETE fetch_inferior_registers (int regno)
+// OBSOLETE {
+// OBSOLETE int i;
+// OBSOLETE struct pt_regset regs;
+// OBSOLETE
+// OBSOLETE deprecated_registers_fetched ();
+// OBSOLETE
+// OBSOLETE mptrace (XPT_RREGS, PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) & regs, 0);
+// OBSOLETE *(int *) &deprecated_registers[REGISTER_BYTE (EAX_REGNUM)] = regs.pr_eax;
+// OBSOLETE *(int *) &rdeprecated_egisters[REGISTER_BYTE (EBX_REGNUM)] = regs.pr_ebx;
+// OBSOLETE *(int *) &deprecated_registers[REGISTER_BYTE (ECX_REGNUM)] = regs.pr_ecx;
+// OBSOLETE *(int *) &deprecated_registers[REGISTER_BYTE (EDX_REGNUM)] = regs.pr_edx;
+// OBSOLETE *(int *) &deprecated_registers[REGISTER_BYTE (ESI_REGNUM)] = regs.pr_esi;
+// OBSOLETE *(int *) &deprecated_registers[REGISTER_BYTE (EDI_REGNUM)] = regs.pr_edi;
+// OBSOLETE *(int *) &deprecated_registers[REGISTER_BYTE (EBP_REGNUM)] = regs.pr_ebp;
+// OBSOLETE *(int *) &deprecated_registers[REGISTER_BYTE (ESP_REGNUM)] = regs.pr_esp;
+// OBSOLETE *(int *) &deprecated_registers[REGISTER_BYTE (EIP_REGNUM)] = regs.pr_eip;
+// OBSOLETE *(int *) &deprecated_registers[REGISTER_BYTE (EFLAGS_REGNUM)] = regs.pr_flags;
+// OBSOLETE for (i = 0; i < FPA_NREGS; i++)
+// OBSOLETE {
+// OBSOLETE *(int *) &deprecated_registers[REGISTER_BYTE (FP1_REGNUM + i)] =
+// OBSOLETE regs.pr_fpa.fpa_regs[i];
+// OBSOLETE }
+// OBSOLETE memcpy (&deprecated_registers[REGISTER_BYTE (ST0_REGNUM)], regs.pr_fpu.fpu_stack[0], 10);
+// OBSOLETE memcpy (&deprecated_registers[REGISTER_BYTE (ST1_REGNUM)], regs.pr_fpu.fpu_stack[1], 10);
+// OBSOLETE memcpy (&deprecated_registers[REGISTER_BYTE (ST2_REGNUM)], regs.pr_fpu.fpu_stack[2], 10);
+// OBSOLETE memcpy (&deprecated_registers[REGISTER_BYTE (ST3_REGNUM)], regs.pr_fpu.fpu_stack[3], 10);
+// OBSOLETE memcpy (&deprecated_registers[REGISTER_BYTE (ST4_REGNUM)], regs.pr_fpu.fpu_stack[4], 10);
+// OBSOLETE memcpy (&deprecated_registers[REGISTER_BYTE (ST5_REGNUM)], regs.pr_fpu.fpu_stack[5], 10);
+// OBSOLETE memcpy (&deprecated_registers[REGISTER_BYTE (ST6_REGNUM)], regs.pr_fpu.fpu_stack[6], 10);
+// OBSOLETE memcpy (&deprecated_registers[REGISTER_BYTE (ST7_REGNUM)], regs.pr_fpu.fpu_stack[7], 10);
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE /* FIXME: This should be merged with i387-tdep.c as well. */
+// OBSOLETE static
+// OBSOLETE print_fpu_status (struct pt_regset ep)
+// OBSOLETE {
+// OBSOLETE int i;
+// OBSOLETE int bothstatus;
+// OBSOLETE int top;
+// OBSOLETE int fpreg;
+// OBSOLETE unsigned char *p;
+// OBSOLETE
+// OBSOLETE printf_unfiltered ("80387:");
+// OBSOLETE if (ep.pr_fpu.fpu_ip == 0)
+// OBSOLETE {
+// OBSOLETE printf_unfiltered (" not in use.\n");
+// OBSOLETE return;
+// OBSOLETE }
+// OBSOLETE else
+// OBSOLETE {
+// OBSOLETE printf_unfiltered ("\n");
+// OBSOLETE }
+// OBSOLETE if (ep.pr_fpu.fpu_status != 0)
+// OBSOLETE {
+// OBSOLETE print_387_status_word (ep.pr_fpu.fpu_status);
+// OBSOLETE }
+// OBSOLETE print_387_control_word (ep.pr_fpu.fpu_control);
+// OBSOLETE printf_unfiltered ("last exception: ");
+// OBSOLETE printf_unfiltered ("opcode 0x%x; ", ep.pr_fpu.fpu_rsvd4);
+// OBSOLETE printf_unfiltered ("pc 0x%x:0x%x; ", ep.pr_fpu.fpu_cs, ep.pr_fpu.fpu_ip);
+// OBSOLETE printf_unfiltered ("operand 0x%x:0x%x\n", ep.pr_fpu.fpu_data_offset, ep.pr_fpu.fpu_op_sel);
+// OBSOLETE
+// OBSOLETE top = (ep.pr_fpu.fpu_status >> 11) & 7;
+// OBSOLETE
+// OBSOLETE printf_unfiltered ("regno tag msb lsb value\n");
+// OBSOLETE for (fpreg = 7; fpreg >= 0; fpreg--)
+// OBSOLETE {
+// OBSOLETE double val;
+// OBSOLETE
+// OBSOLETE printf_unfiltered ("%s %d: ", fpreg == top ? "=>" : " ", fpreg);
+// OBSOLETE
+// OBSOLETE switch ((ep.pr_fpu.fpu_tag >> (fpreg * 2)) & 3)
+// OBSOLETE {
+// OBSOLETE case 0:
+// OBSOLETE printf_unfiltered ("valid ");
+// OBSOLETE break;
+// OBSOLETE case 1:
+// OBSOLETE printf_unfiltered ("zero ");
+// OBSOLETE break;
+// OBSOLETE case 2:
+// OBSOLETE printf_unfiltered ("trap ");
+// OBSOLETE break;
+// OBSOLETE case 3:
+// OBSOLETE printf_unfiltered ("empty ");
+// OBSOLETE break;
+// OBSOLETE }
+// OBSOLETE for (i = 9; i >= 0; i--)
+// OBSOLETE printf_unfiltered ("%02x", ep.pr_fpu.fpu_stack[fpreg][i]);
+// OBSOLETE
+// OBSOLETE i387_to_double ((char *) ep.pr_fpu.fpu_stack[fpreg], (char *) &val);
+// OBSOLETE printf_unfiltered (" %g\n", val);
+// OBSOLETE }
+// OBSOLETE if (ep.pr_fpu.fpu_rsvd1)
+// OBSOLETE warning ("rsvd1 is 0x%x\n", ep.pr_fpu.fpu_rsvd1);
+// OBSOLETE if (ep.pr_fpu.fpu_rsvd2)
+// OBSOLETE warning ("rsvd2 is 0x%x\n", ep.pr_fpu.fpu_rsvd2);
+// OBSOLETE if (ep.pr_fpu.fpu_rsvd3)
+// OBSOLETE warning ("rsvd3 is 0x%x\n", ep.pr_fpu.fpu_rsvd3);
+// OBSOLETE if (ep.pr_fpu.fpu_rsvd5)
+// OBSOLETE warning ("rsvd5 is 0x%x\n", ep.pr_fpu.fpu_rsvd5);
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE
+// OBSOLETE print_1167_control_word (unsigned int pcr)
+// OBSOLETE {
+// OBSOLETE int pcr_tmp;
+// OBSOLETE
+// OBSOLETE pcr_tmp = pcr & FPA_PCR_MODE;
+// OBSOLETE printf_unfiltered ("\tMODE= %#x; RND= %#x ", pcr_tmp, pcr_tmp & 12);
+// OBSOLETE switch (pcr_tmp & 12)
+// OBSOLETE {
+// OBSOLETE case 0:
+// OBSOLETE printf_unfiltered ("RN (Nearest Value)");
+// OBSOLETE break;
+// OBSOLETE case 1:
+// OBSOLETE printf_unfiltered ("RZ (Zero)");
+// OBSOLETE break;
+// OBSOLETE case 2:
+// OBSOLETE printf_unfiltered ("RP (Positive Infinity)");
+// OBSOLETE break;
+// OBSOLETE case 3:
+// OBSOLETE printf_unfiltered ("RM (Negative Infinity)");
+// OBSOLETE break;
+// OBSOLETE }
+// OBSOLETE printf_unfiltered ("; IRND= %d ", pcr_tmp & 2);
+// OBSOLETE if (0 == pcr_tmp & 2)
+// OBSOLETE {
+// OBSOLETE printf_unfiltered ("(same as RND)\n");
+// OBSOLETE }
+// OBSOLETE else
+// OBSOLETE {
+// OBSOLETE printf_unfiltered ("(toward zero)\n");
+// OBSOLETE }
+// OBSOLETE pcr_tmp = pcr & FPA_PCR_EM;
+// OBSOLETE printf_unfiltered ("\tEM= %#x", pcr_tmp);
+// OBSOLETE if (pcr_tmp & FPA_PCR_EM_DM)
+// OBSOLETE printf_unfiltered (" DM");
+// OBSOLETE if (pcr_tmp & FPA_PCR_EM_UOM)
+// OBSOLETE printf_unfiltered (" UOM");
+// OBSOLETE if (pcr_tmp & FPA_PCR_EM_PM)
+// OBSOLETE printf_unfiltered (" PM");
+// OBSOLETE if (pcr_tmp & FPA_PCR_EM_UM)
+// OBSOLETE printf_unfiltered (" UM");
+// OBSOLETE if (pcr_tmp & FPA_PCR_EM_OM)
+// OBSOLETE printf_unfiltered (" OM");
+// OBSOLETE if (pcr_tmp & FPA_PCR_EM_ZM)
+// OBSOLETE printf_unfiltered (" ZM");
+// OBSOLETE if (pcr_tmp & FPA_PCR_EM_IM)
+// OBSOLETE printf_unfiltered (" IM");
+// OBSOLETE printf_unfiltered ("\n");
+// OBSOLETE pcr_tmp = FPA_PCR_CC;
+// OBSOLETE printf_unfiltered ("\tCC= %#x", pcr_tmp);
+// OBSOLETE if (pcr_tmp & FPA_PCR_20MHZ)
+// OBSOLETE printf_unfiltered (" 20MHZ");
+// OBSOLETE if (pcr_tmp & FPA_PCR_CC_Z)
+// OBSOLETE printf_unfiltered (" Z");
+// OBSOLETE if (pcr_tmp & FPA_PCR_CC_C2)
+// OBSOLETE printf_unfiltered (" C2");
+// OBSOLETE
+// OBSOLETE /* Dynix defines FPA_PCR_CC_C0 to 0x100 and ptx defines
+// OBSOLETE FPA_PCR_CC_C1 to 0x100. Use whichever is defined and assume
+// OBSOLETE the OS knows what it is doing. */
+// OBSOLETE #ifdef FPA_PCR_CC_C1
+// OBSOLETE if (pcr_tmp & FPA_PCR_CC_C1)
+// OBSOLETE printf_unfiltered (" C1");
+// OBSOLETE #else
+// OBSOLETE if (pcr_tmp & FPA_PCR_CC_C0)
+// OBSOLETE printf_unfiltered (" C0");
+// OBSOLETE #endif
+// OBSOLETE
+// OBSOLETE switch (pcr_tmp)
+// OBSOLETE {
+// OBSOLETE case FPA_PCR_CC_Z:
+// OBSOLETE printf_unfiltered (" (Equal)");
+// OBSOLETE break;
+// OBSOLETE #ifdef FPA_PCR_CC_C1
+// OBSOLETE case FPA_PCR_CC_C1:
+// OBSOLETE #else
+// OBSOLETE case FPA_PCR_CC_C0:
+// OBSOLETE #endif
+// OBSOLETE printf_unfiltered (" (Less than)");
+// OBSOLETE break;
+// OBSOLETE case 0:
+// OBSOLETE printf_unfiltered (" (Greater than)");
+// OBSOLETE break;
+// OBSOLETE case FPA_PCR_CC_Z |
+// OBSOLETE #ifdef FPA_PCR_CC_C1
+// OBSOLETE FPA_PCR_CC_C1
+// OBSOLETE #else
+// OBSOLETE FPA_PCR_CC_C0
+// OBSOLETE #endif
+// OBSOLETE | FPA_PCR_CC_C2:
+// OBSOLETE printf_unfiltered (" (Unordered)");
+// OBSOLETE break;
+// OBSOLETE default:
+// OBSOLETE printf_unfiltered (" (Undefined)");
+// OBSOLETE break;
+// OBSOLETE }
+// OBSOLETE printf_unfiltered ("\n");
+// OBSOLETE pcr_tmp = pcr & FPA_PCR_AE;
+// OBSOLETE printf_unfiltered ("\tAE= %#x", pcr_tmp);
+// OBSOLETE if (pcr_tmp & FPA_PCR_AE_DE)
+// OBSOLETE printf_unfiltered (" DE");
+// OBSOLETE if (pcr_tmp & FPA_PCR_AE_UOE)
+// OBSOLETE printf_unfiltered (" UOE");
+// OBSOLETE if (pcr_tmp & FPA_PCR_AE_PE)
+// OBSOLETE printf_unfiltered (" PE");
+// OBSOLETE if (pcr_tmp & FPA_PCR_AE_UE)
+// OBSOLETE printf_unfiltered (" UE");
+// OBSOLETE if (pcr_tmp & FPA_PCR_AE_OE)
+// OBSOLETE printf_unfiltered (" OE");
+// OBSOLETE if (pcr_tmp & FPA_PCR_AE_ZE)
+// OBSOLETE printf_unfiltered (" ZE");
+// OBSOLETE if (pcr_tmp & FPA_PCR_AE_EE)
+// OBSOLETE printf_unfiltered (" EE");
+// OBSOLETE if (pcr_tmp & FPA_PCR_AE_IE)
+// OBSOLETE printf_unfiltered (" IE");
+// OBSOLETE printf_unfiltered ("\n");
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE print_1167_regs (long regs[FPA_NREGS])
+// OBSOLETE {
+// OBSOLETE int i;
+// OBSOLETE
+// OBSOLETE union
+// OBSOLETE {
+// OBSOLETE double d;
+// OBSOLETE long l[2];
+// OBSOLETE }
+// OBSOLETE xd;
+// OBSOLETE union
+// OBSOLETE {
+// OBSOLETE float f;
+// OBSOLETE long l;
+// OBSOLETE }
+// OBSOLETE xf;
+// OBSOLETE
+// OBSOLETE
+// OBSOLETE for (i = 0; i < FPA_NREGS; i++)
+// OBSOLETE {
+// OBSOLETE xf.l = regs[i];
+// OBSOLETE printf_unfiltered ("%%fp%d: raw= %#x, single= %f", i + 1, regs[i], xf.f);
+// OBSOLETE if (!(i & 1))
+// OBSOLETE {
+// OBSOLETE printf_unfiltered ("\n");
+// OBSOLETE }
+// OBSOLETE else
+// OBSOLETE {
+// OBSOLETE xd.l[1] = regs[i];
+// OBSOLETE xd.l[0] = regs[i + 1];
+// OBSOLETE printf_unfiltered (", double= %f\n", xd.d);
+// OBSOLETE }
+// OBSOLETE }
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE print_fpa_status (struct pt_regset ep)
+// OBSOLETE {
+// OBSOLETE
+// OBSOLETE printf_unfiltered ("WTL 1167:");
+// OBSOLETE if (ep.pr_fpa.fpa_pcr != 0)
+// OBSOLETE {
+// OBSOLETE printf_unfiltered ("\n");
+// OBSOLETE print_1167_control_word (ep.pr_fpa.fpa_pcr);
+// OBSOLETE print_1167_regs (ep.pr_fpa.fpa_regs);
+// OBSOLETE }
+// OBSOLETE else
+// OBSOLETE {
+// OBSOLETE printf_unfiltered (" not in use.\n");
+// OBSOLETE }
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE #if 0 /* disabled because it doesn't go through the target vector. */
+// OBSOLETE i386_float_info (void)
+// OBSOLETE {
+// OBSOLETE char ubuf[UPAGES * NBPG];
+// OBSOLETE struct pt_regset regset;
+// OBSOLETE
+// OBSOLETE if (have_inferior_p ())
+// OBSOLETE {
+// OBSOLETE PTRACE_READ_REGS (PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) & regset);
+// OBSOLETE }
+// OBSOLETE else
+// OBSOLETE {
+// OBSOLETE int corechan = bfd_cache_lookup (core_bfd);
+// OBSOLETE if (lseek (corechan, 0, 0) < 0)
+// OBSOLETE {
+// OBSOLETE perror ("seek on core file");
+// OBSOLETE }
+// OBSOLETE if (myread (corechan, ubuf, UPAGES * NBPG) < 0)
+// OBSOLETE {
+// OBSOLETE perror ("read on core file");
+// OBSOLETE }
+// OBSOLETE /* only interested in the floating point registers */
+// OBSOLETE regset.pr_fpu = ((struct user *) ubuf)->u_fpusave;
+// OBSOLETE regset.pr_fpa = ((struct user *) ubuf)->u_fpasave;
+// OBSOLETE }
+// OBSOLETE print_fpu_status (regset);
+// OBSOLETE print_fpa_status (regset);
+// OBSOLETE }
+// OBSOLETE #endif
+// OBSOLETE
+// OBSOLETE static volatile int got_sigchld;
+// OBSOLETE
+// OBSOLETE /*ARGSUSED */
+// OBSOLETE /* This will eventually be more interesting. */
+// OBSOLETE void
+// OBSOLETE sigchld_handler (int signo)
+// OBSOLETE {
+// OBSOLETE got_sigchld++;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE /*
+// OBSOLETE * Signals for which the default action does not cause the process
+// OBSOLETE * to die. See <sys/signal.h> for where this came from (alas, we
+// OBSOLETE * can't use those macros directly)
+// OBSOLETE */
+// OBSOLETE #ifndef sigmask
+// OBSOLETE #define sigmask(s) (1 << ((s) - 1))
+// OBSOLETE #endif
+// OBSOLETE #define SIGNALS_DFL_SAFE sigmask(SIGSTOP) | sigmask(SIGTSTP) | \
+// OBSOLETE sigmask(SIGTTIN) | sigmask(SIGTTOU) | sigmask(SIGCHLD) | \
+// OBSOLETE sigmask(SIGCONT) | sigmask(SIGWINCH) | sigmask(SIGPWR) | \
+// OBSOLETE sigmask(SIGURG) | sigmask(SIGPOLL)
+// OBSOLETE
+// OBSOLETE #ifdef ATTACH_DETACH
+// OBSOLETE /*
+// OBSOLETE * Thanks to XPT_MPDEBUGGER, we have to mange child_wait().
+// OBSOLETE */
+// OBSOLETE ptid_t
+// OBSOLETE child_wait (ptid_t ptid, struct target_waitstatus *status)
+// OBSOLETE {
+// OBSOLETE int save_errno, rv, xvaloff, saoff, sa_hand;
+// OBSOLETE struct pt_stop pt;
+// OBSOLETE struct user u;
+// OBSOLETE sigset_t set;
+// OBSOLETE /* Host signal number for a signal which the inferior terminates with, or
+// OBSOLETE 0 if it hasn't terminated due to a signal. */
+// OBSOLETE static int death_by_signal = 0;
+// OBSOLETE #ifdef SVR4_SHARED_LIBS /* use this to distinguish ptx 2 vs ptx 4 */
+// OBSOLETE prstatus_t pstatus;
+// OBSOLETE #endif
+// OBSOLETE int pid = PIDGET (ptid);
+// OBSOLETE
+// OBSOLETE do
+// OBSOLETE {
+// OBSOLETE set_sigint_trap (); /* Causes SIGINT to be passed on to the
+// OBSOLETE attached process. */
+// OBSOLETE save_errno = errno;
+// OBSOLETE
+// OBSOLETE got_sigchld = 0;
+// OBSOLETE
+// OBSOLETE sigemptyset (&set);
+// OBSOLETE
+// OBSOLETE while (got_sigchld == 0)
+// OBSOLETE {
+// OBSOLETE sigsuspend (&set);
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE clear_sigint_trap ();
+// OBSOLETE
+// OBSOLETE rv = mptrace (XPT_STOPSTAT, 0, (char *) &pt, 0);
+// OBSOLETE if (-1 == rv)
+// OBSOLETE {
+// OBSOLETE printf ("XPT_STOPSTAT: errno %d\n", errno); /* DEBUG */
+// OBSOLETE continue;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE pid = pt.ps_pid;
+// OBSOLETE
+// OBSOLETE if (pid != PIDGET (inferior_ptid))
+// OBSOLETE {
+// OBSOLETE /* NOTE: the mystery fork in csh/tcsh needs to be ignored.
+// OBSOLETE * We should not return new children for the initial run
+// OBSOLETE * of a process until it has done the exec.
+// OBSOLETE */
+// OBSOLETE /* inferior probably forked; send it on its way */
+// OBSOLETE rv = mptrace (XPT_UNDEBUG, pid, 0, 0);
+// OBSOLETE if (-1 == rv)
+// OBSOLETE {
+// OBSOLETE printf ("child_wait: XPT_UNDEBUG: pid %d: %s\n", pid,
+// OBSOLETE safe_strerror (errno));
+// OBSOLETE }
+// OBSOLETE continue;
+// OBSOLETE }
+// OBSOLETE /* FIXME: Do we deal with fork notification correctly? */
+// OBSOLETE switch (pt.ps_reason)
+// OBSOLETE {
+// OBSOLETE case PTS_FORK:
+// OBSOLETE /* multi proc: treat like PTS_EXEC */
+// OBSOLETE /*
+// OBSOLETE * Pretend this didn't happen, since gdb isn't set up
+// OBSOLETE * to deal with stops on fork.
+// OBSOLETE */
+// OBSOLETE rv = ptrace (PT_CONTSIG, pid, 1, 0);
+// OBSOLETE if (-1 == rv)
+// OBSOLETE {
+// OBSOLETE printf ("PTS_FORK: PT_CONTSIG: error %d\n", errno);
+// OBSOLETE }
+// OBSOLETE continue;
+// OBSOLETE case PTS_EXEC:
+// OBSOLETE /*
+// OBSOLETE * Pretend this is a SIGTRAP.
+// OBSOLETE */
+// OBSOLETE status->kind = TARGET_WAITKIND_STOPPED;
+// OBSOLETE status->value.sig = TARGET_SIGNAL_TRAP;
+// OBSOLETE break;
+// OBSOLETE case PTS_EXIT:
+// OBSOLETE /*
+// OBSOLETE * Note: we stop before the exit actually occurs. Extract
+// OBSOLETE * the exit code from the uarea. If we're stopped in the
+// OBSOLETE * exit() system call, the exit code will be in
+// OBSOLETE * u.u_ap[0]. An exit due to an uncaught signal will have
+// OBSOLETE * something else in here, see the comment in the default:
+// OBSOLETE * case, below. Finally,let the process exit.
+// OBSOLETE */
+// OBSOLETE if (death_by_signal)
+// OBSOLETE {
+// OBSOLETE status->kind = TARGET_WAITKIND_SIGNALED;
+// OBSOLETE status->value.sig = target_signal_from_host (death_by_signal);
+// OBSOLETE death_by_signal = 0;
+// OBSOLETE break;
+// OBSOLETE }
+// OBSOLETE xvaloff = (unsigned long) &u.u_ap[0] - (unsigned long) &u;
+// OBSOLETE errno = 0;
+// OBSOLETE rv = ptrace (PT_RUSER, pid, (char *) xvaloff, 0);
+// OBSOLETE status->kind = TARGET_WAITKIND_EXITED;
+// OBSOLETE status->value.integer = rv;
+// OBSOLETE /*
+// OBSOLETE * addr & data to mptrace() don't matter here, since
+// OBSOLETE * the process is already dead.
+// OBSOLETE */
+// OBSOLETE rv = mptrace (XPT_UNDEBUG, pid, 0, 0);
+// OBSOLETE if (-1 == rv)
+// OBSOLETE {
+// OBSOLETE printf ("child_wait: PTS_EXIT: XPT_UNDEBUG: pid %d error %d\n", pid,
+// OBSOLETE errno);
+// OBSOLETE }
+// OBSOLETE break;
+// OBSOLETE case PTS_WATCHPT_HIT:
+// OBSOLETE internal_error (__FILE__, __LINE__,
+// OBSOLETE "PTS_WATCHPT_HIT\n");
+// OBSOLETE break;
+// OBSOLETE default:
+// OBSOLETE /* stopped by signal */
+// OBSOLETE status->kind = TARGET_WAITKIND_STOPPED;
+// OBSOLETE status->value.sig = target_signal_from_host (pt.ps_reason);
+// OBSOLETE death_by_signal = 0;
+// OBSOLETE
+// OBSOLETE if (0 == (SIGNALS_DFL_SAFE & sigmask (pt.ps_reason)))
+// OBSOLETE {
+// OBSOLETE break;
+// OBSOLETE }
+// OBSOLETE /* else default action of signal is to die */
+// OBSOLETE #ifdef SVR4_SHARED_LIBS
+// OBSOLETE rv = ptrace (PT_GET_PRSTATUS, pid, (char *) &pstatus, 0);
+// OBSOLETE if (-1 == rv)
+// OBSOLETE error ("child_wait: signal %d PT_GET_PRSTATUS: %s\n",
+// OBSOLETE pt.ps_reason, safe_strerror (errno));
+// OBSOLETE if (pstatus.pr_cursig != pt.ps_reason)
+// OBSOLETE {
+// OBSOLETE printf ("pstatus signal %d, pt signal %d\n",
+// OBSOLETE pstatus.pr_cursig, pt.ps_reason);
+// OBSOLETE }
+// OBSOLETE sa_hand = (int) pstatus.pr_action.sa_handler;
+// OBSOLETE #else
+// OBSOLETE saoff = (unsigned long) &u.u_sa[0] - (unsigned long) &u;
+// OBSOLETE saoff += sizeof (struct sigaction) * (pt.ps_reason - 1);
+// OBSOLETE errno = 0;
+// OBSOLETE sa_hand = ptrace (PT_RUSER, pid, (char *) saoff, 0);
+// OBSOLETE if (errno)
+// OBSOLETE error ("child_wait: signal %d: RUSER: %s\n",
+// OBSOLETE pt.ps_reason, safe_strerror (errno));
+// OBSOLETE #endif
+// OBSOLETE if ((int) SIG_DFL == sa_hand)
+// OBSOLETE {
+// OBSOLETE /* we will be dying */
+// OBSOLETE death_by_signal = pt.ps_reason;
+// OBSOLETE }
+// OBSOLETE break;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE }
+// OBSOLETE while (pid != PIDGET (inferior_ptid)); /* Some other child died or stopped */
+// OBSOLETE
+// OBSOLETE return pid_to_ptid (pid);
+// OBSOLETE }
+// OBSOLETE #else /* !ATTACH_DETACH */
+// OBSOLETE /*
+// OBSOLETE * Simple child_wait() based on inftarg.c child_wait() for use until
+// OBSOLETE * the MPDEBUGGER child_wait() works properly. This will go away when
+// OBSOLETE * that is fixed.
+// OBSOLETE */
+// OBSOLETE ptid_t
+// OBSOLETE child_wait (ptid_t ptid, struct target_waitstatus *ourstatus)
+// OBSOLETE {
+// OBSOLETE int save_errno;
+// OBSOLETE int status;
+// OBSOLETE int pid = PIDGET (ptid);
+// OBSOLETE
+// OBSOLETE do
+// OBSOLETE {
+// OBSOLETE pid = wait (&status);
+// OBSOLETE save_errno = errno;
+// OBSOLETE
+// OBSOLETE if (pid == -1)
+// OBSOLETE {
+// OBSOLETE if (save_errno == EINTR)
+// OBSOLETE continue;
+// OBSOLETE fprintf (stderr, "Child process unexpectedly missing: %s.\n",
+// OBSOLETE safe_strerror (save_errno));
+// OBSOLETE ourstatus->kind = TARGET_WAITKIND_SIGNALLED;
+// OBSOLETE ourstatus->value.sig = TARGET_SIGNAL_UNKNOWN;
+// OBSOLETE return pid_to_ptid (-1);
+// OBSOLETE }
+// OBSOLETE }
+// OBSOLETE while (pid != PIDGET (inferior_ptid)); /* Some other child died or stopped */
+// OBSOLETE store_waitstatus (ourstatus, status);
+// OBSOLETE return pid_to_ptid (pid);
+// OBSOLETE }
+// OBSOLETE #endif /* ATTACH_DETACH */
+// OBSOLETE
+// OBSOLETE
+// OBSOLETE
+// OBSOLETE /* This function simply calls ptrace with the given arguments.
+// OBSOLETE It exists so that all calls to ptrace are isolated in this
+// OBSOLETE machine-dependent file. */
+// OBSOLETE int
+// OBSOLETE call_ptrace (int request, int pid, PTRACE_ARG3_TYPE addr, int data)
+// OBSOLETE {
+// OBSOLETE return ptrace (request, pid, addr, data);
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE int
+// OBSOLETE call_mptrace (int request, int pid, PTRACE_ARG3_TYPE addr, int data)
+// OBSOLETE {
+// OBSOLETE return mptrace (request, pid, addr, data);
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE #if defined (DEBUG_PTRACE)
+// OBSOLETE /* For the rest of the file, use an extra level of indirection */
+// OBSOLETE /* This lets us breakpoint usefully on call_ptrace. */
+// OBSOLETE #define ptrace call_ptrace
+// OBSOLETE #define mptrace call_mptrace
+// OBSOLETE #endif
+// OBSOLETE
+// OBSOLETE void
+// OBSOLETE kill_inferior (void)
+// OBSOLETE {
+// OBSOLETE if (ptid_equal (inferior_ptid, null_ptid))
+// OBSOLETE return;
+// OBSOLETE
+// OBSOLETE /* For MPDEBUGGER, don't use PT_KILL, since the child will stop
+// OBSOLETE again with a PTS_EXIT. Just hit him with SIGKILL (so he stops)
+// OBSOLETE and detach. */
+// OBSOLETE
+// OBSOLETE kill (PIDGET (inferior_ptid), SIGKILL);
+// OBSOLETE #ifdef ATTACH_DETACH
+// OBSOLETE detach (SIGKILL);
+// OBSOLETE #else /* ATTACH_DETACH */
+// OBSOLETE ptrace (PT_KILL, PIDGET (inferior_ptid), 0, 0);
+// OBSOLETE wait ((int *) NULL);
+// OBSOLETE #endif /* ATTACH_DETACH */
+// OBSOLETE target_mourn_inferior ();
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE /* Resume execution of the inferior process.
+// OBSOLETE If STEP is nonzero, single-step it.
+// OBSOLETE If SIGNAL is nonzero, give it that signal. */
+// OBSOLETE
+// OBSOLETE void
+// OBSOLETE child_resume (ptid_t ptid, int step, enum target_signal signal)
+// OBSOLETE {
+// OBSOLETE int pid = PIDGET (ptid);
+// OBSOLETE
+// OBSOLETE errno = 0;
+// OBSOLETE
+// OBSOLETE if (pid == -1)
+// OBSOLETE pid = PIDGET (inferior_ptid);
+// OBSOLETE
+// OBSOLETE /* An address of (PTRACE_ARG3_TYPE)1 tells ptrace to continue from where
+// OBSOLETE it was. (If GDB wanted it to start some other way, we have already
+// OBSOLETE written a new PC value to the child.)
+// OBSOLETE
+// OBSOLETE If this system does not support PT_SSTEP, a higher level function will
+// OBSOLETE have called single_step() to transmute the step request into a
+// OBSOLETE continue request (by setting breakpoints on all possible successor
+// OBSOLETE instructions), so we don't have to worry about that here. */
+// OBSOLETE
+// OBSOLETE if (step)
+// OBSOLETE ptrace (PT_SSTEP, pid, (PTRACE_ARG3_TYPE) 1, signal);
+// OBSOLETE else
+// OBSOLETE ptrace (PT_CONTSIG, pid, (PTRACE_ARG3_TYPE) 1, signal);
+// OBSOLETE
+// OBSOLETE if (errno)
+// OBSOLETE perror_with_name ("ptrace");
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE #ifdef ATTACH_DETACH
+// OBSOLETE /* Start debugging the process whose number is PID. */
+// OBSOLETE int
+// OBSOLETE attach (int pid)
+// OBSOLETE {
+// OBSOLETE sigset_t set;
+// OBSOLETE int rv;
+// OBSOLETE
+// OBSOLETE rv = mptrace (XPT_DEBUG, pid, 0, 0);
+// OBSOLETE if (-1 == rv)
+// OBSOLETE {
+// OBSOLETE error ("mptrace(XPT_DEBUG): %s", safe_strerror (errno));
+// OBSOLETE }
+// OBSOLETE rv = mptrace (XPT_SIGNAL, pid, 0, SIGSTOP);
+// OBSOLETE if (-1 == rv)
+// OBSOLETE {
+// OBSOLETE error ("mptrace(XPT_SIGNAL): %s", safe_strerror (errno));
+// OBSOLETE }
+// OBSOLETE attach_flag = 1;
+// OBSOLETE return pid;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE void
+// OBSOLETE detach (int signo)
+// OBSOLETE {
+// OBSOLETE int rv;
+// OBSOLETE
+// OBSOLETE rv = mptrace (XPT_UNDEBUG, PIDGET (inferior_ptid), 1, signo);
+// OBSOLETE if (-1 == rv)
+// OBSOLETE {
+// OBSOLETE error ("mptrace(XPT_UNDEBUG): %s", safe_strerror (errno));
+// OBSOLETE }
+// OBSOLETE attach_flag = 0;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE #endif /* ATTACH_DETACH */
+// OBSOLETE
+// OBSOLETE /* Default the type of the ptrace transfer to int. */
+// OBSOLETE #ifndef PTRACE_XFER_TYPE
+// OBSOLETE #define PTRACE_XFER_TYPE int
+// OBSOLETE #endif
+// OBSOLETE
+// OBSOLETE
+// OBSOLETE /* NOTE! I tried using PTRACE_READDATA, etc., to read and write memory
+// OBSOLETE in the NEW_SUN_PTRACE case.
+// OBSOLETE It ought to be straightforward. But it appears that writing did
+// OBSOLETE not write the data that I specified. I cannot understand where
+// OBSOLETE it got the data that it actually did write. */
+// OBSOLETE
+// OBSOLETE /* Copy LEN bytes to or from inferior's memory starting at MEMADDR
+// OBSOLETE to debugger memory starting at MYADDR. Copy to inferior if
+// OBSOLETE WRITE is nonzero. TARGET is ignored.
+// OBSOLETE
+// OBSOLETE Returns the length copied, which is either the LEN argument or zero.
+// OBSOLETE This xfer function does not do partial moves, since child_ops
+// OBSOLETE doesn't allow memory operations to cross below us in the target stack
+// OBSOLETE anyway. */
+// OBSOLETE
+// OBSOLETE int
+// OBSOLETE child_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write,
+// OBSOLETE struct mem_attrib *attrib,
+// OBSOLETE struct target_ops *target)
+// OBSOLETE {
+// OBSOLETE register int i;
+// OBSOLETE /* Round starting address down to longword boundary. */
+// OBSOLETE register CORE_ADDR addr = memaddr & -(CORE_ADDR) sizeof (PTRACE_XFER_TYPE);
+// OBSOLETE /* Round ending address up; get number of longwords that makes. */
+// OBSOLETE register int count
+// OBSOLETE = (((memaddr + len) - addr) + sizeof (PTRACE_XFER_TYPE) - 1)
+// OBSOLETE / sizeof (PTRACE_XFER_TYPE);
+// OBSOLETE /* Allocate buffer of that many longwords. */
+// OBSOLETE /* FIXME (alloca): This code, cloned from infptrace.c, is unsafe
+// OBSOLETE because it uses alloca to allocate a buffer of arbitrary size.
+// OBSOLETE For very large xfers, this could crash GDB's stack. */
+// OBSOLETE register PTRACE_XFER_TYPE *buffer
+// OBSOLETE = (PTRACE_XFER_TYPE *) alloca (count * sizeof (PTRACE_XFER_TYPE));
+// OBSOLETE
+// OBSOLETE if (write)
+// OBSOLETE {
+// OBSOLETE /* Fill start and end extra bytes of buffer with existing memory data. */
+// OBSOLETE
+// OBSOLETE if (addr != memaddr || len < (int) sizeof (PTRACE_XFER_TYPE))
+// OBSOLETE {
+// OBSOLETE /* Need part of initial word -- fetch it. */
+// OBSOLETE buffer[0] = ptrace (PT_RTEXT, PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) addr,
+// OBSOLETE 0);
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE if (count > 1) /* FIXME, avoid if even boundary */
+// OBSOLETE {
+// OBSOLETE buffer[count - 1]
+// OBSOLETE = ptrace (PT_RTEXT, PIDGET (inferior_ptid),
+// OBSOLETE ((PTRACE_ARG3_TYPE)
+// OBSOLETE (addr + (count - 1) * sizeof (PTRACE_XFER_TYPE))),
+// OBSOLETE 0);
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE /* Copy data to be written over corresponding part of buffer */
+// OBSOLETE
+// OBSOLETE memcpy ((char *) buffer + (memaddr & (sizeof (PTRACE_XFER_TYPE) - 1)),
+// OBSOLETE myaddr,
+// OBSOLETE len);
+// OBSOLETE
+// OBSOLETE /* Write the entire buffer. */
+// OBSOLETE
+// OBSOLETE for (i = 0; i < count; i++, addr += sizeof (PTRACE_XFER_TYPE))
+// OBSOLETE {
+// OBSOLETE errno = 0;
+// OBSOLETE ptrace (PT_WDATA, PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) addr,
+// OBSOLETE buffer[i]);
+// OBSOLETE if (errno)
+// OBSOLETE {
+// OBSOLETE /* Using the appropriate one (I or D) is necessary for
+// OBSOLETE Gould NP1, at least. */
+// OBSOLETE errno = 0;
+// OBSOLETE ptrace (PT_WTEXT, PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) addr,
+// OBSOLETE buffer[i]);
+// OBSOLETE }
+// OBSOLETE if (errno)
+// OBSOLETE return 0;
+// OBSOLETE }
+// OBSOLETE }
+// OBSOLETE else
+// OBSOLETE {
+// OBSOLETE /* Read all the longwords */
+// OBSOLETE for (i = 0; i < count; i++, addr += sizeof (PTRACE_XFER_TYPE))
+// OBSOLETE {
+// OBSOLETE errno = 0;
+// OBSOLETE buffer[i] = ptrace (PT_RTEXT, PIDGET (inferior_ptid),
+// OBSOLETE (PTRACE_ARG3_TYPE) addr, 0);
+// OBSOLETE if (errno)
+// OBSOLETE return 0;
+// OBSOLETE QUIT;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE /* Copy appropriate bytes out of the buffer. */
+// OBSOLETE memcpy (myaddr,
+// OBSOLETE (char *) buffer + (memaddr & (sizeof (PTRACE_XFER_TYPE) - 1)),
+// OBSOLETE len);
+// OBSOLETE }
+// OBSOLETE return len;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE
+// OBSOLETE void
+// OBSOLETE _initialize_symm_nat (void)
+// OBSOLETE {
+// OBSOLETE #ifdef ATTACH_DETACH
+// OBSOLETE /*
+// OBSOLETE * the MPDEBUGGER is necessary for process tree debugging and attach
+// OBSOLETE * to work, but it alters the behavior of debugged processes, so other
+// OBSOLETE * things (at least child_wait()) will have to change to accomodate
+// OBSOLETE * that.
+// OBSOLETE *
+// OBSOLETE * Note that attach is not implemented in dynix 3, and not in ptx
+// OBSOLETE * until version 2.1 of the OS.
+// OBSOLETE */
+// OBSOLETE int rv;
+// OBSOLETE sigset_t set;
+// OBSOLETE struct sigaction sact;
+// OBSOLETE
+// OBSOLETE rv = mptrace (XPT_MPDEBUGGER, 0, 0, 0);
+// OBSOLETE if (-1 == rv)
+// OBSOLETE {
+// OBSOLETE internal_error (__FILE__, __LINE__,
+// OBSOLETE "_initialize_symm_nat(): mptrace(XPT_MPDEBUGGER): %s",
+// OBSOLETE safe_strerror (errno));
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE /*
+// OBSOLETE * Under MPDEBUGGER, we get SIGCLHD when a traced process does
+// OBSOLETE * anything of interest.
+// OBSOLETE */
+// OBSOLETE
+// OBSOLETE /*
+// OBSOLETE * Block SIGCHLD. We leave it blocked all the time, and then
+// OBSOLETE * call sigsuspend() in child_wait() to wait for the child
+// OBSOLETE * to do something. None of these ought to fail, but check anyway.
+// OBSOLETE */
+// OBSOLETE sigemptyset (&set);
+// OBSOLETE rv = sigaddset (&set, SIGCHLD);
+// OBSOLETE if (-1 == rv)
+// OBSOLETE {
+// OBSOLETE internal_error (__FILE__, __LINE__,
+// OBSOLETE "_initialize_symm_nat(): sigaddset(SIGCHLD): %s",
+// OBSOLETE safe_strerror (errno));
+// OBSOLETE }
+// OBSOLETE rv = sigprocmask (SIG_BLOCK, &set, (sigset_t *) NULL);
+// OBSOLETE if (-1 == rv)
+// OBSOLETE {
+// OBSOLETE internal_error (__FILE__, __LINE__,
+// OBSOLETE "_initialize_symm_nat(): sigprocmask(SIG_BLOCK): %s",
+// OBSOLETE safe_strerror (errno));
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE sact.sa_handler = sigchld_handler;
+// OBSOLETE sigemptyset (&sact.sa_mask);
+// OBSOLETE sact.sa_flags = SA_NOCLDWAIT; /* keep the zombies away */
+// OBSOLETE rv = sigaction (SIGCHLD, &sact, (struct sigaction *) NULL);
+// OBSOLETE if (-1 == rv)
+// OBSOLETE {
+// OBSOLETE internal_error (__FILE__, __LINE__,
+// OBSOLETE "_initialize_symm_nat(): sigaction(SIGCHLD): %s",
+// OBSOLETE safe_strerror (errno));
+// OBSOLETE }
+// OBSOLETE #endif
+// OBSOLETE }
diff --git a/gdb/symm-tdep.c b/gdb/symm-tdep.c
index 37a2f51..21c8436 100644
--- a/gdb/symm-tdep.c
+++ b/gdb/symm-tdep.c
@@ -1,102 +1,102 @@
-/* Sequent Symmetry target interface, for GDB.
- Copyright 1986, 1987, 1989, 1991, 1992, 1993, 1994, 1995, 2000
- Free Software Foundation, Inc.
-
- This file is part of GDB.
-
- 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.
-
- 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.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-
-/* many 387-specific items of use taken from i386-dep.c */
-
-#include "defs.h"
-#include "frame.h"
-#include "inferior.h"
-#include "symtab.h"
-
-#include <signal.h>
-#include <sys/param.h>
-#include <sys/user.h>
-#include <sys/dir.h>
-#include <sys/ioctl.h>
-#include "gdb_stat.h"
-#include "gdbcore.h"
-#include <fcntl.h>
-
-void
-symmetry_extract_return_value (struct type *type, char *regbuf, char *valbuf)
-{
- union
- {
- double d;
- int l[2];
- }
- xd;
- struct minimal_symbol *msymbol;
- float f;
-
- if (TYPE_CODE_FLT == TYPE_CODE (type))
- {
- msymbol = lookup_minimal_symbol ("1167_flt", NULL, NULL);
- if (msymbol != NULL)
- {
- /* found "1167_flt" means 1167, %fp2-%fp3 */
- /* float & double; 19= %fp2, 20= %fp3 */
- /* no single precision on 1167 */
- xd.l[1] = *((int *) &regbuf[REGISTER_BYTE (19)]);
- xd.l[0] = *((int *) &regbuf[REGISTER_BYTE (20)]);
- switch (TYPE_LENGTH (type))
- {
- case 4:
- /* FIXME: broken for cross-debugging. */
- f = (float) xd.d;
- memcpy (valbuf, &f, TYPE_LENGTH (type));
- break;
- case 8:
- /* FIXME: broken for cross-debugging. */
- memcpy (valbuf, &xd.d, TYPE_LENGTH (type));
- break;
- default:
- error ("Unknown floating point size");
- break;
- }
- }
- else
- {
- /* 387 %st(0), gcc uses this */
- i387_to_double (((int *) &regbuf[REGISTER_BYTE (3)]),
- &xd.d);
- switch (TYPE_LENGTH (type))
- {
- case 4: /* float */
- f = (float) xd.d;
- /* FIXME: broken for cross-debugging. */
- memcpy (valbuf, &f, 4);
- break;
- case 8: /* double */
- /* FIXME: broken for cross-debugging. */
- memcpy (valbuf, &xd.d, 8);
- break;
- default:
- error ("Unknown floating point size");
- break;
- }
- }
- }
- else
- {
- memcpy (valbuf, regbuf, TYPE_LENGTH (type));
- }
-}
+// OBSOLETE /* Sequent Symmetry target interface, for GDB.
+// OBSOLETE Copyright 1986, 1987, 1989, 1991, 1992, 1993, 1994, 1995, 2000
+// OBSOLETE Free Software Foundation, Inc.
+// OBSOLETE
+// OBSOLETE This file is part of GDB.
+// OBSOLETE
+// OBSOLETE This program is free software; you can redistribute it and/or modify
+// OBSOLETE it under the terms of the GNU General Public License as published by
+// OBSOLETE the Free Software Foundation; either version 2 of the License, or
+// OBSOLETE (at your option) any later version.
+// OBSOLETE
+// OBSOLETE This program is distributed in the hope that it will be useful,
+// OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of
+// OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// OBSOLETE GNU General Public License for more details.
+// OBSOLETE
+// OBSOLETE You should have received a copy of the GNU General Public License
+// OBSOLETE along with this program; if not, write to the Free Software
+// OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330,
+// OBSOLETE Boston, MA 02111-1307, USA. */
+// OBSOLETE
+// OBSOLETE /* many 387-specific items of use taken from i386-dep.c */
+// OBSOLETE
+// OBSOLETE #include "defs.h"
+// OBSOLETE #include "frame.h"
+// OBSOLETE #include "inferior.h"
+// OBSOLETE #include "symtab.h"
+// OBSOLETE
+// OBSOLETE #include <signal.h>
+// OBSOLETE #include <sys/param.h>
+// OBSOLETE #include <sys/user.h>
+// OBSOLETE #include <sys/dir.h>
+// OBSOLETE #include <sys/ioctl.h>
+// OBSOLETE #include "gdb_stat.h"
+// OBSOLETE #include "gdbcore.h"
+// OBSOLETE #include <fcntl.h>
+// OBSOLETE
+// OBSOLETE void
+// OBSOLETE symmetry_extract_return_value (struct type *type, char *regbuf, char *valbuf)
+// OBSOLETE {
+// OBSOLETE union
+// OBSOLETE {
+// OBSOLETE double d;
+// OBSOLETE int l[2];
+// OBSOLETE }
+// OBSOLETE xd;
+// OBSOLETE struct minimal_symbol *msymbol;
+// OBSOLETE float f;
+// OBSOLETE
+// OBSOLETE if (TYPE_CODE_FLT == TYPE_CODE (type))
+// OBSOLETE {
+// OBSOLETE msymbol = lookup_minimal_symbol ("1167_flt", NULL, NULL);
+// OBSOLETE if (msymbol != NULL)
+// OBSOLETE {
+// OBSOLETE /* found "1167_flt" means 1167, %fp2-%fp3 */
+// OBSOLETE /* float & double; 19= %fp2, 20= %fp3 */
+// OBSOLETE /* no single precision on 1167 */
+// OBSOLETE xd.l[1] = *((int *) &regbuf[REGISTER_BYTE (19)]);
+// OBSOLETE xd.l[0] = *((int *) &regbuf[REGISTER_BYTE (20)]);
+// OBSOLETE switch (TYPE_LENGTH (type))
+// OBSOLETE {
+// OBSOLETE case 4:
+// OBSOLETE /* FIXME: broken for cross-debugging. */
+// OBSOLETE f = (float) xd.d;
+// OBSOLETE memcpy (valbuf, &f, TYPE_LENGTH (type));
+// OBSOLETE break;
+// OBSOLETE case 8:
+// OBSOLETE /* FIXME: broken for cross-debugging. */
+// OBSOLETE memcpy (valbuf, &xd.d, TYPE_LENGTH (type));
+// OBSOLETE break;
+// OBSOLETE default:
+// OBSOLETE error ("Unknown floating point size");
+// OBSOLETE break;
+// OBSOLETE }
+// OBSOLETE }
+// OBSOLETE else
+// OBSOLETE {
+// OBSOLETE /* 387 %st(0), gcc uses this */
+// OBSOLETE i387_to_double (((int *) &regbuf[REGISTER_BYTE (3)]),
+// OBSOLETE &xd.d);
+// OBSOLETE switch (TYPE_LENGTH (type))
+// OBSOLETE {
+// OBSOLETE case 4: /* float */
+// OBSOLETE f = (float) xd.d;
+// OBSOLETE /* FIXME: broken for cross-debugging. */
+// OBSOLETE memcpy (valbuf, &f, 4);
+// OBSOLETE break;
+// OBSOLETE case 8: /* double */
+// OBSOLETE /* FIXME: broken for cross-debugging. */
+// OBSOLETE memcpy (valbuf, &xd.d, 8);
+// OBSOLETE break;
+// OBSOLETE default:
+// OBSOLETE error ("Unknown floating point size");
+// OBSOLETE break;
+// OBSOLETE }
+// OBSOLETE }
+// OBSOLETE }
+// OBSOLETE else
+// OBSOLETE {
+// OBSOLETE memcpy (valbuf, regbuf, TYPE_LENGTH (type));
+// OBSOLETE }
+// OBSOLETE }
diff --git a/gdb/symmisc.c b/gdb/symmisc.c
index 1712c90..acd83b4 100644
--- a/gdb/symmisc.c
+++ b/gdb/symmisc.c
@@ -33,6 +33,7 @@
#include "language.h"
#include "bcache.h"
#include "block.h"
+#include "gdb_regex.h"
#include "dictionary.h"
#include "gdb_string.h"
@@ -1002,6 +1003,145 @@ maintenance_print_objfiles (char *ignore, int from_tty)
immediate_quit--;
}
+
+/* List all the symbol tables. */
+void
+maintenance_list_symtabs (char *regexp, int from_tty)
+{
+ struct objfile *objfile;
+
+ if (regexp)
+ re_comp (regexp);
+
+ ALL_OBJFILES (objfile)
+ {
+ struct symtab *symtab;
+
+ /* We don't want to print anything for this objfile until we
+ actually find a symtab whose name matches. */
+ int printed_objfile_start = 0;
+
+ ALL_OBJFILE_SYMTABS (objfile, symtab)
+ if (! regexp
+ || re_exec (symtab->filename))
+ {
+ if (! printed_objfile_start)
+ {
+ printf_filtered ("{ objfile %s ", objfile->name);
+ wrap_here (" ");
+ printf_filtered ("((struct objfile *) %p)\n", objfile);
+ printed_objfile_start = 1;
+ }
+
+ printf_filtered (" { symtab %s ", symtab->filename);
+ wrap_here (" ");
+ printf_filtered ("((struct symtab *) %p)\n", symtab);
+ printf_filtered (" dirname %s\n",
+ symtab->dirname ? symtab->dirname : "(null)");
+ printf_filtered (" fullname %s\n",
+ symtab->fullname ? symtab->fullname : "(null)");
+ printf_filtered (" blockvector ((struct blockvector *) %p)%s\n",
+ symtab->blockvector,
+ symtab->primary ? " (primary)" : "");
+ printf_filtered (" debugformat %s\n", symtab->debugformat);
+ printf_filtered (" }\n");
+ }
+
+ if (printed_objfile_start)
+ printf_filtered ("}\n");
+ }
+}
+
+
+/* List all the partial symbol tables. */
+void
+maintenance_list_psymtabs (char *regexp, int from_tty)
+{
+ struct objfile *objfile;
+
+ if (regexp)
+ re_comp (regexp);
+
+ ALL_OBJFILES (objfile)
+ {
+ struct partial_symtab *psymtab;
+
+ /* We don't want to print anything for this objfile until we
+ actually find a symtab whose name matches. */
+ int printed_objfile_start = 0;
+
+ ALL_OBJFILE_PSYMTABS (objfile, psymtab)
+ if (! regexp
+ || re_exec (psymtab->filename))
+ {
+ if (! printed_objfile_start)
+ {
+ printf_filtered ("{ objfile %s ", objfile->name);
+ wrap_here (" ");
+ printf_filtered ("((struct objfile *) %p)\n", objfile);
+ printed_objfile_start = 1;
+ }
+
+ printf_filtered (" { psymtab %s ", psymtab->filename);
+ wrap_here (" ");
+ printf_filtered ("((struct partial_symtab *) %p)\n", psymtab);
+ printf_filtered (" readin %s\n",
+ psymtab->readin ? "yes" : "no");
+ printf_filtered (" fullname %s\n",
+ psymtab->fullname ? psymtab->fullname : "(null)");
+ printf_filtered (" text addresses ");
+ print_address_numeric (psymtab->textlow, 1, gdb_stdout);
+ printf_filtered (" -- ");
+ print_address_numeric (psymtab->texthigh, 1, gdb_stdout);
+ printf_filtered ("\n");
+ printf_filtered (" globals ");
+ if (psymtab->n_global_syms)
+ {
+ printf_filtered ("(* (struct partial_symbol **) %p @ %d)\n",
+ (psymtab->objfile->global_psymbols.list
+ + psymtab->globals_offset),
+ psymtab->n_global_syms);
+ }
+ else
+ printf_filtered ("(none)\n");
+ printf_filtered (" statics ");
+ if (psymtab->n_static_syms)
+ {
+ printf_filtered ("(* (struct partial_symbol **) %p @ %d)\n",
+ (psymtab->objfile->static_psymbols.list
+ + psymtab->statics_offset),
+ psymtab->n_static_syms);
+ }
+ else
+ printf_filtered ("(none)\n");
+ printf_filtered (" dependencies ");
+ if (psymtab->number_of_dependencies)
+ {
+ int i;
+
+ printf_filtered ("{\n");
+ for (i = 0; i < psymtab->number_of_dependencies; i++)
+ {
+ struct partial_symtab *dep = psymtab->dependencies[i];
+
+ /* Note the string concatenation there --- no comma. */
+ printf_filtered (" psymtab %s "
+ "((struct partial_symtab *) %p)\n",
+ dep->filename, dep);
+ }
+ printf_filtered (" }\n");
+ }
+ else
+ printf_filtered ("(none)\n");
+ printf_filtered (" }\n");
+ }
+
+ if (printed_objfile_start)
+ printf_filtered ("}\n");
+ }
+}
+
+
/* Check consistency of psymtabs and symtabs. */
void
diff --git a/gdb/symtab.c b/gdb/symtab.c
index b134f02..de2cc56 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -513,61 +513,111 @@ symbol_find_demangled_name (struct general_symbol_info *gsymbol,
return NULL;
}
-/* Set both the mangled and demangled (if any) names for GSYMBOL based on
- NAME and LEN. The hash table corresponding to OBJFILE is used, and the
- memory comes from that objfile's symbol_obstack. NAME is copied, so the
- pointer can be discarded after calling this function. */
+/* Set both the mangled and demangled (if any) names for GSYMBOL based
+ on LINKAGE_NAME and LEN. The hash table corresponding to OBJFILE
+ is used, and the memory comes from that objfile's symbol_obstack.
+ LINKAGE_NAME is copied, so the pointer can be discarded after
+ calling this function. */
+
+/* We have to be careful when dealing with Java names: when we run
+ into a Java minimal symbol, we don't know it's a Java symbol, so it
+ gets demangled as a C++ name. This is unfortunate, but there's not
+ much we can do about it: but when demangling partial symbols and
+ regular symbols, we'd better not reuse the wrong demangled name.
+ (See PR gdb/1039.) We solve this by putting a distinctive prefix
+ on Java names when storing them in the hash table. */
+
+/* FIXME: carlton/2003-03-13: This is an unfortunate situation. I
+ don't mind the Java prefix so much: different languages have
+ different demangling requirements, so it's only natural that we
+ need to keep language data around in our demangling cache. But
+ it's not good that the minimal symbol has the wrong demangled name.
+ Unfortunately, I can't think of any easy solution to that
+ problem. */
+
+#define JAVA_PREFIX "##JAVA$$"
+#define JAVA_PREFIX_LEN 8
void
symbol_set_names (struct general_symbol_info *gsymbol,
- const char *name, int len, struct objfile *objfile)
+ const char *linkage_name, int len, struct objfile *objfile)
{
char **slot;
- const char *tmpname;
+ /* A 0-terminated copy of the linkage name. */
+ const char *linkage_name_copy;
+ /* A copy of the linkage name that might have a special Java prefix
+ added to it, for use when looking names up in the hash table. */
+ const char *lookup_name;
+ /* The length of lookup_name. */
+ int lookup_len;
if (objfile->demangled_names_hash == NULL)
create_demangled_names_hash (objfile);
- /* The stabs reader generally provides names that are not NULL-terminated;
- most of the other readers don't do this, so we can just use the given
- copy. */
- if (name[len] != 0)
+ /* The stabs reader generally provides names that are not
+ NUL-terminated; most of the other readers don't do this, so we
+ can just use the given copy, unless we're in the Java case. */
+ if (gsymbol->language == language_java)
+ {
+ char *alloc_name;
+ lookup_len = len + JAVA_PREFIX_LEN;
+
+ alloc_name = alloca (lookup_len + 1);
+ memcpy (alloc_name, JAVA_PREFIX, JAVA_PREFIX_LEN);
+ memcpy (alloc_name + JAVA_PREFIX_LEN, linkage_name, len);
+ alloc_name[lookup_len] = '\0';
+
+ lookup_name = alloc_name;
+ linkage_name_copy = alloc_name + JAVA_PREFIX_LEN;
+ }
+ else if (linkage_name[len] != '\0')
{
- char *alloc_name = alloca (len + 1);
- memcpy (alloc_name, name, len);
- alloc_name[len] = 0;
- tmpname = alloc_name;
+ char *alloc_name;
+ lookup_len = len;
+
+ alloc_name = alloca (lookup_len + 1);
+ memcpy (alloc_name, linkage_name, len);
+ alloc_name[lookup_len] = '\0';
+
+ lookup_name = alloc_name;
+ linkage_name_copy = alloc_name;
}
else
- tmpname = name;
+ {
+ lookup_len = len;
+ lookup_name = linkage_name;
+ linkage_name_copy = linkage_name;
+ }
- slot = (char **) htab_find_slot (objfile->demangled_names_hash, tmpname, INSERT);
+ slot = (char **) htab_find_slot (objfile->demangled_names_hash,
+ lookup_name, INSERT);
/* If this name is not in the hash table, add it. */
if (*slot == NULL)
{
- char *demangled_name = symbol_find_demangled_name (gsymbol, tmpname);
+ char *demangled_name = symbol_find_demangled_name (gsymbol,
+ linkage_name_copy);
int demangled_len = demangled_name ? strlen (demangled_name) : 0;
/* If there is a demangled name, place it right after the mangled name.
Otherwise, just place a second zero byte after the end of the mangled
name. */
*slot = obstack_alloc (&objfile->symbol_obstack,
- len + demangled_len + 2);
- memcpy (*slot, tmpname, len + 1);
- if (demangled_name)
+ lookup_len + demangled_len + 2);
+ memcpy (*slot, lookup_name, lookup_len + 1);
+ if (demangled_name != NULL)
{
- memcpy (*slot + len + 1, demangled_name, demangled_len + 1);
+ memcpy (*slot + lookup_len + 1, demangled_name, demangled_len + 1);
xfree (demangled_name);
}
else
- (*slot)[len + 1] = 0;
+ (*slot)[lookup_len + 1] = '\0';
}
- gsymbol->name = *slot;
- if ((*slot)[len + 1])
+ gsymbol->name = *slot + lookup_len - len;
+ if ((*slot)[lookup_len + 1] != '\0')
gsymbol->language_specific.cplus_specific.demangled_name
- = &(*slot)[len + 1];
+ = &(*slot)[lookup_len + 1];
else
gsymbol->language_specific.cplus_specific.demangled_name = NULL;
}
diff --git a/gdb/symtab.h b/gdb/symtab.h
index e0ce92f..a893890 100644
--- a/gdb/symtab.h
+++ b/gdb/symtab.h
@@ -25,7 +25,9 @@
#define SYMTAB_H 1
/* Opaque declarations. */
-
+struct ui_file;
+struct frame_info;
+struct symbol;
struct obstack;
struct objfile;
struct block;
@@ -156,10 +158,10 @@ extern void symbol_init_language_specific (struct general_symbol_info *symbol,
extern void symbol_init_demangled_name (struct general_symbol_info *symbol,
struct obstack *obstack);
-#define SYMBOL_SET_NAMES(symbol,name,len,objfile) \
- symbol_set_names (&(symbol)->ginfo, name, len, objfile)
+#define SYMBOL_SET_NAMES(symbol,linkage_name,len,objfile) \
+ symbol_set_names (&(symbol)->ginfo, linkage_name, len, objfile)
extern void symbol_set_names (struct general_symbol_info *symbol,
- const char *name, int len,
+ const char *linkage_name, int len,
struct objfile *objfile);
/* Now come lots of name accessor macros. Short version as to when to
@@ -1244,6 +1246,10 @@ void maintenance_print_msymbols (char *, int);
void maintenance_print_objfiles (char *, int);
+void maintenance_list_symtabs (char *, int);
+
+void maintenance_list_psymtabs (char *, int);
+
void maintenance_check_symtabs (char *, int);
/* maint.c */
diff --git a/gdb/target.h b/gdb/target.h
index f081bd3..b3f43fc 100644
--- a/gdb/target.h
+++ b/gdb/target.h
@@ -23,6 +23,10 @@
#if !defined (TARGET_H)
#define TARGET_H
+struct objfile;
+struct ui_file;
+struct mem_attrib;
+
/* This include file defines the interface between the main part
of the debugger, and the part which is target-specific, or
specific to the communications interface between us and the
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 1bc95db..f9364cc 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,152 @@
+2003-04-15 David Carlton <carlton@math.stanford.edu>
+
+ * gdb.c++/maint.exp: New file.
+
+2003-04-14 Elena Zannoni <ezannoni@redhat.com>
+
+ * gdb.threads/schedlock.c: Change type of thread function argument
+ to long, to avoid warnings on 64-bit platforms.
+
+2003-04-14 Elena Zannoni <ezannoni@redhat.com>
+
+ * gdb.base/attach.exp: Add new message from ptrace in case of
+ attaching to nonexistent process.
+
+2003-04-11 Jim Blandy <jimb@redhat.com>
+
+ * gdb.c++/derivation.exp, gdb.c++/overload.exp,
+ gdb.c++/userdef.cc: Place comments on the lines to which the
+ marker function might return.
+ * gdb.c++/derivation.exp, gdb.c++/overload.exp,
+ gdb.c++/userdef.exp: Look for those comments to check that we've
+ returned to the right place, instead of checking line numbers.
+
+2003-04-11 Elena Zannoni <ezannoni@redhat.com>
+
+ * gdb.threads/pthreads.exp (test_startup): When setting a breakpoint
+ match on sourcefile name, instead of directory name.
+
+2003-04-10 Elena Zannoni <ezannoni@redhat.com>
+
+ * gdb.base/completion.exp: Use string_to_regexp to match the
+ working directory name.
+
+2003-04-09 Jim Blandy <jimb@redhat.com>
+
+ * gdb.c++/derivation.exp, gdb.c++/overload.exp,
+ gdb.c++/userdef.exp: If GDB fails to restore the selected frame
+ after an inferior function call, report the failure, but allow the
+ test to continue.
+
+2003-04-05 Stephane Carrez <stcarrez@nerim.fr>
+
+ * gdb.base/break.exp: marker4() is defined at line 46 when compiled
+ with -DPROTOTYPES.
+
+2003-04-05 Stephane Carrez <stcarrez@nerim.fr>
+
+ * gdb.base/break.exp: Revert last patch.
+
+2003-04-04 Stephane Carrez <stcarrez@nerim.fr>
+
+ * gdb.base/break.exp: marker4() is defined at line 46 when compiled
+ with -DPROTOTYPES.
+
+2003-04-02 Andrew Cagney <cagney@redhat.com>
+
+ * gdb.base/callfuncs.exp: Make "print add" messages unique.
+ * gdb.base/ending-run.exp: Put spaces around "breakpoint" to stop
+ matching directories by the name breakpoint.
+ * gdb.base/pointers.exp: Make "ptype pppC" message consistent.
+ Make "continue to marker1" consistent.
+ * gdb.base/call-rt-st.exp: Make "finish out from loop_count"
+ message consistent.
+ * lib/gdb.exp: Put "the program is no longer running", and "the
+ program exited" in parenthesis.
+ * lib/mi-support.exp: Ditto.
+
+2003-04-02 Bob Rossi <bob_rossi@cox.net>
+
+ * gdb.mi/mi-file.exp: New file for -file-list-exec-source-file.
+
+2003-03-29 Andrew Cagney <cagney@redhat.com>
+
+ * gdb.base/sizeof.c (main): Print the value of '\377'.
+ * gdb.base/sizeof.exp: Check the sign of '\377'.
+
+2003-03-27 Michael Chastain <mec@shout.net>
+
+ * gdb.base/gdb1090.exp: New file.
+ * gdb.base/gdb1090.cc: New file.
+
+2003-03-27 J. Brobecker <brobecker@gnat.com>
+
+ * gdb.gdb/observer.exp: New regression test.
+
+2003-03-27 Michael Chastain <mec@shout.net>
+
+ * gdb.base/list.exp: Remove setup_xfail_format for DWARF 1.
+ * gdb.base/ptype.exp: Likewise.
+
+2003-03-27 Corinna Vinschen <vinschen@redhat.com>
+
+ * gdb.c++/casts.exp: Fix startup to run also on embedded targets.
+
+2003-03-26 Michael Chastain <mec@shout.net>
+
+ * gdb.base/ptype.exp: Actually use some typedef'd types.
+
+2003-03-21 Stephane Carrez <stcarrez@nerim.fr>
+
+ * gdb.asm/asm-source.exp: Set asm-arch for m6811 and m6812.
+ * gdb.asm/m68hc11.inc: New file for HC11/HC12 macros.
+
+2003-03-20 Corinna Vinschen <vinschen@redhat.com>
+
+ * gdb.base/default.exp: Fix regular expression.
+
+2003-03-20 Corinna Vinschen <vinschen@redhat.com>
+
+ * gdb.base/args.exp: Fix regular expression.
+
+2003-03-20 Corinna Vinschen <vinschen@redhat.com>
+
+ * gdb.base/help.exp: Allow Win32 child process.
+
+2003-03-20 Corinna Vinschen <vinschen@redhat.com>
+
+ * gdb.base/ending-run.exp: Check for Cygwin specific wrapper function
+ when stepping out of main().
+
+2003-03-20 Corinna Vinschen <vinschen@redhat.com>
+
+ * gdb.base/default.exp: Check for win32 specific message when calling
+ "run" without executable.
+
+2003-03-20 Corinna Vinschen <vinschen@redhat.com>
+
+ * gdb.base/args.exp: Expect .exe in output.
+
+2003-03-20 Corinna Vinschen <vinschen@redhat.com>
+
+ * gdb.asm/asm-source.exp: Add appropriate --entry linker flag for
+ Cygwin native.
+
+2003-03-17 Andrew Cagney <cagney@redhat.com>
+
+ From Elena Zannoni <ezannoni@redhat.com>. Test e500 abi and
+ vector registes.
+ * gdb.arch/e500-regs.c, gdb.arch/e500-regs.exp: New files.
+ * gdb.arch/e500-abi.c, gdb.arch/e500-abi.exp: New files.
+
+2003-03-17 David Carlton <carlton@math.stanford.edu>
+
+ * gdb.base/watchpoint.exp (test_watchpoint_and_breakpoint): New
+ test, for PR breakpoints/38.
+ Call test_watchpoint_and_breakpoint.
+ * gdb.base/watchpoint.c (func3): New function.
+ (main): Call func3.
+
2003-03-06 David Carlton <carlton@math.stanford.edu>
* gdb.c++/templates.exp (do_tests): Make expressions for 'ptype
diff --git a/gdb/testsuite/gdb.asm/asm-source.exp b/gdb/testsuite/gdb.asm/asm-source.exp
index a42c61a..ac1bcd2 100644
--- a/gdb/testsuite/gdb.asm/asm-source.exp
+++ b/gdb/testsuite/gdb.asm/asm-source.exp
@@ -53,10 +53,21 @@ if [istarget "x86_64-*-*"] then {
}
if [istarget "i\[3456\]86-*-*"] then {
set asm-arch i386
+ if [istarget "*-*-cygwin*"] then {
+ set link-flags "--entry _start"
+ }
}
if [istarget "m32r*-*"] then {
set asm-arch m32r
}
+if [istarget "m6811-*-*"] then {
+ set asm-arch m68hc11
+ set asm-flags "-mshort-double -m68hc11 -gdwarf2 --no-warn -I${srcdir}/${subdir} -I${objdir}/${subdir}"
+}
+if [istarget "m6812-*-*"] then {
+ set asm-arch m68hc11
+ set asm-flags "-mshort-double -m68hc12 -gdwarf2 --no-warn -I${srcdir}/${subdir} -I${objdir}/${subdir}"
+}
if [istarget "mips*-*"] then {
set asm-arch mips
}
diff --git a/gdb/testsuite/gdb.base/args.exp b/gdb/testsuite/gdb.base/args.exp
index ff7ccab..e481ecb 100644
--- a/gdb/testsuite/gdb.base/args.exp
+++ b/gdb/testsuite/gdb.base/args.exp
@@ -48,7 +48,7 @@ gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_test "run" \
- "Starting program.*args 1 3.*3\r\n.*args\r\n1\r\n3.*Program exited normally." \
+ "Starting program.*args(\\.exe)? 1 3.*3\r\n.*args\r\n1\r\n3.*Program exited normally." \
"correct args printed"
#
@@ -59,7 +59,7 @@ gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_test "run" \
- "Starting program.*args 1 \\\\'\\\\' 3.*4\r\n.*args\r\n1\r\n''\r\n3.*Program exited normally." \
+ "Starting program.*args(\\.exe)? 1 \\\\'\\\\' 3.*4\r\n.*args\r\n1\r\n''\r\n3.*Program exited normally." \
"correct args printed, one empty"
#
@@ -70,7 +70,7 @@ gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_test "run" \
- "Starting program.*args 1 \\\\'\\\\' \\\\'\\\\' 3.*5\r\n.*args\r\n1\r\n''\r\n''\r\n3.*Program exited normally." \
+ "Starting program.*args(\\.exe)? 1 \\\\'\\\\' \\\\'\\\\' 3.*5\r\n.*args\r\n1\r\n''\r\n''\r\n3.*Program exited normally." \
"correct args printed, two empty"
set GDBFLAGS $old_gdbflags
diff --git a/gdb/testsuite/gdb.base/attach.exp b/gdb/testsuite/gdb.base/attach.exp
index 4019fea..c561080 100644
--- a/gdb/testsuite/gdb.base/attach.exp
+++ b/gdb/testsuite/gdb.base/attach.exp
@@ -123,6 +123,8 @@ proc do_attach_tests {} {
}
-re "Attaching to.*, process 0.*denied.*$gdb_prompt $"\
{pass "attach to nonexistent process is prohibited"}
+ -re "Attaching to.*, process 0.*Operation not permitted.*$gdb_prompt $"\
+ {pass "attach to nonexistent process is prohibited"}
-re "Attaching to.*, process .*couldn't open /proc file.*$gdb_prompt $"\
{
# Response expected from /proc-based systems.
diff --git a/gdb/testsuite/gdb.base/break.exp b/gdb/testsuite/gdb.base/break.exp
index fbc0e11..38820ec 100644
--- a/gdb/testsuite/gdb.base/break.exp
+++ b/gdb/testsuite/gdb.base/break.exp
@@ -914,6 +914,10 @@ gdb_expect {
-re "Breakpoint $decimal, $hex in marker4 \\(d=177601976\\) at .*$srcfile:51\[\r\n\]+51\[\t \]+void marker4.*" {
pass "run until breakpoint set at small function, optimized file"
}
+ -re "Breakpoint $decimal, marker4 \\(d=177601976\\) at .*$srcfile:46\[\r\n\]+46\[\t \]+void marker4.*" {
+ # marker4() is defined at line 46 when compiled with -DPROTOTYPES
+ pass "run until breakpoint set at small function, optimized file (line 46)"
+ }
-re ".*$gdb_prompt " {
fail "run until breakpoint set at small function, optimized file"
}
diff --git a/gdb/testsuite/gdb.base/call-rt-st.exp b/gdb/testsuite/gdb.base/call-rt-st.exp
index 115dcb3..0acd139 100644
--- a/gdb/testsuite/gdb.base/call-rt-st.exp
+++ b/gdb/testsuite/gdb.base/call-rt-st.exp
@@ -128,12 +128,18 @@ gdb_expect {
send_gdb "finish\n"
gdb_expect {
- -re "Run till exit from .0 loop_count \\(\\) at.*call-rt-st.c:106\[ \t\r\n\]+main \\(\\) at.*call-rt-st.c:617\[ \t\r\n\]+617\[\t \]+return 0;.*$gdb_prompt $" {
- pass "finish out from loop_count (line 617)"}
- -re "Run till exit from .0 loop_count \\(\\) at.*call-rt-st.c:106\[ \t\r\n\]+main \\(\\) at.*call-rt-st.c:615\[ \t\r\n\]+615\[\t \]+loop_count.*$gdb_prompt $" {
- pass "finish out from loop_count (line 615)"}
- -re ".*$gdb_prompt $" { fail "finish out from loop_count"}
- timeout { fail "(timeout)finish out from loop_count"}
+ -re "Run till exit from .0 loop_count \\(\\) at.*call-rt-st.c:106\[ \t\r\n\]+main \\(\\) at.*call-rt-st.c:617\[ \t\r\n\]+617\[\t \]+return 0;.*$gdb_prompt $" {
+ pass "finish out from loop_count (line 617)"
+ }
+ -re "Run till exit from .0 loop_count \\(\\) at.*call-rt-st.c:106\[ \t\r\n\]+main \\(\\) at.*call-rt-st.c:615\[ \t\r\n\]+615\[\t \]+loop_count.*$gdb_prompt $" {
+ pass "finish out from loop_count (line 615)"
+ }
+ -re ".*$gdb_prompt $" {
+ fail "finish out from loop_count"
+ }
+ timeout {
+ fail "finish out from loop_count (timeout)"
+ }
}
# Ask GDB to print the value of EXPR, and expect to see the regexp
diff --git a/gdb/testsuite/gdb.base/callfuncs.exp b/gdb/testsuite/gdb.base/callfuncs.exp
index 9183fe4..7a5f143 100644
--- a/gdb/testsuite/gdb.base/callfuncs.exp
+++ b/gdb/testsuite/gdb.base/callfuncs.exp
@@ -342,7 +342,8 @@ if ![gdb_test "bt 2" \
# Call function (causing a breakpoint hit in the call dummy) and do a finish,
# make sure we are back at main and still have the same register contents.
-gdb_test "print add(4,5)" "The program being debugged stopped while.*" ""
+gdb_test "print add(4,5)" "The program being debugged stopped while.*" \
+ "call function causing a breakpoint then do a finish"
gdb_test "finish" \
"Value returned is .* = 9" \
"finish from call dummy breakpoint returns correct value"
@@ -360,7 +361,8 @@ if ![gdb_test "bt 2" \
# Call function (causing a breakpoint hit in the call dummy) and do a return
# with a value, make sure we are back at main with the same register contents.
-gdb_test "print add(4,5)" "The program being debugged stopped while.*" ""
+gdb_test "print add(4,5)" "The program being debugged stopped while.*" \
+ "call function causing a breakpoint and then do a return"
if ![gdb_test "return 7" \
"#0 main.*" \
"back at main after return from call dummy breakpoint" \
diff --git a/gdb/testsuite/gdb.base/completion.exp b/gdb/testsuite/gdb.base/completion.exp
index 512bbdb..38bbd4b 100644
--- a/gdb/testsuite/gdb.base/completion.exp
+++ b/gdb/testsuite/gdb.base/completion.exp
@@ -669,7 +669,14 @@ cd ${srcdir}
set fullsrcdir [pwd]
cd ${mydir}
-gdb_test "cd ${fullsrcdir}" "Working directory ${fullsrcdir}.*" "cd to \${srcdir}"
+# If the directory name contains a '+' we must escape it, adding a backslash.
+# If not, the test below will fail because it will interpret the '+' as a
+# regexp operator. We use string_to_regexp for this purpose.
+
+gdb_test "cd ${fullsrcdir}" \
+ "Working directory [string_to_regexp ${fullsrcdir}].*" \
+ "cd to \${srcdir}"
+
send_gdb "file ./gdb.base/compl\t"
sleep 1
gdb_expect {
diff --git a/gdb/testsuite/gdb.base/default.exp b/gdb/testsuite/gdb.base/default.exp
index 7e3ed44..9179a53 100644
--- a/gdb/testsuite/gdb.base/default.exp
+++ b/gdb/testsuite/gdb.base/default.exp
@@ -428,6 +428,9 @@ No executable file specified.*
Use the \"file\" or \"exec-file\" command.*$gdb_prompt $"\
{ pass "run \"r\" abbreviation" }
-re "Starting program: .*
+No executable specified, use .target exec.\\..*$gdb_prompt $"\
+ { pass "run \"r\" abbreviation" }
+ -re "Starting program: .*
No image loaded into target.*$gdb_prompt $"\
{ pass "run \"r\" abbreviation" }
-re "Starting program: .*
@@ -457,6 +460,9 @@ No executable file specified.*
Use the \"file\" or \"exec-file\" command.*$gdb_prompt $"\
{ pass "run" }
-re "Starting program: .*
+No executable specified, use .target exec.\\..*$gdb_prompt $"\
+ { pass "run" }
+ -re "Starting program: .*
No image loaded into target.*$gdb_prompt $"\
{ pass "run" }
-re "Starting program: .*
diff --git a/gdb/testsuite/gdb.base/ending-run.exp b/gdb/testsuite/gdb.base/ending-run.exp
index f7e954f..3960f06 100644
--- a/gdb/testsuite/gdb.base/ending-run.exp
+++ b/gdb/testsuite/gdb.base/ending-run.exp
@@ -74,7 +74,7 @@ if [target_info exists use_gdb_stub] {
gdb_test "cle" ".*Deleted breakpoints 2 1.*" "clear worked"
send_gdb "i b\n"
gdb_expect {
- -re ".*breakpoint.*breakpoint.*$gdb_prompt $" {
+ -re ".* breakpoint .* breakpoint .*$gdb_prompt $" {
fail "cleared bp at line before routine"
}
-re ".*3.*main.*31.*$gdb_prompt $" {
@@ -120,7 +120,7 @@ gdb_expect {
send_gdb "i b\n"
gdb_expect {
- -re ".*breakpoint.*breakpoint.*$gdb_prompt $" {
+ -re ".* breakpoint .* breakpoint .*$gdb_prompt $" {
fail "all set to continue (didn't clear bps)"
}
-re ".*3.*main.*31.*$gdb_prompt $" {
@@ -171,6 +171,10 @@ gdb_expect {
# This is what happens on sparc64-elf ultra.
pass "step out of main"
}
+ -re ".*in.*dll_crt0_1.*$gdb_prompt $" {
+ # This is what happens on Cygwin.
+ pass "step out of main"
+ }
-re ".*Program exited normally.*$gdb_prompt $" {
# This is what happens on Linux i86 (and I would expect others)
set program_exited 1
diff --git a/gdb/testsuite/gdb.base/help.exp b/gdb/testsuite/gdb.base/help.exp
index 69cf40d..2eed1dc 100644
--- a/gdb/testsuite/gdb.base/help.exp
+++ b/gdb/testsuite/gdb.base/help.exp
@@ -547,7 +547,7 @@ gdb_test "help support" "Support facilities\.\[\r\n\]+List of commands:.*\[\r\n\
# test help symbol-file
gdb_test "help symbol-file" "Load symbol table from executable file FILE\.\[\r\n\]+The `file' command can also load symbol tables, as well as setting the file\[\r\n\]+to execute\." "help symbol-file"
# test help target child
-gdb_test "help target child" "Unix child process \\(started by the \"run\" command\\)\.|Undefined target command: \"child\"\. Try \"help target\"\." "help target child"
+gdb_test "help target child" "(Unix|Win32) child process \\(started by the \"run\" command\\)\.|Undefined target command: \"child\"\. Try \"help target\"\." "help target child"
# test help target procfs
gdb_test "help target procfs" "Unix /proc child process \\(started by the \"run\" command\\)\.|Undefined target command: \"procfs\"\. Try \"help target\"\." "help target procfs (procfs version)"
# test help target core
diff --git a/gdb/testsuite/gdb.base/list.exp b/gdb/testsuite/gdb.base/list.exp
index dee9152..84a15cf 100644
--- a/gdb/testsuite/gdb.base/list.exp
+++ b/gdb/testsuite/gdb.base/list.exp
@@ -164,11 +164,9 @@ proc test_listsize {} {
proc test_list_include_file {} {
global gdb_prompt
- setup_xfail_format "DWARF 1"
setup_xfail_format "COFF"
gdb_test "list list0.h:1" "1\[ \t\]+/\[*\]+ An include file .*10\[ \t\]+bar \\(x\\+\\+\\);" "list line 1 in include file"
- setup_xfail_format "DWARF 1"
setup_xfail_format "COFF"
gdb_test "list list0.h:100" "Line number 95 out of range; .*list0.h has 3\[67\] lines." "list message for lines past EOF"
}
@@ -239,7 +237,6 @@ proc test_list_function {} {
# Ultrix gdb is the second case, still correct.
# SunPRO cc is the third case.
setup_xfail "powerpc-*-*"
- setup_xfail_format "DWARF 1"
gdb_test "list foo" "(3\[ \t\]+.*12\[ \t\]+bar \[(\]+.*\[)\]+;|2\[ \t\]+including file.*11\[ \t\]+bar \[(\]+.*\[)\]+;|1\[ \t\]+/. An include file.*10\[ \t\]+bar \[(\]+.*\[)\]+;)" "list function in include file"
}
@@ -427,7 +424,6 @@ proc test_list_filename_and_function {} {
# SunPRO cc is the third case.
setup_xfail "rs6000-*-*" 1804
setup_xfail "powerpc-*-*" 1804
- setup_xfail_format "DWARF 1"
setup_xfail_format "COFF"
send_gdb "list list0.h:foo\n"
gdb_expect {
@@ -496,7 +492,6 @@ proc test_list_filename_and_function {} {
gdb_test "list foobar.c:main" "No source file named foobar.c.|Location not found" "list filename:function; nonexistant file"
- setup_xfail_format "DWARF 1"
gdb_test "list list0.h:foobar" "Function \"foobar\" not defined.|Location not found" "list filename:function; nonexistant function"
}
diff --git a/gdb/testsuite/gdb.base/pointers.exp b/gdb/testsuite/gdb.base/pointers.exp
index 5f406ad..a10a7f3 100644
--- a/gdb/testsuite/gdb.base/pointers.exp
+++ b/gdb/testsuite/gdb.base/pointers.exp
@@ -366,23 +366,28 @@ gdb_expect {
send_gdb "break marker1\n" ; gdb_expect -re ".*$gdb_prompt $"
- send_gdb "cont\n"
- gdb_expect {
- -re "Break.* marker1 \\(\\) at .*:$decimal.*$gdb_prompt $" {
- send_gdb "up\n"
- gdb_expect {
- -re ".*more_code.*$gdb_prompt $" {
- pass "up from marker1"
- }
- -re ".*$gdb_prompt $" {
- fail "up from marker1"
- }
- timeout { fail "up from marker1 (timeout)" }
- }
- }
- -re "$gdb_prompt $" { fail "continue to marker1" }
- timeout { fail "(timeout) continue to marker1" }
+send_gdb "cont\n"
+gdb_expect {
+ -re "Break.* marker1 \\(\\) at .*:$decimal.*$gdb_prompt $" {
+ pass "continue to marker1"
+ send_gdb "up\n"
+ gdb_expect {
+ -re ".*more_code.*$gdb_prompt $" {
+ pass "up from marker1"
+ }
+ -re ".*$gdb_prompt $" {
+ fail "up from marker1"
+ }
+ timeout { fail "up from marker1 (timeout)" }
+ }
+ }
+ -re "$gdb_prompt $" {
+ fail "continue to marker1"
}
+ timeout {
+ fail "continue to marker1 (timeout)"
+ }
+}
send_gdb "print *pUC\n"
@@ -568,7 +573,7 @@ gdb_expect {
send_gdb "ptype pppC\n"
gdb_expect {
- -re "type = char \\*\\*\\*.*$gdb_prompt $" { pass "ptype pppC" }
+ -re "type = char \\*\\*\\*.*$gdb_prompt $" { pass "ptype pppC" }
-re ".*$gdb_prompt $" { fail "ptype pppC" }
timeout { fail "(timeout) ptype pppC" }
}
diff --git a/gdb/testsuite/gdb.base/ptype.c b/gdb/testsuite/gdb.base/ptype.c
index 2c85c7c..397a714 100644
--- a/gdb/testsuite/gdb.base/ptype.c
+++ b/gdb/testsuite/gdb.base/ptype.c
@@ -59,6 +59,7 @@ double v_double_array[2];
/* PR 3742 */
typedef char t_char_array[];
+t_char_array *pv_char_array;
/**** pointers *******/
@@ -237,6 +238,8 @@ int (*xptr) (int (*) (), int (*) (void), int);
int (*(*ffptr) (char)) (short);
int (*(*(*fffptr) (char)) (short)) (long);
+func_type v_func_type;
+
/* Here are the sort of stabs we expect to see for the above:
.stabs "func_type:t(0,100)=*(0,101)=g(0,1)(0,102)=*(0,103)=g(0,1)(0,1)(0,14)#(0,14)#",128,0,234,0
diff --git a/gdb/testsuite/gdb.base/ptype.exp b/gdb/testsuite/gdb.base/ptype.exp
index 6e33d85..6580b43 100644
--- a/gdb/testsuite/gdb.base/ptype.exp
+++ b/gdb/testsuite/gdb.base/ptype.exp
@@ -1,5 +1,5 @@
# Copyright 1988, 1990, 1991, 1992, 1994, 1995, 1996, 1997, 1999,
-# 2000, 2002 Free Software Foundation, Inc.
+# 2000, 2002, 2003 Free Software Foundation, Inc.
# 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
@@ -137,7 +137,6 @@ if {!$gcc_compiled && !$hp_aCC_compiler} {
# For get_debug_format to do its job, we need to have a current source file.
gdb_test "list main" ""
get_debug_format
-setup_xfail_format "DWARF 1"
gdb_test "whatis v_boolean" "type = (enum |)boolean" \
"whatis unnamed typedef'd enum (compiler bug in IBM's xlc)"
@@ -370,7 +369,6 @@ gdb_test "ptype v_int" "type = int.*" "ptype int"
#
if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" "i*86-*-sysv4*" }
-setup_xfail_format "DWARF 1"
if {$hp_aCC_compiler} {setup_xfail "hppa*-*-*"}
gdb_test "ptype t_char_array" "type = (|unsigned )char \\\[0?\\\]"
diff --git a/gdb/testsuite/gdb.base/sizeof.c b/gdb/testsuite/gdb.base/sizeof.c
index 95d379e..c32231f 100644
--- a/gdb/testsuite/gdb.base/sizeof.c
+++ b/gdb/testsuite/gdb.base/sizeof.c
@@ -114,6 +114,7 @@ main ()
printf ("sizeof (long double) == %d\n", sizeof (long double));
/* Signed char? */
+ printf ("valueof ('\\377') == %d\n", '\377');
printf ("valueof ((int) (char) -1) == %d\n", (int) (char) -1);
printf ("valueof ((int) (signed char) -1) == %d\n", (int) (signed char) -1);
printf ("valueof ((int) (unsigned char) -1) == %d\n", (int) (unsigned char) -1);
diff --git a/gdb/testsuite/gdb.base/sizeof.exp b/gdb/testsuite/gdb.base/sizeof.exp
index 7c03905..7fcbe0e 100644
--- a/gdb/testsuite/gdb.base/sizeof.exp
+++ b/gdb/testsuite/gdb.base/sizeof.exp
@@ -154,10 +154,12 @@ proc check_valueof { exp val } {
# Check that GDB and the target agree over the sign of a character.
+set signof_byte [get_valueof "/d" "'\\377'" -1]
set signof_char [get_valueof "/d" "(int) (char) -1" -1]
set signof_signed_char [get_valueof "/d" "(int) (signed char) -1" -1]
set signof_unsigned_char [get_valueof "/d" "(int) (unsigned char) -1" -1]
+check_valueof "'\\\\377'" ${signof_byte}
check_valueof "(int) (char) -1" ${signof_char}
check_valueof "(int) (signed char) -1" ${signof_signed_char}
check_valueof "(int) (unsigned char) -1" ${signof_unsigned_char}
diff --git a/gdb/testsuite/gdb.base/watchpoint.c b/gdb/testsuite/gdb.base/watchpoint.c
index 14ccecd..1a61ba1 100644
--- a/gdb/testsuite/gdb.base/watchpoint.c
+++ b/gdb/testsuite/gdb.base/watchpoint.c
@@ -83,6 +83,18 @@ func2 ()
static_b = local_a;
}
+void
+func3 ()
+{
+ int x;
+ int y;
+
+ x = 0;
+ x = 1; /* second x assignment */
+ y = 1;
+ y = 2;
+}
+
int
func1 ()
{
@@ -170,5 +182,8 @@ int main ()
recurser (2);
marker6 ();
+
+ func3 ();
+
return 0;
}
diff --git a/gdb/testsuite/gdb.base/watchpoint.exp b/gdb/testsuite/gdb.base/watchpoint.exp
index f10955f..c5e37d4 100644
--- a/gdb/testsuite/gdb.base/watchpoint.exp
+++ b/gdb/testsuite/gdb.base/watchpoint.exp
@@ -648,6 +648,27 @@ proc test_complex_watchpoint {} {
}
}
+proc test_watchpoint_and_breakpoint {} {
+ global gdb_prompt
+
+ # This is a test for PR gdb/38, which involves setting a
+ # watchpoint right after you've reached a breakpoint.
+
+ if [runto func3] then {
+ gdb_breakpoint [gdb_get_line_number "second x assignment"]
+ gdb_continue_to_breakpoint "second x assignment"
+ gdb_test "watch x" ".*atchpoint \[0-9\]+: x"
+ gdb_test_multiple "next" "next after watch x" {
+ -re ".*atchpoint \[0-9\]+: x\r\n\r\nOld value = 0\r\nNew value = 1\r\n.*$gdb_prompt $" {
+ pass "next after watch x"
+ }
+ -re "\[0-9\]+\[\t \]+y = 1;\r\n$gdb_prompt $" {
+ kfail "gdb/38" "next after watch x"
+ }
+ }
+ }
+}
+
# Start with a fresh gdb.
gdb_exit
@@ -799,6 +820,17 @@ if [initialize] then {
timeout {fail "(timeout) access watches disallowed"}
}
}
+
+ # See above.
+ if [istarget "mips-idt-*"] then {
+ gdb_exit
+ gdb_start
+ gdb_reinitialize_dir $srcdir/$subdir
+ gdb_load $binfile
+ initialize
+ }
+
+ test_watchpoint_and_breakpoint
}
# Restore old timeout
diff --git a/gdb/testsuite/gdb.c++/casts.exp b/gdb/testsuite/gdb.c++/casts.exp
index 859755f..5b6cabe 100644
--- a/gdb/testsuite/gdb.c++/casts.exp
+++ b/gdb/testsuite/gdb.c++/casts.exp
@@ -55,11 +55,16 @@ gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}
+if ![runto_main] then {
+ perror "couldn't run to breakpoint"
+ continue
+}
+
gdb_test "break [gdb_get_line_number "casts.exp: 1"]" \
"Breakpoint.*at.* file .*" \
""
-gdb_test "run" "Breakpoint .* at .*casts.cc.*" ""
+gdb_test "continue" "Breakpoint .* at .*casts.cc.*" ""
# Casting a pointer to a base class to a pointer to a derived class
# should yield the entire derived class. Until August 2002, GDB got
diff --git a/gdb/testsuite/gdb.c++/derivation.cc b/gdb/testsuite/gdb.c++/derivation.cc
index 99efa76..f6d42e7 100644
--- a/gdb/testsuite/gdb.c++/derivation.cc
+++ b/gdb/testsuite/gdb.c++/derivation.cc
@@ -214,9 +214,9 @@ int main(void)
#endif
- marker1();
+ marker1(); // marker1-returns-here
- a_instance.a = 20;
+ a_instance.a = 20; // marker1-returns-here
a_instance.aa = 21;
b_instance.b = 22;
b_instance.bb = 23;
diff --git a/gdb/testsuite/gdb.c++/derivation.exp b/gdb/testsuite/gdb.c++/derivation.exp
index 9128730..38a46a2 100644
--- a/gdb/testsuite/gdb.c++/derivation.exp
+++ b/gdb/testsuite/gdb.c++/derivation.exp
@@ -300,6 +300,24 @@ gdb_expect {
timeout { fail "(timeout) print value of g_instance.afoo()" }
}
+
+# If GDB fails to restore the selected frame properly after the
+# inferior function call above (see GDB PR 1155 for an explanation of
+# why this might happen), all the subsequent tests will fail. We
+# should detect report that failure, but let the marker call finish so
+# that the rest of the tests can run undisturbed.
+gdb_test_multiple "frame" "re-selected 'main' frame after inferior call" {
+ -re "#0 marker1.*$gdb_prompt $" {
+ setup_kfail "gdb/1155" s390-*-linux-gnu
+ fail "re-selected 'main' frame after inferior call"
+ gdb_test "finish" ".*main.*at .*derivation.cc:.*// marker1-returns-here.*" \
+ "finish call to marker1"
+ }
+ -re "#1 ($hex in )?main.*$gdb_prompt $" {
+ pass "re-selected 'main' frame after inferior call"
+ }
+}
+
send_gdb "print g_instance.bfoo()\n"
gdb_expect {
-re ".\[0-9\]* = 2.*$gdb_prompt $" {
diff --git a/gdb/testsuite/gdb.c++/overload.cc b/gdb/testsuite/gdb.c++/overload.cc
index 9ac0d22..a41e14d 100644
--- a/gdb/testsuite/gdb.c++/overload.cc
+++ b/gdb/testsuite/gdb.c++/overload.cc
@@ -105,9 +105,9 @@ int main ()
// Verify that intToChar should work:
intToChar(1);
- marker1();
- XXX::marker2();
- return 0;
+ marker1(); // marker1-returns-here
+ XXX::marker2(); // marker1-returns-here
+ return 0;
}
foo::foo (int i) { ifoo = i; ccpfoo = NULL; }
diff --git a/gdb/testsuite/gdb.c++/overload.exp b/gdb/testsuite/gdb.c++/overload.exp
index c41e3f2..7a2ecb4 100644
--- a/gdb/testsuite/gdb.c++/overload.exp
+++ b/gdb/testsuite/gdb.c++/overload.exp
@@ -120,6 +120,24 @@ gdb_expect {
}
+# If GDB fails to restore the selected frame properly after the
+# inferior function call above (see GDB PR 1155 for an explanation of
+# why this might happen), all the subsequent tests will fail. We
+# should detect and report that failure, but let the marker call
+# finish so that the rest of the tests can run undisturbed.
+gdb_test_multiple "frame" "re-selected 'main' frame after inferior call" {
+ -re "#0 marker1.*$gdb_prompt $" {
+ setup_kfail "gdb/1155" s390-*-linux-gnu
+ fail "re-selected 'main' frame after inferior call"
+ gdb_test "finish" ".*main.*at .*overload.cc:.*// marker1-returns-here.*" \
+ "finish call to marker1"
+ }
+ -re "#1 ($hex in )?main.*$gdb_prompt $" {
+ pass "re-selected 'main' frame after inferior call"
+ }
+}
+
+
send_gdb "print foo_instance1.overloadargs(1, 2)\n"
gdb_expect {
-re ".\[0-9\]* = 2\r\n$gdb_prompt $" {
diff --git a/gdb/testsuite/gdb.c++/userdef.cc b/gdb/testsuite/gdb.c++/userdef.cc
index 95a4055..0bb88a2 100644
--- a/gdb/testsuite/gdb.c++/userdef.cc
+++ b/gdb/testsuite/gdb.c++/userdef.cc
@@ -273,8 +273,8 @@ int main (void)
A1 three(0,0);
int val;
- marker1();
- cout << one;
+ marker1(); // marker1-returns-here
+ cout << one; // marker1-returns-here
cout << two;
three = one + two;
cout << "+ " << three;
diff --git a/gdb/testsuite/gdb.c++/userdef.exp b/gdb/testsuite/gdb.c++/userdef.exp
index a46aba6..4575249 100644
--- a/gdb/testsuite/gdb.c++/userdef.exp
+++ b/gdb/testsuite/gdb.c++/userdef.exp
@@ -66,6 +66,23 @@ send_gdb "break marker1\n" ; gdb_expect -re ".*$gdb_prompt $"
gdb_test "print one + two" "\\\$\[0-9\]* = {x = 6, y = 8}"
+# If GDB fails to restore the selected frame properly after the
+# inferior function call above (see GDB PR 1155 for an explanation of
+# why this might happen), all the subsequent tests will fail. We
+# should detect report that failure, but let the marker call finish so
+# that the rest of the tests can run undisturbed.
+gdb_test_multiple "frame" "re-selected 'main' frame after inferior call" {
+ -re "#0 marker1.*$gdb_prompt $" {
+ setup_kfail "gdb/1155" s390-*-linux-gnu
+ fail "re-selected 'main' frame after inferior call"
+ gdb_test "finish" ".*main.*at .*userdef.cc:.*// marker1-returns-here.*" \
+ "finish call to marker1"
+ }
+ -re "#1 ($hex in )?main.*$gdb_prompt $" {
+ pass "re-selected 'main' frame after inferior call"
+ }
+}
+
gdb_test "print one - two" "\\\$\[0-9\]* = {x = -2, y = -2}"
gdb_test "print one * two" "\\\$\[0-9\]* = {x = 8, y = 15}"
diff --git a/gdb/testsuite/gdb.mi/ChangeLog b/gdb/testsuite/gdb.mi/ChangeLog
index d089462..d2aae78 100644
--- a/gdb/testsuite/gdb.mi/ChangeLog
+++ b/gdb/testsuite/gdb.mi/ChangeLog
@@ -1,3 +1,7 @@
+2003-04-08 Andrew Cagney <cagney@redhat.com>
+
+ * gdb792.exp: Skip when C++.
+
2003-02-23 Stephane Carrez <stcarrez@nerim.fr>
* mi-syn-frame.exp: Don't run this test when gdb,nosignals is set.
diff --git a/gdb/testsuite/gdb.mi/gdb792.exp b/gdb/testsuite/gdb.mi/gdb792.exp
index 3fc6df0..8196464 100644
--- a/gdb/testsuite/gdb.mi/gdb792.exp
+++ b/gdb/testsuite/gdb.mi/gdb792.exp
@@ -21,6 +21,8 @@
# test gdb/792
#
+if { [skip_cplus_tests] } { continue }
+
load_lib mi-support.exp
set MIFLAGS "-i=mi"
diff --git a/gdb/testsuite/gdb.threads/pthreads.exp b/gdb/testsuite/gdb.threads/pthreads.exp
index 1ab019b..5dbe1a8 100644
--- a/gdb/testsuite/gdb.threads/pthreads.exp
+++ b/gdb/testsuite/gdb.threads/pthreads.exp
@@ -186,7 +186,7 @@ proc test_startup {} {
set main_id $expect_out(1,string)
# Check that we can continue and create the first thread.
- gdb_test "break thread1" "Breakpoint .* file .*$srcdir.*"
+ gdb_test "break thread1" "Breakpoint .* file .*$srcfile.*"
gdb_test "continue" \
"Continuing.*Breakpoint .*, thread1 \\(arg=0xfeedface\\).*at.*$srcfile.*" \
"Continue to creation of first thread"
@@ -199,7 +199,7 @@ proc test_startup {} {
# Check that we can continue and create the second thread,
# ignoring the first thread for the moment.
- gdb_test "break thread2" "Breakpoint .* file .*$srcdir.*"
+ gdb_test "break thread2" "Breakpoint .* file .*$srcfile.*"
gdb_test "continue" \
"Continuing.*Breakpoint .*, thread2 \\(arg=0xdeadbeef\\).*at.*$srcfile.*" \
"Continue to creation of second thread"
diff --git a/gdb/testsuite/gdb.threads/schedlock.c b/gdb/testsuite/gdb.threads/schedlock.c
index 033131c..13f9e75 100644
--- a/gdb/testsuite/gdb.threads/schedlock.c
+++ b/gdb/testsuite/gdb.threads/schedlock.c
@@ -13,12 +13,15 @@ int main() {
int res;
pthread_t threads[NUM];
void *thread_result;
- int i;
+ long i;
for (i = 0; i < NUM; i++)
{
args[i] = 1;
- res = pthread_create(&threads[i], NULL, thread_function, (void *)i);
+ res = pthread_create(&threads[i],
+ NULL,
+ thread_function,
+ (void *) i);
}
/* schedlock.exp: last thread start. */
@@ -29,7 +32,7 @@ int main() {
}
void *thread_function(void *arg) {
- int my_number = (int) arg;
+ int my_number = (long) arg;
int *myp = &args[my_number];
/* Don't run forever. Run just short of it :) */
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index d2b6fbd..4dfbf76 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -541,27 +541,27 @@ proc gdb_test_multiple { command message user_code } {
}
-re "Program exited with code \[0-9\]+.*$gdb_prompt $" {
if ![string match "" $message] then {
- set errmsg "$message: the program exited"
+ set errmsg "$message (the program exited)"
} else {
- set errmsg "$command: the program exited"
+ set errmsg "$command (the program exited)"
}
fail "$errmsg"
set result -1
}
-re "EXIT code \[0-9\r\n\]+Program exited normally.*$gdb_prompt $" {
if ![string match "" $message] then {
- set errmsg "$message: the program exited"
+ set errmsg "$message (the program exited)"
} else {
- set errmsg "$command: the program exited"
+ set errmsg "$command (the program exited)"
}
fail "$errmsg"
set result -1
}
-re "The program is not being run.*$gdb_prompt $" {
if ![string match "" $message] then {
- set errmsg "$message: the program is no longer running"
+ set errmsg "$message (the program is no longer running)"
} else {
- set errmsg "$command: the program is no longer running"
+ set errmsg "$command (the program is no longer running)"
}
fail "$errmsg"
set result -1
diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp
index 4b057d4..5907628 100644
--- a/gdb/testsuite/lib/mi-support.exp
+++ b/gdb/testsuite/lib/mi-support.exp
@@ -549,18 +549,18 @@ proc mi_gdb_test { args } {
}
-re "Program exited with code \[0-9\]+.*$mi_gdb_prompt\[ \]*$" {
if ![string match "" $message] then {
- set errmsg "$message: the program exited"
+ set errmsg "$message (the program exited)"
} else {
- set errmsg "$command: the program exited"
+ set errmsg "$command (the program exited)"
}
fail "$errmsg"
return -1
}
-re "The program is not being run.*$mi_gdb_prompt\[ \]*$" {
if ![string match "" $message] then {
- set errmsg "$message: the program is no longer running"
+ set errmsg "$message (the program is no longer running)"
} else {
- set errmsg "$command: the program is no longer running"
+ set errmsg "$command (the program is no longer running)"
}
fail "$errmsg"
return -1
diff --git a/gdb/thread.c b/gdb/thread.c
index 2c70ee5..53a2d4f 100644
--- a/gdb/thread.c
+++ b/gdb/thread.c
@@ -255,9 +255,8 @@ in_thread_list (ptid_t ptid)
/* Print a list of thread ids currently known, and the total number of
threads. To be used from within catch_errors. */
-static int
-do_captured_list_thread_ids (struct ui_out *uiout,
- void *arg)
+static int
+do_captured_list_thread_ids (struct ui_out *uiout, void *arg)
{
struct thread_info *tp;
int num = 0;
@@ -291,24 +290,22 @@ gdb_list_thread_ids (struct ui_out *uiout)
/* Load infrun state for the thread PID. */
void
-load_infrun_state (ptid_t ptid,
- CORE_ADDR *prev_pc,
- CORE_ADDR *prev_func_start,
- char **prev_func_name,
+load_infrun_state (ptid_t ptid,
+ CORE_ADDR *prev_pc,
+ char **prev_func_name,
int *trap_expected,
struct breakpoint **step_resume_breakpoint,
struct breakpoint **through_sigtramp_breakpoint,
- CORE_ADDR *step_range_start,
+ CORE_ADDR *step_range_start,
CORE_ADDR *step_range_end,
- struct frame_id *step_frame_id,
+ struct frame_id *step_frame_id,
int *handling_longjmp,
- int *another_trap,
+ int *another_trap,
int *stepping_through_solib_after_catch,
bpstat *stepping_through_solib_catchpoints,
int *stepping_through_sigtramp,
- int *current_line,
- struct symtab **current_symtab,
- CORE_ADDR *step_sp)
+ int *current_line,
+ struct symtab **current_symtab, CORE_ADDR *step_sp)
{
struct thread_info *tp;
@@ -319,7 +316,6 @@ load_infrun_state (ptid_t ptid,
return;
*prev_pc = tp->prev_pc;
- *prev_func_start = tp->prev_func_start;
*prev_func_name = tp->prev_func_name;
*trap_expected = tp->trap_expected;
*step_resume_breakpoint = tp->step_resume_breakpoint;
@@ -329,8 +325,10 @@ load_infrun_state (ptid_t ptid,
*step_frame_id = tp->step_frame_id;
*handling_longjmp = tp->handling_longjmp;
*another_trap = tp->another_trap;
- *stepping_through_solib_after_catch = tp->stepping_through_solib_after_catch;
- *stepping_through_solib_catchpoints = tp->stepping_through_solib_catchpoints;
+ *stepping_through_solib_after_catch =
+ tp->stepping_through_solib_after_catch;
+ *stepping_through_solib_catchpoints =
+ tp->stepping_through_solib_catchpoints;
*stepping_through_sigtramp = tp->stepping_through_sigtramp;
*current_line = tp->current_line;
*current_symtab = tp->current_symtab;
@@ -340,24 +338,22 @@ load_infrun_state (ptid_t ptid,
/* Save infrun state for the thread PID. */
void
-save_infrun_state (ptid_t ptid,
- CORE_ADDR prev_pc,
- CORE_ADDR prev_func_start,
- char *prev_func_name,
+save_infrun_state (ptid_t ptid,
+ CORE_ADDR prev_pc,
+ char *prev_func_name,
int trap_expected,
struct breakpoint *step_resume_breakpoint,
struct breakpoint *through_sigtramp_breakpoint,
- CORE_ADDR step_range_start,
+ CORE_ADDR step_range_start,
CORE_ADDR step_range_end,
- const struct frame_id *step_frame_id,
+ const struct frame_id *step_frame_id,
int handling_longjmp,
- int another_trap,
+ int another_trap,
int stepping_through_solib_after_catch,
bpstat stepping_through_solib_catchpoints,
- int stepping_through_sigtramp,
+ int stepping_through_sigtramp,
int current_line,
- struct symtab *current_symtab,
- CORE_ADDR step_sp)
+ struct symtab *current_symtab, CORE_ADDR step_sp)
{
struct thread_info *tp;
@@ -368,7 +364,6 @@ save_infrun_state (ptid_t ptid,
return;
tp->prev_pc = prev_pc;
- tp->prev_func_start = prev_func_start;
tp->prev_func_name = prev_func_name;
tp->trap_expected = trap_expected;
tp->step_resume_breakpoint = step_resume_breakpoint;
@@ -506,7 +501,7 @@ switch_to_thread (ptid_t ptid)
static void
restore_current_thread (ptid_t ptid)
{
- if (! ptid_equal (ptid, inferior_ptid))
+ if (!ptid_equal (ptid, inferior_ptid))
{
switch_to_thread (ptid);
print_stack_frame (get_current_frame (), 0, -1);
@@ -571,14 +566,13 @@ thread_apply_all_command (char *cmd, int from_tty)
switch_to_thread (tp->ptid);
#ifdef HPUXHPPA
printf_filtered ("\nThread %d (%s):\n",
- tp->num,
- target_tid_to_str (inferior_ptid));
+ tp->num, target_tid_to_str (inferior_ptid));
#else
printf_filtered ("\nThread %d (%s):\n", tp->num,
target_pid_to_str (inferior_ptid));
#endif
execute_command (cmd, from_tty);
- strcpy (cmd, saved_cmd); /* Restore exact command used previously */
+ strcpy (cmd, saved_cmd); /* Restore exact command used previously */
}
do_cleanups (saved_cmd_cleanup_chain);
@@ -690,8 +684,7 @@ thread_command (char *tidstr, int from_tty)
}
static int
-do_captured_thread_select (struct ui_out *uiout,
- void *tidstr)
+do_captured_thread_select (struct ui_out *uiout, void *tidstr)
{
int num;
struct thread_info *tp;
@@ -724,8 +717,7 @@ do_captured_thread_select (struct ui_out *uiout,
}
enum gdb_rc
-gdb_thread_select (struct ui_out *uiout,
- char *tidstr)
+gdb_thread_select (struct ui_out *uiout, char *tidstr)
{
return catch_exceptions (uiout, do_captured_thread_select, tidstr,
NULL, RETURN_MASK_ALL);
@@ -744,16 +736,14 @@ _initialize_thread (void)
add_prefix_cmd ("thread", class_run, thread_command,
"Use this command to switch between threads.\n\
-The new thread ID must be currently known.", &thread_cmd_list, "thread ", 1,
- &cmdlist);
+The new thread ID must be currently known.", &thread_cmd_list, "thread ", 1, &cmdlist);
add_prefix_cmd ("apply", class_run, thread_apply_command,
"Apply a command to a list of threads.",
&thread_apply_list, "apply ", 1, &thread_cmd_list);
add_cmd ("all", class_run, thread_apply_all_command,
- "Apply a command to all threads.",
- &thread_apply_list);
+ "Apply a command to all threads.", &thread_apply_list);
if (!xdb_commands)
add_com_alias ("t", "thread", class_run, 1);
diff --git a/gdb/tui/ChangeLog b/gdb/tui/ChangeLog
index c3e659d..7069f96 100644
--- a/gdb/tui/ChangeLog
+++ b/gdb/tui/ChangeLog
@@ -1,3 +1,17 @@
+2003-03-14 Andrew Cagney <cagney@redhat.com>
+
+ * tuiRegs.c (_tuiGetRegisterRawValue): Use frame_read_register,
+ instead of get_saved_register.
+
+2003-03-13 Stephane Carrez <stcarrez@nerim.fr>
+
+ * tui-out.c (tui_out_data): Fix typedef.
+
+2003-03-08 Andrew Cagney <cagney@redhat.com>
+
+ * tui-out.c: Update copyright.
+ (tui_out_data): Define typedef. Use instead of ui_out_data.
+
2003-02-14 Andrew Cagney <ac131313@redhat.com>
* tui.c (tui_enable, tui_disable): Don't modify tui_version.
diff --git a/gdb/tui/tui-out.c b/gdb/tui/tui-out.c
index 71ce5e0..94fda09 100644
--- a/gdb/tui/tui-out.c
+++ b/gdb/tui/tui-out.c
@@ -1,6 +1,7 @@
/* Output generating routines for GDB CLI.
- Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright 1999, 2000, 2001, 2002, 2003 Free Software Foundation,
+ Inc.
Contributed by Cygnus Solutions.
Written by Fernando Nasser for Cygnus.
@@ -35,6 +36,7 @@ struct ui_out_data
int line;
int start_of_line;
};
+typedef struct ui_out_data tui_out_data;
/* These are the CLI output functions */
@@ -112,7 +114,7 @@ tui_table_begin (struct ui_out *uiout, int nbrofcols,
int nr_rows,
const char *tblid)
{
- struct ui_out_data *data = ui_out_data (uiout);
+ tui_out_data *data = ui_out_data (uiout);
if (nr_rows == 0)
data->suppress_output = 1;
else
@@ -126,7 +128,7 @@ tui_table_begin (struct ui_out *uiout, int nbrofcols,
void
tui_table_body (struct ui_out *uiout)
{
- struct ui_out_data *data = ui_out_data (uiout);
+ tui_out_data *data = ui_out_data (uiout);
if (data->suppress_output)
return;
/* first, close the table header line */
@@ -138,7 +140,7 @@ tui_table_body (struct ui_out *uiout)
void
tui_table_end (struct ui_out *uiout)
{
- struct ui_out_data *data = ui_out_data (uiout);
+ tui_out_data *data = ui_out_data (uiout);
data->suppress_output = 0;
}
@@ -149,7 +151,7 @@ tui_table_header (struct ui_out *uiout, int width, enum ui_align alignment,
const char *col_name,
const char *colhdr)
{
- struct ui_out_data *data = ui_out_data (uiout);
+ tui_out_data *data = ui_out_data (uiout);
if (data->suppress_output)
return;
tui_field_string (uiout, 0, width, alignment, 0, colhdr);
@@ -163,7 +165,7 @@ tui_begin (struct ui_out *uiout,
int level,
const char *id)
{
- struct ui_out_data *data = ui_out_data (uiout);
+ tui_out_data *data = ui_out_data (uiout);
if (data->suppress_output)
return;
}
@@ -175,7 +177,7 @@ tui_end (struct ui_out *uiout,
enum ui_out_type type,
int level)
{
- struct ui_out_data *data = ui_out_data (uiout);
+ tui_out_data *data = ui_out_data (uiout);
if (data->suppress_output)
return;
}
@@ -189,7 +191,7 @@ tui_field_int (struct ui_out *uiout, int fldno, int width,
{
char buffer[20]; /* FIXME: how many chars long a %d can become? */
- struct ui_out_data *data = ui_out_data (uiout);
+ tui_out_data *data = ui_out_data (uiout);
if (data->suppress_output)
return;
@@ -212,7 +214,7 @@ tui_field_skip (struct ui_out *uiout, int fldno, int width,
enum ui_align alignment,
const char *fldname)
{
- struct ui_out_data *data = ui_out_data (uiout);
+ tui_out_data *data = ui_out_data (uiout);
if (data->suppress_output)
return;
tui_field_string (uiout, fldno, width, alignment, fldname, "");
@@ -232,7 +234,7 @@ tui_field_string (struct ui_out *uiout,
int before = 0;
int after = 0;
- struct ui_out_data *data = ui_out_data (uiout);
+ tui_out_data *data = ui_out_data (uiout);
if (data->suppress_output)
return;
@@ -290,7 +292,7 @@ tui_field_fmt (struct ui_out *uiout, int fldno,
const char *format,
va_list args)
{
- struct ui_out_data *data = ui_out_data (uiout);
+ tui_out_data *data = ui_out_data (uiout);
if (data->suppress_output)
return;
@@ -304,7 +306,7 @@ tui_field_fmt (struct ui_out *uiout, int fldno,
void
tui_spaces (struct ui_out *uiout, int numspaces)
{
- struct ui_out_data *data = ui_out_data (uiout);
+ tui_out_data *data = ui_out_data (uiout);
if (data->suppress_output)
return;
print_spaces_filtered (numspaces, data->stream);
@@ -313,7 +315,7 @@ tui_spaces (struct ui_out *uiout, int numspaces)
void
tui_text (struct ui_out *uiout, const char *string)
{
- struct ui_out_data *data = ui_out_data (uiout);
+ tui_out_data *data = ui_out_data (uiout);
if (data->suppress_output)
return;
data->start_of_line ++;
@@ -335,7 +337,7 @@ void
tui_message (struct ui_out *uiout, int verbosity,
const char *format, va_list args)
{
- struct ui_out_data *data = ui_out_data (uiout);
+ tui_out_data *data = ui_out_data (uiout);
if (data->suppress_output)
return;
if (ui_out_get_verblvl (uiout) >= verbosity)
@@ -345,7 +347,7 @@ tui_message (struct ui_out *uiout, int verbosity,
void
tui_wrap_hint (struct ui_out *uiout, char *identstring)
{
- struct ui_out_data *data = ui_out_data (uiout);
+ tui_out_data *data = ui_out_data (uiout);
if (data->suppress_output)
return;
wrap_here (identstring);
@@ -354,7 +356,7 @@ tui_wrap_hint (struct ui_out *uiout, char *identstring)
void
tui_flush (struct ui_out *uiout)
{
- struct ui_out_data *data = ui_out_data (uiout);
+ tui_out_data *data = ui_out_data (uiout);
gdb_flush (data->stream);
}
@@ -369,7 +371,7 @@ out_field_fmt (struct ui_out *uiout, int fldno,
const char *fldname,
const char *format,...)
{
- struct ui_out_data *data = ui_out_data (uiout);
+ tui_out_data *data = ui_out_data (uiout);
va_list args;
va_start (args, format);
@@ -383,7 +385,7 @@ out_field_fmt (struct ui_out *uiout, int fldno,
static void
field_separator (void)
{
- struct ui_out_data *data = ui_out_data (uiout);
+ tui_out_data *data = ui_out_data (uiout);
fputc_filtered (' ', data->stream);
}
@@ -394,7 +396,7 @@ tui_out_new (struct ui_file *stream)
{
int flags = 0;
- struct ui_out_data *data = XMALLOC (struct ui_out_data);
+ tui_out_data *data = XMALLOC (tui_out_data);
data->stream = stream;
data->suppress_output = 0;
data->line = -1;
diff --git a/gdb/tui/tuiRegs.c b/gdb/tui/tuiRegs.c
index 6fc63d9..6920d80 100644
--- a/gdb/tui/tuiRegs.c
+++ b/gdb/tui/tuiRegs.c
@@ -799,10 +799,10 @@ _tuiGetRegisterRawValue (int regNum, char *regValue, struct frame_info *frame)
if (target_has_registers)
{
- int opt;
-
- get_saved_register (regValue, &opt, (CORE_ADDR*) NULL, frame,
- regNum, (enum lval_type*) NULL);
+ frame_read_register (frame, regNum, regValue);
+ /* NOTE: cagney/2003-03-13: This is bogus. It is refering to
+ the register cache and not the frame which could have pulled
+ the register value off the stack. */
if (register_cached (regNum) >= 0)
ret = TUI_SUCCESS;
}
diff --git a/gdb/typeprint.h b/gdb/typeprint.h
index c57cc58..f2de1c5 100644
--- a/gdb/typeprint.h
+++ b/gdb/typeprint.h
@@ -22,6 +22,8 @@
#ifndef TYPEPRINT_H
#define TYPEPRINT_H
+struct ui_file;
+
void print_type_scalar (struct type * type, LONGEST, struct ui_file *);
void c_type_print_varspec_suffix (struct type *, struct ui_file *, int,
diff --git a/gdb/utils.c b/gdb/utils.c
index d0f2edd..6d62f1c 100644
--- a/gdb/utils.c
+++ b/gdb/utils.c
@@ -1073,16 +1073,15 @@ xmmalloc (void *md, size_t size)
{
void *val;
+ /* See libiberty/xmalloc.c. This function need's to match that's
+ semantics. It never returns NULL. */
if (size == 0)
- {
- val = NULL;
- }
- else
- {
- val = mmalloc (md, size);
- if (val == NULL)
- nomem (size);
- }
+ size = 1;
+
+ val = mmalloc (md, size);
+ if (val == NULL)
+ nomem (size);
+
return (val);
}
@@ -1091,27 +1090,18 @@ xmrealloc (void *md, void *ptr, size_t size)
{
void *val;
+ /* See libiberty/xmalloc.c. This function need's to match that's
+ semantics. It never returns NULL. */
if (size == 0)
- {
- if (ptr != NULL)
- mfree (md, ptr);
- val = NULL;
- }
+ size = 1;
+
+ if (ptr != NULL)
+ val = mrealloc (md, ptr, size);
else
- {
- if (ptr != NULL)
- {
- val = mrealloc (md, ptr, size);
- }
- else
- {
- val = mmalloc (md, size);
- }
- if (val == NULL)
- {
- nomem (size);
- }
- }
+ val = mmalloc (md, size);
+ if (val == NULL)
+ nomem (size);
+
return (val);
}
@@ -1119,14 +1109,19 @@ void *
xmcalloc (void *md, size_t number, size_t size)
{
void *mem;
+
+ /* See libiberty/xmalloc.c. This function need's to match that's
+ semantics. It never returns NULL. */
if (number == 0 || size == 0)
- mem = NULL;
- else
{
- mem = mcalloc (md, number, size);
- if (mem == NULL)
- nomem (number * size);
+ number = 1;
+ size = 1;
}
+
+ mem = mcalloc (md, number, size);
+ if (mem == NULL)
+ nomem (number * size);
+
return mem;
}
@@ -2299,22 +2294,7 @@ fprintf_symbol_filtered (struct ui_file *stream, const char *name,
}
else
{
- switch (lang)
- {
- case language_cplus:
- demangled = cplus_demangle (name, arg_mode);
- break;
- case language_java:
- demangled = cplus_demangle (name, arg_mode | DMGL_JAVA);
- break;
- case language_objc:
- /* Commented out until ObjC handling is enabled. */
- /*demangled = objc_demangle (name); */
- /*break; */
- default:
- demangled = NULL;
- break;
- }
+ demangled = language_demangle (language_def (lang), name, arg_mode);
fputs_filtered (demangled ? demangled : name, stream);
if (demangled != NULL)
{
diff --git a/gdb/v850-tdep.c b/gdb/v850-tdep.c
index 0894a8f..de81056 100644
--- a/gdb/v850-tdep.c
+++ b/gdb/v850-tdep.c
@@ -826,7 +826,7 @@ v850_frame_chain (struct frame_info *fi)
CORE_ADDR callers_pc, fp;
/* First, find out who called us */
- callers_pc = FRAME_SAVED_PC (fi);
+ callers_pc = DEPRECATED_FRAME_SAVED_PC (fi);
/* If caller is a call-dummy, then our FP bears no relation to his FP! */
fp = v850_find_callers_reg (fi, E_FP_RAW_REGNUM);
if (DEPRECATED_PC_IN_CALL_DUMMY (callers_pc, fp, fp))
@@ -892,7 +892,7 @@ v850_pop_frame (void)
generic_pop_dummy_frame ();
else
{
- write_register (E_PC_REGNUM, FRAME_SAVED_PC (frame));
+ write_register (E_PC_REGNUM, DEPRECATED_FRAME_SAVED_PC (frame));
for (regnum = 0; regnum < E_NUM_REGS; regnum++)
if (get_frame_saved_regs (frame)[regnum] != 0)
@@ -1165,7 +1165,7 @@ v850_init_extra_frame_info (int fromleaf, struct frame_info *fi)
struct prologue_info pi;
if (get_next_frame (fi))
- deprecated_update_frame_pc_hack (fi, FRAME_SAVED_PC (get_next_frame (fi)));
+ deprecated_update_frame_pc_hack (fi, DEPRECATED_FRAME_SAVED_PC (get_next_frame (fi)));
v850_frame_init_saved_regs (fi);
}
@@ -1244,9 +1244,9 @@ v850_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
*/
set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, v850_frame_init_saved_regs);
set_gdbarch_deprecated_init_extra_frame_info (gdbarch, v850_init_extra_frame_info);
- set_gdbarch_frame_chain (gdbarch, v850_frame_chain);
- set_gdbarch_saved_pc_after_call (gdbarch, v850_saved_pc_after_call);
- set_gdbarch_frame_saved_pc (gdbarch, v850_frame_saved_pc);
+ set_gdbarch_deprecated_frame_chain (gdbarch, v850_frame_chain);
+ set_gdbarch_deprecated_saved_pc_after_call (gdbarch, v850_saved_pc_after_call);
+ set_gdbarch_deprecated_frame_saved_pc (gdbarch, v850_frame_saved_pc);
set_gdbarch_skip_prologue (gdbarch, v850_skip_prologue);
/*
@@ -1268,24 +1268,16 @@ v850_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
* Call Dummies
*
* These values and methods are used when gdb calls a target function. */
- set_gdbarch_push_return_address (gdbarch, v850_push_return_address);
+ set_gdbarch_deprecated_push_return_address (gdbarch, v850_push_return_address);
set_gdbarch_deprecated_extract_return_value (gdbarch, v850_extract_return_value);
- set_gdbarch_push_arguments (gdbarch, v850_push_arguments);
- set_gdbarch_pop_frame (gdbarch, v850_pop_frame);
- set_gdbarch_store_struct_return (gdbarch, v850_store_struct_return);
+ set_gdbarch_deprecated_push_arguments (gdbarch, v850_push_arguments);
+ set_gdbarch_deprecated_pop_frame (gdbarch, v850_pop_frame);
+ set_gdbarch_deprecated_store_struct_return (gdbarch, v850_store_struct_return);
set_gdbarch_deprecated_store_return_value (gdbarch, v850_store_return_value);
set_gdbarch_deprecated_extract_struct_value_address (gdbarch, v850_extract_struct_value_address);
set_gdbarch_use_struct_convention (gdbarch, v850_use_struct_convention);
- set_gdbarch_call_dummy_address (gdbarch, entry_point_address);
- set_gdbarch_call_dummy_start_offset (gdbarch, 0);
- set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 0);
- set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 1);
- set_gdbarch_call_dummy_length (gdbarch, 0);
- set_gdbarch_call_dummy_p (gdbarch, 1);
set_gdbarch_call_dummy_words (gdbarch, call_dummy_nil);
set_gdbarch_sizeof_call_dummy_words (gdbarch, 0);
- set_gdbarch_call_dummy_stack_adjust_p (gdbarch, 0);
- /* set_gdbarch_call_dummy_stack_adjust */
set_gdbarch_fix_call_dummy (gdbarch, v850_fix_call_dummy);
set_gdbarch_breakpoint_from_pc (gdbarch, v850_breakpoint_from_pc);
@@ -1294,7 +1286,8 @@ v850_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_addr_bit (gdbarch, 4 * TARGET_CHAR_BIT);
set_gdbarch_long_double_bit (gdbarch, 8 * TARGET_CHAR_BIT);
- set_gdbarch_extra_stack_alignment_needed (gdbarch, 0);
+ /* Should be using push_dummy_call. */
+ set_gdbarch_deprecated_dummy_write_sp (gdbarch, generic_target_write_sp);
return gdbarch;
}
diff --git a/gdb/valarith.c b/gdb/valarith.c
index e1b4426..97b3370 100644
--- a/gdb/valarith.c
+++ b/gdb/valarith.c
@@ -276,6 +276,7 @@ value_subscripted_rvalue (struct value *array, struct value *idx, int lowerbound
else
VALUE_LVAL (v) = VALUE_LVAL (array);
VALUE_ADDRESS (v) = VALUE_ADDRESS (array);
+ VALUE_REGNO (v) = VALUE_REGNO (array);
VALUE_OFFSET (v) = VALUE_OFFSET (array) + elt_offs;
return v;
}
diff --git a/gdb/valops.c b/gdb/valops.c
index 647a7fc..1b7f174 100644
--- a/gdb/valops.c
+++ b/gdb/valops.c
@@ -1126,8 +1126,8 @@ value_push (register CORE_ADDR sp, struct value *arg)
}
CORE_ADDR
-default_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
- int struct_return, CORE_ADDR struct_addr)
+legacy_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
+ int struct_return, CORE_ADDR struct_addr)
{
/* ASSERT ( !struct_return); */
int i;
@@ -1287,8 +1287,8 @@ find_function_addr (struct value *function, struct type **retval_type)
ARGS is modified to contain coerced values. */
-static struct value *
-hand_function_call (struct value *function, int nargs, struct value **args)
+struct value *
+call_function_by_hand (struct value *function, int nargs, struct value **args)
{
register CORE_ADDR sp;
register int i;
@@ -1311,6 +1311,7 @@ hand_function_call (struct value *function, int nargs, struct value **args)
static ULONGEST *dummy;
int sizeof_dummy1;
char *dummy1;
+ CORE_ADDR dummy_addr;
CORE_ADDR old_sp;
struct type *value_type;
unsigned char struct_return;
@@ -1350,7 +1351,7 @@ hand_function_call (struct value *function, int nargs, struct value **args)
if (DEPRECATED_PUSH_DUMMY_FRAME_P ())
{
/* DEPRECATED_PUSH_DUMMY_FRAME is responsible for saving the
- inferior registers (and POP_FRAME for restoring them). (At
+ inferior registers (and frame_pop() for restoring them). (At
least on most machines) they are saved on the stack in the
inferior. */
DEPRECATED_PUSH_DUMMY_FRAME;
@@ -1421,9 +1422,9 @@ hand_function_call (struct value *function, int nargs, struct value **args)
be able to correctly perform back traces. If a target is
having trouble with backtraces, first thing to do is add
FRAME_ALIGN() to its architecture vector. After that, try
- adding SAVE_DUMMY_FRAME_TOS() and modifying FRAME_CHAIN so that
- when the next outer frame is a generic dummy, it returns the
- current frame's base. */
+ adding SAVE_DUMMY_FRAME_TOS() and modifying
+ DEPRECATED_FRAME_CHAIN so that when the next outer frame is a
+ generic dummy, it returns the current frame's base. */
sp = old_sp;
if (INNER_THAN (1, 2))
@@ -1470,26 +1471,34 @@ hand_function_call (struct value *function, int nargs, struct value **args)
real_pc = FIX_CALL_DUMMY (dummy1, start_sp, funaddr, nargs, args,
value_type, using_gcc);
#else
- FIX_CALL_DUMMY (dummy1, start_sp, funaddr, nargs, args,
- value_type, using_gcc);
+ if (FIX_CALL_DUMMY_P ())
+ {
+ /* gdb_assert (CALL_DUMMY_LOCATION == ON_STACK) true? */
+ FIX_CALL_DUMMY (dummy1, start_sp, funaddr, nargs, args, value_type,
+ using_gcc);
+ }
real_pc = start_sp;
#endif
- if (CALL_DUMMY_LOCATION == ON_STACK)
+ switch (CALL_DUMMY_LOCATION)
{
+ case ON_STACK:
+ dummy_addr = start_sp;
write_memory (start_sp, (char *) dummy1, sizeof_dummy1);
if (DEPRECATED_USE_GENERIC_DUMMY_FRAMES)
generic_save_call_dummy_addr (start_sp, start_sp + sizeof_dummy1);
- }
-
- if (CALL_DUMMY_LOCATION == AT_ENTRY_POINT)
- {
+ break;
+ case AT_ENTRY_POINT:
real_pc = funaddr;
+ dummy_addr = CALL_DUMMY_ADDRESS ();
if (DEPRECATED_USE_GENERIC_DUMMY_FRAMES)
/* NOTE: cagney/2002-04-13: The entry point is going to be
modified with a single breakpoint. */
generic_save_call_dummy_addr (CALL_DUMMY_ADDRESS (),
CALL_DUMMY_ADDRESS () + 1);
+ break;
+ default:
+ internal_error (__FILE__, __LINE__, "bad switch");
}
#ifdef lint
@@ -1616,9 +1625,8 @@ You must use a pointer to function type variable. Command ignored.", arg_name);
{
int len = TYPE_LENGTH (value_type);
if (STACK_ALIGN_P ())
- /* MVS 11/22/96: I think at least some of this stack_align
- code is really broken. Better to let PUSH_ARGUMENTS adjust
- the stack in a target-defined manner. */
+ /* NOTE: cagney/2003-03-22: Should rely on frame align, rather
+ than stack align to force the alignment of the stack. */
len = STACK_ALIGN (len);
if (INNER_THAN (1, 2))
{
@@ -1646,10 +1654,13 @@ You must use a pointer to function type variable. Command ignored.", arg_name);
on other architectures. This is because all the alignment is
taken care of in the above code (ifdef REG_STRUCT_HAS_ADDR) and
in hppa_push_arguments */
- if (EXTRA_STACK_ALIGNMENT_NEEDED)
+ /* NOTE: cagney/2003-03-24: The below code is very broken. Given an
+ odd sized parameter the below will mis-align the stack. As was
+ suggested back in '96, better to let PUSH_ARGUMENTS handle it. */
+ if (DEPRECATED_EXTRA_STACK_ALIGNMENT_NEEDED)
{
/* MVS 11/22/96: I think at least some of this stack_align code
- is really broken. Better to let PUSH_ARGUMENTS adjust the
+ is really broken. Better to let push_dummy_call() adjust the
stack in a target-defined manner. */
if (STACK_ALIGN_P () && INNER_THAN (1, 2))
{
@@ -1658,15 +1669,30 @@ You must use a pointer to function type variable. Command ignored.", arg_name);
for (i = nargs - 1; i >= 0; i--)
len += TYPE_LENGTH (VALUE_ENCLOSING_TYPE (args[i]));
- if (CALL_DUMMY_STACK_ADJUST_P)
- len += CALL_DUMMY_STACK_ADJUST;
+ if (DEPRECATED_CALL_DUMMY_STACK_ADJUST_P ())
+ len += DEPRECATED_CALL_DUMMY_STACK_ADJUST;
sp -= STACK_ALIGN (len) - len;
}
}
- sp = PUSH_ARGUMENTS (nargs, args, sp, struct_return, struct_addr);
+ /* Create the dummy stack frame. Pass in the call dummy address as,
+ presumably, the ABI code knows where, in the call dummy, the
+ return address should be pointed. */
+ if (gdbarch_push_dummy_call_p (current_gdbarch))
+ /* When there is no push_dummy_call method, should this code
+ simply error out. That would the implementation of this method
+ for all ABIs (which is probably a good thing). */
+ sp = gdbarch_push_dummy_call (current_gdbarch, current_regcache,
+ dummy_addr, nargs, args, sp, struct_return,
+ struct_addr);
+ else if (DEPRECATED_PUSH_ARGUMENTS_P ())
+ /* Keep old targets working. */
+ sp = DEPRECATED_PUSH_ARGUMENTS (nargs, args, sp, struct_return,
+ struct_addr);
+ else
+ sp = legacy_push_arguments (nargs, args, sp, struct_return, struct_addr);
- if (PUSH_RETURN_ADDRESS_P ())
+ if (DEPRECATED_PUSH_RETURN_ADDRESS_P ())
/* for targets that use no CALL_DUMMY */
/* There are a number of targets now which actually don't write
any CALL_DUMMY instructions into the target, but instead just
@@ -1677,14 +1703,19 @@ You must use a pointer to function type variable. Command ignored.", arg_name);
return-address register as appropriate. Formerly this has been
done in PUSH_ARGUMENTS, but that's overloading its
functionality a bit, so I'm making it explicit to do it here. */
- sp = PUSH_RETURN_ADDRESS (real_pc, sp);
+ sp = DEPRECATED_PUSH_RETURN_ADDRESS (real_pc, sp);
- if (STACK_ALIGN_P () && !INNER_THAN (1, 2))
+ /* NOTE: cagney/2003-03-23: Diable this code when there is a
+ push_dummy_call() method. Since that method will have already
+ handled any alignment issues, the code below is entirely
+ redundant. */
+ if (!gdbarch_push_dummy_call_p (current_gdbarch)
+ && STACK_ALIGN_P () && !INNER_THAN (1, 2))
{
/* If stack grows up, we must leave a hole at the bottom, note
that sp already has been advanced for the arguments! */
- if (CALL_DUMMY_STACK_ADJUST_P)
- sp += CALL_DUMMY_STACK_ADJUST;
+ if (DEPRECATED_CALL_DUMMY_STACK_ADJUST_P ())
+ sp += DEPRECATED_CALL_DUMMY_STACK_ADJUST;
sp = STACK_ALIGN (sp);
}
@@ -1693,30 +1724,31 @@ You must use a pointer to function type variable. Command ignored.", arg_name);
/* MVS 11/22/96: I think at least some of this stack_align code is
really broken. Better to let PUSH_ARGUMENTS adjust the stack in
a target-defined manner. */
- if (CALL_DUMMY_STACK_ADJUST_P)
+ if (DEPRECATED_CALL_DUMMY_STACK_ADJUST_P ())
if (INNER_THAN (1, 2))
{
/* stack grows downward */
- sp -= CALL_DUMMY_STACK_ADJUST;
+ sp -= DEPRECATED_CALL_DUMMY_STACK_ADJUST;
}
/* Store the address at which the structure is supposed to be
- written. Note that this (and the code which reserved the space
- above) assumes that gcc was used to compile this function. Since
- it doesn't cost us anything but space and if the function is pcc
- it will ignore this value, we will make that assumption.
-
- Also note that on some machines (like the sparc) pcc uses a
- convention like gcc's. */
-
- if (struct_return)
- STORE_STRUCT_RETURN (struct_addr, sp);
+ written. */
+ /* NOTE: 2003-03-24: Since PUSH_ARGUMENTS can (and typically does)
+ store the struct return address, this call is entirely redundant. */
+ if (struct_return && DEPRECATED_STORE_STRUCT_RETURN_P ())
+ DEPRECATED_STORE_STRUCT_RETURN (struct_addr, sp);
/* Write the stack pointer. This is here because the statements above
might fool with it. On SPARC, this write also stores the register
window into the right place in the new stack frame, which otherwise
wouldn't happen. (See store_inferior_registers in sparc-nat.c.) */
- write_sp (sp);
+ /* NOTE: cagney/2003-03-23: Disable this code when there is a
+ push_dummy_call() method. Since that method will have already
+ stored the stack pointer (as part of creating the fake call
+ frame), and none of the code following that code adjusts the
+ stack-pointer value, the below call is entirely redundant. */
+ if (DEPRECATED_DUMMY_WRITE_SP_P ())
+ DEPRECATED_DUMMY_WRITE_SP (sp);
if (SAVE_DUMMY_FRAME_TOS_P ())
SAVE_DUMMY_FRAME_TOS (sp);
@@ -1874,21 +1906,6 @@ the function call).", name);
}
}
-struct value *
-call_function_by_hand (struct value *function, int nargs, struct value **args)
-{
- if (CALL_DUMMY_P)
- {
- return hand_function_call (function, nargs, args);
- }
- else
- {
- error ("Cannot invoke functions on this machine.");
- }
-}
-
-
-
/* Create a value for an array by allocating space in the inferior, copying
the data into that space, and then setting up an array value.
diff --git a/gdb/valprint.c b/gdb/valprint.c
index b1c47a1..d4b8bf5 100644
--- a/gdb/valprint.c
+++ b/gdb/valprint.c
@@ -205,12 +205,8 @@ val_print_type_code_int (struct type *type, char *valaddr,
}
else
{
-#ifdef PRINT_TYPELESS_INTEGER
- PRINT_TYPELESS_INTEGER (stream, type, unpack_long (type, valaddr));
-#else
print_longest (stream, TYPE_UNSIGNED (type) ? 'u' : 'd', 0,
unpack_long (type, valaddr));
-#endif
}
}
diff --git a/gdb/valprint.h b/gdb/valprint.h
index 52314aa..4e2d166 100644
--- a/gdb/valprint.h
+++ b/gdb/valprint.h
@@ -33,6 +33,12 @@ extern int objectprint; /* Controls looking up an object's derived type
extern unsigned int print_max; /* Max # of chars for strings/vectors */
+/* Flag to low-level print routines that this value is being printed
+ in an epoch window. We'd like to pass this as a parameter, but
+ every routine would need to take it. Perhaps we can encapsulate
+ this in the I/O stream once we have GNU stdio. */
+extern int inspect_it;
+
/* Print repeat counts if there are more than this many repetitions of an
element in an array. Referenced by the low level language dependent
print routines. */
diff --git a/gdb/value.h b/gdb/value.h
index 928f940..102b709 100644
--- a/gdb/value.h
+++ b/gdb/value.h
@@ -23,6 +23,10 @@
#if !defined (VALUE_H)
#define VALUE_H 1
+struct ui_file;
+struct expression;
+struct symbol;
+struct type;
struct regcache;
struct block;
@@ -128,9 +132,7 @@ struct value
list. */
struct value *next;
- /* Register number if the value is from a register. Is not kept
- if you take a field of a structure that is stored in a
- register. Shouldn't it be? */
+ /* Register number if the value is from a register. */
short regno;
/* If zero, contents of this value are in the contents field.
If nonzero, contents are in inferior memory at address
@@ -560,9 +562,9 @@ extern struct value *find_function_in_inferior (const char *);
extern struct value *value_allocate_space_in_inferior (int);
-extern CORE_ADDR default_push_arguments (int nargs, struct value ** args,
- CORE_ADDR sp, int struct_return,
- CORE_ADDR struct_addr);
+extern CORE_ADDR legacy_push_arguments (int nargs, struct value ** args,
+ CORE_ADDR sp, int struct_return,
+ CORE_ADDR struct_addr);
extern struct value *value_of_local (const char *name, int complain);
diff --git a/gdb/vax-tdep.c b/gdb/vax-tdep.c
index ab968b6..859e2b3 100644
--- a/gdb/vax-tdep.c
+++ b/gdb/vax-tdep.c
@@ -40,20 +40,16 @@ static gdbarch_register_virtual_size_ftype vax_register_virtual_size;
static gdbarch_register_virtual_type_ftype vax_register_virtual_type;
static gdbarch_skip_prologue_ftype vax_skip_prologue;
-static gdbarch_saved_pc_after_call_ftype vax_saved_pc_after_call;
static gdbarch_frame_num_args_ftype vax_frame_num_args;
-static gdbarch_frame_chain_ftype vax_frame_chain;
-static gdbarch_frame_saved_pc_ftype vax_frame_saved_pc;
+static gdbarch_deprecated_frame_chain_ftype vax_frame_chain;
static gdbarch_frame_args_address_ftype vax_frame_args_address;
static gdbarch_frame_locals_address_ftype vax_frame_locals_address;
-static gdbarch_store_struct_return_ftype vax_store_struct_return;
static gdbarch_deprecated_extract_return_value_ftype vax_extract_return_value;
static gdbarch_deprecated_extract_struct_value_address_ftype
vax_extract_struct_value_address;
static gdbarch_deprecated_push_dummy_frame_ftype vax_push_dummy_frame;
-static gdbarch_pop_frame_ftype vax_pop_frame;
static gdbarch_fix_call_dummy_ftype vax_fix_call_dummy;
/* Return 1 if P points to an invalid floating point value.
@@ -375,7 +371,7 @@ vax_skip_prologue (CORE_ADDR pc)
static CORE_ADDR
vax_saved_pc_after_call (struct frame_info *frame)
{
- return (FRAME_SAVED_PC(frame));
+ return (DEPRECATED_FRAME_SAVED_PC(frame));
}
/* Print the vax instruction at address MEMADDR in debugged memory,
@@ -643,14 +639,14 @@ vax_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
/* Frame and stack info */
set_gdbarch_skip_prologue (gdbarch, vax_skip_prologue);
- set_gdbarch_saved_pc_after_call (gdbarch, vax_saved_pc_after_call);
+ set_gdbarch_deprecated_saved_pc_after_call (gdbarch, vax_saved_pc_after_call);
set_gdbarch_frame_num_args (gdbarch, vax_frame_num_args);
set_gdbarch_frameless_function_invocation (gdbarch,
generic_frameless_function_invocation_not);
- set_gdbarch_frame_chain (gdbarch, vax_frame_chain);
- set_gdbarch_frame_saved_pc (gdbarch, vax_frame_saved_pc);
+ set_gdbarch_deprecated_frame_chain (gdbarch, vax_frame_chain);
+ set_gdbarch_deprecated_frame_saved_pc (gdbarch, vax_frame_saved_pc);
set_gdbarch_frame_args_address (gdbarch, vax_frame_args_address);
set_gdbarch_frame_locals_address (gdbarch, vax_frame_locals_address);
@@ -662,25 +658,21 @@ vax_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
/* Return value info */
- set_gdbarch_store_struct_return (gdbarch, vax_store_struct_return);
+ set_gdbarch_deprecated_store_struct_return (gdbarch, vax_store_struct_return);
set_gdbarch_deprecated_extract_return_value (gdbarch, vax_extract_return_value);
set_gdbarch_deprecated_store_return_value (gdbarch, vax_store_return_value);
set_gdbarch_deprecated_extract_struct_value_address (gdbarch, vax_extract_struct_value_address);
/* Call dummy info */
set_gdbarch_deprecated_push_dummy_frame (gdbarch, vax_push_dummy_frame);
- set_gdbarch_pop_frame (gdbarch, vax_pop_frame);
+ set_gdbarch_deprecated_pop_frame (gdbarch, vax_pop_frame);
set_gdbarch_call_dummy_location (gdbarch, ON_STACK);
- set_gdbarch_call_dummy_p (gdbarch, 1);
set_gdbarch_call_dummy_words (gdbarch, vax_call_dummy_words);
set_gdbarch_sizeof_call_dummy_words (gdbarch, sizeof_vax_call_dummy_words);
set_gdbarch_fix_call_dummy (gdbarch, vax_fix_call_dummy);
- set_gdbarch_call_dummy_start_offset (gdbarch, 0);
- set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 1);
set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 7);
set_gdbarch_deprecated_use_generic_dummy_frames (gdbarch, 0);
set_gdbarch_deprecated_pc_in_call_dummy (gdbarch, deprecated_pc_in_call_dummy_on_stack);
- set_gdbarch_call_dummy_stack_adjust_p (gdbarch, 0);
/* Breakpoint info */
set_gdbarch_breakpoint_from_pc (gdbarch, vax_breakpoint_from_pc);
@@ -690,6 +682,9 @@ vax_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_function_start_offset (gdbarch, 2);
set_gdbarch_believe_pcc_promotion (gdbarch, 1);
+ /* Should be using push_dummy_call. */
+ set_gdbarch_deprecated_dummy_write_sp (gdbarch, generic_target_write_sp);
+
/* Hook in ABI-specific overrides, if they have been registered. */
gdbarch_init_osabi (info, gdbarch);
diff --git a/gdb/version.in b/gdb/version.in
index 8a8ed14..6665297 100644
--- a/gdb/version.in
+++ b/gdb/version.in
@@ -1 +1 @@
-2003-03-05-cvs
+2003-04-16-cvs
diff --git a/gdb/x86-64-tdep.c b/gdb/x86-64-tdep.c
index 5ba1da2..f3c08e3 100644
--- a/gdb/x86-64-tdep.c
+++ b/gdb/x86-64-tdep.c
@@ -240,17 +240,6 @@ x86_64_dwarf2_reg_to_regnum (int dw_reg)
return x86_64_dwarf2gdb_regno_map[dw_reg];
}
-/* This is the variable that is set with "set disassembly-flavour", and
- its legitimate values. */
-static const char att_flavour[] = "att";
-static const char intel_flavour[] = "intel";
-static const char *valid_flavours[] = {
- att_flavour,
- intel_flavour,
- NULL
-};
-static const char *disassembly_flavour = att_flavour;
-
/* Push the return address (pointing to the call dummy) onto the stack
and return the new value for the stack pointer. */
@@ -471,6 +460,8 @@ classify_argument (struct type *type,
return 2;
}
break;
+ case TYPE_CODE_ENUM:
+ case TYPE_CODE_REF:
case TYPE_CODE_INT:
case TYPE_CODE_PTR:
switch (bytes)
@@ -700,11 +691,17 @@ x86_64_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
intreg += 2;
break;
case X86_64_INTEGERSI_CLASS:
- deprecated_write_register_gen (int_parameter_registers[intreg / 2],
- VALUE_CONTENTS_ALL (args[i]) + offset);
- offset += 8;
- intreg++;
- break;
+ {
+ LONGEST num
+ = extract_signed_integer (VALUE_CONTENTS_ALL (args[i])
+ + offset, 4);
+ regcache_raw_write_signed (current_regcache,
+ int_parameter_registers[intreg / 2], num);
+
+ offset += 8;
+ intreg++;
+ break;
+ }
case X86_64_SSEDF_CLASS:
case X86_64_SSESF_CLASS:
case X86_64_SSE_CLASS:
@@ -773,7 +770,7 @@ x86_64_store_return_value (struct type *type, struct regcache *regcache,
floating point format used by the FPU. This is probably
not exactly how it would happen on the target itself, but
it is the best we can do. */
- val = extract_floating (valbuf, TYPE_LENGTH (type));
+ val = deprecated_extract_floating (valbuf, TYPE_LENGTH (type));
floatformat_from_doublest (&floatformat_i387_ext, &val, buf);
regcache_cooked_write_part (regcache, FP0_REGNUM,
0, FPU_REG_RAW_SIZE, buf);
@@ -820,23 +817,6 @@ x86_64_register_number (const char *name)
}
-
-/* We have two flavours of disassembly. The machinery on this page
- deals with switching between those. */
-
-static int
-gdb_print_insn_x86_64 (bfd_vma memaddr, disassemble_info * info)
-{
- if (disassembly_flavour == att_flavour)
- return print_insn_i386_att (memaddr, info);
- else if (disassembly_flavour == intel_flavour)
- return print_insn_i386_intel (memaddr, info);
- /* Never reached -- disassembly_flavour is always either att_flavour
- or intel_flavour. */
- internal_error (__FILE__, __LINE__, "failed internal consistency check");
-}
-
-
/* Store the address of the place in which to copy the structure the
subroutine will return. This is called from call_function. */
void
@@ -851,11 +831,34 @@ x86_64_frameless_function_invocation (struct frame_info *frame)
return 0;
}
+/* We will handle only functions beginning with:
+ 55 pushq %rbp
+ 48 89 e5 movq %rsp,%rbp
+ Any function that doesn't start with this sequence
+ will be assumed to have no prologue and thus no valid
+ frame pointer in %rbp. */
+#define PROLOG_BUFSIZE 4
+int
+x86_64_function_has_prologue (CORE_ADDR pc)
+{
+ int i;
+ unsigned char prolog_expect[PROLOG_BUFSIZE] = { 0x55, 0x48, 0x89, 0xe5 },
+ prolog_buf[PROLOG_BUFSIZE];
+
+ read_memory (pc, (char *) prolog_buf, PROLOG_BUFSIZE);
+
+ /* First check, whether pc points to pushq %rbp, movq %rsp,%rbp. */
+ for (i = 0; i < PROLOG_BUFSIZE; i++)
+ if (prolog_expect[i] != prolog_buf[i])
+ return 0; /* ... no, it doesn't. Nothing to skip. */
+
+ return 1;
+}
+
/* If a function with debugging information and known beginning
is detected, we will return pc of the next line in the source
code. With this approach we effectively skip the prolog. */
-#define PROLOG_BUFSIZE 4
CORE_ADDR
x86_64_skip_prologue (CORE_ADDR pc)
{
@@ -863,21 +866,9 @@ x86_64_skip_prologue (CORE_ADDR pc)
struct symtab_and_line v_sal;
struct symbol *v_function;
CORE_ADDR endaddr;
- unsigned char prolog_buf[PROLOG_BUFSIZE];
-
- /* We will handle only functions starting with: */
- static unsigned char prolog_expect[PROLOG_BUFSIZE] =
- {
- 0x55, /* pushq %rbp */
- 0x48, 0x89, 0xe5 /* movq %rsp, %rbp */
- };
- read_memory (pc, (char *) prolog_buf, PROLOG_BUFSIZE);
-
- /* First check, whether pc points to pushq %rbp, movq %rsp, %rbp. */
- for (i = 0; i < PROLOG_BUFSIZE; i++)
- if (prolog_expect[i] != prolog_buf[i])
- return pc; /* ... no, it doesn't. Nothing to skip. */
+ if (! x86_64_function_has_prologue (pc))
+ return pc;
/* OK, we have found the prologue and want PC of the first
non-prologue instruction. */
@@ -904,13 +895,21 @@ x86_64_skip_prologue (CORE_ADDR pc)
return pc;
}
-/* Sequence of bytes for breakpoint instruction. */
-static const unsigned char *
-x86_64_breakpoint_from_pc (CORE_ADDR *pc, int *lenptr)
+static void
+x86_64_save_dummy_frame_tos (CORE_ADDR sp)
+{
+ /* We must add the size of the return address that is already
+ put on the stack. */
+ generic_save_dummy_frame_tos (sp +
+ TYPE_LENGTH (builtin_type_void_func_ptr));
+}
+
+static struct frame_id
+x86_64_unwind_dummy_id (struct gdbarch *gdbarch, struct frame_info *frame)
{
- static unsigned char breakpoint[] = { 0xcc };
- *lenptr = 1;
- return breakpoint;
+ CORE_ADDR base;
+ frame_unwind_unsigned_register (frame, SP_REGNUM, &base);
+ return frame_id_build (base, frame_pc_unwind (frame));
}
void
@@ -975,17 +974,17 @@ x86_64_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
x86_64_register_convert_to_raw);
/* Getting saved registers is handled by unwind information. */
- set_gdbarch_get_saved_register (gdbarch, cfi_get_saved_register);
+ set_gdbarch_deprecated_get_saved_register (gdbarch, cfi_get_saved_register);
/* FIXME: kettenis/20021026: Should we set parm_boundary to 64 here? */
set_gdbarch_read_fp (gdbarch, cfi_read_fp);
set_gdbarch_extract_return_value (gdbarch, x86_64_extract_return_value);
- set_gdbarch_push_arguments (gdbarch, x86_64_push_arguments);
- set_gdbarch_push_return_address (gdbarch, x86_64_push_return_address);
- set_gdbarch_pop_frame (gdbarch, x86_64_pop_frame);
- set_gdbarch_store_struct_return (gdbarch, x86_64_store_struct_return);
+ set_gdbarch_deprecated_push_arguments (gdbarch, x86_64_push_arguments);
+ set_gdbarch_deprecated_push_return_address (gdbarch, x86_64_push_return_address);
+ set_gdbarch_deprecated_pop_frame (gdbarch, x86_64_pop_frame);
+ set_gdbarch_deprecated_store_struct_return (gdbarch, x86_64_store_struct_return);
set_gdbarch_store_return_value (gdbarch, x86_64_store_return_value);
/* Override, since this is handled by x86_64_extract_return_value. */
set_gdbarch_extract_struct_value_address (gdbarch, NULL);
@@ -994,13 +993,13 @@ x86_64_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, x86_64_frame_init_saved_regs);
set_gdbarch_skip_prologue (gdbarch, x86_64_skip_prologue);
- set_gdbarch_frame_chain (gdbarch, x86_64_linux_frame_chain);
+ set_gdbarch_deprecated_frame_chain (gdbarch, x86_64_linux_frame_chain);
set_gdbarch_frameless_function_invocation (gdbarch,
x86_64_frameless_function_invocation);
/* FIXME: kettenis/20021026: These two are GNU/Linux-specific and
should be moved elsewhere. */
- set_gdbarch_frame_saved_pc (gdbarch, x86_64_linux_frame_saved_pc);
- set_gdbarch_saved_pc_after_call (gdbarch, x86_64_linux_saved_pc_after_call);
+ set_gdbarch_deprecated_frame_saved_pc (gdbarch, x86_64_linux_frame_saved_pc);
+ set_gdbarch_deprecated_saved_pc_after_call (gdbarch, x86_64_linux_saved_pc_after_call);
set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown);
/* FIXME: kettenis/20021026: This one is GNU/Linux-specific too. */
set_gdbarch_pc_in_sigtramp (gdbarch, x86_64_linux_in_sigtramp);
@@ -1023,6 +1022,10 @@ x86_64_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
since all supported x86-64 targets are ELF, but that might change
in the future. */
set_gdbarch_in_solib_call_trampoline (gdbarch, in_plt_section);
+
+ /* Dummy frame helper functions. */
+ set_gdbarch_save_dummy_frame_tos (gdbarch, x86_64_save_dummy_frame_tos);
+ set_gdbarch_unwind_dummy_id (gdbarch, x86_64_unwind_dummy_id);
}
void
diff --git a/gdb/x86-64-tdep.h b/gdb/x86-64-tdep.h
index 6977f9b..6885a7c 100644
--- a/gdb/x86-64-tdep.h
+++ b/gdb/x86-64-tdep.h
@@ -23,6 +23,9 @@
#ifndef X86_64_TDEP_H
#define X86_64_TDEP_H
+struct gdbarch;
+struct frame_info;
+
#include "i386-tdep.h"
extern int x86_64_num_regs;
@@ -31,11 +34,12 @@ extern int x86_64_num_gregs;
int x86_64_register_number (const char *name);
const char *x86_64_register_name (int reg_nr);
-gdbarch_frame_saved_pc_ftype x86_64_linux_frame_saved_pc;
-gdbarch_saved_pc_after_call_ftype x86_64_linux_saved_pc_after_call;
+gdbarch_deprecated_frame_saved_pc_ftype x86_64_linux_frame_saved_pc;
+gdbarch_deprecated_saved_pc_after_call_ftype x86_64_linux_saved_pc_after_call;
gdbarch_pc_in_sigtramp_ftype x86_64_linux_in_sigtramp;
CORE_ADDR x86_64_linux_frame_chain (struct frame_info *fi);
CORE_ADDR x86_64_init_frame_pc (int fromleaf, struct frame_info *fi);
+int x86_64_function_has_prologue (CORE_ADDR pc);
void x86_64_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch);
diff --git a/gdb/xmodem.h b/gdb/xmodem.h
index 86c5008..83aa24f 100644
--- a/gdb/xmodem.h
+++ b/gdb/xmodem.h
@@ -18,6 +18,8 @@
Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
+struct serial;
+
int xmodem_init_xfer (struct serial *desc);
void send_xmodem_packet (struct serial *desc, unsigned char *packet, int len,
int hashmark);
diff --git a/gdb/xstormy16-tdep.c b/gdb/xstormy16-tdep.c
index 2bbd402..2d3b7af 100644
--- a/gdb/xstormy16-tdep.c
+++ b/gdb/xstormy16-tdep.c
@@ -354,7 +354,7 @@ xstormy16_pop_frame (void)
xstormy16_reg_size));
}
/* Restore the PC */
- write_register (PC_REGNUM, FRAME_SAVED_PC (fi));
+ write_register (PC_REGNUM, DEPRECATED_FRAME_SAVED_PC (fi));
flush_cached_frames ();
}
return;
@@ -723,11 +723,10 @@ xstormy16_in_function_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR pc)
actual value of the previous frame's stack register.
This function may be called in any context where the saved register
- values may be needed (backtrace, frame_info, get_saved_register).
- On many targets, it is called directly by init_extra_frame_info,
- in part because the information may be needed immediately by
- frame_chain.
-*/
+ values may be needed (backtrace, frame_info, frame_register). On
+ many targets, it is called directly by init_extra_frame_info, in
+ part because the information may be needed immediately by
+ frame_chain. */
static void
xstormy16_frame_init_saved_regs (struct frame_info *fi)
@@ -749,9 +748,8 @@ xstormy16_frame_init_saved_regs (struct frame_info *fi)
/* Function: xstormy16_frame_saved_pc
Returns the return address for the selected frame.
- Called by frame_info, frame_chain_valid, and sometimes by
- get_prev_frame.
-*/
+ Called by frame_info, legacy_frame_chain_valid, and sometimes by
+ get_prev_frame. */
static CORE_ADDR
xstormy16_frame_saved_pc (struct frame_info *fi)
@@ -836,17 +834,16 @@ xstormy16_frame_chain (struct frame_info *fi)
static int
xstormy16_frame_chain_valid (CORE_ADDR chain, struct frame_info *thisframe)
{
- return chain < 0x8000 && FRAME_SAVED_PC (thisframe) >= 0x8000 &&
+ return chain < 0x8000 && DEPRECATED_FRAME_SAVED_PC (thisframe) >= 0x8000 &&
(get_frame_extra_info (thisframe)->frameless_p ||
get_frame_base (thisframe) - get_frame_extra_info (thisframe)->framesize == chain);
}
-/* Function: xstormy16_saved_pc_after_call
- Returns the previous PC immediately after a function call.
- This function is meant to bypass the regular get_saved_register
- mechanism, ie. it is meant to work even if the frame isn't complete.
- Called by step_over_function, and sometimes by get_prev_frame.
-*/
+/* Function: xstormy16_saved_pc_after_call Returns the previous PC
+ immediately after a function call. This function is meant to
+ bypass the regular frame_register() mechanism, ie. it is meant to
+ work even if the frame isn't complete. Called by
+ step_over_function, and sometimes by get_prev_frame. */
static CORE_ADDR
xstormy16_saved_pc_after_call (struct frame_info *ignore)
@@ -1057,12 +1054,12 @@ xstormy16_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
xstormy16_init_extra_frame_info);
set_gdbarch_deprecated_frame_init_saved_regs (gdbarch,
xstormy16_frame_init_saved_regs);
- set_gdbarch_frame_chain (gdbarch, xstormy16_frame_chain);
- set_gdbarch_get_saved_register (gdbarch, xstormy16_get_saved_register);
- set_gdbarch_saved_pc_after_call (gdbarch, xstormy16_saved_pc_after_call);
- set_gdbarch_frame_saved_pc (gdbarch, xstormy16_frame_saved_pc);
+ set_gdbarch_deprecated_frame_chain (gdbarch, xstormy16_frame_chain);
+ set_gdbarch_deprecated_get_saved_register (gdbarch, xstormy16_get_saved_register);
+ set_gdbarch_deprecated_saved_pc_after_call (gdbarch, xstormy16_saved_pc_after_call);
+ set_gdbarch_deprecated_frame_saved_pc (gdbarch, xstormy16_frame_saved_pc);
set_gdbarch_skip_prologue (gdbarch, xstormy16_skip_prologue);
- set_gdbarch_frame_chain_valid (gdbarch, xstormy16_frame_chain_valid);
+ set_gdbarch_deprecated_frame_chain_valid (gdbarch, xstormy16_frame_chain_valid);
set_gdbarch_in_function_epilogue_p (gdbarch,
xstormy16_in_function_epilogue_p);
@@ -1086,28 +1083,20 @@ xstormy16_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
* Call Dummies
*
* These values and methods are used when gdb calls a target function. */
- set_gdbarch_push_return_address (gdbarch, xstormy16_push_return_address);
+ set_gdbarch_deprecated_push_return_address (gdbarch, xstormy16_push_return_address);
set_gdbarch_deprecated_extract_return_value (gdbarch, xstormy16_extract_return_value);
- set_gdbarch_push_arguments (gdbarch, xstormy16_push_arguments);
- set_gdbarch_pop_frame (gdbarch, xstormy16_pop_frame);
- set_gdbarch_store_struct_return (gdbarch, xstormy16_store_struct_return);
+ set_gdbarch_deprecated_push_arguments (gdbarch, xstormy16_push_arguments);
+ set_gdbarch_deprecated_pop_frame (gdbarch, xstormy16_pop_frame);
+ set_gdbarch_deprecated_store_struct_return (gdbarch, xstormy16_store_struct_return);
set_gdbarch_deprecated_store_return_value (gdbarch, xstormy16_store_return_value);
set_gdbarch_deprecated_extract_struct_value_address (gdbarch, xstormy16_extract_struct_value_address);
set_gdbarch_use_struct_convention (gdbarch,
xstormy16_use_struct_convention);
- set_gdbarch_call_dummy_address (gdbarch, entry_point_address);
- set_gdbarch_call_dummy_start_offset (gdbarch, 0);
- set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 0);
- set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 1);
- set_gdbarch_call_dummy_length (gdbarch, 0);
- set_gdbarch_call_dummy_p (gdbarch, 1);
set_gdbarch_call_dummy_words (gdbarch, call_dummy_words);
set_gdbarch_sizeof_call_dummy_words (gdbarch, 0);
- set_gdbarch_call_dummy_stack_adjust_p (gdbarch, 0);
- /* set_gdbarch_call_dummy_stack_adjust */
- set_gdbarch_fix_call_dummy (gdbarch, generic_fix_call_dummy);
set_gdbarch_breakpoint_from_pc (gdbarch, xstormy16_breakpoint_from_pc);
+ set_gdbarch_char_signed (gdbarch, 0);
set_gdbarch_int_bit (gdbarch, 2 * TARGET_CHAR_BIT);
set_gdbarch_ptr_bit (gdbarch, 2 * TARGET_CHAR_BIT);
set_gdbarch_addr_bit (gdbarch, 4 * TARGET_CHAR_BIT);
@@ -1117,7 +1106,6 @@ xstormy16_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_pointer_to_address (gdbarch, xstormy16_pointer_to_address);
set_gdbarch_stack_align (gdbarch, xstormy16_stack_align);
- set_gdbarch_extra_stack_alignment_needed (gdbarch, 0);
set_gdbarch_save_dummy_frame_tos (gdbarch, xstormy16_save_dummy_frame_tos);
@@ -1126,6 +1114,9 @@ xstormy16_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_in_solib_call_trampoline (gdbarch,
xstormy16_in_solib_call_trampoline);
+ /* Should be using push_dummy_call. */
+ set_gdbarch_deprecated_dummy_write_sp (gdbarch, generic_target_write_sp);
+
return gdbarch;
}