Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* gdbserver: thread getmsg err on mips[el]-linux
@ 2005-01-14  8:48 Atsushi Nemoto
  2005-01-28 10:43 ` Atsushi Nemoto
  2005-02-09 14:55 ` Atsushi Nemoto
  0 siblings, 2 replies; 4+ messages in thread
From: Atsushi Nemoto @ 2005-01-14  8:48 UTC (permalink / raw)
  To: gdb

Hi.  When I tried to debug multi thread program with gdbserver
(6.3.50_20050104) on mips[el]-linux, I got following error:

[[gdbserver side]]
$ ./gdbserver host:50000 ./ttest
Process ./ttest created; pid = 3328
Listening on port 50000
Remote debugging from host 127.0.0.1
thread getmsg err: no event message for getmsg
Segmentation fault

[[gdb side]]
$ ./gdb ./ttest
GNU gdb 6.3.50_20050104
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "mipsel-unknown-linux-gnu"...Using host libthread_db library "/lib/libthread_db.so.1".
 
(gdb) target remote localhost:50000
Remote debugging using localhost:50000
0x2aaa8b00 in ?? ()
(gdb) b main
Breakpoint 1 at 0x4008c4: file ttest.c, line 14.
(gdb) c
Continuing.
[New Thread 16384]
[Switching to Thread 16384]
 
Breakpoint 1, main (argc=1, argv=0x7fff7dd4) at ttest.c:14
14              ret = pthread_create(&id, NULL, func, 0);
(gdb) c
Continuing.
Watchdog has expired.  Target detached.


My environment is Debian sarge (glibc 2.3.2.ds1-20) with kernel
2.6.10.  Strangely, rarely I did not get this error on same
environment.  Also I did not get this error with kernel 2.4.28.

The error was printed in gdbserver/thread-db.c:thread_db_create_event().

  err = td_ta_event_getmsg (thread_agent, &msg);
  if (err != TD_OK)
    fprintf (stderr, "thread getmsg err: %s\n",
	     thread_db_err_str (err));

Why td_ta_event_getmsg() return TD_NOMSG?

If I modified above code as following, the error did not happen.

  do {
    err = td_ta_event_getmsg (thread_agent, &msg);
  } while (err == TD_NOMSG);

So it seems there is some race around here?


Here is a session log with debug_threads = 1.

[[gdbserver side]]
$ ./gdbserver host:50000 ./ttest
Process ./ttest created; pid = 3328
Got an event from 3328 (57f)
Hit a (non-reinsert) breakpoint.
Listening on port 50000
[[gdb side]]
$ ./gdb ./ttest
GNU gdb 6.3.50_20050104
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "mipsel-unknown-linux-gnu"...Using host libthread_db library "/lib/libthread_db.so.1".
 
(gdb) target remote localhost:50000
Remote debugging using localhost:50000
0x2aaa8b00 in ?? ()
[[gdbserver side]]
Remote debugging from host 127.0.0.1
[[gdb side]]
(gdb) b main
Breakpoint 1 at 0x4008c4: file ttest.c, line 14.
(gdb) c
Continuing.
[New Thread 16384]
[Switching to Thread 16384]
 
Breakpoint 1, main (argc=1, argv=0x7fff7dd4) at ttest.c:14
14              ret = pthread_create(&id, NULL, func, 0);
[[gdbserver side]]
Writing 0d to 2aab7310
Writing 0d to 004008c4
Resuming, no pending status
Resuming process 3328 (continue, signal 0, stop not expected)
  Got an event from 3328 (57f)
Hit a (non-reinsert) breakpoint.
Writing 05 to 2aab7310
Writing 18 to 004008c4
Writing ffffff80 to 2ab54cb0
Writing 0d to 2ab11050
Writing 01 to 2ab54cc4
Writing 0d to 2aab7314
Resuming, no pending status
Resuming process 3328 (continue, signal 0, stop not expected)
Checking for breakpoint.
Removed breakpoint.
  Got an event from 3328 (57f)
Hit a (non-reinsert) breakpoint.
Writing resume reply for 16384
 
Writing 70 to 2aab7314
Writing 0d to 2aab7310
Writing 0d to 004008c4
Resuming, no pending status
Resuming process 3328 (continue, signal 0, stop not expected)
Checking for breakpoint.
Removed breakpoint.
  Got an event from 3328 (57f)
Hit a (non-reinsert) breakpoint.
Writing resume reply for 16384
 
Writing 05 to 2aab7310
Writing 18 to 004008c4
Writing 0d to 2aab7314
Resuming, no pending status
Resuming process 3328 (continue, signal 0, stop not expected)
Checking for breakpoint.
Removed breakpoint.
  Got an event from 3328 (57f)
Hit a (non-reinsert) breakpoint.
Writing resume reply for 16384
 
Writing 70 to 2aab7314
Writing 0d to 2aab7310
Writing 0d to 004008c4
Resuming, no pending status
Resuming process 3328 (continue, signal 0, stop not expected)
Checking for breakpoint.
Removed breakpoint.
  Got an event from 3328 (57f)
Hit a (non-reinsert) breakpoint.
Writing resume reply for 16384
 
Writing 05 to 2aab7310
Writing 18 to 004008c4
Writing 0d to 2aab7314
Resuming, no pending status
Resuming process 3328 (continue, signal 0, stop not expected)
Checking for breakpoint.
Removed breakpoint.
  Got an event from 3328 (57f)
Hit a (non-reinsert) breakpoint.
Writing resume reply for 16384
 
Writing 70 to 2aab7314
Writing 0d to 2aab7310
Writing 0d to 004008c4
Resuming, no pending status
Resuming process 3328 (continue, signal 0, stop not expected)
Checking for breakpoint.
Removed breakpoint.
  Got an event from 3328 (57f)
Hit a (non-reinsert) breakpoint.
Writing resume reply for 16384
 
Writing 05 to 2aab7310
Writing 18 to 004008c4
[[gdb side]]
(gdb) c
Continuing.
Watchdog has expired.  Target detached.
 
(gdb)
[[gdbserver side]]
Writing 0d to 004008c8
Resuming, no pending status
Resuming process 3328 (continue, signal 0, stop not expected)
Checking for breakpoint.
Removed breakpoint.
  Got an event from 3328 (57f)
Hit a (non-reinsert) breakpoint.
Writing resume reply for 16384
 
Writing 21 to 004008c8
Writing 0d to 2aab7310
Writing 0d to 004008c4
Resuming, no pending status
Resuming process 3328 (continue, signal 0, stop not expected)
Checking for breakpoint.
Removed breakpoint.
  Got an event from 3328 (57f)
Hit a (non-reinsert) breakpoint.
Thread creation event.
thread getmsg err: no event message for getmsg
Segmentation fault


And this is the test program.

#include <stdio.h>
#include <pthread.h>
static void *func(void *arg)
{
        while (1)
                sleep(1);
}
 
int
main(int argc, char *argv[])
{
        pthread_t id;
        int ret;
        ret = pthread_create(&id, NULL, func, 0);
        printf("ID %d ret = %d\n", id, ret);
        while (1)
                sleep(1);
}


P.S.  I'm not on this ML.  Please CC to me.
---
Atsushi Nemoto


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2005-02-09 14:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-01-14  8:48 gdbserver: thread getmsg err on mips[el]-linux Atsushi Nemoto
2005-01-28 10:43 ` Atsushi Nemoto
2005-02-09 14:55 ` Atsushi Nemoto
2005-02-09 14:57   ` Daniel Jacobowitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox