Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Markus Metzger <markus.t.metzger@intel.com>
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	[thread overview]
Message-ID: <1367496216-21217-1-git-send-email-markus.t.metzger@intel.com> (raw)

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


             reply	other threads:[~2013-05-02 12:03 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-02 12:03 Markus Metzger [this message]
2013-05-02 12:03 ` [PATCH 03/15] record-btrace: fix insn range in function call history Markus Metzger
2013-05-02 12:03 ` [PATCH 01/15] gdbarch: add instruction predicate methods Markus Metzger
2013-05-13 15:23   ` Jan Kratochvil
2013-05-02 12:03 ` [PATCH 12/15] record-btrace: provide xfer_partial target method Markus Metzger
2013-05-02 12:03 ` [PATCH 07/15] btrace: add replay position to btrace thread info Markus Metzger
2013-05-02 12:03 ` [PATCH 14/15] record-btrace: add record goto target methods Markus Metzger
2013-05-02 17:11   ` Eli Zaretskii
2013-05-02 12:03 ` [PATCH 10/15] frame, backtrace: allow targets to supply a frame unwinder Markus Metzger
2013-05-02 12:03 ` [PATCH 08/15] target: add ops parameter to to_prepare_to_store method Markus Metzger
2013-05-02 12:03 ` [PATCH 06/15] record-btrace: make ranges include begin and end Markus Metzger
2013-05-02 15:51   ` Eli Zaretskii
2013-05-02 12:03 ` [PATCH 09/15] record-btrace: supply register target methods Markus Metzger
2013-05-02 12:04 ` [PATCH 15/15] record-btrace: extend unwinder Markus Metzger
2013-05-02 15:52   ` Eli Zaretskii
2013-05-02 12:04 ` [PATCH 02/15] btrace: change branch trace data structure Markus Metzger
2013-05-13 15:25   ` Jan Kratochvil
2013-05-14 15:27     ` Metzger, Markus T
2013-05-14 16:11       ` Doug Evans
2013-05-02 12:04 ` [PATCH 11/15] record-btrace, frame: supply target-specific unwinder Markus Metzger
2013-05-02 12:04 ` [PATCH 05/15] record-btrace: optionally indent function call history Markus Metzger
2013-05-02 17:10   ` Eli Zaretskii
2013-05-02 12:04 ` [PATCH 13/15] record-btrace: add to_wait and to_resume target methods Markus Metzger
2013-05-02 12:04 ` [PATCH 04/15] btrace: increase buffer size Markus Metzger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1367496216-21217-1-git-send-email-markus.t.metzger@intel.com \
    --to=markus.t.metzger@intel.com \
    --cc=gdb-patches@sourceware.org \
    --cc=jan.kratochvil@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox