From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 45449 invoked by alias); 18 Mar 2015 08:54:42 -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 45415 invoked by uid 89); 18 Mar 2015 08:54:41 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.4 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, 18 Mar 2015 08:54:39 +0000 Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by pb-sasl1.pobox.com (Postfix) with ESMTP id 5FAAA3A399; Wed, 18 Mar 2015 04:54:37 -0400 (EDT) Received: from pb-sasl1.int.icgroup.com (unknown [127.0.0.1]) by pb-sasl1.pobox.com (Postfix) with ESMTP id 57DC33A398; Wed, 18 Mar 2015 04:54:37 -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 823683A397; Wed, 18 Mar 2015 04:54:36 -0400 (EDT) From: Andy Wingo To: Alexander Smundak Cc: 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> <87twxrncld.fsf@igalia.com> <87ioe1dvu2.fsf@igalia.com> <87sid4atms.fsf@igalia.com> Date: Wed, 18 Mar 2015 08:54:00 -0000 In-Reply-To: (Alexander Smundak's message of "Tue, 17 Mar 2015 14:37:24 -0700") Message-ID: <87r3smado6.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: 678F9316-CD4C-11E4-885E-96E29252DF99-02397024!pb-sasl1.pobox.com X-IsSubscribed: yes X-SW-Source: 2015-03/txt/msg00533.txt.bz2 On Tue 17 Mar 2015 22:37, Alexander Smundak writes: > +/* The implementation of > + gdb.UnwindInfo.set_previous_frame_register (REG, VALUE) -> None. */ > + > +static PyObject * > +unwind_infopy_set_previous_frame_register (PyObject *self, PyObject *args) > +{ > + unwind_info_object *unwind_info = (unwind_info_object *) self; > + sniffer_info_object *sniffer_info > + = (sniffer_info_object *) (unwind_info->sniffer_info); > + PyObject *pyo_reg_id; > + PyObject *pyo_reg_value; > + int regnum; > + > + if (sniffer_info->frame_info == NULL) > + { > + PyErr_SetString (PyExc_ValueError, > + "Attempting to read register from stale SnifferInfo"); > + return NULL; > + } Nit: we are setting the register here. > +int > +gdbpy_initialize_unwind (void) > +{ > + int rc; > + add_setshow_zuinteger_cmd > + ("py-unwind", class_maintenance, &pyuw_debug, > + _("Set Python unwinder debugging."), > + _("Show Python unwinder debugging."), > + _("When non-zero, Pythin unwinder debugging is enabled."), "Python" > +static PyMethodDef sniffer_info_object_methods[] = > +{ > + { "read_register", sniffer_infopy_read_register, METH_VARARGS, > + "read_register (REGNUM) -> gdb.Value\n" > + "Return the value of the REGNUM in the frame." }, > + { "unwind_info_with_id", > + sniffer_infopy_unwind_info_with_id, METH_VARARGS, > + "unwind_info_with_id (SP, PC) -> gdb.UnwindInfo\n" > + "Construct UnwindInfo for this FrameData, using given SP and PC registers \n" > + "to identify the frame." }, > + { "unwind_info_with_id_special", > + sniffer_infopy_unwind_info_with_id_special, METH_VARARGS, > + "unwind_info_with_id_special (SP, PC, SPECIAL) -> gdb.UnwindInfo\n" > + "Construct UnwindInfo for this FrameData, using given SP, PC, and SPECIAL " > + "registers to identify the frame." }, > + { "unwind_info_with_id_wild", > + sniffer_infopy_unwind_info_with_id_wild, METH_VARARGS, > + "unwind_info_with_id_wild (SP) ->gdb.UnwindInfo\n" > + "Construct UnwindInfo for this FrameData, using given SP register to \n" > + "identify the frame." }, > + {NULL} /* Sentinel */ > +}; Still no support for register names. > +import gdb > +from gdb.sniffer import Sniffer > + > +class TestSniffer(Sniffer): I still think it's much better to call these "unwinders". You say that it's the terminology that GDB uses but that's not really the case -- "sniffer" names part of the unwinder interface, which Python and Guile implement the whole of. You chose "unwinder" as the documentation heading and the file name; why introduce a new term to the user? Andy