From: my Name <interested0815@yahoo.com>
To: gdb@sources.redhat.com
Subject: debugging multithreaded applications
Date: Tue, 16 Aug 2005 15:24:00 -0000 [thread overview]
Message-ID: <20050816152422.39274.qmail@web50102.mail.yahoo.com> (raw)
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 <iostream>
#include <pthread.h>
#include <time.h>
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
next reply other threads:[~2005-08-16 15:24 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-08-16 15:24 my Name [this message]
2005-08-30 2:12 ` Daniel Jacobowitz
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=20050816152422.39274.qmail@web50102.mail.yahoo.com \
--to=interested0815@yahoo.com \
--cc=gdb@sources.redhat.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).