From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12104 invoked by alias); 14 Jan 2014 08:04:48 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 11922 invoked by uid 89); 14 Jan 2014 08:04:47 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.1 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mga01.intel.com Received: from mga01.intel.com (HELO mga01.intel.com) (192.55.52.88) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 14 Jan 2014 08:04:46 +0000 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP; 14 Jan 2014 00:04:43 -0800 X-ExtLoop1: 1 Received: from irvmail001.ir.intel.com ([163.33.26.43]) by fmsmga001.fm.intel.com with ESMTP; 14 Jan 2014 00:04:42 -0800 Received: from ulvlx001.iul.intel.com (ulvlx001.iul.intel.com [172.28.207.17]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id s0E84fcT013315; Tue, 14 Jan 2014 08:04:41 GMT Received: from ulvlx001.iul.intel.com (localhost [127.0.0.1]) by ulvlx001.iul.intel.com with ESMTP id s0E84fI2009436; Tue, 14 Jan 2014 09:04:41 +0100 Received: (from mmetzger@localhost) by ulvlx001.iul.intel.com with œ id s0E84fJV009432; Tue, 14 Jan 2014 09:04:41 +0100 From: Markus Metzger To: jan.kratochvil@redhat.com, palves@redhat.com Cc: gdb-patches@sourceware.org Subject: [PATCH v10 18/28] record-btrace, frame: supply target-specific unwinder Date: Tue, 14 Jan 2014 08:04:00 -0000 Message-Id: <1389686678-9039-19-git-send-email-markus.t.metzger@intel.com> In-Reply-To: <1389686678-9039-1-git-send-email-markus.t.metzger@intel.com> References: <1389686678-9039-1-git-send-email-markus.t.metzger@intel.com> X-IsSubscribed: yes X-SW-Source: 2014-01/txt/msg00395.txt.bz2 Supply a target-specific frame unwinder for the record-btrace target that does not allow unwinding while replaying. 2013-02-11 Jan Kratochvil Markus Metzger gdb/ * record-btrace.c: Include frame-unwind.h. (record_btrace_frame_unwind_stop_reason) (record_btrace_frame_this_id, record_btrace_frame_prev_register) (record_btrace_frame_sniffer, record_btrace_frame_unwind): New. (init_record_btrace_ops): Install it. --- gdb/record-btrace.c | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) diff --git a/gdb/record-btrace.c b/gdb/record-btrace.c index 44ce754..870ad7d 100644 --- a/gdb/record-btrace.c +++ b/gdb/record-btrace.c @@ -33,6 +33,7 @@ #include "symtab.h" #include "filenames.h" #include "regcache.h" +#include "frame-unwind.h" /* The target_ops of record-btrace. */ static struct target_ops record_btrace_ops; @@ -840,6 +841,68 @@ record_btrace_prepare_to_store (struct target_ops *ops, } } +/* Implement stop_reason method for record_btrace_frame_unwind. */ + +static enum unwind_stop_reason +record_btrace_frame_unwind_stop_reason (struct frame_info *this_frame, + void **this_cache) +{ + return UNWIND_UNAVAILABLE; +} + +/* Implement this_id method for record_btrace_frame_unwind. */ + +static void +record_btrace_frame_this_id (struct frame_info *this_frame, void **this_cache, + struct frame_id *this_id) +{ + /* Leave there the outer_frame_id value. */ +} + +/* Implement prev_register method for record_btrace_frame_unwind. */ + +static struct value * +record_btrace_frame_prev_register (struct frame_info *this_frame, + void **this_cache, + int regnum) +{ + throw_error (NOT_AVAILABLE_ERROR, + _("Registers are not available in btrace record history")); +} + +/* Implement sniffer method for record_btrace_frame_unwind. */ + +static int +record_btrace_frame_sniffer (const struct frame_unwind *self, + struct frame_info *this_frame, + void **this_cache) +{ + struct thread_info *tp; + struct btrace_thread_info *btinfo; + struct btrace_insn_iterator *replay; + + /* THIS_FRAME does not contain a reference to its thread. */ + tp = find_thread_ptid (inferior_ptid); + gdb_assert (tp != NULL); + + return btrace_is_replaying (tp); +} + +/* btrace recording does not store previous memory content, neither the stack + frames content. Any unwinding would return errorneous results as the stack + contents no longer matches the changed PC value restored from history. + Therefore this unwinder reports any possibly unwound registers as + . */ + +static const struct frame_unwind record_btrace_frame_unwind = +{ + NORMAL_FRAME, + record_btrace_frame_unwind_stop_reason, + record_btrace_frame_this_id, + record_btrace_frame_prev_register, + NULL, + record_btrace_frame_sniffer +}; /* Initialize the record-btrace target ops. */ static void @@ -870,6 +933,7 @@ init_record_btrace_ops (void) ops->to_fetch_registers = record_btrace_fetch_registers; ops->to_store_registers = record_btrace_store_registers; ops->to_prepare_to_store = record_btrace_prepare_to_store; + ops->to_get_unwinder = &record_btrace_frame_unwind; ops->to_stratum = record_stratum; ops->to_magic = OPS_MAGIC; } -- 1.8.3.1