]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Failed attempt to make JDK 1.4.0 work.
authorJulian Seward <jseward@acm.org>
Mon, 3 Jun 2002 00:58:18 +0000 (00:58 +0000)
committerJulian Seward <jseward@acm.org>
Mon, 3 Jun 2002 00:58:18 +0000 (00:58 +0000)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@361

coregrind/arch/x86-linux/vg_libpthread.c
coregrind/arch/x86-linux/vg_libpthread_unimp.c
coregrind/vg_kerneliface.h
coregrind/vg_libpthread.c
coregrind/vg_libpthread_unimp.c
coregrind/vg_main.c
vg_kerneliface.h
vg_libpthread.c
vg_libpthread_unimp.c
vg_main.c

index 56f435bece185fac17056c531356f3902acd00e8..6cb5dd6622c749f0a73fc68697cac559971e8b91 100644 (file)
@@ -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.
index b5d1349e2c5065a65aa2cf4a66de7effc562d48a..21dbbc50acc3a0d0457f4a83b3506bfca22ceb74 100644 (file)
@@ -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"); }
index ef74d8db2995f20117bb1186ca0422828d4f8b8d..8eb7046306750d92e428cd01ab54b07747f8ca41 100644 (file)
@@ -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 */
index 56f435bece185fac17056c531356f3902acd00e8..6cb5dd6622c749f0a73fc68697cac559971e8b91 100644 (file)
@@ -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.
index b5d1349e2c5065a65aa2cf4a66de7effc562d48a..21dbbc50acc3a0d0457f4a83b3506bfca22ceb74 100644 (file)
@@ -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"); }
index 64b0aa0502cce45abe143b4536cf2a2c6ea60482..9f50ab21bd4e89bad42f0b9051dd524ce9e7652b 100644 (file)
@@ -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)();
index ef74d8db2995f20117bb1186ca0422828d4f8b8d..8eb7046306750d92e428cd01ab54b07747f8ca41 100644 (file)
@@ -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 */
index 56f435bece185fac17056c531356f3902acd00e8..6cb5dd6622c749f0a73fc68697cac559971e8b91 100644 (file)
@@ -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.
index b5d1349e2c5065a65aa2cf4a66de7effc562d48a..21dbbc50acc3a0d0457f4a83b3506bfca22ceb74 100644 (file)
@@ -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"); }
index 64b0aa0502cce45abe143b4536cf2a2c6ea60482..9f50ab21bd4e89bad42f0b9051dd524ce9e7652b 100644 (file)
--- 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)();