From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2357 invoked by alias); 3 Aug 2010 15:09:36 -0000 Mailing-List: contact archer-help@sourceware.org; run by ezmlm Sender: Precedence: bulk List-Post: List-Help: List-Subscribe: List-Id: Received: (qmail 2343 invoked by uid 22791); 3 Aug 2010 15:09:34 -0000 X-SWARE-Spam-Status: No, hits=-6.6 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Date: Tue, 03 Aug 2010 15:09:00 -0000 From: Oleg Nesterov To: Jan Kratochvil Cc: Roland McGrath , archer@sourceware.org, utrace-devel@redhat.com Subject: Re: Q: %Stop && gdb crash Message-ID: <20100803150656.GA8043@redhat.com> References: <20100803131436.GA2185@redhat.com> <20100803122434.GA32698@redhat.com> <20100803133627.GB16669@host1.dyn.jankratochvil.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20100803133627.GB16669@host1.dyn.jankratochvil.net> User-Agent: Mutt/1.5.18 (2008-05-17) X-SW-Source: 2010-q3/txt/msg00084.txt.bz2 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 > GNU gdb (GDB) 7.1 > > Copyright (C) 2010 Free Software Foundation, Inc. > > License GPLv3+: GNU GPL version 3 or later > > 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: > > . > > (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.