Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: "Marc Khouzam" <marc.khouzam@ericsson.com>
To: "Pedro Alves" <pedro@codesourcery.com>, <gdb@sourceware.org>
Subject: RE: Does HEAD support non-stop with 'gdbserver --multi' on Linux?
Date: Thu, 30 Apr 2009 20:55:00 -0000	[thread overview]
Message-ID: <6D19CA8D71C89C43A057926FE0D4ADAA075CAE22@ecamlmw720.eamcs.ericsson.se> (raw)
In-Reply-To: <200904302049.49881.pedro@codesourcery.com>

 

> -----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 ==


  reply	other threads:[~2009-04-30 20:20 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-30 19:49 Marc Khouzam
2009-04-30 20:20 ` Pedro Alves
2009-04-30 20:55   ` Marc Khouzam [this message]
     [not found]     ` <200904302245.11843.pedro@codesourcery.com>
2009-05-01 18:40       ` Marc Khouzam
2009-05-12 15:23         ` Marc Khouzam
2009-05-12 15:58           ` Pedro Alves
2009-05-12 16:23             ` Marc Khouzam

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=6D19CA8D71C89C43A057926FE0D4ADAA075CAE22@ecamlmw720.eamcs.ericsson.se \
    --to=marc.khouzam@ericsson.com \
    --cc=gdb@sourceware.org \
    --cc=pedro@codesourcery.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