public inbox for archer@sourceware.org
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: Jan Kratochvil <jan.kratochvil@redhat.com>
Cc: Roland McGrath <roland@redhat.com>,
	archer@sourceware.org, utrace-devel@redhat.com
Subject: Re: Q: %Stop && gdb crash
Date: Tue, 03 Aug 2010 15:09:00 -0000	[thread overview]
Message-ID: <20100803150656.GA8043@redhat.com> (raw)
In-Reply-To: <20100803133627.GB16669@host1.dyn.jankratochvil.net>

On 08/03, Jan Kratochvil wrote:
>
> On Tue, 03 Aug 2010 14:24:34 +0200, Oleg Nesterov wrote:
> > >
> > > So I assumed it is always safe to resend the notification unless gdb already
> > > sent vStopped. Since it is not clear to me when it makes sense to resend it,
> > > currently gdbstub does re-send every time /proc/ugdb reports the new event
> > > (T00 in this case). I agree this is not optimal, but this looks correct to me.
> >
> > I'll change gdbstub to never resend the notification to avoid the problem.
>
> Yes, I has been now just writing you such reply.

Sure, will do.

> > But probably gdb should be fixed anyway.
>
> There are so many serious bugs in GDB affecting regular GDB usage...

OK, so I assume that the current behaviour of gdbstub is correct, even
if stupid.

> > To avoid the unnecessary details, consider the oversimplified example,
> >
> > 	$ sleep 10000&
> > 	[1] 2923
> >
> > 	$ cat > SLEEP
> > 	set target-async on
> > 	set non-stop
> > 	target extended-remote :2000
> > 	file /bin/sleep
> > 	attach 2923
> > 	info registers
> > 	detach
> > 	^D
> >
> > 	$ gdb <SLEEP
> > 	GNU gdb (GDB) 7.1
> > 	Copyright (C) 2010 Free Software Foundation, Inc.
> > 	License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
> > 	This is free software: you are free to change and redistribute it.
> > 	There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
> > 	and "show warranty" for details.
> > 	This GDB was configured as "x86_64-unknown-linux-gnu".
> > 	For bug reporting instructions, please see:
> > 	<http://www.gnu.org/software/gdb/bugs/>.
> > 	(gdb) (gdb) (gdb) Remote debugging using :2000
> > 	(gdb) Reading symbols from /bin/sleep...(no debugging symbols found)...done.
> > 	(gdb) Attached to process 2923
> > 	[New Thread 2923.2923]
> > 	Target is executing.
> > 	(gdb) Detached from remote process 2923.
> > 	(gdb) quit
> >
> > And yes, gdb ignores %Stop and just detaches. But this is because
> > of another issue (which looks like a minor gdb bug to me), note the
> >
> > 	"Target is executing."
> >
> > above. This is the reply to "info registers". Why? OK, yes, it is
> > executing.
>
> Yes.
>
>
> > Then send vCont:t ? "attach PID" means attach and stop it, no?
>
> But it is not yet stopped that time.

Well. And how can I stop it?

Once again, this all works in CLI mode. And this looks very natural

	(gdb) attach PID
	(gdb) info registers

As a newbie user of gdb, I expected it is gdb who should take care
and stop the tracee after "attach". And please remember, "interrupt"
doesn't help.

OK, please ignore. Now that I know I can't trust 'gdb < BATCH' I do
not use this.

> > Can't resist, I spent a lot of time trying to understand what is wrong.
>
> Nothing, you should wait till GDB reports the inferior has stopped.

Yes, yes, now I understand this. Once again, I was greatly confused
because I didn't know that CLI mode makes the difference. Even if I
enter the commands via copy-and-paste, gdb always "completes" this
attach before it reacts to "info registers".

And there were other issues which I didn't understand when I tried
to solve this problem...

> It is
> easy/normal in the GDB testsuite

Hmm. How? probably the tests in testsuite wait for something which
looks like "[Thread 5683.5683] #1 stopped." from gdb?

> > I tried to achieve the same results with /proc/ugdb doing
> > "$ gdb < BATCH_FILE" with the same commands.
>
> Maybe you can write a new *.exp testcase for such testing.

I guess you want me to learn /usr/bin/expect ;)

Oleg.

  reply	other threads:[~2010-08-03 15:09 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 [this message]
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
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=20100803150656.GA8043@redhat.com \
    --to=oleg@redhat.com \
    --cc=archer@sourceware.org \
    --cc=jan.kratochvil@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).