From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17201 invoked by alias); 19 Dec 2013 14:11:13 -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 17192 invoked by uid 89); 19 Dec 2013 14:11:13 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.0 required=5.0 tests=AWL,BAYES_00,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-wg0-f52.google.com Received: from mail-wg0-f52.google.com (HELO mail-wg0-f52.google.com) (74.125.82.52) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Thu, 19 Dec 2013 14:11:12 +0000 Received: by mail-wg0-f52.google.com with SMTP id x13so1133076wgg.7 for ; Thu, 19 Dec 2013 06:11:09 -0800 (PST) MIME-Version: 1.0 X-Received: by 10.194.175.202 with SMTP id cc10mr1707770wjc.48.1387462269381; Thu, 19 Dec 2013 06:11:09 -0800 (PST) Received: by 10.194.123.4 with HTTP; Thu, 19 Dec 2013 06:11:09 -0800 (PST) In-Reply-To: References: <871u1j2ldi.fsf@fleche.redhat.com> Date: Thu, 19 Dec 2013 14:11:00 -0000 Message-ID: Subject: Re: [RFC/Patch] Call overloaded operators to perform valid Python operations on struct/class values. From: Doug Evans To: Siva Chandra Cc: Tom Tromey , gdb-patches Content-Type: text/plain; charset=ISO-8859-1 X-IsSubscribed: yes X-SW-Source: 2013-12/txt/msg00746.txt.bz2 On Wed, Dec 18, 2013 at 3:15 PM, Siva Chandra wrote: > On Wed, Dec 18, 2013 at 8:37 AM, Doug Evans wrote: >> Not that this could work, but for illustration's sake: >> smart_ptr = gdb.parse_and_eval ("my_smart_ptr"); >> dereferenced_smart_ptr = gdb.parse_and_eval("*%V" % smart_ptr) > > Should work. May be the '%' syntax would not (I am not sure). But, we > could consider other alternatives [Replace occurrences of $1, $2, etc > for example]. > > Is this an exhaustive solution or a cool fallback option when no other > Pythonic way works Both? [Not sure I understand the question.] > [Side topic: Should smart_ptr.dereference() invoke 'operator*'? The > documentation says this: "... behavior of Value.dereference is > identical to applying the C unary operator * on a given value." And, I > remember writing this myself :-)] Dunno.