aboutsummaryrefslogtreecommitdiff
path: root/gdb/btrace.c
diff options
context:
space:
mode:
authorMarkus Metzger <markus.t.metzger@intel.com>2013-03-27 09:49:47 +0100
committerMarkus Metzger <markus.t.metzger@intel.com>2014-01-16 13:09:42 +0100
commit0b722aec57e2e54083c1d56657762945ad4604fc (patch)
tree79d6da6e2638297a8c806d25c25ef1573347ce79 /gdb/btrace.c
parent066ce621f46cabb382b31a682501f0de8120c9fc (diff)
downloadgdb-0b722aec57e2e54083c1d56657762945ad4604fc.zip
gdb-0b722aec57e2e54083c1d56657762945ad4604fc.tar.gz
gdb-0b722aec57e2e54083c1d56657762945ad4604fc.tar.bz2
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/btrace.c')
-rw-r--r--gdb/btrace.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/gdb/btrace.c b/gdb/btrace.c
index 632ebe1..ba87e16 100644
--- a/gdb/btrace.c
+++ b/gdb/btrace.c
@@ -765,6 +765,10 @@ btrace_clear (struct thread_info *tp)
DEBUG ("clear thread %d (%s)", tp->num, target_pid_to_str (tp->ptid));
+ /* Make sure btrace frames that may hold a pointer into the branch
+ trace data are destroyed. */
+ reinit_frame_cache ();
+
btinfo = &tp->btrace;
it = btinfo->begin;