0

I want to view the lifecycle of a variable throughout my program all at once. I do not want to stop the program with breakpoints. I just want to view the progression of the variable from start to finish all at once.

In general, how can I do this with the Eclipse debugger tool and without hard coding System.out.println(variable); somewhere in the program? Is there a proper way to do this?

1 Answer 1

1

Likely the best you can do is to create "Tracepoints". Find a line of code where you want to print the current value of any variables in the current scope, right-click in the left margin, left of the line numbers, and select "Toggle Tracepoint". You'll see a little icon with a question mark appear on that line. Right-click on that icon and select "Breakpoint Properties". There is a text area in that dialog which is initialized to a simple print statement. Modify the print statement to include the variable(s) you want to print, or in fact any expression. When done editing your tracepoints, run your application. You'll likely want to put a recognizable string in the print statement so you can search the console output for the occurrences of your tracepoints.

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

1 Comment

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.