This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH v3] Implement $_exitsignal


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]