From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10679 invoked by alias); 13 Sep 2013 19:33:37 -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 10669 invoked by uid 89); 13 Sep 2013 19:33:37 -0000 Received: from mtaout20.012.net.il (HELO mtaout20.012.net.il) (80.179.55.166) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 13 Sep 2013 19:33:37 +0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.8 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,KHOP_THREADED autolearn=ham version=3.3.2 X-HELO: mtaout20.012.net.il Received: from conversion-daemon.a-mtaout20.012.net.il by a-mtaout20.012.net.il (HyperSendmail v2007.08) id <0MT200300WXRRV00@a-mtaout20.012.net.il> for gdb-patches@sourceware.org; Fri, 13 Sep 2013 22:33:34 +0300 (IDT) Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout20.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0MT2003GWWZXS000@a-mtaout20.012.net.il>; Fri, 13 Sep 2013 22:33:34 +0300 (IDT) Date: Fri, 13 Sep 2013 19:33:00 -0000 From: Eli Zaretskii Subject: Re: [PATCH/RFA] Introduce new $_isvoid() convenience function In-reply-to: To: Sergio Durigan Junior Cc: dje@google.com, gdb-patches@sourceware.org Reply-to: Eli Zaretskii Message-id: <83li30h5z0.fsf@gnu.org> References: <83a9jhi3h0.fsf@gnu.org> X-IsSubscribed: yes X-SW-Source: 2013-09/txt/msg00406.txt.bz2 > From: Sergio Durigan Junior > Cc: dje@google.com, gdb-patches@sourceware.org > Date: Fri, 13 Sep 2013 14:44:53 -0300 > > > And now a question about this feature: what will use of this function > > do in versions of GDB before 7.7? > > I am not sure I understood your question. Do you want to know what will > happen when the user calls a non-existent $_isvoid convenience function? Yes. > 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? > (gdb) p $_isvoid (a) > Invalid data type for function to be called. > (gdb) p $_isvoid (1) > Invalid data type for function to be called. > > Is this what you wanted to know? IOW, the user won't be able to call > this function from inside his/her script on a GDB prior to 7.7. > > Thanks, > > -- > Sergio > > gdb/ > 2013-09-13 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-13 Sergio Durigan Junior > > * gdb.texinfo (Convenience Functions): Mention new convenience > function $_isvoid. > > gdb/testsuite/ > 2013-09-13 Sergio Durigan Junior > > * gdb.base/gdbvars.c (foo_void): New function. > (foo_int): Likewise. > * gdb.base/gdbvars.exp (test_convenience_functions): New > function. Call it. > > 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. > +@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. Thanks.