Quick hint for today: how do you switch the thread you’re examining in Windbg? If you know the thread number you can type the command ~<thread number>s (e.g. ~21s to switch to thread 21).
But what about if you only know the ThreadID (which is an hexadecimal value)? For example if you examine the output of the !lock command:
0:000> !locks CritSec mscorwks!ThreadpoolMgr::WorkerCriticalSection+0 at 7a393800 WaiterWoken No LockCount 21 RecursionCount 1 OwningThread 26a0 EntryCount 0 ContentionCount 15 *** Locked
What thread is 26a0? Well… you can display all available threads (with the managed !sos.threads command or the native ~ [tilde] command) and then manually look for the ID, or use the following:
0:000> ~~[26a0]s eax=000057b4 ebx=00000000 ecx=79f40a2b edx=18926823 esi=000e194c edi=000006c4 eip=7c82ed54 esp=02d2fbf0 ebp=02d2fc2c iopl=0 nv up ei pl zr na pe nc cs=001b ss=0023 ds=0023 es=0023 fs=003b gs=0000 efl=00000246 ntdll!KiFastSystemCallRet: 7c82ed54 c3 ret
~~[<threadID>]s (e.g. ~~[26a0]s), and with the sample above Windbg will switch to thread 21 ?
Carlo
Quote of the day:
Knowledge is power, if you know it about the right person. – Ethel Mumford