From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14809 invoked by alias); 2 May 2013 12:03:53 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 14772 invoked by uid 89); 2 May 2013 12:03:52 -0000 X-Spam-SWARE-Status: No, score=-7.8 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL,RP_MATCHES_RCVD autolearn=ham version=3.3.1 Received: from mga14.intel.com (HELO mga14.intel.com) (143.182.124.37) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Thu, 02 May 2013 12:03:51 +0000 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by azsmga102.ch.intel.com with ESMTP; 02 May 2013 05:03:50 -0700 X-ExtLoop1: 1 Received: from irvmail001.ir.intel.com ([163.33.26.43]) by fmsmga001.fm.intel.com with ESMTP; 02 May 2013 05:03:40 -0700 Received: from ulslx001.iul.intel.com (ulslx001.iul.intel.com [172.28.207.63]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id r42C3clO019520; Thu, 2 May 2013 13:03:39 +0100 Received: from ulslx001.iul.intel.com (localhost [127.0.0.1]) by ulslx001.iul.intel.com with ESMTP id r42C3bGk021472; Thu, 2 May 2013 14:03:37 +0200 Received: (from mmetzger@localhost) by ulslx001.iul.intel.com with id r42C3aGw021468; Thu, 2 May 2013 14:03:36 +0200 From: Markus Metzger To: jan.kratochvil@redhat.com Cc: gdb-patches@sourceware.org Subject: [PATCH 00/15] record-btrace: goto support Date: Thu, 02 May 2013 12:03:00 -0000 Message-Id: <1367496216-21217-1-git-send-email-markus.t.metzger@intel.com> X-SW-Source: 2013-05/txt/msg00018.txt.bz2 This is the start of the next step for branch tracing support. This series adds support for the "record goto" command for the btrace record target. It allows navigating to a place in the recorded execution log and printing the back trace at this point. There are a number of opens wrt unwinding listed in the last patch of the series, which makes this more an RFC than a real PATCH series, I suppose. It also changes the existing "record function-call-history" and "record instruction-history" commands slightly and fixes PR/15240. The "record function-call-history" command can now show the call relationship like this: (gdb) record function-call-history /cli 12 fib inst 101,111 at src/fib.c:3,7 13 fib inst 112,124 at src/fib.c:3,8 14 fib inst 125,129 at src/fib.c:7 15 fib inst 130,142 at src/fib.c:3,8 16 fib inst 143,147 at src/fib.c:7,8 17 fib inst 148,152 at src/fib.c:7,8 18 fib inst 153,157 at src/fib.c:7 19 fib inst 158,168 at src/fib.c:3,7 20 fib inst 169,179 at src/fib.c:3,7 21 fib inst 180,185 at src/fib.c:3,4 The instruction numbers printed with the /i modifier can be used for figuring out interesting locations to go to. It looks like this: (gdb) record goto 130 #0 0x0000000000400558 in fib ( n=) at src/fib.c:3 3 static unsigned long fib(unsigned long n) { (gdb) list 1 #include 2 3 static unsigned long fib(unsigned long n) { 4 if (n < 2) 5 return n; 6 7 return fib(n-1) + fib(n-2); 8 } 9 10 extern int main(int argc, char **argv) { (gdb) backtrace #0 0x0000000000400558 in fib ( n=) at src/fib.c:3 #1 0x000000000040058c in fib ( n=) at src/fib.c:7 #2 0x0000000000400591 in fib ( n=) at src/fib.c:7 #3 0x0000000000400591 in fib ( n=) at src/fib.c:7 #4 0x0000000000400591 in fib ( n=) at src/fib.c:7 #5 main (argc=, argv=) at src/fib.c:19 Backtrace stopped: not enough registers or memory available to unwind further Markus Metzger (15): gdbarch: add instruction predicate methods btrace: change branch trace data structure record-btrace: fix insn range in function call history btrace: increase buffer size record-btrace: optionally indent function call history record-btrace: make ranges include begin and end btrace: add replay position to btrace thread info target: add ops parameter to to_prepare_to_store method record-btrace: supply register target methods frame, backtrace: allow targets to supply a frame unwinder record-btrace, frame: supply target-specific unwinder record-btrace: provide xfer_partial target method record-btrace: add to_wait and to_resume target methods. record-btrace: add record goto target methods record-btrace: extend unwinder gdb/NEWS | 10 + gdb/amd64-tdep.c | 66 ++ gdb/btrace.c | 979 +++++++++++++++---- gdb/btrace.h | 173 +++- gdb/common/linux-btrace.c | 25 +- gdb/doc/gdb.texinfo | 18 +- gdb/dwarf2-frame.c | 8 +- gdb/frame-unwind.c | 80 +- gdb/frame.c | 9 +- gdb/frame.h | 4 +- gdb/gdbarch.c | 99 ++ gdb/gdbarch.h | 24 + gdb/gdbarch.sh | 9 + gdb/i386-tdep.c | 57 + gdb/inf-child.c | 2 +- gdb/monitor.c | 2 +- gdb/ravenscar-thread.c | 7 +- gdb/record-btrace.c | 1070 +++++++++++++++++--- gdb/record-full.c | 3 +- gdb/record.c | 4 + gdb/record.h | 3 + gdb/remote-m32r-sdi.c | 2 +- gdb/remote-mips.c | 5 +- gdb/remote.c | 5 +- gdb/target.c | 42 +- gdb/target.h | 12 +- gdb/testsuite/gdb.btrace/Makefile.in | 3 +- gdb/testsuite/gdb.btrace/exception.cc | 56 + gdb/testsuite/gdb.btrace/exception.exp | 64 ++ gdb/testsuite/gdb.btrace/function_call_history.exp | 142 ++- gdb/testsuite/gdb.btrace/instruction_history.exp | 6 +- gdb/testsuite/gdb.btrace/record_goto.c | 51 + gdb/testsuite/gdb.btrace/record_goto.exp | 166 +++ gdb/testsuite/gdb.btrace/tailcall.exp | 66 ++ gdb/testsuite/gdb.btrace/unknown_functions.c | 45 + gdb/testsuite/gdb.btrace/unknown_functions.exp | 58 ++ gdb/testsuite/gdb.btrace/x86-record_goto.S | 332 ++++++ gdb/testsuite/gdb.btrace/x86-tailcall.S | 269 +++++ gdb/testsuite/gdb.btrace/x86-tailcall.c | 39 + 39 files changed, 3524 insertions(+), 491 deletions(-) create mode 100644 gdb/testsuite/gdb.btrace/exception.cc create mode 100644 gdb/testsuite/gdb.btrace/exception.exp create mode 100644 gdb/testsuite/gdb.btrace/record_goto.c create mode 100644 gdb/testsuite/gdb.btrace/record_goto.exp create mode 100644 gdb/testsuite/gdb.btrace/tailcall.exp create mode 100644 gdb/testsuite/gdb.btrace/unknown_functions.c create mode 100644 gdb/testsuite/gdb.btrace/unknown_functions.exp create mode 100644 gdb/testsuite/gdb.btrace/x86-record_goto.S create mode 100644 gdb/testsuite/gdb.btrace/x86-tailcall.S create mode 100644 gdb/testsuite/gdb.btrace/x86-tailcall.c