From: Greg Galperin <grg22@ai.mit.edu>
To: gdb@sourceware.cygnus.com, grg22@life.ai.mit.edu
Subject: Re: GDB 5.1 TODO list
Date: Thu, 03 Aug 2000 09:38:00 -0000 [thread overview]
Message-ID: <200008031636.MAA17233@skydive.ai.mit.edu> (raw)
> > * Thread support. Right now, as soon as a thread finishes and exits,
> > you're hosed. This problem is reported once a week or so.
>
> One thing that is desparatly needed is a few good test cases. It is
> hard to tell if thread support is getting better or worse :-(
>
> Andrew
I posted one in February which should help:
http://sources.redhat.com/ml/bug-gdb/2000-02/msg00008.html
Below are four versions of that same idea, which test detached or joinable
threads, and exiting by calling pthread_exit() or just falling through.
This tests several forms of thread exiting, as well as the ability to
create a large number of threads (in a lifetime serially, not concurrently)
-- as MarkK explained to me,
> Be aware though, that GDB cannot handle a lot of threads right now. It
> chokes on the thread ID's after that since they don't fit in 15 bits. So
> you'll see something like:
>
> thread_db: map_id2thr failed: invalid thread handle
>
> after 30 or so threads with your program.
>
> Mark
IMHO it's important to both handle thread exit and have a lifetime budget
of more than a few dozen threads.
--grg
===========================================================================
////
//// detached, pthread_exit()
////
#include <pthread.h>
#include <stdio.h>
#include <assert.h>
#define NTHREADS 100000
#define PRINTEVERY 10000
// committing the grossness of putting an int where a void* is expected.
void* exitImmediately(void* count)
{
if ((int)count % PRINTEVERY == 0)
printf("%d\n",(int)count);
pthread_exit(NULL);
}
int main()
{
pthread_t pthread;
pthread_attr_t attr;
int retval;
int i;
// set up attr to detach
retval = pthread_attr_init(&attr);
assert(retval==0); // success
retval = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
assert(retval==0); // success
for (i=0; i<NTHREADS; ++i)
pthread_create(&pthread, &attr, exitImmediately, (void*)i);
}
===========================================================================
////
//// detached, fall through
////
#include <pthread.h>
#include <stdio.h>
#include <assert.h>
#define NTHREADS 100000
#define PRINTEVERY 10000
// committing the grossness of putting an int where a void* is expected.
void* exitImmediately(void* count)
{
if ((int)count % PRINTEVERY == 0)
printf("%d\n",(int)count);
return NULL;
}
int main()
{
pthread_t pthread;
pthread_attr_t attr;
int retval;
int i;
// set up attr to detach
retval = pthread_attr_init(&attr);
assert(retval==0); // success
retval = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
assert(retval==0); // success
for (i=0; i<NTHREADS; ++i)
pthread_create(&pthread, &attr, exitImmediately, (void*)i);
}
===========================================================================
////
//// joinable, pthread_exit()
////
#include <stdio.h>
#include <pthread.h>
#define NTHREADS 10000
// committing the grossness of putting an int where a void* is expected.
void* exitImmediately(void* count)
{
printf("tid %d: I'm #%d\n", pthread_self(), (int)count);
pthread_exit(NULL);
}
int main(int argc, char* argv[])
{
pthread_t p_thread;
int i, retCreate, retJoin;
for (i=0; i<NTHREADS; ++i) {
retCreate = pthread_create(&p_thread, NULL, exitImmediately, (void*)i);
if (retCreate == 0) {
retJoin = pthread_join(p_thread, NULL);
}
printf("spawned %d, return code %d, join returned %d\n", i,
retCreate, retJoin);
}
}
===========================================================================
////
//// joinable, fall through
////
#include <stdio.h>
#include <pthread.h>
#define NTHREADS 10000
// committing the grossness of putting an int where a void* is expected.
void* exitImmediately(void* count)
{
printf("tid %d: I'm #%d\n", pthread_self(), (int)count);
return NULL;
}
int main(int argc, char* argv[])
{
pthread_t p_thread;
int i, retCreate, retJoin;
for (i=0; i<NTHREADS; ++i) {
retCreate = pthread_create(&p_thread, NULL, exitImmediately, (void*)i);
if (retCreate == 0) {
retJoin = pthread_join(p_thread, NULL);
}
printf("spawned %d, return code %d, join returned %d\n", i,
retCreate, retJoin);
}
}
From shaunj@gray-interfaces.com Thu Aug 03 12:44:00 2000
From: Shaun Jackman <shaunj@gray-interfaces.com>
To: gdb@sources.redhat.com
Subject: gdb and jeeni
Date: Thu, 03 Aug 2000 12:44:00 -0000
Message-id: <00080313412800.00552@ed>
X-SW-Source: 2000-08/msg00028.html
Content-length: 819
I'm running Insight 5.0 --target=arm-elf --host=i686-pc-linux-gnu and a jeeni
(ARM Angel/Ethernet). When I click "Target Settings" I get the error 'No symbol
"ETH" in current context.'
The stack trace is:
No symbol "ETH" in current context.
while executing
"gdb_cmd "set remotebaud $baud""
(object "::.targetselection0.targetselection" method "::TargetSelection::change_baud" body line 4)
invoked from within
"::.targetselection0.targetselection change_baud .targetselection0.targetselection.f.lab.lf.childsite.cb ETH"
(in namespace inscope "::TargetSelection" script line 1)
invoked from within
"namespace inscope ::TargetSelection {::.targetselection0.targetselection change_baud} .targetselection0.targetselection.f.lab.lf.childsite.cb ETH"
("after" script)errorCode is NONE
Cheers,
Shaun
next reply other threads:[~2000-08-03 9:38 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-08-03 9:38 Greg Galperin [this message]
-- strict thread matches above, loose matches on Subject: below --
2000-08-01 18:50 Andrew Cagney
[not found] ` <10008021015.AA03688@tiptree.brainstorm.co.uk>
2000-08-02 22:30 ` Andrew Cagney
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=200008031636.MAA17233@skydive.ai.mit.edu \
--to=grg22@ai.mit.edu \
--cc=gdb@sourceware.cygnus.com \
--cc=grg22@life.ai.mit.edu \
/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