From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14928 invoked by alias); 7 Feb 2014 06:53: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 14916 invoked by uid 89); 7 Feb 2014 06:53:09 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.2 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-vc0-f172.google.com Received: from mail-vc0-f172.google.com (HELO mail-vc0-f172.google.com) (209.85.220.172) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Fri, 07 Feb 2014 06:53:08 +0000 Received: by mail-vc0-f172.google.com with SMTP id lf12so2291224vcb.17 for ; Thu, 06 Feb 2014 22:53:06 -0800 (PST) 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=lZl27sHiPiPsRIcNOnnBPfNYZ9vExo0Kb71SSRDiir8=; b=T2Mu3Hm6pgA55HHvVRl9t+vfzJh40Z8QWuqYLvUqSifvDN/Ye4nM1qSJ+xuf1QI16i FXg9ZVbnuWfGCURpUWZKEL/9IJO48IXmaBZX329gnm9tLCYcubbRVyRExXo3/blC0q+o rtGeO70GgYT3vaI12KODn4BavZ7r0hiRcfCthfH6zKff16hNlT5z+trKy7ORFKhlvlcW 3Xjt33WbaPi+ZlOs5kAsxIqNKEemlXeJe5K8tUpiG1nlXqV69rBLR6HOkgtt3YN6/4UT 9PhcKtqcW9eFL5uOO1eo2wLMxMgDuJKqCuqDe/pqsbvhFQKa2K1v5PP/kU82bh3/zxBP aUDQ== X-Gm-Message-State: ALoCoQkft8ce6luG3RH9eOmtfMnPu45DFo5Wl4owm8gkZl4JTKFBKx9Nnj6visL35eJFePPOyYALXvSeBkZlNxNIYN2JSS/v8PY3DyxvODEGbod9Qjalco29EVf5DjrYdi5yyjcZ5HWMdk+XfEyKIUsJuDHUMj8G+JpASajqUJrnwlrM7lDZqt8cW+uNyIklCc6CuZPnMcjR0PRhD03BTac5umPvcdcvHA== MIME-Version: 1.0 X-Received: by 10.220.92.135 with SMTP id r7mr8966477vcm.11.1391755986106; Thu, 06 Feb 2014 22:53:06 -0800 (PST) Received: by 10.52.51.234 with HTTP; Thu, 6 Feb 2014 22:53:05 -0800 (PST) In-Reply-To: References: Date: Fri, 07 Feb 2014 06:53:00 -0000 Message-ID: Subject: Re: [RFC/Patch v4] Call overloaded operators to perform valid Python operations on struct/class values. From: Doug Evans To: Siva Chandra Cc: Eli Zaretskii , gdb-patches , Tom Tromey Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes X-SW-Source: 2014-02/txt/msg00184.txt.bz2 On Sun, Feb 2, 2014 at 12:06 PM, Siva Chandra wrote: > On Sat, Jan 25, 2014 at 10:45 AM, Doug Evans wrote: >> IWBN if the docs listed exactly which operations are supported. > > I have added it now in the attached patch. Eli should probably take > another look. > >> [I realize this patch relies on the user-defined method patch, so it >> can't go in just yet.] > > Are you referring to the debug methods patch? If yes, I do think this > patch relies on that patch. This is an independent feature which would > make writing debug methods simpler (IMO). > > 2014-02-02 Siva Chandra Reddy > > Call overloaded operators to perform valid Python operations on > struct/class values. > * NEWS (Python Scripting): Add entry for this new feature. > * python/py-value.c (valpy_binop): Call value_x_binop for struct > and class values. > > testsuite/ > * gdb.python/py-value-cc.cc: Improve test case to enable testing > operations on gdb.Value objects. > * gdb.python/py-value-cc.exp: Add new test to test operations on > gdb.Value objects. > > doc/ > * gdb.texinfo (Values From Inferior): Add description about > performing valid Python operations on gdb.Value objects. Hi. The patch is fine with me. I put in some time to play with the patch. One thing I wondered about is what happens if the user does string1 + string2? We do leak memory. That's not a problem with this patch of course, though by making this scriptable the problem gets worse. I filed https://sourceware.org/bugzilla/show_bug.cgi?id=16537 btw, Just writing this down since it's on my mind: If anything needs to be done it should be addressed in a separate patch. And maybe leaving things as-is is ok, and just a doc addition is all that's needed. Anyways, hand called functions (which includes c++ operators) run the inferior (setting aside using debug methods). The more we make it easy to invoke c++ operators the more users are going to run into the issues of hand called functions (e.g. what if they have a breakpoint set that the c++ operator happens to trip?).