From: Pedro Alves <pedro@palves.net>
To: "Aktemur, Tankut Baris" <tankut.baris.aktemur@intel.com>,
"gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: Re: [PATCH] gdbserver: try selecting a thread first to access memory
Date: Tue, 18 Jul 2023 15:03:29 +0100 [thread overview]
Message-ID: <24bc1dc1-b3fa-29e0-fc93-c202d9580a9f@palves.net> (raw)
In-Reply-To: <IA0PR11MB73074B28C433B3E94A68E47AC438A@IA0PR11MB7307.namprd11.prod.outlook.com>
On 2023-07-18 14:36, Aktemur, Tankut Baris wrote:
> On Tuesday, July 18, 2023 3:09 PM, Pedro Alves wrote:
[ snip answers; thanks! ]
>> I'm wondering whether we should have something like:
>>
>> if ((aspace_thread_specific (...) && set_desired_thread ())
>> || set_desired_process ())
>> res = read_inferior_memory (memaddr, myaddr, len);
>> else
>> res = 1;
>
> I believe `aspace_thread_specific` would have to be a target-specific
> logic.
Right.
> What you referred to in the comment [1] above, i.e. "immediately
> exposed to the problem scenario and is forced to fix it", would be caught
> and the target would fix the problem by implementing `aspace_thread_specific`
> appropriately. This makes sense to me.
Exactly.
> An alternative would be that
> the target calls `set_desired_thread` itself, before accessing the memory,
> if it detects that the request is thread-specific. I don't see any low-target
> using `set_desired_thread` ever in the gdbserver codebase, though. So, it
> might be considered a breakage of abstraction. Hence, your suggestion looks
> favorable.
Yeah, that'd be an abstraction violation. Ideally, the gdbserver backends would
have no RSP awareness at all, and would even be reusable by GDB.
Many years ago, the abstraction didn't exist as it does today, and the backends
would even peek into the remote protocol message buffer. That was all separated
out with the non-stop and multi-process work, IIRC, where gdbserver migrated to a
target_ops interface similar to GDB's.
Pedro Alves
next prev parent reply other threads:[~2023-07-18 14:03 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-20 8:35 Tankut Baris Aktemur
2023-07-18 13:09 ` Pedro Alves
2023-07-18 13:36 ` Aktemur, Tankut Baris
2023-07-18 14:03 ` Pedro Alves [this message]
2023-07-18 14:23 ` Aktemur, Tankut Baris
2023-08-01 13:20 ` [PATCH v2] gdbserver: select a thread, if necessary, to access memory (was: [PATCH] gdbserver: try selecting a thread first to access memory) Tankut Baris Aktemur
2023-11-21 19:45 ` Aktemur, Tankut Baris
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=24bc1dc1-b3fa-29e0-fc93-c202d9580a9f@palves.net \
--to=pedro@palves.net \
--cc=gdb-patches@sourceware.org \
--cc=tankut.baris.aktemur@intel.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).