This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: RFA: fix PR mi/12661
- From: Pedro Alves <pedro at codesourcery dot com>
- To: gdb-patches at sourceware dot org
- Cc: Tom Tromey <tromey at redhat dot com>
- Date: Wed, 27 Apr 2011 19:26:30 +0100
- Subject: Re: RFA: fix PR mi/12661
- References: <m339l3in3a.fsf@fleche.redhat.com>
On Wednesday 27 April 2011 19:08:25, Tom Tromey wrote:
> @@ -364,10 +364,16 @@ static void
> mi_inferior_exit (struct inferior *inf)
> {
> struct mi_interp *mi = top_level_interpreter_data ();
> + LONGEST exit_code;
> + struct target_waitstatus status;
> + ptid_t ptidp;
>
> target_terminal_ours ();
> - fprintf_unfiltered (mi->event_channel, "thread-group-exited,id=\"i%d\"",
> - inf->num);
> + get_last_target_status (&ptidp, &status);
> + exit_code = status.value.integer;
> + fprintf_unfiltered (mi->event_channel,
> + "thread-group-exited,id=\"i%d\",exit-code=\"%s\"",
> + inf->num, int_string (exit_code, 8, 0, 0, 1));
> gdb_flush (mi->event_channel);
> }
1 - I think this observer is called at places where get_last_target_status
will not make sense --- the last status may well be of another inferior.
E.g., debug against a live target, let it hit a break, detach. Then in the same
gdb, open and close a core.
2 - this observer is called at places where the last target status
wasn't an exit event, thus status.value.integer will not be an exit code.
(e.g., infrun.c:follow_exec).
--
Pedro Alves