From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25523 invoked by alias); 12 Sep 2013 23:59:59 -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 25514 invoked by uid 89); 12 Sep 2013 23:59:59 -0000 Received: from mail-ie0-f171.google.com (HELO mail-ie0-f171.google.com) (209.85.223.171) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Thu, 12 Sep 2013 23:59:59 +0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.6 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED,NO_RELAYS autolearn=ham version=3.3.2 X-HELO: mail-ie0-f171.google.com Received: by mail-ie0-f171.google.com with SMTP id at1so1136467iec.16 for ; Thu, 12 Sep 2013 16:59:56 -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=8bUEuNsJzLBrQ+0nNl7UebCOJPVc717iUpHcxSShB4Q=; b=GydVLYJD4IxecjZAykXhjPXEvAG/+L/WI+sO8mxl8naU7aVdx3w5YLa+m7AMiGvpWZ x42suDBJLJSDDudQOPbEFzRElYV5emEoI0Npzc9KbkrZllpwNP2f7cMcwUAszi2wJ+eg f2KOzvc0KURC8B7zRqP1vR+ugrzX5KtvDGkXNxB7SdIQq6CXz5EnEw6tx14Mf470ruFe xy7XsH87dKS6PFi2lubfNbhfqVog/Gu67iqJMHrp7LDJE+PGtmsUHrD2ikiLdnWIEqgE DO966BxaJgatw+efcz0orugomtqLVB7llQewYrwhDU2xq78wNxvM6VSf2VOgtGWNpl0j EOoA== X-Gm-Message-State: ALoCoQl1XOsnmEoySDLwUiMQIVMJfsCHOKg3lJGHdVQdCdjn6I3yNwEazXzpAl8vhnykUWM7jTFncact1BbV5DE9GaYDg9f9z/R0sCtvsZbSQOBJigv1TMRGjmjrADJKXDSMi0pW1qlOu71ernhjcrb/yHMBTUKAO0cyfAABb3GarVFkO9JVkazsTpfVYBAZE+gY8FHPKaMsNhhscAPmdMWa8AbvsLe7eA== MIME-Version: 1.0 X-Received: by 10.50.67.107 with SMTP id m11mr112254igt.11.1379030396568; Thu, 12 Sep 2013 16:59:56 -0700 (PDT) Received: by 10.64.31.100 with HTTP; Thu, 12 Sep 2013 16:59:56 -0700 (PDT) In-Reply-To: References: Date: Thu, 12 Sep 2013 23:59:00 -0000 Message-ID: Subject: Re: [PATCH/RFA] Introduce new $_isvoid() convenience function From: Doug Evans To: Sergio Durigan Junior Cc: GDB Patches Content-Type: text/plain; charset=ISO-8859-1 X-IsSubscribed: yes X-SW-Source: 2013-09/txt/msg00390.txt.bz2 On Thu, Sep 12, 2013 at 1:11 PM, Sergio Durigan Junior wrote: > gdb/ > 2013-09-12 Sergio Durigan Junior > > * NEWS: Mention new convenience function $_isvoid. > * value.c (isvoid_internal_fn): New function. > (_initialize_values): Add new convenience function $_isvoid. > > gdb/doc/ > 2013-09-12 Sergio Durigan Junior > > * gdb.texinfo (Convenience Functions): Mention new convenience > function $_isvoid. > > gdb/testsuite/ > 2013-09-12 Sergio Durigan Junior > > * gdb.base/gdbvars.exp (test_convenience_functions): New > function. Call it. Hi. Thanks for persevering! While I often follow "it's easier to relax restrictions than impose them after the fact", in this case I wonder if there's any reason to restrict $_isvoid() to convenience variables. Thoughts? For "void foo(){}", is there any real difference to: (gdb) set $foo = foo() (gdb) p $_isvoid($foo) (gdb) p $_isvoid(foo()) [Haven't tried it, but I'm guessing removing the internalva4 check in your patch would make that work.] Also, you've put a fair bit of time into this, and I'm happy with what you've got. And thanks! The high order bit here for me is being able to script $_exitcode + $exitsignal. If we're going with checking for a void value, one could just leave it to be handled in Python. OTOH, this patch is really simple, and IMO it is *nice* to be able to do this from just a plain gdb script, so I'm advocating accepting this patch (modulo maybe handling any void value, not just conv vars). btw, I noticed that if I run a program to exit, and then rerun to main, $_exitcode has the last exit code - I would have expected it to get reset to void upon rerun. After all, if I stop at main the first time through, $_exitcode is void. [I'll file a bug, no need to address this in your patch series.]