This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: Inadvertently run inferior threads
- From: Pedro Alves <palves at redhat dot com>
- To: Doug Evans <dje at google dot com>
- Cc: Eli Zaretskii <eliz at gnu dot org>, gdb <gdb at sourceware dot org>
- Date: Tue, 23 Jun 2015 13:19:40 +0100
- Subject: Re: Inadvertently run inferior threads
- Authentication-results: sourceware.org; auth=none
- References: <83h9tq3zu3 dot fsf at gnu dot org> <55043A63 dot 6020103 at redhat dot com> <8361a339xd dot fsf at gnu dot org> <5504555C dot 804 at redhat dot com> <550458E0 dot 10206 at redhat dot com> <83y4jrsgui dot fsf at gnu dot org> <83ioaus6pt dot fsf at gnu dot org> <557ED083 dot 1060804 at redhat dot com> <83si9tngaj dot fsf at gnu dot org> <557EF27E dot 3030900 at redhat dot com> <CADPb22RP5gwPYx_DxhbbzZpWjN69Qpxd8Yk52Mwjd0TOTWqbOA at mail dot gmail dot com>
On 06/23/2015 05:07 AM, Doug Evans wrote:
> Maybe we could give up on trying to cover up the stopped/running state
> of the thread and just let info threads report something closer to
> what's actually going on?
> An asterisk or some such accompanying the output of threads in
> intermediate states may be a sufficient clue to the the user.
I strongly disagree.
Plus, frontends also don't want to be flooded with useless
*running -> *stopped -> *running transitions.
Hiding internal stops isn't the complicated part. It's the opposite
that is causing problems. That is, the hiding that threads run at all
when doing an infcall:
(gdb)
p malloc (0)
&"p malloc (0)\n"
~"$1 = (void *) 0x602010\n"
^done
(gdb)
Note no *running/*stopped above.
The next question should be: if you do "print sleep (10000)", then
since the thread / threads was/were never marked running, does that mean that
the user/frontend can end up issuing another execution command
that corrupts the ongoing infcall? The answer is no, but just because
infcalls are always synchronous, so there's no way to issue any command
while an infcall is ongoing anyway. More about it here:
https://sourceware.org/ml/gdb-patches/2014-05/msg00273.html
But fixing this bug may require removing the infcall-specific
(pretend-it-doesnt-run) suppressions, resulting in something like:
(gdb)
p malloc (0)
*running,thread-id="all"
&"p malloc (0)\n"
~"$1 = (void *) 0x602010\n"
*stopped,frame={addr="0x000000000040071c",func="main",args=[{name="argc",value="1"}, (...) ,thread-id="1",stopped-threads="all",core="3" ^done
(gdb)
I'm playing with tests and potential solutions.
Thanks,
Pedro Alves