This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH v5] Exit code of exited inferiors in -list-thread-groups
- From: Pedro Alves <palves at redhat dot com>
- To: Simon Marchi <simon dot marchi at ericsson dot com>, Tom Tromey <tromey at redhat dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Wed, 21 May 2014 19:09:15 +0100
- Subject: Re: [PATCH v5] Exit code of exited inferiors in -list-thread-groups
- Authentication-results: sourceware.org; auth=none
- References: <1400018204-29559-1-git-send-email-simon dot marchi at ericsson dot com> <87mweh31qi dot fsf at fleche dot redhat dot com> <537CE38B dot 7040000 at ericsson dot com>
On 05/21/2014 06:34 PM, Simon Marchi wrote:
> On Fri 16 May 2014 04:30:45 PM EDT, Tom Tromey wrote:
>>>>>>> "Simon" == Simon Marchi <simon.marchi@ericsson.com> writes:
>>
>> Simon> This one was also from a year ago, I would like to make sure it is still
>> Simon> OK.
>>
>> Simon> + if (inferior->has_exit_code)
>> Simon> + ui_out_field_string (uiout, "exit-code",
>> Simon> + int_string (inferior->exit_code, 8, 0, 0, 1));
>>
>> Why not the simpler ui_out_field_int?
>> Going out of the way to print it in octal seems a bit odd for a machine
>> interface.
>>
>> Tom
>
> Agreed. I found that the exit code is often represented in octal (the
> reason for this probably predates my birth). But for MI, it does not
> matter.
Though it might be a little less surprising if all places that print
the exit code print it the same way. That way it's possible that
frontends just treat the exit code as a string, and present it as
is to the user. They may already be doing that.
The =thread-group-exited code has:
mi_inferior_exit (struct inferior *inf)
{
struct mi_interp *mi = top_level_interpreter_data ();
target_terminal_ours ();
if (inf->has_exit_code)
fprintf_unfiltered (mi->event_channel,
"thread-group-exited,id=\"i%d\",exit-code=\"%s\"",
inf->num, int_string (inf->exit_code, 8, 0, 0, 1));
(I bet that's where the new code was copied from.)
--
Pedro Alves