6 ms·
C++ Just My Code Stepping in Visual Studio
- anilgulecha 8y agoJust a clarifying note : this is the closed Visual Studio, and not free software - VS Code - which usually does the rounds on HN. I'm far more excited about the LSP protocol for C++ which would bring like this to all IDEs.
- Rusky 8y agoI don't think the LSP includes any debugging support?
- anilgulecha 8y agoI meant the sister/offshoot of LSP: https://github.com/Microsoft/vscode-debugadapter-node/tree/master/protocol https://github.com/Microsoft/vscode-debugadapter-node/tree/m... https://code.visualstudio.com/docs/extensionAPI/api-debugging https://code.visualstudio.com/docs/extensionAPI/api-debuggin...
- spoiler 8y agoI love this idea. I wonder if something similar could be ported/achieved for JavaScript!
- maddyboo 8y agoNot exactly the same, but you can use blackboxing [1] in the Chrome DevTools to isolate code you’ve written from library/framework code in the debugger. [1]: https://developer.chrome.com/devtools/docs/blackboxing https://developer.chrome.com/devtools/docs/blackboxing
- spoiler 8y agoThanks for this! I didn't realise this feature existed.
- brian_herman 8y agoI was thinking the same thing!
- dmethvin 8y agoThe Microsoft Edge browser has had this feature for two or three years, by the same name. Chrome has something similar. https://docs.microsoft.com/en-us/microsoft-edge/devtools-guide/debugger#toolbar https://docs.microsoft.com/en-us/microsoft-edge/devtools-gui...
- melling 8y agoSomeone had a useful gdb trick in a previous post: https://news.ycombinator.com/item?id=17427001 https://news.ycombinator.com/item?id=17427001 “”” with gdb 7.12 or later, you can exclude files matching a glob with "skip -gfile", e.g. "skip -gfile /usr/*" “””
- ubadair 8y agoUsing libClang and gdb: http://jefftrull.github.io/c++/gdb/python/libclang/llvm/2018/04/30/stepping-with-libclang.html http://jefftrull.github.io/c++/gdb/python/libclang/llvm/2018...
- Dinux 8y agoAs a developer spending hours a day in Visual Studio with C++ as primary language this is a major improvement in terms of development time. Debugging is a a time consuming task in any language, but library headers from STD and Boost slow down the process tremendously.
- johnboyer 8y agoAlthough it does help, I would say its only a bit faster than actually just setting a breakpoint of where you want the code to stop, and running till then, unlike Microsoft's example which shows 85 step intos, as if people actually do that.
- hhmc 8y agoIt depends on the purpose of your debugging. If you know exactly where you want to go then, as you say, this has diminished value. but debugging can often be exploratory, in which case this feature could be a real timesaver.
- Dinux 8y agoWe, for example, have lots of classes and structures that are designed to the interfaces provided by the STD containers. Mix that with actual STD containers and you can spend several hours trying to find the problem. Just My Code eliminates much of that since almost always the STD is not the cause for the problem.
- scraft 8y agoIt is funny how long this has been an issue and how I and so many people have given up stepping in and instead jump to the actual user function, set break point, and then step over at the source location, then unset the breakpoint and continue. A bunch of crazy steps which you end up doing again and again. Needless to say, this improvement is much welcomed!
- Dinux 8y agoVisual Studio even created the "Jump to here" option to do just this, but I agree this is how we all did it for a long time.
- deleted 8y ago[deleted]
- chris_wot 8y agoI would love to know the best Linux/OS X GUI debugger... and can it do this?
- neverfone 8y agoI don't know if there are any good Linux GUI debuggers, but gdb is a comprehensive debugger and can do something similar with the skip command. Any gui debugger for Linux is probably a frontend to gdb, so as long as it lets you passthrough commands to gdb it can do this.
- pjmlp 8y agoI think DDD is still one of the best ones around given the display of data structures, even if the UI could get a facelift.
- waynecochran 8y agoGreat. 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-studio-ide/suggestions/8543248-make-the-debugger-stick-to-the-current-thread-inst https://visualstudio.uservoice.com/forums/121579-visual-stud...
- maxxxxx 8y agoAgreed. That's a real nuisance.
- neverfone 8y agoNot 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.
- phendrenad2 8y agoIt’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 don’t think VS has tabs for the debugger interface, so it would need that added.
- neverfone 8y agoHmmph, I see what you're saying, that sounds like it could work. I think the tab flashing is the critical detail, otherwise you would be confused why things are deadlocking.
- jamesfmilne 8y agoGDB 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').
- Kenji 8y agoNow if only the Visual Studio C++ compiler was half as good and fast as GCC or Clang, or supported the new C++11/14/17 features properly. Frankly, it is 5-10 years behind these other compilers. Or maybe they could finally support variadic templates properly instead of doing it internally with ugly macro rewriting and limited argument numbers. That would be cool. Instead they add this feature which may have its uses but this is not something a skilled programmer who knows how to step through a program ever had a problem with.
- w_t_payne 8y agoWhy has it taken this long for something so obvious to be implemented?
- merinowool 8y agoSo that people with VS2015 would have to buy new version...
- rootlocus 8y agoI know you're sarcastic, but this was common practice at my previous shop.
- Tempest1981 8y agoWith VS2017, they've moved to a faster release cadence. Fortunely, the minor releases are actually delivering significant features, like C++17 conformance. The downside is occasional toolset compatibility issues. https://blogs.msdn.microsoft.com/vcblog/2017/11/15/side-by-side-minor-version-msvc-toolsets-in-visual-studio-2017/ https://blogs.msdn.microsoft.com/vcblog/2017/11/15/side-by-s...
- a-dub 8y agoIt would be pretty funny if they extended it to "just my uncommitted changes." ie: I want to step through every line I have written, but skip everything else...
- TylerGlaiel 8y agoWhy does this require a special compiler switch? Can't the IDE just auto-step until it gets back to your own file of code?
- deleted 8y ago[deleted]