Linux MIPS Architecture development
 help / color / mirror / Atom feed
* pthread_create() gets BUS ERROR
@ 2000-10-19 22:31 Jun Sun
  2000-10-19 22:39 ` Ralf Baechle
  0 siblings, 1 reply; 6+ messages in thread
From: Jun Sun @ 2000-10-19 22:31 UTC (permalink / raw)
  To: linux-mips

[-- Attachment #1: Type: text/plain, Size: 530 bytes --]


I am running a simple pthread_create() test.  The thread gets created,
but the creating thread gets BUS error after the function call.  In
fact, it gets SIGUSR1 signal.  Does anybody know what is wrong here?

It looks to me that creating thread is waiting for the created thread to
start up, but somehow did not install the signal handler correctly!?

I am running with the "stable" toolchain that I generated recently,
i.e., binutil 2.8.1, egcs 1.0.3a and glibc2.0.6.

I attached the program and the strace output.

Thanks.

Jun

[-- Attachment #2: pthread.c --]
[-- Type: text/plain, Size: 532 bytes --]

#include <pthread.h>
#include <stdio.h>
#include <errno.h>

typedef void * (*pthread_func_t) (void *);


void myfunc(void *arg)
{
   printf("slave : myfunc runs.\n");
}

main()
{
    int ret;

    pthread_t thread;

    printf("master : before create a thread ... \n");

    ret = pthread_create(&thread, NULL, (pthread_func_t)myfunc, NULL);
    perror("after creating a thread ... :");
   printf("master : after create a thread ... %d(%s)\n", ret, strerror(ret));

   if (ret == EAGAIN) {
      printf("error is EAGAIN\n");
   }
}

[-- Attachment #3: output --]
[-- Type: text/plain, Size: 3341 bytes --]

execve("./pthread", ["./pthread"], [/* 15 vars */]) = 0
brk(0)                                  = 0x10010fb0
cacheflush(0x7ffffbb8, 0x28, 0x3)       = 0
cacheflush(0x7ffffb40, 0x28, 0x3)       = 0
mmap(ptrace: umoven: Input/output error
ptrace: umoven: Input/output error
)                                  = 715829248
open("/etc/ld.so.preload", O_RDONLY)    = -1 ENOENT (No such file or directory)
cacheflush(0x7ffffaa8, 0x28, 0x3)       = 0
open("/etc/ld.so.cache", O_RDONLY)      = -1 ENOENT (No such file or directory)
open("/lib/libpthread.so.0", O_RDONLY)  = 3
mmap(ptrace: umoven: Input/output error
ptrace: umoven: Input/output error
)                                  = 715833344
munmap(0x2aaac000, 4096)                = 0
mmap(ptrace: umoven: Input/output error
ptrace: umoven: Input/output error
)                                  = 715833344
mprotect(0x2aab7000, 281200, PROT_NONE) = 0
mmap(NULL, 0, PROT_NONE, MAP_FILE, 0, 0) = 0x2aaf6000
close(3)                                = 0
open("/lib/libc.so.6", O_RDONLY)        = 3
mmap(ptrace: umoven: Input/output error
ptrace: umoven: Input/output error
)                                  = 716161024
munmap(0x2aafc000, 4096)                = 0
mmap(ptrace: umoven: Input/output error
ptrace: umoven: Input/output error
)                                  = 716161024
mprotect(0x2abb3000, 330496, PROT_NONE) = 0
mmap(0x18f, 0, 0x8f380000, MAP_SHARED|MAP_FIXED|MAP_RENAME|0x180, 0, 0x8f380000) = 0x2abf2000
mmap(0x8f364045, 87, PROT_NONE, MAP_FILE|0x8f380000, 121, 0ptrace: umoven: Input/output error
) = 717201408
close(3)                                = 0
mprotect(0x2aafc000, 749568, PROT_READ|PROT_WRITE) = 0
mprotect(0x2aafc000, 749568, PROT_READ|PROT_EXEC) = 0
mprotect(0x2aaac000, 45056, PROT_READ|PROT_WRITE) = 0
mprotect(0x2aaac000, 45056, PROT_READ|PROT_EXEC) = 0
personality(PER_LINUX)                  = 0
getpid()                                = 92
getpid()                                = 92
sigaction(SIGUSR1, {0x10000000, [TRAP EMT BUS SEGV SYS ALRM USR2 CHLD WINCH IO TSTP TTIN VTALRM XCPU], 0}, NULL, 0x5c) = 0
sigaction(SIGUSR2, {SIG_DFL}, NULL, 0x5c) = 0
sigprocmask(SIG_BLOCK, [USR1], NULL)    = 0
fstat(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(3, 0), ...}) = 0
mmap(ptrace: umoven: Input/output error
ptrace: umoven: Input/output error
)                                  = 717242368
ioctl(1, TCGETS, {B9600 opost isig icanon echo ...}) = 0
write(1, "master : before create a thread "..., 37master : before create a thread ... 
) = 37
brk(0)                                  = 0x10010fb0
brk(0x10012fa8)                         = 0x10012fa8
brk(0x10013000)                         = 0x10013000
pipe([717225552, 0])                    = 3
clone(child_stack=0x10012f78, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND) = 93
sigprocmask(SIG_SETMASK, NULL, [USR1])  = 0
write(4, "\0\220\257*\0\0\0\0\0\0\0\0\220\v@\0\0\0\0\0\0\200\0\0"..., 148) = 148
sigprocmask(SIG_SETMASK, NULL, [USR1])  = 0
sigsuspend(~[HUP INT QUIT ILL EMT FPE BUS] <unfinished ...>
--- SIGUSR1 (User defined signal 1) ---
<... sigsuspend resumed> )              = -1 EINTR (Interrupted system call)
sigreturn()                             = ? (mask now [TRAP FPE BUS SEGV SYS ALRM TERM CHLD PWR PROF])
--- SIGBUS (Bus error) ---
+++ killed by SIGBUS +++
sh-2.03# slave : myfunc runs.


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2000-10-24 21:35 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2000-10-19 22:31 pthread_create() gets BUS ERROR Jun Sun
2000-10-19 22:39 ` Ralf Baechle
2000-10-19 23:00   ` Jun Sun
2000-10-24  1:24   ` Jun Sun
2000-10-24  1:37     ` Ralf Baechle
2000-10-24 21:36       ` Jun Sun

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox