This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFC/PATCH] New convenience variable $_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>
- Date: Mon, 17 Jun 2013 18:20:16 +0100
- Subject: Re: [RFC/PATCH] New convenience variable $_exitsignal
- References: <m3mwqqvagk dot fsf at redhat dot com>
On 06/16/2013 07:25 AM, Sergio Durigan Junior wrote:
> @@ -3455,6 +3455,12 @@ handle_inferior_event (struct execution_control_state *ecs)
> set_internalvar_integer (lookup_internalvar ("_exitcode"),
> (LONGEST) ecs->ws.value.integer);
>
> + /* Clear the internal variable, since if we are here chances
> + are the inferior has not been terminated by a signal.
> + And even if it has, then GDB will get to
> + TARGET_WAITKIND_SIGNALLED in time... */
No it won't. The target either returns TARGET_WAITKIND_EXITED
or TARGET_WAITKIND_SIGNALLED. They're mutually exclusive.
> + clear_internalvar (lookup_internalvar ("_exitsignal"));
> +
> /* Also record this in the inferior itself. */
> current_inferior ()->has_exit_code = 1;
> current_inferior ()->exit_code = (LONGEST) ecs->ws.value.integer;
> @@ -3462,7 +3468,17 @@ handle_inferior_event (struct execution_control_state *ecs)
> print_exited_reason (ecs->ws.value.integer);
> }
> else
> - print_signal_exited_reason (ecs->ws.value.sig);
> + {
> + print_signal_exited_reason (ecs->ws.value.sig);
> + /* Set the value of the internal variable $_exitsignal,
> + which holds the signal uncaught by the inferior. */
> + set_internalvar_integer (lookup_internalvar ("_exitsignal"),
> + (LONGEST) ecs->ws.value.sig);
> +
> + /* Clear the $_exitcode internal variable, because if the
> + inferior signalled then its return code does not exist. */
s/the inferior signalled/the inferior died with a signal/ ?
> + clear_internalvar (lookup_internalvar ("_exitcode"));
> + }
--
Pedro Alves