|
Re: Debugging vs setting a breakfront and running a program [message #1799336 is a reply to message #1799332] |
Wed, 05 December 2018 05:27 |
Ed Merks Messages: 33140 Registered: July 2009 |
Senior Member |
|
|
I'm not sure which language your using, Java I'll assume. If you simply run the application, it won't stop at breakpoints. Breakpoints only work when debugging the application. Then when it hits the breakpoint you'll be asked if you want to turn to the Debug perspective; at least that's what it does by default. Here you can see in the Debug view your running application and all its threads. You can click any stack frame and in the Variables view to see the values of all the variables that are in scope in order to inspect the state. The debugger is your best friend. You should learn everything that it can do for you. For example, in the Breakpoints view's view toolbar you can "Add Exception Breakpoint", i.e., the little J! icon. Then you can have your application stop whenever an exception of the specific type is thrown; that makes it easy for example to track down NullPointerExceptions. And of course the toolbar in the Debug perspective has buttons for continue, step over, and step into so you can walk through the logic. Also very useful is the Drop To Frame button; this lets you "restart" a method back to its start, in case you've stepped past the logic you want to inspect. Also, the debugger supports hot replace, i.e., you can modify a method and when you save, the running process is updated to use that new logic, making it easier to fix problems on the fly without relaunching the whole application. Note too that breakpoints can have conditions on them, so that your application will only stop at the breakpoint when the condition expression evaluates to true; very useful when your breakpoint will be hit a thousand times but your only interested in one particular case; you can even use breakpoint conditions to add print statements "System.out.println(x); return false;" to do logging. As I said, the debugger is really your best friend.
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Powered by
FUDForum. Page generated in 0.08110 seconds