Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Infinite loop, how to know in Eclipse what code is running now? [closed]

I am using eclipse to run some android/java code in my device. Sometimes the code seems to be stuck in a loop. And sometimes it works. I was wondering, is there a way in eclipse where I can tell it to show my what is the current running? Or even last method called? I want to know where this "code stuck" is so I can fix it. Stepping in won't help as I need the code to run without stoppage for this to reproduce

Please help

like image 633
Snake Avatar asked Jan 31 '13 07:01

Snake


2 Answers

Run the app with eclipse debugger connected. When it got stuck click the suspend ("pause") button. Maybe you have to do some single-steps to jump out of some lib call and get to your code. In debug perspective you can see the call trace which tells you the function you're in.

like image 188
bidifx Avatar answered Nov 13 '22 20:11

bidifx


If you don't want or can't run the application in debug mode, you can use Java VisualVM, a tool that can be found at the bin folder of your installed JDK under the name jvisualvm.exe.

It provides you a way to see all the running threads, the methods that were called, and, on a case of a deadlock, it can help you to find out where it happens.

I never used this tool to monitor an application on other machine or even other device, but, I know that under "File" menu there is an option called "Add Remote Host...". Maybe, you can monitor you application from there.

like image 40
Jose Renato Avatar answered Nov 13 '22 22:11

Jose Renato