From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4705 invoked by alias); 18 Aug 2013 19:07:50 -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 4691 invoked by uid 89); 18 Aug 2013 19:07:50 -0000 X-Spam-SWARE-Status: No, score=-7.7 required=5.0 tests=AWL,BAYES_00,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Sun, 18 Aug 2013 19:07:49 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r7IJ7l36004075 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sun, 18 Aug 2013 15:07:48 -0400 Received: from host2.jankratochvil.net (ovpn-116-37.ams2.redhat.com [10.36.116.37]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r7IJ7gjN000824 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Sun, 18 Aug 2013 15:07:45 -0400 Date: Sun, 18 Aug 2013 19:07:00 -0000 From: Jan Kratochvil To: Markus Metzger Cc: gdb-patches@sourceware.org Subject: Re: [patch v4 13/24] record-btrace, frame: supply target-specific unwinder Message-ID: <20130818190742.GJ24153@host2.jankratochvil.net> References: <1372842874-28951-1-git-send-email-markus.t.metzger@intel.com> <1372842874-28951-14-git-send-email-markus.t.metzger@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1372842874-28951-14-git-send-email-markus.t.metzger@intel.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes X-SW-Source: 2013-08/txt/msg00466.txt.bz2 On Wed, 03 Jul 2013 11:14:23 +0200, Markus Metzger wrote: > 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 | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++ > 1 files changed, 66 insertions(+), 0 deletions(-) > > diff --git a/gdb/record-btrace.c b/gdb/record-btrace.c > index e9c0801..cb1f3bb 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; > @@ -844,6 +845,70 @@ 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 doesn't seem right. Yet, I don't see how I could get from a frame > + to its thread. */ That's OK. Either remove the comment or: /* THIS_FRAME does not contain a reference to its thread. */ > + tp = find_thread_ptid (inferior_ptid); > + if (tp == NULL) > + return 0; 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 > @@ -874,6 +939,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.7.1