This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 1/4] Create private_inferior class hierarchy
On 11/22/2017 04:41 PM, Simon Marchi wrote:
> diff --git a/gdb/darwin-nat-info.c b/gdb/darwin-nat-info.c
> index 44782bf..feab181 100644
> --- a/gdb/darwin-nat-info.c
> +++ b/gdb/darwin-nat-info.c
> @@ -118,7 +118,11 @@ get_task_from_args (const char *args)
> {
> if (ptid_equal (inferior_ptid, null_ptid))
> printf_unfiltered (_("No inferior running\n"));
> - return current_inferior ()->priv->task;
> +
> + darwin_inferior *priv
> + = (darwin_inferior *) current_inferior ()->priv.get ();
> +
How about adding a function like this:
static darwin_inferior *
get_darwin_inferior (inferior *inf)
{
return static_cast<darwin_inferior *> (inf->priv.get ());
}
and then using it throughout instead of the casts.
>
> +/* Get the remote private inferior data associated to INF. */
> +
> +static remote_inferior *get_remote_inferior (inferior *inf)
Ah, you've added something like it to remote.c
Missing line break before get_, though.
> +{
> + if (inf->priv == NULL)
> + inf->priv.reset (new remote_inferior);
> +
> + return (remote_inferior *) inf->priv.get ();
static_cast would ensure that remote_inferior actually
inherits private_inferior.
> +}
> +
Thanks,
Pedro Alves