This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[rfc] [1/4] Remove macro BREAKPOINT_FROM_PC
- From: Markus Deuling <deuling at de dot ibm dot com>
- To: GDB Patches <gdb-patches at sourceware dot org>
- Cc: Ulrich Weigand <uweigand at de dot ibm dot com>
- Date: Wed, 13 Jun 2007 19:22:03 +0200
- Subject: [rfc] [1/4] Remove macro BREAKPOINT_FROM_PC
Hello,
this patch removes BREAKPOINT_FROM_PC macro from gdbarch.sh
ChangeLog:
* gdbarch.sh (BREAKPOINT_FROM_PC): Replace by
gdbarch_breakpoint_from_pc.
* s390-tdep.c (s390_gdbarch_init): Likewise (comment).
* remote.c (remote_insert_breakpoint)
(remote_insert_hw_breakpoint): Likewise.
* ppc-linux-tdep.c (ppc_linux_memory_remove_breakpoint): Likewise.
* mips-tdep.c (mips_breakpoint_from_pc): Likewise (comment).
* breakpoint.h (bp_target_info): Likewise (comment).
* breakpoint.c (read_memory_nobpt): Likewise.
* mem-break.c (default_memory_insert_breakpoint): Likewise.
(symtab.h, breakpoint.h): Remove include. Remove unnecessary comment.
* gdbarch.c, gdbarch.h: Regenerate.
Is this ok to commit ?
--
Markus Deuling
GNU Toolchain for Linux on Cell BE
deuling@de.ibm.com
diff -urN src/gdb/breakpoint.c dev/gdb/breakpoint.c
--- src/gdb/breakpoint.c 2007-06-08 05:38:50.000000000 +0200
+++ dev/gdb/breakpoint.c 2007-06-13 17:10:12.000000000 +0200
@@ -706,7 +706,7 @@
CORE_ADDR bp_addr = 0;
int bp_size = 0;
- if (BREAKPOINT_FROM_PC (&bp_addr, &bp_size) == NULL)
+ if (gdbarch_breakpoint_from_pc (current_gdbarch, &bp_addr, &bp_size) == NULL)
/* No breakpoints on this machine. */
return target_read_memory (memaddr, myaddr, len);
diff -urN src/gdb/breakpoint.h dev/gdb/breakpoint.h
--- src/gdb/breakpoint.h 2007-06-06 05:21:54.000000000 +0200
+++ dev/gdb/breakpoint.h 2007-06-13 17:10:12.000000000 +0200
@@ -188,7 +188,7 @@
{
/* Address at which the breakpoint was placed. This is normally the
same as ADDRESS from the bp_location, except when adjustment
- happens in BREAKPOINT_FROM_PC. The most common form of
+ happens in gdbarch_breakpoint_from_pc. The most common form of
adjustment is stripping an alternate ISA marker from the PC which
is used to determine the type of breakpoint to insert. */
CORE_ADDR placed_address;
@@ -203,7 +203,7 @@
int shadow_len;
/* The size of the placed breakpoint, according to
- BREAKPOINT_FROM_PC, when the breakpoint was inserted. This is
+ gdbarch_breakpoint_from_pc, when the breakpoint was inserted. This is
generally the same as SHADOW_LEN, unless we did not need
to read from the target to implement the memory breakpoint
(e.g. if a remote stub handled the details). We may still
diff -urN src/gdb/gdbarch.c dev/gdb/gdbarch.c
--- src/gdb/gdbarch.c 2007-06-13 16:16:37.000000000 +0200
+++ dev/gdb/gdbarch.c 2007-06-13 17:10:12.000000000 +0200
@@ -712,12 +712,6 @@
fprintf_unfiltered (file,
"gdbarch_dump: bfd_vma_bit = %s\n",
paddr_d (current_gdbarch->bfd_vma_bit));
-#ifdef BREAKPOINT_FROM_PC
- fprintf_unfiltered (file,
- "gdbarch_dump: %s # %s\n",
- "BREAKPOINT_FROM_PC(pcptr, lenptr)",
- XSTRING (BREAKPOINT_FROM_PC (pcptr, lenptr)));
-#endif
fprintf_unfiltered (file,
"gdbarch_dump: breakpoint_from_pc = <0x%lx>\n",
(long) current_gdbarch->breakpoint_from_pc);
diff -urN src/gdb/gdbarch.h dev/gdb/gdbarch.h
--- src/gdb/gdbarch.h 2007-06-13 16:16:37.000000000 +0200
+++ dev/gdb/gdbarch.h 2007-06-13 17:10:12.000000000 +0200
@@ -557,12 +557,6 @@
typedef const gdb_byte * (gdbarch_breakpoint_from_pc_ftype) (CORE_ADDR *pcptr, int *lenptr);
extern const gdb_byte * gdbarch_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr, int *lenptr);
extern void set_gdbarch_breakpoint_from_pc (struct gdbarch *gdbarch, gdbarch_breakpoint_from_pc_ftype *breakpoint_from_pc);
-#if !defined (GDB_TM_FILE) && defined (BREAKPOINT_FROM_PC)
-#error "Non multi-arch definition of BREAKPOINT_FROM_PC"
-#endif
-#if !defined (BREAKPOINT_FROM_PC)
-#define BREAKPOINT_FROM_PC(pcptr, lenptr) (gdbarch_breakpoint_from_pc (current_gdbarch, pcptr, lenptr))
-#endif
extern int gdbarch_adjust_breakpoint_address_p (struct gdbarch *gdbarch);
diff -urN src/gdb/gdbarch.sh dev/gdb/gdbarch.sh
--- src/gdb/gdbarch.sh 2007-06-13 16:16:37.000000000 +0200
+++ dev/gdb/gdbarch.sh 2007-06-13 17:10:12.000000000 +0200
@@ -543,7 +543,7 @@
#
f::CORE_ADDR:skip_prologue:CORE_ADDR ip:ip:0:0
f::int:inner_than:CORE_ADDR lhs, CORE_ADDR rhs:lhs, rhs:0:0
-f:=:const gdb_byte *:breakpoint_from_pc:CORE_ADDR *pcptr, int *lenptr:pcptr, lenptr::0:
+f::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
diff -urN src/gdb/mem-break.c dev/gdb/mem-break.c
--- src/gdb/mem-break.c 2007-06-11 11:31:58.000000000 +0200
+++ dev/gdb/mem-break.c 2007-06-13 17:10:13.000000000 +0200
@@ -50,7 +50,8 @@
int bplen;
/* Determine appropriate breakpoint contents and size for this address. */
- bp = BREAKPOINT_FROM_PC (&bp_tgt->placed_address, &bp_tgt->placed_size);
+ bp = gdbarch_breakpoint_from_pc
+ (current_gdbarch, &bp_tgt->placed_address, &bp_tgt->placed_size);
if (bp == NULL)
error (_("Software breakpoints not implemented for this target."));
diff -urN src/gdb/mips-tdep.c dev/gdb/mips-tdep.c
--- src/gdb/mips-tdep.c 2007-06-11 11:31:58.000000000 +0200
+++ dev/gdb/mips-tdep.c 2007-06-13 17:10:13.000000000 +0200
@@ -4381,12 +4381,12 @@
return print_insn_little_mips (memaddr, info);
}
-/* This function implements the BREAKPOINT_FROM_PC macro. It uses the program
- counter value to determine whether a 16- or 32-bit breakpoint should be
- used. It returns a pointer to a string of bytes that encode a breakpoint
- instruction, stores the length of the string to *lenptr, and adjusts pc
- (if necessary) to point to the actual memory location where the
- breakpoint should be inserted. */
+/* This function implements gdbarch_breakpoint_from_pc. It uses the program
+ counter value to determine whether a 16- or 32-bit breakpoint should be used.
+ It returns a pointer to a string of bytes that encode a breakpoint
+ instruction, stores the length of the string to *lenptr, and adjusts pc (if
+ necessary) to point to the actual memory location where the breakpoint
+ should be inserted. */
static const gdb_byte *
mips_breakpoint_from_pc (CORE_ADDR *pcptr, int *lenptr)
diff -urN src/gdb/ppc-linux-tdep.c dev/gdb/ppc-linux-tdep.c
--- src/gdb/ppc-linux-tdep.c 2007-06-04 05:41:42.000000000 +0200
+++ dev/gdb/ppc-linux-tdep.c 2007-06-13 17:10:13.000000000 +0200
@@ -329,7 +329,7 @@
gdb_byte old_contents[BREAKPOINT_MAX];
/* Determine appropriate breakpoint contents and size for this address. */
- bp = BREAKPOINT_FROM_PC (&addr, &bplen);
+ bp = gdbarch_breakpoint_from_pc (current_gdbarch, &addr, &bplen);
if (bp == NULL)
error (_("Software breakpoints not implemented for this target."));
diff -urN src/gdb/remote.c dev/gdb/remote.c
--- src/gdb/remote.c 2007-06-13 16:52:50.000000000 +0200
+++ dev/gdb/remote.c 2007-06-13 17:10:13.000000000 +0200
@@ -5128,7 +5128,8 @@
*(p++) = 'Z';
*(p++) = '0';
*(p++) = ',';
- BREAKPOINT_FROM_PC (&bp_tgt->placed_address, &bp_tgt->placed_size);
+ gdbarch_breakpoint_from_pc
+ (current_gdbarch, &bp_tgt->placed_address, &bp_tgt->placed_size);
addr = (ULONGEST) remote_address_masked (bp_tgt->placed_address);
p += hexnumstr (p, addr);
sprintf (p, ",%d", bp_tgt->placed_size);
@@ -5323,7 +5324,8 @@
/* The length field should be set to the size of a breakpoint
instruction, even though we aren't inserting one ourselves. */
- BREAKPOINT_FROM_PC (&bp_tgt->placed_address, &bp_tgt->placed_size);
+ gdbarch_breakpoint_from_pc
+ (current_gdbarch, &bp_tgt->placed_address, &bp_tgt->placed_size);
if (remote_protocol_packets[PACKET_Z1].support == PACKET_DISABLE)
return -1;
diff -urN src/gdb/s390-tdep.c dev/gdb/s390-tdep.c
--- src/gdb/s390-tdep.c 2007-02-27 21:17:19.000000000 +0100
+++ dev/gdb/s390-tdep.c 2007-06-13 17:10:13.000000000 +0200
@@ -2374,7 +2374,7 @@
set_gdbarch_char_signed (gdbarch, 0);
/* Amount PC must be decremented by after a breakpoint. This is
- often the number of bytes returned by BREAKPOINT_FROM_PC but not
+ often the number of bytes returned by gdbarch_breakpoint_from_pc but not
always. */
set_gdbarch_decr_pc_after_break (gdbarch, 2);
/* Stack grows downward. */