From: Sergio Durigan Junior <sergiodj@redhat.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: dje@google.com, gdb-patches@sourceware.org
Subject: Re: [PATCH/RFA] Introduce new $_isvoid() convenience function
Date: Fri, 13 Sep 2013 19:41:00 -0000 [thread overview]
Message-ID: <m3ioy4y0fv.fsf@redhat.com> (raw)
In-Reply-To: <83li30h5z0.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 13 Sep 2013 22:33:23 +0300")
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
next prev parent reply other threads:[~2013-09-13 19:41 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-12 20:11 Sergio Durigan Junior
2013-09-12 23:59 ` Doug Evans
2013-09-13 6:42 ` Sergio Durigan Junior
2013-09-13 7:30 ` Eli Zaretskii
2013-09-13 17:45 ` Sergio Durigan Junior
2013-09-13 19:33 ` Eli Zaretskii
2013-09-13 19:41 ` Sergio Durigan Junior [this message]
2013-09-13 19:47 ` Eli Zaretskii
2013-09-13 21:17 ` Sergio Durigan Junior
2013-09-14 7:00 ` Eli Zaretskii
2013-09-16 17:19 ` Sergio Durigan Junior
2013-09-16 17:23 ` Doug Evans
2013-09-16 17:47 ` Sergio Durigan Junior
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m3ioy4y0fv.fsf@redhat.com \
--to=sergiodj@redhat.com \
--cc=dje@google.com \
--cc=eliz@gnu.org \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox