This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: Does HEAD support non-stop with 'gdbserver --multi' on Linux?


 

> -----Original Message-----
> From: Pedro Alves [mailto:pedro@codesourcery.com] 
> Sent: Thursday, April 30, 2009 3:50 PM
> To: gdb@sourceware.org
> Cc: Marc Khouzam
> Subject: Re: Does HEAD support non-stop with 'gdbserver 
> --multi' on Linux?
> 
> Hi Marc,
> 
> On Thursday 30 April 2009 20:39:47, Marc Khouzam wrote:
> 
> > In the last couple months there has been a set of patches about
> > non-stop/multi-process 
> > for gdbserver and GDB for Linux from Pedro.  Sadly, I wasn't able to
> > keep track of what went
> > in and all the functionality they supported.
> > 
> > I'm trying HEAD with:
> > - gdbserver --multi
> 
> Note that --multi is not about multi-process in the same sense you're
> talking about.  It is a preexisting option that means that gdbserver 
> will stay persistent even when the inferior exits.  It also enables
> starting up gdbserver without giving it a process to start with.
> You'll need to connect with "target extended-remote" in that case.

Yep.  I use that to do a Remote Attach debug session.


> The gdbserver multiprocess support is in head already, but needs
> more GDB side work to be useable.

I don't want to waste your time if it is not ready yet.
But I put the details below, just in case.

> > - non-stop for a multi-threaded app
> > - on Linux
> > 
> > Is that supported yet?
> > Because I'm not getting the correct list of threads (only in the
> > non-stop case).
> 
> What exactly are you seeing?  I just run a few non-stop test
> (mi-nonstop.exp, mi-nsintrall.exp and ns-nsmoribund.exp tests)
> against linux x86-64 gdbserver head, and they passed cleanly for
> me, so *something* is working.  :-)

It seems no new thread is listed by GDB.

Thanks

Marc

Details
=======

My program has the main thread start a second thread which prints every
second.
The main thread then does a pthread_join
I let both threads run and ask GDB for the list of threads using 'info
thread'.
Only the main thread is reported as you can see below.

== I first start gdbserver like this: ==
> gdbserver --multi :10008&

Then I start GDB:
> gdb
GNU gdb (GDB) 6.8.50.20090430-cvs
Copyright (C) 2009 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 "i686-pc-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
(gdb)  file a.out
Reading symbols from /local/home/lmckhou/testing/a.out...done.
(gdb) l 1
1       #include <stdio.h>
2       #include <stdlib.h>
3       #include <pthread.h>
4       #include <unistd.h>
5
6       void *thread_exec(void *ptr)
7       {
8           for (int i=0;i<30;i++) {
9               printf("thread 2 prints: %d\n" , i);
10              sleep(1);
(gdb) l
11          }
12      }
13
14      int main()
15      {
16
17          sleep(15);
18
19          pthread_t thread2;
20          char *message2 = "Thread 2";
(gdb) l
21
22          pthread_create(&thread2, NULL, thread_exec, (void*)
message2);
23
24          pthread_join(thread2, NULL);
25
26          printf("Thread 2 finished\n");
27
28          return 0;
29      }
(gdb) b 22
Breakpoint 1 at 0x80485b8: file MultiThread.cc, line 22.
(gdb) set target-async on
(gdb) set pagination off
(gdb) set non-stop on
(gdb) target extended-remote localhost:10008
Remote debugging using localhost:10008

=== Here I start the a.out program in another ==
===  window and it gets pid 30668.            ==

(gdb)  attach 30668
Attached to process 30668
[New Thread 30668.30668]
Reading symbols from /lib/libpthread.so.0...done.
Loaded symbols for /lib/libpthread.so.0
Reading symbols from /usr/lib/libstdc++.so.6...done.
Loaded symbols for /usr/lib/libstdc++.so.6
Reading symbols from /lib/libm.so.6...done.
Loaded symbols for /lib/libm.so.6
Reading symbols from /lib/libgcc_s.so.1...done.
Loaded symbols for /lib/libgcc_s.so.1
Reading symbols from /lib/libc.so.6...done.
Loaded symbols for /lib/libc.so.6
Reading symbols from /lib/ld-linux.so.2...done.
Loaded symbols for /lib/ld-linux.so.2
0xffffe410 in __kernel_vsyscall ()
(gdb) c&
Continuing.
(gdb) 
Breakpoint 1, main () at MultiThread.cc:22
22          pthread_create(&thread2, NULL, thread_exec, (void*)
message2);
info th
* 1 Thread 30668.30668  main () at MultiThread.cc:22
(gdb) c&
Continuing.

== This continues past the creation of the second thread ==
== I actually see the printouts of the second thread     ==
== in the other window, every second                     ==

(gdb) info th
* 1 Thread 30668.30668  (running)

== Thread 2 is not shown ==
== This also happens if I have thread 1 stopped at line 24 ==


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]