Question

I am debugging some Java code and came into a situation where I reached a method declared for simplicity sake as: Method1(Var1 var1, Var2, var2).

I am certain that the previous class I was in that called this method passed in no arguments and am struggling to find where these parameters are being created and passed from.

Is there a short-cut or way in eclipse for me to go to where an argument is passed from when debugging? I have gone over all the cheat sheets but cannot seem to find anything that does this.

The thing I want to be able to find is the values being assigned to the fields in var1 and var2.

Was it helpful?

Solution

In the Debug perspective there is a Debug view which, when you've stopped on a breakpoint, will display the current execution stack. You can select different levels in that list to see program state at each of the points in time represented by the stack. To answer your specific question, you can navigate up the stack to see how each of the arguments passed to your method were provided: as a variable, constant, evaluated expression or result of another method call. From there you can use the references search to see where variables may have been set.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top