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...
Not a windows user, but the same applies to gdb. What is your proposal? If you're currently debugging a thread, breakpoints are disabled for other threads? That really doesn't seem like what people would expect by default.
C++ Just My Code Stepping in Visual Studio
31–40 of 42 posts
Re: C++ Just My Code Stepping in Visual Studio
#32Great. 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...
It's definitely possible to implement, but not as easy as using a regular INT 3 instruction.
Re: C++ Just My Code Stepping in Visual Studio
#33Earlier quoted context omitted.
Not a windows user, but the same applies to gdb. What is your proposal? If you're currently debugging a thread, breakpoints are disabled for other threads? That really doesn't seem like what people would expect by default.
It’s a UX issue, not a behavior issue, I think. What I would do is... after the user presses the “step” button, until the user presses the “continue normally” (or whatever the free run button that ends the debugger is in VS), if breakpoints are encountered in other threads, they are quietly opened in new tabs, places under the current debugger tab. Maybe flash the tab a bit to let the user know this has happened. I d…
I think the tab flashing is the critical detail, otherwise you would be confused why things are deadlocking.
Re: C++ Just My Code Stepping in Visual Studio
#34Great. 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...
Not a windows user, but the same applies to gdb. What is your proposal? If you're currently debugging a thread, breakpoints are disabled for other threads? That really doesn't seem like what people would expect by default.
(gdb) help set scheduler-locking
Set mode for locking scheduler during execution.
off == no locking (threads may preempt at any time)
on == full locking (no thread except the current thread may run)
step == scheduler locked during every single-step operation.
In this mode, no other thread may run during a step command.
Other threads may run while stepping over a function call ('next').Re: C++ Just My Code Stepping in Visual Studio
#35Re: C++ Just My Code Stepping in Visual Studio
#36Why does this require a special compiler switch? Can't the IDE just auto-step until it gets back to your own file of code?
Re: C++ Just My Code Stepping in Visual Studio
#37Earlier quoted context omitted.
Not a windows user, but the same applies to gdb. What is your proposal? If you're currently debugging a thread, breakpoints are disabled for other threads? That really doesn't seem like what people would expect by default.
GDB can do that already. (gdb) help set scheduler-locking Set mode for locking scheduler during execution. off == no locking (threads may preempt at any time) on == full locking (no thread except the current thread may run) step == scheduler locked during every single-step operation. In this mode, no other thread may run during a step command. Other threads may run while stepping over a function call ('next').
Re: C++ Just My Code Stepping in Visual Studio
#38Earlier quoted context omitted.
GDB can do that already. (gdb) help set scheduler-locking Set mode for locking scheduler during execution. off == no locking (threads may preempt at any time) on == full locking (no thread except the current thread may run) step == scheduler locked during every single-step operation. In this mode, no other thread may run during a step command. Other threads may run while stepping over a function call ('next').
GDB has all sorts of super powers but is there a GUI that works well with GDB?
Re: C++ Just My Code Stepping in Visual Studio
#39Earlier quoted context omitted.
Not a windows user, but the same applies to gdb. What is your proposal? If you're currently debugging a thread, breakpoints are disabled for other threads? That really doesn't seem like what people would expect by default.
GDB can do that already. (gdb) help set scheduler-locking Set mode for locking scheduler during execution. off == no locking (threads may preempt at any time) on == full locking (no thread except the current thread may run) step == scheduler locked during every single-step operation. In this mode, no other thread may run during a step command. Other threads may run while stepping over a function call ('next').
Re: C++ Just My Code Stepping in Visual Studio
#40Great. 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…