From 0b722aec57e2e54083c1d56657762945ad4604fc Mon Sep 17 00:00:00 2001 From: Markus Metzger Date: Wed, 27 Mar 2013 09:49:47 +0100 Subject: 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 * 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. --- gdb/dwarf2-frame.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'gdb/dwarf2-frame.c') diff --git a/gdb/dwarf2-frame.c b/gdb/dwarf2-frame.c index 772de56b4d1..ce21112ba76 100644 --- a/gdb/dwarf2-frame.c +++ b/gdb/dwarf2-frame.c @@ -31,6 +31,7 @@ #include "objfiles.h" #include "regcache.h" #include "value.h" +#include "record.h" #include "gdb_assert.h" #include @@ -1510,6 +1511,11 @@ dwarf2_frame_base_sniffer (struct frame_info *this_frame) CORE_ADDR dwarf2_frame_cfa (struct frame_info *this_frame) { + if (frame_unwinder_is (this_frame, &record_btrace_tailcall_frame_unwind) + || frame_unwinder_is (this_frame, &record_btrace_frame_unwind)) + throw_error (NOT_AVAILABLE_ERROR, + _("cfa not available for record btrace target")); + while (get_frame_type (this_frame) == INLINE_FRAME) this_frame = get_prev_frame (this_frame); if (get_frame_unwind_stop_reason (this_frame) == UNWIND_UNAVAILABLE) -- cgit v1.2.1