Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Break on thread creation in Visual Studio debugger

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?)

like image 400
pauldoo Avatar asked Sep 29 '10 10:09

pauldoo


People also ask

How do you Debug a break point?

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.

How do I stop a thread in Visual Studio?

Select a thread. Right-click the thread. Select "Kill thread" from the context menu.

How do I skip a line while debugging in Visual Studio?

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.


1 Answers

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 :)

like image 181
Min Avatar answered Nov 01 '22 11:11

Min