From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from nx226.node01.secure-mailgate.com (nx226.node01.secure-mailgate.com [89.22.108.226]) by sourceware.org (Postfix) with ESMTPS id D0D1A393A411 for ; Mon, 31 May 2021 21:33:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org D0D1A393A411 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 1lnpXO-0047YK-VP; Mon, 31 May 2021 23:33:31 +0200 X-SecureMailgate-Identity: zied.guermazi@trande.de;host202.checkdomain.de Received: from Trande0001.fritz.box (x4dbe295e.dyn.telefonica.de [77.190.41.94]) (Authenticated sender: zied.guermazi@trande.de) by host202.checkdomain.de (Postfix) with ESMTPSA id 381A8300084; Mon, 31 May 2021 23:33:27 +0200 (CEST) X-SecureMailgate-Identity: zied.guermazi@trande.de;host202.checkdomain.de From: Zied Guermazi To: gdb-patches@sourceware.org, markus.t.metzger@intel.com Cc: Zied Guermazi Subject: [PATCH v6 0/7] extend branch tracing to use ARM CoreSight traces Date: Mon, 31 May 2021 23:33:00 +0200 Message-Id: <20210531213307.275079-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: <20210531213327.2005894.59595@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.03) X-Recommended-Action: accept X-Filter-ID: Pt3MvcO5N4iKaDQ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735LO15p1JjFBmbIK2Uo19T7lUH3LO9MZQl/R0Vlf0U/hJ2/TL4CJHf9+nBwWhkxc XLTzYUv2yTYYszlVwj1n2JAvHUSGQgae99MGMevVVKNikwLQ0fq/FOv/N1K8VM5vTIIOsiSAznIa Ah0r7Fnp/G6lXvg2pGEA3A== X-Report-Abuse-To: spam@node04.secure-mailgate.com X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, 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: Mon, 31 May 2021 21:33:36 -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 # of expected passes 588 # of unexpected failures 7 # of untested testcases 1 # of unsupported tests 1 test results of gdb.btrace testsuite on ARMv7 variation native-gdbserver # of expected passes 583 # of unexpected failures 4 # of unsupported tests 2 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 (7): 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 gdb/Makefile.in | 5 +- gdb/NEWS | 27 + gdb/aarch64-linux-nat.c | 68 ++ gdb/arch/arm.h | 33 + gdb/arm-linux-nat.c | 68 ++ gdb/btrace.c | 986 +++++++++++++++++- gdb/btrace.h | 16 +- gdb/config.in | 3 + gdb/configure | 549 ++++++++++ gdb/configure.nat | 4 +- gdb/doc/gdb.texinfo | 114 +- gdb/features/btrace-conf.dtd | 10 +- gdb/features/btrace.dtd | 38 +- gdb/infrun.c | 3 +- gdb/nat/linux-btrace.c | 395 ++++++- gdb/nat/linux-btrace.h | 19 + gdb/record-btrace.c | 174 +++- gdb/record.c | 2 + gdb/remote.c | 66 +- .../gdb.btrace/aarch64-instruction_history.S | 31 + .../gdb.btrace/aarch64-record_goto.S | 399 +++++++ .../gdb.btrace/aarch64-tailcall-only.S | 516 +++++++++ gdb/testsuite/gdb.btrace/aarch64-tailcall.S | 408 ++++++++ .../gdb.btrace/arm-instruction_history.S | 31 + gdb/testsuite/gdb.btrace/arm-record_goto.S | 432 ++++++++ gdb/testsuite/gdb.btrace/arm-tailcall-only.S | 503 +++++++++ gdb/testsuite/gdb.btrace/arm-tailcall.S | 390 +++++++ gdb/testsuite/gdb.btrace/buffer-size.exp | 15 +- .../gdb.btrace/instruction_history.exp | 106 +- gdb/testsuite/gdb.btrace/non-stop.exp | 60 +- gdb/testsuite/gdb.btrace/record_goto.exp | 253 +++-- gdb/testsuite/gdb.btrace/stepi.exp | 107 +- gdb/testsuite/gdb.btrace/tailcall-only.exp | 20 +- gdb/testsuite/gdb.btrace/tailcall.exp | 58 +- ...on_history.S => x86-instruction_history.S} | 0 gdb/testsuite/lib/gdb.exp | 2 +- gdb/top.c | 10 +- gdbserver/config.in | 3 + gdbserver/configure | 545 ++++++++++ gdbserver/configure.srv | 4 + gdbserver/linux-low.cc | 100 +- gdbserver/server.cc | 34 +- gdbsupport/Makefile.in | 3 + gdbsupport/btrace-common.cc | 45 + gdbsupport/btrace-common.h | 128 ++- gdbsupport/common.m4 | 39 + gdbsupport/config.in | 3 + gdbsupport/configure | 545 ++++++++++ 48 files changed, 7192 insertions(+), 178 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