From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 88923 invoked by alias); 17 Mar 2015 19:48:06 -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 88912 invoked by uid 89); 17 Mar 2015 19:48:03 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.4 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mail-ig0-f173.google.com Received: from mail-ig0-f173.google.com (HELO mail-ig0-f173.google.com) (209.85.213.173) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Tue, 17 Mar 2015 19:48:02 +0000 Received: by igbue6 with SMTP id ue6so81568972igb.1 for ; Tue, 17 Mar 2015 12:48:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=wJtDkscprwuSczYoTMPKcwWEEYWvxcdUmhf8XJBVbF8=; b=ZchA+QSkgrdQWAixa5GFy5Z6io8NWldKYa1fpvTJuVOIDb4Po414cSUAlCb/Q64UFy WUmUaKmJMl+Zn4TueBtuYFZLbdUGg9KKYTF4rKWkXfNT2xRTh4IjnvDRW7nrDdUXC7Rq e4PhZskBOL+Whjrws2QKQerJmOLSIXu8PNlMHOZGilB3BxChoerHvGAphX5wKJtwVr0w x8mhwlWgxXRPc0fK8bFV46U/Nx0vPFlzRpc1+gw16xLfrCWHHhkxiga3OjU6Zyxvf1PT vPqY4yL+m71D0NqS/KGv1Cx9qa/n9EiFtknkTv4NCQGtDGbIgcerSo1posmyGBRqN7SD vofg== X-Gm-Message-State: ALoCoQk2ID7IAGPibnlPjDbAK63/uW4G2zMF4FHWKFph3yCfQoa49jBmRJ0JwlIiqmAQymFTB7Mt MIME-Version: 1.0 X-Received: by 10.50.143.42 with SMTP id sb10mr666980igb.49.1426621680308; Tue, 17 Mar 2015 12:48:00 -0700 (PDT) Received: by 10.64.98.103 with HTTP; Tue, 17 Mar 2015 12:48:00 -0700 (PDT) In-Reply-To: <87sid4atms.fsf@igalia.com> 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: Tue, 17 Mar 2015 19:48:00 -0000 Message-ID: Subject: Re: [RFC] [PATCH] Provide the ability to write the frame unwinder in Python From: Alexander Smundak To: Andy Wingo Cc: Doug Evans , gdb-patches Content-Type: text/plain; charset=UTF-8 X-SW-Source: 2015-03/txt/msg00501.txt.bz2 On Tue, Mar 17, 2015 at 1:57 AM, Andy Wingo wrote: > On Mon 16 Mar 2015 18:25, Alexander Smundak writes: > >> I'd like to propose one improvement on the Python side: UnwinderInfo >> is constructed by a frame method instead of an implicit constructor. >> I.e., frame.create_frame_with_id(sp, pc) returns UnwindInfo instance >> whose ID is the result of calling GDB's frame_id_build(sp, pc), >> frame.create_frame_with_id_wild(sp) returns UnwindInfo instance >> whose ID is the results of calling frame_id_build_wild(sp), etc. >> >> The example above would then look as follows: >> def unwind(frame): >> if we_can_handle(frame): >> unwind_info = frame.create_frame_with_id(sp, pc) >> unwind_info.set_previous_frame_register("r0", r0) >> unwind_info.set_previous_frame_register(...) >> return unwind_info >> else >> return None > > Looks great to me :) Thank you for the consideration! I realized after writing my proposal that 'create_frame_xxx' misguides about the type of the returned object. The new name candidate is `unwind_info_with_id' (omitting 'create' prefix, too). > I might consider naming "set_previous_frame_register" as > "add_saved_register", in anticipation of a possible > add_unavailable_register(), add_unmodified_register(), etc, but that is > just a minor nit. It does not reflect that we are setting previous frame's register. > I also think that "ephemeral frame" is easier to document as a concept > than the more generic "frame data", and corresponds better to what is > happening in GDB. YMMV, though. EphemeralFrame emphasizes that the object is short-lived. Maybe it's better to put forward what this object is for and name it InspectedFrame? > As an aside, it seems to me that if we can avoid it, the word "sniffer" > should not enter the documentation or the API. The Python and Guile > APIs don't just sniff, they do the whole of the unwinding operation, so > it's more clear to call them "unwinders". 'Sniffer' comes from the "GDB Internals" document; I am not too fond of it, but I thought it's desirable to use similar terminology. IMHO we reached an agreement on API. I would really like the reviewers to express their opinions about the naming at this point. To summarize: * We need a name for the entity passed to a sniffer. This entity provides access to the registers of the frame being sniffed, and has factory methods to create instances returned by a sniffer. * We need a name for the entity returned by a sniffer. * Should the term 'sniffer' be used in the API and documentation describing implementing frame unwinding in GDB extensions?