Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I step back to previous breakpoint while debugging in Android Studio? (Drop the frames)

Tags:

I would like to be able to execute previous breakpoint that I've just stepped over

I know Android Studio is based on Intellij Idea where it's possible link here. Similar question asking the same but its related to Eclipse IDE link here

There is also one answer that say's it's impossible. link here

I can see "Drop Frame" button. But it's disabled by default. enter image description here

So is there any way to enable this button?

like image 781
Phate P Avatar asked Sep 25 '17 11:09

Phate P


People also ask

Can we go back while debugging?

So, if you've just taken a step in live debugging (F10 or F11), you can use the Step Backward button to quickly navigate to the previous step. This will automatically put Visual Studio in Historical debugging mode, at the line of code you've stepped back to.

What happens when a breakpoint is reached when the debugger is enabled?

If a breakpoint is reached, or a signal not related to stepping occurs before count steps, stepping stops right away. Continue to the next source line in the current (innermost) stack frame. This is similar to step , but function calls that appear within the line of code are executed without stopping.

How do I Stepback in Visual Studio debugging?

The data you see is from the snapshot of the application's process taken at that point in time. So, for example, if you've hit a breakpoint and taken a Step (F10), the Step Backward button puts Visual Studio in historical mode at the line of code corresponding to the breakpoint.

How do breakpoints work in debugging?

They work by patching the code you are trying to execute with an instruction that triggers a debug event in some fashion. This is accomplished by injecting a breakpoint instruction or when that is not supported by inserting an instruction that causes a fault that halts the core.


2 Answers

The answer you are referring to regarding Eclipse is still valid for Android Studio:

You cannot step back to previous breakpoint in Android Studio because DalvikVM and Android Runtime (ART) do not support it.

You can enable the "Drop Frame" button if you debug JUnit tests as they run on a standard virtual machine (although I'm guessing this is not what you are after).

It is probably the only reason why the button exists.

Google's User Guide ignores it completely.

like image 107
Maciej Beimcik Avatar answered Sep 21 '22 21:09

Maciej Beimcik


I'm fairly new to Android Studio, so I'm not entirely sure if this is what you are looking for, but have you tried playing around with the Frames window?

enter image description here

It allows you to backtrack the app's process, even reaching old breakpoints.

like image 45
Tobias Ettrup Mølbak Avatar answered Sep 21 '22 21:09

Tobias Ettrup Mølbak