views:

13

answers:

2

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: http://stackoverflow.com/questions/3048064/can-i-set-a-breakpoint-in-visual-studio-c-to-break-on-a-thread-context-switch)

+1  A: 

Yes, the debugger gets a notification for it. No, the UI doesn't allow you to tell it to break on that notification. If this is for managed code then you could use the MDbg sample and modify it.

Hans Passant
A: 

You can set a breakpoint at the first call to CreateThread (maybe you insert a fake call for this purpose). When hit, change from Source Code View to Disassemly View and step into the call. Go through the ImportLib-Code and set a breakpoint. Not perfect, but it works.

ur