Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you set the current thread when using windbg

Analyzing a crash dump using windbag. Need to set the code to go to a current thread. I tried doing ~thread 5a0.b44 but that did not work. It gives me an error "No runnable debuggees error n in '~thread 5a0.b44'. I need to setup the dump to debug a particular thread. how do i do this?

like image 662
Developer2015 Avatar asked Sep 19 '26 09:09

Developer2015


1 Answers

You can list all threads by just ~. It will show logical thread IDs and OS thread IDs.

You can select a thread by its logical number using ~<number>s (s for select) and by its OS thread ID using ~~[<number>]s.

0:000> ~
.  0  Id: 1ee0.2270 Suspend: 1 Teb: 0000008c`1373b000 Unfrozen
   1  Id: 1ee0.2b18 Suspend: 1 Teb: 0000008c`1373d000 Unfrozen
   2  Id: 1ee0.1d44 Suspend: 1 Teb: 0000008c`1373f000 Unfrozen
   3  Id: 1ee0.1a1c Suspend: 1 Teb: 0000008c`13741000 Unfrozen
0:000> ~1s
ntdll!NtWaitForWorkViaWorkerFactory+0x14:
00007fff`32522fe4 c3              ret
0:001> ~~[1d44]s
ntdll!NtWaitForWorkViaWorkerFactory+0x14:
00007fff`32522fe4 c3              ret
0:002> *** on thread 2 now

You can't use the process ID together with the thread ID:

0:002> ~~[1ee0.1a1c]s
Syntax error at '1ee0.1a1c]s'
0:002> ~~[1ee01a1c]s
                  ^ Illegal thread error in '~~[1ee01a1c]s

If you need to switch the process, use |<number>s or |~[<number>]s:

0:003> |
.  0    id: 1ee0    examine name: C:\Windows\System32\ApproveChildRequest.exe
#  1    id: 1e9c    attach  name: C:\Program Files\paint.net\PaintDotNet.exe
0:003> |~[1e9c]s
ntdll!DbgBreakPoint:
00007fff`32523060 cc              int     3
1:026> *** on process 1 now
like image 99
Thomas Weller Avatar answered Sep 20 '26 23:09

Thomas Weller



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!