]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Fix Valgrind coredump when VG_(unimplemented)() is called
authorIvo Raisr <ivosh@ivosh.net>
Sat, 23 Apr 2016 19:35:11 +0000 (19:35 +0000)
committerIvo Raisr <ivosh@ivosh.net>
Sat, 23 Apr 2016 19:35:11 +0000 (19:35 +0000)
early during main initialization, before the threads are
created and scheduler is initialized.
Fixes BZ#362009

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15867

NEWS
coregrind/m_libcassert.c
none/tests/solaris/reserve_sysstat_addr.stderr.exp
none/tests/solaris/reserve_sysstat_addr.vgtest
none/tests/solaris/reserve_sysstat_zone_addr.stderr.exp
none/tests/solaris/reserve_sysstat_zone_addr.vgtest

diff --git a/NEWS b/NEWS
index 5f39676adc6486778209aaa235137df94c9ed786..cbeb9d8d922cdcc8c3fb397b23885485d910f75c 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -86,6 +86,8 @@ where XXXXXX is the bug number as listed below.
 359829  PowerPC test none/tests/ppc64/test_isa_2_07.c uninitialized memory
         references was fixed.
 359871  Incorrect mask handling in ppoll
+360008  Contents of Power vr registers contents is not printed correctly when
+        the --vgdb-shadow-registers=yes option is used
 360425  arm64 unsupported instruction ldpsw
 360519  none/tests/arm64/memory.vgtest might fail with newer gcc
 360749  kludge for multiple .rodata sections on Solaris no longer needed
@@ -93,8 +95,7 @@ where XXXXXX is the bug number as listed below.
 361354  ppc64[le]: wire up separate socketcalls system calls
 361226  s390x: risbgn (EC59) not implemented
 361926  Unhandled Solaris syscall: sysfs(84)
-360008  Contents of Power vr registers contents is not printed correctly when
-        the --vgdb-shadow-registers=yes option is used
+362009  Valgrind dumps core on unimplemented functionality before threads are created
 
 n-i-bz Fix incorrect (or infinite loop) unwind on RHEL7 x86 and amd64
 n-i-bz massif --pages-as-heap=yes does not report peak caused by mmap+munmap
index c393d7b73bc284d909a2b561b6dcf7137f46365a..b5ce2d9c9ff751f1008b71d8d3b59a724f1a3151 100644 (file)
@@ -362,38 +362,42 @@ static void show_sched_status_wrk ( Bool host_stacktrace,
    }
 
    VG_(printf)("\nsched status:\n"); 
