New tarball of valgrind for WINE available
Raphaël Junqueira
fenix at club-internet.fr
Mon Nov 3 17:54:13 CST 2003
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi again,
With my little patch, valgrind/NTPL wine works like a charm (even with unreal2
and after too many errors) :)
Now going to sleep
Regards,
Raphael
Le Monday 03 November 2003 23:14, Raphaël Junqueira a écrit :
> Le Monday 03 November 2003 23:06, Lionel Ulmer a écrit :
> > > Trying to run valgrind on wine directx (running Unreal2 with nvidia
> > > openGL drivers)
> >
> > I think it's best to use software GL when using Valgrind... It is
> > reported to make the DRI crash and not support all syscalls needed by the
> > NVIDIA GL drivers.
>
> well it seems NTPL-related (only one real reference of
> pthread_attr_setstack, in ntdll):
>
> int SYSDEPS_SpawnThread( void (*func)(TEB *), TEB *teb )
> {
> #ifdef HAVE_NPTL
> pthread_t id;
> pthread_attr_t attr;
>
> pthread_attr_init( &attr );
> pthread_attr_setstack( &attr, teb->DeallocationStack,
> (char *)teb->Tib.StackBase - (char
> *)teb->DeallocationStack );
> if (pthread_create( &id, &attr, (void * (*)(void *))func, teb )) return
> -1;
> return 0;
> #elif defined(HAVE_CLONE)
> <snip>
>
> Implementing it into valgrind is difficult ?
>
> > Anyway, I have a different issue :
> >
> > valgrind: vg_ldt.c:167 (vgPlain_do_useseg): Assertion (seg_selector & 7)
> > == 7' failed.
>
> strange, valgrind love wine :p
>
> > Lionel
>
> Regards,
> Raphael
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)
iD8DBQE/puqlp7NA3AmQTU4RApWdAJ9GaAVd/YSxLtvKJzvvjRZi53GVzQCeKNCC
KX7p0QikmBaAOqWwKsKWQjs=
=+iec
-----END PGP SIGNATURE-----
-------------- next part --------------
Seulement dans ./addrcheck: .deps
Seulement dans ./addrcheck/docs: Makefile
Seulement dans ./addrcheck: Makefile
Seulement dans ./addrcheck/tests: Makefile
Seulement dans ./auxprogs: .deps
Seulement dans ./auxprogs: Makefile
Seulement dans ./auxprogs: valgrind-listener
Seulement dans ./cachegrind: cg_annotate
Seulement dans ./cachegrind: .deps
Seulement dans ./cachegrind/docs: Makefile
Seulement dans ./cachegrind: Makefile
Seulement dans ./cachegrind/tests: .deps
Seulement dans ./cachegrind/tests: Makefile
Seulement dans .: config.h
Seulement dans .: config.log
Seulement dans .: config.status
Seulement dans ./corecheck: .deps
Seulement dans ./corecheck/docs: Makefile
Seulement dans ./corecheck: Makefile
Seulement dans ./corecheck/tests: .deps
Seulement dans ./corecheck/tests: Makefile
Seulement dans ./coregrind/demangle: .deps
Seulement dans ./coregrind/demangle: libdemangle.a
Seulement dans ./coregrind/demangle: Makefile
Seulement dans ./coregrind: .deps
Seulement dans ./coregrind/docs: Makefile
Seulement dans ./coregrind: .in_place
Seulement dans ./coregrind: lib_replace_malloc.a
Seulement dans ./coregrind: Makefile
Seulement dans ./coregrind: valgrind
Seulement dans ./coregrind: vg_include.h~
diff --exclude='*.*o' -r -u ../valgrind-20031012-wine/coregrind/vg_libpthread.c ./coregrind/vg_libpthread.c
--- ../valgrind-20031012-wine/coregrind/vg_libpthread.c 2003-10-17 13:46:50.000000000 +0200
+++ ./coregrind/vg_libpthread.c 2003-11-04 00:44:12.000000000 +0100
@@ -377,6 +377,33 @@
barf(buf);
}
+WEAK
+int pthread_attr_setstack (pthread_attr_t *__attr,
+ void* __stackaddr,
+ size_t __stacksize)
+{
+ size_t limit;
+ char buf[1024];
+ ensure_valgrind("pthread_attr_setstack");
+ limit = VG_PTHREAD_STACK_SIZE - VG_AR_CLIENT_STACKBASE_REDZONE_SZB;
+ if (__stacksize >= limit && NULL != __stackaddr) {
+ __attr->__stackaddr = __stackaddr;
+ __attr->__stacksize = __stacksize;
+ return 0;
+ }
+ if (__stacksize < limit) {
+ snprintf(buf, sizeof(buf), "pthread_attr_setstack: "
+ "requested size %d < VG_PTHREAD_STACK_SIZE - VG_AR_CLIENT_STACKBASE_REDZONE_SZ\n "
+ "edit vg_include.h and rebuild.", __stacksize);
+ } else if (NULL == __stackaddr) {
+ snprintf(buf, sizeof(buf), "pthread_attr_setstack: "
+ "requested with a null stack pointer.");
+ }
+ buf[sizeof(buf)-1] = '\0'; /* Make sure it is zero terminated */
+ barf(buf);
+}
+
+
/* This is completely bogus. */
int pthread_attr_getschedparam(const pthread_attr_t *attr,
@@ -721,6 +748,11 @@
int tid_child;
NewThreadInfo* info;
int (*clone_fn)( void* (*)(void *), void *, int, void * );
+ struct {
+ int clone_flags;
+ void* user_stackaddr;
+ size_t user_stacksize;
+ } thread_create_info;
ensure_valgrind("pthread_create");
@@ -733,10 +765,17 @@
info = my_malloc(sizeof(NewThreadInfo));
my_assert(info != NULL);
- if (__attr)
+ if (__attr) {
info->attr__detachstate = __attr->__detachstate;
- else
+ thread_create_info.user_stackaddr = __attr->__stackaddr;
+ thread_create_info.user_stacksize = __attr->__stacksize;
+ } else {
info->attr__detachstate = PTHREAD_CREATE_JOINABLE;
+ thread_create_info.user_stackaddr = NULL;
+ thread_create_info.user_stacksize = 0;
+ }
+
+ thread_create_info.clone_flags = flags;
info->root_fn = __start_routine;
info->arg = __arg;
@@ -746,7 +785,7 @@
VALGRIND_MAGIC_SEQUENCE(tid_child, VG_INVALID_THREADID /* default */,
VG_USERREQ__APPLY_IN_NEW_THREAD,
- &thread_wrapper, info, clone_fn, flags);
+ &thread_wrapper, info, clone_fn, &thread_create_info);
my_assert(tid_child != VG_INVALID_THREADID);
if (__thredd)
Seulement dans ./coregrind: vg_libpthread.c~
diff --exclude='*.*o' -r -u ../valgrind-20031012-wine/coregrind/vg_libpthread_unimp.c ./coregrind/vg_libpthread_unimp.c
--- ../valgrind-20031012-wine/coregrind/vg_libpthread_unimp.c 2003-10-17 13:46:50.000000000 +0200
+++ ./coregrind/vg_libpthread_unimp.c 2003-11-04 00:32:12.000000000 +0100
@@ -233,8 +233,8 @@
{ vgPlain_unimp("pthread_attr_getstacksize"); }
//__attribute__((weak)) void pthread_attr_setguardsize ( void )
// { vgPlain_unimp("pthread_attr_setguardsize"); }
-__attribute__((weak)) void pthread_attr_setstack ( void )
- { vgPlain_unimp("pthread_attr_setstack"); }
+//__attribute__((weak)) void pthread_attr_setstack ( void )
+// { vgPlain_unimp("pthread_attr_setstack"); }
__attribute__((weak)) void pthread_attr_setstackaddr ( void )
{ vgPlain_unimp("pthread_attr_setstackaddr"); }
//__attribute__((weak)) void pthread_attr_setstacksize ( void )
Seulement dans ./coregrind: vg_libpthread_unimp.c~
diff --exclude='*.*o' -r -u ../valgrind-20031012-wine/coregrind/vg_scheduler.c ./coregrind/vg_scheduler.c
--- ../valgrind-20031012-wine/coregrind/vg_scheduler.c 2003-10-17 13:46:50.000000000 +0200
+++ ./coregrind/vg_scheduler.c 2003-11-04 00:36:20.000000000 +0100
@@ -2148,8 +2148,8 @@
static
-void do_pthread_join ( ThreadId tid,
- ThreadId jee, void** thread_return )
+void do__pthread_join ( ThreadId tid,
+ ThreadId jee, void** thread_return )
{
Char msg_buf[100];
ThreadId i;
@@ -2291,17 +2291,25 @@
/* (Fn, Arg): Create a new thread and run Fn applied to Arg in it. Fn
MUST NOT return -- ever. Eventually it will do either __QUIT or
__WAIT_JOINER. Return the child tid to the parent. */
+typedef struct {
+ int clone_flags;
+ void* user_stackaddr;
+ size_t user_stacksize;
+} thread_create_info;
+
static
void do__apply_in_new_thread ( ThreadId parent_tid,
void* (*fn)(void *),
void* arg,
int (*clone_fn)( void* (*)(void *), void *, int, void * ),
- int clone_flags )
+ void* info )
{
Addr new_stack;
UInt new_stk_szb;
ThreadId tid;
Char msg_buf[100];
+ thread_create_info* t_info = (thread_create_info*) info;
+ int clone_flags = t_info->clone_flags;
/* Paranoia ... */
vg_assert(sizeof(pthread_t) == sizeof(UInt));
@@ -2345,18 +2353,22 @@
is inadequate. */
new_stk_szb = VG_PTHREAD_STACK_MIN;
+ VG_(threads)[tid].stack_size = t_info->user_stacksize;
+
if (new_stk_szb > VG_(threads)[tid].stack_size) {
/* Again, for good measure :) We definitely don't want to be
allocating a stack for the main thread. */
vg_assert(tid != 1);
/* for now, we don't handle the case of anything other than
assigning it for the first time. */
- vg_assert(VG_(threads)[tid].stack_size == 0);
+ /*vg_assert(VG_(threads)[tid].stack_size == 0); * setstack support now */
vg_assert(VG_(threads)[tid].stack_base == (Addr)NULL);
new_stack = (Addr)VG_(get_memory_from_mmap)( new_stk_szb,
"new thread stack" );
VG_(threads)[tid].stack_base = new_stack;
VG_(threads)[tid].stack_size = new_stk_szb;
+ } else {
+ VG_(threads)[tid].stack_base = (Addr)t_info->user_stackaddr; /* user allocated stack seems correct so use it */
}
/* always recalculate this in case someone switched stack on the
@@ -2441,7 +2453,6 @@
SET_PTHREQ_RETVAL(parent_tid, tid); /* success */
}
-
/* -----------------------------------------------------------
MUTEXes
-------------------------------------------------------- */
@@ -3532,7 +3543,7 @@
break;
case VG_USERREQ__PTHREAD_JOIN:
- do_pthread_join( tid, arg[1], (void**)(arg[2]) );
+ do__pthread_join( tid, arg[1], (void**)(arg[2]) );
break;
case VG_USERREQ__PTHREAD_COND_WAIT:
@@ -3629,7 +3640,7 @@
case VG_USERREQ__APPLY_IN_NEW_THREAD:
do__apply_in_new_thread ( tid, (void*(*)(void*))arg[1],
- (void*)arg[2], (void*)arg[3], (int)arg[4] );
+ (void*)arg[2], (void*)arg[3], (void*)arg[4] );
break;
case VG_USERREQ__GET_KEY_D_AND_S:
Seulement dans ./coregrind: vg_scheduler.c~
Seulement dans .: default.supp
Seulement dans ./docs: Makefile
Seulement dans ./helgrind: .deps
Seulement dans ./helgrind/docs: Makefile
Seulement dans ./helgrind: Makefile
Seulement dans ./helgrind/tests: Makefile
Seulement dans ./include: Makefile
Seulement dans ./lackey: .deps
Seulement dans ./lackey/docs: Makefile
Seulement dans ./lackey: Makefile
Seulement dans ./lackey/tests: Makefile
Seulement dans .: Makefile
Seulement dans ./memcheck: .deps
Seulement dans ./memcheck/docs: Makefile
Seulement dans ./memcheck: Makefile
Seulement dans ./memcheck/tests: .deps
Seulement dans ./memcheck/tests: Makefile
Seulement dans ./none: .deps
Seulement dans ./none/docs: Makefile
Seulement dans ./none: Makefile
Seulement dans ./none/tests: .deps
Seulement dans ./none/tests: Makefile
Seulement dans .: stamp-h1
Seulement dans ./tests: .deps
Seulement dans ./tests: Makefile
Seulement dans ./tests/unused: Makefile
Seulement dans ./tests: vg_regtest
Seulement dans .: valgrind.spec
More information about the wine-devel
mailing list