From a48259b4bf6fa3d8c86f55cea82069f08af43541 Mon Sep 17 00:00:00 2001 From: Markus Deuling Date: Wed, 20 Feb 2008 14:31:40 +0000 Subject: [PATCH] * gdbarch.sh (memory_insert_breakpoint, memory_remove_breakpoint): Add gdbarch as parameter. * gdbarch.{c,h}: Regenerate. * ppc-tdep.h (ppc_linux_memory_remove_breakpoint): Add gdbarch as parameter. * mem-break.c (default_memory_insert_breakpoint) (default_memory_remove_breakpoint): Likewise. * target.h (default_memory_remove_breakpoint) (default_memory_insert_breakpoint): Likewise. * ppc-linux-tdep.c (ppc_linux_memory_remove_breakpoint): Add gdbarch as parameter. Replace current_gdbarch by gdbarch. * m32r-tdep.c (m32r_memory_insert_breakpoint) (m32r_memory_remove_breakpoint): Likewise. --- gdb/ChangeLog | 19 +++++++++++++++++++ gdb/gdbarch.c | 8 ++++---- gdb/gdbarch.h | 4 ++-- gdb/gdbarch.sh | 4 ++-- gdb/ia64-tdep.c | 6 ++++-- gdb/m32r-tdep.c | 10 ++++++---- gdb/mem-break.c | 8 +++++--- gdb/ppc-linux-tdep.c | 5 +++-- gdb/ppc-tdep.h | 2 +- gdb/target.h | 4 ++-- 10 files changed, 48 insertions(+), 22 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 233ac4185d..cfdd971610 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,22 @@ +2008-02-20 Markus Deuling + + * gdbarch.sh (memory_insert_breakpoint, memory_remove_breakpoint): Add + gdbarch as parameter. + + * gdbarch.{c,h}: Regenerate. + + * ppc-tdep.h (ppc_linux_memory_remove_breakpoint): Add gdbarch as + parameter. + * mem-break.c (default_memory_insert_breakpoint) + (default_memory_remove_breakpoint): Likewise. + * target.h (default_memory_remove_breakpoint) + (default_memory_insert_breakpoint): Likewise. + + * ppc-linux-tdep.c (ppc_linux_memory_remove_breakpoint): Add gdbarch as + parameter. Replace current_gdbarch by gdbarch. + * m32r-tdep.c (m32r_memory_insert_breakpoint) + (m32r_memory_remove_breakpoint): Likewise. + 2008-02-19 Daniel Jacobowitz * MAINTAINERS: Add Vladimir Prus as MI maintainer. diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index 3c5a282eb5..613064cc1d 100644 --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -309,8 +309,8 @@ struct gdbarch startup_gdbarch = 0, /* inner_than */ 0, /* breakpoint_from_pc */ 0, /* adjust_breakpoint_address */ - 0, /* memory_insert_breakpoint */ - 0, /* memory_remove_breakpoint */ + default_memory_insert_breakpoint, /* memory_insert_breakpoint */ + default_memory_remove_breakpoint, /* memory_remove_breakpoint */ 0, /* decr_pc_after_break */ 0, /* deprecated_function_start_offset */ default_remote_register_number, /* remote_register_number */ @@ -2139,7 +2139,7 @@ gdbarch_memory_insert_breakpoint (struct gdbarch *gdbarch, struct bp_target_info gdb_assert (gdbarch->memory_insert_breakpoint != NULL); if (gdbarch_debug >= 2) fprintf_unfiltered (gdb_stdlog, "gdbarch_memory_insert_breakpoint called\n"); - return gdbarch->memory_insert_breakpoint (bp_tgt); + return gdbarch->memory_insert_breakpoint (gdbarch, bp_tgt); } void @@ -2156,7 +2156,7 @@ gdbarch_memory_remove_breakpoint (struct gdbarch *gdbarch, struct bp_target_info gdb_assert (gdbarch->memory_remove_breakpoint != NULL); if (gdbarch_debug >= 2) fprintf_unfiltered (gdb_stdlog, "gdbarch_memory_remove_breakpoint called\n"); - return gdbarch->memory_remove_breakpoint (bp_tgt); + return gdbarch->memory_remove_breakpoint (gdbarch, bp_tgt); } void diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h index c068ddec5a..06ac3ce2fd 100644 --- a/gdb/gdbarch.h +++ b/gdb/gdbarch.h @@ -388,11 +388,11 @@ typedef CORE_ADDR (gdbarch_adjust_breakpoint_address_ftype) (struct gdbarch *gdb extern CORE_ADDR gdbarch_adjust_breakpoint_address (struct gdbarch *gdbarch, CORE_ADDR bpaddr); extern void set_gdbarch_adjust_breakpoint_address (struct gdbarch *gdbarch, gdbarch_adjust_breakpoint_address_ftype *adjust_breakpoint_address); -typedef int (gdbarch_memory_insert_breakpoint_ftype) (struct bp_target_info *bp_tgt); +typedef int (gdbarch_memory_insert_breakpoint_ftype) (struct gdbarch *gdbarch, struct bp_target_info *bp_tgt); extern int gdbarch_memory_insert_breakpoint (struct gdbarch *gdbarch, struct bp_target_info *bp_tgt); extern void set_gdbarch_memory_insert_breakpoint (struct gdbarch *gdbarch, gdbarch_memory_insert_breakpoint_ftype *memory_insert_breakpoint); -typedef int (gdbarch_memory_remove_breakpoint_ftype) (struct bp_target_info *bp_tgt); +typedef int (gdbarch_memory_remove_breakpoint_ftype) (struct gdbarch *gdbarch, struct bp_target_info *bp_tgt); extern int gdbarch_memory_remove_breakpoint (struct gdbarch *gdbarch, struct bp_target_info *bp_tgt); extern void set_gdbarch_memory_remove_breakpoint (struct gdbarch *gdbarch, gdbarch_memory_remove_breakpoint_ftype *memory_remove_breakpoint); diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh index eda85af533..5e91d6e5f5 100755 --- a/gdb/gdbarch.sh +++ b/gdb/gdbarch.sh @@ -480,8 +480,8 @@ m:CORE_ADDR:skip_prologue:CORE_ADDR ip:ip:0:0 f:int:inner_than:CORE_ADDR lhs, CORE_ADDR rhs:lhs, rhs:0:0 m:const gdb_byte *:breakpoint_from_pc:CORE_ADDR *pcptr, int *lenptr:pcptr, lenptr::0: M:CORE_ADDR:adjust_breakpoint_address:CORE_ADDR bpaddr:bpaddr -f:int:memory_insert_breakpoint:struct bp_target_info *bp_tgt:bp_tgt:0:default_memory_insert_breakpoint::0 -f:int:memory_remove_breakpoint:struct bp_target_info *bp_tgt:bp_tgt:0:default_memory_remove_breakpoint::0 +m:int:memory_insert_breakpoint:struct bp_target_info *bp_tgt:bp_tgt:0:default_memory_insert_breakpoint::0 +m:int:memory_remove_breakpoint:struct bp_target_info *bp_tgt:bp_tgt:0:default_memory_remove_breakpoint::0 v:CORE_ADDR:decr_pc_after_break:::0:::0 # A function can be addressed by either it's "pointer" (possibly a diff --git a/gdb/ia64-tdep.c b/gdb/ia64-tdep.c index fb47cbacaf..b724dda721 100644 --- a/gdb/ia64-tdep.c +++ b/gdb/ia64-tdep.c @@ -553,7 +553,8 @@ fetch_instruction (CORE_ADDR addr, instruction_type *it, long long *instr) #define IA64_BREAKPOINT 0x00003333300LL static int -ia64_memory_insert_breakpoint (struct bp_target_info *bp_tgt) +ia64_memory_insert_breakpoint (struct gdbarch *gdbarch, + struct bp_target_info *bp_tgt) { CORE_ADDR addr = bp_tgt->placed_address; char bundle[BUNDLE_LEN]; @@ -588,7 +589,8 @@ ia64_memory_insert_breakpoint (struct bp_target_info *bp_tgt) } static int -ia64_memory_remove_breakpoint (struct bp_target_info *bp_tgt) +ia64_memory_remove_breakpoint (struct gdbarch *gdbarch, + struct bp_target_info *bp_tgt) { CORE_ADDR addr = bp_tgt->placed_address; char bundle[BUNDLE_LEN]; diff --git a/gdb/m32r-tdep.c b/gdb/m32r-tdep.c index 714a98cff3..8085b86fff 100644 --- a/gdb/m32r-tdep.c +++ b/gdb/m32r-tdep.c @@ -79,7 +79,8 @@ m32r_frame_align (struct gdbarch *gdbarch, CORE_ADDR sp) The following functions take care of this behavior. */ static int -m32r_memory_insert_breakpoint (struct bp_target_info *bp_tgt) +m32r_memory_insert_breakpoint (struct gdbarch *gdbarch, + struct bp_target_info *bp_tgt) { CORE_ADDR addr = bp_tgt->placed_address; int val; @@ -95,7 +96,7 @@ m32r_memory_insert_breakpoint (struct bp_target_info *bp_tgt) bp_tgt->placed_size = bp_tgt->shadow_len = 4; /* Determine appropriate breakpoint contents and size for this address. */ - if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG) + if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG) { if ((addr & 3) == 0) { @@ -136,7 +137,8 @@ m32r_memory_insert_breakpoint (struct bp_target_info *bp_tgt) } static int -m32r_memory_remove_breakpoint (struct bp_target_info *bp_tgt) +m32r_memory_remove_breakpoint (struct gdbarch *gdbarch, + struct bp_target_info *bp_tgt) { CORE_ADDR addr = bp_tgt->placed_address; int val; @@ -149,7 +151,7 @@ m32r_memory_remove_breakpoint (struct bp_target_info *bp_tgt) buf[3] = contents_cache[3]; /* Remove parallel bit. */ - if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG) + if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG) { if ((buf[0] & 0x80) == 0 && (buf[2] & 0x80) != 0) buf[2] &= 0x7f; diff --git a/gdb/mem-break.c b/gdb/mem-break.c index 8686493901..6f4f463630 100644 --- a/gdb/mem-break.c +++ b/gdb/mem-break.c @@ -41,7 +41,8 @@ BREAKPOINT_MAX). */ int -default_memory_insert_breakpoint (struct bp_target_info *bp_tgt) +default_memory_insert_breakpoint (struct gdbarch *gdbarch, + struct bp_target_info *bp_tgt) { int val; const unsigned char *bp; @@ -49,7 +50,7 @@ default_memory_insert_breakpoint (struct bp_target_info *bp_tgt) /* Determine appropriate breakpoint contents and size for this address. */ bp = gdbarch_breakpoint_from_pc - (current_gdbarch, &bp_tgt->placed_address, &bp_tgt->placed_size); + (gdbarch, &bp_tgt->placed_address, &bp_tgt->placed_size); if (bp == NULL) error (_("Software breakpoints not implemented for this target.")); @@ -68,7 +69,8 @@ default_memory_insert_breakpoint (struct bp_target_info *bp_tgt) int -default_memory_remove_breakpoint (struct bp_target_info *bp_tgt) +default_memory_remove_breakpoint (struct gdbarch *gdbarch, + struct bp_target_info *bp_tgt) { return target_write_memory (bp_tgt->placed_address, bp_tgt->shadow_contents, bp_tgt->placed_size); diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c index 4b35f7f109..872db01672 100644 --- a/gdb/ppc-linux-tdep.c +++ b/gdb/ppc-linux-tdep.c @@ -273,7 +273,8 @@ ppc_linux_skip_trampoline_code (struct frame_info *frame, CORE_ADDR pc) regard to removing breakpoints in some potentially self modifying code. */ int -ppc_linux_memory_remove_breakpoint (struct bp_target_info *bp_tgt) +ppc_linux_memory_remove_breakpoint (struct gdbarch *gdbarch, + struct bp_target_info *bp_tgt) { CORE_ADDR addr = bp_tgt->placed_address; const unsigned char *bp; @@ -282,7 +283,7 @@ ppc_linux_memory_remove_breakpoint (struct bp_target_info *bp_tgt) gdb_byte old_contents[BREAKPOINT_MAX]; /* Determine appropriate breakpoint contents and size for this address. */ - bp = gdbarch_breakpoint_from_pc (current_gdbarch, &addr, &bplen); + bp = gdbarch_breakpoint_from_pc (gdbarch, &addr, &bplen); if (bp == NULL) error (_("Software breakpoints not implemented for this target.")); diff --git a/gdb/ppc-tdep.h b/gdb/ppc-tdep.h index dfe589e750..50805ae0b3 100644 --- a/gdb/ppc-tdep.h +++ b/gdb/ppc-tdep.h @@ -54,7 +54,7 @@ CORE_ADDR ppc64_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR struct_addr); CORE_ADDR ppc64_sysv_abi_adjust_breakpoint_address (struct gdbarch *gdbarch, CORE_ADDR bpaddr); -int ppc_linux_memory_remove_breakpoint (struct bp_target_info *bp_tgt); +int ppc_linux_memory_remove_breakpoint (struct gdbarch *, struct bp_target_info *); struct link_map_offsets *ppc_linux_svr4_fetch_link_map_offsets (void); const struct regset *ppc_linux_gregset (int); const struct regset *ppc_linux_fpregset (void); diff --git a/gdb/target.h b/gdb/target.h index 3f332fda32..4a2236cbc3 100644 --- a/gdb/target.h +++ b/gdb/target.h @@ -1177,9 +1177,9 @@ extern int memory_remove_breakpoint (struct bp_target_info *); extern int memory_insert_breakpoint (struct bp_target_info *); -extern int default_memory_remove_breakpoint (struct bp_target_info *); +extern int default_memory_remove_breakpoint (struct gdbarch *, struct bp_target_info *); -extern int default_memory_insert_breakpoint (struct bp_target_info *); +extern int default_memory_insert_breakpoint (struct gdbarch *, struct bp_target_info *); /* From target.c */ -- 2.11.0