From: Simon Marchi <simon.marchi@ericsson.com>
To: Pedro Alves <palves@redhat.com>, <gdb-patches@sourceware.org>
Subject: Re: [PATCH 0/7] Pass ptid to target_ops register methods
Date: Fri, 10 Mar 2017 16:06:00 -0000 [thread overview]
Message-ID: <402e87d0-f05a-07dc-fb3f-0c0bbc5eef28@ericsson.com> (raw)
In-Reply-To: <706d8cd5-f3a2-c9dc-9d87-3cf171b3d012@redhat.com>
On 17-03-08 06:31 PM, Pedro Alves wrote:
> A question that I think needs answering is:
>
> A regcache stores the ptid it is connected to as a field.
> We rely on it for get_thread_regcache for example.
>
> So, couldn't we instead just use that ptid?
>
> Thanks,
> Pedro Alves
Huh, good point. At first I wasn't sure I liked it, because I thought
the method interfaces would clearer with the ptid as its own parameter.
However, it would probably be more error-prone, because it would make it
possible to call to_fetch/store_register with a regcache that doesn't
match the provided ptid. Actually, in the current state, I guess it's
also possible to call to_fetch/store_register with a regcache that
doesn't match inferior_ptid. In that regard, using the ptid from the
regcache is probably the safest thing to do. I'll try that.
Looking at the comments in regcache:
/* Is this a read-only cache? A read-only cache is used for saving
the target's register state (e.g, across an inferior function
call or just before forcing a function return). A read-only
cache can only be updated via the methods regcache_dup() and
regcache_cpy(). The actual contents are determined by the
reggroup_save and reggroup_restore methods. */
int readonly_p;
/* If this is a read-write cache, which thread's registers is
it connected to? */
ptid_t ptid;
I understand that in some situations, a regcache can have a minus_one ptid.
However, it looks like a regcache with an invalid ptid is never used to
directly fetch and store registers. Instead, it is used as a "backup", the
content being copied from and to a regcache connected to a thread. Does
that sound right?
next prev parent reply other threads:[~2017-03-10 16:06 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-08 16:42 Simon Marchi
2017-03-08 16:42 ` [PATCH 3/7] Define and use typedefs for bsd_uthread_ops fields Simon Marchi
2017-03-08 16:42 ` [PATCH 1/7] windows: Don't use current_thread for register fetch/store Simon Marchi
2017-03-08 16:42 ` [PATCH 6/7] Pass ptid to target_store_registers Simon Marchi
2017-03-08 16:42 ` [PATCH 4/7] Pass down ptid in bsd_uthread_ops layer Simon Marchi
2017-03-08 16:42 ` [PATCH 2/7] Add overload of s390_inferior_tid with a parameter Simon Marchi
2017-03-08 16:42 ` [PATCH 7/7] Pass ptid to to_prepare_to_store Simon Marchi
2017-03-08 16:42 ` [PATCH 5/7] Pass ptid to target_fetch_registers Simon Marchi
2017-03-08 21:08 ` Simon Marchi
2017-03-08 17:03 ` [PATCH 0/7] Pass ptid to target_ops register methods Simon Marchi
2017-03-08 23:31 ` Pedro Alves
2017-03-10 16:06 ` Simon Marchi [this message]
2017-03-10 17:12 ` Ulrich Weigand
2017-03-10 17:51 ` 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=402e87d0-f05a-07dc-fb3f-0c0bbc5eef28@ericsson.com \
--to=simon.marchi@ericsson.com \
--cc=gdb-patches@sourceware.org \
--cc=palves@redhat.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