Live data from Hacker News

C++ Just My Code Stepping in Visual Studio

blogs.msdn.microsoft.com

41–42 of 42 posts

Re: C++ Just My Code Stepping in Visual Studio

#41

Earlier quoted context omitted.

The problem is that the normal implementation of a breakpoint/step is replace a single byte with a 0xCC opcode (INT 3), which will be hit by every thread. Making it lock onto a single thread would require a conditional breakpoint, checking the thread ID every time that code path is executed, which might potentially use a lot of CPU. I'm not sure that kind of conditional breakpoint has hardware support. It's definitel…

Should be doable with help from the operating system to have thread-local storage for the code segment when debugging.

That sounds like a pretty good idea, would be nice to see gdb implement something like that.

Re: C++ Just My Code Stepping in Visual Studio

#42

Great. Now if they can actually fix the debugger to lock onto a single thread when stepping thru multithreaded code. Currently when you set a breakpoint and step, you’ll be jarringly switched back to the breakpoint when another thread hits it. The solutions now are tedious : https://visualstudio.uservoice.com/forums/121579-visual-stud...

The problem is that the normal implementation of a breakpoint/step is replace a single byte with a 0xCC opcode (INT 3), which will be hit by every thread. Making it lock onto a single thread would require a conditional breakpoint, checking the thread ID every time that code path is executed, which might potentially use a lot of CPU. I'm not sure that kind of conditional breakpoint has hardware support. It's definitel…

Not sure anyone would care about that cost. Generally people are glad to waste CPU time instead of human time.
Post reply on HN