This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH v3] Implement $_exitsignal
- From: Doug Evans <dje at google dot com>
- To: Sergio Durigan Junior <sergiodj at redhat dot com>
- Cc: GDB Patches <gdb-patches at sourceware dot org>, Pedro Alves <palves at redhat dot com>, Tom Tromey <tromey at redhat dot com>
- Date: Mon, 9 Sep 2013 10:07:24 -0700
- Subject: Re: [PATCH v3] Implement $_exitsignal
- Authentication-results: sourceware.org; auth=none
- References: <m3d2p1xy2w dot fsf at redhat dot com>
On Sun, Aug 25, 2013 at 2:25 PM, Sergio Durigan Junior
<sergiodj@redhat.com> wrote:
> Hi,
>
> This is the third attempt to implement the new convenience variable
> $_exitsignal. You can take a look at the other attempts in the
> following threads:
>
> - First attempt:
> <http://sourceware.org/ml/gdb-patches/2013-06/msg00352.html>
>
> - Second attempt:
> <http://sourceware.org/ml/gdb-patches/2013-06/msg00452.html>
>
> I have addressed all the comments, probably except for Tom's message:
>
> <https://sourceware.org/ml/gdb-patches/2013-07/msg00456.html>
>
> Because of another internal discussion we had, when we decided that it
> would be better to leave things this way for now, i.e., $_exitcode and
> $_exitsignal separated.
>
> I have also added code to create the $_exitsignal variable when a
> corefile is opened, and to make $_exitcode become void in that case,
> as explained by myself in:
>
> <https://sourceware.org/ml/gdb-patches/2013-06/msg00473.html>
>
> Now I guess everything makes sense, since we are correctly dealing
> with $_exitsignal and $_exitcode in a mutually exclusive way. There
> is still the $_signo patch to be made, but this one will come later.
>
> OK to apply? I'd appreciate comments, if you have any.
>
> --
> Sergio
>
> gdb/
> 2013-08-25 Sergio Durigan Junior <sergiodj@redhat.com>
>
> * NEWS: Mention new convenience variable $_exitsignal.
> * corelow.c (core_open): Set $_exitsignal to the uncaught signal
> which generated the corefile; reset $_exitcode to void.
> * infrun.c (handle_inferior_event): Reset $_exitsignal for
> TARGET_WAITKIND_EXITED; set $_exitsignal and reset $_exitcode for
> TARGET_WAITKIND_SIGNALLED.
>
> gdb/testsuite
> 2013-08-25 Sergio Durigan Junior <sergiodj@redhat.com>
>
> * gdb.base/corefile.exp: Test whether $_exitsignal is set and
> $_exitcode is void when opening a corefile.
> * gdb.base/exitsignal.exp: New file.
> * gdb.base/segv.c: Likewise.
> * gdb.base/normal.c: Likewise.
>
> gdb/doc
> 2013-08-25 Sergio Durigan Junior <sergiodj@redhat.com>
>
> * gdb.texinfo (Convenience Variables): Document $_exitsignal.
> Update entry for $_exitcode.
> [...]
> diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
> index 6d5dec4..8157447 100644
> --- a/gdb/doc/gdb.texinfo
> +++ b/gdb/doc/gdb.texinfo
> @@ -9751,8 +9751,15 @@ to match the format in which the data was printed.
>
> @item $_exitcode
> @vindex $_exitcode@r{, convenience variable}
> -The variable @code{$_exitcode} is automatically set to the exit code when
> -the program being debugged terminates.
> +When the program being debugged terminates normally, @value{GDBN}
> +automatically sets this variable to the exit code of the program, and
> +resets @code{$_exitsignal} to @code{void}.
> +
> +@item $_exitsignal
> +@vindex $_exitsignal@r{, convenience variable}
> +When the program being debugged dies due to an uncaught signal,
> +@value{GDBN} automatically sets this variable to that signal's number,
> +and resets @code{$_exitcode} to @code{void}.
>
> @item $_exception
> The variable @code{$_exception} is set to the exception object being
Hi.
The docs don't say this,
[and there may be a better place in the docs to say it, and it may not
currently be possible ... but with those caveats in mind ... :-)]
I need to see documented a way for a script to know which of
$_exitcode and $_exitsignal to look at.