From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27796 invoked by alias); 14 Jan 2005 08:48:23 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 27710 invoked from network); 14 Jan 2005 08:48:04 -0000 Received: from unknown (HELO topsns.toshiba-tops.co.jp) (202.230.225.5) by sourceware.org with SMTP; 14 Jan 2005 08:48:04 -0000 Received: from newms.toshiba-tops.co.jp by topsns.toshiba-tops.co.jp via smtpd (for sourceware.org [12.107.209.250]) with SMTP; 14 Jan 2005 08:48:04 UT Received: from srd2sd.toshiba-tops.co.jp (gw-chiba7.toshiba-tops.co.jp [172.17.244.27]) by newms.toshiba-tops.co.jp (Postfix) with ESMTP id 4F124239E3F; Fri, 14 Jan 2005 17:48:03 +0900 (JST) Received: from localhost (fragile [172.17.28.65]) by srd2sd.toshiba-tops.co.jp (8.12.10/8.12.10) with ESMTP id j0E8m2Rm042306; Fri, 14 Jan 2005 17:48:03 +0900 (JST) (envelope-from anemo@mba.ocn.ne.jp) Date: Fri, 14 Jan 2005 08:48:00 -0000 Message-Id: <20050114.174802.55486536.nemoto@toshiba-tops.co.jp> To: gdb@sources.redhat.com Subject: gdbserver: thread getmsg err on mips[el]-linux From: Atsushi Nemoto X-Fingerprint: 6ACA 1623 39BD 9A94 9B1A B746 CA77 FE94 2874 D52F X-Pgp-Public-Key: http://wwwkeys.pgp.net/pks/lookup?op=get&search=0x2874D52F Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-SW-Source: 2005-01/txt/msg00071.txt.bz2 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 #include 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