Compile a list of current locals usable for insertion into a JTree. Recursively resolves object references. @param t the suspended thread to get locals for @param depth how deep to resolve nested object references. 0 will not resolve nested objects. @return the list of current locals
(ThreadReference t, int depth)
| 974 | * @return the list of current locals |
| 975 | */ |
| 976 | protected List<VariableNode> getLocals(ThreadReference t, int depth) { |
| 977 | //System.out.println("getting locals"); |
| 978 | List<VariableNode> vars = new ArrayList<>(); |
| 979 | try { |
| 980 | if (t.frameCount() > 0) { |
| 981 | StackFrame sf = t.frame(0); |
| 982 | for (LocalVariable lv : sf.visibleVariables()) { |
| 983 | //System.out.println("local var: " + lv.name()); |
| 984 | Value val = sf.getValue(lv); |
| 985 | VariableNode var = new LocalVariableNode(lv.name(), lv.typeName(), val, lv, sf); |
| 986 | if (depth > 0) { |
| 987 | var.addChildren(getFields(val, depth - 1, true)); |
| 988 | } |
| 989 | vars.add(var); |
| 990 | } |
| 991 | } |
| 992 | } catch (IncompatibleThreadStateException ex) { |
| 993 | logitse(ex); |
| 994 | } catch (AbsentInformationException ex) { |
| 995 | loge("local variable information not available", ex); |
| 996 | } |
| 997 | return vars; |
| 998 | } |
| 999 | |
| 1000 | |
| 1001 | /** |
no test coverage detected