From: Julian Seward Date: Mon, 3 Jun 2002 00:58:18 +0000 (+0000) Subject: Failed attempt to make JDK 1.4.0 work. X-Git-Tag: svn/VALGRIND_1_0_3~110 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a75be28f6f30ea2bc1fdcd10ab9fdc714e0bfd39;p=thirdparty%2Fvalgrind.git Failed attempt to make JDK 1.4.0 work. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@361 --- diff --git a/coregrind/arch/x86-linux/vg_libpthread.c b/coregrind/arch/x86-linux/vg_libpthread.c index 56f435bece..6cb5dd6622 100644 --- a/coregrind/arch/x86-linux/vg_libpthread.c +++ b/coregrind/arch/x86-linux/vg_libpthread.c @@ -288,6 +288,59 @@ int pthread_attr_getscope ( const pthread_attr_t *attr, int *scope ) return 0; } + +/* Pretty bogus. Avoid if possible. */ +int pthread_getattr_np (pthread_t thread, pthread_attr_t *attr) +{ + int detached; + size_t limit; + ensure_valgrind("pthread_getattr_np"); + kludged("pthread_getattr_np"); + limit = VG_PTHREAD_STACK_SIZE - VG_AR_CLIENT_STACKBASE_REDZONE_SZB + - 1000; /* paranoia */ + attr->__detachstate = PTHREAD_CREATE_JOINABLE; + attr->__schedpolicy = SCHED_OTHER; + attr->__schedparam.sched_priority = 0; + attr->__inheritsched = PTHREAD_EXPLICIT_SCHED; + attr->__scope = PTHREAD_SCOPE_SYSTEM; + attr->__guardsize = VKI_BYTES_PER_PAGE; + attr->__stackaddr = NULL; + attr->__stackaddr_set = 0; + attr->__stacksize = limit; + VALGRIND_MAGIC_SEQUENCE(detached, (-1) /* default */, + VG_USERREQ__SET_OR_GET_DETACH, + 2 /* get */, thread, 0, 0); + assert(detached == 0 || detached == 1); + if (detached) + attr->__detachstate = PTHREAD_CREATE_DETACHED; + return 0; +} + + +/* Bogus ... */ +int pthread_attr_getstackaddr ( const pthread_attr_t * attr, + void ** stackaddr ) +{ + ensure_valgrind("pthread_attr_getstackaddr"); + kludged("pthread_attr_getstackaddr"); + if (stackaddr) + *stackaddr = NULL; + return 0; +} + +/* Not bogus (!) */ +int pthread_attr_getstacksize ( const pthread_attr_t * _attr, + size_t * __stacksize ) +{ + size_t limit; + ensure_valgrind("pthread_attr_getstacksize"); + limit = VG_PTHREAD_STACK_SIZE - VG_AR_CLIENT_STACKBASE_REDZONE_SZB + - 1000; /* paranoia */ + if (__stacksize) + *__stacksize = limit; + return 0; +} + /* --------------------------------------------------- Helper functions for running a thread and for clearing up afterwards. diff --git a/coregrind/arch/x86-linux/vg_libpthread_unimp.c b/coregrind/arch/x86-linux/vg_libpthread_unimp.c index b5d1349e2c..21dbbc50ac 100644 --- a/coregrind/arch/x86-linux/vg_libpthread_unimp.c +++ b/coregrind/arch/x86-linux/vg_libpthread_unimp.c @@ -113,7 +113,7 @@ void pthread_condattr_setpshared ( void ) { unimp("pthread_condattr_setpshared" //void pthread_detach ( void ) { unimp("pthread_detach"); } //void pthread_equal ( void ) { unimp("pthread_equal"); } //void pthread_exit ( void ) { unimp("pthread_exit"); } -void pthread_getattr_np ( void ) { unimp("pthread_getattr_np"); } +//void pthread_getattr_np ( void ) { unimp("pthread_getattr_np"); } void pthread_getcpuclockid ( void ) { unimp("pthread_getcpuclockid"); } //void pthread_getschedparam ( void ) { unimp("pthread_getschedparam"); } //void pthread_getspecific ( void ) { unimp("pthread_getspecific"); } diff --git a/coregrind/vg_kerneliface.h b/coregrind/vg_kerneliface.h index ef74d8db29..8eb7046306 100644 --- a/coregrind/vg_kerneliface.h +++ b/coregrind/vg_kerneliface.h @@ -130,14 +130,14 @@ typedef #define VKI_SIGTERM 15 #define VKI_SIGUSR1 10 -/* The following are copied from /usr/include/bits/mman.h, which in - turn claims to have got them from the kernel headers. */ +/* The following are copied from include/asm-i386/mman.h .*/ #define VKI_PROT_READ 0x1 /* Page can be read. */ #define VKI_PROT_WRITE 0x2 /* Page can be written. */ #define VKI_PROT_EXEC 0x4 /* Page can be executed. */ #define VKI_MAP_ANONYMOUS 0x20 /* Don't use a file. */ #define VKI_MAP_PRIVATE 0x02 /* Changes are private. */ +#define VKI_MAP_FIXED 0x10 /* Interpret addr exactly */ /* Copied from /usr/src/linux-2.4.9-13/include/asm/errno.h */ diff --git a/coregrind/vg_libpthread.c b/coregrind/vg_libpthread.c index 56f435bece..6cb5dd6622 100644 --- a/coregrind/vg_libpthread.c +++ b/coregrind/vg_libpthread.c @@ -288,6 +288,59 @@ int pthread_attr_getscope ( const pthread_attr_t *attr, int *scope ) return 0; } + +/* Pretty bogus. Avoid if possible. */ +int pthread_getattr_np (pthread_t thread, pthread_attr_t *attr) +{ + int detached; + size_t limit; + ensure_valgrind("pthread_getattr_np"); + kludged("pthread_getattr_np"); + limit = VG_PTHREAD_STACK_SIZE - VG_AR_CLIENT_STACKBASE_REDZONE_SZB + - 1000; /* paranoia */ + attr->__detachstate = PTHREAD_CREATE_JOINABLE; + attr->__schedpolicy = SCHED_OTHER; + attr->__schedparam.sched_priority = 0; + attr->__inheritsched = PTHREAD_EXPLICIT_SCHED; + attr->__scope = PTHREAD_SCOPE_SYSTEM; + attr->__guardsize = VKI_BYTES_PER_PAGE; + attr->__stackaddr = NULL; + attr->__stackaddr_set = 0; + attr->__stacksize = limit; + VALGRIND_MAGIC_SEQUENCE(detached, (-1) /* default */, + VG_USERREQ__SET_OR_GET_DETACH, + 2 /* get */, thread, 0, 0); + assert(detached == 0 || detached == 1); + if (detached) + attr->__detachstate = PTHREAD_CREATE_DETACHED; + return 0; +} + + +/* Bogus ... */ +int pthread_attr_getstackaddr ( const pthread_attr_t * attr, + void ** stackaddr ) +{ + ensure_valgrind("pthread_attr_getstackaddr"); + kludged("pthread_attr_getstackaddr"); + if (stackaddr) + *stackaddr = NULL; + return 0; +} + +/* Not bogus (!) */ +int pthread_attr_getstacksize ( const pthread_attr_t * _attr, + size_t * __stacksize ) +{ + size_t limit; + ensure_valgrind("pthread_attr_getstacksize"); + limit = VG_PTHREAD_STACK_SIZE - VG_AR_CLIENT_STACKBASE_REDZONE_SZB + - 1000; /* paranoia */ + if (__stacksize) + *__stacksize = limit; + return 0; +} + /* --------------------------------------------------- Helper functions for running a thread and for clearing up afterwards. diff --git a/coregrind/vg_libpthread_unimp.c b/coregrind/vg_libpthread_unimp.c index b5d1349e2c..21dbbc50ac 100644 --- a/coregrind/vg_libpthread_unimp.c +++ b/coregrind/vg_libpthread_unimp.c @@ -113,7 +113,7 @@ void pthread_condattr_setpshared ( void ) { unimp("pthread_condattr_setpshared" //void pthread_detach ( void ) { unimp("pthread_detach"); } //void pthread_equal ( void ) { unimp("pthread_equal"); } //void pthread_exit ( void ) { unimp("pthread_exit"); } -void pthread_getattr_np ( void ) { unimp("pthread_getattr_np"); } +//void pthread_getattr_np ( void ) { unimp("pthread_getattr_np"); } void pthread_getcpuclockid ( void ) { unimp("pthread_getcpuclockid"); } //void pthread_getschedparam ( void ) { unimp("pthread_getschedparam"); } //void pthread_getspecific ( void ) { unimp("pthread_getspecific"); } diff --git a/coregrind/vg_main.c b/coregrind/vg_main.c index 64b0aa0502..9f50ab21bd 100644 --- a/coregrind/vg_main.c +++ b/coregrind/vg_main.c @@ -987,6 +987,14 @@ void VG_(main) ( void ) /* Process Valgrind's command-line opts (from env var VG_OPTS). */ process_cmd_line_options(); + /* Hook to delay things long enough so we can get the pid and + attach GDB in another shell. */ + if (0) { + Int p, q; + for (p = 0; p < 50000; p++) + for (q = 0; q < 50000; q++) ; + } + /* Initialise the scheduler, and copy the client's state from baseBlock into VG_(threads)[1]. This has to come before signal initialisations. */ @@ -1004,10 +1012,6 @@ void VG_(main) ( void ) /* Start calibration of our RDTSC-based clock. */ VG_(start_rdtsc_calibration)(); - /* Hook to delay things long enough so we can get the pid and - attach GDB in another shell. */ - /* {extern unsigned int sleep(unsigned int seconds); sleep(10);} */ - if (VG_(clo_instrument) || VG_(clo_cachesim)) { VGP_PUSHCC(VgpInitAudit); VGM_(init_memory_audit)(); diff --git a/vg_kerneliface.h b/vg_kerneliface.h index ef74d8db29..8eb7046306 100644 --- a/vg_kerneliface.h +++ b/vg_kerneliface.h @@ -130,14 +130,14 @@ typedef #define VKI_SIGTERM 15 #define VKI_SIGUSR1 10 -/* The following are copied from /usr/include/bits/mman.h, which in - turn claims to have got them from the kernel headers. */ +/* The following are copied from include/asm-i386/mman.h .*/ #define VKI_PROT_READ 0x1 /* Page can be read. */ #define VKI_PROT_WRITE 0x2 /* Page can be written. */ #define VKI_PROT_EXEC 0x4 /* Page can be executed. */ #define VKI_MAP_ANONYMOUS 0x20 /* Don't use a file. */ #define VKI_MAP_PRIVATE 0x02 /* Changes are private. */ +#define VKI_MAP_FIXED 0x10 /* Interpret addr exactly */ /* Copied from /usr/src/linux-2.4.9-13/include/asm/errno.h */ diff --git a/vg_libpthread.c b/vg_libpthread.c index 56f435bece..6cb5dd6622 100644 --- a/vg_libpthread.c +++ b/vg_libpthread.c @@ -288,6 +288,59 @@ int pthread_attr_getscope ( const pthread_attr_t *attr, int *scope ) return 0; } + +/* Pretty bogus. Avoid if possible. */ +int pthread_getattr_np (pthread_t thread, pthread_attr_t *attr) +{ + int detached; + size_t limit; + ensure_valgrind("pthread_getattr_np"); + kludged("pthread_getattr_np"); + limit = VG_PTHREAD_STACK_SIZE - VG_AR_CLIENT_STACKBASE_REDZONE_SZB + - 1000; /* paranoia */ + attr->__detachstate = PTHREAD_CREATE_JOINABLE; + attr->__schedpolicy = SCHED_OTHER; + attr->__schedparam.sched_priority = 0; + attr->__inheritsched = PTHREAD_EXPLICIT_SCHED; + attr->__scope = PTHREAD_SCOPE_SYSTEM; + attr->__guardsize = VKI_BYTES_PER_PAGE; + attr->__stackaddr = NULL; + attr->__stackaddr_set = 0; + attr->__stacksize = limit; + VALGRIND_MAGIC_SEQUENCE(detached, (-1) /* default */, + VG_USERREQ__SET_OR_GET_DETACH, + 2 /* get */, thread, 0, 0); + assert(detached == 0 || detached == 1); + if (detached) + attr->__detachstate = PTHREAD_CREATE_DETACHED; + return 0; +} + + +/* Bogus ... */ +int pthread_attr_getstackaddr ( const pthread_attr_t * attr, + void ** stackaddr ) +{ + ensure_valgrind("pthread_attr_getstackaddr"); + kludged("pthread_attr_getstackaddr"); + if (stackaddr) + *stackaddr = NULL; + return 0; +} + +/* Not bogus (!) */ +int pthread_attr_getstacksize ( const pthread_attr_t * _attr, + size_t * __stacksize ) +{ + size_t limit; + ensure_valgrind("pthread_attr_getstacksize"); + limit = VG_PTHREAD_STACK_SIZE - VG_AR_CLIENT_STACKBASE_REDZONE_SZB + - 1000; /* paranoia */ + if (__stacksize) + *__stacksize = limit; + return 0; +} + /* --------------------------------------------------- Helper functions for running a thread and for clearing up afterwards. diff --git a/vg_libpthread_unimp.c b/vg_libpthread_unimp.c index b5d1349e2c..21dbbc50ac 100644 --- a/vg_libpthread_unimp.c +++ b/vg_libpthread_unimp.c @@ -113,7 +113,7 @@ void pthread_condattr_setpshared ( void ) { unimp("pthread_condattr_setpshared" //void pthread_detach ( void ) { unimp("pthread_detach"); } //void pthread_equal ( void ) { unimp("pthread_equal"); } //void pthread_exit ( void ) { unimp("pthread_exit"); } -void pthread_getattr_np ( void ) { unimp("pthread_getattr_np"); } +//void pthread_getattr_np ( void ) { unimp("pthread_getattr_np"); } void pthread_getcpuclockid ( void ) { unimp("pthread_getcpuclockid"); } //void pthread_getschedparam ( void ) { unimp("pthread_getschedparam"); } //void pthread_getspecific ( void ) { unimp("pthread_getspecific"); } diff --git a/vg_main.c b/vg_main.c index 64b0aa0502..9f50ab21bd 100644 --- a/vg_main.c +++ b/vg_main.c @@ -987,6 +987,14 @@ void VG_(main) ( void ) /* Process Valgrind's command-line opts (from env var VG_OPTS). */ process_cmd_line_options(); + /* Hook to delay things long enough so we can get the pid and + attach GDB in another shell. */ + if (0) { + Int p, q; + for (p = 0; p < 50000; p++) + for (q = 0; q < 50000; q++) ; + } + /* Initialise the scheduler, and copy the client's state from baseBlock into VG_(threads)[1]. This has to come before signal initialisations. */ @@ -1004,10 +1012,6 @@ void VG_(main) ( void ) /* Start calibration of our RDTSC-based clock. */ VG_(start_rdtsc_calibration)(); - /* Hook to delay things long enough so we can get the pid and - attach GDB in another shell. */ - /* {extern unsigned int sleep(unsigned int seconds); sleep(10);} */ - if (VG_(clo_instrument) || VG_(clo_cachesim)) { VGP_PUSHCC(VgpInitAudit); VGM_(init_memory_audit)();