Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Simon Marchi <simon.marchi@polymtl.ca>
Cc: gdb-patches@sourceware.org, Simon Marchi <simon.marchi@ericsson.com>
Subject: Re: [PATCH 3/3] windows: Use ptid from regcache in register fetch/store
Date: Tue, 21 Mar 2017 14:27:00 -0000	[thread overview]
Message-ID: <419e195c-66dd-3d05-d945-2dc0646e6a44@redhat.com> (raw)
In-Reply-To: <80d736666fe9a1484f57f8c60a1f64df@polymtl.ca>

On 03/20/2017 10:22 PM, Simon Marchi wrote:

>>>  static void
>>> -do_windows_fetch_inferior_registers (struct regcache *regcache, int r)
>>> +do_windows_fetch_inferior_registers (struct regcache *regcache,
>>> +                     windows_thread_info *th, int r)
>>>  {
>>>    char *context_offset = ((char *) &current_thread->context) +
>>> mappings[r];
>>
>> Is this reference to "current_thread" still correct?
> 
> Oops, I guess it should be th, like the rest:
> 
>   char *context_offset = ((char *) th->context) + mappings[r];
> 
> Fixed locally.

Thanks.

> 
>>> @@ -537,25 +533,26 @@ static void
>>>  windows_fetch_inferior_registers (struct target_ops *ops,
>>>                    struct regcache *regcache, int r)
>>>  {
>>> -  current_thread = thread_rec (ptid_get_tid (inferior_ptid), TRUE);
>>> +  DWORD pid = ptid_get_tid (regcache_get_ptid (regcache));
>>> +  windows_thread_info *th = thread_rec (pid, TRUE);
>>> +
>>>    /* Check if current_thread exists.  Windows sometimes uses a
>>> non-existent
>>>       thread id in its events.  */
>>
>> The comment is out of date now.
> 
> Fixed locally.
> 
>> Did you look for the history around these comments?  I wonder whether
>> these NULL checks still make sense here if we always reference the
>> regcache's thread.  The equivalent code in gdbserver doesn't seem to
>> have them.
> 
> All I know is that this is the patch that introduced them:
> https://sourceware.org/ml/gdb-patches/2003-12/msg00479.html
> 
> The PR 1048 seems to refer to a pre-bugzilla bug tracking system.  Do we
> still have them somewhere?

Here:

 https://sourceware.org/gdb/wiki/DeveloperTips?highlight=%28gnats%29#Finding_Gnats_bug_entries_in_the_Bugzilla_database

gnats 1048 + 7105 -> bugzilla 8153:

 https://sourceware.org/bugzilla/show_bug.cgi?id=8153

> 
> From what I understand, it's the use case where you attach to a process
> whose main thread has already exited.  If the patch introduced these
> NULL checks, I suppose it's because they were necessary back then to
> work around the Windows bug.  I have no idea if they are still
> necessary, or if the Microsoft people fixed it.  

[...]

> In any case, the fact
> of whether the checks are needed is not impacted by the current patch:
> in the end, we call thread_rec with the same pid with which we would
> have called it before, so we should get the same result.

You're right.

> 
> I'll wait for your input on this before sending a new version.
> 

I don't have further input.

Thanks,
Pedro Alves


  reply	other threads:[~2017-03-21 14:27 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-18 17:08 [PATCH 1/3] Use ptid from regcache in almost all remaining nat files Simon Marchi
2017-03-18 17:08 ` [PATCH 3/3] windows: Use ptid from regcache in register fetch/store Simon Marchi
2017-03-20 15:56   ` Pedro Alves
2017-03-20 22:22     ` Simon Marchi
2017-03-21 14:27       ` Pedro Alves [this message]
2017-03-21 15:24         ` Simon Marchi
2017-03-21 15:39           ` [pushed] " Simon Marchi
2017-03-18 17:08 ` [PATCH 2/3] spu: Use ptid from regcache instead of inferior_ptid Simon Marchi
2017-03-20 15:54   ` Pedro Alves
2017-03-20 21:50     ` Simon Marchi
2017-03-20 21:52     ` [PATCH v2 " Simon Marchi
2017-03-20 22:06       ` Pedro Alves
2017-03-20 22:24         ` Simon Marchi
2017-03-20 15:54 ` [PATCH 1/3] Use ptid from regcache in almost all remaining nat files Pedro Alves
2017-03-20 21:39   ` Simon Marchi

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=419e195c-66dd-3d05-d945-2dc0646e6a44@redhat.com \
    --to=palves@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=simon.marchi@ericsson.com \
    --cc=simon.marchi@polymtl.ca \
    /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