This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[rfc] Remove DEPRECATED_REMOTE_BREAKPOINT
- From: "Ulrich Weigand" <uweigand at de dot ibm dot com>
- To: gdb-patches at sourceware dot org
- Date: Wed, 28 Feb 2007 03:07:08 +0100 (CET)
- Subject: [rfc] Remove DEPRECATED_REMOTE_BREAKPOINT
Hello,
this patch removes DEPRECATED_REMOTE_BREAKPOINT and its big/little endian
variants. The macro is used if you need to use a different byte pattern
as breakpoint when using the remote target (as compared to the native target).
The only remaining user is tm-sh.h.
To remove the macro without changing the behaviour on SH, I've added a
check to sh_breakpoint_from_pc whether target_shortname is "remote",
and return the remote-specific breakpoint sequence in that case.
This is a bit weird, but there's some precedent for this method in
mips_breakpoint_from_pc, which also returns different byte patterns
depending on the value of target_shortname.
Tested by building a sh-netbsd cross-GDB.
I'd appreciate any feedback on this method -- did I overlook something
easier/better?
Bye,
Ulrich
ChangeLog:
* config/sh/tm-sh.h (DEPRECATED_BIG_REMOTE_BREAKPOINT,
DEPRECATED_LITTLE_REMOTE_BREAKPOINT): Remove.
* doc/gdbint.texinfo: Remove mention of DEPRECATED_REMOTE_BREAKPOINT,
DEPRECATED_BIG_REMOTE_BREAKPOINT, DEPRECATED_LITTLE_REMOTE_BREAKPOINT.
* remote.c: Remove code under #ifdef DEPRECATED_REMOTE_BREAKPOINT,
DEPRECATED_BIG_REMOTE_BREAKPOINT, DEPRECATED_LITTLE_REMOTE_BREAKPOINT.
* sh-tdep.c (sh_breakpoint_from_pc): Return remote breakpoint
sequence if target_shortname is "remote".
diff -ur gdb-orig/gdb/config/sh/tm-sh.h gdb-head/gdb/config/sh/tm-sh.h
--- gdb-orig/gdb/config/sh/tm-sh.h 2007-01-11 20:58:03.000000000 +0100
+++ gdb-head/gdb/config/sh/tm-sh.h 2007-02-28 02:35:36.420113032 +0100
@@ -23,7 +23,4 @@
#define NUM_REALREGS 59 /* used in remote-e7000.c which is not multiarched. */
-#define DEPRECATED_BIG_REMOTE_BREAKPOINT { 0xc3, 0x20 } /* Used in remote.c */
-#define DEPRECATED_LITTLE_REMOTE_BREAKPOINT { 0x20, 0xc3 } /* Used in remote.c */
-
/*#define NOP {0x20, 0x0b}*/ /* Who uses this???*/
diff -ur gdb-orig/gdb/doc/gdbint.texinfo gdb-head/gdb/doc/gdbint.texinfo
--- gdb-orig/gdb/doc/gdbint.texinfo 2007-02-22 16:00:08.000000000 +0100
+++ gdb-head/gdb/doc/gdbint.texinfo 2007-02-28 02:35:36.438110296 +0100
@@ -3321,18 +3321,6 @@
@code{BIG_BREAKPOINT} and @code{LITTLE_BREAKPOINT} have been deprecated in
favor of @code{BREAKPOINT_FROM_PC}.
-@item DEPRECATED_REMOTE_BREAKPOINT
-@itemx DEPRECATED_LITTLE_REMOTE_BREAKPOINT
-@itemx DEPRECATED_BIG_REMOTE_BREAKPOINT
-@findex DEPRECATED_BIG_REMOTE_BREAKPOINT
-@findex DEPRECATED_LITTLE_REMOTE_BREAKPOINT
-@findex DEPRECATED_REMOTE_BREAKPOINT
-Specify the breakpoint instruction sequence for a remote target.
-@code{DEPRECATED_REMOTE_BREAKPOINT},
-@code{DEPRECATED_BIG_REMOTE_BREAKPOINT} and
-@code{DEPRECATED_LITTLE_REMOTE_BREAKPOINT} have been deprecated in
-favor of @code{BREAKPOINT_FROM_PC} (@pxref{BREAKPOINT_FROM_PC}).
-
@item BREAKPOINT_FROM_PC (@var{pcptr}, @var{lenptr})
@findex BREAKPOINT_FROM_PC
@anchor{BREAKPOINT_FROM_PC} Use the program counter to determine the
diff -ur gdb-orig/gdb/remote.c gdb-head/gdb/remote.c
--- gdb-orig/gdb/remote.c 2007-02-27 22:13:38.852048000 +0100
+++ gdb-head/gdb/remote.c 2007-02-28 02:35:36.489102544 +0100
@@ -5108,35 +5108,6 @@
}
-/* On some machines, e.g. 68k, we may use a different breakpoint
- instruction than other targets; in those use
- DEPRECATED_REMOTE_BREAKPOINT instead of just BREAKPOINT_FROM_PC.
- Also, bi-endian targets may define
- DEPRECATED_LITTLE_REMOTE_BREAKPOINT and
- DEPRECATED_BIG_REMOTE_BREAKPOINT. If none of these are defined, we
- just call the standard routines that are in mem-break.c. */
-
-/* NOTE: cagney/2003-06-08: This is silly. A remote and simulator
- target should use an identical BREAKPOINT_FROM_PC. As for native,
- the ARCH-OS-tdep.c code can override the default. */
-
-#if defined (DEPRECATED_LITTLE_REMOTE_BREAKPOINT) && defined (DEPRECATED_BIG_REMOTE_BREAKPOINT) && !defined(DEPRECATED_REMOTE_BREAKPOINT)
-#define DEPRECATED_REMOTE_BREAKPOINT
-#endif
-
-#ifdef DEPRECATED_REMOTE_BREAKPOINT
-
-/* If the target isn't bi-endian, just pretend it is. */
-#if !defined (DEPRECATED_LITTLE_REMOTE_BREAKPOINT) && !defined (DEPRECATED_BIG_REMOTE_BREAKPOINT)
-#define DEPRECATED_LITTLE_REMOTE_BREAKPOINT DEPRECATED_REMOTE_BREAKPOINT
-#define DEPRECATED_BIG_REMOTE_BREAKPOINT DEPRECATED_REMOTE_BREAKPOINT
-#endif
-
-static unsigned char big_break_insn[] = DEPRECATED_BIG_REMOTE_BREAKPOINT;
-static unsigned char little_break_insn[] = DEPRECATED_LITTLE_REMOTE_BREAKPOINT;
-
-#endif /* DEPRECATED_REMOTE_BREAKPOINT */
-
/* Insert a breakpoint. On targets that have software breakpoint
support, we ask the remote target to do the work; on targets
which don't, we insert a traditional memory breakpoint. */
@@ -5146,9 +5117,6 @@
{
CORE_ADDR addr = bp_tgt->placed_address;
struct remote_state *rs = get_remote_state ();
-#ifdef DEPRECATED_REMOTE_BREAKPOINT
- int val;
-#endif
/* Try the "Z" s/w breakpoint packet if it is not already disabled.
If it succeeds, then set the support to PACKET_ENABLE. If it
@@ -5181,24 +5149,7 @@
}
}
-#ifdef DEPRECATED_REMOTE_BREAKPOINT
- bp_tgt->placed_size = bp_tgt->shadow_len = sizeof big_break_insn;
- val = target_read_memory (addr, bp_tgt->shadow_contents, bp_tgt->shadow_len);
-
- if (val == 0)
- {
- if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
- val = target_write_memory (addr, (char *) big_break_insn,
- sizeof big_break_insn);
- else
- val = target_write_memory (addr, (char *) little_break_insn,
- sizeof little_break_insn);
- }
-
- return val;
-#else
return memory_insert_breakpoint (bp_tgt);
-#endif /* DEPRECATED_REMOTE_BREAKPOINT */
}
static int
@@ -5226,12 +5177,7 @@
return (rs->buf[0] == 'E');
}
-#ifdef DEPRECATED_REMOTE_BREAKPOINT
- return target_write_memory (bp_tgt->placed_address, bp_tgt->shadow_contents,
- bp_tgt->shadow_len);
-#else
return memory_remove_breakpoint (bp_tgt);
-#endif /* DEPRECATED_REMOTE_BREAKPOINT */
}
static int
diff -ur gdb-orig/gdb/sh-tdep.c gdb-head/gdb/sh-tdep.c
--- gdb-orig/gdb/sh-tdep.c 2007-02-27 22:13:38.975029000 +0100
+++ gdb-head/gdb/sh-tdep.c 2007-02-28 02:35:36.534095704 +0100
@@ -389,6 +389,24 @@
/* 0xc3c3 is trapa #c3, and it works in big and little endian modes */
static unsigned char breakpoint[] = { 0xc3, 0xc3 };
+ /* For remote stub targets, trapa #20 is used. */
+ if (strcmp (target_shortname, "remote") == 0)
+ {
+ static unsigned char big_remote_breakpoint[] = { 0xc3, 0x20 };
+ static unsigned char little_remote_breakpoint[] = { 0x20, 0xc3 };
+
+ if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
+ {
+ *lenptr = sizeof (big_remote_breakpoint);
+ return big_remote_breakpoint;
+ }
+ else
+ {
+ *lenptr = sizeof (little_remote_breakpoint);
+ return little_remote_breakpoint;
+ }
+ }
+
*lenptr = sizeof (breakpoint);
return breakpoint;
}
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com