public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
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: Fri, 26 Feb 2021 03:46:02 +0100	[thread overview]
Message-ID: <20210226024602.55057-9-zied.guermazi@trande.de> (raw)
In-Reply-To: <20210226024602.55057-1-zied.guermazi@trande.de>

This patch documents the extensions done in GDB to enable using
ARM Coresight traces for btrace.

gdb/doc/ChangeLog

	* gdb.texinfo: Document extending btrace to support
	ARM CoreSight traces commands and packets
	* gdb/NEWS: list new commands and new remote packets


---
 gdb/NEWS            |  30 +++++++++++
 gdb/doc/ChangeLog   |   5 ++
 gdb/doc/gdb.texinfo | 119 +++++++++++++++++++++++++++++++++++++++++++-
 3 files changed, 153 insertions(+), 1 deletion(-)

diff --git a/gdb/NEWS b/gdb/NEWS
index 7f5a745d0c0..b0caef1688c 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 revert 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..c68a258463d 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 ETM Trace 
+Use the @dfn{ARM CoreSight ETM Trace} recording format.  In this
+format, the processor stores the 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,11 @@ 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. 
+possible values for @var{sink} can be found by listing the folder 
+/sys/bus/event_source/devices/cs_etm/sinks/
+
 @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 +7653,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 +7707,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 +7781,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
@@ -38628,6 +38676,17 @@ Newer packets have higher numbers.  The oldest packet has number zero.
 The packet's offset in the trace stream.
 @item Packet opcode and payload
 @end table
+
+@item etm
+For the ARM CoreSight ETM Trace recording format, print a list of
+ARM CoreSight ETM Trace packets.  For each packet, the following
+information is printed:
+
+@table @asis
+@item Packet number
+Newer packets have higher numbers.  The oldest packet has number zero.
+@item Packet opcode and payload
+@end table
 @end table
 
 @kindex maint btrace clear-packet-history
@@ -41659,6 +41718,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:
@@ -41873,6 +41947,15 @@ 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.
+
+@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::
@@ -42335,6 +42418,40 @@ The ring buffer size has been set.
 A badly formed request or an error was encountered.
 @end table
 
+@item 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


  parent reply	other threads:[~2021-02-26  2:46 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-26  2:45 [PATCH 0/8] extend branch tracing to use ARM CoreSight traces Zied Guermazi
2021-02-26  2:45 ` [PATCH 1/8] configure gdb build system for supporting btrace on arm processors Zied Guermazi
2021-03-04 16:35   ` Metzger, Markus T
2021-03-10 22:09     ` Zied Guermazi
2021-02-26  2:45 ` [PATCH 2/8] add btrace coresight related commands Zied Guermazi
2021-03-04 16:35   ` Metzger, Markus T
     [not found]     ` <8a71a9a3-ad14-b716-6d86-ece063061b02@trande.de>
2021-03-10 22:37       ` Zied Guermazi
2021-03-16 10:16         ` Metzger, Markus T
2021-03-19 15:21           ` Zied Guermazi
2021-02-26  2:45 ` [PATCH 3/8] start/stop btrace with coresight etm and parse etm buffer. nat independant Zied Guermazi
2021-03-04 16:35   ` Metzger, Markus T
2021-03-11  0:12     ` Zied Guermazi
2021-03-16 10:16       ` Metzger, Markus T
2021-03-19 15:29         ` Zied Guermazi
2021-03-29 14:01           ` Metzger, Markus T
2021-03-30 15:11             ` Zied Guermazi
2021-02-26  2:45 ` [PATCH 4/8] start/stop btrace with coresight etm and collect etm buffer on linux os Zied Guermazi
2021-02-26  2:45 ` [PATCH 5/8] fix issue: gdb hangs in the command following a commad returning with TARGET_WAITKIND_NO_HISTORY Zied Guermazi
2021-02-26  7:12   ` Aktemur, Tankut Baris
2021-03-10 20:39     ` Zied Guermazi
2021-02-26  2:46 ` [PATCH 6/8] add support for coresight btrace via remote protocol Zied Guermazi
2021-02-26  2:46 ` [PATCH 7/8] adapt btrace testcases for arm target Zied Guermazi
2021-02-26  2:46 ` Zied Guermazi [this message]
2021-02-26  7:36   ` [PATCH 8/8] document btrace support for arm targets using coresight etm traces Eli Zaretskii
2021-03-10 20:36     ` Zied Guermazi
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 8/8] document btrace support for arm targets using coresight etm traces Zied Guermazi
2021-03-11  6:23   ` Eli Zaretskii

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=20210226024602.55057-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).