|
Lines 10-30
Link Here
|
| 10 |
*******************************************************************************/ |
10 |
*******************************************************************************/ |
| 11 |
package org.eclipse.jdt.internal.debug.core.model; |
11 |
package org.eclipse.jdt.internal.debug.core.model; |
| 12 |
|
12 |
|
| 13 |
|
13 |
|
| 14 |
import java.util.ArrayList; |
14 |
import java.util.ArrayList; |
| 15 |
import java.util.Collections; |
15 |
import java.util.Collections; |
| 16 |
import java.util.Comparator; |
16 |
import java.util.Comparator; |
| 17 |
import java.util.Iterator; |
17 |
import java.util.Iterator; |
| 18 |
import java.util.List; |
18 |
import java.util.List; |
| 19 |
|
19 |
|
|
|
20 |
import org.eclipse.core.runtime.IAdaptable; |
| 20 |
import org.eclipse.core.runtime.IStatus; |
21 |
import org.eclipse.core.runtime.IStatus; |
| 21 |
import org.eclipse.core.runtime.Status; |
22 |
import org.eclipse.core.runtime.Status; |
| 22 |
import org.eclipse.debug.core.DebugEvent; |
23 |
import org.eclipse.debug.core.DebugEvent; |
| 23 |
import org.eclipse.debug.core.DebugException; |
24 |
import org.eclipse.debug.core.DebugException; |
| 24 |
import org.eclipse.debug.core.model.IRegisterGroup; |
25 |
import org.eclipse.debug.core.model.IRegisterGroup; |
| 25 |
import org.eclipse.debug.core.model.IStackFrame; |
26 |
import org.eclipse.debug.core.model.IStackFrame; |
|
|
27 |
import org.eclipse.debug.core.model.IStep; |
| 28 |
import org.eclipse.debug.core.model.ISuspendResume; |
| 29 |
import org.eclipse.debug.core.model.ITerminate; |
| 26 |
import org.eclipse.debug.core.model.IThread; |
30 |
import org.eclipse.debug.core.model.IThread; |
| 27 |
import org.eclipse.debug.core.model.IVariable; |
31 |
import org.eclipse.debug.core.model.IVariable; |
|
|
32 |
import org.eclipse.jdi.internal.AccessibleImpl; |
| 33 |
import org.eclipse.jdi.internal.FieldImpl; |
| 34 |
import org.eclipse.jdi.internal.LocalVariableImpl; |
| 35 |
import org.eclipse.jdi.internal.MethodImpl; |
| 28 |
import org.eclipse.jdi.internal.ValueImpl; |
36 |
import org.eclipse.jdi.internal.ValueImpl; |
| 29 |
import org.eclipse.jdi.internal.VirtualMachineImpl; |
37 |
import org.eclipse.jdi.internal.VirtualMachineImpl; |
| 30 |
import org.eclipse.jdt.core.Signature; |
38 |
import org.eclipse.jdt.core.Signature; |
|
Lines 53-58
Link Here
|
| 53 |
import com.sun.jdi.ReferenceType; |
61 |
import com.sun.jdi.ReferenceType; |
| 54 |
import com.sun.jdi.StackFrame; |
62 |
import com.sun.jdi.StackFrame; |
| 55 |
import com.sun.jdi.Type; |
63 |
import com.sun.jdi.Type; |
|
|
64 |
import com.sun.jdi.Value; |
| 56 |
import com.sun.jdi.VirtualMachine; |
65 |
import com.sun.jdi.VirtualMachine; |
| 57 |
|
66 |
|
| 58 |
/** |
67 |
/** |
|
Lines 61-66
Link Here
|
| 61 |
|
70 |
|
| 62 |
public class JDIStackFrame extends JDIDebugElement implements IJavaStackFrame { |
71 |
public class JDIStackFrame extends JDIDebugElement implements IJavaStackFrame { |
| 63 |
|
72 |
|
|
|
73 |
private static final String PARENT_SCOPED_PREFIX = "val$"; //$NON-NLS-1$ |
| 74 |
|
| 75 |
final class AnnonLocalVariable extends LocalVariableImpl { |
| 76 |
private final FieldImpl f; |
| 77 |
|
| 78 |
private AnnonLocalVariable(VirtualMachineImpl vmImpl, MethodImpl method, long codeIndex, String name, |
| 79 |
String signature, String genericSignature, int length, int slot, boolean isArgument, FieldImpl f) { |
| 80 |
super(vmImpl, method, codeIndex, name, signature, genericSignature, length, slot, isArgument); |
| 81 |
this.f = f; |
| 82 |
} |
| 83 |
|
| 84 |
public boolean isThis() { |
| 85 |
return false; |
| 86 |
} |
| 87 |
|
| 88 |
public boolean isArgument() { |
| 89 |
return false; |
| 90 |
} |
| 91 |
|
| 92 |
Value actuallyGetValue() throws DebugException { |
| 93 |
return getUnderlyingThisObject().getValue(f); |
| 94 |
} |
| 95 |
} |
| 96 |
|
| 64 |
/** |
97 |
/** |
| 65 |
* This frame's depth in the call stack (0 == bottom of stack). |
98 |
* This frame's depth in the call stack (0 == bottom of stack). |
| 66 |
* A new frame is indicated by -2. |
99 |
* A new frame is indicated by -2. |
|
Lines 683-692
Link Here
|
| 683 |
} catch (RuntimeException e) { |
716 |
} catch (RuntimeException e) { |
| 684 |
targetRequestFailed(MessageFormat.format(JDIDebugModelMessages.JDIStackFrame_exception_retrieving_visible_variables_2,new String[] {e.toString()}), e); |
717 |
targetRequestFailed(MessageFormat.format(JDIDebugModelMessages.JDIStackFrame_exception_retrieving_visible_variables_2,new String[] {e.toString()}), e); |
| 685 |
} |
718 |
} |
|
|
719 |
|
| 720 |
List fields= getUnderlyingMethod().declaringType().fields(); |
| 721 |
for (int i = 0; i < fields.size(); ++i) { |
| 722 |
Object next= fields.get(i); |
| 723 |
if (next instanceof FieldImpl) { |
| 724 |
FieldImpl f= (FieldImpl) next; |
| 725 |
|
| 726 |
if (isParentScopedVariable(f)) { |
| 727 |
variables.add(new AnnonLocalVariable(f.virtualMachineImpl(), (MethodImpl) getUnderlyingMethod(), |
| 728 |
0, washHiddenFieldName(f), f.signature(), f.genericSignature(), 0, |
| 729 |
-1, false, f)); |
| 730 |
} |
| 731 |
} |
| 732 |
} |
| 686 |
return variables; |
733 |
return variables; |
| 687 |
} |
734 |
} |
| 688 |
} |
735 |
} |
| 689 |
|
736 |
|
|
|
737 |
|
| 738 |
private boolean isParentScopedVariable(final FieldImpl f) { |
| 739 |
final int mod= f.modifiers(); |
| 740 |
return (mod & AccessibleImpl.MODIFIER_ACC_SYNTHETIC) != 0 && |
| 741 |
(mod & AccessibleImpl.MODIFIER_ACC_FINAL) != 0 && |
| 742 |
(mod & AccessibleImpl.MODIFIER_ACC_PRIVATE) != 0 && |
| 743 |
f.name().startsWith(PARENT_SCOPED_PREFIX); |
| 744 |
} |
| 745 |
|
| 746 |
private static String washHiddenFieldName(final FieldImpl f) { |
| 747 |
return f.name().substring(PARENT_SCOPED_PREFIX.length()); |
| 748 |
} |
| 749 |
|
| 690 |
/** |
750 |
/** |
| 691 |
* Retrieves 'this' from the underlying stack frame. |
751 |
* Retrieves 'this' from the underlying stack frame. |
| 692 |
* Returns <code>null</code> for static stack frames. |
752 |
* Returns <code>null</code> for static stack frames. |