From: Philippe Waroquiers Date: Thu, 14 May 2015 21:05:49 +0000 (+0000) Subject: Add the lwpid in the scheduler status information X-Git-Tag: svn/VALGRIND_3_11_0~391 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9e5ae6e8dbbb2bd1e53e4b9a23b4ad8fe59d4090;p=thirdparty%2Fvalgrind.git Add the lwpid in the scheduler status information 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 --- diff --git a/coregrind/m_libcassert.c b/coregrind/m_libcassert.c index 5d3a07b37e..566dd8496d 100644 --- a/coregrind/m_libcassert.c +++ b/coregrind/m_libcassert.c @@ -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");