I want jdb (which I'm using via the Eclipse debugger) to break when a variable is assigned some value. I'm not interested in setting a breakpoint at some specific line but rather more generally.
For example, break every time x == null.
Is such a thing achievable?
To set a breakpoint in source code, click in the far left margin next to a line of code. You can also select the line and press F9, select Debug > Toggle Breakpoint, or right-click and select Breakpoint > Insert breakpoint. The breakpoint appears as a red dot in the left margin.
First, set a breakpoint at a given location. Then, use the context menu on the breakpoint in the left editor margin or in the Breakpoints view in the Debug perspective, and select the breakpoint’s properties. In the dialog box, check Enable Condition, and enter an arbitrary Java condition, such as list.
Simply execute the DebugView program file (dbgview.exe) and DebugView will immediately start capturing debug output. Note that if you run DebugView on Windows 2000/XP you must have administrative privilege to view kernel-mode debug output.
Yes - What you need to setup is a 'Conditional Breakpoint' - this gives you the ability to stop the program execution and step through the debugger when a certain state of the application is reached.
So, let's say you want to jump into a particular point in the execution when a certain condition is fulfilled (as per the image attached), you can do this as follows:
Open your debugger perspective and select the 'BreakPoints' tab
Add a new BreakPoint in the code file - at the appropriate place where you would like to observe the program execution
Then go back to the 'Breakpoints' tab, right-click on the newly added entry, and select 'Breakpoint Properties'
Set the condition upon which it should be activated
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With