From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24972 invoked by alias); 17 Jun 2009 01:35:16 -0000 Received: (qmail 24959 invoked by uid 22791); 17 Jun 2009 01:35:15 -0000 X-SWARE-Spam-Status: No, hits=-3.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org Received: from main.gmane.org (HELO ciao.gmane.org) (80.91.229.2) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 17 Jun 2009 01:35:05 +0000 Received: from root by ciao.gmane.org with local (Exim 4.43) id 1MGk3K-0008BE-QO for gdb-patches@sources.redhat.com; Wed, 17 Jun 2009 01:35:02 +0000 Received: from cpe0019e26b2db7-cm001692f4e452.cpe.net.cable.rogers.com ([99.224.129.49]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 17 Jun 2009 01:35:02 +0000 Received: from aristovski by cpe0019e26b2db7-cm001692f4e452.cpe.net.cable.rogers.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 17 Jun 2009 01:35:02 +0000 To: gdb-patches@sources.redhat.com From: Aleksandar Ristovski Subject: Re: [patch] gdbserver: Add support for Z0/Z1 packets Date: Wed, 17 Jun 2009 01:35:00 -0000 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------090807050204020705020105" User-Agent: Thunderbird 2.0.0.21 (Windows/20090302) In-Reply-To: X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2009-06/txt/msg00428.txt.bz2 This is a multi-part message in MIME format. --------------090807050204020705020105 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 572 Aleksandar Ristovski wrote: > Hello, > > This adds support for Z0 and Z1 (and z0 and z1) packets. > I apologize, the patch should be this one. Change log corrected as well. -- Aleksandar Ristovski QNX Software Systems ChangeLog: * target.h (insert_breakpoint, remove_breakpoint): New target functions. * server.c (process_serial_event): 'Z' and 'z' packet - add support for [Zz]0 and [Zz]1 - software and hardware breakpoints. * linux-low.c (linux_target_ops): Add new fields. * spu-low.c (spu_target_ops): Likewise. * win32-low.c (win32_target_ops): Likewise. --------------090807050204020705020105 Content-Type: text/x-patch; name="gdbserver-Z0Z1support-20090616.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="gdbserver-Z0Z1support-20090616.diff" Content-length: 5775 Index: target.h =================================================================== RCS file: /cvs/src/src/gdb/gdbserver/target.h,v retrieving revision 1.36 diff -u -p -r1.36 target.h --- target.h 1 Apr 2009 22:50:24 -0000 1.36 +++ target.h 17 Jun 2009 01:11:04 -0000 @@ -228,6 +228,14 @@ struct target_ops int (*stopped_by_watchpoint) (void); + /* Insert and remove breakpoint. Argument TYPE can be: + '0' = software-breakpoint + '1' = hardware-breakpoint + Returns 0 if successful, 1 otherwise. */ + + int (*insert_breakpoint) (char type, CORE_ADDR addr); + int (*remove_breakpoint) (char type, CORE_ADDR addr); + /* Returns the address associated with the watchpoint that hit, if any; returns 0 otherwise. */ Index: server.c =================================================================== RCS file: /cvs/src/src/gdb/gdbserver/server.c,v retrieving revision 1.97 diff -u -p -r1.97 server.c --- server.c 24 May 2009 21:06:53 -0000 1.97 +++ server.c 17 Jun 2009 01:11:05 -0000 @@ -2373,28 +2374,48 @@ process_serial_event (void) CORE_ADDR addr = strtoul (&own_buf[3], &lenptr, 16); int len = strtol (lenptr + 1, &dataptr, 16); char type = own_buf[1]; + int res = -1; + + /* Type: '0' - software-breakpoint + '1' - hardware-breakpoint + '2' - write watchpoint + '3' - read watchpoint + '4' - access watchpoint */ - if (the_target->insert_watchpoint == NULL - || (type < '2' || type > '4')) + if (type < '2' && type >= '0') { - /* No watchpoint support or not a watchpoint command; - unrecognized either way. */ - own_buf[0] = '\0'; + /* Insert breakpoint. */ + if (the_target->insert_breakpoint == NULL) + { + /* Not supported. */ + own_buf[0] = '\0'; + res = 1; + } + else + res = (*the_target->insert_breakpoint) (type, addr); } else { - int res; - - require_running (own_buf); - res = (*the_target->insert_watchpoint) (type, addr, len); - if (res == 0) - write_ok (own_buf); - else if (res == 1) - /* Unsupported. */ - own_buf[0] = '\0'; + if (the_target->insert_watchpoint == NULL) + { + /* No watchpoint support or not a watchpoint command; + unrecognized either way. */ + own_buf[0] = '\0'; + res = 1; + } else - write_enn (own_buf); + { + require_running (own_buf); + res = (*the_target->insert_watchpoint) (type, addr, len); + } } + if (res == 0) + write_ok (own_buf); + else if (res == 1) + /* Unsupported. */ + own_buf[0] = '\0'; + else + write_enn (own_buf); break; } case 'z': @@ -2404,28 +2425,48 @@ process_serial_event (void) CORE_ADDR addr = strtoul (&own_buf[3], &lenptr, 16); int len = strtol (lenptr + 1, &dataptr, 16); char type = own_buf[1]; + int res = -1; - if (the_target->remove_watchpoint == NULL - || (type < '2' || type > '4')) + /* Type: '0' - software-breakpoint + '1' - hardware-breakpoint + '2' - write watchpoint + '3' - read watchpoint + '4' - access watchpoint */ + + if (type < '2' && type >= '0') { - /* No watchpoint support or not a watchpoint command; - unrecognized either way. */ - own_buf[0] = '\0'; + /* Remove breakpoint. */ + if (the_target->remove_breakpoint == NULL) + { + /* Not supported. */ + own_buf[0] = '\0'; + res = 1; + } + else + res = (*the_target->remove_breakpoint) (type, addr); } else { - int res; - - require_running (own_buf); - res = (*the_target->remove_watchpoint) (type, addr, len); - if (res == 0) - write_ok (own_buf); - else if (res == 1) - /* Unsupported. */ - own_buf[0] = '\0'; + if (the_target->remove_watchpoint == NULL) + { + /* No watchpoint support or not a watchpoint command; + unrecognized either way. */ + own_buf[0] = '\0'; + res = 1; + } else - write_enn (own_buf); + { + require_running (own_buf); + res = (*the_target->remove_watchpoint) (type, addr, len); + } } + if (res == 0) + write_ok (own_buf); + else if (res == 1) + /* Unsupported. */ + own_buf[0] = '\0'; + else + write_enn (own_buf); break; } case 'k': Index: linux-low.c =================================================================== RCS file: /cvs/src/src/gdb/gdbserver/linux-low.c,v retrieving revision 1.105 diff -u -p -r1.105 linux-low.c --- linux-low.c 24 May 2009 17:44:19 -0000 1.105 +++ linux-low.c 17 Jun 2009 01:11:05 -0000 @@ -3027,6 +3027,8 @@ static struct target_ops linux_target_op linux_insert_watchpoint, linux_remove_watchpoint, linux_stopped_by_watchpoint, + NULL, /* insert_breakpoint */ + NULL, /* remove_breakpoint */ linux_stopped_data_address, #if defined(__UCLIBC__) && defined(HAS_NOMMU) linux_read_offsets, Index: spu-low.c =================================================================== RCS file: /cvs/src/src/gdb/gdbserver/spu-low.c,v retrieving revision 1.24 diff -u -p -r1.24 spu-low.c --- spu-low.c 3 Apr 2009 14:38:39 -0000 1.24 +++ spu-low.c 17 Jun 2009 01:11:05 -0000 @@ -615,6 +615,8 @@ static struct target_ops spu_target_ops NULL, NULL, NULL, + NULL, /* insert_breakpoint */ + NULL, /* remove_breakpoint */ NULL, NULL, NULL, Index: win32-low.c =================================================================== RCS file: /cvs/src/src/gdb/gdbserver/win32-low.c,v retrieving revision 1.35 diff -u -p -r1.35 win32-low.c --- win32-low.c 1 Apr 2009 22:50:24 -0000 1.35 +++ win32-low.c 17 Jun 2009 01:11:05 -0000 @@ -1700,6 +1700,8 @@ static struct target_ops win32_target_op NULL, NULL, NULL, + NULL, /* insert_breakpoint */ + NULL, /* remove_breakpoint */ NULL, NULL, NULL, --------------090807050204020705020105--