diff options
author | Markus Metzger <markus.t.metzger@intel.com> | 2013-03-27 09:49:47 +0100 |
---|---|---|
committer | Markus Metzger <markus.t.metzger@intel.com> | 2014-01-16 13:09:42 +0100 |
commit | 0b722aec57e2e54083c1d56657762945ad4604fc (patch) | |
tree | 79d6da6e2638297a8c806d25c25ef1573347ce79 /gdb/testsuite/gdb.btrace | |
parent | 066ce621f46cabb382b31a682501f0de8120c9fc (diff) | |
download | binutils-gdb-0b722aec57e2e54083c1d56657762945ad4604fc.tar.gz |
record-btrace: extend unwinder
Extend the always failing unwinder to provide the PC based on the call
structure detected in the branch trace.
The unwinder supports normal frames and tailcall frames.
Inline frames are not supported.
2014-01-16 Markus Metzger <markus.t.metzger@intel.com>
* record.h (record_btrace_frame_unwind)
(record_btrace_tailcall_frame_unwind): New declarations.
* dwarf2-frame: Include record.h
(dwarf2_frame_cfa): Throw an error for btrace frames.
* record-btrace.c: Include hashtab.h.
(btrace_get_bfun_name): New.
(btrace_call_history): Call btrace_get_bfun_name.
(struct btrace_frame_cache): New.
(bfcache): New.
(bfcache_hash, bfcache_eq, bfcache_new): New.
(btrace_get_frame_function): New.
(record_btrace_frame_unwind_stop_reason): Allow unwinding.
(record_btrace_frame_this_id): Compute own id.
(record_btrace_frame_prev_register): Provide PC, throw_error
for all other registers.
(record_btrace_frame_sniffer): Detect btrace frames.
(record_btrace_tailcall_frame_sniffer): New.
(record_btrace_frame_dealloc_cache): New.
(record_btrace_frame_unwind): Add new functions.
(record_btrace_tailcall_frame_unwind): New.
(_initialize_record_btrace): Allocate cache.
* btrace.c (btrace_clear): Call reinit_frame_cache.
* NEWS: Announce it.
testsuite/
* gdb.btrace/record_goto.exp: Add backtrace test.
* gdb.btrace/tailcall.exp: Add backtrace test.
Diffstat (limited to 'gdb/testsuite/gdb.btrace')
-rw-r--r-- | gdb/testsuite/gdb.btrace/record_goto.exp | 12 | ||||
-rw-r--r-- | gdb/testsuite/gdb.btrace/tailcall.exp | 15 |
2 files changed, 27 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.btrace/record_goto.exp b/gdb/testsuite/gdb.btrace/record_goto.exp index eb07b9b797d..ab69bef2283 100644 --- a/gdb/testsuite/gdb.btrace/record_goto.exp +++ b/gdb/testsuite/gdb.btrace/record_goto.exp @@ -87,6 +87,18 @@ gdb_test "record instruction-history" [join [list \ # let's go to another place in the history gdb_test "record goto 26" ".*fun3 \\(\\) at record_goto.c:35.*" +# check the back trace at that location +gdb_test "backtrace" [join [list \ + "#0.*fun3.*at record_goto.c:35.*" \ + "#1.*fun4.*at record_goto.c:43.*" \ + "#2.*main.*at record_goto.c:49.*" \ + "Backtrace stopped: not enough registers or memory available to unwind further" \ + ] "\r\n"] + +# walk the backtrace +gdb_test "up" ".*fun4.*at record_goto.c:43.*" "up to fun4" +gdb_test "up" ".*main.*at record_goto.c:49.*" "up to main" + # the function call history should start at the new location gdb_test "record function-call-history /ci -" [join [list \ "8\t fun3\tinst 19,21" \ diff --git a/gdb/testsuite/gdb.btrace/tailcall.exp b/gdb/testsuite/gdb.btrace/tailcall.exp index c965675fd82..a00178323a9 100644 --- a/gdb/testsuite/gdb.btrace/tailcall.exp +++ b/gdb/testsuite/gdb.btrace/tailcall.exp @@ -60,3 +60,18 @@ gdb_test "record function-call-history /c 1" [join [list \ "2\t bar" \ "3\tmain" \ ] "\r\n"] "indented" + +# go into bar +gdb_test "record goto 3" ".*bar \\(\\) at .*x86-tailcall.c:24\r\n.*" + +# check the backtrace +gdb_test "backtrace" [join [list \ + "#0.*bar \\(\\) at x86-tailcall.c:24" \ + "#1.*foo \\(\\) at x86-tailcall.c:29" \ + "#2.*main \\(\\) at x86-tailcall.c:37" \ + "Backtrace stopped: not enough registers or memory available to unwind further" \ + ] "\r\n"] + +# walk the backtrace +gdb_test "up" "#1\[^\r\n\]*foo \\(\\) at x86-tailcall.c:29\r\n.*" "up to foo" +gdb_test "up" "#2\[^\r\n\]*main \\(\\) at x86-tailcall.c:37\r\n.*" "up to main" |