public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: "Aktemur, Tankut Baris" <tankut.baris.aktemur@intel.com>
To: Pedro Alves <pedro@palves.net>,
	"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 14:23:10 +0000	[thread overview]
Message-ID: <IA0PR11MB7307EEE79FC369E7C751B03BC438A@IA0PR11MB7307.namprd11.prod.outlook.com> (raw)
In-Reply-To: <24bc1dc1-b3fa-29e0-fc93-c202d9580a9f@palves.net>

On Tuesday, July 18, 2023 4:03 PM, Pedro Alves wrote:
> 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.

Ack. 

I'll revise the patch accordingly and send an update as soon as I can.

Thanks
-Baris


Intel Deutschland GmbH
Registered Address: Am Campeon 10, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de <http://www.intel.de>
Managing Directors: Christin Eisenschmid, Sharon Heck, Tiffany Doon Silva  
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928

  reply	other threads:[~2023-07-18 14:23 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
2023-07-18 14:23       ` Aktemur, Tankut Baris [this message]
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=IA0PR11MB7307EEE79FC369E7C751B03BC438A@IA0PR11MB7307.namprd11.prod.outlook.com \
    --to=tankut.baris.aktemur@intel.com \
    --cc=gdb-patches@sourceware.org \
    --cc=pedro@palves.net \
    /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).