From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24060 invoked by alias); 16 Aug 2005 15:24:30 -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 24044 invoked by uid 22791); 16 Aug 2005 15:24:23 -0000 Received: from web50102.mail.yahoo.com (HELO web50102.mail.yahoo.com) (206.190.38.30) by sourceware.org (qpsmtpd/0.30-dev) with SMTP; Tue, 16 Aug 2005 15:24:23 +0000 Received: (qmail 39276 invoked by uid 60001); 16 Aug 2005 15:24:22 -0000 Message-ID: <20050816152422.39274.qmail@web50102.mail.yahoo.com> Received: from [80.246.32.40] by web50102.mail.yahoo.com via HTTP; Tue, 16 Aug 2005 08:24:22 PDT Date: Tue, 16 Aug 2005 15:24:00 -0000 From: my Name Subject: debugging multithreaded applications To: gdb@sources.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-SW-Source: 2005-08/txt/msg00062.txt.bz2 Hello, I'm trying to debug multithreaded applications. But I think I am doing something wrong. I'm using RedHat Fedora Core 2, gcc 3.3.3, gdb 6.3 (built from source). I created a simple program spawning a thread which prints to cout, while the "main" thread just calls pthread_join on the working one. #include #include #include using namespace std; bool g_shouldrun = true; void* work(void*){ while (g_shouldrun) { timespec t = {1,0}; timespec remaining = t; //while ((remaining.tv_sec + remaining.tv_nsec) != 0) { nanosleep(&t,&remaining); } std::cout << "hello world" << std::endl; //line 18 } std::cout << "ok, enough of it" << std::endl; } int main (int argc, char *argv[]) { cout << "hello main" << endl; pthread_t thread; int a = pthread_create(&thread,0,&work,0); pthread_join(thread,0); return(0); } If I enter breakpoints into work (line 18), the program is stopped if I use gdb (version 6.3). If using gdbserver, after starting the process I get "Cannot find new threads: capability not available", and later the child process is terminated with "signal = 5", SIGTRAP Since I did not find anything in the manual that said whether or not gdbserver can be used with multithreaded programs, I hope someone on this mailing list can help. Is it possible to debug multithreaded programs using gdbserver and if so, how? Regards, Thomas Fenzl ____________________________________________________ Start your day with Yahoo! - make it your home page http://www.yahoo.com/r/hs