Eclipse - Run expression at point in code?

Is it possible for Eclipse to execute arbitrary expression at a specific point in the code when debugging?

The function Execute / Display allows you to run arbitrary code in the context of debugging. A breakpoint stops the thread.

What I would like is that something like a breakpoint that can be inserted at a specific point in the class does not stop the application flow, but instead executes a piece of code.

In the background, I am trying to debug multithreaded code that I cannot edit, and I want to make a naive System.out.println to see when different things happen. If I use breakpoints, the event flow will be disrupted.

+4
source share
2 answers

Yeah! There is an undocumented function whereby conditional breakpoints can execute other code called "Printpoints" .

enter image description here

+7
source

You can use the breakpoint properties of the breakpoint to add code. Check the box "Conditional" in the dialog box and place your code there.

+3
source

Source: https://habr.com/ru/post/1502549/


All Articles