From: Julian Seward Date: Tue, 16 Apr 2002 04:40:49 +0000 (+0000) Subject: Add more pthread wrappers in a failed attempt to get Opera 6.0TP2 X-Git-Tag: svn/VALGRIND_1_0_3~361 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8f0229881b6810eb52f0080eba3ac7d30e2b80e2;p=thirdparty%2Fvalgrind.git Add more pthread wrappers in a failed attempt to get Opera 6.0TP2 to run. Now it creates some threads but segfaults. Also add wrapper for syscall __NR_mremap; it is way wrong, but finding a decent description of what mremap() really does is nearly impossible. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@89 --- diff --git a/coregrind/arch/x86-linux/vg_libpthread.c b/coregrind/arch/x86-linux/vg_libpthread.c index 08abf32811..ab397457de 100644 --- a/coregrind/arch/x86-linux/vg_libpthread.c +++ b/coregrind/arch/x86-linux/vg_libpthread.c @@ -32,7 +32,7 @@ ------------------------------------------------------------------ */ /* Set to 1 to see IGNORED debugging messages. */ -static int show_IGNORED = 0; +static int show_IGNORED = 1; /* --------------------------------------------------------------------- @@ -108,6 +108,19 @@ static void ignored ( char* msg ) Pass pthread_ calls to Valgrind's request mechanism. ------------------------------------------------------------------ */ +int pthread_attr_init(pthread_attr_t *attr) +{ + ignored("pthread_attr_init"); + return 0; +} + +int pthread_attr_setdetachstate(pthread_attr_t *attr, int detachstate) +{ + ignored("pthread_attr_setdetachstate"); + return 0; +} + + int pthread_create (pthread_t *__restrict __thread, __const pthread_attr_t *__restrict __attr, @@ -188,8 +201,14 @@ int pthread_mutex_init(pthread_mutex_t *mutex, int pthread_mutexattr_destroy(pthread_mutexattr_t *attr) { - ignored("pthread_mutexattr_destroy"); - return 0; + ignored("pthread_mutexattr_destroy"); + return 0; +} + +int pthread_mutexattr_settype(pthread_mutexattr_t *attr, int type) +{ + ignored("pthread_mutexattr_settype"); + return 0; } int pthread_mutex_lock(pthread_mutex_t *mutex) @@ -437,6 +456,20 @@ off_t lseek(int fildes, off_t offset, int whence) return __libc_lseek(fildes, offset, whence); } +extern +void __libc_longjmp(jmp_buf env, int val) __attribute((noreturn)); +void longjmp(jmp_buf env, int val) +{ + __libc_longjmp(env, val); +} + +extern +int __libc_send(int s, const void *msg, size_t len, int flags); +int send(int s, const void *msg, size_t len, int flags) +{ + return __libc_send(s, msg, len, flags); +} + /*--------------------------------------------------*/ /* I've no idea what these are, but they get called quite a lot. diff --git a/coregrind/vg_libpthread.c b/coregrind/vg_libpthread.c index 08abf32811..ab397457de 100644 --- a/coregrind/vg_libpthread.c +++ b/coregrind/vg_libpthread.c @@ -32,7 +32,7 @@ ------------------------------------------------------------------ */ /* Set to 1 to see IGNORED debugging messages. */ -static int show_IGNORED = 0; +static int show_IGNORED = 1; /* --------------------------------------------------------------------- @@ -108,6 +108,19 @@ static void ignored ( char* msg ) Pass pthread_ calls to Valgrind's request mechanism. ------------------------------------------------------------------ */ +int pthread_attr_init(pthread_attr_t *attr) +{ + ignored("pthread_attr_init"); + return 0; +} + +int pthread_attr_setdetachstate(pthread_attr_t *attr, int detachstate) +{ + ignored("pthread_attr_setdetachstate"); + return 0; +} + + int pthread_create (pthread_t *__restrict __thread, __const pthread_attr_t *__restrict __attr, @@ -188,8 +201,14 @@ int pthread_mutex_init(pthread_mutex_t *mutex, int pthread_mutexattr_destroy(pthread_mutexattr_t *attr) { - ignored("pthread_mutexattr_destroy"); - return 0; + ignored("pthread_mutexattr_destroy"); + return 0; +} + +int pthread_mutexattr_settype(pthread_mutexattr_t *attr, int type) +{ + ignored("pthread_mutexattr_settype"); + return 0; } int pthread_mutex_lock(pthread_mutex_t *mutex) @@ -437,6 +456,20 @@ off_t lseek(int fildes, off_t offset, int whence) return __libc_lseek(fildes, offset, whence); } +extern +void __libc_longjmp(jmp_buf env, int val) __attribute((noreturn)); +void longjmp(jmp_buf env, int val) +{ + __libc_longjmp(env, val); +} + +extern +int __libc_send(int s, const void *msg, size_t len, int flags); +int send(int s, const void *msg, size_t len, int flags) +{ + return __libc_send(s, msg, len, flags); +} + /*--------------------------------------------------*/ /* I've no idea what these are, but they get called quite a lot. diff --git a/vg_libpthread.c b/vg_libpthread.c index 08abf32811..ab397457de 100644 --- a/vg_libpthread.c +++ b/vg_libpthread.c @@ -32,7 +32,7 @@ ------------------------------------------------------------------ */ /* Set to 1 to see IGNORED debugging messages. */ -static int show_IGNORED = 0; +static int show_IGNORED = 1; /* --------------------------------------------------------------------- @@ -108,6 +108,19 @@ static void ignored ( char* msg ) Pass pthread_ calls to Valgrind's request mechanism. ------------------------------------------------------------------ */ +int pthread_attr_init(pthread_attr_t *attr) +{ + ignored("pthread_attr_init"); + return 0; +} + +int pthread_attr_setdetachstate(pthread_attr_t *attr, int detachstate) +{ + ignored("pthread_attr_setdetachstate"); + return 0; +} + + int pthread_create (pthread_t *__restrict __thread, __const pthread_attr_t *__restrict __attr, @@ -188,8 +201,14 @@ int pthread_mutex_init(pthread_mutex_t *mutex, int pthread_mutexattr_destroy(pthread_mutexattr_t *attr) { - ignored("pthread_mutexattr_destroy"); - return 0; + ignored("pthread_mutexattr_destroy"); + return 0; +} + +int pthread_mutexattr_settype(pthread_mutexattr_t *attr, int type) +{ + ignored("pthread_mutexattr_settype"); + return 0; } int pthread_mutex_lock(pthread_mutex_t *mutex) @@ -437,6 +456,20 @@ off_t lseek(int fildes, off_t offset, int whence) return __libc_lseek(fildes, offset, whence); } +extern +void __libc_longjmp(jmp_buf env, int val) __attribute((noreturn)); +void longjmp(jmp_buf env, int val) +{ + __libc_longjmp(env, val); +} + +extern +int __libc_send(int s, const void *msg, size_t len, int flags); +int send(int s, const void *msg, size_t len, int flags) +{ + return __libc_send(s, msg, len, flags); +} + /*--------------------------------------------------*/ /* I've no idea what these are, but they get called quite a lot. diff --git a/vg_syscall_mem.c b/vg_syscall_mem.c index e9c788234c..aebd4e0e63 100644 --- a/vg_syscall_mem.c +++ b/vg_syscall_mem.c @@ -354,6 +354,33 @@ void VG_(perform_assumed_nonblocking_syscall) ( ThreadId tid ) /* !!!!!!!!!! New, untested syscalls !!!!!!!!!!!!!!!!!!!!! */ +# if defined(__NR_mremap) + /* Is this really right? Perhaps it should copy the permissions + from the old area into the new. Unclear from the Linux man + pages what this really does. Also, the flags don't look like + they mean the same as the standard mmap flags, so that's + probably wrong too. */ + case __NR_mremap: /* syscall 163 */ + /* void* mremap(void * old_address, size_t old_size, + size_t new_size, unsigned long flags); */ + if (VG_(clo_trace_syscalls)) + VG_(printf)("mremap ( %p, %d, %d, 0x%x )\n", + arg1, arg2, arg3, arg4); + must_be_writable ( tst, "mremap(old_address)", arg1, arg2 ); + KERNEL_DO_SYSCALL(tid,res); + if (!VG_(is_kerror)(res)) { + /* Copied from munmap() wrapper. */ + Addr start = arg1; + Addr length = arg2; + while ((start % VKI_BYTES_PER_PAGE) > 0) { start--; length++; } + while (((start+length) % VKI_BYTES_PER_PAGE) > 0) { length++; } + make_noaccess( start, length ); + VG_(symtab_notify_munmap) ( start, length ); + approximate_mmap_permissions( (Addr)res, arg3, arg4 ); + } + break; +# endif + case __NR_nice: /* syscall 34 */ /* int nice(int inc); */ if (VG_(clo_trace_syscalls))