Hi, These patches provide an implementation of displaced stepping support for ARM (Linux only for now), using the generic hooks provided by GDB. ARM support is relatively tricky compared to some other architectures, because there's no hardware single-stepping support. However we can fake it by making sure that displaced instructions don't modify control flow, and placing a software breakpoint after each displaced instruction. Also registers are rewritten to handle instructions which might read/write the PC. We must of course take care that the cleanup routine puts things back in the correct places. As a side-effect of the lack of h/w single-stepping support, we've enabled displaced stepping in all cases, not just when stepping over breakpoints (a patch of Pedro Alves's, attached, but mangled by me to apply to mainline). I'm not sure if that's the most sensible approach (for displaced stepping, we only care about not *removing* breakpoints which might be hit by other threads. We can still add temporary breakpoints for the purpose of software single-stepping). Only the traditional ARM instruction set is covered by this patch -- there's no support for Thumb or Thumb-2. For ARM instructions, the coverage is pretty good though I think. Note that though this implementation is loosely inspired by the Linux kernel's kprobes implementation, no code has been taken from there. Regression tested using an x86 host and a remote target running gdbserver, with (possibly) no regressions -- although several tests seem to fluctuate randomly between passing/failing for me (with timeouts) with or without the patch. I'm not sure how normal that is. Also tested with "GDBFLAGS=-ex 'set displaced-stepping on'", which seemed OK, and of course with hand-written spot-checks. OK to apply, or any comments? Cheers, Julian ChangeLog (always use displaced stepping) 2008-11-19 Pedro Alves * infrun.c (displaced_step_fixup): If this is a software single-stepping arch, don't tell the target to single-step. (resume): If this is a software single-stepping arch, and displaced-stepping is enabled, use it for all single-step requests. ChangeLog (ARM displaced stepping) gdb/ * arm-linux-tdep.c (arch-utils.h): Include file. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (struct displaced_step_closure): Define. (displaced_read_reg, displaced_write_reg, copy_unmodified) (copy_preload, copy_preload_reg, copy_copro_load_store) (copy_b_bl_blx, copy_bx_blx_reg, copy_dp_imm, copy_dp_reg) (copy_dp_shifted_reg, modify_store_pc, copy_extra_ld_st) (copy_ldr_str_ldrb_strb, copy_block_xfer, copy_svc, copy_undef) (copy_unpred): New. (cleanup_branch, cleanup_dp_imm, cleanup_dp_reg) (cleanup_dp_shifted_reg, cleanup_load, cleanup_store) (cleanup_block_xfer, cleanup_svc, cleanup_kernel_helper_return) (cleanup_preload, cleanup_copro_load_store): New functions (with forward declarations). (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_catch_kernel_helper_return, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.