Reputation: 23372
Is there a way to put a breakpoint on every line in Eclipse?
The reason I ask is because I am analyzing a proxy program written in Java, which waits and listens for connections. I'm trying to follow how it works, but I can't figure out where the code starts from when a connection arrives.
How can I trigger a breakpoint no matter where the code starts from, in other words, breakpoint every line?
Upvotes: 12
Views: 9134
Reputation: 9581
From StackOverFlow site reference
I don't think you can select a class for debugging but you could go to the Outline view
in eclipse, select all the methods in the class, right click and select Toggle Method Breakpoint
How to set a breakpoint on a Class NOT a Line in Eclipse?
Upvotes: 1
Reputation: 1115
Breakpoint in every line is not possible... Put the breakpoint where you want in your code or else do it manually.. Then degug your application; it will stop on the breakpoint line;
Upvotes: 0
Reputation: 88757
IMHO a breakpoint in every line would be overkill so I'd put a breakpoint at a line that I know is passed and then walk up the call stack to get the entry point, i.e. use the "Debug" view where the threads and the current stack are listed.
Once you found that entry point you could set a breakpoint there and then step through the code using the normal debugger commands like "step into", "step over" etc.
Btw, AFAIK setting a breakpoint in every line with a few actions is not even possible in eclipse, because it wouldn't make much sense. There might be a way by creating a .bkpt file for every line in the code and import those, but I neither don't know how you would create such a file nor do I think that Eclipse would be able to handle such a potenially huge amount of breakpoint.
Upvotes: 0
Reputation: 41271
I can't think of a reason you'd want a breakpoint on every line. It would be equivalent to simply putting a breakpoint at the first line of main()
, then stepping through your program with step into
-- not something a sane person would normally want to do with a large program.
I would suggest:
If you like, you can now connect to your proxy with a client, and use the debug step controls to watch how the code handles it. One problem with this is that things time out while you're looking at steps, so it can be useful to set longer timeouts where possible.
Upvotes: 9
Reputation: 67
The yellow arrow that " hits " between two black dots , imagine that our program has the breakpoint on a line on which a call is made to a method and has stopped there. By pressing this button, the debugger will get inside the method and stop at the first line of the same , so we can debug inside the method . For example, where the breakpoint is shown in the following figure.
Pressing the button marked in red , the debugger will get inside the echaCuentas ( ) method and stop at the first line of that method. The next button , a yellow arrow jumping over a black point , goes a step program execution , but without getting into the method that you find. For example , in the previous figure , if push this button , the execution would pass line System.out.println ( ) , without stopping within echaCuentas ( ) method .
Finally , the last button is an arrow from between two black dots , advances the program until we got out of the current method and go to the place where it has been called .
Upvotes: 0
Reputation: 741
I don't know if you can add a breakpoint for each row at a time. However, you can debug row by row by clicking "Debug as" then using the following commands : [F6] "Step Over" and [F5] "Step Into".
Upvotes: 5