Can I set the Visual Studio debugger to break on thread creation?
(Note this is not the same as breaking on context switch as asked for in this other question: Can I set a breakpoint in Visual Studio (c++) to break on a thread context switch?)
To set a breakpoint in source code: Click in the far left margin next to a line of code. You can also select the line and press F9, select Debug > Toggle Breakpoint, or right-click and select Breakpoint > Insert breakpoint. The breakpoint appears as a red dot in the left margin.
Select a thread. Right-click the thread. Select "Kill thread" from the context menu.
You can also click on the line you want to skip to and hit Ctrl+F10 (Run to Cursor). It will jump directly to that line.
I've found a way to do it. While googling I saw the opposite question: Is it possible to break on thread exit with specific error code?
I put a breakpoint at the function RtlExitUserThread
, after that I realized that all threads was creating with the function RtlUserThreadStart
, so put another breakpoint to that function and that's all :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With