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] remote-sim.c: Add support for multiple sim instances


On Saturday 07 August 2010 00:20:43, Kevin Buettner wrote:

> +static int
> +gdbsim_close_inferior (struct inferior *inf, void *arg)
> +{
> +  struct sim_inferior_data *sim_data = inferior_data (inf,
> +                                                      sim_inferior_data_key);
> +  if (sim_data != NULL)
> +    {
> +      ptid_t ptid = sim_data->remote_sim_ptid;
> +
> +      sim_inferior_data_cleanup (inf, sim_data);
> +      set_inferior_data (inf, sim_inferior_data_key, NULL);
> +
> +      inferior_ptid = ptid;

Please do "switch_to_thread (ptid)" instead, so that the
program space and current inferior globals are kept
in sync with inferior_ptid while mourning.

> +      generic_mourn_inferior ();
> +    }
> +
> +  return 0;
>  }
>  

> +static int
> +gdbsim_stop_inferior (struct inferior *inf, void *arg)
> +{
> +  struct sim_inferior_data *sim_data
> +    = get_sim_inferior_data (inf, SIM_INSTANCE_NEEDED);
> +
> +  if (sim_data)
> +    {
> +      /* Try to stop the sim.  If it can't stop, exit GDB altogether.  */
> +      if (!sim_stop (sim_data->gdbsim_desc))
> +	{
> +	  quit ();
> +	}
> +    }
> +

Calling quit doesn't exit GDB; it throws the same exception ^C usually
ends up throwing, cancelling the whole current operation all the way back
to the top CLI prompt.   (Well, usually.  Some places catch all
exceptions instead of just RETURN_MASK_ERROR.

Other than that, it looked good to me.  Thanks!

-- 
Pedro Alves


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