]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Add the lwpid in the scheduler status information
authorPhilippe Waroquiers <philippe.waroquiers@skynet.be>
Thu, 14 May 2015 21:05:49 +0000 (21:05 +0000)
committerPhilippe Waroquiers <philippe.waroquiers@skynet.be>
Thu, 14 May 2015 21:05:49 +0000 (21:05 +0000)
E.g. we now have:
Thread 1: status = VgTs_Runnable (lwpid 15782)
==15782==    at 0x8048EB5: main (sleepers.c:188)
client stack range: [0xBE836000 0xBE839FFF] client SP: 0xBE838F80
valgrind stack top usage: 10264 of 1048576

Thread 2: status = VgTs_WaitSys (lwpid 15828)
==15782==    at 0x2E9451: ??? (syscall-template.S:82)
==15782==    by 0x8048AD3: sleeper_or_burner (sleepers.c:84)
==15782==    by 0x39B924: start_thread (pthread_create.c:297)
==15782==    by 0x2F107D: clone (clone.S:130)
client stack range: [0x442F000 0x4E2EFFF] client SP: 0x4E2E338
valgrind stack top usage: 2288 of 1048576

This allows to attach with GDB to the good lwpid in case
you want to examine the valgrind state rather than the guest state.

(it is needed to attach to the specific lwpid as valgrind is not
linked with lib pthread, so GDB cannot discover the threads
of the process).

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

coregrind/m_libcassert.c

index 5d3a07b37e050dd8b1cf147e7f4ba86021fa1dbf..566dd8496d854e332429b5377a880cb06fd636c0 100644 (file)
@@ -369,8 +369,9 @@ static void show_sched_status_wrk ( Bool host_stacktrace,
          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\n", i, 
-                  VG_(name_of_ThreadStatus)(VG_(threads)[i].status) );
+      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 ) {
@@ -388,8 +389,8 @@ static void show_sched_status_wrk ( Bool host_stacktrace,
       if (stack_usage && stack != 0)
           VG_(printf)("valgrind stack top usage: %ld of %ld\n",
                       VG_(clo_valgrind_stacksize)
-                      - VG_(am_get_VgStack_unused_szB)(stack,
-                                                       VG_(clo_valgrind_stacksize)),
+                        - VG_(am_get_VgStack_unused_szB)
+                               (stack, VG_(clo_valgrind_stacksize)),
                       (SizeT) VG_(clo_valgrind_stacksize));
    }
    VG_(printf)("\n");