5

As the title says: is it possible to set a breakpoint in classes with no source available? Does any debugger support this? Bonus points for being able to view the stack and local variables.

edit: Sorry for being unclear from start, but I'm not interested in method breakpoints. I want to set a breakpoint inside the method.

Alexander Torstling
  • 18,552
  • 7
  • 62
  • 74

1 Answers1

2

If you are using eclipse, you can set breakpoints on the methods in the class using the outline view.

You can set a method breakpoint using the outline view of the class in question. Then the debugger breaks at the first line of the method.(taken from How to put breakpoint in class without having it's source?)

Right click on the method in eclipse outline view and select Toggle Method Breakpoint

P.S. I have tried this and it works for me.

Community
  • 1
  • 1
anirudh
  • 4,116
  • 2
  • 20
  • 35
  • 1
    Or in jdb `stop in package.Class.method` – slim Mar 13 '14 at 07:35
  • Sorry for being unclear, but I'm not interested in method breakpoints. – Alexander Torstling Mar 13 '14 at 08:02
  • method breakpoint sets the breakpoint at the first line of the method. You could step over to get to the line you would like to debug. I'll let u know if I find a way to set breakpoints at specific lines. – anirudh Mar 13 '14 at 08:55
  • Can you step over bytecode instructions? I can't seem to do that in IntelliJ. – Alexander Torstling Mar 13 '14 at 09:18
  • Have a look at http://stackoverflow.com/questions/17979492/is-it-possible-to-set-breakpoints-at-a-specific-bytecode-instruction. I don't know whether this works, and I can't test right now, but the answer has been accepted, so it might be useful to you. – anirudh Mar 13 '14 at 09:21