From 5cbf8c08fcfd26cd95b8f2fd8d833777b402e621 Mon Sep 17 00:00:00 2001 From: Andrew Cagney Date: Sun, 30 Mar 2003 16:35:25 +0000 Subject: Merge with mainline. --- bfd/ChangeLog | 10 + bfd/elflink.h | 10 +- bfd/elfxx-ia64.c | 1 + bfd/version.h | 2 +- gdb/ChangeLog | 238 +- gdb/MAINTAINERS | 1 + gdb/Makefile.in | 16 +- gdb/NEWS | 3 + gdb/alpha-tdep.c | 5 +- gdb/arm-linux-tdep.c | 2 +- gdb/arm-tdep.c | 299 +-- gdb/avr-tdep.c | 6 +- gdb/config/i386/tm-symmetry.h | 2 +- gdb/config/pa/hppabsd.mh | 8 +- gdb/config/pa/hppabsd.mt | 6 +- gdb/config/pa/hppaosf.mh | 10 +- gdb/config/pa/hppaosf.mt | 6 +- gdb/config/pa/hppapro.mt | 6 +- gdb/config/pa/nm-hppab.h | 246 +- gdb/config/pa/nm-hppah.h | 7 + gdb/config/pa/nm-hppao.h | 86 +- gdb/config/pa/tm-hppa.h | 5 +- gdb/config/pa/tm-hppab.h | 94 +- gdb/config/pa/tm-hppao.h | 196 +- gdb/config/pa/tm-pro.h | 28 +- gdb/config/pa/xm-hppab.h | 48 +- gdb/config/pa/xm-hppah.h | 2 - gdb/config/pa/xm-pa.h | 10 +- gdb/config/sparc/tm-sp64.h | 6 +- gdb/config/sparc/tm-sparc.h | 2 +- gdb/configure.host | 4 +- gdb/configure.tgt | 6 +- gdb/cris-tdep.c | 9 +- gdb/d10v-tdep.c | 92 +- gdb/doc/ChangeLog | 24 + gdb/doc/Makefile.in | 2 - gdb/doc/gdb.texinfo | 4540 +++++++++++++++++++++++++++++++++++- gdb/doc/gdbint.texinfo | 40 +- gdb/frv-tdep.c | 7 +- gdb/gdbarch.c | 221 +- gdb/gdbarch.h | 136 +- gdb/gdbarch.sh | 14 +- gdb/h8300-tdep.c | 7 +- gdb/hppa-hpux-tdep.c | 1 + gdb/hppa-tdep.c | 6 +- gdb/hppah-nat.c | 8 +- gdb/hpread.c | 19 +- gdb/i386-tdep.c | 16 +- gdb/ia64-tdep.c | 8 +- gdb/inferior.h | 2 - gdb/infrun.c | 19 +- gdb/infttrace.c | 10 +- gdb/infttrace.h | 28 + gdb/lin-lwp.c | 231 +- gdb/linux-proc.c | 205 +- gdb/m68hc11-tdep.c | 6 +- gdb/m68k-tdep.c | 3 + gdb/mcore-tdep.c | 7 +- gdb/mi/ChangeLog | 5 + gdb/mi/gdbmi.texinfo | 3902 ------------------------------- gdb/mips-tdep.c | 18 +- gdb/mn10300-tdep.c | 7 +- gdb/ns32k-tdep.c | 6 +- gdb/objc-exp.y | 3 + gdb/regcache.c | 18 +- gdb/remote.h | 3 + gdb/rs6000-tdep.c | 8 +- gdb/s390-tdep.c | 7 +- gdb/sh-tdep.c | 8 +- gdb/signals/signals.c | 21 +- gdb/somread.c | 4 +- gdb/somsolib.h | 12 + gdb/sparc-tdep.c | 14 +- gdb/testsuite/ChangeLog | 27 + gdb/testsuite/gdb.base/gdb1090.c | 48 + gdb/testsuite/gdb.base/gdb1090.exp | 67 + gdb/testsuite/gdb.base/list.exp | 5 - gdb/testsuite/gdb.base/ptype.c | 3 + gdb/testsuite/gdb.base/ptype.exp | 4 +- gdb/testsuite/gdb.base/sizeof.c | 1 + gdb/testsuite/gdb.base/sizeof.exp | 2 + gdb/testsuite/gdb.c++/casts.exp | 7 +- gdb/testsuite/gdb.gdb/observer.exp | 274 +++ gdb/thread.c | 64 +- gdb/v850-tdep.c | 7 +- gdb/valops.c | 62 +- gdb/value.h | 6 +- gdb/vax-tdep.c | 3 + gdb/version.in | 2 +- gdb/x86-64-tdep.c | 4 +- gdb/xstormy16-tdep.c | 7 +- include/gdb/ChangeLog | 4 + include/gdb/sim-arm.h | 34 +- sim/arm/ChangeLog | 39 + sim/arm/Makefile.in | 1 + sim/arm/armcopro.c | 10 + sim/arm/armdefs.h | 2 + sim/arm/armemu.c | 23 +- sim/arm/arminit.c | 23 + sim/arm/armos.c | 49 +- sim/arm/configure | 2 +- sim/arm/configure.in | 2 +- sim/arm/iwmmxt.c | 3730 +++++++++++++++++++++++++++++ sim/arm/iwmmxt.h | 28 + sim/arm/wrapper.c | 95 + 105 files changed, 10633 insertions(+), 5070 deletions(-) create mode 100644 gdb/infttrace.h delete mode 100644 gdb/mi/gdbmi.texinfo create mode 100644 gdb/testsuite/gdb.base/gdb1090.c create mode 100644 gdb/testsuite/gdb.base/gdb1090.exp create mode 100644 gdb/testsuite/gdb.gdb/observer.exp create mode 100644 sim/arm/iwmmxt.c create mode 100644 sim/arm/iwmmxt.h diff --git a/bfd/ChangeLog b/bfd/ChangeLog index cec8e28d809..5d387c06155 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,13 @@ +2003-03-28 H.J. Lu + + * elflink.h (elf_link_add_object_symbols): Correctly combine + visibilities. + +2003-03-27 Jakub Jelinek + + * elfxx-ia64.c (elfNN_ia64_relax_section): Reset self_dtpmod_offset + to -1 before recomputing got offsets. + 2003-03-26 Andreas Schwab * elf32-m68k.c (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. diff --git a/bfd/elflink.h b/bfd/elflink.h index c39120d037b..3af34ee284d 100644 --- a/bfd/elflink.h +++ b/bfd/elflink.h @@ -1940,7 +1940,7 @@ elf_link_add_object_symbols (abfd, info) might be needed here. */ if (isym->st_other != 0) { - unsigned char hvis, symvis, other; + unsigned char hvis, symvis, other, nvis; /* Take the balance of OTHER from the definition. */ other = (definition ? isym->st_other : h->other); @@ -1949,8 +1949,14 @@ elf_link_add_object_symbols (abfd, info) /* Combine visibilities, using the most constraining one. */ hvis = ELF_ST_VISIBILITY (h->other); symvis = ELF_ST_VISIBILITY (isym->st_other); + if (! hvis) + nvis = symvis; + else if (! symvis) + nvis = hvis; + else + nvis = hvis < symvis ? hvis : symvis; - h->other = other | (hvis > symvis ? hvis : symvis); + h->other = other | nvis; } /* Set a flag in the hash table entry indicating the type of diff --git a/bfd/elfxx-ia64.c b/bfd/elfxx-ia64.c index d46d78c5c43..c42305717c6 100644 --- a/bfd/elfxx-ia64.c +++ b/bfd/elfxx-ia64.c @@ -1032,6 +1032,7 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again) struct elfNN_ia64_allocate_data data; data.info = link_info; data.ofs = 0; + ia64_info->self_dtpmod_offset = (bfd_vma) -1; elfNN_ia64_dyn_sym_traverse (ia64_info, allocate_global_data_got, &data); elfNN_ia64_dyn_sym_traverse (ia64_info, allocate_global_fptr_got, &data); diff --git a/bfd/version.h b/bfd/version.h index 6d6a9a8959d..0757b92d47f 100644 --- a/bfd/version.h +++ b/bfd/version.h @@ -1,3 +1,3 @@ -#define BFD_VERSION_DATE 20030326 +#define BFD_VERSION_DATE 20030330 #define BFD_VERSION @bfd_version@ #define BFD_VERSION_STRING @bfd_version_string@ diff --git a/gdb/ChangeLog b/gdb/ChangeLog index a0f277072b1..35babd63eea 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,4 +1,4 @@ -2003-03-26 Andrew Cagney +2003-03-30 Andrew Cagney Add frame debug info addresses: * frame-base.c: New file. @@ -36,6 +36,240 @@ (d10v_frame_base): New variable. (d10v_gdbarch_init): Set frame_base default. +2003-03-30 Mark Kettenis + + * i386-tdep.c (i386_store_struct_return): Removed. + (i386_gdbarch_init): Don't set deprecated_store_struct_return. + +2003-03-30 Andrew Cagney + + * 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 + + * 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 + + * 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 + + * 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 + + * 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 + + * ns32k-tdep.c (ns32k_gdbarch_init): Set the call dummy breakpoint + offset. + +2003-03-29 Richard Earnshaw + + * 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 + + * 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 + + * thread.c: Reindented. + * lin-lwp.c: Ditto. + * linux-proc.c: Ditto. + +2003-03-28 Bob Rossi + + * MAINTAINERS (write after approval): Add myself. + +2003-03-27 Theodore A. Roth + + * objc-exp.y: Add missing semi-colons. + +2003-03-27 Andrew Cagney + + * 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 + + * 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 + + * 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 + + * 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 + + * signals/signals.c (do_target_signal_to_host): Correct realtime + signal range test. + 2003-03-26 Daniel Jacobowitz * breakpoint.c (handle_gnu_4_16_catch_command, get_catch_sals) @@ -78,7 +312,7 @@ * objc-lang.c (objc_skip_trampoline): New function. (objc_language_defn): Add objc_skip_trampoline. -I2003-03-25 Andrew Cagney +2003-03-25 Andrew Cagney * frame.c (get_prev_frame): Delay validating a frame's ID - non-NULL, didn't go backwards - until an attempt to unwind it to diff --git a/gdb/MAINTAINERS b/gdb/MAINTAINERS index 0adfcb6ea28..15a0ea826c1 100644 --- a/gdb/MAINTAINERS +++ b/gdb/MAINTAINERS @@ -367,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 diff --git a/gdb/Makefile.in b/gdb/Makefile.in index 5449392c4d9..c1bd030f46d 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -724,6 +724,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 @@ -1624,7 +1625,7 @@ cris-tdep.o: cris-tdep.c $(defs_h) $(frame_h) $(symtab_h) $(inferior_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) \ + $(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) @@ -1748,11 +1749,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) $(gdb_assert_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) @@ -1761,7 +1763,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) \ @@ -1839,7 +1841,7 @@ infrun.o: infrun.c $(defs_h) $(gdb_string_h) $(symtab_h) $(frame_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) @@ -2117,7 +2119,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) \ diff --git a/gdb/NEWS b/gdb/NEWS index eaefeff70e7..0e381d9cef7 100644 --- a/gdb/NEWS +++ b/gdb/NEWS @@ -41,6 +41,9 @@ 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* * REMOVED configurations and files diff --git a/gdb/alpha-tdep.c b/gdb/alpha-tdep.c index a6449e1e834..1a19257ca3d 100644 --- a/gdb/alpha-tdep.c +++ b/gdb/alpha-tdep.c @@ -67,7 +67,6 @@ 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_push_arguments_ftype alpha_push_arguments; static gdbarch_fix_call_dummy_ftype alpha_fix_call_dummy; static gdbarch_get_longjmp_target_ftype alpha_get_longjmp_target; @@ -1853,7 +1852,7 @@ alpha_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) /* 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_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, @@ -1876,6 +1875,8 @@ alpha_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) 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_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/arm-linux-tdep.c b/gdb/arm-linux-tdep.c index 01b45f13f89..fa4d8fa00ca 100644 --- a/gdb/arm-linux-tdep.c +++ b/gdb/arm-linux-tdep.c @@ -536,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 dbe14836d96..ca152515e11 100644 --- a/gdb/arm-tdep.c +++ b/gdb/arm-tdep.c @@ -1334,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 @@ -1499,6 +1368,161 @@ arm_pop_frame (void) 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 = malloc (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) { @@ -2456,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) { @@ -2928,9 +2943,8 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) 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_deprecated_frame_chain_valid (gdbarch, arm_frame_chain_valid); @@ -2994,7 +3008,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_deprecated_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); diff --git a/gdb/avr-tdep.c b/gdb/avr-tdep.c index 73588375883..d3da3aa8e50 100644 --- a/gdb/avr-tdep.c +++ b/gdb/avr-tdep.c @@ -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); @@ -1180,8 +1180,8 @@ avr_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) 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_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); diff --git a/gdb/config/i386/tm-symmetry.h b/gdb/config/i386/tm-symmetry.h index a15f45f1c95..ea2229090e7 100644 --- a/gdb/config/i386/tm-symmetry.h +++ b/gdb/config/i386/tm-symmetry.h @@ -266,7 +266,7 @@ switch (regno) { \ passes it on the stack. gcc should be fixed in future versions to adopt native cc conventions. */ -#undef PUSH_ARGUMENTS +#undef DEPRECATED_PUSH_ARGUMENTS #undef STORE_STRUCT_RETURN #define STORE_STRUCT_RETURN(ADDR, SP) write_register(0, (ADDR)) diff --git a/gdb/config/pa/hppabsd.mh b/gdb/config/pa/hppabsd.mh index d4a152d03e5..e4d0215cdc3 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 0fc0380c26a..e63f9b8074b 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 d6dd2822d35..0e82dc10d7c 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 675402387b6..4a54c79cfa2 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 4851b1896e7..cfd99699528 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 d9827dcf790..96dea6e68dd 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 83871158d35..2cc1e300365 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 6389b2c1868..0a6b810a16e 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 64a4fe1362f..9c26c798258 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. */ @@ -614,7 +617,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-hppab.h b/gdb/config/pa/tm-hppab.h index 1cd438df75e..edacdbfe9b6 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-hppao.h b/gdb/config/pa/tm-hppao.h index e6fae89b85b..a466287ede5 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 05ecb62f7dc..c4f2b775329 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 d2561dfcf69..d46e5adc868 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 b1c26dd4de8..a2ed9ba407f 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 979609d4776..0095003da1e 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/sparc/tm-sp64.h b/gdb/config/sparc/tm-sp64.h index 8abec1c709c..b4417b80613 100644 --- a/gdb/config/sparc/tm-sp64.h +++ b/gdb/config/sparc/tm-sp64.h @@ -208,8 +208,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 +274,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 7b11c4fbd58..ef3996232cc 100644 --- a/gdb/config/sparc/tm-sparc.h +++ b/gdb/config/sparc/tm-sparc.h @@ -688,7 +688,7 @@ void sparc_fix_call_dummy (char *dummy, CORE_ADDR pc, CORE_ADDR fun, 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, diff --git a/gdb/configure.host b/gdb/configure.host index b309a332a19..98acc7e02af 100644 --- a/gdb/configure.host +++ b/gdb/configure.host @@ -40,13 +40,13 @@ 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 diff --git a/gdb/configure.tgt b/gdb/configure.tgt index 17ac70fa170..9a4dba3bf0b 100644 --- a/gdb/configure.tgt +++ b/gdb/configure.tgt @@ -73,12 +73,12 @@ 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 ;; diff --git a/gdb/cris-tdep.c b/gdb/cris-tdep.c index 8bf06466b7e..a618f5547db 100644 --- a/gdb/cris-tdep.c +++ b/gdb/cris-tdep.c @@ -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); @@ -4283,7 +4283,7 @@ cris_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) /* 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_deprecated_push_return_address (gdbarch, cris_push_return_address); set_gdbarch_deprecated_pop_frame (gdbarch, cris_pop_frame); set_gdbarch_deprecated_store_struct_return (gdbarch, cris_store_struct_return); @@ -4323,6 +4323,9 @@ cris_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) /* 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 31b49899e96..56a7260f57b 100644 --- a/gdb/d10v-tdep.c +++ b/gdb/d10v-tdep.c @@ -39,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" @@ -277,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; @@ -293,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; @@ -950,30 +950,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))); } -/* 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. */ @@ -1011,20 +993,26 @@ 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; + /* 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) { - write_register (regnum, struct_addr); + regcache_cooked_write_unsigned (regcache, regnum, struct_addr); regnum++; } @@ -1042,7 +1030,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 @@ -1053,12 +1041,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 @@ -1076,6 +1064,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; } @@ -1348,26 +1340,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)); @@ -1606,8 +1601,6 @@ 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; @@ -1651,7 +1644,6 @@ 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); @@ -1701,15 +1693,11 @@ d10v_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) 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_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_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); @@ -1746,10 +1734,6 @@ d10v_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) return gdbarch; } - -extern void (*target_resume_hook) (void); -extern void (*target_wait_loop_hook) (void); - void _initialize_d10v_tdep (void) { diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index 3aeadd3ba3c..4286726403f 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -1,3 +1,27 @@ +2003-03-30 Andrew Cagney + + * gdbint.texinfo (Target Architecture Definition): Remove + reference to TARGET_WRITE_SP. + +2003-03-27 Andrew Cagney + + * gdbint.texinfo (Target Architecture Definition): Remove + references to write_sp. + +2003-03-27 Andrew Cagney + + * 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 + + * gdbint.texinfo (Target Architecture Definition): Replace + PUSH_ARGUMENTS with push_dummy_call, add gdbarch, regcache and + dummy_addr parameters. + 2003-03-25 Andrew Cagney * gdbint.texinfo (Target Architecture Definition): Delete diff --git a/gdb/doc/Makefile.in b/gdb/doc/Makefile.in index db74889328c..52213143688 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 = \ diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index 8c38e877353..5c4eb95e6b3 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -14045,8 +14045,4544 @@ 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-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} diff --git a/gdb/doc/gdbint.texinfo b/gdb/doc/gdbint.texinfo index fa537ca0218..c82c68cb0bf 100644 --- a/gdb/doc/gdbint.texinfo +++ b/gdb/doc/gdbint.texinfo @@ -41,7 +41,7 @@ Software Foundation raise funds for GNU development.'' @page @tex \def\$#1${{#1}} % Kluge: collect RCS revision info without $...$ -\xdef\manvers{\$Revision: 1.134 $} % For use in headers, footers too +\xdef\manvers{\$Revision: 1.134.2.1 $} % For use in headers, footers too {\parskip=0pt \hfill Cygnus Solutions\par \hfill \manvers\par @@ -3115,7 +3115,7 @@ See the file @file{inferior.h}. @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_ARGUMENTS}, which can handle +function is no longer needed. @xref{push_dummy_call}, which can handle all alignment directly. @item CANNOT_FETCH_REGISTER (@var{regno}) @@ -3703,14 +3703,21 @@ definition is only used in generic code when parsing "$ps".) 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 -@anchor{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 @@ -3770,10 +3777,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 @@ -3880,19 +3885,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 diff --git a/gdb/frv-tdep.c b/gdb/frv-tdep.c index cb8dc55e679..2711b52a26c 100644 --- a/gdb/frv-tdep.c +++ b/gdb/frv-tdep.c @@ -42,7 +42,6 @@ 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_push_arguments_ftype frv_push_arguments; -static gdbarch_push_return_address_ftype frv_push_return_address; static gdbarch_saved_pc_after_call_ftype frv_saved_pc_after_call; static void frv_pop_frame_regular (struct frame_info *frame); @@ -1090,8 +1089,8 @@ frv_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) /* 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_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); @@ -1107,7 +1106,7 @@ 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); diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index c45a70f054f..4d94614ecde 100644 --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -148,7 +148,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; @@ -212,9 +212,10 @@ 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_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; @@ -433,6 +434,7 @@ struct gdbarch startup_gdbarch = 0, 0, 0, + 0, generic_in_function_epilogue_p, construct_inferior_arguments, 0, @@ -502,7 +504,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; @@ -543,7 +544,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; @@ -631,7 +631,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 */ @@ -713,9 +713,10 @@ 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 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 */ @@ -1125,6 +1126,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 */ @@ -1413,6 +1437,26 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) (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", @@ -1436,6 +1480,26 @@ 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_STORE_RETURN_VALUE #if GDB_MULTI_ARCH /* Macro might contain `[{}]' when not multi-arch */ @@ -1898,37 +1962,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", @@ -2236,8 +2277,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, @@ -2556,20 +2597,6 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) "gdbarch_dump: TARGET_WRITE_PC = <0x%08lx>\n", (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 if (GDB_MULTI_ARCH) fprintf_unfiltered (file, @@ -2919,23 +2946,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 @@ -4218,23 +4252,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 @@ -4264,29 +4331,29 @@ 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 diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h index dd66773a8ac..de8cb2d9949 100644 --- a/gdb/gdbarch.h +++ b/gdb/gdbarch.h @@ -388,20 +388,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 @@ -1238,11 +1260,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,11 +1274,9 @@ 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 -#endif #if defined (DEPRECATED_CALL_DUMMY_STACK_ADJUST) /* Legacy for systems yet to multi-arch DEPRECATED_CALL_DUMMY_STACK_ADJUST */ @@ -1629,23 +1647,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) @@ -1683,40 +1729,42 @@ 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 diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh index a1122e17ea9..91f22931eb1 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. @@ -531,8 +532,8 @@ v:2:CALL_DUMMY_LENGTH:int:call_dummy_length::::0:-1:::::gdbarch->call_dummy_leng # 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::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: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:2:DEPRECATED_INIT_FRAME_PC_FIRST:CORE_ADDR:deprecated_init_frame_pc_first:int fromleaf, struct frame_info *prev:fromleaf, prev @@ -555,9 +556,12 @@ 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 +# 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 diff --git a/gdb/h8300-tdep.c b/gdb/h8300-tdep.c index e78bc0f3813..e08cff7f85e 100644 --- a/gdb/h8300-tdep.c +++ b/gdb/h8300-tdep.c @@ -1148,9 +1148,9 @@ 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_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); @@ -1175,6 +1175,9 @@ h8300_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) /* set_gdbarch_stack_align (gdbarch, SOME_stack_align); */ 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 66b7b611e61..3d1ca88ce50 100644 --- a/gdb/hppa-hpux-tdep.c +++ b/gdb/hppa-hpux-tdep.c @@ -21,6 +21,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); diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c index 2f5412e2bb6..b9d3d55abb8 100644 --- a/gdb/hppa-tdep.c +++ b/gdb/hppa-tdep.c @@ -33,7 +33,7 @@ #include "language.h" #include "osabi.h" #include "gdb_assert.h" - +#include "infttrace.h" /* For argument passing to the inferior */ #include "symtab.h" @@ -886,7 +886,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; @@ -5005,7 +5005,7 @@ hppa_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) 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 51b74fc7ba0..b953d2546f6 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 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 6acf5760364..606ccfeba7c 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) @@ -3359,10 +3366,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; @@ -3378,11 +3385,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-tdep.c b/gdb/i386-tdep.c index 02abc9e537e..f4c03689206 100644 --- a/gdb/i386-tdep.c +++ b/gdb/i386-tdep.c @@ -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). */ @@ -1586,10 +1580,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_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_deprecated_store_struct_return (gdbarch, i386_store_struct_return); set_gdbarch_store_return_value (gdbarch, i386_store_return_value); set_gdbarch_extract_struct_value_address (gdbarch, i386_extract_struct_value_address); @@ -1630,6 +1623,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/ia64-tdep.c b/gdb/ia64-tdep.c index 1b3d7657e45..5ace9621151 100644 --- a/gdb/ia64-tdep.c +++ b/gdb/ia64-tdep.c @@ -96,8 +96,6 @@ 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_push_arguments_ftype ia64_push_arguments; -static gdbarch_push_return_address_ftype ia64_push_return_address; static gdbarch_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); @@ -2216,8 +2214,8 @@ ia64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) /* 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_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); @@ -2239,7 +2237,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_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); diff --git a/gdb/inferior.h b/gdb/inferior.h index 10da8ee5408..99316ccff9d 100644 --- a/gdb/inferior.h +++ b/gdb/inferior.h @@ -178,8 +178,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); diff --git a/gdb/infrun.c b/gdb/infrun.c index 6da33946ec1..7066a52de2b 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -1153,6 +1153,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; @@ -1165,7 +1170,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 @@ -1179,6 +1192,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: @@ -1189,6 +1203,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; diff --git a/gdb/infttrace.c b/gdb/infttrace.c index 02a55762cd9..f86ab025ef6 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/infttrace.h b/gdb/infttrace.h new file mode 100644 index 00000000000..d3330e3b85a --- /dev/null +++ b/gdb/infttrace.h @@ -0,0 +1,28 @@ +/* Low level Unix child interface to ttrace, for GDB when running under HP-UX. + + Copyright 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. */ + +#ifndef INFTTRACE_H +#define INFTTRACE_H + +extern int parent_attach_all (int, PTRACE_ARG3_TYPE, int); +extern pid_t hppa_switched_threads (pid_t gdb_pid); + +#endif diff --git a/gdb/lin-lwp.c b/gdb/lin-lwp.c index 9f9dd81d8c3..c36394e87f3 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/linux-proc.c b/gdb/linux-proc.c index 00383e9a6ee..a9512964dab 100644 --- a/gdb/linux-proc.c +++ b/gdb/linux-proc.c @@ -21,17 +21,17 @@ #include "defs.h" #include "inferior.h" -#include /* for MAXPATHLEN */ -#include /* for elf_gregset etc. */ -#include "gdb_stat.h" /* for struct stat */ -#include /* for isdigit */ -#include /* for open, pread64 */ -#include /* 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 /* for MAXPATHLEN */ +#include /* for elf_gregset etc. */ +#include "gdb_stat.h" /* for struct stat */ +#include /* for isdigit */ +#include /* for open, pread64 */ +#include /* 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/m68hc11-tdep.c b/gdb/m68hc11-tdep.c index 02ba5c0b096..3fff897d976 100644 --- a/gdb/m68hc11-tdep.c +++ b/gdb/m68hc11-tdep.c @@ -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); @@ -1392,8 +1392,8 @@ m68hc11_gdbarch_init (struct gdbarch_info info, set_gdbarch_deprecated_get_saved_register (gdbarch, deprecated_generic_get_saved_register); set_gdbarch_fix_call_dummy (gdbarch, generic_fix_call_dummy); 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_deprecated_store_struct_return (gdbarch, m68hc11_store_struct_return); diff --git a/gdb/m68k-tdep.c b/gdb/m68k-tdep.c index a72ea534671..c25f2e11d0c 100644 --- a/gdb/m68k-tdep.c +++ b/gdb/m68k-tdep.c @@ -1051,6 +1051,9 @@ m68k_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_deprecated_push_dummy_frame (gdbarch, m68k_push_dummy_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/mcore-tdep.c b/gdb/mcore-tdep.c index e3070b35d1e..a112eeeb9d8 100644 --- a/gdb/mcore-tdep.c +++ b/gdb/mcore-tdep.c @@ -1129,8 +1129,8 @@ mcore_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) 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_deprecated_push_return_address (gdbarch, mcore_push_return_address); + set_gdbarch_deprecated_push_arguments (gdbarch, mcore_push_arguments); set_gdbarch_call_dummy_length (gdbarch, 0); /* Frames: */ @@ -1163,6 +1163,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/mi/ChangeLog b/gdb/mi/ChangeLog index 1785b9b8813..1b6b497ebb1 100644 --- a/gdb/mi/ChangeLog +++ b/gdb/mi/ChangeLog @@ -1,3 +1,8 @@ +2003-03-27 Andrew Cagney + + * gdbmi.texinfo: Delete file. Contents moved to + ../doc/gdb.texinfo. + 2003-03-12 Andrew Cagney * mi-main.c (get_register): Use frame_register instead of diff --git a/gdb/mi/gdbmi.texinfo b/gdb/mi/gdbmi.texinfo deleted file mode 100644 index da8b77cc354..00000000000 --- 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/mips-tdep.c b/gdb/mips-tdep.c index 2a63d22e31d..67f516b87fe 100644 --- a/gdb/mips-tdep.c +++ b/gdb/mips-tdep.c @@ -5806,7 +5806,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; @@ -5825,7 +5825,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; @@ -5844,7 +5844,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; @@ -5863,7 +5863,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; @@ -5882,7 +5882,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; @@ -5913,7 +5913,7 @@ mips_gdbarch_init (struct gdbarch_info info, 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; @@ -6003,7 +6003,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. */ @@ -6028,7 +6028,7 @@ mips_gdbarch_init (struct gdbarch_info info, set_gdbarch_call_dummy_p (gdbarch, 1); set_gdbarch_call_dummy_address (gdbarch, mips_call_dummy_address); - set_gdbarch_push_return_address (gdbarch, mips_push_return_address); + set_gdbarch_deprecated_push_return_address (gdbarch, mips_push_return_address); set_gdbarch_deprecated_pop_frame (gdbarch, mips_pop_frame); set_gdbarch_call_dummy_start_offset (gdbarch, 0); set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 1); @@ -6037,7 +6037,7 @@ mips_gdbarch_init (struct gdbarch_info info, 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); diff --git a/gdb/mn10300-tdep.c b/gdb/mn10300-tdep.c index 087c9df9f5b..156adbf2bd4 100644 --- a/gdb/mn10300-tdep.c +++ b/gdb/mn10300-tdep.c @@ -1196,14 +1196,17 @@ mn10300_gdbarch_init (struct gdbarch_info info, 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/ns32k-tdep.c b/gdb/ns32k-tdep.c index 323cade60a2..4e43674efb2 100644 --- a/gdb/ns32k-tdep.c +++ b/gdb/ns32k-tdep.c @@ -600,7 +600,8 @@ ns32k_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) 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_p (gdbarch, 1); + 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); @@ -611,6 +612,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/objc-exp.y b/gdb/objc-exp.y index 8e52fc0f124..002600de9cb 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); } @@ -569,6 +571,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); diff --git a/gdb/regcache.c b/gdb/regcache.c index c66901780ae..70af06f2fab 100644 --- a/gdb/regcache.c +++ b/gdb/regcache.c @@ -1328,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. @@ -1456,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/remote.h b/gdb/remote.h index e2171b27efd..4477148f9c8 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 539905ed977..6dea3d85045 100644 --- a/gdb/rs6000-tdep.c +++ b/gdb/rs6000-tdep.c @@ -2876,7 +2876,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); @@ -2909,7 +2909,7 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) 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); @@ -2924,9 +2924,9 @@ 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_deprecated_store_struct_return (gdbarch, rs6000_store_struct_return); set_gdbarch_extract_struct_value_address (gdbarch, rs6000_extract_struct_value_address); diff --git a/gdb/s390-tdep.c b/gdb/s390-tdep.c index 18b7d108fe7..6574874ae9a 100644 --- a/gdb/s390-tdep.c +++ b/gdb/s390-tdep.c @@ -1866,12 +1866,12 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) 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_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); @@ -1907,6 +1907,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/sh-tdep.c b/gdb/sh-tdep.c index 7649c6208bc..38098b53192 100644 --- a/gdb/sh-tdep.c +++ b/gdb/sh-tdep.c @@ -4375,7 +4375,7 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) 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_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); @@ -4617,7 +4617,7 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) 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_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); @@ -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); @@ -4663,7 +4663,7 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_call_dummy_p (gdbarch, 1); 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); diff --git a/gdb/signals/signals.c b/gdb/signals/signals.c index ba5e7eac59a..ca46a9ed1c7 100644 --- a/gdb/signals/signals.c +++ b/gdb/signals/signals.c @@ -518,6 +518,8 @@ static int do_target_signal_to_host (enum target_signal oursig, int *oursig_ok) { + int retsig; + *oursig_ok = 1; switch (oursig) { @@ -742,36 +744,31 @@ do_target_signal_to_host (enum target_signal oursig, default: #if defined (REALTIME_LO) - if (oursig < REALTIME_LO || oursig >= REALTIME_HI) - { - *oursig_ok = 0; - return 0; - } + retsig = 0; 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; - 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; diff --git a/gdb/somread.c b/gdb/somread.c index 85d4f0a537c..654ae067f75 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.h b/gdb/somsolib.h index 0840067d997..c2414118843 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/sparc-tdep.c b/gdb/sparc-tdep.c index e9daad8de60..a6ca7cd3a0f 100644 --- a/gdb/sparc-tdep.c +++ b/gdb/sparc-tdep.c @@ -1040,7 +1040,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, ®ister_temp[0], DUMMY_STACK_REG_BUF_SIZE); @@ -1310,7 +1310,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]) { @@ -3161,7 +3161,7 @@ sparc_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_deprecated_max_register_raw_size (gdbarch, 8); set_gdbarch_deprecated_max_register_virtual_size (gdbarch, 8); set_gdbarch_deprecated_pop_frame (gdbarch, sparc_pop_frame); - set_gdbarch_push_return_address (gdbarch, sparc_push_return_address); + 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); @@ -3259,7 +3259,7 @@ sparc_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) 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); @@ -3279,7 +3279,7 @@ sparc_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) 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; @@ -3315,7 +3315,7 @@ sparc_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) 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); @@ -3337,7 +3337,7 @@ sparc_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) 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; diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 433708822bf..3c031f30813 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,30 @@ +2003-03-29 Andrew Cagney + + * gdb.base/sizeof.c (main): Print the value of '\377'. + * gdb.base/sizeof.exp: Check the sign of '\377'. + +2003-03-27 Michael Chastain + + * gdb.base/gdb1090.exp: New file. + * gdb.base/gdb1090.cc: New file. + +2003-03-27 J. Brobecker + + * gdb.gdb/observer.exp: New regression test. + +2003-03-27 Michael Chastain + + * gdb.base/list.exp: Remove setup_xfail_format for DWARF 1. + * gdb.base/ptype.exp: Likewise. + +2003-03-27 Corinna Vinschen + + * gdb.c++/casts.exp: Fix startup to run also on embedded targets. + +2003-03-26 Michael Chastain + + * gdb.base/ptype.exp: Actually use some typedef'd types. + 2003-03-21 Stephane Carrez * gdb.asm/asm-source.exp: Set asm-arch for m6811 and m6812. diff --git a/gdb/testsuite/gdb.base/gdb1090.c b/gdb/testsuite/gdb.base/gdb1090.c new file mode 100644 index 00000000000..cd9e2cdecbd --- /dev/null +++ b/gdb/testsuite/gdb.base/gdb1090.c @@ -0,0 +1,48 @@ +/* Test program for multi-register variable. + Copyright 2003 Free Software Foundation, Inc. + + This file is part of the gdb testsuite. + + 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. + + This file was written by Michael Elizabeth Chastain (mec@shout.net). */ + +struct s_2_by_4 +{ + int field_0; + int field_1; +}; + +void marker (struct s_2_by_4 s_whatever) +{ + s_whatever = s_whatever; + return; +} + +void foo () +{ + /* I want this variable in a register but I can't really force it */ + register struct s_2_by_4 s24; + s24.field_0 = 1170; + s24.field_1 = 64701; + marker (s24); + return; +} + +int main () +{ + foo (); +} diff --git a/gdb/testsuite/gdb.base/gdb1090.exp b/gdb/testsuite/gdb.base/gdb1090.exp new file mode 100644 index 00000000000..20da3b12839 --- /dev/null +++ b/gdb/testsuite/gdb.base/gdb1090.exp @@ -0,0 +1,67 @@ +# Copyright 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 +# 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. + +# Tests for PR gdb/1090. +# 2003-02-23 Michael Chastain + +# This file is part of the gdb testsuite. + +if $tracelevel then { + strace $tracelevel + } + +# +# test running programs +# +set prms_id 0 +set bug_id 0 + +set testfile "gdb1090" +set srcfile ${testfile}.c +set binfile ${objdir}/${subdir}/${testfile} + +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +} + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir +gdb_load ${binfile} + +if ![runto marker] then { + perror "couldn't run to breakpoint" + continue +} +gdb_test "up" ".*foo.*" "up from marker" + +send_gdb "print s24\n" +gdb_expect { + -re "\\\$\[0-9\]* = \\{field_0 = 1170, field_1 = 64701\\}\r\n$gdb_prompt $" { + pass "print s24" + } + -re "\\\$\[0-9\]* = \\{field_0 = 1170, field_1 = .*\\}\r\n$gdb_prompt $" { + # happens with gcc 2.95.3, which actually puts s24 in registers. + # gdb cannot find the second register and prints garbage. + kfail "gdb/1090" "print s24" + } + -re ".*$gdb_prompt $" { + fail "print s24" + } + timeout { + fail "print s24 (timeout)" + } +} diff --git a/gdb/testsuite/gdb.base/list.exp b/gdb/testsuite/gdb.base/list.exp index dee91520e92..84a15cfacbe 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/ptype.c b/gdb/testsuite/gdb.base/ptype.c index 2c85c7c88fc..397a714692b 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 6e33d854805..6580b43c427 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 95d379ee9ae..c32231f8566 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 7c0390588a0..7fcbe0e37e7 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.c++/casts.exp b/gdb/testsuite/gdb.c++/casts.exp index 859755f66b7..5b6cabe34fa 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.gdb/observer.exp b/gdb/testsuite/gdb.gdb/observer.exp new file mode 100644 index 00000000000..390df8d61b0 --- /dev/null +++ b/gdb/testsuite/gdb.gdb/observer.exp @@ -0,0 +1,274 @@ +# Copyright 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 +# 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. + +# Please email any bugs, comments, and/or additions to this file to: +# bug-gdb@prep.ai.mit.edu + +# This file was written by Joel Brobecker (brobecker@gnat.com), derived +# from xfullpath.exp. + +if $tracelevel then { + strace $tracelevel +} + +set prms_id 0 +set bug_id 0 + +# are we on a target board +if [is_remote target] { + return +} + +if [istarget "m68k*-*-hpux*"] then { + # The top-level makefile passes CFLAGS= (no -g) for hp300. This probably + # should be fixed (it is only needed for gcc bootstrapping, not gdb), + # but until then..... + setup_xfail "*-*-*" + fail "cannot test self if compiled without debug info" + return -1 +} + +proc setup_test { executable } { + global gdb_prompt + global timeout + + # load yourself into the debugger + # This can take a relatively long time, particularly for testing where + # the executable is being accessed over a network, or where gdb does not + # support partial symbols for a particular target and has to load the + # entire symbol table. Set the timeout to 10 minutes, which should be + # adequate for most environments (it *has* timed out with 5 min on a + # SPARCstation SLC under moderate load, so this isn't unreasonable). + # After gdb is started, set the timeout to 30 seconds for the duration + # of this test, and then back to the original value. + + set oldtimeout $timeout + set timeout 600 + verbose "Timeout is now $timeout seconds" 2 + if {[gdb_load $executable] <0} then { + set timeout $oldtimeout + verbose "Timeout is now $timeout seconds" 2 + return -1 + } + set timeout $oldtimeout + verbose "Timeout is now $timeout seconds" 2 + + # Set a breakpoint at main + gdb_test "break captured_main" \ + "Breakpoint.*at.* file.*, line.*" \ + "breakpoint in captured_main" + + # run yourself + # It may take a very long time for the inferior gdb to start (lynx), + # so we bump it back up for the duration of this command. + set timeout 600 + + set description "run until breakpoint at captured_main" + send_gdb "run -nw\n" + gdb_expect { + -re "Starting program.*Breakpoint \[0-9\]+,.*captured_main .data.* at .*main.c:.*$gdb_prompt $" { + pass "$description" + } + -re "Starting program.*Breakpoint \[0-9\]+,.*captured_main .data.*$gdb_prompt $" { + xfail "$description (line numbers scrambled?)" + } + -re "vfork: No more processes.*$gdb_prompt $" { + fail "$description (out of virtual memory)" + set timeout $oldtimeout + verbose "Timeout is now $timeout seconds" 2 + return -1 + } + -re ".*$gdb_prompt $" { + fail "$description" + set timeout $oldtimeout + verbose "Timeout is now $timeout seconds" 2 + return -1 + } + timeout { + fail "$description (timeout)" + } + } + + set timeout $oldtimeout + verbose "Timeout is now $timeout seconds" 2 + + return 0 +} + +proc attach_first_observer { } { + gdb_test "set \$first_obs = observer_attach_normal_stop (&observer_test_first_notification_function)" \ + "" "attach first observer" +} + +proc attach_second_observer { } { + gdb_test "set \$second_obs = observer_attach_normal_stop (&observer_test_second_notification_function)" \ + "" "attach second observer" +} + +proc attach_third_observer { } { + gdb_test "set \$third_obs = observer_attach_normal_stop (&observer_test_third_notification_function)" \ + "" "attach third observer" +} + +proc detach_first_observer { } { + gdb_test "call observer_detach_normal_stop (\$first_obs)" \ + "" "detach first observer" +} + +proc detach_second_observer { } { + gdb_test "call observer_detach_normal_stop (\$second_obs)" \ + "" "detach second observer" +} + +proc detach_third_observer { } { + gdb_test "call observer_detach_normal_stop (\$third_obs)" \ + "" "detach third observer" +} + +proc check_counters { first second third message } { + gdb_test "print observer_test_first_observer" \ + ".\[0-9\]+ =.*$first" \ + "check first observer counter value ($message)" + gdb_test "print observer_test_second_observer" \ + ".\[0-9\]+ =.*$second" \ + "check second observer counter value ($message)" + gdb_test "print observer_test_third_observer" \ + ".\[0-9\]+ =.*$third" \ + "check third observer counter value ($message)" +} + +proc reset_counters { } { + gdb_test "set variable observer_test_first_observer = 0" "" \ + "reset first observer counter" + gdb_test "set variable observer_test_second_observer = 0" "" \ + "reset second observer counter" + gdb_test "set variable observer_test_third_observer = 0" "" \ + "reset third observer counter" +} + +proc test_normal_stop_notifications { first second third message } { + reset_counters + gdb_test "call observer_notify_normal_stop ()" "" \ + "sending notification ($message)" + check_counters $first $second $third $message +} + +proc test_observer_normal_stop { executable } { + + set setup_result [setup_test $executable] + if {$setup_result <0} then { + return -1 + } + + # First, try sending a notification without any observer attached. + test_normal_stop_notifications 0 0 0 "no observer" + + # Now, attach one observer, and send a notification. + attach_second_observer + test_normal_stop_notifications 0 1 0 "one observer" + + # Remove the observer, and send a notification. + detach_second_observer + test_normal_stop_notifications 0 0 0 "no observer" + + # With a new observer. + attach_first_observer + test_normal_stop_notifications 1 0 0 "a new observer" + + # With 2 observers. + attach_second_observer + test_normal_stop_notifications 1 1 0 "2 observers" + + # With 3 observers. + attach_third_observer + test_normal_stop_notifications 1 1 1 "3 observers" + + # Remove middle observer. + detach_second_observer + test_normal_stop_notifications 1 0 1 "middle observer removed" + + # Remove first observer. + detach_first_observer + test_normal_stop_notifications 0 0 1 "first observer removed" + + # Remove last observer. + detach_third_observer + test_normal_stop_notifications 0 0 0 "last observer removed" + + # Go back to 3 observers, and remove them in a different order... + attach_first_observer + attach_second_observer + attach_third_observer + test_normal_stop_notifications 1 1 1 "3 observers again" + + # Remove the third observer. + detach_third_observer + test_normal_stop_notifications 1 1 0 "third observer removed" + + # Remove the second observer. + detach_second_observer + test_normal_stop_notifications 1 0 0 "second observer removed" + + # Remove the first observer, no more observers. + detach_first_observer + test_normal_stop_notifications 0 0 0 "last observer removed" + + return 0 +} + +# Find a pathname to a file that we would execute if the shell was asked +# to run $arg using the current PATH. + +proc find_gdb { arg } { + + # If the arg directly specifies an existing executable file, then + # simply use it. + + if [file executable $arg] then { + return $arg + } + + set result [which $arg] + if [string match "/" [ string range $result 0 0 ]] then { + return $result + } + + # If everything fails, just return the unqualified pathname as default + # and hope for best. + + return $arg +} + +# Run the test with self. +# Copy the file executable file in case this OS doesn't like to edit its own +# text space. + +set GDB_FULLPATH [find_gdb $GDB] + +# Remove any old copy lying around. +remote_file host delete x$tool + +gdb_start +set file [remote_download host $GDB_FULLPATH x$tool] +set result [test_observer_normal_stop $file]; +gdb_exit; +catch "remote_file host delete $file"; + +if {$result <0} then { + warning "Couldn't test self" + return -1 +} diff --git a/gdb/thread.c b/gdb/thread.c index 2c70ee5f955..1b6d872050e 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,23 @@ 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, +load_infrun_state (ptid_t ptid, + CORE_ADDR *prev_pc, CORE_ADDR *prev_func_start, - char **prev_func_name, + 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; @@ -329,8 +327,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 +340,23 @@ load_infrun_state (ptid_t ptid, /* Save infrun state for the thread PID. */ void -save_infrun_state (ptid_t ptid, - CORE_ADDR prev_pc, +save_infrun_state (ptid_t ptid, + CORE_ADDR prev_pc, CORE_ADDR prev_func_start, - char *prev_func_name, + 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; @@ -506,7 +505,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 +570,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 +688,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 +721,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 +740,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/v850-tdep.c b/gdb/v850-tdep.c index 9bae316adcd..e6720a4bea5 100644 --- a/gdb/v850-tdep.c +++ b/gdb/v850-tdep.c @@ -1268,9 +1268,9 @@ 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_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); @@ -1292,6 +1292,9 @@ 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); + /* Should be using push_dummy_call. */ + set_gdbarch_deprecated_dummy_write_sp (gdbarch, generic_target_write_sp); + return gdbarch; } diff --git a/gdb/valops.c b/gdb/valops.c index ff24a9f4e7c..5b36cb76fef 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -1079,8 +1079,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; @@ -1264,6 +1264,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; @@ -1428,21 +1429,25 @@ hand_function_call (struct value *function, int nargs, struct value **args) 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 @@ -1569,9 +1574,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)) { @@ -1605,7 +1609,7 @@ You must use a pointer to function type variable. Command ignored.", arg_name); 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)) { @@ -1620,9 +1624,24 @@ You must use a pointer to function type variable. Command ignored.", arg_name); } } - 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 @@ -1633,9 +1652,14 @@ 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! */ @@ -1667,7 +1691,13 @@ You must use a pointer to function type variable. Command ignored.", arg_name); 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); diff --git a/gdb/value.h b/gdb/value.h index 04be76ad7fb..b5b2b07ac29 100644 --- a/gdb/value.h +++ b/gdb/value.h @@ -560,9 +560,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 d2ac4212872..aac62f3e13b 100644 --- a/gdb/vax-tdep.c +++ b/gdb/vax-tdep.c @@ -686,6 +686,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 dae81b3d271..968b70c1326 100644 --- a/gdb/version.in +++ b/gdb/version.in @@ -1 +1 @@ -2003-03-26-cvs +2003-03-30-cvs diff --git a/gdb/x86-64-tdep.c b/gdb/x86-64-tdep.c index 321d9c3fec5..5d43e015819 100644 --- a/gdb/x86-64-tdep.c +++ b/gdb/x86-64-tdep.c @@ -1013,8 +1013,8 @@ x86_64_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) 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_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); diff --git a/gdb/xstormy16-tdep.c b/gdb/xstormy16-tdep.c index 5408a08adb2..1ddc03f39d7 100644 --- a/gdb/xstormy16-tdep.c +++ b/gdb/xstormy16-tdep.c @@ -1084,9 +1084,9 @@ 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_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); @@ -1122,6 +1122,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; } diff --git a/include/gdb/ChangeLog b/include/gdb/ChangeLog index 97c2f443c38..9a216a0f3e2 100644 --- a/include/gdb/ChangeLog +++ b/include/gdb/ChangeLog @@ -1,3 +1,7 @@ +2003-03-27 Nick Clifton + + * sim-arm.h (sim_arm_regs): Add iWMMXt registers. + 2003-03-20 Nick Clifton * sim-arm.h (sim_arm_regs): Add Maverick co-processor diff --git a/include/gdb/sim-arm.h b/include/gdb/sim-arm.h index fae11f0b16b..5598f73fa8f 100644 --- a/include/gdb/sim-arm.h +++ b/include/gdb/sim-arm.h @@ -72,7 +72,39 @@ enum sim_arm_regs SIM_ARM_MAVERIC_COP0R13_REGNUM, SIM_ARM_MAVERIC_COP0R14_REGNUM, SIM_ARM_MAVERIC_COP0R15_REGNUM, - SIM_ARM_MAVERIC_DSPSC_REGNUM + SIM_ARM_MAVERIC_DSPSC_REGNUM, + SIM_ARM_IWMMXT_COP0R0_REGNUM, + SIM_ARM_IWMMXT_COP0R1_REGNUM, + SIM_ARM_IWMMXT_COP0R2_REGNUM, + SIM_ARM_IWMMXT_COP0R3_REGNUM, + SIM_ARM_IWMMXT_COP0R4_REGNUM, + SIM_ARM_IWMMXT_COP0R5_REGNUM, + SIM_ARM_IWMMXT_COP0R6_REGNUM, + SIM_ARM_IWMMXT_COP0R7_REGNUM, + SIM_ARM_IWMMXT_COP0R8_REGNUM, + SIM_ARM_IWMMXT_COP0R9_REGNUM, + SIM_ARM_IWMMXT_COP0R10_REGNUM, + SIM_ARM_IWMMXT_COP0R11_REGNUM, + SIM_ARM_IWMMXT_COP0R12_REGNUM, + SIM_ARM_IWMMXT_COP0R13_REGNUM, + SIM_ARM_IWMMXT_COP0R14_REGNUM, + SIM_ARM_IWMMXT_COP0R15_REGNUM, + SIM_ARM_IWMMXT_COP1R0_REGNUM, + SIM_ARM_IWMMXT_COP1R1_REGNUM, + SIM_ARM_IWMMXT_COP1R2_REGNUM, + SIM_ARM_IWMMXT_COP1R3_REGNUM, + SIM_ARM_IWMMXT_COP1R4_REGNUM, + SIM_ARM_IWMMXT_COP1R5_REGNUM, + SIM_ARM_IWMMXT_COP1R6_REGNUM, + SIM_ARM_IWMMXT_COP1R7_REGNUM, + SIM_ARM_IWMMXT_COP1R8_REGNUM, + SIM_ARM_IWMMXT_COP1R9_REGNUM, + SIM_ARM_IWMMXT_COP1R10_REGNUM, + SIM_ARM_IWMMXT_COP1R11_REGNUM, + SIM_ARM_IWMMXT_COP1R12_REGNUM, + SIM_ARM_IWMMXT_COP1R13_REGNUM, + SIM_ARM_IWMMXT_COP1R14_REGNUM, + SIM_ARM_IWMMXT_COP1R15_REGNUM }; #ifdef __cplusplus diff --git a/sim/arm/ChangeLog b/sim/arm/ChangeLog index c6597defef5..03c923ee0d6 100644 --- a/sim/arm/ChangeLog +++ b/sim/arm/ChangeLog @@ -1,3 +1,42 @@ +2003-03-30 Nick Clifton + + * configure.in (CON_FLAGS): Remove. + (COPRO): Unconditionally include iwmmxt.o. + * configure: Regenerate. + * Makefile.in (CON_FLAGS): Remove. + * armcopro.c: Remove use of __IWMMXT__ flag. + * wrapper.c: Likewise. + * armemu.c: Likewise. + Add explanatory comment for suppressed code. + +2003-03-27 Nick Clifton + + * armos.c (ARMul_OsHandleSWI): Catch SWIs for unhandled vectors. + +2003-03-27 Nick Clifton + + * configure.in: (CON_FLAGS): Define and intialise. + (COPRO): Add iwmmxt.o if configuring for XScale. + * configure: Regenerate. + * Makefile.in (iwmmxt.o): Add rule to build. + (COM_FLAGS): Define. + (ALL_FLAGS): Add CON_FLAGS. + * armcopro.c (ARMul_CoProInit): Initialise iWMMXt coprocessors. + * armdefs.h (struct ARMul_State): Add 'is_iWMMXt' field. + (ARM_iWMMXt_Prop): Define. + * armemu.c (ARMul_Emulate16): Intercept iWMMXt instructions and + pass to coprocessor. + * arminit.c (ARMul_NewState): Initialise 'is_iWMMXt'. + (ARMul_Abort): Catch branches through uninitialised vectors. + * armos.c (softevtorcode): Update comment. + (ARMul_OsInit): Use ARMUndefinedInstrV. + * wrapper.c (sim_create_inferior): Handle iWMMXt processor type. + (sim_store_register): Handle iWMMXt registers. + (sim_fetch_register): Handle iWMMXt registers. + * iwmmxt.h: New file. Exported iWMMXt coprocessor emulator + functions. + * iwmmxt.c: New file: iWMMXt emulator. + 2003-03-20 Nick Clifton * Contribute support for Cirrus Maverick ARM co-processor, diff --git a/sim/arm/Makefile.in b/sim/arm/Makefile.in index 017a983289d..7def0f967bb 100644 --- a/sim/arm/Makefile.in +++ b/sim/arm/Makefile.in @@ -32,6 +32,7 @@ armos.o: armos.c armdefs.h armos.h armfpe.h armcopro.o: armcopro.c armdefs.h maverick.o: maverick.c armdefs.h +iwmmxt.o: iwmmxt.c iwmmxt.h armdefs.h armemu26.o: armemu.c armdefs.h armemu.h $(CC) -c $(srcdir)/armemu.c -o armemu26.o $(ALL_CFLAGS) diff --git a/sim/arm/armcopro.c b/sim/arm/armcopro.c index b9747894869..aa75243dc33 100644 --- a/sim/arm/armcopro.c +++ b/sim/arm/armcopro.c @@ -19,6 +19,7 @@ #include "armos.h" #include "armemu.h" #include "ansidecl.h" +#include "iwmmxt.h" /* Dummy Co-processors. */ @@ -1365,6 +1366,15 @@ ARMul_CoProInit (ARMul_State * state) MMUMRC, MMUMCR, NULL, MMURead, MMUWrite); } + if (state->is_iWMMXt) + { + ARMul_CoProAttach (state, 0, NULL, NULL, IwmmxtLDC, IwmmxtSTC, + NULL, NULL, IwmmxtCDP, NULL, NULL); + + ARMul_CoProAttach (state, 1, NULL, NULL, NULL, NULL, + IwmmxtMRC, IwmmxtMCR, IwmmxtCDP, NULL, NULL); + } + /* No handlers below here. */ /* Call all the initialisation routines. */ diff --git a/sim/arm/armdefs.h b/sim/arm/armdefs.h index 0f252226dd9..a2ea4059037 100644 --- a/sim/arm/armdefs.h +++ b/sim/arm/armdefs.h @@ -135,6 +135,7 @@ struct ARMul_State unsigned is_v5; /* Are we emulating a v5 architecture ? */ unsigned is_v5e; /* Are we emulating a v5e architecture ? */ unsigned is_XScale; /* Are we emulating an XScale architecture ? */ + unsigned is_iWMMXt; /* Are we emulating an iWMMXt co-processor ? */ unsigned is_ep9312; /* Are we emulating a Cirrus Maverick co-processor ? */ unsigned verbose; /* Print various messages like the banner */ }; @@ -164,6 +165,7 @@ struct ARMul_State #define ARM_v5e_Prop 0x100 #define ARM_XScale_Prop 0x200 #define ARM_ep9312_Prop 0x400 +#define ARM_iWMMXt_Prop 0x800 /***************************************************************************\ * Macros to extract instruction fields * diff --git a/sim/arm/armemu.c b/sim/arm/armemu.c index 44943c4ecde..d12ad10e41c 100644 --- a/sim/arm/armemu.c +++ b/sim/arm/armemu.c @@ -19,6 +19,7 @@ #include "armdefs.h" #include "armemu.h" #include "armos.h" +#include "iwmmxt.h" static ARMword GetDPRegRHS (ARMul_State *, ARMword); static ARMword GetDPSRegRHS (ARMul_State *, ARMword); @@ -374,12 +375,23 @@ ARMul_Emulate26 (ARMul_State * state) if (state->EventSet) ARMul_EnvokeEvent (state); -#if 0 - /* Enable this for a helpful bit of debugging when tracing is needed. */ +#if 0 /* Enable this for a helpful bit of debugging when tracing is needed. */ fprintf (stderr, "pc: %x, instr: %x\n", pc & ~1, instr); if (instr == 0) abort (); #endif +#if 0 /* Enable this code to help track down stack alignment bugs. */ + { + static ARMword old_sp = -1; + + if (old_sp != state->Reg[13]) + { + old_sp = state->Reg[13]; + fprintf (stderr, "pc: %08x: SP set to %08x%s\n", + pc & ~1, old_sp, (old_sp % 8) ? " [UNALIGNED!]" : ""); + } + } +#endif if (state->Exception) { @@ -492,6 +504,10 @@ ARMul_Emulate26 (ARMul_State * state) else if ((instr & 0xFC70F000) == 0xF450F000) /* The PLD instruction. Ignored. */ goto donext; + else if ( ((instr & 0xfe500f00) == 0xfc100100) + || ((instr & 0xfe500f00) == 0xfc000100)) + /* wldrw and wstrw are unconditional. */ + goto mainswitch; else /* UNDEFINED in v5, UNPREDICTABLE in v3, v4, non executed in v1, v2. */ ARMul_UndefInstr (state, instr); @@ -689,6 +705,9 @@ check_PMUintr: goto donext; } } + + if (ARMul_HandleIwmmxt (state, instr)) + goto donext; } switch ((int) BITS (20, 27)) diff --git a/sim/arm/arminit.c b/sim/arm/arminit.c index 04399900c95..45887879c31 100644 --- a/sim/arm/arminit.c +++ b/sim/arm/arminit.c @@ -17,6 +17,7 @@ #include "armdefs.h" #include "armemu.h" +#include "dbg_rdi.h" /***************************************************************************\ * Definitions for the emulator architecture * @@ -127,6 +128,7 @@ ARMul_NewState (void) state->is_v5 = LOW; state->is_v5e = LOW; state->is_XScale = LOW; + state->is_iWMMXt = LOW; ARMul_Reset (state); @@ -157,6 +159,7 @@ ARMul_SelectProcessor (ARMul_State * state, unsigned properties) state->is_v5 = (properties & ARM_v5_Prop) ? HIGH : LOW; state->is_v5e = (properties & ARM_v5e_Prop) ? HIGH : LOW; state->is_XScale = (properties & ARM_XScale_Prop) ? HIGH : LOW; + state->is_iWMMXt = (properties & ARM_iWMMXt_Prop) ? HIGH : LOW; state->is_ep9312 = (properties & ARM_ep9312_Prop) ? HIGH : LOW; /* Only initialse the coprocessor support once we @@ -323,4 +326,24 @@ ARMul_Abort (ARMul_State * state, ARMword vector) ARMul_SetR15 (state, vector); else ARMul_SetR15 (state, R15CCINTMODE | vector); + + if (ARMul_ReadWord (state, ARMul_GetPC (state)) == 0) + { + /* No vector has been installed. Rather than simulating whatever + random bits might happen to be at address 0x20 onwards we elect + to stop. */ + switch (vector) + { + case ARMul_ResetV: state->EndCondition = RDIError_Reset; break; + case ARMul_UndefinedInstrV: state->EndCondition = RDIError_UndefinedInstruction; break; + case ARMul_SWIV: state->EndCondition = RDIError_SoftwareInterrupt; break; + case ARMul_PrefetchAbortV: state->EndCondition = RDIError_PrefetchAbort; break; + case ARMul_DataAbortV: state->EndCondition = RDIError_DataAbort; break; + case ARMul_AddrExceptnV: state->EndCondition = RDIError_AddressException; break; + case ARMul_IRQV: state->EndCondition = RDIError_IRQ; break; + case ARMul_FIQV: state->EndCondition = RDIError_FIQ; break; + default: break; + } + state->Emulate = FALSE; + } } diff --git a/sim/arm/armos.c b/sim/arm/armos.c index 04916d6ad72..613d07eda17 100644 --- a/sim/arm/armos.c +++ b/sim/arm/armos.c @@ -131,8 +131,11 @@ unsigned int swi_mask = -1; static ARMword softvectorcode[] = { - /* Basic: swi tidyexception + event; mov pc, lr; - ldmia r11,{r11,pc}; swi generateexception + event. */ + /* Installed instructions: + swi tidyexception + event; + mov lr, pc; + ldmia fp, {fp, pc}; + swi generateexception + event. */ 0xef000090, 0xe1a0e00f, 0xe89b8800, 0xef000080, /* Reset */ 0xef000091, 0xe1a0e00f, 0xe89b8800, 0xef000081, /* Undef */ 0xef000092, 0xe1a0e00f, 0xe89b8800, 0xef000082, /* SWI */ @@ -205,11 +208,15 @@ ARMul_OSInit (ARMul_State * state) /* Copy the code. */ ARMul_WriteWord (state, FPESTART + i, fpecode[i >> 2]); + /* Scan backwards from the end of the code. */ for (i = FPESTART + fpesize;; i -= 4) { - /* Reverse the error strings. */ + /* When we reach the marker value, break out of + the loop, leaving i pointing at the maker. */ if ((j = ARMul_ReadWord (state, i)) == 0xffffffff) break; + + /* If necessary, reverse the error strings. */ if (state->bigendSig && j < 0x80000000) { /* It's part of the string so swap it. */ @@ -221,9 +228,9 @@ ARMul_OSInit (ARMul_State * state) } /* Copy old illegal instr vector. */ - ARMul_WriteWord (state, FPEOLDVECT, ARMul_ReadWord (state, 4)); + ARMul_WriteWord (state, FPEOLDVECT, ARMul_ReadWord (state, ARMUndefinedInstrV)); /* Install new vector. */ - ARMul_WriteWord (state, 4, FPENEWVECT (ARMul_ReadWord (state, i - 4))); + ARMul_WriteWord (state, ARMUndefinedInstrV, FPENEWVECT (ARMul_ReadWord (state, i - 4))); ARMul_ConsolePrint (state, ", FPE"); /* #endif ASIM */ @@ -692,12 +699,34 @@ ARMul_OSHandleSWI (ARMul_State * state, ARMword number) unhandled = TRUE; break; - case 0x90: - case 0x91: - case 0x92: - /* These are used by the FPE code. */ + /* The following SWIs are generated by the softvectorcode[] + installed by default by the simulator. */ + case 0x91: /* Undefined Instruction. */ + { + ARMword addr = state->RegBank[UNDEFBANK][14] - 4; + + sim_callback->printf_filtered + (sim_callback, "sim: exception: Unhandled Instruction '0x%08x' at 0x%08x. Stopping.\n", + ARMul_ReadWord (state, addr), addr); + state->EndCondition = RDIError_SoftwareInterrupt; + state->Emulate = FALSE; + return FALSE; + } + + case 0x90: /* Reset. */ + case 0x92: /* SWI. */ + /* These two can be safely ignored. */ break; - + + case 0x93: /* Prefetch Abort. */ + case 0x94: /* Data Abort. */ + case 0x95: /* Address Exception. */ + case 0x96: /* IRQ. */ + case 0x97: /* FIQ. */ + case 0x98: /* Error. */ + unhandled = TRUE; + break; + case -1: /* This can happen when a SWI is interrupted (eg receiving a ctrl-C whilst processing SWIRead()). The SWI will complete diff --git a/sim/arm/configure b/sim/arm/configure index 26fd5f5d6d1..a82b7c7119e 100755 --- a/sim/arm/configure +++ b/sim/arm/configure @@ -3534,7 +3534,7 @@ fi done -COPRO="armcopro.o maverick.o" +COPRO="armcopro.o maverick.o iwmmxt.o" diff --git a/sim/arm/configure.in b/sim/arm/configure.in index 73fa0a0a643..44300ca8ca7 100644 --- a/sim/arm/configure.in +++ b/sim/arm/configure.in @@ -7,7 +7,7 @@ SIM_AC_COMMON AC_CHECK_HEADERS(unistd.h) -COPRO="armcopro.o maverick.o" +COPRO="armcopro.o maverick.o iwmmxt.o" AC_SUBST(COPRO) diff --git a/sim/arm/iwmmxt.c b/sim/arm/iwmmxt.c new file mode 100644 index 00000000000..72444f6fdbd --- /dev/null +++ b/sim/arm/iwmmxt.c @@ -0,0 +1,3730 @@ +/* iwmmxt.c -- Intel(r) Wireless MMX(tm) technology co-processor interface. + Copyright (C) 2002 Free Software Foundation, Inc. + Contributed by matthew green (mrg@redhat.com). + + 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 "armdefs.h" +#include "armos.h" +#include "armemu.h" +#include "ansidecl.h" +#include "iwmmxt.h" + +/* #define DEBUG 1 */ + +/* Intel(r) Wireless MMX(tm) technology co-processor. + It uses co-processor numbers (0 and 1). There are 16 vector registers wRx + and 16 control registers wCx. Co-processors 0 and 1 are used in MCR/MRC + to access wRx and wCx respectively. */ + +static ARMdword wR[16]; +static ARMword wC[16] = { 0x69051010 }; + +#define SUBSTR(w,t,m,n) ((t)(w << ((sizeof (t) * 8 - 1) - (n))) \ + >> (((sizeof (t) * 8 - 1) - (n)) + (m))) +#define wCBITS(w,x,y) SUBSTR (wC[w], ARMword, x, y) +#define wRBITS(w,x,y) SUBSTR (wR[w], ARMdword, x, y) +#define wCID 0 +#define wCon 1 +#define wCSSF 2 +#define wCASF 3 +#define wCGR0 8 +#define wCGR1 9 +#define wCGR2 10 +#define wCGR3 11 + +/* Bits in the wCon register. */ +#define WCON_CUP (1 << 0) +#define WCON_MUP (1 << 1) + +/* Set the SIMD wCASF flags for 8, 16, 32 or 64-bit operations. */ +#define SIMD8_SET(x, v, n, b) (x) |= ((v != 0) << ((((b) + 1) * 4) + (n))) +#define SIMD16_SET(x, v, n, h) (x) |= ((v != 0) << ((((h) + 1) * 8) + (n))) +#define SIMD32_SET(x, v, n, w) (x) |= ((v != 0) << ((((w) + 1) * 16) + (n))) +#define SIMD64_SET(x, v, n) (x) |= ((v != 0) << (32 + (n))) + +/* Flags to pass as "n" above. */ +#define SIMD_NBIT -1 +#define SIMD_ZBIT -2 +#define SIMD_CBIT -3 +#define SIMD_VBIT -4 + +/* Various status bit macros. */ +#define NBIT8(x) ((x) & 0x80) +#define NBIT16(x) ((x) & 0x8000) +#define NBIT32(x) ((x) & 0x80000000) +#define NBIT64(x) ((x) & 0x8000000000000000ULL) +#define ZBIT8(x) (((x) & 0xff) == 0) +#define ZBIT16(x) (((x) & 0xffff) == 0) +#define ZBIT32(x) (((x) & 0xffffffff) == 0) +#define ZBIT64(x) (x == 0) + +/* Access byte/half/word "n" of register "x". */ +#define wRBYTE(x,n) wRBITS ((x), (n) * 8, (n) * 8 + 7) +#define wRHALF(x,n) wRBITS ((x), (n) * 16, (n) * 16 + 15) +#define wRWORD(x,n) wRBITS ((x), (n) * 32, (n) * 32 + 31) + +/* Macro to handle how the G bit selects wCGR registers. */ +#define DECODE_G_BIT(state, instr, shift) \ +{ \ + unsigned int reg; \ + \ + reg = BITS (0, 3); \ + \ + if (BIT (8)) /* G */ \ + { \ + if (reg < wCGR0 || reg > wCGR3) \ + { \ + ARMul_UndefInstr (state, instr); \ + return ARMul_DONE; \ + } \ + shift = wC [reg]; \ + } \ + else \ + shift = wR [reg]; \ + \ + shift &= 0xff; \ +} + +/* Index calculations for the satrv[] array. */ +#define BITIDX8(x) (x) +#define BITIDX16(x) (((x) + 1) * 2 - 1) +#define BITIDX32(x) (((x) + 1) * 4 - 1) + +/* Sign extension macros. */ +#define EXTEND8(a) ((a) & 0x80 ? ((a) | 0xffffff00) : (a)) +#define EXTEND16(a) ((a) & 0x8000 ? ((a) | 0xffff0000) : (a)) +#define EXTEND32(a) ((a) & 0x80000000ULL ? ((a) | 0xffffffff00000000ULL) : (a)) + +/* Set the wCSSF from 8 values. */ +#define SET_wCSSF(a,b,c,d,e,f,g,h) \ + wC[wCSSF] = (((h) != 0) << 7) | (((g) != 0) << 6) \ + | (((f) != 0) << 5) | (((e) != 0) << 4) \ + | (((d) != 0) << 3) | (((c) != 0) << 2) \ + | (((b) != 0) << 1) | (((a) != 0) << 0); + +/* Set the wCSSR from an array with 8 values. */ +#define SET_wCSSFvec(v) \ + SET_wCSSF((v)[0],(v)[1],(v)[2],(v)[3],(v)[4],(v)[5],(v)[6],(v)[7]) + +/* Size qualifiers for vector operations. */ +#define Bqual 0 +#define Hqual 1 +#define Wqual 2 +#define Dqual 3 + +/* Saturation qualifiers for vector operations. */ +#define NoSaturation 0 +#define UnsignedSaturation 1 +#define SignedSaturation 3 + + +/* Prototypes. */ +static ARMword Add32 (ARMword, ARMword, int *, int *, ARMword); +static ARMdword AddS32 (ARMdword, ARMdword, int *, int *); +static ARMdword AddU32 (ARMdword, ARMdword, int *, int *); +static ARMword AddS16 (ARMword, ARMword, int *, int *); +static ARMword AddU16 (ARMword, ARMword, int *, int *); +static ARMword AddS8 (ARMword, ARMword, int *, int *); +static ARMword AddU8 (ARMword, ARMword, int *, int *); +static ARMword Sub32 (ARMword, ARMword, int *, int *, ARMword); +static ARMdword SubS32 (ARMdword, ARMdword, int *, int *); +static ARMdword SubU32 (ARMdword, ARMdword, int *, int *); +static ARMword SubS16 (ARMword, ARMword, int *, int *); +static ARMword SubS8 (ARMword, ARMword, int *, int *); +static ARMword SubU16 (ARMword, ARMword, int *, int *); +static ARMword SubU8 (ARMword, ARMword, int *, int *); +static unsigned char IwmmxtSaturateU8 (signed short, int *); +static signed char IwmmxtSaturateS8 (signed short, int *); +static unsigned short IwmmxtSaturateU16 (signed int, int *); +static signed short IwmmxtSaturateS16 (signed int, int *); +static unsigned long IwmmxtSaturateU32 (signed long long, int *); +static signed long IwmmxtSaturateS32 (signed long long, int *); +static ARMword Compute_Iwmmxt_Address (ARMul_State *, ARMword, int *); +static ARMdword Iwmmxt_Load_Double_Word (ARMul_State *, ARMword); +static ARMword Iwmmxt_Load_Word (ARMul_State *, ARMword); +static ARMword Iwmmxt_Load_Half_Word (ARMul_State *, ARMword); +static ARMword Iwmmxt_Load_Byte (ARMul_State *, ARMword); +static void Iwmmxt_Store_Double_Word (ARMul_State *, ARMword, ARMdword); +static void Iwmmxt_Store_Word (ARMul_State *, ARMword, ARMword); +static void Iwmmxt_Store_Half_Word (ARMul_State *, ARMword, ARMword); +static void Iwmmxt_Store_Byte (ARMul_State *, ARMword, ARMword); +static int Process_Instruction (ARMul_State *, ARMword); + +static int TANDC (ARMul_State *, ARMword); +static int TBCST (ARMul_State *, ARMword); +static int TEXTRC (ARMul_State *, ARMword); +static int TEXTRM (ARMul_State *, ARMword); +static int TINSR (ARMul_State *, ARMword); +static int TMCR (ARMul_State *, ARMword); +static int TMCRR (ARMul_State *, ARMword); +static int TMIA (ARMul_State *, ARMword); +static int TMIAPH (ARMul_State *, ARMword); +static int TMIAxy (ARMul_State *, ARMword); +static int TMOVMSK (ARMul_State *, ARMword); +static int TMRC (ARMul_State *, ARMword); +static int TMRRC (ARMul_State *, ARMword); +static int TORC (ARMul_State *, ARMword); +static int WACC (ARMul_State *, ARMword); +static int WADD (ARMul_State *, ARMword); +static int WALIGNI (ARMword); +static int WALIGNR (ARMul_State *, ARMword); +static int WAND (ARMword); +static int WANDN (ARMword); +static int WAVG2 (ARMword); +static int WCMPEQ (ARMul_State *, ARMword); +static int WCMPGT (ARMul_State *, ARMword); +static int WLDR (ARMul_State *, ARMword); +static int WMAC (ARMword); +static int WMADD (ARMword); +static int WMAX (ARMul_State *, ARMword); +static int WMIN (ARMul_State *, ARMword); +static int WMUL (ARMword); +static int WOR (ARMword); +static int WPACK (ARMul_State *, ARMword); +static int WROR (ARMul_State *, ARMword); +static int WSAD (ARMword); +static int WSHUFH (ARMword); +static int WSLL (ARMul_State *, ARMword); +static int WSRA (ARMul_State *, ARMword); +static int WSRL (ARMul_State *, ARMword); +static int WSTR (ARMul_State *, ARMword); +static int WSUB (ARMul_State *, ARMword); +static int WUNPCKEH (ARMul_State *, ARMword); +static int WUNPCKEL (ARMul_State *, ARMword); +static int WUNPCKIH (ARMul_State *, ARMword); +static int WUNPCKIL (ARMul_State *, ARMword); +static int WXOR (ARMword); + +/* This function does the work of adding two 32bit values + together, and calculating if a carry has occurred. */ + +static ARMword +Add32 (ARMword a1, + ARMword a2, + int * carry_ptr, + int * overflow_ptr, + ARMword sign_mask) +{ + ARMword result = (a1 + a2); + unsigned int uresult = (unsigned int) result; + unsigned int ua1 = (unsigned int) a1; + + /* If (result == a1) and (a2 == 0), + or (result > a2) then we have no carry. */ + * carry_ptr = ((uresult == ua1) ? (a2 != 0) : (uresult < ua1)); + + /* Overflow occurs when both arguments are the + same sign, but the result is a different sign. */ + * overflow_ptr = ( ( (result & sign_mask) && !(a1 & sign_mask) && !(a2 & sign_mask)) + || (!(result & sign_mask) && (a1 & sign_mask) && (a2 & sign_mask))); + + return result; +} + +static ARMdword +AddS32 (ARMdword a1, ARMdword a2, int * carry_ptr, int * overflow_ptr) +{ + ARMdword result; + unsigned int uresult; + unsigned int ua1; + + a1 = EXTEND32 (a1); + a2 = EXTEND32 (a2); + + result = a1 + a2; + uresult = (unsigned int) result; + ua1 = (unsigned int) a1; + + * carry_ptr = ((uresult == a1) ? (a2 != 0) : (uresult < ua1)); + + * overflow_ptr = ( ( (result & 0x80000000ULL) && !(a1 & 0x80000000ULL) && !(a2 & 0x80000000ULL)) + || (!(result & 0x80000000ULL) && (a1 & 0x80000000ULL) && (a2 & 0x80000000ULL))); + + return result; +} + +static ARMdword +AddU32 (ARMdword a1, ARMdword a2, int * carry_ptr, int * overflow_ptr) +{ + ARMdword result; + unsigned int uresult; + unsigned int ua1; + + a1 &= 0xffffffff; + a2 &= 0xffffffff; + + result = a1 + a2; + uresult = (unsigned int) result; + ua1 = (unsigned int) a1; + + * carry_ptr = ((uresult == a1) ? (a2 != 0) : (uresult < ua1)); + + * overflow_ptr = ( ( (result & 0x80000000ULL) && !(a1 & 0x80000000ULL) && !(a2 & 0x80000000ULL)) + || (!(result & 0x80000000ULL) && (a1 & 0x80000000ULL) && (a2 & 0x80000000ULL))); + + return result; +} + +static ARMword +AddS16 (ARMword a1, ARMword a2, int * carry_ptr, int * overflow_ptr) +{ + a1 = EXTEND16 (a1); + a2 = EXTEND16 (a2); + + return Add32 (a1, a2, carry_ptr, overflow_ptr, 0x8000); +} + +static ARMword +AddU16 (ARMword a1, ARMword a2, int * carry_ptr, int * overflow_ptr) +{ + a1 &= 0xffff; + a2 &= 0xffff; + + return Add32 (a1, a2, carry_ptr, overflow_ptr, 0x8000); +} + +static ARMword +AddS8 (ARMword a1, ARMword a2, int * carry_ptr, int * overflow_ptr) +{ + a1 = EXTEND8 (a1); + a2 = EXTEND8 (a2); + + return Add32 (a1, a2, carry_ptr, overflow_ptr, 0x80); +} + +static ARMword +AddU8 (ARMword a1, ARMword a2, int * carry_ptr, int * overflow_ptr) +{ + a1 &= 0xff; + a2 &= 0xff; + + return Add32 (a1, a2, carry_ptr, overflow_ptr, 0x80); +} + +static ARMword +Sub32 (ARMword a1, + ARMword a2, + int * borrow_ptr, + int * overflow_ptr, + ARMword sign_mask) +{ + ARMword result = (a1 - a2); + unsigned int ua1 = (unsigned int) a1; + unsigned int ua2 = (unsigned int) a2; + + /* A borrow occurs if a2 is (unsigned) larger than a1. + However the carry flag is *cleared* if a borrow occurs. */ + * borrow_ptr = ! (ua2 > ua1); + + /* Overflow occurs when a negative number is subtracted from a + positive number and the result is negative or a positive + number is subtracted from a negative number and the result is + positive. */ + * overflow_ptr = ( (! (a1 & sign_mask) && (a2 & sign_mask) && (result & sign_mask)) + || ((a1 & sign_mask) && ! (a2 & sign_mask) && ! (result & sign_mask))); + + return result; +} + +static ARMdword +SubS32 (ARMdword a1, ARMdword a2, int * borrow_ptr, int * overflow_ptr) +{ + ARMdword result; + unsigned int ua1; + unsigned int ua2; + + a1 = EXTEND32 (a1); + a2 = EXTEND32 (a2); + + result = a1 - a2; + ua1 = (unsigned int) a1; + ua2 = (unsigned int) a2; + + * borrow_ptr = ! (ua2 > ua1); + + * overflow_ptr = ( (! (a1 & 0x80000000ULL) && (a2 & 0x80000000ULL) && (result & 0x80000000ULL)) + || ((a1 & 0x80000000ULL) && ! (a2 & 0x80000000ULL) && ! (result & 0x80000000ULL))); + + return result; +} + +static ARMword +SubS16 (ARMword a1, ARMword a2, int * carry_ptr, int * overflow_ptr) +{ + a1 = EXTEND16 (a1); + a2 = EXTEND16 (a2); + + return Sub32 (a1, a2, carry_ptr, overflow_ptr, 0x8000); +} + +static ARMword +SubS8 (ARMword a1, ARMword a2, int * carry_ptr, int * overflow_ptr) +{ + a1 = EXTEND8 (a1); + a2 = EXTEND8 (a2); + + return Sub32 (a1, a2, carry_ptr, overflow_ptr, 0x80); +} + +static ARMword +SubU16 (ARMword a1, ARMword a2, int * carry_ptr, int * overflow_ptr) +{ + a1 &= 0xffff; + a2 &= 0xffff; + + return Sub32 (a1, a2, carry_ptr, overflow_ptr, 0x8000); +} + +static ARMword +SubU8 (ARMword a1, ARMword a2, int * carry_ptr, int * overflow_ptr) +{ + a1 &= 0xff; + a2 &= 0xff; + + return Sub32 (a1, a2, carry_ptr, overflow_ptr, 0x80); +} + +static ARMdword +SubU32 (ARMdword a1, ARMdword a2, int * borrow_ptr, int * overflow_ptr) +{ + ARMdword result; + unsigned int ua1; + unsigned int ua2; + + a1 &= 0xffffffff; + a2 &= 0xffffffff; + + result = a1 - a2; + ua1 = (unsigned int) a1; + ua2 = (unsigned int) a2; + + * borrow_ptr = ! (ua2 > ua1); + + * overflow_ptr = ( (! (a1 & 0x80000000ULL) && (a2 & 0x80000000ULL) && (result & 0x80000000ULL)) + || ((a1 & 0x80000000ULL) && ! (a2 & 0x80000000ULL) && ! (result & 0x80000000ULL))); + + return result; +} + +/* For the saturation. */ + +static unsigned char +IwmmxtSaturateU8 (signed short val, int * sat) +{ + unsigned char rv; + + if (val < 0) + { + rv = 0; + *sat = 1; + } + else if (val > 0xff) + { + rv = 0xff; + *sat = 1; + } + else + { + rv = val & 0xff; + *sat = 0; + } + return rv; +} + +static signed char +IwmmxtSaturateS8 (signed short val, int * sat) +{ + signed char rv; + + if (val < -0x80) + { + rv = -0x80; + *sat = 1; + } + else if (val > 0x7f) + { + rv = 0x7f; + *sat = 1; + } + else + { + rv = val & 0xff; + *sat = 0; + } + return rv; +} + +static unsigned short +IwmmxtSaturateU16 (signed int val, int * sat) +{ + unsigned short rv; + + if (val < 0) + { + rv = 0; + *sat = 1; + } + else if (val > 0xffff) + { + rv = 0xffff; + *sat = 1; + } + else + { + rv = val & 0xffff; + *sat = 0; + } + return rv; +} + +static signed short +IwmmxtSaturateS16 (signed int val, int * sat) +{ + signed short rv; + + if (val < -0x8000) + { + rv = - 0x8000; + *sat = 1; + } + else if (val > 0x7fff) + { + rv = 0x7fff; + *sat = 1; + } + else + { + rv = val & 0xffff; + *sat = 0; + } + return rv; +} + +static unsigned long +IwmmxtSaturateU32 (signed long long val, int * sat) +{ + unsigned long rv; + + if (val < 0) + { + rv = 0; + *sat = 1; + } + else if (val > 0xffffffff) + { + rv = 0xffffffff; + *sat = 1; + } + else + { + rv = val & 0xffffffff; + *sat = 0; + } + return rv; +} + +static signed long +IwmmxtSaturateS32 (signed long long val, int * sat) +{ + signed long rv; + + if (val < -0x80000000LL) + { + rv = -0x80000000; + *sat = 1; + } + else if (val > 0x7fffffff) + { + rv = 0x7fffffff; + *sat = 1; + } + else + { + rv = val & 0xffffffff; + *sat = 0; + } + return rv; +} + +/* Intel(r) Wireless MMX(tm) technology Acessor functions. */ + +unsigned +IwmmxtLDC (ARMul_State * state ATTRIBUTE_UNUSED, + unsigned type ATTRIBUTE_UNUSED, + ARMword instr, + ARMword data) +{ + return ARMul_CANT; +} + +unsigned +IwmmxtSTC (ARMul_State * state ATTRIBUTE_UNUSED, + unsigned type ATTRIBUTE_UNUSED, + ARMword instr, + ARMword * data) +{ + return ARMul_CANT; +} + +unsigned +IwmmxtMRC (ARMul_State * state ATTRIBUTE_UNUSED, + unsigned type ATTRIBUTE_UNUSED, + ARMword instr, + ARMword * value) +{ + return ARMul_CANT; +} + +unsigned +IwmmxtMCR (ARMul_State * state ATTRIBUTE_UNUSED, + unsigned type ATTRIBUTE_UNUSED, + ARMword instr, + ARMword value) +{ + return ARMul_CANT; +} + +unsigned +IwmmxtCDP (ARMul_State * state, unsigned type, ARMword instr) +{ + return ARMul_CANT; +} + +/* Intel(r) Wireless MMX(tm) technology instruction implementations. */ + +static int +TANDC (ARMul_State * state, ARMword instr) +{ + ARMword cpsr; + + if ((read_cp15_reg (15, 0, 1) & 3) != 3) + return ARMul_CANT; + +#ifdef DEBUG + fprintf (stderr, "tandc\n"); +#endif + + /* The Rd field must be r15. */ + if (BITS (12, 15) != 15) + return ARMul_CANT; + + /* The CRn field must be r3. */ + if (BITS (16, 19) != 3) + return ARMul_CANT; + + /* The CRm field must be r0. */ + if (BITS (0, 3) != 0) + return ARMul_CANT; + + cpsr = ARMul_GetCPSR (state) & 0x0fffffff; + + switch (BITS (22, 23)) + { + case Bqual: + cpsr |= ( (wCBITS (wCASF, 28, 31) & wCBITS (wCASF, 24, 27) + & wCBITS (wCASF, 20, 23) & wCBITS (wCASF, 16, 19) + & wCBITS (wCASF, 12, 15) & wCBITS (wCASF, 8, 11) + & wCBITS (wCASF, 4, 7) & wCBITS (wCASF, 0, 3)) << 28); + break; + + case Hqual: + cpsr |= ( (wCBITS (wCASF, 28, 31) & wCBITS (wCASF, 20, 23) + & wCBITS (wCASF, 12, 15) & wCBITS (wCASF, 4, 7)) << 28); + break; + + case Wqual: + cpsr |= ((wCBITS (wCASF, 28, 31) & wCBITS (wCASF, 12, 15)) << 28); + break; + + default: + ARMul_UndefInstr (state, instr); + return ARMul_DONE; + } + + ARMul_SetCPSR (state, cpsr); + + return ARMul_DONE; +} + +static int +TBCST (ARMul_State * state, ARMword instr) +{ + ARMdword Rn; + int wRd; + + if ((read_cp15_reg (15, 0, 1) & 3) != 3) + return ARMul_CANT; + +#ifdef DEBUG + fprintf (stderr, "tbcst\n"); +#endif + + Rn = state->Reg [BITS (12, 15)]; + if (BITS (12, 15) == 15) + Rn &= 0xfffffffc; + + wRd = BITS (16, 19); + + switch (BITS (6, 7)) + { + case Bqual: + Rn &= 0xff; + wR [wRd] = (Rn << 56) | (Rn << 48) | (Rn << 40) | (Rn << 32) + | (Rn << 24) | (Rn << 16) | (Rn << 8) | Rn; + break; + + case Hqual: + Rn &= 0xffff; + wR [wRd] = (Rn << 48) | (Rn << 32) | (Rn << 16) | Rn; + break; + + case Wqual: + Rn &= 0xffffffff; + wR [wRd] = (Rn << 32) | Rn; + break; + + default: + ARMul_UndefInstr (state, instr); + break; + } + + wC [wCon] |= WCON_MUP; + return ARMul_DONE; +} + +static int +TEXTRC (ARMul_State * state, ARMword instr) +{ + ARMword cpsr; + ARMword selector; + + if ((read_cp15_reg (15, 0, 1) & 3) != 3) + return ARMul_CANT; + +#ifdef DEBUG + fprintf (stderr, "textrc\n"); +#endif + + /* The Rd field must be r15. */ + if (BITS (12, 15) != 15) + return ARMul_CANT; + + /* The CRn field must be r3. */ + if (BITS (16, 19) != 3) + return ARMul_CANT; + + /* The CRm field must be 0xxx. */ + if (BIT (3) != 0) + return ARMul_CANT; + + selector = BITS (0, 2); + cpsr = ARMul_GetCPSR (state) & 0x0fffffff; + + switch (BITS (22, 23)) + { + case Bqual: selector *= 4; break; + case Hqual: selector = ((selector & 3) * 8) + 4; break; + case Wqual: selector = ((selector & 1) * 16) + 12; break; + + default: + ARMul_UndefInstr (state, instr); + return ARMul_DONE; + } + + cpsr |= wCBITS (wCASF, selector, selector + 3) << 28; + ARMul_SetCPSR (state, cpsr); + + return ARMul_DONE; +} + +static int +TEXTRM (ARMul_State * state, ARMword instr) +{ + ARMword Rd; + int offset; + int wRn; + int sign; + + if ((read_cp15_reg (15, 0, 1) & 3) != 3) + return ARMul_CANT; + +#ifdef DEBUG + fprintf (stderr, "textrm\n"); +#endif + + wRn = BITS (16, 19); + sign = BIT (3); + offset = BITS (0, 2); + + switch (BITS (22, 23)) + { + case Bqual: + offset *= 8; + Rd = wRBITS (wRn, offset, offset + 7); + if (sign) + Rd = EXTEND8 (Rd); + break; + + case Hqual: + offset = (offset & 3) * 16; + Rd = wRBITS (wRn, offset, offset + 15); + if (sign) + Rd = EXTEND16 (Rd); + break; + + case Wqual: + offset = (offset & 1) * 32; + Rd = wRBITS (wRn, offset, offset + 31); + break; + + default: + ARMul_UndefInstr (state, instr); + return ARMul_DONE; + } + + if (BITS (12, 15) == 15) + ARMul_UndefInstr (state, instr); + else + state->Reg [BITS (12, 15)] = Rd; + + return ARMul_DONE; +} + +static int +TINSR (ARMul_State * state, ARMword instr) +{ + ARMdword data; + ARMword offset; + int wRd; + + if ((read_cp15_reg (15, 0, 1) & 3) != 3) + return ARMul_CANT; + +#ifdef DEBUG + fprintf (stderr, "tinsr\n"); +#endif + + wRd = BITS (16, 19); + data = state->Reg [BITS (12, 15)]; + offset = BITS (0, 2); + + switch (BITS (6, 7)) + { + case Bqual: + data &= 0xff; + switch (offset) + { + case 0: wR [wRd] = data | (wRBITS (wRd, 8, 63) << 8); break; + case 1: wR [wRd] = wRBITS (wRd, 0, 7) | (data << 8) | (wRBITS (wRd, 16, 63) << 16); break; + case 2: wR [wRd] = wRBITS (wRd, 0, 15) | (data << 16) | (wRBITS (wRd, 24, 63) << 24); break; + case 3: wR [wRd] = wRBITS (wRd, 0, 23) | (data << 24) | (wRBITS (wRd, 32, 63) << 32); break; + case 4: wR [wRd] = wRBITS (wRd, 0, 31) | (data << 32) | (wRBITS (wRd, 40, 63) << 40); break; + case 5: wR [wRd] = wRBITS (wRd, 0, 39) | (data << 40) | (wRBITS (wRd, 48, 63) << 48); break; + case 6: wR [wRd] = wRBITS (wRd, 0, 47) | (data << 48) | (wRBITS (wRd, 56, 63) << 56); break; + case 7: wR [wRd] = wRBITS (wRd, 0, 55) | (data << 56); break; + } + break; + + case Hqual: + data &= 0xffff; + + switch (offset & 3) + { + case 0: wR [wRd] = data | (wRBITS (wRd, 16, 63) << 16); break; + case 1: wR [wRd] = wRBITS (wRd, 0, 15) | (data << 16) | (wRBITS (wRd, 32, 63) << 32); break; + case 2: wR [wRd] = wRBITS (wRd, 0, 31) | (data << 32) | (wRBITS (wRd, 48, 63) << 48); break; + case 3: wR [wRd] = wRBITS (wRd, 0, 47) | (data << 48); break; + } + break; + + case Wqual: + if (offset & 1) + wR [wRd] = wRBITS (wRd, 0, 31) | (data << 32); + else + wR [wRd] = (wRBITS (wRd, 32, 63) << 32) | data; + break; + + default: + ARMul_UndefInstr (state, instr); + break; + } + + wC [wCon] |= WCON_MUP; + return ARMul_DONE; +} + +static int +TMCR (ARMul_State * state, ARMword instr) +{ + ARMword val; + int wCreg; + + if ((read_cp15_reg (15, 0, 1) & 3) != 3) + return ARMul_CANT; + +#ifdef DEBUG + fprintf (stderr, "tmcr\n"); +#endif + + if (BITS (0, 3) != 0) + return ARMul_CANT; + + val = state->Reg [BITS (12, 15)]; + if (BITS (12, 15) == 15) + val &= 0xfffffffc; + + wCreg = BITS (16, 19); + + switch (wCreg) + { + case wCID: + /* The wCID register is read only. */ + break; + + case wCon: + /* Writing to the MUP or CUP bits clears them. */ + wC [wCon] &= ~ (val & 0x3); + break; + + case wCSSF: + /* Only the bottom 8 bits can be written to. + The higher bits write as zero. */ + wC [wCSSF] = (val & 0xff); + wC [wCon] |= WCON_CUP; + break; + + default: + wC [wCreg] = val; + wC [wCon] |= WCON_CUP; + break; + } + + return ARMul_DONE; +} + +static int +TMCRR (ARMul_State * state, ARMword instr) +{ + ARMdword RdHi = state->Reg [BITS (16, 19)]; + ARMword RdLo = state->Reg [BITS (12, 15)]; + + if ((read_cp15_reg (15, 0, 1) & 3) != 3) + return ARMul_CANT; + +#ifdef DEBUG + fprintf (stderr, "tmcrr\n"); +#endif + + if ((BITS (16, 19) == 15) || (BITS (12, 15) == 15)) + return ARMul_CANT; + + wR [BITS (0, 3)] = (RdHi << 32) | RdLo; + + wC [wCon] |= WCON_MUP; + + return ARMul_DONE; +} + +static int +TMIA (ARMul_State * state, ARMword instr) +{ + signed long long a, b; + + if ((read_cp15_reg (15, 0, 1) & 3) != 3) + return ARMul_CANT; + +#ifdef DEBUG + fprintf (stderr, "tmia\n"); +#endif + + if ((BITS (0, 3) == 15) || (BITS (12, 15) == 15)) + { + ARMul_UndefInstr (state, instr); + return ARMul_DONE; + } + + a = state->Reg [BITS (0, 3)]; + b = state->Reg [BITS (12, 15)]; + + a = EXTEND32 (a); + b = EXTEND32 (b); + + wR [BITS (5, 8)] += a * b; + wC [wCon] |= WCON_MUP; + + return ARMul_DONE; +} + +static int +TMIAPH (ARMul_State * state, ARMword instr) +{ + signed long a, b, result; + signed long long r; + ARMword Rm = state->Reg [BITS (0, 3)]; + ARMword Rs = state->Reg [BITS (12, 15)]; + + if ((read_cp15_reg (15, 0, 1) & 3) != 3) + return ARMul_CANT; + +#ifdef DEBUG + fprintf (stderr, "tmiaph\n"); +#endif + + if (BITS (0, 3) == 15 || BITS (12, 15) == 15) + { + ARMul_UndefInstr (state, instr); + return ARMul_DONE; + } + + a = SUBSTR (Rs, ARMword, 16, 31); + b = SUBSTR (Rm, ARMword, 16, 31); + + a = EXTEND16 (a); + b = EXTEND16 (b); + + result = a * b; + + r = result; + r = EXTEND32 (r); + + wR [BITS (5, 8)] += r; + + a = SUBSTR (Rs, ARMword, 0, 15); + b = SUBSTR (Rm, ARMword, 0, 15); + + a = EXTEND16 (a); + b = EXTEND16 (b); + + result = a * b; + + r = result; + r = EXTEND32 (r); + + wR [BITS (5, 8)] += r; + wC [wCon] |= WCON_MUP; + + return ARMul_DONE; +} + +static int +TMIAxy (ARMul_State * state, ARMword instr) +{ + ARMword Rm; + ARMword Rs; + long long temp; + + if ((read_cp15_reg (15, 0, 1) & 3) != 3) + return ARMul_CANT; + +#ifdef DEBUG + fprintf (stderr, "tmiaxy\n"); +#endif + + if (BITS (0, 3) == 15 || BITS (12, 15) == 15) + { + ARMul_UndefInstr (state, instr); + return ARMul_DONE; + } + + Rm = state->Reg [BITS (0, 3)]; + if (BIT (17)) + Rm >>= 16; + else + Rm &= 0xffff; + + Rs = state->Reg [BITS (12, 15)]; + if (BIT (16)) + Rs >>= 16; + else + Rs &= 0xffff; + + if (Rm & (1 << 15)) + Rm -= 1 << 16; + + if (Rs & (1 << 15)) + Rs -= 1 << 16; + + Rm *= Rs; + temp = Rm; + + if (temp & (1 << 31)) + temp -= 1ULL << 32; + + wR [BITS (5, 8)] += temp; + wC [wCon] |= WCON_MUP; + + return ARMul_DONE; +} + +static int +TMOVMSK (ARMul_State * state, ARMword instr) +{ + ARMdword result; + int wRn; + + if ((read_cp15_reg (15, 0, 1) & 3) != 3) + return ARMul_CANT; + +#ifdef DEBUG + fprintf (stderr, "tmovmsk\n"); +#endif + + /* The CRm field must be r0. */ + if (BITS (0, 3) != 0) + return ARMul_CANT; + + wRn = BITS (16, 19); + + switch (BITS (22, 23)) + { + case Bqual: + result = ( (wRBITS (wRn, 63, 63) << 7) + | (wRBITS (wRn, 55, 55) << 6) + | (wRBITS (wRn, 47, 47) << 5) + | (wRBITS (wRn, 39, 39) << 4) + | (wRBITS (wRn, 31, 31) << 3) + | (wRBITS (wRn, 23, 23) << 2) + | (wRBITS (wRn, 15, 15) << 1) + | (wRBITS (wRn, 7, 7) << 0)); + break; + + case Hqual: + result = ( (wRBITS (wRn, 63, 63) << 3) + | (wRBITS (wRn, 47, 47) << 2) + | (wRBITS (wRn, 31, 31) << 1) + | (wRBITS (wRn, 15, 15) << 0)); + break; + + case Wqual: + result = (wRBITS (wRn, 63, 63) << 1) | wRBITS (wRn, 31, 31); + break; + + default: + ARMul_UndefInstr (state, instr); + return ARMul_DONE; + } + + state->Reg [BITS (12, 15)] = result; + + return ARMul_DONE; +} + +static int +TMRC (ARMul_State * state, ARMword instr) +{ + int reg = BITS (12, 15); + + if ((read_cp15_reg (15, 0, 1) & 3) != 3) + return ARMul_CANT; + +#ifdef DEBUG + fprintf (stderr, "tmrc\n"); +#endif + + if (BITS (0, 3) != 0) + return ARMul_CANT; + + if (reg == 15) + ARMul_UndefInstr (state, instr); + else + state->Reg [reg] = wC [BITS (16, 19)]; + + return ARMul_DONE; +} + +static int +TMRRC (ARMul_State * state, ARMword instr) +{ + if ((read_cp15_reg (15, 0, 1) & 3) != 3) + return ARMul_CANT; + +#ifdef DEBUG + fprintf (stderr, "tmrrc\n"); +#endif + + if ((BITS (16, 19) == 15) || (BITS (12, 15) == 15) || (BITS (4, 11) != 0)) + ARMul_UndefInstr (state, instr); + else + { + state->Reg [BITS (16, 19)] = wRBITS (BITS (0, 3), 32, 63); + state->Reg [BITS (12, 15)] = wRBITS (BITS (0, 3), 0, 31); + } + + return ARMul_DONE; +} + +static int +TORC (ARMul_State * state, ARMword instr) +{ + ARMword cpsr = ARMul_GetCPSR (state); + + if ((read_cp15_reg (15, 0, 1) & 3) != 3) + return ARMul_CANT; + +#ifdef DEBUG + fprintf (stderr, "torc\n"); +#endif + + /* The Rd field must be r15. */ + if (BITS (12, 15) != 15) + return ARMul_CANT; + + /* The CRn field must be r3. */ + if (BITS (16, 19) != 3) + return ARMul_CANT; + + /* The CRm field must be r0. */ + if (BITS (0, 3) != 0) + return ARMul_CANT; + + cpsr &= 0x0fffffff; + + switch (BITS (22, 23)) + { + case Bqual: + cpsr |= ( (wCBITS (wCASF, 28, 31) | wCBITS (wCASF, 24, 27) + | wCBITS (wCASF, 20, 23) | wCBITS (wCASF, 16, 19) + | wCBITS (wCASF, 12, 15) | wCBITS (wCASF, 8, 11) + | wCBITS (wCASF, 4, 7) | wCBITS (wCASF, 0, 3)) << 28); + break; + + case Hqual: + cpsr |= ( (wCBITS (wCASF, 28, 31) | wCBITS (wCASF, 20, 23) + | wCBITS (wCASF, 12, 15) | wCBITS (wCASF, 4, 7)) << 28); + break; + + case Wqual: + cpsr |= ((wCBITS (wCASF, 28, 31) | wCBITS (wCASF, 12, 15)) << 28); + break; + + default: + ARMul_UndefInstr (state, instr); + return ARMul_DONE; + } + + ARMul_SetCPSR (state, cpsr); + + return ARMul_DONE; +} + +static int +WACC (ARMul_State * state, ARMword instr) +{ + int wRn; + + if ((read_cp15_reg (15, 0, 1) & 3) != 3) + return ARMul_CANT; + +#ifdef DEBUG + fprintf (stderr, "wacc\n"); +#endif + + wRn = BITS (16, 19); + + switch (BITS (22, 23)) + { + case Bqual: + wR [BITS (12, 15)] = + wRBITS (wRn, 56, 63) + wRBITS (wRn, 48, 55) + + wRBITS (wRn, 40, 47) + wRBITS (wRn, 32, 39) + + wRBITS (wRn, 24, 31) + wRBITS (wRn, 16, 23) + + wRBITS (wRn, 8, 15) + wRBITS (wRn, 0, 7); + break; + + case Hqual: + wR [BITS (12, 15)] = + wRBITS (wRn, 48, 63) + wRBITS (wRn, 32, 47) + + wRBITS (wRn, 16, 31) + wRBITS (wRn, 0, 15); + break; + + case Wqual: + wR [BITS (12, 15)] = wRBITS (wRn, 32, 63) + wRBITS (wRn, 0, 31); + break; + + default: + ARMul_UndefInstr (state, instr); + break; + } + + wC [wCon] |= WCON_MUP; + return ARMul_DONE; +} + +static int +WADD (ARMul_State * state, ARMword instr) +{ + ARMdword r = 0; + ARMdword x; + ARMdword s; + ARMword psr = 0; + int i; + int carry; + int overflow; + int satrv[8]; + + if ((read_cp15_reg (15, 0, 1) & 3) != 3) + return ARMul_CANT; + +#ifdef DEBUG + fprintf (stderr, "wadd\n"); +#endif + + /* Add two numbers using the specified function, + leaving setting the carry bit as required. */ +#define ADDx(x, y, m, f) \ + (*f) (wRBITS (BITS (16, 19), (x), (y)) & (m), \ + wRBITS (BITS ( 0, 3), (x), (y)) & (m), \ + & carry, & overflow) + + switch (BITS (22, 23)) + { + case Bqual: + for (i = 0; i < 8; i++) + { + switch (BITS (20, 21)) + { + case NoSaturation: + s = ADDx ((i * 8), (i * 8) + 7, 0xff, AddS8); + satrv [BITIDX8 (i)] = 0; + r |= (s & 0xff) << (i * 8); + SIMD8_SET (psr, NBIT8 (s), SIMD_NBIT, i); + SIMD8_SET (psr, ZBIT8 (s), SIMD_ZBIT, i); + SIMD8_SET (psr, carry, SIMD_CBIT, i); + SIMD8_SET (psr, overflow, SIMD_VBIT, i); + break; + + case UnsignedSaturation: + s = ADDx ((i * 8), (i * 8) + 7, 0xff, AddU8); + x = IwmmxtSaturateU8 (s, satrv + BITIDX8 (i)); + r |= (x & 0xff) << (i * 8); + SIMD8_SET (psr, NBIT8 (x), SIMD_NBIT, i); + SIMD8_SET (psr, ZBIT8 (x), SIMD_ZBIT, i); + if (! satrv [BITIDX8 (i)]) + { + SIMD8_SET (psr, carry, SIMD_CBIT, i); + SIMD8_SET (psr, overflow, SIMD_VBIT, i); + } + break; + + case SignedSaturation: + s = ADDx ((i * 8), (i * 8) + 7, 0xff, AddS8); + x = IwmmxtSaturateS8 (s, satrv + BITIDX8 (i)); + r |= (x & 0xff) << (i * 8); + SIMD8_SET (psr, NBIT8 (x), SIMD_NBIT, i); + SIMD8_SET (psr, ZBIT8 (x), SIMD_ZBIT, i); + if (! satrv [BITIDX8 (i)]) + { + SIMD8_SET (psr, carry, SIMD_CBIT, i); + SIMD8_SET (psr, overflow, SIMD_VBIT, i); + } + break; + + default: + ARMul_UndefInstr (state, instr); + return ARMul_DONE; + } + } + break; + + case Hqual: + satrv[0] = satrv[2] = satrv[4] = satrv[6] = 0; + + for (i = 0; i < 4; i++) + { + switch (BITS (20, 21)) + { + case NoSaturation: + s = ADDx ((i * 16), (i * 16) + 15, 0xffff, AddS16); + satrv [BITIDX16 (i)] = 0; + r |= (s & 0xffff) << (i * 16); + SIMD16_SET (psr, NBIT16 (s), SIMD_NBIT, i); + SIMD16_SET (psr, ZBIT16 (s), SIMD_ZBIT, i); + SIMD16_SET (psr, carry, SIMD_CBIT, i); + SIMD16_SET (psr, overflow, SIMD_VBIT, i); + break; + + case UnsignedSaturation: + s = ADDx ((i * 16), (i * 16) + 15, 0xffff, AddU16); + x = IwmmxtSaturateU16 (s, satrv + BITIDX16 (i)); + r |= (x & 0xffff) << (i * 16); + SIMD16_SET (psr, NBIT16 (x), SIMD_NBIT, i); + SIMD16_SET (psr, ZBIT16 (x), SIMD_ZBIT, i); + if (! satrv [BITIDX16 (i)]) + { + SIMD16_SET (psr, carry, SIMD_CBIT, i); + SIMD16_SET (psr, overflow, SIMD_VBIT, i); + } + break; + + case SignedSaturation: + s = ADDx ((i * 16), (i * 16) + 15, 0xffff, AddS16); + x = IwmmxtSaturateS16 (s, satrv + BITIDX16 (i)); + r |= (x & 0xffff) << (i * 16); + SIMD16_SET (psr, NBIT16 (x), SIMD_NBIT, i); + SIMD16_SET (psr, ZBIT16 (x), SIMD_ZBIT, i); + if (! satrv [BITIDX16 (i)]) + { + SIMD16_SET (psr, carry, SIMD_CBIT, i); + SIMD16_SET (psr, overflow, SIMD_VBIT, i); + } + break; + + default: + ARMul_UndefInstr (state, instr); + return ARMul_DONE; + } + } + break; + + case Wqual: + satrv[0] = satrv[1] = satrv[2] = satrv[4] = satrv[5] = satrv[6] = 0; + + for (i = 0; i < 2; i++) + { + switch (BITS (20, 21)) + { + case NoSaturation: + s = ADDx ((i * 32), (i * 32) + 31, 0xffffffff, AddS32); + satrv [BITIDX32 (i)] = 0; + r |= (s & 0xffffffff) << (i * 32); + SIMD32_SET (psr, NBIT32 (s), SIMD_NBIT, i); + SIMD32_SET (psr, ZBIT32 (s), SIMD_ZBIT, i); + SIMD32_SET (psr, carry, SIMD_CBIT, i); + SIMD32_SET (psr, overflow, SIMD_VBIT, i); + break; + + case UnsignedSaturation: + s = ADDx ((i * 32), (i * 32) + 31, 0xffffffff, AddU32); + x = IwmmxtSaturateU32 (s, satrv + BITIDX32 (i)); + r |= (x & 0xffffffff) << (i * 32); + SIMD32_SET (psr, NBIT32 (x), SIMD_NBIT, i); + SIMD32_SET (psr, ZBIT32 (x), SIMD_ZBIT, i); + if (! satrv [BITIDX32 (i)]) + { + SIMD32_SET (psr, carry, SIMD_CBIT, i); + SIMD32_SET (psr, overflow, SIMD_VBIT, i); + } + break; + + case SignedSaturation: + s = ADDx ((i * 32), (i * 32) + 31, 0xffffffff, AddS32); + x = IwmmxtSaturateS32 (s, satrv + BITIDX32 (i)); + r |= (x & 0xffffffff) << (i * 32); + SIMD32_SET (psr, NBIT32 (x), SIMD_NBIT, i); + SIMD32_SET (psr, ZBIT32 (x), SIMD_ZBIT, i); + if (! satrv [BITIDX32 (i)]) + { + SIMD32_SET (psr, carry, SIMD_CBIT, i); + SIMD32_SET (psr, overflow, SIMD_VBIT, i); + } + break; + + default: + ARMul_UndefInstr (state, instr); + return ARMul_DONE; + } + } + break; + + default: + ARMul_UndefInstr (state, instr); + return ARMul_DONE; + } + + wC [wCASF] = psr; + wR [BITS (12, 15)] = r; + wC [wCon] |= (WCON_MUP | WCON_CUP); + + SET_wCSSFvec (satrv); + +#undef ADDx + + return ARMul_DONE; +} + +static int +WALIGNI (ARMword instr) +{ + int shift = BITS (20, 22) * 8; + + if ((read_cp15_reg (15, 0, 1) & 3) != 3) + return ARMul_CANT; + +#ifdef DEBUG + fprintf (stderr, "waligni\n"); +#endif + + if (shift) + wR [BITS (12, 15)] = + wRBITS (BITS (16, 19), shift, 63) + | (wRBITS (BITS (0, 3), 0, shift) << ((64 - shift))); + else + wR [BITS (12, 15)] = wR [BITS (16, 19)]; + + wC [wCon] |= WCON_MUP; + return ARMul_DONE; +} + +static int +WALIGNR (ARMul_State * state, ARMword instr) +{ + int shift = (wC [BITS (20, 21) + 8] & 0x7) * 8; + + if ((read_cp15_reg (15, 0, 1) & 3) != 3) + return ARMul_CANT; + +#ifdef DEBUG + fprintf (stderr, "walignr\n"); +#endif + + if (shift) + wR [BITS (12, 15)] = + wRBITS (BITS (16, 19), shift, 63) + | (wRBITS (BITS (0, 3), 0, shift) << ((64 - shift))); + else + wR [BITS (12, 15)] = wR [BITS (16, 19)]; + + wC [wCon] |= WCON_MUP; + return ARMul_DONE; +} + +static int +WAND (ARMword instr) +{ + ARMdword result; + ARMword psr = 0; + + if ((read_cp15_reg (15, 0, 1) & 3) != 3) + return ARMul_CANT; + +#ifdef DEBUG + fprintf (stderr, "wand\n"); +#endif + + result = wR [BITS (16, 19)] & wR [BITS (0, 3)]; + wR [BITS (12, 15)] = result; + + SIMD64_SET (psr, (result == 0), SIMD_ZBIT); + SIMD64_SET (psr, (result & (1ULL << 63)), SIMD_NBIT); + + wC [wCASF] = psr; + wC [wCon] |= (WCON_CUP | WCON_MUP); + + return ARMul_DONE; +} + +static int +WANDN (ARMword instr) +{ + ARMdword result; + ARMword psr = 0; + + if ((read_cp15_reg (15, 0, 1) & 3) != 3) + return ARMul_CANT; + +#ifdef DEBUG + fprintf (stderr, "wandn\n"); +#endif + + result = wR [BITS (16, 19)] & ~ wR [BITS (0, 3)]; + wR [BITS (12, 15)] = result; + + SIMD64_SET (psr, (result == 0), SIMD_ZBIT); + SIMD64_SET (psr, (result & (1ULL << 63)), SIMD_NBIT); + + wC [wCASF] = psr; + wC [wCon] |= (WCON_CUP | WCON_MUP); + + return ARMul_DONE; +} + +static int +WAVG2 (ARMword instr) +{ + ARMdword r = 0; + ARMword psr = 0; + ARMdword s; + int i; + int round = BIT (20) ? 1 : 0; + + if ((read_cp15_reg (15, 0, 1) & 3) != 3) + return ARMul_CANT; + +#ifdef DEBUG + fprintf (stderr, "wavg2\n"); +#endif + +#define AVG2x(x, y, m) (((wRBITS (BITS (16, 19), (x), (y)) & (m)) \ + + (wRBITS (BITS ( 0, 3), (x), (y)) & (m)) \ + + round) / 2) + + if (BIT (22)) + { + for (i = 0; i < 4; i++) + { + s = AVG2x ((i * 16), (i * 16) + 15, 0xffff) & 0xffff; + SIMD16_SET (psr, ZBIT16 (s), SIMD_ZBIT, i); + r |= s << (i * 16); + } + } + else + { + for (i = 0; i < 8; i++) + { + s = AVG2x ((i * 8), (i * 8) + 7, 0xff) & 0xff; + SIMD8_SET (psr, ZBIT8 (s), SIMD_ZBIT, i); + r |= s << (i * 8); + } + } + + wR [BITS (12, 15)] = r; + wC [wCASF] = psr; + wC [wCon] |= (WCON_CUP | WCON_MUP); + + return ARMul_DONE; +} + +static int +WCMPEQ (ARMul_State * state, ARMword instr) +{ + ARMdword r = 0; + ARMword psr = 0; + ARMdword s; + int i; + + if ((read_cp15_reg (15, 0, 1) & 3) != 3) + return ARMul_CANT; + +#ifdef DEBUG + fprintf (stderr, "wcmpeq\n"); +#endif + + switch (BITS (22, 23)) + { + case Bqual: + for (i = 0; i < 8; i++) + { + s = wRBYTE (BITS (16, 19), i) == wRBYTE (BITS (0, 3), i) ? 0xff : 0; + r |= s << (i * 8); + SIMD8_SET (psr, NBIT8 (s), SIMD_NBIT, i); + SIMD8_SET (psr, ZBIT8 (s), SIMD_ZBIT, i); + } + break; + + case Hqual: + for (i = 0; i < 4; i++) + { + s = wRHALF (BITS (16, 19), i) == wRHALF (BITS (0, 3), i) ? 0xffff : 0; + r |= s << (i * 16); + SIMD16_SET (psr, NBIT16 (s), SIMD_NBIT, i); + SIMD16_SET (psr, ZBIT16 (s), SIMD_ZBIT, i); + } + break; + + case Wqual: + for (i = 0; i < 2; i++) + { + s = wRWORD (BITS (16, 19), i) == wRWORD (BITS (0, 3), i) ? 0xffffffff : 0; + r |= s << (i * 32); + SIMD32_SET (psr, NBIT32 (s), SIMD_NBIT, i); + SIMD32_SET (psr, ZBIT32 (s), SIMD_ZBIT, i); + } + break; + + default: + ARMul_UndefInstr (state, instr); + return ARMul_DONE; + } + + wC [wCASF] = psr; + wR [BITS (12, 15)] = r; + wC [wCon] |= (WCON_CUP | WCON_MUP); + + return ARMul_DONE; +} + +static int +WCMPGT (ARMul_State * state, ARMword instr) +{ + ARMdword r = 0; + ARMword psr = 0; + ARMdword s; + int i; + + if ((read_cp15_reg (15, 0, 1) & 3) != 3) + return ARMul_CANT; + +#ifdef DEBUG + fprintf (stderr, "wcmpgt\n"); +#endif + + switch (BITS (22, 23)) + { + case Bqual: + if (BIT (21)) + { + /* Use a signed comparison. */ + for (i = 0; i < 8; i++) + { + signed char a, b; + + a = wRBYTE (BITS (16, 19), i); + b = wRBYTE (BITS (0, 3), i); + + s = (a > b) ? 0xff : 0; + r |= s << (i * 8); + SIMD8_SET (psr, NBIT8 (s), SIMD_NBIT, i); + SIMD8_SET (psr, ZBIT8 (s), SIMD_ZBIT, i); + } + } + else + { + for (i = 0; i < 8; i++) + { + s = (wRBYTE (BITS (16, 19), i) > wRBYTE (BITS (0, 3), i)) + ? 0xff : 0; + r |= s << (i * 8); + SIMD8_SET (psr, NBIT8 (s), SIMD_NBIT, i); + SIMD8_SET (psr, ZBIT8 (s), SIMD_ZBIT, i); + } + } + break; + + case Hqual: + if (BIT (21)) + { + for (i = 0; i < 4; i++) + { + signed int a, b; + + a = wRHALF (BITS (16, 19), i); + a = EXTEND16 (a); + + b = wRHALF (BITS (0, 3), i); + b = EXTEND16 (b); + + s = (a > b) ? 0xffff : 0; + r |= s << (i * 16); + SIMD16_SET (psr, NBIT16 (s), SIMD_NBIT, i); + SIMD16_SET (psr, ZBIT16 (s), SIMD_ZBIT, i); + } + } + else + { + for (i = 0; i < 4; i++) + { + s = (wRHALF (BITS (16, 19), i) > wRHALF (BITS (0, 3), i)) + ? 0xffff : 0; + r |= s << (i * 16); + SIMD16_SET (psr, NBIT16 (s), SIMD_NBIT, i); + SIMD16_SET (psr, ZBIT16 (s), SIMD_ZBIT, i); + } + } + break; + + case Wqual: + if (BIT (21)) + { + for (i = 0; i < 2; i++) + { + signed long a, b; + + a = wRWORD (BITS (16, 19), i); + b = wRWORD (BITS (0, 3), i); + + s = (a > b) ? 0xffffffff : 0; + r |= s << (i * 32); + SIMD32_SET (psr, NBIT32 (s), SIMD_NBIT, i); + SIMD32_SET (psr, ZBIT32 (s), SIMD_ZBIT, i); + } + } + else + { + for (i = 0; i < 2; i++) + { + s = (wRWORD (BITS (16, 19), i) > wRWORD (BITS (0, 3), i)) + ? 0xffffffff : 0; + r |= s << (i * 32); + SIMD32_SET (psr, NBIT32 (s), SIMD_NBIT, i); + SIMD32_SET (psr, ZBIT32 (s), SIMD_ZBIT, i); + } + } + break; + + default: + ARMul_UndefInstr (state, instr); + return ARMul_DONE; + } + + wC [wCASF] = psr; + wR [BITS (12, 15)] = r; + wC [wCon] |= (WCON_CUP | WCON_MUP); + + return ARMul_DONE; +} + +static ARMword +Compute_Iwmmxt_Address (ARMul_State * state, ARMword instr, int * pFailed) +{ + ARMword Rn; + ARMword addr; + ARMword offset; + ARMword multiplier; + + * pFailed = 0; + Rn = BITS (16, 19); + addr = state->Reg [Rn]; + offset = BITS (0, 7); + multiplier = BIT (8) ? 4 : 1; + + if (BIT (24)) /* P */ + { + /* Pre Indexed Addressing. */ + if (BIT (23)) + addr += offset * multiplier; + else + addr -= offset * multiplier; + + /* Immediate Pre-Indexed. */ + if (BIT (21)) /* W */ + { + if (Rn == 15) + { + /* Writeback into R15 is UNPREDICTABLE. */ +#ifdef DEBUG + fprintf (stderr, "iWMMXt: writeback into r15\n"); +#endif + * pFailed = 1; + } + else + state->Reg [Rn] = addr; + } + } + else + { + /* Post Indexed Addressing. */ + if (BIT (21)) /* W */ + { + /* Handle the write back of the final address. */ + if (Rn == 15) + { + /* Writeback into R15 is UNPREDICTABLE. */ +#ifdef DEBUG + fprintf (stderr, "iWMMXt: writeback into r15\n"); +#endif + * pFailed = 1; + } + else + { + ARMword increment; + + if (BIT (23)) + increment = offset * multiplier; + else + increment = - (offset * multiplier); + + state->Reg [Rn] = addr + increment; + } + } + else + { + /* P == 0, W == 0, U == 0 is UNPREDICTABLE. */ + if (BIT (23) == 0) + { +#ifdef DEBUG + fprintf (stderr, "iWMMXt: undefined addressing mode\n"); +#endif + * pFailed = 1; + } + } + } + + return addr; +} + +static ARMdword +Iwmmxt_Load_Double_Word (ARMul_State * state, ARMword address) +{ + ARMdword value; + + /* The address must be aligned on a 8 byte boundary. */ + if (address & 0x7) + { + fprintf (stderr, "iWMMXt: At addr 0x%x: Unaligned double word load from 0x%x\n", + (state->Reg[15] - 8) & ~0x3, address); +#ifdef DEBUG +#endif + /* No need to check for alignment traps. An unaligned + double word load with alignment trapping disabled is + UNPREDICTABLE. */ + ARMul_Abort (state, ARMul_DataAbortV); + } + + /* Load the words. */ + if (! state->bigendSig) + { + value = ARMul_LoadWordN (state, address + 4); + value <<= 32; + value |= ARMul_LoadWordN (state, address); + } + else + { + value = ARMul_LoadWordN (state, address); + value <<= 32; + value |= ARMul_LoadWordN (state, address + 4); + } + + /* Check for data aborts. */ + if (state->Aborted) + ARMul_Abort (state, ARMul_DataAbortV); + else + ARMul_Icycles (state, 2, 0L); + + return value; +} + +static ARMword +Iwmmxt_Load_Word (ARMul_State * state, ARMword address) +{ + ARMword value; + + /* Check for a misaligned address. */ + if (address & 3) + { + if ((read_cp15_reg (1, 0, 0) & ARMul_CP15_R1_ALIGN)) + ARMul_Abort (state, ARMul_DataAbortV); + else + address &= ~ 3; + } + + value = ARMul_LoadWordN (state, address); + + if (state->Aborted) + ARMul_Abort (state, ARMul_DataAbortV); + else + ARMul_Icycles (state, 1, 0L); + + return value; +} + +static ARMword +Iwmmxt_Load_Half_Word (ARMul_State * state, ARMword address) +{ + ARMword value; + + /* Check for a misaligned address. */ + if (address & 1) + { + if ((read_cp15_reg (1, 0, 0) & ARMul_CP15_R1_ALIGN)) + ARMul_Abort (state, ARMul_DataAbortV); + else + address &= ~ 1; + } + + value = ARMul_LoadHalfWord (state, address); + + if (state->Aborted) + ARMul_Abort (state, ARMul_DataAbortV); + else + ARMul_Icycles (state, 1, 0L); + + return value; +} + +static ARMword +Iwmmxt_Load_Byte (ARMul_State * state, ARMword address) +{ + ARMword value; + + value = ARMul_LoadByte (state, address); + + if (state->Aborted) + ARMul_Abort (state, ARMul_DataAbortV); + else + ARMul_Icycles (state, 1, 0L); + + return value; +} + +static void +Iwmmxt_Store_Double_Word (ARMul_State * state, ARMword address, ARMdword value) +{ + /* The address must be aligned on a 8 byte boundary. */ + if (address & 0x7) + { + fprintf (stderr, "iWMMXt: At addr 0x%x: Unaligned double word store to 0x%x\n", + (state->Reg[15] - 8) & ~0x3, address); +#ifdef DEBUG +#endif + /* No need to check for alignment traps. An unaligned + double word store with alignment trapping disabled is + UNPREDICTABLE. */ + ARMul_Abort (state, ARMul_DataAbortV); + } + + /* Store the words. */ + if (! state->bigendSig) + { + ARMul_StoreWordN (state, address, value); + ARMul_StoreWordN (state, address + 4, value >> 32); + } + else + { + ARMul_StoreWordN (state, address + 4, value); + ARMul_StoreWordN (state, address, value >> 32); + } + + /* Check for data aborts. */ + if (state->Aborted) + ARMul_Abort (state, ARMul_DataAbortV); + else + ARMul_Icycles (state, 2, 0L); +} + +static void +Iwmmxt_Store_Word (ARMul_State * state, ARMword address, ARMword value) +{ + /* Check for a misaligned address. */ + if (address & 3) + { + if ((read_cp15_reg (1, 0, 0) & ARMul_CP15_R1_ALIGN)) + ARMul_Abort (state, ARMul_DataAbortV); + else + address &= ~ 3; + } + + ARMul_StoreWordN (state, address, value); + + if (state->Aborted) + ARMul_Abort (state, ARMul_DataAbortV); +} + +static void +Iwmmxt_Store_Half_Word (ARMul_State * state, ARMword address, ARMword value) +{ + /* Check for a misaligned address. */ + if (address & 1) + { + if ((read_cp15_reg (1, 0, 0) & ARMul_CP15_R1_ALIGN)) + ARMul_Abort (state, ARMul_DataAbortV); + else + address &= ~ 1; + } + + ARMul_StoreHalfWord (state, address, value); + + if (state->Aborted) + ARMul_Abort (state, ARMul_DataAbortV); +} + +static void +Iwmmxt_Store_Byte (ARMul_State * state, ARMword address, ARMword value) +{ + ARMul_StoreByte (state, address, value); + + if (state->Aborted) + ARMul_Abort (state, ARMul_DataAbortV); +} + +static int +WLDR (ARMul_State * state, ARMword instr) +{ + ARMword address; + int failed; + + if ((read_cp15_reg (15, 0, 1) & 3) != 3) + return ARMul_CANT; + +#ifdef DEBUG + fprintf (stderr, "wldr\n"); +#endif + + address = Compute_Iwmmxt_Address (state, instr, & failed); + if (failed) + return ARMul_CANT; + + if (BITS (28, 31) == 0xf) + { + /* WLDRW wCx */ + wC [BITS (12, 15)] = Iwmmxt_Load_Word (state, address); + } + else if (BIT (8) == 0) + { + if (BIT (22) == 0) + /* WLDRB */ + wR [BITS (12, 15)] = Iwmmxt_Load_Byte (state, address); + else + /* WLDRH */ + wR [BITS (12, 15)] = Iwmmxt_Load_Half_Word (state, address); + } + else + { + if (BIT (22) == 0) + /* WLDRW wRd */ + wR [BITS (12, 15)] = Iwmmxt_Load_Word (state, address); + else + /* WLDRD */ + wR [BITS (12, 15)] = Iwmmxt_Load_Double_Word (state, address); + } + + wC [wCon] |= WCON_MUP; + + return ARMul_DONE; +} + +static int +WMAC (ARMword instr) +{ + int i; + ARMdword t = 0; + ARMword a, b; + + if ((read_cp15_reg (15, 0, 1) & 3) != 3) + return ARMul_CANT; + +#ifdef DEBUG + fprintf (stderr, "wmac\n"); +#endif + + for (i = 0; i < 4; i++) + { + if (BIT (21)) + { + /* Signed. */ + signed long s; + + a = wRHALF (BITS (16, 19), i); + a = EXTEND16 (a); + + b = wRHALF (BITS (0, 3), i); + b = EXTEND16 (b); + + s = (signed long) a * (signed long) b; + + (signed long long) t += s; + } + else + { + /* Unsigned. */ + a = wRHALF (BITS (16, 19), i); + b = wRHALF (BITS ( 0, 3), i); + + t += a * b; + } + } + + if (BIT (20)) + wR [BITS (12, 15)] = 0; + + if (BIT (21)) /* Signed. */ + (signed long long) wR[BITS (12, 15)] += (signed long long) t; + else + wR [BITS (12, 15)] += t; + + wC [wCon] |= WCON_MUP; + + return ARMul_DONE; +} + +static int +WMADD (ARMword instr) +{ + ARMdword r = 0; + int i; + + if ((read_cp15_reg (15, 0, 1) & 3) != 3) + return ARMul_CANT; + +#ifdef DEBUG + fprintf (stderr, "wmadd\n"); +#endif + + for (i = 0; i < 2; i++) + { + ARMdword s1, s2; + + if (BIT (21)) /* Signed. */ + { + signed long a, b; + + a = wRHALF (BITS (16, 19), i * 2); + a = EXTEND16 (a); + + b = wRHALF (BITS (0, 3), i * 2); + b = EXTEND16 (b); + + (signed long) s1 = a * b; + + a = wRHALF (BITS (16, 19), i * 2 + 1); + a = EXTEND16 (a); + + b = wRHALF (BITS (0, 3), i * 2 + 1); + b = EXTEND16 (b); + + (signed long) s2 = a * b; + } + else /* Unsigned. */ + { + unsigned long a, b; + + a = wRHALF (BITS (16, 19), i * 2); + b = wRHALF (BITS ( 0, 3), i * 2); + + (unsigned long) s1 = a * b; + + a = wRHALF (BITS (16, 19), i * 2 + 1); + b = wRHALF (BITS ( 0, 3), i * 2 + 1); + + (signed long) s2 = a * b; + } + + r |= (ARMdword) ((s1 + s2) & 0xffffffff) << (i ? 32 : 0); + } + + wR [BITS (12, 15)] = r; + wC [wCon] |= WCON_MUP; + + return ARMul_DONE; +} + +static int +WMAX (ARMul_State * state, ARMword instr) +{ + ARMdword r = 0; + ARMdword s; + int i; + + if ((read_cp15_reg (15, 0, 1) & 3) != 3) + return ARMul_CANT; + +#ifdef DEBUG + fprintf (stderr, "wmax\n"); +#endif + + switch (BITS (22, 23)) + { + case Bqual: + for (i = 0; i < 8; i++) + if (BIT (21)) /* Signed. */ + { + int a, b; + + a = wRBYTE (BITS (16, 19), i); + a = EXTEND8 (a); + + b = wRBYTE (BITS (0, 3), i); + b = EXTEND8 (b); + + if (a > b) + s = a; + else + s = b; + + r |= (s & 0xff) << (i * 8); + } + else /* Unsigned. */ + { + unsigned int a, b; + + a = wRBYTE (BITS (16, 19), i); + b = wRBYTE (BITS (0, 3), i); + + if (a > b) + s = a; + else + s = b; + + r |= (s & 0xff) << (i * 8); + } + break; + + case Hqual: + for (i = 0; i < 4; i++) + if (BIT (21)) /* Signed. */ + { + int a, b; + + a = wRHALF (BITS (16, 19), i); + a = EXTEND16 (a); + + b = wRHALF (BITS (0, 3), i); + b = EXTEND16 (b); + + if (a > b) + s = a; + else + s = b; + + r |= (s & 0xffff) << (i * 16); + } + else /* Unsigned. */ + { + unsigned int a, b; + + a = wRHALF (BITS (16, 19), i); + b = wRHALF (BITS (0, 3), i); + + if (a > b) + s = a; + else + s = b; + + r |= (s & 0xffff) << (i * 16); + } + break; + + case Wqual: + for (i = 0; i < 2; i++) + if (BIT (21)) /* Signed. */ + { + int a, b; + + a = wRWORD (BITS (16, 19), i); + b = wRWORD (BITS (0, 3), i); + + if (a > b) + s = a; + else + s = b; + + r |= (s & 0xffffffff) << (i * 32); + } + else + { + unsigned int a, b; + + a = wRWORD (BITS (16, 19), i); + b = wRWORD (BITS (0, 3), i); + + if (a > b) + s = a; + else + s = b; + + r |= (s & 0xffffffff) << (i * 32); + } + break; + + default: + ARMul_UndefInstr (state, instr); + return ARMul_DONE; + } + + wR [BITS (12, 15)] = r; + wC [wCon] |= WCON_MUP; + + return ARMul_DONE; +} + +static int +WMIN (ARMul_State * state, ARMword instr) +{ + ARMdword r = 0; + ARMdword s; + int i; + + if ((read_cp15_reg (15, 0, 1) & 3) != 3) + return ARMul_CANT; + +#ifdef DEBUG + fprintf (stderr, "wmin\n"); +#endif + + switch (BITS (22, 23)) + { + case Bqual: + for (i = 0; i < 8; i++) + if (BIT (21)) /* Signed. */ + { + int a, b; + + a = wRBYTE (BITS (16, 19), i); + a = EXTEND8 (a); + + b = wRBYTE (BITS (0, 3), i); + b = EXTEND8 (b); + + if (a < b) + s = a; + else + s = b; + + r |= (s & 0xff) << (i * 8); + } + else /* Unsigned. */ + { + unsigned int a, b; + + a = wRBYTE (BITS (16, 19), i); + b = wRBYTE (BITS (0, 3), i); + + if (a < b) + s = a; + else + s = b; + + r |= (s & 0xff) << (i * 8); + } + break; + + case Hqual: + for (i = 0; i < 4; i++) + if (BIT (21)) /* Signed. */ + { + int a, b; + + a = wRHALF (BITS (16, 19), i); + a = EXTEND16 (a); + + b = wRHALF (BITS (0, 3), i); + b = EXTEND16 (b); + + if (a < b) + s = a; + else + s = b; + + r |= (s & 0xffff) << (i * 16); + } + else + { + /* Unsigned. */ + unsigned int a, b; + + a = wRHALF (BITS (16, 19), i); + b = wRHALF (BITS ( 0, 3), i); + + if (a < b) + s = a; + else + s = b; + + r |= (s & 0xffff) << (i * 16); + } + break; + + case Wqual: + for (i = 0; i < 2; i++) + if (BIT (21)) /* Signed. */ + { + int a, b; + + a = wRWORD (BITS (16, 19), i); + b = wRWORD (BITS ( 0, 3), i); + + if (a < b) + s = a; + else + s = b; + + r |= (s & 0xffffffff) << (i * 32); + } + else + { + unsigned int a, b; + + a = wRWORD (BITS (16, 19), i); + b = wRWORD (BITS (0, 3), i); + + if (a < b) + s = a; + else + s = b; + + r |= (s & 0xffffffff) << (i * 32); + } + break; + + default: + ARMul_UndefInstr (state, instr); + return ARMul_DONE; + } + + wR [BITS (12, 15)] = r; + wC [wCon] |= WCON_MUP; + + return ARMul_DONE; +} + +static int +WMUL (ARMword instr) +{ + ARMdword r = 0; + ARMdword s; + int i; + + if ((read_cp15_reg (15, 0, 1) & 3) != 3) + return ARMul_CANT; + +#ifdef DEBUG + fprintf (stderr, "wmul\n"); +#endif + + for (i = 0; i < 4; i++) + if (BIT (21)) /* Signed. */ + { + long a, b; + + a = wRHALF (BITS (16, 19), i); + a = EXTEND16 (a); + + b = wRHALF (BITS (0, 3), i); + b = EXTEND16 (b); + + s = a * b; + + if (BIT (20)) + r |= ((s >> 16) & 0xffff) << (i * 16); + else + r |= (s & 0xffff) << (i * 16); + } + else /* Unsigned. */ + { + unsigned long a, b; + + a = wRHALF (BITS (16, 19), i); + b = wRHALF (BITS (0, 3), i); + + s = a * b; + + if (BIT (20)) + r |= ((s >> 16) & 0xffff) << (i * 16); + else + r |= (s & 0xffff) << (i * 16); + } + + wR [BITS (12, 15)] = r; + wC [wCon] |= WCON_MUP; + + return ARMul_DONE; +} + +static int +WOR (ARMword instr) +{ + ARMword psr = 0; + ARMdword result; + + if ((read_cp15_reg (15, 0, 1) & 3) != 3) + return ARMul_CANT; + +#ifdef DEBUG + fprintf (stderr, "wor\n"); +#endif + + result = wR [BITS (16, 19)] | wR [BITS (0, 3)]; + wR [BITS (12, 15)] = result; + + SIMD64_SET (psr, (result == 0), SIMD_ZBIT); + SIMD64_SET (psr, (result & (1ULL << 63)), SIMD_NBIT); + + wC [wCASF] = psr; + wC [wCon] |= (WCON_CUP | WCON_MUP); + + return ARMul_DONE; +} + +static int +WPACK (ARMul_State * state, ARMword instr) +{ + ARMdword r = 0; + ARMword psr = 0; + ARMdword x; + ARMdword s; + int i; + int satrv[8]; + + if ((read_cp15_reg (15, 0, 1) & 3) != 3) + return ARMul_CANT; + +#ifdef DEBUG + fprintf (stderr, "wpack\n"); +#endif + + switch (BITS (22, 23)) + { + case Hqual: + for (i = 0; i < 8; i++) + { + x = wRHALF (i < 4 ? BITS (16, 19) : BITS (0, 3), i & 3); + + switch (BITS (20, 21)) + { + case UnsignedSaturation: + s = IwmmxtSaturateU8 (x, satrv + BITIDX8 (i)); + break; + + case SignedSaturation: + s = IwmmxtSaturateS8 (x, satrv + BITIDX8 (i)); + break; + + default: + ARMul_UndefInstr (state, instr); + return ARMul_DONE; + } + + r |= (s & 0xff) << (i * 8); + SIMD8_SET (psr, NBIT8 (s), SIMD_NBIT, i); + SIMD8_SET (psr, ZBIT8 (s), SIMD_ZBIT, i); + } + break; + + case Wqual: + satrv[0] = satrv[2] = satrv[4] = satrv[6] = 0; + + for (i = 0; i < 4; i++) + { + x = wRWORD (i < 2 ? BITS (16, 19) : BITS (0, 3), i & 1); + + switch (BITS (20, 21)) + { + case UnsignedSaturation: + s = IwmmxtSaturateU16 (x, satrv + BITIDX16 (i)); + break; + + case SignedSaturation: + s = IwmmxtSaturateS16 (x, satrv + BITIDX16 (i)); + break; + + default: + ARMul_UndefInstr (state, instr); + return ARMul_DONE; + } + + r |= (s & 0xffff) << (i * 16); + SIMD16_SET (psr, NBIT16 (s), SIMD_NBIT, i); + SIMD16_SET (psr, ZBIT16 (s), SIMD_ZBIT, i); + } + break; + + case Dqual: + satrv[0] = satrv[1] = satrv[2] = satrv[4] = satrv[5] = satrv[6] = 0; + + for (i = 0; i < 2; i++) + { + x = wR [i ? BITS (0, 3) : BITS (16, 19)]; + + switch (BITS (20, 21)) + { + case UnsignedSaturation: + s = IwmmxtSaturateU32 (x, satrv + BITIDX32 (i)); + break; + + case SignedSaturation: + s = IwmmxtSaturateS32 (x, satrv + BITIDX32 (i)); + break; + + default: + ARMul_UndefInstr (state, instr); + return ARMul_DONE; + } + + r |= (s & 0xffffffff) << (i * 32); + SIMD32_SET (psr, NBIT32 (s), SIMD_NBIT, i); + SIMD32_SET (psr, ZBIT32 (s), SIMD_ZBIT, i); + } + break; + + default: + ARMul_UndefInstr (state, instr); + return ARMul_DONE; + } + + wC [wCASF] = psr; + wR [BITS (12, 15)] = r; + SET_wCSSFvec (satrv); + wC [wCon] |= (WCON_CUP | WCON_MUP); + + return ARMul_DONE; +} + +static int +WROR (ARMul_State * state, ARMword instr) +{ + ARMdword r = 0; + ARMdword s; + ARMword psr = 0; + int i; + int shift; + + if ((read_cp15_reg (15, 0, 1) & 3) != 3) + return ARMul_CANT; + +#ifdef DEBUG + fprintf (stderr, "wror\n"); +#endif + + DECODE_G_BIT (state, instr, shift); + + switch (BITS (22, 23)) + { + case Hqual: + shift &= 0xf; + for (i = 0; i < 4; i++) + { + s = ((wRHALF (BITS (16, 19), i) & 0xffff) << (16 - shift)) + | ((wRHALF (BITS (16, 19), i) & 0xffff) >> shift); + r |= (s & 0xffff) << (i * 16); + SIMD16_SET (psr, NBIT16 (s), SIMD_NBIT, i); + SIMD16_SET (psr, ZBIT16 (s), SIMD_ZBIT, i); + } + break; + + case Wqual: + shift &= 0x1f; + for (i = 0; i < 2; i++) + { + s = ((wRWORD (BITS (16, 19), i) & 0xffffffff) << (32 - shift)) + | ((wRWORD (BITS (16, 19), i) & 0xffffffff) >> shift); + r |= (s & 0xffffffff) << (i * 32); + SIMD32_SET (psr, NBIT32 (s), SIMD_NBIT, i); + SIMD32_SET (psr, ZBIT32 (s), SIMD_ZBIT, i); + } + break; + + case Dqual: + shift &= 0x3f; + r = (wR [BITS (16, 19)] >> shift) + | (wR [BITS (16, 19)] << (64 - shift)); + + SIMD64_SET (psr, NBIT64 (r), SIMD_NBIT); + SIMD64_SET (psr, ZBIT64 (r), SIMD_ZBIT); + break; + + default: + ARMul_UndefInstr (state, instr); + return ARMul_DONE; + } + + wC [wCASF] = psr; + wR [BITS (12, 15)] = r; + wC [wCon] |= (WCON_CUP | WCON_MUP); + + return ARMul_DONE; +} + +static int +WSAD (ARMword instr) +{ + ARMdword r; + int s; + int i; + + if ((read_cp15_reg (15, 0, 1) & 3) != 3) + return ARMul_CANT; + +#ifdef DEBUG + fprintf (stderr, "wsad\n"); +#endif + + /* Z bit. */ + r = BIT (20) ? 0 : (wR [BITS (12, 15)] & 0xffffffff); + + if (BIT (22)) + /* Half. */ + for (i = 0; i < 4; i++) + { + s = (wRHALF (BITS (16, 19), i) - wRHALF (BITS (0, 3), i)); + r += abs (s); + } + else + /* Byte. */ + for (i = 0; i < 8; i++) + { + s = (wRBYTE (BITS (16, 19), i) - wRBYTE (BITS (0, 3), i)); + r += abs (s); + } + + wR [BITS (12, 15)] = r; + wC [wCon] |= WCON_MUP; + + return ARMul_DONE; +} + +static int +WSHUFH (ARMword instr) +{ + ARMdword r = 0; + ARMword psr = 0; + ARMdword s; + int i; + int imm8; + + if ((read_cp15_reg (15, 0, 1) & 3) != 3) + return ARMul_CANT; + +#ifdef DEBUG + fprintf (stderr, "wshufh\n"); +#endif + + imm8 = (BITS (20, 23) << 4) | BITS (0, 3); + + for (i = 0; i < 4; i++) + { + s = wRHALF (BITS (16, 19), ((imm8 >> (i * 2) & 3)) & 0xff); + r |= (s & 0xffff) << (i * 16); + SIMD16_SET (psr, NBIT16 (s), SIMD_NBIT, i); + SIMD16_SET (psr, ZBIT16 (s), SIMD_ZBIT, i); + } + + wC [wCASF] = psr; + wR [BITS (12, 15)] = r; + wC [wCon] |= (WCON_CUP | WCON_MUP); + + return ARMul_DONE; +} + +static int +WSLL (ARMul_State * state, ARMword instr) +{ + ARMdword r = 0; + ARMdword s; + ARMword psr = 0; + int i; + unsigned shift; + + if ((read_cp15_reg (15, 0, 1) & 3) != 3) + return ARMul_CANT; + +#ifdef DEBUG + fprintf (stderr, "wsll\n"); +#endif + + DECODE_G_BIT (state, instr, shift); + + switch (BITS (22, 23)) + { + case Hqual: + for (i = 0; i < 4; i++) + { + if (shift > 15) + s = 0; + else + s = ((wRHALF (BITS (16, 19), i) & 0xffff) << shift); + r |= (s & 0xffff) << (i * 16); + SIMD16_SET (psr, NBIT16 (s), SIMD_NBIT, i); + SIMD16_SET (psr, ZBIT16 (s), SIMD_ZBIT, i); + } + break; + + case Wqual: + for (i = 0; i < 2; i++) + { + if (shift > 31) + s = 0; + else + s = ((wRWORD (BITS (16, 19), i) & 0xffffffff) << shift); + r |= (s & 0xffffffff) << (i * 32); + SIMD32_SET (psr, NBIT32 (s), SIMD_NBIT, i); + SIMD32_SET (psr, ZBIT32 (s), SIMD_ZBIT, i); + } + break; + + case Dqual: + if (shift > 63) + r = 0; + else + r = ((wR[BITS (16, 19)] & 0xffffffffffffffff) << shift); + + SIMD64_SET (psr, NBIT64 (r), SIMD_NBIT); + SIMD64_SET (psr, ZBIT64 (r), SIMD_ZBIT); + break; + + default: + ARMul_UndefInstr (state, instr); + return ARMul_DONE; + } + + wC [wCASF] = psr; + wR [BITS (12, 15)] = r; + wC [wCon] |= (WCON_CUP | WCON_MUP); + + return ARMul_DONE; +} + +static int +WSRA (ARMul_State * state, ARMword instr) +{ + ARMdword r = 0; + ARMdword s; + ARMword psr = 0; + int i; + unsigned shift; + signed long t; + + if ((read_cp15_reg (15, 0, 1) & 3) != 3) + return ARMul_CANT; + +#ifdef DEBUG + fprintf (stderr, "wsra\n"); +#endif + + DECODE_G_BIT (state, instr, shift); + + switch (BITS (22, 23)) + { + case Hqual: + for (i = 0; i < 4; i++) + { + if (shift > 15) + t = (wRHALF (BITS (16, 19), i) & 0x8000) ? 0xffff : 0; + else + { + t = wRHALF (BITS (16, 19), i); + t = EXTEND16 (t); + t >>= shift; + } + + s = t; + r |= (s & 0xffff) << (i * 16); + SIMD16_SET (psr, NBIT16 (s), SIMD_NBIT, i); + SIMD16_SET (psr, ZBIT16 (s), SIMD_ZBIT, i); + } + break; + + case Wqual: + for (i = 0; i < 2; i++) + { + if (shift > 31) + t = (wRWORD (BITS (16, 19), i) & 0x80000000) ? 0xffffffff : 0; + else + { + t = wRWORD (BITS (16, 19), i); + t >>= shift; + } + s = t; + r |= (s & 0xffffffff) << (i * 32); + SIMD32_SET (psr, NBIT32 (s), SIMD_NBIT, i); + SIMD32_SET (psr, ZBIT32 (s), SIMD_ZBIT, i); + } + break; + + case Dqual: + if (shift > 63) + r = (wR [BITS (16, 19)] & 0x8000000000000000) ? 0xffffffffffffffff : 0; + else + r = ((signed long long) (wR[BITS (16, 19)] & 0xffffffffffffffff) >> shift); + SIMD64_SET (psr, NBIT64 (r), SIMD_NBIT); + SIMD64_SET (psr, ZBIT64 (r), SIMD_ZBIT); + break; + + default: + ARMul_UndefInstr (state, instr); + return ARMul_DONE; + } + + wC [wCASF] = psr; + wR [BITS (12, 15)] = r; + wC [wCon] |= (WCON_CUP | WCON_MUP); + + return ARMul_DONE; +} + +static int +WSRL (ARMul_State * state, ARMword instr) +{ + ARMdword r = 0; + ARMdword s; + ARMword psr = 0; + int i; + unsigned int shift; + + if ((read_cp15_reg (15, 0, 1) & 3) != 3) + return ARMul_CANT; + +#ifdef DEBUG + fprintf (stderr, "wsrl\n"); +#endif + + DECODE_G_BIT (state, instr, shift); + + switch (BITS (22, 23)) + { + case Hqual: + for (i = 0; i < 4; i++) + { + if (shift > 15) + s = 0; + else + s = ((unsigned) (wRHALF (BITS (16, 19), i) & 0xffff) >> shift); + + r |= (s & 0xffff) << (i * 16); + SIMD16_SET (psr, NBIT16 (s), SIMD_NBIT, i); + SIMD16_SET (psr, ZBIT16 (s), SIMD_ZBIT, i); + } + break; + + case Wqual: + for (i = 0; i < 2; i++) + { + if (shift > 31) + s = 0; + else + s = ((unsigned long) (wRWORD (BITS (16, 19), i) & 0xffffffff) >> shift); + + r |= (s & 0xffffffff) << (i * 32); + SIMD32_SET (psr, NBIT32 (s), SIMD_NBIT, i); + SIMD32_SET (psr, ZBIT32 (s), SIMD_ZBIT, i); + } + break; + + case Dqual: + if (shift > 63) + r = 0; + else + r = (wR [BITS (16, 19)] & 0xffffffffffffffff) >> shift; + + SIMD64_SET (psr, NBIT64 (r), SIMD_NBIT); + SIMD64_SET (psr, ZBIT64 (r), SIMD_ZBIT); + break; + + default: + ARMul_UndefInstr (state, instr); + return ARMul_DONE; + } + + wC [wCASF] = psr; + wR [BITS (12, 15)] = r; + wC [wCon] |= (WCON_CUP | WCON_MUP); + + return ARMul_DONE; +} + +static int +WSTR (ARMul_State * state, ARMword instr) +{ + ARMword address; + int failed; + + + if ((read_cp15_reg (15, 0, 1) & 3) != 3) + return ARMul_CANT; + +#ifdef DEBUG + fprintf (stderr, "wstr\n"); +#endif + + address = Compute_Iwmmxt_Address (state, instr, & failed); + if (failed) + return ARMul_CANT; + + if (BITS (28, 31) == 0xf) + { + /* WSTRW wCx */ + Iwmmxt_Store_Word (state, address, wC [BITS (12, 15)]); + } + else if (BIT (8) == 0) + { + if (BIT (22) == 0) + /* WSTRB */ + Iwmmxt_Store_Byte (state, address, wR [BITS (12, 15)]); + else + /* WSTRH */ + Iwmmxt_Store_Half_Word (state, address, wR [BITS (12, 15)]); + } + else + { + if (BIT (22) == 0) + /* WSTRW wRd */ + Iwmmxt_Store_Word (state, address, wR [BITS (12, 15)]); + else + /* WSTRD */ + Iwmmxt_Store_Double_Word (state, address, wR [BITS (12, 15)]); + } + + return ARMul_DONE; +} + +static int +WSUB (ARMul_State * state, ARMword instr) +{ + ARMdword r = 0; + ARMword psr = 0; + ARMdword x; + ARMdword s; + int i; + int carry; + int overflow; + int satrv[8]; + + if ((read_cp15_reg (15, 0, 1) & 3) != 3) + return ARMul_CANT; + +#ifdef DEBUG + fprintf (stderr, "wsub\n"); +#endif + +/* Subtract two numbers using the specified function, + leaving setting the carry bit as required. */ +#define SUBx(x, y, m, f) \ + (*f) (wRBITS (BITS (16, 19), (x), (y)) & (m), \ + wRBITS (BITS ( 0, 3), (x), (y)) & (m), & carry, & overflow) + + switch (BITS (22, 23)) + { + case Bqual: + for (i = 0; i < 8; i++) + { + switch (BITS (20, 21)) + { + case NoSaturation: + s = SUBx ((i * 8), (i * 8) + 7, 0xff, SubS8); + satrv [BITIDX8 (i)] = 0; + r |= (s & 0xff) << (i * 8); + SIMD8_SET (psr, NBIT8 (s), SIMD_NBIT, i); + SIMD8_SET (psr, ZBIT8 (s), SIMD_ZBIT, i); + SIMD8_SET (psr, carry, SIMD_CBIT, i); + SIMD8_SET (psr, overflow, SIMD_VBIT, i); + break; + + case UnsignedSaturation: + s = SUBx ((i * 8), (i * 8) + 7, 0xff, SubU8); + x = IwmmxtSaturateU8 (s, satrv + BITIDX8 (i)); + r |= (x & 0xff) << (i * 8); + SIMD8_SET (psr, NBIT8 (x), SIMD_NBIT, i); + SIMD8_SET (psr, ZBIT8 (x), SIMD_ZBIT, i); + if (! satrv [BITIDX8 (i)]) + { + SIMD8_SET (psr, carry, SIMD_CBIT, i); + SIMD8_SET (psr, overflow, SIMD_VBIT, i); + } + break; + + case SignedSaturation: + s = SUBx ((i * 8), (i * 8) + 7, 0xff, SubS8); + x = IwmmxtSaturateS8 (s, satrv + BITIDX8 (i)); + r |= (x & 0xff) << (i * 8); + SIMD8_SET (psr, NBIT8 (x), SIMD_NBIT, i); + SIMD8_SET (psr, ZBIT8 (x), SIMD_ZBIT, i); + if (! satrv [BITIDX8 (i)]) + { + SIMD8_SET (psr, carry, SIMD_CBIT, i); + SIMD8_SET (psr, overflow, SIMD_VBIT, i); + } + break; + + default: + ARMul_UndefInstr (state, instr); + return ARMul_DONE; + } + } + break; + + case Hqual: + satrv[0] = satrv[2] = satrv[4] = satrv[6] = 0; + + for (i = 0; i < 4; i++) + { + switch (BITS (20, 21)) + { + case NoSaturation: + s = SUBx ((i * 16), (i * 16) + 15, 0xffff, SubU16); + satrv [BITIDX16 (i)] = 0; + r |= (s & 0xffff) << (i * 16); + SIMD16_SET (psr, NBIT16 (s), SIMD_NBIT, i); + SIMD16_SET (psr, ZBIT16 (s), SIMD_ZBIT, i); + SIMD16_SET (psr, carry, SIMD_CBIT, i); + SIMD16_SET (psr, overflow, SIMD_VBIT, i); + break; + + case UnsignedSaturation: + s = SUBx ((i * 16), (i * 16) + 15, 0xffff, SubU16); + x = IwmmxtSaturateU16 (s, satrv + BITIDX16 (i)); + r |= (x & 0xffff) << (i * 16); + SIMD16_SET (psr, NBIT16 (x & 0xffff), SIMD_NBIT, i); + SIMD16_SET (psr, ZBIT16 (x), SIMD_ZBIT, i); + if (! satrv [BITIDX16 (i)]) + { + SIMD16_SET (psr, carry, SIMD_CBIT, i); + SIMD16_SET (psr, overflow, SIMD_VBIT, i); + } + break; + + case SignedSaturation: + s = SUBx ((i * 16), (i * 16) + 15, 0xffff, SubS16); + x = IwmmxtSaturateS16 (s, satrv + BITIDX16 (i)); + r |= (x & 0xffff) << (i * 16); + SIMD16_SET (psr, NBIT16 (x), SIMD_NBIT, i); + SIMD16_SET (psr, ZBIT16 (x), SIMD_ZBIT, i); + if (! satrv [BITIDX16 (i)]) + { + SIMD16_SET (psr, carry, SIMD_CBIT, i); + SIMD16_SET (psr, overflow, SIMD_VBIT, i); + } + break; + + default: + ARMul_UndefInstr (state, instr); + return ARMul_DONE; + } + } + break; + + case Wqual: + satrv[0] = satrv[1] = satrv[2] = satrv[4] = satrv[5] = satrv[6] = 0; + + for (i = 0; i < 2; i++) + { + switch (BITS (20, 21)) + { + case NoSaturation: + s = SUBx ((i * 32), (i * 32) + 31, 0xffffffff, SubU32); + satrv[BITIDX32 (i)] = 0; + r |= (s & 0xffffffff) << (i * 32); + SIMD32_SET (psr, NBIT32 (s), SIMD_NBIT, i); + SIMD32_SET (psr, ZBIT32 (s), SIMD_ZBIT, i); + SIMD32_SET (psr, carry, SIMD_CBIT, i); + SIMD32_SET (psr, overflow, SIMD_VBIT, i); + break; + + case UnsignedSaturation: + s = SUBx ((i * 32), (i * 32) + 31, 0xffffffff, SubU32); + x = IwmmxtSaturateU32 (s, satrv + BITIDX32 (i)); + r |= (x & 0xffffffff) << (i * 32); + SIMD32_SET (psr, NBIT32 (x), SIMD_NBIT, i); + SIMD32_SET (psr, ZBIT32 (x), SIMD_ZBIT, i); + if (! satrv [BITIDX32 (i)]) + { + SIMD32_SET (psr, carry, SIMD_CBIT, i); + SIMD32_SET (psr, overflow, SIMD_VBIT, i); + } + break; + + case SignedSaturation: + s = SUBx ((i * 32), (i * 32) + 31, 0xffffffff, SubS32); + x = IwmmxtSaturateS32 (s, satrv + BITIDX32 (i)); + r |= (x & 0xffffffff) << (i * 32); + SIMD32_SET (psr, NBIT32 (x), SIMD_NBIT, i); + SIMD32_SET (psr, ZBIT32 (x), SIMD_ZBIT, i); + if (! satrv [BITIDX32 (i)]) + { + SIMD32_SET (psr, carry, SIMD_CBIT, i); + SIMD32_SET (psr, overflow, SIMD_VBIT, i); + } + break; + + default: + ARMul_UndefInstr (state, instr); + return ARMul_DONE; + } + } + break; + + default: + ARMul_UndefInstr (state, instr); + return ARMul_DONE; + } + + wR [BITS (12, 15)] = r; + wC [wCASF] = psr; + SET_wCSSFvec (satrv); + wC [wCon] |= (WCON_CUP | WCON_MUP); + +#undef SUBx + + return ARMul_DONE; +} + +static int +WUNPCKEH (ARMul_State * state, ARMword instr) +{ + ARMdword r = 0; + ARMword psr = 0; + ARMdword s; + int i; + + if ((read_cp15_reg (15, 0, 1) & 3) != 3) + return ARMul_CANT; + +#ifdef DEBUG + fprintf (stderr, "wunpckeh\n"); +#endif + + switch (BITS (22, 23)) + { + case Bqual: + for (i = 0; i < 4; i++) + { + s = wRBYTE (BITS (16, 19), i + 4); + + if (BIT (21) && NBIT8 (s)) + s |= 0xff00; + + r |= (s & 0xffff) << (i * 16); + SIMD16_SET (psr, NBIT16 (s), SIMD_NBIT, i); + SIMD16_SET (psr, ZBIT16 (s), SIMD_ZBIT, i); + } + break; + + case Hqual: + for (i = 0; i < 2; i++) + { + s = wRHALF (BITS (16, 19), i + 2); + + if (BIT (21) && NBIT16 (s)) + s |= 0xffff0000; + + r |= (s & 0xffffffff) << (i * 32); + SIMD32_SET (psr, NBIT32 (s), SIMD_NBIT, i); + SIMD32_SET (psr, ZBIT32 (s), SIMD_ZBIT, i); + } + break; + + case Wqual: + r = wRWORD (BITS (16, 19), 1); + + if (BIT (21) && NBIT32 (r)) + r |= 0xffffffff00000000; + + SIMD64_SET (psr, NBIT64 (r), SIMD_NBIT); + SIMD64_SET (psr, ZBIT64 (r), SIMD_ZBIT); + break; + + default: + ARMul_UndefInstr (state, instr); + return ARMul_DONE; + } + + wC [wCASF] = psr; + wR [BITS (12, 15)] = r; + wC [wCon] |= (WCON_CUP | WCON_MUP); + + return ARMul_DONE; +} + +static int +WUNPCKEL (ARMul_State * state, ARMword instr) +{ + ARMdword r = 0; + ARMword psr = 0; + ARMdword s; + int i; + + if ((read_cp15_reg (15, 0, 1) & 3) != 3) + return ARMul_CANT; + +#ifdef DEBUG + fprintf (stderr, "wunpckel\n"); +#endif + + switch (BITS (22, 23)) + { + case Bqual: + for (i = 0; i < 4; i++) + { + s = wRBYTE (BITS (16, 19), i); + + if (BIT (21) && NBIT8 (s)) + s |= 0xff00; + + r |= (s & 0xffff) << (i * 16); + SIMD16_SET (psr, NBIT16 (s), SIMD_NBIT, i); + SIMD16_SET (psr, ZBIT16 (s), SIMD_ZBIT, i); + } + break; + + case Hqual: + for (i = 0; i < 2; i++) + { + s = wRHALF (BITS (16, 19), i); + + if (BIT (21) && NBIT16 (s)) + s |= 0xffff0000; + + r |= (s & 0xffffffff) << (i * 32); + SIMD32_SET (psr, NBIT32 (s), SIMD_NBIT, i); + SIMD32_SET (psr, ZBIT32 (s), SIMD_ZBIT, i); + } + break; + + case Wqual: + r = wRWORD (BITS (16, 19), 0); + + if (BIT (21) && NBIT32 (r)) + r |= 0xffffffff00000000; + + SIMD64_SET (psr, NBIT64 (r), SIMD_NBIT); + SIMD64_SET (psr, ZBIT64 (r), SIMD_ZBIT); + break; + + default: + ARMul_UndefInstr (state, instr); + return ARMul_DONE; + } + + wC [wCASF] = psr; + wR [BITS (12, 15)] = r; + wC [wCon] |= (WCON_CUP | WCON_MUP); + + return ARMul_DONE; +} + +static int +WUNPCKIH (ARMul_State * state, ARMword instr) +{ + ARMword a, b; + ARMdword r = 0; + ARMword psr = 0; + ARMdword s; + int i; + + if ((read_cp15_reg (15, 0, 1) & 3) != 3) + return ARMul_CANT; + +#ifdef DEBUG + fprintf (stderr, "wunpckih\n"); +#endif + + switch (BITS (22, 23)) + { + case Bqual: + for (i = 0; i < 4; i++) + { + a = wRBYTE (BITS (16, 19), i + 4); + b = wRBYTE (BITS ( 0, 3), i + 4); + s = a | (b << 8); + r |= (s & 0xffff) << (i * 16); + SIMD8_SET (psr, NBIT8 (a), SIMD_NBIT, i * 2); + SIMD8_SET (psr, ZBIT8 (a), SIMD_ZBIT, i * 2); + SIMD8_SET (psr, NBIT8 (b), SIMD_NBIT, (i * 2) + 1); + SIMD8_SET (psr, ZBIT8 (b), SIMD_ZBIT, (i * 2) + 1); + } + break; + + case Hqual: + for (i = 0; i < 2; i++) + { + a = wRHALF (BITS (16, 19), i + 2); + b = wRHALF (BITS ( 0, 3), i + 2); + s = a | (b << 16); + r |= (s & 0xffffffff) << (i * 32); + SIMD16_SET (psr, NBIT16 (a), SIMD_NBIT, (i * 2)); + SIMD16_SET (psr, ZBIT16 (a), SIMD_ZBIT, (i * 2)); + SIMD16_SET (psr, NBIT16 (b), SIMD_NBIT, (i * 2) + 1); + SIMD16_SET (psr, ZBIT16 (b), SIMD_ZBIT, (i * 2) + 1); + } + break; + + case Wqual: + a = wRWORD (BITS (16, 19), 1); + s = wRWORD (BITS ( 0, 3), 1); + r = a | (s << 32); + + SIMD32_SET (psr, NBIT32 (a), SIMD_NBIT, 0); + SIMD32_SET (psr, ZBIT32 (a), SIMD_ZBIT, 0); + SIMD32_SET (psr, NBIT32 (s), SIMD_NBIT, 1); + SIMD32_SET (psr, ZBIT32 (s), SIMD_ZBIT, 1); + break; + + default: + ARMul_UndefInstr (state, instr); + return ARMul_DONE; + } + + wC [wCASF] = psr; + wR [BITS (12, 15)] = r; + wC [wCon] |= (WCON_CUP | WCON_MUP); + + return ARMul_DONE; +} + +static int +WUNPCKIL (ARMul_State * state, ARMword instr) +{ + ARMword a, b; + ARMdword r = 0; + ARMword psr = 0; + ARMdword s; + int i; + + if ((read_cp15_reg (15, 0, 1) & 3) != 3) + return ARMul_CANT; + +#ifdef DEBUG + fprintf (stderr, "wunpckil\n"); +#endif + + switch (BITS (22, 23)) + { + case Bqual: + for (i = 0; i < 4; i++) + { + a = wRBYTE (BITS (16, 19), i); + b = wRBYTE (BITS ( 0, 3), i); + s = a | (b << 8); + r |= (s & 0xffff) << (i * 16); + SIMD8_SET (psr, NBIT8 (a), SIMD_NBIT, i * 2); + SIMD8_SET (psr, ZBIT8 (a), SIMD_ZBIT, i * 2); + SIMD8_SET (psr, NBIT8 (b), SIMD_NBIT, (i * 2) + 1); + SIMD8_SET (psr, ZBIT8 (b), SIMD_ZBIT, (i * 2) + 1); + } + break; + + case Hqual: + for (i = 0; i < 2; i++) + { + a = wRHALF (BITS (16, 19), i); + b = wRHALF (BITS ( 0, 3), i); + s = a | (b << 16); + r |= (s & 0xffffffff) << (i * 32); + SIMD16_SET (psr, NBIT16 (a), SIMD_NBIT, (i * 2)); + SIMD16_SET (psr, ZBIT16 (a), SIMD_ZBIT, (i * 2)); + SIMD16_SET (psr, NBIT16 (b), SIMD_NBIT, (i * 2) + 1); + SIMD16_SET (psr, ZBIT16 (b), SIMD_ZBIT, (i * 2) + 1); + } + break; + + case Wqual: + a = wRWORD (BITS (16, 19), 0); + s = wRWORD (BITS ( 0, 3), 0); + r = a | (s << 32); + + SIMD32_SET (psr, NBIT32 (a), SIMD_NBIT, 0); + SIMD32_SET (psr, ZBIT32 (a), SIMD_ZBIT, 0); + SIMD32_SET (psr, NBIT32 (s), SIMD_NBIT, 1); + SIMD32_SET (psr, ZBIT32 (s), SIMD_ZBIT, 1); + break; + + default: + ARMul_UndefInstr (state, instr); + return ARMul_DONE; + } + + wC [wCASF] = psr; + wR [BITS (12, 15)] = r; + wC [wCon] |= (WCON_CUP | WCON_MUP); + + return ARMul_DONE; +} + +static int +WXOR (ARMword instr) +{ + ARMword psr = 0; + ARMdword result; + + if ((read_cp15_reg (15, 0, 1) & 3) != 3) + return ARMul_CANT; + +#ifdef DEBUG + fprintf (stderr, "wxor\n"); +#endif + + result = wR [BITS (16, 19)] ^ wR [BITS (0, 3)]; + wR [BITS (12, 15)] = result; + + SIMD64_SET (psr, (result == 0), SIMD_ZBIT); + SIMD64_SET (psr, (result & (1ULL << 63)), SIMD_NBIT); + + wC [wCASF] = psr; + wC [wCon] |= (WCON_CUP | WCON_MUP); + + return ARMul_DONE; +} + +/* This switch table is moved to a seperate function in order + to work around a compiler bug in the host compiler... */ + +static int +Process_Instruction (ARMul_State * state, ARMword instr) +{ + int status = ARMul_BUSY; + + switch ((BITS (20, 23) << 8) | BITS (4, 11)) + { + case 0x000: status = WOR (instr); break; + case 0x011: status = TMCR (state, instr); break; + case 0x100: status = WXOR (instr); break; + case 0x111: status = TMRC (state, instr); break; + case 0x300: status = WANDN (instr); break; + case 0x200: status = WAND (instr); break; + + case 0x810: case 0xa10: + status = WMADD (instr); break; + + case 0x10e: case 0x50e: case 0x90e: case 0xd0e: + status = WUNPCKIL (state, instr); break; + case 0x10c: case 0x50c: case 0x90c: case 0xd0c: + status = WUNPCKIH (state, instr); break; + case 0x012: case 0x112: case 0x412: case 0x512: + status = WSAD (instr); break; + case 0x010: case 0x110: case 0x210: case 0x310: + status = WMUL (instr); break; + case 0x410: case 0x510: case 0x610: case 0x710: + status = WMAC (instr); break; + case 0x006: case 0x406: case 0x806: case 0xc06: + status = WCMPEQ (state, instr); break; + case 0x800: case 0x900: case 0xc00: case 0xd00: + status = WAVG2 (instr); break; + case 0x802: case 0x902: case 0xa02: case 0xb02: + status = WALIGNR (state, instr); break; + case 0x601: case 0x605: case 0x609: case 0x60d: + status = TINSR (state, instr); break; + case 0x107: case 0x507: case 0x907: case 0xd07: + status = TEXTRM (state, instr); break; + case 0x117: case 0x517: case 0x917: case 0xd17: + status = TEXTRC (state, instr); break; + case 0x401: case 0x405: case 0x409: case 0x40d: + status = TBCST (state, instr); break; + case 0x113: case 0x513: case 0x913: case 0xd13: + status = TANDC (state, instr); break; + case 0x01c: case 0x41c: case 0x81c: case 0xc1c: + status = WACC (state, instr); break; + case 0x115: case 0x515: case 0x915: case 0xd15: + status = TORC (state, instr); break; + case 0x103: case 0x503: case 0x903: case 0xd03: + status = TMOVMSK (state, instr); break; + case 0x106: case 0x306: case 0x506: case 0x706: + case 0x906: case 0xb06: case 0xd06: case 0xf06: + status = WCMPGT (state, instr); break; + case 0x00e: case 0x20e: case 0x40e: case 0x60e: + case 0x80e: case 0xa0e: case 0xc0e: case 0xe0e: + status = WUNPCKEL (state, instr); break; + case 0x00c: case 0x20c: case 0x40c: case 0x60c: + case 0x80c: case 0xa0c: case 0xc0c: case 0xe0c: + status = WUNPCKEH (state, instr); break; + case 0x204: case 0x604: case 0xa04: case 0xe04: + case 0x214: case 0x614: case 0xa14: case 0xe14: + status = WSRL (state, instr); break; + case 0x004: case 0x404: case 0x804: case 0xc04: + case 0x014: case 0x414: case 0x814: case 0xc14: + status = WSRA (state, instr); break; + case 0x104: case 0x504: case 0x904: case 0xd04: + case 0x114: case 0x514: case 0x914: case 0xd14: + status = WSLL (state, instr); break; + case 0x304: case 0x704: case 0xb04: case 0xf04: + case 0x314: case 0x714: case 0xb14: case 0xf14: + status = WROR (state, instr); break; + case 0x116: case 0x316: case 0x516: case 0x716: + case 0x916: case 0xb16: case 0xd16: case 0xf16: + status = WMIN (state, instr); break; + case 0x016: case 0x216: case 0x416: case 0x616: + case 0x816: case 0xa16: case 0xc16: case 0xe16: + status = WMAX (state, instr); break; + case 0x002: case 0x102: case 0x202: case 0x302: + case 0x402: case 0x502: case 0x602: case 0x702: + status = WALIGNI (instr); break; + case 0x01a: case 0x11a: case 0x21a: case 0x31a: + case 0x41a: case 0x51a: case 0x61a: case 0x71a: + case 0x81a: case 0x91a: case 0xa1a: case 0xb1a: + case 0xc1a: case 0xd1a: case 0xe1a: case 0xf1a: + status = WSUB (state, instr); break; + case 0x01e: case 0x11e: case 0x21e: case 0x31e: + case 0x41e: case 0x51e: case 0x61e: case 0x71e: + case 0x81e: case 0x91e: case 0xa1e: case 0xb1e: + case 0xc1e: case 0xd1e: case 0xe1e: case 0xf1e: + status = WSHUFH (instr); break; + case 0x018: case 0x118: case 0x218: case 0x318: + case 0x418: case 0x518: case 0x618: case 0x718: + case 0x818: case 0x918: case 0xa18: case 0xb18: + case 0xc18: case 0xd18: case 0xe18: case 0xf18: + status = WADD (state, instr); break; + case 0x008: case 0x108: case 0x208: case 0x308: + case 0x408: case 0x508: case 0x608: case 0x708: + case 0x808: case 0x908: case 0xa08: case 0xb08: + case 0xc08: case 0xd08: case 0xe08: case 0xf08: + status = WPACK (state, instr); break; + case 0x201: case 0x203: case 0x205: case 0x207: + case 0x209: case 0x20b: case 0x20d: case 0x20f: + case 0x211: case 0x213: case 0x215: case 0x217: + case 0x219: case 0x21b: case 0x21d: case 0x21f: + switch (BITS (16, 19)) + { + case 0x0: status = TMIA (state, instr); break; + case 0x8: status = TMIAPH (state, instr); break; + case 0xc: + case 0xd: + case 0xe: + case 0xf: status = TMIAxy (state, instr); break; + default: break; + } + break; + default: + break; + } + return status; +} + +/* Process a possibly Intel(r) Wireless MMX(tm) technology instruction. + Return true if the instruction was handled. */ + +int +ARMul_HandleIwmmxt (ARMul_State * state, ARMword instr) +{ + int status = ARMul_BUSY; + + if (BITS (24, 27) == 0xe) + { + status = Process_Instruction (state, instr); + } + else if (BITS (25, 27) == 0x6) + { + if (BITS (4, 11) == 0x0 && BITS (20, 24) == 0x4) + status = TMCRR (state, instr); + else if (BITS (9, 11) == 0x0) + { + if (BIT (20) == 0x0) + status = WSTR (state, instr); + else if (BITS (20, 24) == 0x5) + status = TMRRC (state, instr); + else + status = WLDR (state, instr); + } + } + + if (status == ARMul_CANT) + { + /* If the instruction was a recognised but illegal, + perform the abort here rather than returning false. + If we return false then ARMul_MRC may be called which + will still abort, but which also perform the register + transfer... */ + ARMul_Abort (state, ARMul_UndefinedInstrV); + status = ARMul_DONE; + } + + return status == ARMul_DONE; +} + +int +Fetch_Iwmmxt_Register (unsigned int regnum, unsigned char * memory) +{ + if (regnum >= 16) + { + memcpy (memory, wC + (regnum - 16), sizeof wC [0]); + return sizeof wC [0]; + } + else + { + memcpy (memory, wR + regnum, sizeof wR [0]); + return sizeof wR [0]; + } +} + +int +Store_Iwmmxt_Register (unsigned int regnum, unsigned char * memory) +{ + if (regnum >= 16) + { + memcpy (wC + (regnum - 16), memory, sizeof wC [0]); + return sizeof wC [0]; + } + else + { + memcpy (wR + regnum, memory, sizeof wR [0]); + return sizeof wR [0]; + } +} diff --git a/sim/arm/iwmmxt.h b/sim/arm/iwmmxt.h new file mode 100644 index 00000000000..e25feab10a4 --- /dev/null +++ b/sim/arm/iwmmxt.h @@ -0,0 +1,28 @@ +/* iwmmxt.h -- Intel(r) Wireless MMX(tm) technology co-processor interface. + Copyright (C) 2002 Free Software Foundation, Inc. + Contributed by matthew green (mrg@redhat.com). + + 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. */ + +extern unsigned IwmmxtLDC (ARMul_State *, unsigned, ARMword, ARMword); +extern unsigned IwmmxtSTC (ARMul_State *, unsigned, ARMword, ARMword *); +extern unsigned IwmmxtMCR (ARMul_State *, unsigned, ARMword, ARMword); +extern unsigned IwmmxtMRC (ARMul_State *, unsigned, ARMword, ARMword *); +extern unsigned IwmmxtCDP (ARMul_State *, unsigned, ARMword); + +extern int ARMul_HandleIwmmxt (ARMul_State *, ARMword); + +extern int Fetch_Iwmmxt_Register (unsigned int, unsigned char *); +extern int Store_Iwmmxt_Register (unsigned int, unsigned char *); diff --git a/sim/arm/wrapper.c b/sim/arm/wrapper.c index f13d32928b0..bba6f7fd444 100644 --- a/sim/arm/wrapper.c +++ b/sim/arm/wrapper.c @@ -263,10 +263,34 @@ sim_create_inferior (sd, abfd, argv, env) /* We wouldn't set the machine type with earlier toolchains, so we explicitly select a processor capable of supporting all ARMs in 32bit mode. */ + /* We choose the XScale rather than the iWMMXt, because the iWMMXt + removes the FPE emulator, since it conflicts with its coprocessors. + For the most generic ARM support, we want the FPE emulator in place. */ case bfd_mach_arm_XScale: ARMul_SelectProcessor (state, ARM_v5_Prop | ARM_v5e_Prop | ARM_XScale_Prop); break; + case bfd_mach_arm_iWMMXt: + { + extern int SWI_vector_installed; + ARMword i; + + if (! SWI_vector_installed) + { + /* Intialise the hardware vectors to zero. */ + if (! SWI_vector_installed) + for (i = ARMul_ResetV; i <= ARMFIQV; i += 4) + ARMul_WriteWord (state, i, 0); + + /* ARM_WriteWord will have detected the write to the SWI vector, + but we want SWI_vector_installed to remain at 0 so that thumb + mode breakpoints will work. */ + SWI_vector_installed = 0; + } + } + ARMul_SelectProcessor (state, ARM_v5_Prop | ARM_v5e_Prop | ARM_XScale_Prop | ARM_iWMMXt_Prop); + break; + case bfd_mach_arm_ep9312: ARMul_SelectProcessor (state, ARM_v4_Prop | ARM_ep9312_Prop); break; @@ -481,6 +505,40 @@ sim_store_register (sd, rn, memory, length) memcpy (&DSPsc, memory, sizeof DSPsc); return sizeof DSPsc; + case SIM_ARM_IWMMXT_COP0R0_REGNUM: + case SIM_ARM_IWMMXT_COP0R1_REGNUM: + case SIM_ARM_IWMMXT_COP0R2_REGNUM: + case SIM_ARM_IWMMXT_COP0R3_REGNUM: + case SIM_ARM_IWMMXT_COP0R4_REGNUM: + case SIM_ARM_IWMMXT_COP0R5_REGNUM: + case SIM_ARM_IWMMXT_COP0R6_REGNUM: + case SIM_ARM_IWMMXT_COP0R7_REGNUM: + case SIM_ARM_IWMMXT_COP0R8_REGNUM: + case SIM_ARM_IWMMXT_COP0R9_REGNUM: + case SIM_ARM_IWMMXT_COP0R10_REGNUM: + case SIM_ARM_IWMMXT_COP0R11_REGNUM: + case SIM_ARM_IWMMXT_COP0R12_REGNUM: + case SIM_ARM_IWMMXT_COP0R13_REGNUM: + case SIM_ARM_IWMMXT_COP0R14_REGNUM: + case SIM_ARM_IWMMXT_COP0R15_REGNUM: + case SIM_ARM_IWMMXT_COP1R0_REGNUM: + case SIM_ARM_IWMMXT_COP1R1_REGNUM: + case SIM_ARM_IWMMXT_COP1R2_REGNUM: + case SIM_ARM_IWMMXT_COP1R3_REGNUM: + case SIM_ARM_IWMMXT_COP1R4_REGNUM: + case SIM_ARM_IWMMXT_COP1R5_REGNUM: + case SIM_ARM_IWMMXT_COP1R6_REGNUM: + case SIM_ARM_IWMMXT_COP1R7_REGNUM: + case SIM_ARM_IWMMXT_COP1R8_REGNUM: + case SIM_ARM_IWMMXT_COP1R9_REGNUM: + case SIM_ARM_IWMMXT_COP1R10_REGNUM: + case SIM_ARM_IWMMXT_COP1R11_REGNUM: + case SIM_ARM_IWMMXT_COP1R12_REGNUM: + case SIM_ARM_IWMMXT_COP1R13_REGNUM: + case SIM_ARM_IWMMXT_COP1R14_REGNUM: + case SIM_ARM_IWMMXT_COP1R15_REGNUM: + return Store_Iwmmxt_Register (rn - SIM_ARM_IWMMXT_COP0R0_REGNUM, memory); + default: return 0; } @@ -560,6 +618,40 @@ sim_fetch_register (sd, rn, memory, length) memcpy (memory, & DSPsc, sizeof DSPsc); return sizeof DSPsc; + case SIM_ARM_IWMMXT_COP0R0_REGNUM: + case SIM_ARM_IWMMXT_COP0R1_REGNUM: + case SIM_ARM_IWMMXT_COP0R2_REGNUM: + case SIM_ARM_IWMMXT_COP0R3_REGNUM: + case SIM_ARM_IWMMXT_COP0R4_REGNUM: + case SIM_ARM_IWMMXT_COP0R5_REGNUM: + case SIM_ARM_IWMMXT_COP0R6_REGNUM: + case SIM_ARM_IWMMXT_COP0R7_REGNUM: + case SIM_ARM_IWMMXT_COP0R8_REGNUM: + case SIM_ARM_IWMMXT_COP0R9_REGNUM: + case SIM_ARM_IWMMXT_COP0R10_REGNUM: + case SIM_ARM_IWMMXT_COP0R11_REGNUM: + case SIM_ARM_IWMMXT_COP0R12_REGNUM: + case SIM_ARM_IWMMXT_COP0R13_REGNUM: + case SIM_ARM_IWMMXT_COP0R14_REGNUM: + case SIM_ARM_IWMMXT_COP0R15_REGNUM: + case SIM_ARM_IWMMXT_COP1R0_REGNUM: + case SIM_ARM_IWMMXT_COP1R1_REGNUM: + case SIM_ARM_IWMMXT_COP1R2_REGNUM: + case SIM_ARM_IWMMXT_COP1R3_REGNUM: + case SIM_ARM_IWMMXT_COP1R4_REGNUM: + case SIM_ARM_IWMMXT_COP1R5_REGNUM: + case SIM_ARM_IWMMXT_COP1R6_REGNUM: + case SIM_ARM_IWMMXT_COP1R7_REGNUM: + case SIM_ARM_IWMMXT_COP1R8_REGNUM: + case SIM_ARM_IWMMXT_COP1R9_REGNUM: + case SIM_ARM_IWMMXT_COP1R10_REGNUM: + case SIM_ARM_IWMMXT_COP1R11_REGNUM: + case SIM_ARM_IWMMXT_COP1R12_REGNUM: + case SIM_ARM_IWMMXT_COP1R13_REGNUM: + case SIM_ARM_IWMMXT_COP1R14_REGNUM: + case SIM_ARM_IWMMXT_COP1R15_REGNUM: + return Fetch_Iwmmxt_Register (rn - SIM_ARM_IWMMXT_COP0R0_REGNUM, memory); + default: return 0; } @@ -822,6 +914,9 @@ sim_stop_reason (sd, reason, sigrc) *reason = sim_stopped; if (state->EndCondition == RDIError_BreakpointReached) *sigrc = SIGTRAP; + else if ( state->EndCondition == RDIError_DataAbort + || state->EndCondition == RDIError_AddressException) + *sigrc = SIGBUS; else *sigrc = 0; } -- cgit v1.2.1