Value Tracing while debugging

Viewed 28

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
}
  1. parameter: String[] x
  2. local function call: foo2( ... )
  3. array constructor: new String[] { ... }
  4. library function call: Integer.toString( ... )
  5. for loop: for(int x : ...) from variable: array
  6. array constructor: new int[]{ ... }
  7. constant: 5 (pressing continue in the debugger would show 6 then 7)
0 Answers
Related