From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: Oleg Nesterov <oleg@redhat.com>
Cc: Roland McGrath <roland@redhat.com>,
archer@sourceware.org, utrace-devel@redhat.com
Subject: Re: Q: multiple inferiors, all-stop && vCont
Date: Tue, 03 Aug 2010 18:37:00 -0000 [thread overview]
Message-ID: <20100803183640.GA27303@host1.dyn.jankratochvil.net> (raw)
In-Reply-To: <20100803165359.GA11274@redhat.com>
On Tue, 03 Aug 2010 18:53:59 +0200, Oleg Nesterov wrote:
> On 08/03, Jan Kratochvil wrote:
> > On Tue, 03 Aug 2010 16:30:04 +0200, Oleg Nesterov wrote:
> > > However, I do not really understand how this can work reliably in the
> > > terms of remote protocol. Somehow this scheme relies on the fact that
> > > gdb will send another vCont;t:pTGID.-1 _once again_ after the previous
> > > vCont;t:pTGID.-1, and gdbserver can report the other threads via
> > > Stop/vStopped. OK, I hope this doesn't matter.
> >
> > attach_command_post_wait:
> >
> > /* At least the current thread is already stopped. */
> >
> > /* In all-stop, by definition, all threads have to be already
> > stopped at this point. In non-stop, however, although the
> > selected thread is stopped, others may still be executing.
> > Be sure to explicitly stop all threads of the process. This
> > should have no effect on already stopped threads. */
> > if (non_stop)
> > target_stop (pid_to_ptid (inferior->pid));
>
> This just reflects the current situation with the current implementation.
> gdb already did
>
> vAttach;PID
> vCont;t:pPID.-1
>
> I do not see anything in the _documentation_ which could explain that
> only the main thread can be stopped despite the fact "-1" means all
> threads.
"-1" really means all threads - all those gdbserver knows about that time.
Anyway this double-stop issue is gdbserver/libthread_db specific and offtopic
for ugdb.
> Once again, I already understand why gdb + gdbserver work this way,
> I meant remote protocol "in general".
In remote protocol - and even internally in gdbserve - "-1" really always
means all the (currently known) threads.
> And in fact, I do not think your explanation is correct. Yes, this
> attach_command_post_wait() is called during attach. But even after that
> gdbserver reports only the main thread. This happens before qSymbol
> stage.
This attach_command_post_wait code is executed after the qSymbol command.
The first single-thread vCont:
#0 putpkt (buf=0x1f348b0 "vCont;t:p517.-1") at remote.c:6730
#1 in remote_stop_ns (ptid=...) at remote.c:4709
#2 in remote_stop (ptid=...) at remote.c:4747
#3 in target_stop (ptid=...) at target.c:3031
#4 in attach_command (args=0x7fffffffd861 "1303", from_tty=1) at infcmd.c:2436
#5 in do_cfunc (c=0x1db8bf0, args=0x7fffffffd861 "1303", from_tty=1) at ./cli/cli-decode.c:67
#6 in cmd_func (cmd=0x1db8bf0, args=0x7fffffffd861 "1303", from_tty=1) at ./cli/cli-decode.c:1771
#7 in execute_command (p=0x7fffffffd864 "3", from_tty=1) at top.c:422
#8 in catch_command_errors (command=0x48a3e3 <execute_command>, arg=0x7fffffffd85a "attach 1303", from_tty=1, mask=6) at exceptions.c:534
#9 in captured_main (data=0x7fffffffd360) at ./main.c:887
The second all-threads vCont:
#0 putpkt (buf=0x1f4ecb0 "vCont;t:p517.-1") at remote.c:6730
#1 in remote_stop_ns (ptid=...) at remote.c:4709
#2 in remote_stop (ptid=...) at remote.c:4747
#3 in target_stop (ptid=...) at target.c:3031
#4 in attach_command_post_wait (args=0x1f3b6f0 "1303", from_tty=1, async_exec=0) at infcmd.c:2334
#5 in attach_command_continuation (args=0x1f3b6a0) at infcmd.c:2355
#6 in do_my_cleanups (pmy_chain=0x7fffffffcd08, old_chain=0x0) at utils.c:421
#7 in do_all_inferior_continuations () at utils.c:692
#8 in inferior_event_handler (event_type=INF_EXEC_COMPLETE, client_data=0x0) at inf-loop.c:96
#9 in fetch_inferior_event (client_data=0x0) at infrun.c:2649
#10 in fetch_inferior_event_wrapper (client_data=0x0) at inf-loop.c:169
#11 in catch_errors (func=0x6b4287 <fetch_inferior_event_wrapper>, func_args=0x0, errstring=0xe378dd "", mask=6) at exceptions.c:518
#12 in inferior_event_handler (event_type=INF_REG_EVENT, client_data=0x0) at inf-loop.c:65
#13 in remote_async_serial_handler (scb=0x1f30b00, context=0x0) at remote.c:10317
#14 in push_event (context=0x1f30b00) at ser-base.c:176
#15 in handle_timer_event (dummy=...) at event-loop.c:1306
#16 in process_event () at event-loop.c:399
#17 in gdb_do_one_event (data=0x0) at event-loop.c:452
#18 in catch_errors (func=0x6b0d2a <gdb_do_one_event>, func_args=0x0, errstring=0xe07943 "", mask=6) at exceptions.c:518
#19 in tui_command_loop (data=0x0) at ./tui/tui-interp.c:171
#20 in current_interp_command_loop () at interps.c:291
#21 in captured_command_loop (data=0x0) at ./main.c:227
#22 in catch_errors (func=0x47ff66 <captured_command_loop>, func_args=0x0, errstring=0xdc6967 "", mask=6) at exceptions.c:518
#23 in captured_main (data=0x7fffffffd360) at ./main.c:910
> But, it is very possible I missed something. Ang again, I think (I hope ;)
> we can forget this because the simple method works too.
This discussion is really offtopic for ugdb.
> I was afraid there are some other reason why we can't avoid libthread_db.
Roland has correctly pointed out the TLS support. But that will come later.
> Yes, I do understand vAttach issues, but I thought that "attach"
> command should always hide these details. From the documentation:
>
> attach PROCESS-ID
>
> ...
> The first thing GDB does after arranging to debug the specified
> process is to stop it. You can examine and modify an attached process
> with all the GDB commands that are ordinarily available when you start
> processes with `run'. You can insert breakpoints; you can step and
> continue; you can modify storage. If you would rather the process
> continue running, you may use the `continue' command after attaching
> GDB to the process.
It is true "attach" stops the inferior. Just the stop completes only after
the "attach" command returns.
Regards,
Jan
next prev parent reply other threads:[~2010-08-03 18:37 UTC|newest]
Thread overview: 59+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-16 20:54 Q: mutlithreaded tracees && clone/exit Oleg Nesterov
2010-07-16 21:40 ` Roland McGrath
2010-07-18 17:51 ` Oleg Nesterov
2010-07-18 18:04 ` Oleg Nesterov
2010-07-18 20:22 ` Roland McGrath
2010-07-19 13:44 ` BUG: add_thread_silent()->switch_to_thread(minus_one_ptid) is wrong Oleg Nesterov
2010-07-19 15:36 ` Oleg Nesterov
2010-07-19 16:01 ` Q: mutlithreaded tracees && clone/exit Jan Kratochvil
2010-07-19 22:57 ` Roland McGrath
2010-07-20 13:18 ` Oleg Nesterov
2010-07-20 14:04 ` BUG? gdb, non-stop && c -a Oleg Nesterov
2010-07-20 14:12 ` Jan Kratochvil
2010-07-20 14:49 ` Oleg Nesterov
2010-07-20 15:08 ` Jan Kratochvil
2010-07-20 15:28 ` Oleg Nesterov
2010-07-20 19:43 ` Roland McGrath
2010-07-21 7:59 ` Oleg Nesterov
2010-07-21 8:10 ` Jan Kratochvil
2010-07-21 11:12 ` Oleg Nesterov
2010-07-20 14:21 ` Q: mutlithreaded tracees && clone/exit Jan Kratochvil
2010-07-20 15:09 ` Oleg Nesterov
2010-07-20 19:41 ` Roland McGrath
2010-07-21 8:32 ` Oleg Nesterov
2010-07-20 14:43 ` Q: who maintains the STOPPED/RUNNING state? Oleg Nesterov
[not found] ` <y0mk4ophmvn.fsf@fche.csb>
2010-07-21 10:20 ` Oleg Nesterov
2010-07-21 10:51 ` Oleg Nesterov
2010-07-21 17:06 ` Q: multiple inferiors, all-stop && vCont Oleg Nesterov
2010-07-21 20:42 ` Roland McGrath
2010-07-23 17:33 ` Oleg Nesterov
2010-07-26 14:30 ` Oleg Nesterov
2010-07-26 16:06 ` Oleg Nesterov
2010-07-28 18:19 ` gdbstub initial code, another approach Oleg Nesterov
2010-07-29 21:38 ` Frank Ch. Eigler
2010-07-30 13:00 ` Oleg Nesterov
2010-07-30 13:16 ` Frank Ch. Eigler
2010-07-30 15:01 ` Oleg Nesterov
2010-07-30 13:25 ` Jan Kratochvil
2010-07-30 14:44 ` Oleg Nesterov
2010-07-30 15:20 ` Jan Kratochvil
2010-08-02 12:54 ` Oleg Nesterov
2010-08-03 13:55 ` Jan Kratochvil
2010-07-30 17:59 ` Tom Tromey
2010-08-02 18:25 ` Oleg Nesterov
2010-08-02 23:54 ` Jan Kratochvil
2010-08-03 12:27 ` Q: %Stop && gdb crash Oleg Nesterov
2010-08-03 13:17 ` Oleg Nesterov
2010-08-03 19:57 ` Kevin Buettner
2010-08-04 19:42 ` Oleg Nesterov
2010-08-04 23:32 ` Kevin Buettner
2010-08-05 18:24 ` Oleg Nesterov
2010-08-03 13:36 ` Jan Kratochvil
2010-08-03 15:09 ` Oleg Nesterov
2010-08-03 12:39 ` Q: multiple inferiors, all-stop && vCont Jan Kratochvil
2010-08-03 14:32 ` Oleg Nesterov
2010-08-03 15:55 ` Jan Kratochvil
2010-08-03 16:56 ` Oleg Nesterov
2010-08-03 18:37 ` Jan Kratochvil [this message]
2010-08-18 17:07 ` Jan Kratochvil
2010-08-18 19:22 ` Roland McGrath
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=20100803183640.GA27303@host1.dyn.jankratochvil.net \
--to=jan.kratochvil@redhat.com \
--cc=archer@sourceware.org \
--cc=oleg@redhat.com \
--cc=roland@redhat.com \
--cc=utrace-devel@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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).