From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from nx207.node02.secure-mailgate.com (nx207.node02.secure-mailgate.com [192.162.87.207]) by sourceware.org (Postfix) with ESMTPS id 324DB38708B2 for ; Fri, 26 Feb 2021 02:46:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 324DB38708B2 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=trande.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=zied.guermazi@trande.de Received: from host202.checkdomain.de ([185.137.168.148]) by node02.secure-mailgate.com with esmtps (TLSv1.2:AES128-GCM-SHA256:128) (Exim 4.92) (envelope-from ) id 1lFT9A-00BfCl-Rd for gdb-patches@sourceware.org; Fri, 26 Feb 2021 03:46:29 +0100 X-SecureMailgate-Identity: zied.guermazi@trande.de;host202.checkdomain.de Received: from Trande0001.fritz.box (x4dbd6140.dyn.telefonica.de [77.189.97.64]) (Authenticated sender: zied.guermazi@trande.de) by host202.checkdomain.de (Postfix) with ESMTPSA id 6A3543880DD; Fri, 26 Feb 2021 03:46:28 +0100 (CET) From: Zied Guermazi To: gdb-patches@sourceware.org Cc: Zied Guermazi Subject: [PATCH 8/8] document btrace support for arm targets using coresight etm traces Date: Fri, 26 Feb 2021 03:46:02 +0100 Message-Id: <20210226024602.55057-9-zied.guermazi@trande.de> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210226024602.55057-1-zied.guermazi@trande.de> References: <20210226024602.55057-1-zied.guermazi@trande.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-PPP-Message-ID: <20210226024628.3433221.39733@host202.checkdomain.de> X-PPP-Vhost: trande.de X-Originating-IP: 185.137.168.148 X-SecureMailgate-Domain: host202.checkdomain.de X-SecureMailgate-Username: 185.137.168.148 Authentication-Results: secure-mailgate.com; auth=pass smtp.auth=185.137.168.148@host202.checkdomain.de X-SecureMailgate-Outgoing-Class: ham X-SecureMailgate-Outgoing-Evidence: SB/global_tokens (0.00660547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zgmJi5 UydShOH22SRgbHWq1uciMDoDhcd9NG1JDoOknqc6qrb4AiZPF6HXPq5gLm4Q4ElmvUALMK9HC+pU QBAyR03+Yzd87yCUgX8YuF5WBQr1Bq861zvA3BXN5HBbApl4eIrLaWewxjLyThsLecb51qdaSQev MS+4ayUpOtEhdxekWDmK9g== X-Report-Abuse-To: spam@node04.secure-mailgate.com X-Spam-Status: No, score=-11.2 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Feb 2021 02:46:33 -0000 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 + + * gdb.texinfo: Document extending btrace to support + ARM CoreSight traces commands and packets + 2021-02-24 Andrew Burgess * 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