Re: patch for invalid hw breakpoints

Nathan Sidwell
2006-06-05T14:30:57Z

[-- Attachment #1: Type: text/plain, Size: 451 bytes --]

Eli Zaretskii wrote:
>>Date: Thu, 1 Jun 2006 17:11:59 -0400
>>From: Daniel Jacobowitz <drow@false.org>
>>Cc: Nathan Sidwell <nathan@codesourcery.com>, gdb-patches@sourceware.org
>>

>
> Indeed. But I think remote.c shouldn't throw an internal error in
> such cases.

This patch ok?

nathan
--
Nathan Sidwell :: http://www.codesourcery.com :: CodeSourcery
nathan@codesourcery.com :: http://www.planetfall.pwp.blueyonder.co.uk

[-- Attachment #2: remote-1.patch --]
[-- Type: text/x-patch, Size: 3301 bytes --]

2006-06-05 Nathan Sidwell <nathan@codesourcery.com>

* gdb/remote.c (remote_insert_watchpoint): Return -1, rather than
fatal error if packet is disabled.
(remote_remove_watchpoint, remote_insert_hw_breakpoint,
remote_remove_hw_breakpoint): Likewise.

Index: gdb/remote.c
===================================================================
RCS file: /cvs/src/src/gdb/remote.c,v
retrieving revision 1.202.2.4
diff -c -3 -p -r1.202.2.4 remote.c
*** gdb/remote.c 24 May 2006 08:00:02 -0000 1.202.2.4
--- gdb/remote.c 5 Jun 2006 14:26:11 -0000
*************** remote_insert_watchpoint (CORE_ADDR addr
*** 4670,4678 ****
enum Z_packet_type packet = watchpoint_to_Z_packet (type);

if (remote_protocol_packets[PACKET_Z0 + packet].support == PACKET_DISABLE)
! error (_("Can't set hardware watchpoints without the '%s' (%s) packet."),
! remote_protocol_packets[PACKET_Z0 + packet].name,
! remote_protocol_packets[PACKET_Z0 + packet].title);

sprintf (buf, "Z%x,", packet);
p = strchr (buf, '\0');
--- 4670,4676 ----
enum Z_packet_type packet = watchpoint_to_Z_packet (type);

if (remote_protocol_packets[PACKET_Z0 + packet].support == PACKET_DISABLE)
! return -1;

sprintf (buf, "Z%x,", packet);
p = strchr (buf, '\0');
*************** remote_remove_watchpoint (CORE_ADDR addr
*** 4705,4714 ****
enum Z_packet_type packet = watchpoint_to_Z_packet (type);

if (remote_protocol_packets[PACKET_Z0 + packet].support == PACKET_DISABLE)
! error (_("Can't clear hardware watchpoints without the '%s' (%s) packet."),
! remote_protocol_packets[PACKET_Z0 + packet].name,
! remote_protocol_packets[PACKET_Z0 + packet].title);
!
sprintf (buf, "z%x,", packet);
p = strchr (buf, '\0');
addr = remote_address_masked (addr);
--- 4703,4710 ----
enum Z_packet_type packet = watchpoint_to_Z_packet (type);

if (remote_protocol_packets[PACKET_Z0 + packet].support == PACKET_DISABLE)
! return -1;
!
sprintf (buf, "z%x,", packet);
p = strchr (buf, '\0');
addr = remote_address_masked (addr);
*************** remote_insert_hw_breakpoint (CORE_ADDR a
*** 4796,4805 ****
BREAKPOINT_FROM_PC (&addr, &len);

if (remote_protocol_packets[PACKET_Z1].support == PACKET_DISABLE)
! error (_("Can't set hardware breakpoint without the '%s' (%s) packet."),
! remote_protocol_packets[PACKET_Z1].name,
! remote_protocol_packets[PACKET_Z1].title);
!
*(p++) = 'Z';
*(p++) = '1';
*(p++) = ',';
--- 4792,4799 ----
BREAKPOINT_FROM_PC (&addr, &len);

if (remote_protocol_packets[PACKET_Z1].support == PACKET_DISABLE)
! return -1;
!
*(p++) = 'Z';
*(p++) = '1';
*(p++) = ',';
*************** remote_remove_hw_breakpoint (CORE_ADDR a
*** 4838,4846 ****
BREAKPOINT_FROM_PC (&addr, &len);

if (remote_protocol_packets[PACKET_Z1].support == PACKET_DISABLE)
! error (_("Can't clear hardware breakpoint without the '%s' (%s) packet."),
! remote_protocol_packets[PACKET_Z1].name,
! remote_protocol_packets[PACKET_Z1].title);

*(p++) = 'z';
*(p++) = '1';
--- 4832,4838 ----
BREAKPOINT_FROM_PC (&addr, &len);

if (remote_protocol_packets[PACKET_Z1].support == PACKET_DISABLE)
! return -1;

*(p++) = 'z';
*(p++) = '1';