From: Aleksandar Ristovski <aristovski@qnx.com>
To: gdb-patches@sources.redhat.com
Subject: Re: [patch] gdbserver: Add support for Z0/Z1 packets
Date: Wed, 17 Jun 2009 01:35:00 -0000 [thread overview]
Message-ID: <h19h0q$u4m$1@ger.gmane.org> (raw)
In-Reply-To: <h19g9r$sht$2@ger.gmane.org>
[-- Attachment #1: Type: text/plain, Size: 572 bytes --]
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.
[-- Attachment #2: gdbserver-Z0Z1support-20090616.diff --]
[-- Type: text/x-patch, Size: 5775 bytes --]
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,
next prev parent reply other threads:[~2009-06-17 1:35 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-17 1:20 Aleksandar Ristovski
2009-06-17 1:35 ` Aleksandar Ristovski [this message]
2009-06-19 7:08 ` Doug Evans
2009-06-19 13:56 ` Aleksandar Ristovski
2009-06-20 22:01 ` Pedro Alves
2009-06-22 19:39 ` Aleksandar Ristovski
2009-06-22 22:46 ` Pedro Alves
2009-06-23 15:18 ` Aleksandar Ristovski
2009-06-23 15:59 ` Pedro Alves
2009-06-23 16:57 ` Aleksandar Ristovski
2009-06-24 18:51 ` Aleksandar Ristovski
2009-06-24 19:01 ` Doug Evans
2009-06-24 19:04 ` Aleksandar Ristovski
2009-06-24 19:10 ` Doug Evans
2009-06-24 19:10 ` Pedro Alves
2009-06-24 19:20 ` Aleksandar Ristovski
2009-06-24 19:28 ` Pedro Alves
2009-06-24 19:25 ` Aleksandar Ristovski
2009-06-25 22:18 ` Pedro Alves
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='h19h0q$u4m$1@ger.gmane.org' \
--to=aristovski@qnx.com \
--cc=gdb-patches@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox