From: Hui Zhu <hui_zhu@mentor.com>
To: gdb-patches ml <gdb-patches@sourceware.org>
Subject: [PATCH] Let gdbserver doesn't tell GDB it support target-side breakpoint conditions and commands if it doesn't support 'Z' packet
Date: Mon, 21 Oct 2013 10:30:00 -0000 [thread overview]
Message-ID: <5265022F.8060203@mentor.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1334 bytes --]
We found that in powerpc arch board, it cannot pass some dprintf test:
FAIL: gdb.base/dprintf.exp: dprintf info 2 (pattern 6)
FAIL: gdb.mi/mi-dprintf.exp: mi expect stop (unknown output after running)
FAIL: gdb.mi/mi-dprintf.exp: mi 1st dprintf, agent (unknown output after running)
This because the gdbserver will always tell GDB that it support target-side breakpoint conditions and commands. So "set dprintf-style agent" will always got success.
But target-side breakpoint conditions and commands are depend on 'Z' packet because GDB just can post target-side breakpoint conditions and commands with 'Z' packet.
The test will check if "set dprintf-style agent" success or not. Because it will always succes. So GDB change the commands to agent-printf that will make test get fail.
So I make a patch to check if the low-target support insert_point before return support target-side breakpoint conditions and commands.
Tested in powerpc-linux target.
2013-10-21 Hui Zhu <yao@codesourcery.com>
* linux-low.c (linux_supports_insert_point): New.
(linux_target_op): Add linux_supports_insert_point.
* server.c (handle_query): Check target_supports_insert_point
before return support target-side breakpoint conditions and
commands.
* target.h (target_ops): Add supports_insert_point.
(target_supports_insert_point): New.
[-- Attachment #2: fix-dprintf.txt --]
[-- Type: text/plain, Size: 2222 bytes --]
--- a/gdb/gdbserver/linux-low.c
+++ b/gdb/gdbserver/linux-low.c
@@ -4929,6 +4929,15 @@ linux_supports_range_stepping (void)
return (*the_low_target.supports_range_stepping) ();
}
+static int
+linux_supports_insert_point (void)
+{
+ if (the_low_target.insert_point != NULL)
+ return 1;
+
+ return 0;
+}
+
/* Enumerate spufs IDs for process PID. */
static int
spu_enumerate_spu_ids (long pid, unsigned char *buf, CORE_ADDR offset, int len)
@@ -5825,6 +5834,7 @@ static struct target_ops linux_target_op
NULL,
#endif
linux_supports_range_stepping,
+ linux_supports_insert_point,
};
static void
--- a/gdb/gdbserver/server.c
+++ b/gdb/gdbserver/server.c
@@ -1806,9 +1806,16 @@ handle_query (char *own_buf, int packet_
strcat (own_buf, ";tracenz+");
}
- /* Support target-side breakpoint conditions and commands. */
- strcat (own_buf, ";ConditionalBreakpoints+");
- strcat (own_buf, ";BreakpointCommands+");
+ /* GDB will send target-side breakpoint conditions and commands packets
+ with insert point packets. So if target doesn't support insert
+ point, it should not support target-side breakpoint conditions
+ and commands packets. */
+ if (target_supports_insert_point ())
+ {
+ /* Support target-side breakpoint conditions and commands. */
+ strcat (own_buf, ";ConditionalBreakpoints+");
+ strcat (own_buf, ";BreakpointCommands+");
+ }
if (target_supports_agent ())
strcat (own_buf, ";QAgent+");
--- a/gdb/gdbserver/target.h
+++ b/gdb/gdbserver/target.h
@@ -365,6 +365,9 @@ struct target_ops
/* Return true if target supports range stepping. */
int (*supports_range_stepping) (void);
+
+ /* Return true if target supports insert_point. */
+ int (*supports_insert_point) (void);
};
extern struct target_ops *the_target;
@@ -504,6 +507,10 @@ int kill_inferior (int);
(the_target->supports_range_stepping ? \
(*the_target->supports_range_stepping) () : 0)
+#define target_supports_insert_point() \
+ (the_target->supports_insert_point ? \
+ (*the_target->supports_insert_point) () : 0)
+
/* Start non-stop mode, returns 0 on success, -1 on failure. */
int start_non_stop (int nonstop);
next reply other threads:[~2013-10-21 10:30 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-21 10:30 Hui Zhu [this message]
2013-10-21 15:37 ` Pedro Alves
2013-11-28 10:56 ` Hui Zhu
2013-11-28 17:38 ` Maciej W. Rozycki
2013-11-29 9:41 ` Hui Zhu
2013-11-29 15:27 ` [pushed] Plug target side conditions and commands leaks (was: Re: [PATCH] Let gdbserver doesn't tell GDB it support target-side breakpoint conditions and commands if it doesn't support 'Z' packet) Pedro Alves
2013-11-29 16:05 ` [PATCH] Let gdbserver doesn't tell GDB it support target-side breakpoint conditions and commands if it doesn't support 'Z' packet Pedro Alves
2013-12-02 12:45 ` Hui Zhu
2013-12-02 14:38 ` Pedro Alves
2013-12-03 4:50 ` Hui Zhu
2013-12-03 4:54 ` Hui Zhu
2013-12-06 19:29 ` Pedro Alves
2013-12-08 5:19 ` Hui Zhu
2013-12-08 8:34 ` Doug Evans
2013-12-08 14:18 ` Hui Zhu
2013-12-09 19:48 ` Pedro Alves
2013-12-09 21:07 ` Doug Evans
2013-12-10 17:34 ` Pedro Alves
2013-12-10 18:14 ` [PATCH] Eliminate UNSUPPORTED_ERROR Pedro Alves
2013-12-11 16:33 ` Doug Evans
2013-12-11 19:17 ` Pedro Alves
2013-12-12 4:23 ` Doug Evans
2013-12-12 10:23 ` Pedro Alves
2013-12-11 16:40 ` [PATCH] Let gdbserver doesn't tell GDB it support target-side breakpoint conditions and commands if it doesn't support 'Z' packet Doug Evans
2013-12-12 10:55 ` breakpoint.c:insert_bp_location: Constify local. (was: Re: [PATCH] Let gdbserver doesn't tell GDB it support target-side breakpoint conditions and commands if it doesn't support 'Z' packet) Pedro Alves
2013-12-12 12:55 ` [PATCH] Let gdbserver doesn't tell GDB it support target-side breakpoint conditions and commands if it doesn't support 'Z' packet Pedro Alves
2014-01-09 18:36 ` 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=5265022F.8060203@mentor.com \
--to=hui_zhu@mentor.com \
--cc=gdb-patches@sourceware.org \
/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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).