* gdb 5 and threads
@ 2000-07-26 11:01 Ali Ijaz Sheikh
0 siblings, 0 replies; only message in thread
From: Ali Ijaz Sheikh @ 2000-07-26 11:01 UTC (permalink / raw)
To: gdb
Hi!
I was trying to debug a multithreaded program with GDB 5. Apparently there
are some problems. To test my hypothesis, I wrote a little program and tried
it out with gdb (source code at the end):
This is what happens with gdb:
------------snip------------
(gdb) b start
Breakpoint 1 at 0x80484ea: file test.c, line 8.
(gdb) r
Starting program: /home/ali/tmp/./test
[New Thread 1024 (runnable)]
[New Thread 2049 (runnable)]
Error: rw_common (): read: Input/output error.
Ack! Thread Exited event. What do I do now???
(gdb)
-----------snip-------------
While, if run directly, the program proceeds normally without any problems:
[/home/ali/tmp]$ ./test
Creating Threads..
Inside thread 1
Inside thread 2
Collapsing Threads..
The platform I am running this on is:
Linux hodgepodge 2.4.0-test3 #2 SMP Wed Jul 12 12:50:21 EST 2000 i686 unknown
gcc version is 2.95.2
glibc is libc-2.1.3
Any ideas what this is about?
Ali
--------- source code --------
#include <stdio.h>
#include <unistd.h>
#include <pthread.h>
typedef void *(*pthread_start_t) (void *);
void start(int i) {
printf("Inside thread %d\n", i);
}
int main() {
pthread_t t1;
pthread_t t2;
void *ret;
printf("Creating Threads..\n");
pthread_create(&t1, NULL, (pthread_start_t) start, (void *)1);
pthread_create(&t2, NULL, (pthread_start_t) start, (void *)2);
sleep(10);
printf("Collapsing Threads..\n");
pthread_join(t1, NULL);
pthread_join(t2, NULL);
}
----- end source code ------
--
The Fifth Rule:
You have taken yourself too seriously.
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2000-07-26 11:01 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-07-26 11:01 gdb 5 and threads Ali Ijaz Sheikh
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).