2

One of my programs is stopping at some position (no exception, also seems not to be crashed), but I don't know that position. Instead of setting up a breakpoint (which means you already need to know the position where something happens), is it possible to get an information which code line was executed as last (=before now)? I am using Eclipse, is this maybe somehow possible in the debug view?

Think of something like step-by-step code execution, except that I don't want to click step-by-step a million times, instead Eclipse or some other tool shall do that for me.

Thanks for any hint on this!

2
  • You may also consider taking a thread dump when you program seems to stop/hang - that might help you a bit as well. Commented Apr 16, 2013 at 21:25
  • Do you mean the jstack tool? I tried that, but it didn't show the exception that was thrown in another thread? Commented Apr 16, 2013 at 21:45

3 Answers 3

1

enter image description here

I faced the same problem. There is a "suspend" button (two vertical yellow bars - see top-right of image) on the right of the green arrow/triangle which will stop you in the debugger. You may need to look carefully at the debug stack until you recognize part of your code.

It was very useful for me - I was in a catastrophic backtrack in a regex (which could take years to terminate!) and I would never have guessed this.

[If you don't have any breakpoints you will need to start in debugger perspective to see the button.]

Sign up to request clarification or add additional context in comments.

1 Comment

While Jim was the first who replied, I liked the detailed answer. Of course, thanks to all of you!
0

In Eclipse, if you click the "suspend" button in the debug UI you can pause a thread or the entire VM. You are probably hung behind a wait of some kind and may have to walk down the stack trace to find the line in your code that invokes the service that is waiting.

Comments

0

As others have said, Eclipse has the Suspend button.

But the good old fashioned way is to add a load of System.out.println("No problem so far at line 'x' " ) statements and track the bug down by hand.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.