From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 63582 invoked by alias); 11 Mar 2015 08:49:10 -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 63572 invoked by uid 89); 11 Mar 2015 08:49:09 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.3 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,SPF_NEUTRAL autolearn=ham version=3.3.2 X-HELO: sasl.smtp.pobox.com Received: from pb-sasl1.int.icgroup.com (HELO sasl.smtp.pobox.com) (208.72.237.25) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 11 Mar 2015 08:49:08 +0000 Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by pb-sasl1.pobox.com (Postfix) with ESMTP id 7003E36F42; Wed, 11 Mar 2015 04:49:06 -0400 (EDT) Received: from pb-sasl1.int.icgroup.com (unknown [127.0.0.1]) by pb-sasl1.pobox.com (Postfix) with ESMTP id 6829736F41; Wed, 11 Mar 2015 04:49:06 -0400 (EDT) Received: from rusty (unknown [88.160.190.192]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by pb-sasl1.pobox.com (Postfix) with ESMTPSA id 9E3B136F40; Wed, 11 Mar 2015 04:49:05 -0400 (EDT) From: Andy Wingo To: Alexander Smundak Cc: Phil Muldoon , Doug Evans , gdb-patches Subject: Re: [RFC] [PATCH] Provide the ability to write the frame unwinder in Python References: <21714.40641.510825.30998@ruffy2.mtv.corp.google.com> <54E71694.1080304@redhat.com> <87ioei31uj.fsf@igalia.com> <87d24p19tt.fsf@igalia.com> <54FD7DAA.7010603@redhat.com> Date: Wed, 11 Mar 2015 08:49:00 -0000 In-Reply-To: (Alexander Smundak's message of "Tue, 10 Mar 2015 19:22:00 -0700") Message-ID: <87twxrncld.fsf@igalia.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Pobox-Relay-ID: 7972F568-C7CB-11E4-AE4E-96E29252DF99-02397024!pb-sasl1.pobox.com X-IsSubscribed: yes X-SW-Source: 2015-03/txt/msg00271.txt.bz2 Hi, On Wed 11 Mar 2015 03:22, Alexander Smundak writes: > +@defun SnifferInfo.read_register (self, regnum) > +This method returns the contents of the register @var{regnum} in the > +frame as a @code{gdb.Value} object. @var{regnum} values are > +platform-specific. They are usually defined in the corresponding > +xxx-@code{tdep.h} file in the gdb source tree. > +@end defun I note that the patch has no interface to specify registers by name. I still wouldn't do numbers but I see we disagree :) > + /* Call `deprecated_frame_register_read' -- calling > + `value_of_register' would an assert in `get_frame_id' > + because our frame is incomplete. */ > + if (deprecated_frame_register_read (frame, regnum, buffer)) > + val = value_from_contents (register_type (gdbarch, regnum), > + buffer); As mentioned in a previous comment, can be replaced with: val = get_frame_register_value (frame, regnum); > +/* Initialize new UnwindInfo object. */ > +static int > +unwind_infopy_init (PyObject *self, PyObject *args, PyObject *kwargs) > +{ > + PyObject *pyo_sniffer_info; > + PyObject *pyo_regs; > + > + if (PyArg_UnpackTuple (args, "__init__", 2, 2, &pyo_sniffer_info, &pyo_regs) > + && (pyo_sniffer_info != NULL > + && PyObject_IsInstance (pyo_sniffer_info, > + (PyObject *) &sniffer_info_object_type) > 0) > + && pyo_regs != NULL > + && PyTuple_Check (pyo_regs)) > + { > + unwind_info_object *unwind_info = (unwind_info_object *) self; > + unwind_info->frame_id = null_frame_id; > + unwind_info->sniffer_info = pyo_sniffer_info; > + Py_INCREF (pyo_sniffer_info); > + unwind_info->previous_frame_registers = pyo_regs; Probably better to check types and values here, so the user gets a good backtrace. What do you think about merging the SnifferInfo and UnwindInfo objects into an EphemeralFrame object? It would be nice to use the same nouns on the Guile and Python sides. Andy