This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RFA: fix PR mi/12661


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]