Unable to use F5 to step into function while debugging on Eclipse
android, debugging, eclipse, multithreading, step-into
Solution
You can't control the execution pattern of threads as they don't run in sequence, but debugger does.
I have faced similar issues with threads and async operations that run in the background.
How I manage it:
- What I do is run the same code without thread and after confirmation I put that in thread
- Use `android.os.Debug.waitForDebugger();` in your thread. It will automatically bring you there and force the debugger to halt here. There onwards you can carry on with your debugguing.
Precautions
Don't forget to comment this line before launching the application, otherwise it will result in endless waiting as it will go to debug mode in real device also.
Moreover its not the fault of Eclipse, it's purely because of nature of threading as it starts getting executed in its own environment. Visual Studio behaves the same with threads.
Problem
Sometimes (about 50% of the times) , while debugging an Android app, in order to step into a function , I use F5 (F6 is for going over it) yet it doesn't do anything Sometimes, none of the regular debugging keys work (F5,F6,F7,F8, maybe other that i don't know about too). Currently, the only way to overcome this is to choose the current thread from the "Debug" view (that shows the current stack of each thread) and then press on F5 . When the situation is even worse (unable to use the content assist, for example), I restart eclipse. Speaking of threads, I've noticed that if I have multiple threads running, sometimes when I try to go further, it goes to another thread and this is annoying as I lose the concentration I had on the current thread. I know it does make some sense, but it's really annoying especially if I've taken into account that there are multiple threads. Why do those things occur, and how can I fix them? Note: I have the latest version of both Eclipse, ADT and the Android SDK . the problem occurs on both devices and emulators.