From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 126291 invoked by alias); 23 Nov 2017 14:09:05 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 126279 invoked by uid 89); 23 Nov 2017 14:09:05 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.7 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,KB_WAM_FROM_NAME_SINGLEWORD,SPF_HELO_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy= X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 23 Nov 2017 14:09:04 +0000 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 089ED3DBC2; Thu, 23 Nov 2017 14:09:03 +0000 (UTC) Received: from [127.0.0.1] (ovpn04.gateway.prod.ext.ams2.redhat.com [10.39.146.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6090F177FE; Thu, 23 Nov 2017 14:09:02 +0000 (UTC) Subject: Re: [PATCH 1/4] Create private_inferior class hierarchy To: Simon Marchi , gdb-patches@sourceware.org References: <1511368867-19365-1-git-send-email-simon.marchi@ericsson.com> <1511368867-19365-2-git-send-email-simon.marchi@ericsson.com> From: Pedro Alves Message-ID: <6e26896a-c65c-1f72-65e5-1a02fdbf9886@redhat.com> Date: Thu, 23 Nov 2017 14:09:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <1511368867-19365-2-git-send-email-simon.marchi@ericsson.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-SW-Source: 2017-11/txt/msg00537.txt.bz2 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 (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