This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH 00/15] record-btrace: goto support
- From: Markus Metzger <markus dot t dot metzger at intel dot com>
- To: jan dot kratochvil at redhat dot com
- Cc: gdb-patches at sourceware dot org
- Date: Thu, 2 May 2013 14:03:21 +0200
- Subject: [PATCH 00/15] record-btrace: goto support
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=<error reading variable: can't compute CFA for this frame>)
at src/fib.c:3
3 static unsigned long fib(unsigned long n) {
(gdb) list
1 #include <stdio.h>
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=<error reading variable: can't compute CFA for this frame>)
at src/fib.c:3
#1 0x000000000040058c in fib (
n=<error reading variable: can't compute CFA for this frame>)
at src/fib.c:7
#2 0x0000000000400591 in fib (
n=<error reading variable: can't compute CFA for this frame>)
at src/fib.c:7
#3 0x0000000000400591 in fib (
n=<error reading variable: can't compute CFA for this frame>)
at src/fib.c:7
#4 0x0000000000400591 in fib (
n=<error reading variable: can't compute CFA for this frame>)
at src/fib.c:7
#5 main (argc=<unavailable>, argv=<unavailable>) 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