From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14475 invoked by alias); 13 Sep 2013 19:41:01 -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 14462 invoked by uid 89); 13 Sep 2013 19:41:01 -0000 Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 13 Sep 2013 19:41:01 +0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r8DJeukV017436 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 13 Sep 2013 15:40:56 -0400 Received: from psique (ovpn-113-70.phx2.redhat.com [10.3.113.70]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r8DJermu017845 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Fri, 13 Sep 2013 15:40:55 -0400 From: Sergio Durigan Junior To: Eli Zaretskii Cc: dje@google.com, gdb-patches@sourceware.org Subject: Re: [PATCH/RFA] Introduce new $_isvoid() convenience function References: <83a9jhi3h0.fsf@gnu.org> <83li30h5z0.fsf@gnu.org> X-URL: http://www.redhat.com Date: Fri, 13 Sep 2013 19:41:00 -0000 In-Reply-To: <83li30h5z0.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 13 Sep 2013 22:33:23 +0300") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-IsSubscribed: yes X-SW-Source: 2013-09/txt/msg00407.txt.bz2 On Friday, September 13 2013, Eli Zaretskii wrote: >> Starting program: /home/sergio/work/src/git/isvoid/build-64/a.out >> >> Temporary breakpoint 1, main () at 1.c:12 >> 12 return 0; >> (gdb) p $_isvoid ($var) >> Invalid data type for function to be called. > > Exactly. That's a confusing diagnostics. Do we care? Can we do > anything about it? About older GDB versions not offering this convenience function? No, I don't think we can do anything about it. About the "Do we care?" question, I don't really have an answer. But this is a new feature, therefore we should expect the users to understand that it cannot be used if it doesn't exist in their GDB... >> diff --git a/gdb/NEWS b/gdb/NEWS >> index ad97f6f..35aaf41 100644 >> --- a/gdb/NEWS >> +++ b/gdb/NEWS >> @@ -3,6 +3,11 @@ >> >> *** Changes since GDB 7.6 >> >> +* New convenience function "$_isvoid", to check whether an expression >> + is void. A void expression is an expression where the type of the >> + result is `void'; for example, when calling a function whose return >> + type is `void'. > > But this function is being introduced mainly for testing convenience > variables, isn't it? Then the explanation should describe that use > case first, I think. OK, I will rewrite and resubmit. >> +@item $_isvoid (@var{expr}) >> +@findex $_isvoid@r{, convenience function} >> +Return one if the expression @var{expr} is void. Otherwise it >> +returns zero. >> + >> +A void expression is an expression where the type of the result is >> +`void'. For example, given the following function: >> + >> +@smallexample >> +void >> +foo (void) >> +@{ >> +@} >> +@end smallexample >> + >> +The result of calling it inside @value{GDBN} is `void': >> + >> +@smallexample >> +(@value{GDBP}) print foo () >> +$1 = void >> +(@value{GDBP}) print $_isvoid (foo ()) >> +$2 = 1 >> +(@value{GDBP}) set $v = foo () >> +(@value{GDBP}) print $v >> +$3 = void >> +(@value{GDBP}) print $_isvoid ($v) >> +$4 = 1 >> +@end smallexample >> + >> +@end table > > This is fine, but I would also include an example with $_exitcode. I intend to expand this explanation when I resubmit the patch for $_exitsignal. In fact, I will add another example showing the behavior of $_exitsignal and $_exitcode. But if you wish, I can add $_exitcode here as well. -- Sergio