From: Zied Guermazi <zied.guermazi@trande.de>
To: gdb-patches@sourceware.org
Cc: Zied Guermazi <zied.guermazi@trande.de>
Subject: [PATCH 8/8] document btrace support for arm targets using coresight etm traces
Date: Thu, 11 Mar 2021 03:50:39 +0100 [thread overview]
Message-ID: <20210311025039.57112-9-zied.guermazi@trande.de> (raw)
In-Reply-To: <20210311025039.57112-1-zied.guermazi@trande.de>
This patch documents the extensions done in GDB to enable using
ARM Coresight traces for btrace.
gdb/ChangeLog
* gdb/NEWS: list new commands and remote packets for extending btrace
to support using ARM CoreSight Traces.
gdb/doc/ChangeLog
* gdb.texinfo (Process Record and Replay): Document extending
GDB btrace commands to support using ARM CoreSight traces.
(General Query Packets) Document extending GDB remote protocol
packets to support using ARM CoreSight traces for btrace.
---
gdb/NEWS | 30 ++++++++++++
gdb/doc/ChangeLog | 5 ++
gdb/doc/gdb.texinfo | 115 +++++++++++++++++++++++++++++++++++++++++++-
3 files changed, 149 insertions(+), 1 deletion(-)
diff --git a/gdb/NEWS b/gdb/NEWS
index 7f5a745d0c0..0c31af6ed0b 100644
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -2,6 +2,7 @@
(Organized release by release)
*** Changes since GDB 10
+* Record btrace now supports using ARM CoreSight ETM traces.
* Building GDB now requires GMP (The GNU Multiple Precision Arithmetic
Library).
@@ -35,6 +36,21 @@
* New commands
+record btrace etm
+record etm
+ Start branch trace recording using ARM CoreSight trace format (ETM).
+
+set|show record btrace etm buffer-size
+ Set and show the size of the ring buffer used for branch tracing in
+ ETM format.
+ The obtained size may differ from the requested size. Use "info
+ record" to see the obtained buffer size.
+
+set|show record btrace etm sink
+ Set and show the trace sink used for branch tracing in
+ ETM format.
+ Use "default" to reset it to default sink.
+
set debug event-loop
show debug event-loop
Control the display of debug output about GDB's event loop.
@@ -98,6 +114,20 @@ maintenance info sections
ARM Symbian arm*-*-symbianelf*
+* New remote packets
+
+Qbtrace:etm
+ Enable ARM CoreSight ETM Trace-based branch tracing for the current
+ process. The remote stub reports support for this packet to GDB's
+ qSupported query.
+
+Qbtrace-conf:etm:size
+ Set the requested ring buffer size for branch tracing in
+ ARM CoreSight ETM Trace format.
+
+Qbtrace-conf:etm:sink
+ Set the trace sink for branch tracing in ARM CoreSight ETM Trace format.
+
*** Changes in GDB 10
* There are new feature names for ARC targets: "org.gnu.gdb.arc.core"
diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog
index add31a0cc39..b4b9faa20d5 100644
--- a/gdb/doc/ChangeLog
+++ b/gdb/doc/ChangeLog
@@ -1,3 +1,8 @@
+2021-02-08 Zied Guermazi <zied.guermazi@trande.de>
+
+ * gdb.texinfo: Document extending btrace to support
+ ARM CoreSight traces commands and packets
+
2021-02-24 Andrew Burgess <andrew.burgess@embecosm.com>
* gdb.texinfo (Files): Document new 'maint info target-sections'
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 80ccf74a049..fd528442503 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -7371,15 +7371,19 @@ For architecture environments that support process record and replay,
@kindex record btrace
@kindex record btrace bts
@kindex record btrace pt
+@kindex record btrace etm
@kindex record bts
@kindex record pt
+@kindex record etm
@kindex rec
@kindex rec full
@kindex rec btrace
@kindex rec btrace bts
@kindex rec btrace pt
+@kindex rec btrace etm
@kindex rec bts
@kindex rec pt
+@kindex rec etm
@item record @var{method}
This command starts the process record and replay target. The
recording method can be specified as parameter. Without a parameter
@@ -7393,7 +7397,7 @@ replay implementation. This method allows replaying and reverse
execution.
@item btrace @var{format}
-Hardware-supported instruction recording, supported on Intel
+Hardware-supported instruction recording, supported on Intel and ARM
processors. This method does not record data. Further, the data is
collected in a ring buffer so old data will be overwritten when the
buffer is full. It allows limited reverse execution. Variables and
@@ -7427,6 +7431,13 @@ Decoding the recorded execution trace, on the other hand, is more
expensive than decoding @acronym{BTS} trace. This is mostly due to the
increased number of instructions to process. You should increase the
buffer-size with care.
+
+@item etm
+@cindex ARM CoreSight Trace
+Use the @dfn{ARM CoreSight Trace} recording format. In this
+format, @acronym{ETM, Extended Trace Macrocell} stores the processor
+execution trace in a compressed form that is afterwards
+decoded by @value{GDBN}.
@end table
Not all recording formats may be available on all processors.
@@ -7574,6 +7585,12 @@ and to read-write memory. Beware that the accessed memory corresponds
to the live target and not necessarily to the current replay
position.
+@item set record btrace etm sink @var{sink}
+Set ARM CoreSight ETM sink to collect traces.
+On @sc{gnu}/Linux systems, possible values for @var{sink} are the name of the
+files in the directory @file{/sys/bus/event_source/devices/cs_etm/sinks/}.
+Use the value @kbd{default} to reset it to default sink.
+
@item set record btrace cpu @var{identifier}
Set the processor to be used for enabling workarounds for processor
errata when decoding the trace.
@@ -7637,6 +7654,9 @@ Recorded 84872 instructions in 3189 functions (0 gaps) for thread 1 (...).
@item show record btrace replay-memory-access
Show the current setting of @code{replay-memory-access}.
+@item show record btrace etm sink
+Show ARM CoreSight ETM sink.
+
@item show record btrace cpu
Show the processor to be used for enabling trace decode errata
workarounds.
@@ -7688,6 +7708,29 @@ also need longer to process the branch trace data before it can be used.
Show the current setting of the requested ring buffer size for branch
tracing in Intel Processor Trace format.
+@kindex set record btrace etm
+@item set record btrace etm buffer-size @var{size}
+@itemx set record btrace etm buffer-size unlimited
+Set the requested ring buffer size for branch tracing in ARM
+CoreSight ETM Trace format. Default is 16KB.
+
+If @var{size} is a positive number, then @value{GDBN} will try to
+allocate a buffer of at least @var{size} bytes for each new thread
+that uses the btrace recording method and the Intel Processor Trace
+format. The actually obtained buffer size may differ from the
+requested @var{size}. Use the @code{info record} command to see the
+actual buffer size for each thread.
+
+If @var{limit} is @code{unlimited} or zero, @value{GDBN} will try to
+allocate a buffer of 4MB.
+
+Bigger buffers mean longer traces. On the other hand, @value{GDBN} will
+also need longer to process the branch trace data before it can be used.
+
+@item show record btrace etm buffer-size @var{size}
+Show the current setting of the requested ring buffer size for branch
+tracing in ARM CoreSight ETM Trace format.
+
@kindex info record
@item info record
Show various statistics about the recording depending on the recording
@@ -7739,6 +7782,12 @@ For the @code{pt} recording format, it also shows:
@item
Size of the perf ring buffer.
@end itemize
+
+For the @code{etm} recording format, it also shows:
+@itemize @bullet
+@item
+Size of the perf ring buffer.
+@end itemize
@end table
@kindex record delete
@@ -41659,6 +41708,21 @@ These are the currently defined stub features and their properties:
@tab @samp{-}
@tab No
+@item @samp{Qbtrace:etm}
+@tab Yes
+@tab @samp{-}
+@tab Yes
+
+@item @samp{Qbtrace-conf:etm:size}
+@tab Yes
+@tab @samp{-}
+@tab Yes
+
+
+@item @samp{Qbtrace-conf:etm:sink}
+@tab Yes
+@tab @samp{-}
+@tab Yes
@end multitable
These are the currently defined stub features, in more detail:
@@ -41835,9 +41899,11 @@ The remote stub understands the @samp{Qbtrace:off} packet.
@item Qbtrace:bts
The remote stub understands the @samp{Qbtrace:bts} packet.
+(@pxref{Qbtrace:bts}).
@item Qbtrace:pt
The remote stub understands the @samp{Qbtrace:pt} packet.
+(@pxref{Qbtrace:pt}).
@item Qbtrace-conf:bts:size
The remote stub understands the @samp{Qbtrace-conf:bts:size} packet.
@@ -41873,6 +41939,16 @@ The remote stub understands the @samp{QThreadEvents} packet.
@item no-resumed
The remote stub reports the @samp{N} stop reply.
+@item Qbtrace:etm
+The remote stub understands the @samp{Qbtrace:etm} packet.
+(@pxref{Qbtrace:etm}).
+
+@item Qbtrace-conf:etm:size
+The remote stub understands the @samp{Qbtrace-conf:etm:size} packet.
+
+@item Qbtrace-conf:etm:sink
+The remote stub understands the @samp{Qbtrace-conf:etm:sink} packet.
+
@end table
@item qSymbol::
@@ -42279,6 +42355,7 @@ A badly formed request or an error was encountered.
@end table
@item Qbtrace:bts
+@anchor{Qbtrace:bts}
Enable branch tracing for the current thread using Branch Trace Store.
Reply:
@@ -42290,6 +42367,7 @@ A badly formed request or an error was encountered.
@end table
@item Qbtrace:pt
+@anchor{Qbtrace:pt}
Enable branch tracing for the current thread using Intel Processor Trace.
Reply:
@@ -42335,6 +42413,41 @@ The ring buffer size has been set.
A badly formed request or an error was encountered.
@end table
+@item Qbtrace:etm
+@anchor{Qbtrace:etm}
+Enable branch tracing for the current thread using ARM CoreSight ETM Trace.
+
+Reply:
+@table @samp
+@item OK
+Branch tracing has been enabled.
+@item E.errtext
+A badly formed request or an error was encountered.
+@end table
+
+@item Qbtrace-conf:etm:size=@var{value}
+Set the requested ring buffer size for new threads that use the
+btrace recording method in etm format.
+
+Reply:
+@table @samp
+@item OK
+The ring buffer size has been set.
+@item E.errtext
+A badly formed request or an error was encountered.
+@end table
+
+@item Qbtrace-conf:etm:sink=@var{value}
+Set the requested trace sink for new threads that use the
+btrace recording method in etm format.
+
+Reply:
+@table @samp
+@item OK
+The ring buffer size has been set.
+@item E.errtext
+A badly formed request or an error was encountered.
+@end table
@end table
@node Architecture-Specific Protocol Details
--
2.25.1
next prev parent reply other threads:[~2021-03-11 2:51 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-11 2:50 [PATCH v2 0/8] extend branch tracing to use ARM CoreSight traces Zied Guermazi
2021-03-11 2:50 ` [PATCH v2 1/8] configure gdb build system for supporting btrace on arm processors Zied Guermazi
2021-03-11 2:50 ` [PATCH v2 2/8] add btrace coresight related commands Zied Guermazi
2021-03-11 2:50 ` [PATCH v2 3/8] start/stop btrace with coresight etm and parse etm buffer. nat independant Zied Guermazi
2021-03-11 2:50 ` [PATCH v2 4/8] start/stop btrace with coresight etm and collect etm buffer on linux os Zied Guermazi
2021-03-11 2:50 ` [PATCH v2 5/8] fix issue: gdb hangs in the command following a commad returning with TARGET_WAITKIND_NO_HISTORY Zied Guermazi
2021-03-11 2:50 ` [PATCH v2 6/8] add support for coresight btrace via remote protocol Zied Guermazi
2021-03-11 2:50 ` [PATCH v2 7/8] adapt btrace testcases for arm target Zied Guermazi
2021-03-11 2:50 ` Zied Guermazi [this message]
2021-03-11 6:23 ` [PATCH 8/8] document btrace support for arm targets using coresight etm traces Eli Zaretskii
-- strict thread matches above, loose matches on Subject: below --
2021-02-26 2:45 [PATCH 0/8] extend branch tracing to use ARM CoreSight traces Zied Guermazi
2021-02-26 2:46 ` [PATCH 8/8] document btrace support for arm targets using coresight etm traces Zied Guermazi
2021-02-26 7:36 ` Eli Zaretskii
2021-03-10 20:36 ` Zied Guermazi
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=20210311025039.57112-9-zied.guermazi@trande.de \
--to=zied.guermazi@trande.de \
--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).