aboutsummaryrefslogtreecommitdiff
path: root/gdb/remote.c
diff options
context:
space:
mode:
authorGrace Sainsbury <graces@redhat.com>2002-08-16 14:52:12 +0000
committerGrace Sainsbury <graces@redhat.com>2002-08-16 14:52:12 +0000
commitc8189ed1622f773021bcced903b71fed26727f09 (patch)
treef67fcaf04098707917e9ba346caed8a2878aa4ec /gdb/remote.c
parent86f5577900c142a05e29952714021a3804657174 (diff)
downloadgdb-c8189ed1622f773021bcced903b71fed26727f09.zip
gdb-c8189ed1622f773021bcced903b71fed26727f09.tar.gz
gdb-c8189ed1622f773021bcced903b71fed26727f09.tar.bz2
* remote.c (remote_insert_hw_breakpoint)
(remote_remove_hw_breakpoint): Fix calculation of length field for Z-packet.
Diffstat (limited to 'gdb/remote.c')
-rw-r--r--gdb/remote.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/gdb/remote.c b/gdb/remote.c
index 0c3f23a..de64cc0 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -4985,11 +4985,11 @@ remote_insert_hw_breakpoint (CORE_ADDR addr, char *shadow)
char *buf = alloca (rs->remote_packet_size);
char *p = buf;
- /* The length field should be set to soething so that the packet is
- well formed. */
+ /* The length field should be set to the size of a breakpoint
+ instruction. */
+
+ BREAKPOINT_FROM_PC (&addr, &len);
- len = strlen (shadow);
- len = len ? len : 1;
if (remote_protocol_Z[Z_PACKET_HARDWARE_BP].support == PACKET_DISABLE)
error ("Can't set hardware breakpoint without the '%s' (%s) packet\n",
remote_protocol_Z[Z_PACKET_HARDWARE_BP].name,
@@ -5026,8 +5026,12 @@ remote_remove_hw_breakpoint (CORE_ADDR addr, char *shadow)
struct remote_state *rs = get_remote_state ();
char *buf = alloca (rs->remote_packet_size);
char *p = buf;
-
- len = sizeof (shadow);
+
+ /* The length field should be set to the size of a breakpoint
+ instruction. */
+
+ BREAKPOINT_FROM_PC (&addr, &len);
+
if (remote_protocol_Z[Z_PACKET_HARDWARE_BP].support == PACKET_DISABLE)
error ("Can't clear hardware breakpoint without the '%s' (%s) packet\n",
remote_protocol_Z[Z_PACKET_HARDWARE_BP].name,