aboutsummaryrefslogtreecommitdiff
path: root/gdb/i386-tdep.c
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2014-11-12 10:10:48 +0000
committerPedro Alves <palves@redhat.com>2014-11-12 10:32:53 +0000
commitae9bb220caeb7d51fce6f54a182477247d8e3ac3 (patch)
tree18462743c2f94ff69124e00172aa0d3a9f0ffe3f /gdb/i386-tdep.c
parent6bb3e67958b0ee59f1b69619761e6d5ad1f7544b (diff)
downloadgdb-ae9bb220caeb7d51fce6f54a182477247d8e3ac3.zip
gdb-ae9bb220caeb7d51fce6f54a182477247d8e3ac3.tar.gz
gdb-ae9bb220caeb7d51fce6f54a182477247d8e3ac3.tar.bz2
add a default method for gdbarch_skip_permanent_breakpoint
breakpoint.c uses gdbarch_breakpoint_from_pc to determine whether a breakpoint location points at a permanent breakpoint: static int bp_loc_is_permanent (struct bp_location *loc) { ... addr = loc->address; bpoint = gdbarch_breakpoint_from_pc (loc->gdbarch, &addr, &len); ... if (target_read_memory (loc->address, target_mem, len) == 0 && memcmp (target_mem, bpoint, len) == 0) retval = 1; ... So I think we should default the gdbarch_skip_permanent_breakpoint hook to advancing the PC by the length of the breakpoint instruction, as determined by gdbarch_breakpoint_from_pc. I believe that simple implementation does the right thing for most architectures. If there's an oddball architecture where that doesn't work, then it should override the hook, just like it should be overriding the hook if there was no default anyway. The only two implementation of skip_permanent_breakpoint are i386_skip_permanent_breakpoint, for x86, and hppa_skip_permanent_breakpoint, for PA-RISC/HP-UX The x86 implementation is trivial, and can clearly be replaced by the new default. I don't know about the HP-UX one though, I know almost nothing about PA. It may well be advancing the PC ends up being equivalent. Otherwise, it must be that "jump $pc_after_bp" doesn't work either... Tested on x86_64 Fedora 20 native and gdbserver. gdb/ 2014-11-12 Pedro Alves <palves@redhat.com> * arch-utils.c (default_skip_permanent_breakpoint): New function. * arch-utils.h (default_skip_permanent_breakpoint): New declaration. * gdbarch.sh (skip_permanent_breakpoint): Now an 'f' function. Install default_skip_permanent_breakpoint as default method. * i386-tdep.c (i386_skip_permanent_breakpoint): Delete function. (i386_gdbarch_init): Don't install it. * infrun.c (resume): Assume there's always a gdbarch_skip_permanent_breakpoint implementation. * gdbarch.h, gdbarch.c: Regenerate.
Diffstat (limited to 'gdb/i386-tdep.c')
-rw-r--r--gdb/i386-tdep.c15
1 files changed, 0 insertions, 15 deletions
diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
index 8387c72..83956bf 100644
--- a/gdb/i386-tdep.c
+++ b/gdb/i386-tdep.c
@@ -4523,18 +4523,6 @@ i386_fetch_pointer_argument (struct frame_info *frame, int argi,
return read_memory_unsigned_integer (sp + (4 * (argi + 1)), 4, byte_order);
}
-static void
-i386_skip_permanent_breakpoint (struct regcache *regcache)
-{
- CORE_ADDR current_pc = regcache_read_pc (regcache);
-
- /* On i386, breakpoint is exactly 1 byte long, so we just
- adjust the PC in the regcache. */
- current_pc += 1;
- regcache_write_pc (regcache, current_pc);
-}
-
-
#define PREFIX_REPZ 0x01
#define PREFIX_REPNZ 0x02
#define PREFIX_LOCK 0x04
@@ -8566,9 +8554,6 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_iterate_over_regset_sections
(gdbarch, i386_iterate_over_regset_sections);
- set_gdbarch_skip_permanent_breakpoint (gdbarch,
- i386_skip_permanent_breakpoint);
-
set_gdbarch_fast_tracepoint_valid_at (gdbarch,
i386_fast_tracepoint_valid_at);