1

I want to get a better idea how a program I have operates, and rather than print the code out and try to see which method calls which method, it'd be easier to just run a debugger that steps through every line.

But manually putting a breakpoint on every line seems a bit laborious.

Is there any option to step through every line of the program as it runs(without manually putting in all the breakpoints)?

So that I could then see, ah MainActivity launches and runs onCreate and I could see it running through the code of onCreate how it then goes to a fragment class's onCreateView method.. and so on.. I want to see who is calling who as it happens and step through.

barlop
  • 12,887
  • 8
  • 80
  • 109

1 Answers1

3

You don't need to add breakpoints on each line. Just add a breakpoint to the entry point of your application and then simply use the step-in and step-out buttons of the debugger to execute the code line by line.

In order to prevent the debugger from stepping through the code that wasn't written by you, go to File > Settings > Debugger > Stepping and then on the right, click the plus icon with the question mark that says Add Pattern to add the following patterns:

android.*
dalvik.* 
com.android.*
Cihan Tek
  • 5,349
  • 3
  • 22
  • 29
  • the leading me through code I didn't write is awful! – barlop Feb 16 '15 at 00:48
  • looks like there is a way http://stackoverflow.com/questions/19486163/android-studio-how-to-debug-through-my-code-only/19573830#19573830 you can add patterns for classes that the debugger should ignore. – barlop Feb 16 '15 at 01:11
  • 1
    There may be other patterns but you find out that there are others when you run it and find it going through classes from package blah.bleh.a.b.c, then you know what pattern to add. – barlop Feb 16 '15 at 03:20