mirror of
https://github.com/Zenithsiz/ftmemsim-valgrind.git
synced 2026-02-04 02:18:37 +00:00
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
This commit is contained in:
parent
0f5c165ccc
commit
8f0229881b
@ -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.
|
||||
|
||||
@ -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.
|
||||
|
||||
@ -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.
|
||||
|
||||
@ -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))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user