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: [PATCH 1/9] Change remote-sim.c to use type-safe registry


Hi Tom,

Just one nit:

> diff --git a/gdb/remote-sim.c b/gdb/remote-sim.c
> index a22a59ed399..9030ead562d 100644
> --- a/gdb/remote-sim.c
> +++ b/gdb/remote-sim.c
> @@ -132,15 +132,15 @@ struct gdbsim_target final
>  
>  static struct gdbsim_target gdbsim_ops;
>  
> -static const struct inferior_data *sim_inferior_data_key;
> -
>  /* Simulator-specific, per-inferior state.  */
>  struct sim_inferior_data {
> +  ~sim_inferior_data ();
> +
>    /* Flag which indicates whether or not the program has been loaded.  */
> -  int program_loaded;
> +  int program_loaded = 0;
>  
>    /* Simulator descriptor for this inferior.  */
> -  SIM_DESC gdbsim_desc;
> +  SIM_DESC gdbsim_desc = nullptr;
>  
>    /* This is the ptid we use for this particular simulator instance.  Its
>       value is somewhat arbitrary, as the simulator target don't have a
> @@ -150,12 +150,14 @@ struct sim_inferior_data {
>    ptid_t remote_sim_ptid;

It probably doesn't matter because it's reassigned after sim_inferior_data,
is allocated, but this field should probably be initialized too, to be consistent
with the other fields.  ptid_t doesn't initialize its fields by default (to remain
a POD), so its initial content would be some garbage.

Otherwise, LGTM.

Simon


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