From: Pedro Alves <palves@redhat.com>
To: Simon Marchi <simon.marchi@ericsson.com>,
Simon Marchi <simon.marchi@polymtl.ca>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] Don't send queries to the MI interpreter
Date: Fri, 10 Feb 2017 19:20:00 -0000 [thread overview]
Message-ID: <9751aea3-0481-4c4b-52e5-3dcccbf89bad@redhat.com> (raw)
In-Reply-To: <71cf7c59-8b3c-595d-b4ec-69f44ae3d6fc@ericsson.com>
On 02/10/2017 07:05 PM, Simon Marchi wrote:
> On 17-02-10 01:07 PM, Pedro Alves wrote:
>> So I think that to support multiple queries like that
>> the simplest / most natural would be to make each
>> UI above run on its own thread, so that each would have
>> its own independent stack/frames.
>
> Indeed. That represents a tremendous amount of work I imagine,
> putting the proper locking mechanisms in place... And if you
> are holding a lock while the query is issued, it would still
> block some other things.
I had it working with a GIL/BKL-style lock, in the original
"new-console" prototype that was later rewritten into what
is "new-ui" today. I.e,. even though we'd have multiple
threads, only one thread really runs at a time. The idea
was that we'd start with a big lock, and then over time break
down the lock into more finer-grained locks.
Here:
https://github.com/palves/gdb/commits/palves/console-extra
- A thread per UI. See the "Start a thread for each UI" patch.
- Per-UI readline (with a giant readline hack)
- Per-UI nurses/TUI instance (it really works!) :-)
The trouble is that this then trips on another nasty problem:
All ptrace calls targeting a process must be issued
from the thread that first attached to that inferior process.
The kernel rejects the ptrace call otherwise eith EIO/EINVAL
or some such, I don't recall which. So on that branch, with
native debugging, if you start the inferior on UI #1, and then
try to read memory from UI #2, it fails... If you instead
try the same against gdbserver, it all works, because in that
case gdbserver handles the ptrace calls, not gdb, so all
ptrace calls come from the same thread in that case.
So for native debugging, we'd need to marshall all ptrace
requests through the same thread...
Thanks,
Pedro Alves
next prev parent reply other threads:[~2017-02-10 19:20 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-10 16:37 Simon Marchi
2017-02-10 16:48 ` Pedro Alves
2017-02-10 16:52 ` Simon Marchi
2017-02-10 17:12 ` Pedro Alves
2017-02-10 17:44 ` Pedro Alves
2017-02-10 18:07 ` Pedro Alves
2017-02-10 18:36 ` Pedro Alves
2017-02-10 19:08 ` Simon Marchi
2017-02-10 19:23 ` Pedro Alves
2017-02-10 19:06 ` Simon Marchi
2017-02-10 19:20 ` Pedro Alves [this message]
2017-02-10 19:26 ` Simon Marchi
2017-02-10 19:32 ` Pedro Alves
2017-02-10 19:30 ` Pedro Alves
2017-02-10 19:03 ` Simon Marchi
2017-02-10 19:08 ` 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=9751aea3-0481-4c4b-52e5-3dcccbf89bad@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