This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH v4] Implement $_exitsignal
- From: Pedro Alves <palves at redhat dot com>
- To: Sergio Durigan Junior <sergiodj at redhat dot com>
- Cc: GDB Patches <gdb-patches at sourceware dot org>, Doug Evans <dje at google dot com>
- Date: Tue, 01 Oct 2013 19:36:56 +0100
- Subject: Re: [PATCH v4] Implement $_exitsignal
- Authentication-results: sourceware.org; auth=none
- References: <m3six3nxr6 dot fsf at redhat dot com>
On 09/17/2013 06:50 PM, Sergio Durigan Junior wrote:
> +# Running until the end.
> +gdb_test "run" "\\\[Inferior .* exited normally\\\]" "Run inferior until the end"
> +
I was about to OK the whole patch, but I noticed this: :-/
"run" won't work with "target remote". Please try the native-gdbserver.exp
board.
As long as there's going to be another round, I think the code
could be simplified. All that logic that clears the variables:
+ /* The inferior did not die because of an uncaught signal,
+ therefore we must clear $_exitsignal. */
+ clear_internalvar (lookup_internalvar ("_exitsignal"));
+ }
+
+ /* Clear the $_exitcode internal variable, because there is no way
+ the inferior could have exited and generated a corefile. */
+ clear_internalvar (lookup_internalvar ("_exitcode"));
could be replaced by this pattern:
/* Clear these first. */
clear $_exitsignal;
clear $_exitcode;
if (blah)
set $_exitsignal;
if (bleh)
set $_exitcode;
IOW, unconditionally clear both variables first, then set
the one that makes sense.
The same pattern can be done in both corelow.c and infrun.c.
(those clears could be put in a small helper, as they'll
be done in two places).
--
Pedro Alves