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: Sergio Durigan Junior <sergiodj at redhat dot com>
- To: Pedro Alves <palves at redhat dot com>
- Cc: GDB Patches <gdb-patches at sourceware dot org>
- Date: Mon, 17 Jun 2013 14:35:25 -0300
- Subject: Re: [RFC/PATCH] New convenience variable $_exitsignal
- References: <m3mwqqvagk dot fsf at redhat dot com> <51BF4550 dot 80704 at redhat dot com>
On Monday, June 17 2013, Pedro Alves wrote:
> 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.
You're right, I confused the matters here, I was debugging with "debug
infrun" and saw a _STOPPED then a _SIGNALLED, and my mind twisted when I
wrote that comment.
>> + 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/ ?
Yes, will change. I will resubmit the patch with all the modifications
(by Eli, Doug and you) next.
--
Sergio