From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from nx241.node01.secure-mailgate.com (nx241.node01.secure-mailgate.com [89.22.108.241]) by sourceware.org (Postfix) with ESMTPS id 2F6F93857010 for ; Thu, 11 Mar 2021 02:51:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 2F6F93857010 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 1lKBPi-00F5De-Bo for gdb-patches@sourceware.org; Thu, 11 Mar 2021 03:51:03 +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 ACE512AE372; Thu, 11 Mar 2021 03:51:01 +0100 (CET) X-SecureMailgate-Identity: host202.checkdomain.de From: Zied Guermazi To: gdb-patches@sourceware.org Cc: Zied Guermazi Subject: [PATCH v2 0/8] extend branch tracing to use ARM CoreSight traces Date: Thu, 11 Mar 2021 03:50:31 +0100 Message-Id: <20210311025039.57112-1-zied.guermazi@trande.de> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-PPP-Message-ID: <20210311025102.3191933.22260@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: Combined (0.04) X-Recommended-Action: accept X-Filter-ID: Pt3MvcO5N4iKaDQ5O6lkdGlMVN6RH8bjR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QXR0pcnE0axI2jIHIygW3/AVBWvF+WByBawaHTiVQQhQ3cXtT qZg6zYv+9efs9Nqx2AbbYAO73tfvTX/QeA== X-Report-Abuse-To: spam@node04.secure-mailgate.com X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, RCVD_IN_BARRACUDACENTRAL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=no 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:07 -0000 This patch set adds support for branch tracing in GDB on arm platforms using coresight etm traces Branch tracing offers instructions and functions histories as well as execution record and replay (forwards and reverse debugging) this patch set was tested using the gdb.btrace testsuite on ARMv7 and ARMv8 cortex A processors running linux operating system with coresight drivers. test results of gdb.btrace testsuite on ARMv8, variation unix # of expected passes 595 # of unexpected failures 1 # of unsupported tests 1 test results of gdb.btrace testsuite on ARMv8 variation native-gdbserver # of expected passes 582 # of unexpected failures 4 # of unsupported tests 2 test results of gdb.btrace testsuite on ARMv7, variation unix test results of gdb.btrace testsuite on ARMv7 variation native-gdbserver known limitations: for arm v7 only - some registers needed for breakpoint address calculation in forwards executions may be missing. for arm v7 and arm v8 - sometimes trace buffers are not flushed properly or flushed in the buffer of a different thread. this was observed in test scripts only. - sometimes, in non-stop mode, while executing "stepi n" for two threads in parallel, a thread is hitting breakpoints intended for stepping the other one. Gdb recognizes that it is intended for the second thread, but decreases the step counter. leading to a stepping less than "n" times. patches are: Zied Guermazi (8): configure gdb build system for supporting btrace on arm processors add btrace coresight related commands start/stop btrace with coresight etm and parse etm buffer. nat independant start/stop btrace with coresight etm and collect etm buffer on linux os fix issue: gdb hangs in the command following a commad returning with TARGET_WAITKIND_NO_HISTORY add support for coresight btrace via remote protocol adapt btrace testcases for arm target document btrace support for arm targets using coresight etm traces gdb/ChangeLog | 139 +++ gdb/Makefile.in | 5 +- gdb/NEWS | 30 + gdb/aarch64-linux-nat.c | 68 ++ gdb/arm-linux-nat.c | 68 ++ gdb/btrace.c | 992 +++++++++++++++++- gdb/btrace.h | 25 + gdb/config.in | 3 + gdb/configure | 545 ++++++++++ gdb/configure.nat | 4 +- gdb/doc/ChangeLog | 5 + gdb/doc/gdb.texinfo | 115 +- gdb/features/btrace-conf.dtd | 10 +- gdb/features/btrace.dtd | 38 +- gdb/infrun.c | 3 +- gdb/nat/linux-btrace.c | 457 +++++++- gdb/nat/linux-btrace.h | 19 + gdb/record-btrace.c | 136 ++- gdb/record.c | 2 + gdb/remote.c | 66 +- .../gdb.btrace/aarch64-instruction_history.S | 31 + .../gdb.btrace/aarch64-record_goto.S | 400 +++++++ .../gdb.btrace/aarch64-tailcall-only.S | 517 +++++++++ gdb/testsuite/gdb.btrace/aarch64-tailcall.S | 409 ++++++++ .../gdb.btrace/arm-instruction_history.S | 31 + gdb/testsuite/gdb.btrace/arm-record_goto.S | 433 ++++++++ gdb/testsuite/gdb.btrace/arm-tailcall-only.S | 504 +++++++++ gdb/testsuite/gdb.btrace/arm-tailcall.S | 391 +++++++ gdb/testsuite/gdb.btrace/buffer-size.exp | 15 +- gdb/testsuite/gdb.btrace/delta.exp | 10 + .../gdb.btrace/instruction_history.exp | 107 +- gdb/testsuite/gdb.btrace/non-stop.exp | 60 +- gdb/testsuite/gdb.btrace/record_goto.exp | 241 ++++- gdb/testsuite/gdb.btrace/stepi.exp | 95 +- gdb/testsuite/gdb.btrace/tailcall-only.exp | 8 + gdb/testsuite/gdb.btrace/tailcall.exp | 46 +- ...on_history.S => x86-instruction_history.S} | 0 gdb/testsuite/lib/gdb.exp | 2 +- gdb/top.c | 10 +- gdbserver/ChangeLog | 16 + gdbserver/config.in | 3 + gdbserver/configure | 545 ++++++++++ gdbserver/configure.srv | 4 + gdbserver/linux-low.cc | 103 +- gdbserver/server.cc | 34 +- gdbsupport/ChangeLog | 29 + gdbsupport/Makefile.in | 3 + gdbsupport/btrace-common.cc | 47 + gdbsupport/btrace-common.h | 173 ++- gdbsupport/common.m4 | 39 + gdbsupport/config.in | 3 + gdbsupport/configure | 545 ++++++++++ 52 files changed, 7427 insertions(+), 157 deletions(-) create mode 100644 gdb/testsuite/gdb.btrace/aarch64-instruction_history.S create mode 100644 gdb/testsuite/gdb.btrace/aarch64-record_goto.S create mode 100644 gdb/testsuite/gdb.btrace/aarch64-tailcall-only.S create mode 100644 gdb/testsuite/gdb.btrace/aarch64-tailcall.S create mode 100644 gdb/testsuite/gdb.btrace/arm-instruction_history.S create mode 100644 gdb/testsuite/gdb.btrace/arm-record_goto.S create mode 100644 gdb/testsuite/gdb.btrace/arm-tailcall-only.S create mode 100644 gdb/testsuite/gdb.btrace/arm-tailcall.S rename gdb/testsuite/gdb.btrace/{instruction_history.S => x86-instruction_history.S} (100%) -- 2.25.1