I need to stop at breakpoint in case when other breakpoint was passed. Is it possible realize in VC++?
Why did you debug your two breakpoint using this way? If the debugging runs to the specific code line, it would call the conditional, and then trigger the conditional breakpoint, if it just runs to A code line, I don't think it could call the conditional in B code line unless it really calls/runs to this line.
I do c#, and I know JetBrains Rider has exactly the feature you want. Called Dependent breakpoints. So I guess their c++ IDE CLion also has the feature.
In Visual Studio, you can manually do this. Set up the two breakpoints, disable B first. Run the code, after A got hit and the execution suspends, then enable B, press continue.
Related
I often find myself in a situation where I wish to break on several breakpoints in a run, but only for a while until I have seen enough on on those breakpoints and would like the Visual Studio to stop breaking on the breakpoints for the remainder of the current debug session.
I certainly do not want to delete all breakpoints because later I may change something in database or the code, and would like to perform a new, similar run to the one described above again.
I do not want to disable all breakpoints, since I want them to be activated again at the next debug run. At the same time I already have breakpoints, both active and disabled, in other parts of the code (which I am not currently interested in for instance) but I do not want to disable them and then try to remember later which I need for debugging a specific area/functionality of the code.
What I want is simply to be able to tell Visual Studio that "from now on as I resume execution, please ignore all breakpoints for the remainder of this debugging session. Thank you very much!"
So for the next debug run, all breakpoints should be hit again as they already were configured before as usual, but I mean at some point when I have seen enough I just want to continue execution without breaking. and without changing the status to "disabled" for all breakpoints - because doing so will make them stay disabled even at the next run, and I do not want to "Enable all" because I already had some breakpoints on my list which were disabled. And I certainly do not want to manually select/deselect breakpoints before every run just because I chose "Disable all" during a run.
Is this possible to and, in that case, how to do it?
Thanks!
I'm using VS2017 but hopefully the options are similar in VS2013:
Go to the Debug menu, then Windows > Breakpoints to open the Breakpoints window.
From here, the blue curvy arrows in the toolbar allow you to Export and Import breakpoints into an XML file.
So you could export all of your breakpoints, then delete them all. Later you can re-import them instead of having to set them all up again manually.
I am using the Visual Micro extension for Microsoft Visual Studio, which allows me to debug my Arduino project (in opposed to the Sketch IDE).
For some strange reason, when no breakpoints are present, it automatically adds a breakpoint at the beginning of the loop function.
When running via the debugger, I can simply remove it and continue running.
However, I cannot do the same when running without a debugger (i.e., upon power-up), since breakpoints seem to be "embedded" into the code as additional code segments (though I'm not really sure how explain the fact that the debugger allows me to remove a breakpoint).
Here is an illustration of the problem:
Now, I've been able to work-around it by adding a piece of "dead code" with a breakpoint:
if (0)
{
// insert a breakpoint here
}
But this feels kinda "clumsy".
I suppose that if there is a solution to this problem, then it lies somewhere in here:
But I have not able to find it, so any help will be highly appreciated.
Found the answer!
It turns out that all I needed was to hover on top of the breakpoint and read the tooltip carefully:
As you can read on the bottom line of this tooltip, in order to switch off that automatically-generated breakpoint, we only need to disable the Visual Micro's Tutorial Mode:
And voilĂ - we're all done!
How can I find out which line will be executed after performing any action?
If I know what will be executed I can put break point there. But what if I am not sure where to set breakpoint or just I need to go to the executing line faster (without setting breakpoints).
"Break All" is not what I look for. It is pausing debugging, so I cannot perform any action (just after which I want Visual Studio sets breakpoint automatically)
In other words, for example I want to start debugging each line after clicking a button, without putting breakpoints. Is it possibile?
For a .NET application you can use my Runtime Flow tool (30-day trial) to see code that is executed after some action.
Set a breakpoint at the line you want to stop after. Then once the breakpoint is hit Step Into or press F11 in Visual Studio. This takes you to the very next line of code that executes, no matter where it is in the project.
Is there a Visual Studio macro (either for version 2008 or 2010) to set a breakpoint on the start of every method in a class?
I've seen hints of references, but I've not been able to dig an actual one out.
A Visual Studio extension named OzCode does have a feature to set/unset breakpoints on all members of a class. I use this extension a lot, as it has some very nice debugging enhancements.
Admittedly though, I haven't used the set/unset breakpoint feature much, but it's an option for you.
There are some good ideas here:
How to put breakpoint in every function of .cpp file?
Wouldn't you be better off just single-stepping through your source code?
I can't imagine why a breakpoint at the start of every method would be any better than single-stepping. You're going to end up breaking everywhere anyway, and single-stepping provides the additional advantage of showing you the logical flow of your code paths.
You'll probably definitely want to learn the keyboard shortcut keys, but they can depend on how you have your VS environment set up. Look in your "Debug" menu for the "Step Over" and "Step Into" items. (Normally, Step Over is F10 and Step Into is F11.) The only difference is that, if the currently highlighted line contains a function call, Step Into will allow you to single-step through the code in the called function (this is probably most like what you want to do), while Step Over will simply call the function and stop on the next line in the current function.
In VS2010, I set a break point (from the left gutter of the editor) on a line of code. After I removed the break point, the debugger always breaks on that line of code. After starting visual studio, the debugger still breaks at the point.
Thanks in advance!
Are you removing the breakpoint while the program is running? I find that VS 2008 (and 2010) only disables the breakpoint then, but re-enable it on the next program invocation. If so, try removing it while the program is not running. Otherwise I have no idea.
use control+shift+f9 or goto your Debug menu and delete all breakpoints. It might be some weird bug..
Is there a debugbreak statement in there or an asm int 3 call?