-   VG_(printf)("  running_tid=%u\n", VG_(get_running_tid)());
-   for (i = 1; i < VG_N_THREADS; i++) {
-      VgStack* stack 
-         = (VgStack*)VG_(threads)[i].os_state.valgrind_stack_base;
-      /* If a thread slot was never used (yet), valgrind_stack_base is 0.
-         If a thread slot is used by a thread or was used by a thread which
-         has exited, then valgrind_stack_base points to the stack base. */
-      if (VG_(threads)[i].status == VgTs_Empty
-          && (!exited_threads || stack == 0)) continue;
-      VG_(printf)("\nThread %d: status = %s (lwpid %d)\n", i, 
-                  VG_(name_of_ThreadStatus)(VG_(threads)[i].status),
-                  VG_(threads)[i].os_state.lwpid);
-      if (VG_(threads)[i].status != VgTs_Empty)
-         VG_(get_and_pp_StackTrace)( i, BACKTRACE_DEPTH );
-      if (stack_usage && VG_(threads)[i].client_stack_highest_byte != 0 ) {
-         Addr start, end;
-         
-         start = end = 0;
-         VG_(stack_limits)(VG_(threads)[i].client_stack_highest_byte,
-                           &start, &end);
-         if (start != end)
-            VG_(printf)("client stack range: [%p %p] client SP: %p\n",
-                        (void*)start, (void*)end, (void*)VG_(get_SP)(i));
-         else
-            VG_(printf)("client stack range: ???????\n");
+   if (VG_(threads) == NULL) {
+      VG_(printf)("  scheduler not yet initialised\n");
+   } else {
+      VG_(printf)("  running_tid=%u\n", VG_(get_running_tid)());
+      for (i = 1; i < VG_N_THREADS; i++) {
+         VgStack *stack 
+            = (VgStack*)VG_(threads)[i].os_state.valgrind_stack_base;
+         /* If a thread slot was never used (yet), valgrind_stack_base is 0.
+            If a thread slot is used by a thread or was used by a thread which
+            has exited, then valgrind_stack_base points to the stack base. */
+         if (VG_(threads)[i].status == VgTs_Empty
+             && (!exited_threads || stack == 0)) continue;
+         VG_(printf)("\nThread %d: status = %s (lwpid %d)\n", i, 
+                     VG_(name_of_ThreadStatus)(VG_(threads)[i].status),
+                     VG_(threads)[i].os_state.lwpid);
+         if (VG_(threads)[i].status != VgTs_Empty)
+            VG_(get_and_pp_StackTrace)( i, BACKTRACE_DEPTH );
+         if (stack_usage && VG_(threads)[i].client_stack_highest_byte != 0 ) {
+            Addr start, end;
+
+            start = end = 0;
+            VG_(stack_limits)(VG_(threads)[i].client_stack_highest_byte,
+                              &start, &end);
+            if (start != end)
+               VG_(printf)("client stack range: [%p %p] client SP: %p\n",
+                           (void*)start, (void*)end, (void*)VG_(get_SP)(i));
+            else
+               VG_(printf)("client stack range: ???????\n");
+         }
+         if (stack_usage && stack != 0)
+            VG_(printf)("valgrind stack top usage: %lu of %lu\n",
+                        VG_(clo_valgrind_stacksize)
+                           - VG_(am_get_VgStack_unused_szB)
+                              (stack, VG_(clo_valgrind_stacksize)),
+                        (SizeT) VG_(clo_valgrind_stacksize));
       }
-      if (stack_usage && stack != 0)
-          VG_(printf)("valgrind stack top usage: %lu of %lu\n",
-                      VG_(clo_valgrind_stacksize)
-                        - VG_(am_get_VgStack_unused_szB)
-                               (stack, VG_(clo_valgrind_stacksize)),
-                      (SizeT) VG_(clo_valgrind_stacksize));
    }
    VG_(printf)("\n");
 }
index 05d2cc671aa32112af5436e7f5a4fa1fb3f21889..73ba489cff406c7df47c8ea7099220731a7aea6c 100644 (file)
@@ -11,4 +11,5 @@ Valgrind has to exit now.  Sorry.  Bye!
 
 
 sched status:
-  running_tid=0
+  scheduler not yet initialised
+
index 01ece7e61fced6614a65fc5995a68ae01863d44c..c3e8d14e7bf7f43e223b8ecd12c3a7bbebf254e7 100644 (file)
@@ -1,4 +1,3 @@
 prereq: test -e reserve_sysstat_addr
 prog: reserve_sysstat_addr
 vgopts: -q
-cleanup: rm -f core
index e907920471032a5768fe39e18ae1d8a9b3e41276..32b0439af297bf70412643f7b0fe1a58a95744f9 100644 (file)
@@ -11,4 +11,5 @@ Valgrind has to exit now.  Sorry.  Bye!
 
 
 sched status:
-  running_tid=0
+  scheduler not yet initialised
+
index 012b290064bc5efeac5ada3aa51eb883bbdd3422..e48b2788670e9d54e0cf53ef8a78b9fad2b59e40 100644 (file)
@@ -1,4 +1,3 @@
 prereq: test -e reserve_sysstat_zone_addr
 prog: reserve_sysstat_zone_addr
 vgopts: -q
-cleanup: rm -f core