Recently I've had to track down where a specific value in a very large program comes from. Is there a type of tool that allows you to see this easily? Essentially, you would set a breakpoint in a function, and ask the tool to show the 'value trace' for some variable, or a value in that variable.
Debugging this java snippet, and running the tool on the x variable at the breakpoint would produce information similar to the following list.
void foo1() {
int[] array = new int[]{ 5, 6, 7 };
for(int x : array) {
foo2(new String[] { Integer.toString(x) });
}
}
void foo2(String[] x) {
System.out.println(Arrays.toString(x)); // breakpoint here
}
- parameter:
String[] x - local function call:
foo2( ... ) - array constructor:
new String[] { ... } - library function call:
Integer.toString( ... ) - for loop:
for(int x : ...)from variable:array - array constructor:
new int[]{ ... } - constant:
5(pressing continue in the debugger would show6then7)