Usually, this works, but in addition to my own code there a lot of machine code too, which doesn't really help me out with debugging my own program logic.
Is there a way to step through only my own code?
First put a breakpoint where you want to start step over.After the breakpoint ,Use this button to step over through the code.The play button just runs till the next breakpoint
You probably want to be using the next command or "step over" button in the debugger UI instead of step or "step into" to avoid stepping into each function as you debug. You might still want to step into your own functions, of course, but next will let you step over framework functions instead of diving into their assembly.
Related
Currently i'm on a project which has some main loop which is quite slow. Putting a breakpoint into it implicates i have to press F9 each time, and there are a lot of iterations. What i imagine is to see the program 'move' on one of my screens, without wondering if it is stuck or not.
I already have log outputs and so on, my question really focuses on this 'show debug without stop' feature.
What i imagine is to see in this main loop the current line highlighted as i it was a line-by-line execution, but without breakpoints and without going down in the subcalls.
Does any of you know a way to do something like this or wish the same thing ?
Thanks !
Your Debug tool window has a "Mute breakpoints" control:
If you leave it ON, your application won't stop at breakpoints. You can switch it off later once you reach the point where you actually want to start debugging (e.g. mute breakpoints while the app is doing all the initial loading tasks, while you navigate to the screen you want to debug etc. and then unmute them).
I'm not quite sure this is it but , how about disabling focus on breakpoint:
Put your cursor on the line you'd like to breakpoint and hit ctrl-shift-f8 (on a pc). You can choose not to suspend when a breakpoint is hit, and/or you can add logging that the breakpoint was triggered. If you need to, you can add a condition that must be met before the breakpoint is triggered.
Here's what this looks like for me:
I want to use the option of "step into" in the debugger. But, I want that the debugger enters only function that are implemented in specific files. For other functions, "step into" will behave like "Step Over".
You can use the debuggers stepping configuration to define where you want the debugger to stop and where not.
Or you can put a breakpoint to a start point from where you want to examine the behavior of your code and then put breakpoints in your specific files/implementations.
Furthermore, it would be very helpful if you describe your problem in more detail.
I am curious how to execute previous line of code while debugging?
Currently, I see the following buttons:
- Step over;
- Step into;
- Force step into;
- Step out;
but no button "Step previous".
By default, you cannot advance backwards while debugging code. Since code runs are temporal, one should be able to re-run the code that they're debugging to narrow in on what specifically they want to observe in the debugger.
However, if you really want to be able to debug and step backwards, then the Chronon plugin is a viable option. Note that you won't be dropped into a debug context immediately, and you won't be able to access any live evaluation, but this will allow you to debug your code by stepping forwards and backwards.
You could Drop Frame - it will return you to a previous method, so you can step on that line again. See When using the Java debugger in Intellij what does "Drop Frame" mean?
Every so often, when I'm debugging and stepping through a thread, Xcode pulls me into another thread (that I'm guessing is executing all the other stuff involved in setting up views etc.). the problem is that this doesn't help me, as I just want to observe the code I've written myself.
Is there any way to prevent this?
If you use "step over" you normally won't see this view, I only ever see it when I do "step into" on lines with a compound statement.
What you are seeing is not your code, but the debugger working through code it doesn't have the source to (e.g. UIKit stuff). If you hit "step out" or "step over" in this view, you will return to your code.
Is it possible to set a starting point for the debugger so that every debugging session
will start immediately from that point (instead of starting from the beginning of the code)?
Or to express it differently:
Isn't it possible to somehow store everything until the breakpoint so that next time the debugger could just instantly resume to that specific breakpoint (instead of starting from the beginning of the code and pausing at the breakpoint)?. Is there any debugger that can do this?
I am using Microsoft Visual Studio Express 2012.
Thank you.
Use a Debugger in visual studio.
In your code, click on the line number, you will see a dot on the line.
When you run the program, it will 'pause' at the line you specify, you can then walk through your program line by line from there
You can use a breakpoint at a line that you want to inspect.
You have a description how to do it here.
You could attach a debugger to a running process, but i'm afraid that it will be on a random place of execution. You could make a wait for a key or button press in your code and attach to your program before continuing.
No. It would have to run the code up to the point you want to get all the variables etc in the right state. If you just set a breakpoint where you're interested from and hit F5 it should get there quickly enough.
If it doesn't get there quickly enough, jot down the variables used and make some unit tests round the troublesome functions instead. That will skip the 10 minutes.