Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Simon Marchi <simon.marchi@polymtl.ca>
To: Pedro Alves <palves@redhat.com>
Cc: Simon Marchi <simon.marchi@ericsson.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH 1/4] Create private_inferior class hierarchy
Date: Thu, 23 Nov 2017 16:17:00 -0000	[thread overview]
Message-ID: <757702afe1579a9d96d2aa3c47a65918@polymtl.ca> (raw)
In-Reply-To: <6e26896a-c65c-1f72-65e5-1a02fdbf9886@redhat.com>

On 2017-11-23 09:09, Pedro Alves wrote:
> 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.

Good idea.

>> 
>> +/* 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.

Oops, thanks.

>> +{
>> +  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.

Didn't know static_cast checked that, cool!  I'll use that.

Simon


  reply	other threads:[~2017-11-23 16:17 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-22 16:41 [PATCH 0/4] Poison XNEW and friends for non-POD types Simon Marchi
2017-11-22 16:41 ` [PATCH 1/4] Create private_inferior class hierarchy Simon Marchi
2017-11-22 22:20   ` Joel Brobecker
2017-11-24 15:46     ` Simon Marchi
2017-11-24 21:31       ` Joel Brobecker
2017-11-23 14:09   ` Pedro Alves
2017-11-23 16:17     ` Simon Marchi [this message]
2017-11-22 16:42 ` [PATCH 3/4] Create private_thread_info hierarchy Simon Marchi
2017-11-23 14:41   ` Pedro Alves
2017-11-23 16:54     ` Simon Marchi
2017-11-23 16:56       ` Simon Marchi
2017-11-22 16:42 ` [PATCH 2/4] remote: C++ify thread_item and threads_listing_context Simon Marchi
2017-11-23 14:22   ` Pedro Alves
2017-11-23 16:48     ` Simon Marchi
2017-11-23 16:52       ` Pedro Alves
2017-11-22 16:42 ` [PATCH 4/4] Poison XNEW and friends for types that should use new/delete Simon Marchi
2017-11-23 15:02   ` Pedro Alves
2017-11-23 17:27     ` Simon Marchi
2017-11-23 17:31       ` Pedro Alves

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=757702afe1579a9d96d2aa3c47a65918@polymtl.ca \
    --to=simon.marchi@polymtl.ca \
    --cc=gdb-patches@sourceware.org \
    --cc=palves@redhat.com \
    --cc=simon.marchi@ericsson.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox