From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from nx204.node01.secure-mailgate.com (nx204.node01.secure-mailgate.com [89.22.108.204]) by sourceware.org (Postfix) with ESMTPS id 91C183857010 for ; Thu, 11 Mar 2021 02:51:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 91C183857010 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 node01.secure-mailgate.com with esmtps (TLSv1.2:AES128-GCM-SHA256:128) (Exim 4.92) (envelope-from ) id 1lKBPm-00F5N0-VO for gdb-patches@sourceware.org; Thu, 11 Mar 2021 03:51:07 +0100 X-SecureMailgate-Identity: host202.checkdomain.de Received: from Trande0001.fritz.box (x4db421df.dyn.telefonica.de [77.180.33.223]) (Authenticated sender: zied.guermazi@trande.de) by host202.checkdomain.de (Postfix) with ESMTPSA id 66C9E2A2211; Thu, 11 Mar 2021 03:51:06 +0100 (CET) X-SecureMailgate-Identity: host202.checkdomain.de 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: Thu, 11 Mar 2021 03:50:39 +0100 Message-Id: <20210311025039.57112-9-zied.guermazi@trande.de> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210311025039.57112-1-zied.guermazi@trande.de> References: <20210311025039.57112-1-zied.guermazi@trande.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-PPP-Message-ID: <20210311025106.3192169.45188@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 (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rVfWaPHLh9d13TvnYIJS 8uss0ueeSQv3iRNCdtD1uwyAKMADmSgTOnv22Aeeug8bgwJPDDg1BsZlJJwIRfFRTyc2vKtsh88u M6zHbDccOKMrUoTh9tkkYGx1qtbnIjA6A3MtdZ3kU7K9G0Sx0xT0TSw= X-Report-Abuse-To: spam@node04.secure-mailgate.com X-Spam-Status: No, score=-9.8 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, RCVD_IN_BARRACUDACENTRAL, 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: Thu, 11 Mar 2021 02:51:11 -0000 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 + + * 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..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