From: markus.t.metzger@intel.com
To: jan.kratochvil@redhat.com
Cc: gdb-patches@sourceware.org, markus.t.metzger@gmail.com,
Markus Metzger <markus.t.metzger@intel.com>
Subject: [rfc] remote, btrace: add branch tracing protocol to Qbtrace packet
Date: Fri, 22 Feb 2013 15:23:00 -0000 [thread overview]
Message-ID: <1361546562-26827-1-git-send-email-markus.t.metzger@intel.com> (raw)
From: Markus Metzger <markus.t.metzger@intel.com>
We might want to add support for LBR branch tracing in the future.
To prepare for this, I would specify the branch trace recording method
in the Qbtrace packet when requesting branch tracing.
The supported branch trace recording methods will further be listed
in response to a QSupported packet.
The patch works but I'm not sure whether it is in the spirit of
the remote serial protocol.
This patch does not enable GDB to support different recording methods.
GDB still only supports BTS-based branch trace recording.
But I hope this will avoid having to change the remote serial protocol
later on when we want to add the new recording method.
2013-02-22 Markus Metzger <markus.t.metzger@intel.com>
---
gdb/doc/gdb.texinfo | 10 +++++++---
gdb/gdbserver/server.c | 6 +++---
gdb/remote.c | 4 ++--
3 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index d6842f1..ec934a5 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -37570,7 +37570,10 @@ rather than reporting the hit to @value{GDBN}.
The remote stub understands the @samp{qbtrace} packet.
@item Qbtrace
-The remote stub understands the @samp{Qbtrace} packet.
+The remote stub understands the @samp{Qbtrace} packet. The branch
+trace recording method will be specified after the packet name
+separated by a single colon (@code{:}). There will be one entry for
+each supported branch trace recording method.
@end table
@@ -37951,8 +37954,9 @@ No new branch trace data is available.
A badly formed request or an error was encountered.
@end table
-@item Qbtrace:on
-Enable branch tracing for the current thread.
+@item Qbtrace:@var{method}
+Enable branch tracing for the current thread using the @var{method}
+branch trace recording method.
Reply:
@table @samp
diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c
index c335af7..debef5d 100644
--- a/gdb/gdbserver/server.c
+++ b/gdb/gdbserver/server.c
@@ -463,12 +463,12 @@ handle_btrace_general_set (char *own_buf)
err = NULL;
- if (strcmp (op, "on") == 0)
+ if (strcmp (op, "bts") == 0)
err = handle_btrace_enable (thread);
else if (strcmp (op, "off") == 0)
err = handle_btrace_disable (thread);
else
- err = "E.Bad Qbtrace operation. Use on or off.";
+ err = "E.Bad Qbtrace operation. Use bts or off.";
if (err != 0)
strcpy (own_buf, err);
@@ -1828,7 +1828,7 @@ handle_query (char *own_buf, int packet_len, int *new_packet_len_p)
if (target_supports_btrace ())
{
strcat (own_buf, ";qbtrace+");
- strcat (own_buf, ";Qbtrace+");
+ strcat (own_buf, ";Qbtrace:bts+");
strcat (own_buf, ";qXfer:btrace:read+");
}
diff --git a/gdb/remote.c b/gdb/remote.c
index 6f95125..2322ece 100755
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -11164,7 +11164,7 @@ send_Qbtrace (ptid_t ptid, int enable)
set_general_thread (ptid);
buf += xsnprintf (buf, endbuf - buf, "%s:", packet->name);
- buf += xsnprintf (buf, endbuf - buf, enable ? "on" : "off");
+ buf += xsnprintf (buf, endbuf - buf, enable ? "bts" : "off");
putpkt (rs->buf);
getpkt (&rs->buf, &rs->buf_size, 0);
@@ -11928,7 +11928,7 @@ Show the maximum size of the address (in bits) in a memory packet."), NULL,
"qbtrace", "query-btrace", 0);
add_packet_config_cmd (&remote_protocol_packets[PACKET_Qbtrace],
- "Qbtrace", "enable-btrace", 0);
+ "Qbtrace:bts", "enable-btrace", 0);
add_packet_config_cmd (&remote_protocol_packets[PACKET_qXfer_btrace],
"qXfer:btrace", "read-btrace", 0);
--
1.7.1
next reply other threads:[~2013-02-22 15:23 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-22 15:23 markus.t.metzger [this message]
2013-02-22 15:51 ` Eli Zaretskii
2013-02-25 8:51 ` Metzger, Markus T
2013-02-25 9:08 ` Jan Kratochvil
2013-02-25 9:13 ` FW: " Metzger, Markus T
2013-02-25 20:33 ` Pedro Alves
2013-02-26 9:24 ` Metzger, Markus T
2013-02-27 16:48 ` Jan Kratochvil
2013-02-28 9:19 ` Metzger, Markus T
2013-02-28 11:31 ` Jan Kratochvil
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=1361546562-26827-1-git-send-email-markus.t.metzger@intel.com \
--to=markus.t.metzger@intel.com \
--cc=gdb-patches@sourceware.org \
--cc=jan.kratochvil@redhat.com \
--cc=markus.t.metzger@gmail.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