[jboss-svn-commits] JBL Code SVN: r26464 - labs/jbossrules/trunk/drools-eclipse/org.drools.eclipse/src/main/java/org/drools/eclipse/debug/core.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Tue May 12 07:29:17 EDT 2009
Author: mark.proctor at jboss.com
Date: 2009-05-12 07:29:17 -0400 (Tue, 12 May 2009)
New Revision: 26464
Removed:
labs/jbossrules/trunk/drools-eclipse/org.drools.eclipse/src/main/java/org/drools/eclipse/debug/core/DroolsLocalVariable.java
labs/jbossrules/trunk/drools-eclipse/org.drools.eclipse/src/main/java/org/drools/eclipse/debug/core/DroolsThisVariable.java
Modified:
labs/jbossrules/trunk/drools-eclipse/org.drools.eclipse/src/main/java/org/drools/eclipse/debug/core/DroolsStackFrame.java
labs/jbossrules/trunk/drools-eclipse/org.drools.eclipse/src/main/java/org/drools/eclipse/debug/core/DroolsThread.java
labs/jbossrules/trunk/drools-eclipse/org.drools.eclipse/src/main/java/org/drools/eclipse/debug/core/MVELStackFrame.java
Log:
-refactoring the debug impl to make them simpler.
Deleted: labs/jbossrules/trunk/drools-eclipse/org.drools.eclipse/src/main/java/org/drools/eclipse/debug/core/DroolsLocalVariable.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/org.drools.eclipse/src/main/java/org/drools/eclipse/debug/core/DroolsLocalVariable.java 2009-05-11 19:54:59 UTC (rev 26463)
+++ labs/jbossrules/trunk/drools-eclipse/org.drools.eclipse/src/main/java/org/drools/eclipse/debug/core/DroolsLocalVariable.java 2009-05-12 11:29:17 UTC (rev 26464)
@@ -1,22 +0,0 @@
-package org.drools.eclipse.debug.core;
-
-import org.eclipse.jdt.internal.debug.core.model.JDILocalVariable;
-import org.eclipse.jdt.internal.debug.core.model.JDIStackFrame;
-
-import com.sun.jdi.LocalVariable;
-
-public class DroolsLocalVariable extends JDILocalVariable {
-
- public DroolsLocalVariable(JDIStackFrame frame, LocalVariable local) {
- super(frame, local);
- }
-
- protected void setLocal(LocalVariable local) {
- super.setLocal(local);
- }
-
- protected LocalVariable getLocal() {
- return super.getLocal();
- }
-
-}
Modified: labs/jbossrules/trunk/drools-eclipse/org.drools.eclipse/src/main/java/org/drools/eclipse/debug/core/DroolsStackFrame.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/org.drools.eclipse/src/main/java/org/drools/eclipse/debug/core/DroolsStackFrame.java 2009-05-11 19:54:59 UTC (rev 26463)
+++ labs/jbossrules/trunk/drools-eclipse/org.drools.eclipse/src/main/java/org/drools/eclipse/debug/core/DroolsStackFrame.java 2009-05-12 11:29:17 UTC (rev 26464)
@@ -9,15 +9,26 @@
import org.drools.eclipse.DroolsEclipsePlugin;
import org.drools.eclipse.DRLInfo.FunctionInfo;
import org.drools.eclipse.DRLInfo.RuleInfo;
+import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.debug.core.DebugEvent;
import org.eclipse.debug.core.DebugException;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.model.IDebugElement;
+import org.eclipse.debug.core.model.IDebugTarget;
+import org.eclipse.debug.core.model.IDisconnect;
+import org.eclipse.debug.core.model.IRegisterGroup;
import org.eclipse.debug.core.model.IThread;
import org.eclipse.debug.core.model.IVariable;
+import org.eclipse.jdt.debug.core.IJavaClassType;
+import org.eclipse.jdt.debug.core.IJavaObject;
+import org.eclipse.jdt.debug.core.IJavaReferenceType;
import org.eclipse.jdt.debug.core.IJavaStackFrame;
import org.eclipse.jdt.debug.core.IJavaThread;
+import org.eclipse.jdt.debug.core.IJavaValue;
import org.eclipse.jdt.debug.core.IJavaVariable;
+import org.eclipse.jdt.internal.debug.core.IJDIEventListener;
import org.eclipse.jdt.internal.debug.core.JDIDebugPlugin;
import org.eclipse.jdt.internal.debug.core.model.JDIDebugModelMessages;
import org.eclipse.jdt.internal.debug.core.model.JDIDebugTarget;
@@ -37,32 +48,16 @@
import com.sun.jdi.ObjectReference;
import com.sun.jdi.ReferenceType;
import com.sun.jdi.StackFrame;
+import com.sun.jdi.request.EventRequest;
+import com.sun.jdi.request.EventRequestManager;
-public class DroolsStackFrame extends JDIStackFrame {
-
+public class DroolsStackFrame extends JDIStackFrame {
private static final String CONSEQUENCE_SIGNATURE = "(Lorg/drools/spi/KnowledgeHelper";
-
- private DroolsThread fThread;
- private Location fLocation;
- private List fVariables;
- private boolean fRefreshVariables = true;
- private int fDepth = -2;
- private boolean initialized = true;
- private StackFrame fStackFrame;
- private ObjectReference fThisObject;
- private String fReceivingTypeName;
- private boolean fLocalsAvailable = true;
-
- public DroolsStackFrame(DroolsThread thread,
- StackFrame frame,
- int depth) {
- super( thread,
- frame,
- depth );
- bind( frame,
- depth );
+
+ public DroolsStackFrame(JDIThread thread, StackFrame frame, int depth) {
+ super(thread, frame, depth);
}
-
+
public boolean isExecutingRule() {
try {
if ( "consequence".equals( getMethodName() ) && getSignature().startsWith( CONSEQUENCE_SIGNATURE ) ) {
@@ -72,8 +67,8 @@
DroolsEclipsePlugin.log( exc );
}
return false;
- }
-
+ }
+
public RuleInfo getExecutingRuleInfo() {
try {
String methodName = getMethodName();
@@ -87,8 +82,8 @@
DroolsEclipsePlugin.log( exc );
}
return null;
- }
-
+ }
+
public FunctionInfo getExecutingFunctionInfo() {
try {
return DroolsEclipsePlugin.getDefault().getFunctionInfoByClass( getDeclaringTypeName() );
@@ -96,36 +91,22 @@
DroolsEclipsePlugin.log( exc );
}
return null;
- }
-
- public int getLineNumber() throws DebugException {
- synchronized ( fThread ) {
- RuleInfo ruleInfo = getExecutingRuleInfo();
- if ( ruleInfo != null ) {
- return ruleInfo.getConsequenceDrlLineNumber() + (getInternalLineNumber() - ruleInfo.getConsequenceJavaLineNumber() - 1);
- }
- FunctionInfo functionInfo = getExecutingFunctionInfo();
- if ( functionInfo != null ) {
- return functionInfo.getDrlLineNumber() + (getInternalLineNumber() - functionInfo.getJavaLineNumber());
- }
+ }
+
+ @Override
+ protected JDIStackFrame bind(StackFrame frame,
+ int depth) {
+ JDIStackFrame jdiFrame = super.bind( frame, depth );
+ if ( jdiFrame != null && jdiFrame != this ) {
+ // this might be a little heaver, as it's a duplicate creation
+ jdiFrame = ( JDIStackFrame ) DroolsThread.createCustomFrame( (DroolsThread ) getThread(),
+ depth,
+ frame );
}
-
- return getInternalLineNumber();
+
+ return jdiFrame;
}
-
- private int getInternalLineNumber() throws DebugException {
- try {
- return fLocation.lineNumber();
- } catch ( RuntimeException e ) {
- if ( getThread().isSuspended() ) {
- targetRequestFailed( MessageFormat.format( JDIDebugModelMessages.JDIStackFrame_exception_retrieving_line_number,
- new String[]{e.toString()} ),
- e );
- }
- }
- return -1;
- }
-
+
public IVariable[] getVariables() throws DebugException {
IVariable[] variables = super.getVariables();
List result = new ArrayList( (variables.length - 1) / 2 );
@@ -135,505 +116,56 @@
result.add( variables[i] );
}
}
- return (IVariable[]) result.toArray( new IVariable[result.size()] );
- }
-
- protected List getVariables0() throws DebugException {
- synchronized ( fThread ) {
- if ( fVariables == null ) {
-
- // throw exception if native method, so variable view will update
- // with information message
- if ( isNative() ) {
- requestFailed( JDIDebugModelMessages.JDIStackFrame_Variable_information_unavailable_for_native_methods,
- null );
- }
-
- Method method = getUnderlyingMethod();
- fVariables = new ArrayList();
- // #isStatic() does not claim to throw any exceptions - so it is not try/catch coded
- if ( method.isStatic() ) {
- // add statics
- List allFields = null;
- ReferenceType declaringType = method.declaringType();
- try {
- allFields = declaringType.allFields();
- } catch ( RuntimeException e ) {
- targetRequestFailed( MessageFormat.format( JDIDebugModelMessages.JDIStackFrame_exception_retrieving_fields,
- new String[]{e.toString()} ),
- e );
- // execution will not reach this line, as
- // #targetRequestFailed will throw an exception
- return Collections.EMPTY_LIST;
- }
- if ( allFields != null ) {
- Iterator fields = allFields.iterator();
- while ( fields.hasNext() ) {
- Field field = (Field) fields.next();
- if ( field.isStatic() ) {
- fVariables.add( new JDIFieldVariable( (JDIDebugTarget) getDebugTarget(),
- field,
- declaringType ) );
- }
- }
- Collections.sort( fVariables,
- new Comparator() {
- public int compare(Object a,
- Object b) {
- JDIFieldVariable v1 = (JDIFieldVariable) a;
- JDIFieldVariable v2 = (JDIFieldVariable) b;
- try {
- return v1.getName().compareToIgnoreCase( v2.getName() );
- } catch ( DebugException de ) {
- logError( de );
- return -1;
- }
- }
- } );
- }
- } else {
- // add "this"
- ObjectReference t = getUnderlyingThisObject();
- if ( t != null ) {
- fVariables.add( new DroolsThisVariable( (JDIDebugTarget) getDebugTarget(),
- t ) );
- }
- }
- // add locals
- Iterator variables = getUnderlyingVisibleVariables().iterator();
- while ( variables.hasNext() ) {
- LocalVariable var = (LocalVariable) variables.next();
- fVariables.add( new DroolsLocalVariable( this,
- var ) );
- }
- } else if ( fRefreshVariables ) {
- updateVariables();
- }
- fRefreshVariables = false;
- return fVariables;
+ variables = (IVariable[]) result.toArray( new IVariable[result.size()] );
+ System.out.print( "vars" );
+ for ( IVariable var : variables ) {
+ System.out.print( var.getName() + " " );
}
+ System.out.println( );
+ return variables;
}
-
- protected JDIStackFrame bind(StackFrame frame,
- int depth) {
- if ( initialized ) {
- synchronized ( fThread ) {
- if ( fDepth == -2 ) {
- // first initialization
- fStackFrame = frame;
- fDepth = depth;
- fLocation = frame.location();
- return this;
- } else if ( depth == -1 ) {
- // mark as invalid
- fDepth = -1;
- fStackFrame = null;
- return null;
- } else if ( fDepth == depth ) {
- Location location = frame.location();
- Method method = location.method();
- if ( method.equals( fLocation.method() ) ) {
- try {
- if ( method.declaringType().defaultStratum().equals( "Java" ) || //$NON-NLS-1$
- equals( getSourceName( location ),
- getSourceName( fLocation ) ) ) {
- // TODO: what about receiving type being the same?
- fStackFrame = frame;
- fLocation = location;
- clearCachedData();
- return this;
- }
- } catch ( DebugException e ) {
- }
- }
- }
- // invalidate this franme
- bind( null,
- -1 );
- // return a new frame
- return createNewDroolsFrame( frame,
- depth );
- }
- } else {
- return null;
+
+ public IJavaVariable[] getLocalVariables() throws DebugException {
+ IJavaVariable[] localVars = super.getLocalVariables();
+ System.out.print( "local vars" );
+ for ( IJavaVariable var : localVars ) {
+ System.out.print( var.getName() + " " );
}
+ System.out.println( );
+
+ return localVars;
}
-
- protected DroolsStackFrame createNewDroolsFrame(StackFrame frame,
- int depth) {
- return DroolsThread.createCustomFrame( fThread,
- depth,
- frame );
- }
-
- public IThread getThread() {
- return fThread;
- }
-
- public Method getUnderlyingMethod() {
- synchronized ( fThread ) {
- return fLocation.method();
- }
- }
-
- protected List getUnderlyingVisibleVariables() throws DebugException {
- synchronized ( fThread ) {
- List variables = Collections.EMPTY_LIST;
- try {
- variables = getUnderlyingStackFrame().visibleVariables();
- } catch ( AbsentInformationException e ) {
- setLocalsAvailable( false );
- } catch ( NativeMethodException e ) {
- setLocalsAvailable( false );
- } catch ( RuntimeException e ) {
- targetRequestFailed( MessageFormat.format( JDIDebugModelMessages.JDIStackFrame_exception_retrieving_visible_variables_2,
- new String[]{e.toString()} ),
- e );
+
+ public int getLineNumber() throws DebugException {
+ synchronized ( getThread() ) {
+ RuleInfo ruleInfo = getExecutingRuleInfo();
+ if ( ruleInfo != null ) {
+ return ruleInfo.getConsequenceDrlLineNumber() + (super.getLineNumber() - ruleInfo.getConsequenceJavaLineNumber() - 1);
}
- return variables;
- }
- }
-
- protected ObjectReference getUnderlyingThisObject() throws DebugException {
- synchronized ( fThread ) {
- if ( (fStackFrame == null || fThisObject == null) && !isStatic() ) {
- try {
- fThisObject = getUnderlyingStackFrame().thisObject();
- } catch ( RuntimeException e ) {
- targetRequestFailed( MessageFormat.format( JDIDebugModelMessages.JDIStackFrame_exception_retrieving_this,
- new String[]{e.toString()} ),
- e );
- // execution will not reach this line, as
- // #targetRequestFailed will throw an exception
- return null;
- }
+ FunctionInfo functionInfo = getExecutingFunctionInfo();
+ if ( functionInfo != null ) {
+ return functionInfo.getDrlLineNumber() + (super.getLineNumber() - functionInfo.getJavaLineNumber());
}
- return fThisObject;
}
- }
- public String getDeclaringTypeName() throws DebugException {
- synchronized ( fThread ) {
- try {
- if ( isObsolete() ) {
- return JDIDebugModelMessages.JDIStackFrame__unknown_declaring_type__1;
- }
- return JDIReferenceType.getGenericName( getUnderlyingMethod().declaringType() );
- } catch ( RuntimeException e ) {
- if ( getThread().isSuspended() ) {
- targetRequestFailed( MessageFormat.format( JDIDebugModelMessages.JDIStackFrame_exception_retrieving_declaring_type,
- new String[]{e.toString()} ),
- e );
- }
- return JDIDebugModelMessages.JDIStackFrame__unknown_declaring_type__1;
- }
- }
+ return super.getLineNumber();
+ }
+
+
+ public StackFrame getUnderlyingStackFrame() throws DebugException {
+ return super.getUnderlyingStackFrame();
}
-
- public String getSourceName() throws DebugException {
- synchronized ( fThread ) {
- return getSourceName( fLocation );
- }
- }
-
- public boolean isObsolete() {
- if ( !JDIDebugPlugin.isJdiVersionGreaterThanOrEqual( new int[]{1, 4} ) || !((JDIDebugTarget) getDebugTarget()).hasHCROccurred() ) {
- // If no hot code replace has occurred, this frame
- // cannot be obsolete.
- return false;
- }
- // if this frame's thread is not suspended, the obsolete status cannot
- // change until it suspends again
- synchronized ( fThread ) {
- if ( getThread().isSuspended() ) {
- return getUnderlyingMethod().isObsolete();
- }
- return false;
- }
- }
-
- protected boolean exists() {
- synchronized ( fThread ) {
- return fDepth != -1;
- }
- }
-
- protected StackFrame getUnderlyingStackFrame() throws DebugException {
- synchronized ( fThread ) {
- if ( fStackFrame == null ) {
- if ( fDepth == -1 ) {
- throw new DebugException( new Status( IStatus.ERROR,
- JDIDebugPlugin.getUniqueIdentifier(),
- IJavaStackFrame.ERR_INVALID_STACK_FRAME,
- JDIDebugModelMessages.JDIStackFrame_25,
- null ) );
- }
- if ( fThread.isSuspended() ) {
- // re-index stack frames - See Bug 47198
- fThread.computeStackFrames();
- if ( fDepth == -1 ) {
- // If depth is -1, then this is an invalid frame
- throw new DebugException( new Status( IStatus.ERROR,
- JDIDebugPlugin.getUniqueIdentifier(),
- IJavaStackFrame.ERR_INVALID_STACK_FRAME,
- JDIDebugModelMessages.JDIStackFrame_25,
- null ) );
- }
- } else {
- throw new DebugException( new Status( IStatus.ERROR,
- JDIDebugPlugin.getUniqueIdentifier(),
- IJavaThread.ERR_THREAD_NOT_SUSPENDED,
- JDIDebugModelMessages.JDIStackFrame_25,
- null ) );
- }
- }
- return fStackFrame;
- }
- }
-
+
protected void setUnderlyingStackFrame(StackFrame frame) {
- synchronized ( fThread ) {
- fStackFrame = frame;
- if ( frame == null ) {
- fRefreshVariables = true;
- }
- }
+ super.setUnderlyingStackFrame( frame );
}
-
- protected void setThread(JDIThread thread) {
- fThread = (DroolsThread) thread;
+
+ @Override
+ public void stepOver() throws DebugException {
+ List frames = ((JDIThread) getThread()).computeStackFrames();
+ int index = frames.indexOf(this);
+ System.out.println( "frames " + frames.size() + " : " + index );
+ super.stepOver();
}
- public String getSourcePath(String stratum) throws DebugException {
- synchronized ( fThread ) {
- try {
- return fLocation.sourcePath( stratum );
- } catch ( AbsentInformationException e ) {
- } catch ( RuntimeException e ) {
- targetRequestFailed( MessageFormat.format( JDIDebugModelMessages.JDIStackFrame_exception_retrieving_source_path,
- new String[]{e.toString()} ),
- e );
- }
- }
- return null;
- }
-
- public String getSourcePath() throws DebugException {
- synchronized ( fThread ) {
- try {
- return fLocation.sourcePath();
- } catch ( AbsentInformationException e ) {
- } catch ( RuntimeException e ) {
- targetRequestFailed( MessageFormat.format( JDIDebugModelMessages.JDIStackFrame_exception_retrieving_source_path,
- new String[]{e.toString()} ),
- e );
- }
- }
- return null;
- }
-
- public int getLineNumber(String stratum) throws DebugException {
- synchronized ( fThread ) {
- try {
- return fLocation.lineNumber( stratum );
- } catch ( RuntimeException e ) {
- if ( getThread().isSuspended() ) {
- targetRequestFailed( MessageFormat.format( JDIDebugModelMessages.JDIStackFrame_exception_retrieving_line_number,
- new String[]{e.toString()} ),
- e );
- }
- }
- }
- return -1;
- }
-
- public String getSourceName(String stratum) throws DebugException {
- synchronized ( fThread ) {
- try {
- return fLocation.sourceName( stratum );
- } catch ( AbsentInformationException e ) {
- } catch ( NativeMethodException e ) {
- } catch ( RuntimeException e ) {
- targetRequestFailed( MessageFormat.format( JDIDebugModelMessages.JDIStackFrame_exception_retrieving_source_name,
- new String[]{e.toString()} ),
- e );
- }
- }
- return null;
- }
-
- protected void updateVariables() throws DebugException {
- if ( fVariables == null ) {
- return;
- }
-
- Method method = getUnderlyingMethod();
- int index = 0;
- if ( !method.isStatic() ) {
- // update "this"
- ObjectReference thisObject;
- try {
- thisObject = getUnderlyingThisObject();
- } catch ( DebugException exception ) {
- if ( !getThread().isSuspended() ) {
- thisObject = null;
- } else {
- throw exception;
- }
- }
- DroolsThisVariable oldThisObject = null;
- if ( !fVariables.isEmpty() && fVariables.get( 0 ) instanceof DroolsThisVariable ) {
- oldThisObject = (DroolsThisVariable) fVariables.get( 0 );
- }
- if ( thisObject == null && oldThisObject != null ) {
- // removal of 'this'
- fVariables.remove( 0 );
- index = 0;
- } else {
- if ( oldThisObject == null && thisObject != null ) {
- // creation of 'this'
- oldThisObject = new DroolsThisVariable( (JDIDebugTarget) getDebugTarget(),
- thisObject );
- fVariables.add( 0,
- oldThisObject );
- index = 1;
- } else {
- if ( oldThisObject != null ) {
- // 'this' still exists, replace with new 'this' if a different receiver
- if ( !oldThisObject.retrieveValue().equals( thisObject ) ) {
- fVariables.remove( 0 );
- fVariables.add( 0,
- new DroolsThisVariable( (JDIDebugTarget) getDebugTarget(),
- thisObject ) );
- }
- index = 1;
- }
- }
- }
- }
-
- List locals = null;
- try {
- locals = getUnderlyingStackFrame().visibleVariables();
- } catch ( AbsentInformationException e ) {
- locals = Collections.EMPTY_LIST;
- } catch ( NativeMethodException e ) {
- locals = Collections.EMPTY_LIST;
- } catch ( RuntimeException e ) {
- targetRequestFailed( MessageFormat.format( JDIDebugModelMessages.JDIStackFrame_exception_retrieving_visible_variables,
- new String[]{e.toString()} ),
- e );
- // execution will not reach this line, as
- // #targetRequestFailed will throw an exception
- return;
- }
- int localIndex = -1;
- while ( index < fVariables.size() ) {
- Object var = fVariables.get( index );
- if ( var instanceof JDILocalVariable ) {
- DroolsLocalVariable local = (DroolsLocalVariable) fVariables.get( index );
- localIndex = locals.indexOf( local.getLocal() );
- if ( localIndex >= 0 ) {
- // update variable with new underling JDI LocalVariable
- local.setLocal( (LocalVariable) locals.get( localIndex ) );
- locals.remove( localIndex );
- index++;
- } else {
- // remove variable
- fVariables.remove( index );
- }
- } else {
- //field variable of a static frame
- index++;
- }
- }
-
- // add any new locals
- Iterator newOnes = locals.iterator();
- while ( newOnes.hasNext() ) {
- DroolsLocalVariable local = new DroolsLocalVariable( this,
- (LocalVariable) newOnes.next() );
- fVariables.add( local );
- }
- }
-
- protected void setVariables(List variables) {
- fVariables = variables;
- }
-
- public String getReceivingTypeName() throws DebugException {
- if ( fStackFrame == null || fReceivingTypeName == null ) {
- try {
- if ( isObsolete() ) {
- fReceivingTypeName = JDIDebugModelMessages.JDIStackFrame__unknown_receiving_type__2;
- } else {
- ObjectReference thisObject = getUnderlyingThisObject();
- if ( thisObject == null ) {
- fReceivingTypeName = getDeclaringTypeName();
- } else {
- fReceivingTypeName = JDIReferenceType.getGenericName( thisObject.referenceType() );
- }
- }
- } catch ( RuntimeException e ) {
- if ( getThread().isSuspended() ) {
- targetRequestFailed( MessageFormat.format( JDIDebugModelMessages.JDIStackFrame_exception_retrieving_receiving_type,
- new String[]{e.toString()} ),
- e );
- }
- return JDIDebugModelMessages.JDIStackFrame__unknown_receiving_type__2;
- }
- }
- return fReceivingTypeName;
- }
-
- private String getSourceName(Location location) throws DebugException {
- try {
- return location.sourceName();
- } catch ( AbsentInformationException e ) {
- return null;
- } catch ( NativeMethodException e ) {
- return null;
- } catch ( RuntimeException e ) {
- targetRequestFailed( MessageFormat.format( JDIDebugModelMessages.JDIStackFrame_exception_retrieving_source_name,
- new String[]{e.toString()} ),
- e );
- }
- return null;
- }
-
- private boolean equals(Object o1,
- Object o2) {
- if ( o1 == null ) {
- return o2 == null;
- } else {
- return o1.equals( o2 );
- }
- }
-
- protected void clearCachedData() {
- fThisObject = null;
- fReceivingTypeName = null;
- }
-
- private void setLocalsAvailable(boolean available) {
- if ( available != fLocalsAvailable ) {
- fLocalsAvailable = available;
- fireChangeEvent( DebugEvent.STATE );
- }
- }
-
- public boolean wereLocalsAvailable() {
- return fLocalsAvailable;
- }
-
- public IJavaVariable[] getLocalVariables() throws DebugException {
- List list = getUnderlyingVisibleVariables();
- IJavaVariable[] locals = new IJavaVariable[list.size()];
- for ( int i = 0; i < list.size(); i++ ) {
- locals[i] = new DroolsLocalVariable( this,
- (LocalVariable) list.get( i ) );
- }
- return locals;
- }
-
}
Deleted: labs/jbossrules/trunk/drools-eclipse/org.drools.eclipse/src/main/java/org/drools/eclipse/debug/core/DroolsThisVariable.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/org.drools.eclipse/src/main/java/org/drools/eclipse/debug/core/DroolsThisVariable.java 2009-05-11 19:54:59 UTC (rev 26463)
+++ labs/jbossrules/trunk/drools-eclipse/org.drools.eclipse/src/main/java/org/drools/eclipse/debug/core/DroolsThisVariable.java 2009-05-12 11:29:17 UTC (rev 26464)
@@ -1,18 +0,0 @@
-package org.drools.eclipse.debug.core;
-
-import org.eclipse.jdt.internal.debug.core.model.JDIDebugTarget;
-import org.eclipse.jdt.internal.debug.core.model.JDIThisVariable;
-
-import com.sun.jdi.ObjectReference;
-import com.sun.jdi.Value;
-
-public class DroolsThisVariable extends JDIThisVariable {
-
- public DroolsThisVariable(JDIDebugTarget target, ObjectReference object) {
- super(target, object);
- }
-
- protected Value retrieveValue() {
- return super.retrieveValue();
- }
-}
Modified: labs/jbossrules/trunk/drools-eclipse/org.drools.eclipse/src/main/java/org/drools/eclipse/debug/core/DroolsThread.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/org.drools.eclipse/src/main/java/org/drools/eclipse/debug/core/DroolsThread.java 2009-05-11 19:54:59 UTC (rev 26463)
+++ labs/jbossrules/trunk/drools-eclipse/org.drools.eclipse/src/main/java/org/drools/eclipse/debug/core/DroolsThread.java 2009-05-12 11:29:17 UTC (rev 26464)
@@ -35,31 +35,20 @@
*
*/
public class DroolsThread extends JDIThread {
-
- private List fStackFrames;
- private boolean fRefreshChildren = true;
-
public DroolsThread(JDIDebugTarget target,
ThreadReference thread) throws ObjectCollectedException {
super( target,
thread );
}
- protected void initialize() throws ObjectCollectedException {
- super.initialize();
- fStackFrames = new ArrayList();
- }
-
- public synchronized List computeStackFrames() throws DebugException {
- return computeStackFrames( fRefreshChildren );
- }
-
protected synchronized List computeStackFrames(boolean refreshChildren) throws DebugException {
+ List fStackFrames = getInternalfStackFrames();
+
if ( isSuspended() ) {
if ( isTerminated() ) {
fStackFrames.clear();
} else if ( refreshChildren ) {
- List frames = getUnderlyingFrames();
+ List frames = getInternalUnderlyingFrames();
int oldSize = fStackFrames.size();
int newSize = frames.size();
int discard = oldSize - newSize; // number of old frames to discard, if any
@@ -72,14 +61,10 @@
int depth = oldSize;
for ( int i = newFrames - 1; i >= 0; i-- ) {
StackFrame currentFrame = (StackFrame) frames.get( i );
- //MVEL: create an mvel stack frame when the declaring type is our debugger?
+ JDIStackFrame customFrame = createCustomFrame( this,
+ depth,
+ currentFrame );
- DroolsStackFrame customFrame;
-
- customFrame = createCustomFrame( this,
- depth,
- currentFrame );
-
fStackFrames.add( 0,
customFrame );
@@ -101,7 +86,7 @@
}
}
- fRefreshChildren = false;
+ setInternalfRefreshChildren( false );
} else {
return Collections.EMPTY_LIST;
}
@@ -109,8 +94,8 @@
}
public final static synchronized DroolsStackFrame createCustomFrame(DroolsThread thread,
- int depth,
- StackFrame currentFrame) {
+ int depth,
+ StackFrame currentFrame) {
DroolsStackFrame customFrame;
Location loc = currentFrame.location();
if ( loc.declaringType().name().equals( "org.drools.base.mvel.MVELDebugHandler" ) && loc.method().name().equals( "onBreak" ) ) {
@@ -125,87 +110,88 @@
return customFrame;
}
- private List getUnderlyingFrames() throws DebugException {
- if ( !isSuspended() ) {
- // Checking isSuspended here eliminates a race condition in resume
- // between the time stack frames are preserved and the time the
- // underlying thread is actually resumed.
- requestFailed( JDIDebugModelMessages.JDIThread_Unable_to_retrieve_stack_frame___thread_not_suspended__1,
- null,
- IJavaThread.ERR_THREAD_NOT_SUSPENDED );
- }
- try {
- return getUnderlyingThread().frames();
- } catch ( IncompatibleThreadStateException e ) {
- requestFailed( JDIDebugModelMessages.JDIThread_Unable_to_retrieve_stack_frame___thread_not_suspended__1,
- e,
- IJavaThread.ERR_THREAD_NOT_SUSPENDED );
- } catch ( RuntimeException e ) {
- targetRequestFailed( MessageFormat.format( JDIDebugModelMessages.JDIThread_exception_retrieving_stack_frames_2,
- new String[]{e.toString()} ),
- e );
- } catch ( InternalError e ) {
- targetRequestFailed( MessageFormat.format( JDIDebugModelMessages.JDIThread_exception_retrieving_stack_frames_2,
- new String[]{e.toString()} ),
- e );
- }
- // execution will not reach this line, as
- // #targetRequestFailed will thrown an exception
- return null;
- }
+// I don't see the need for any of this custom stepOver stuff, why is it here?
+// public synchronized void stepOver() throws DebugException {
+//
+// // Detection for active stackframe
+// if ( !(getTopStackFrame() instanceof MVELStackFrame) ) {
+// super.stepOver();
+// return;
+// }
+//
+// //MVEL step over
+// MVELStackFrame mvelStack = (MVELStackFrame) getTopStackFrame();
+//
+// if ( !canStepOver() || !mvelStack.canStepOver() ) {
+// return;
+// }
+//
+// if ( !setRemoteOnBreakReturn( Debugger.STEP ) ) {
+// return;
+// }
+//
+// setRunning( true );
+//
+// preserveStackFrames();
+//
+// fireEvent( new DebugEvent( this,
+// DebugEvent.RESUME,
+// DebugEvent.STEP_OVER ) );
+//
+// try {
+// getUnderlyingThread().resume();
+// } catch ( RuntimeException e ) {
+// //stepEnd();
+// targetRequestFailed( MessageFormat.format( JDIDebugModelMessages.JDIThread_exception_stepping,
+// new String[]{e.toString()} ),
+// e );
+// }
+//
+// }
+//
+// private boolean setRemoteOnBreakReturn(int step_over) throws DebugException {
+//
+// JDIStackFrame top = (JDIStackFrame) getTopStackFrame();
+// if ( top == null || (!(top instanceof MVELStackFrame)) ) {
+// return false;
+// }
+//
+// Iterator handleriter = getVM().classesByName( "org.drools.base.mvel.MVELDebugHandler" ).iterator();
+// Object debugHandlerClass = handleriter.next();
+//
+// int line = step_over;
+//
+// ReferenceType refType = (ReferenceType) debugHandlerClass;
+// Method m = (Method) refType.methodsByName( "setOnBreakReturn" ).iterator().next();
+// List args = new ArrayList();
+// IntegerValue lineVal = getVM().mirrorOf( line );
+// //ObjectReference realVal = val.getUnderlyingObject();
+// args.add( lineVal );
+//
+// try {
+// ClassType tt = (ClassType) debugHandlerClass;
+// tt.invokeMethod( getUnderlyingThread(),
+// m,
+// args,
+// ObjectReference.INVOKE_SINGLE_THREADED );
+//
+// } catch ( Exception e ) {
+// DroolsEclipsePlugin.log( e );
+// return false;
+// }
+// return true;
+// }
+//
+// public synchronized void resume() throws DebugException {
+// // clear up the step over flag. step over button never calls this method.
+// setRemoteOnBreakReturn( Debugger.CONTINUE );
+// super.resume();
+// }
- protected synchronized void preserveStackFrames() {
- fRefreshChildren = true;
- Iterator frames = fStackFrames.iterator();
- while ( frames.hasNext() ) {
- ((DroolsStackFrame) frames.next()).setUnderlyingStackFrame( null );
- }
- }
-
protected synchronized void disposeStackFrames() {
- fStackFrames.clear();
- fRefreshChildren = true;
+ super.disposeStackFrames();
}
- protected void popFrame(IStackFrame frame) throws DebugException {
- JDIDebugTarget target = (JDIDebugTarget) getDebugTarget();
- if ( target.canPopFrames() ) {
- // JDK 1.4 support
- try {
- // Pop the frame and all frames above it
- StackFrame jdiFrame = null;
- int desiredSize = fStackFrames.size() - fStackFrames.indexOf( frame ) - 1;
- int lastSize = fStackFrames.size() + 1; // Set up to pass the first test
- int size = fStackFrames.size();
- while ( size < lastSize && size > desiredSize ) {
- // Keep popping frames until the stack stops getting smaller
- // or popFrame is gone.
- // see Bug 8054
- jdiFrame = ((DroolsStackFrame) frame).getUnderlyingStackFrame();
- preserveStackFrames();
- getUnderlyingThread().popFrames( jdiFrame );
- lastSize = size;
- size = computeStackFrames().size();
- }
- } catch ( IncompatibleThreadStateException exception ) {
- targetRequestFailed( MessageFormat.format( JDIDebugModelMessages.JDIThread_exception_popping,
- new String[]{exception.toString()} ),
- exception );
- } catch ( InvalidStackFrameException exception ) {
- // InvalidStackFrameException can be thrown when all but the
- // deepest frame were popped. Fire a changed notification
- // in case this has occured.
- fireChangeEvent( DebugEvent.CONTENT );
- targetRequestFailed( exception.toString(),
- exception );
- } catch ( RuntimeException exception ) {
- targetRequestFailed( MessageFormat.format( JDIDebugModelMessages.JDIThread_exception_popping,
- new String[]{exception.toString()} ),
- exception );
- }
- }
- }
-
protected void terminated() {
super.terminated();
}
@@ -226,102 +212,40 @@
super.setRunning( running );
}
- protected void dropToFrame(IStackFrame frame) throws DebugException {
- super.dropToFrame( frame );
+ public void setInternalfRefreshChildren(boolean bool) {
+ try {
+ java.lang.reflect.Field field = JDIThread.class.getDeclaredField( "fRefreshChildren" );
+ field.setAccessible( true );
+ field.set( this,
+ bool );
+ } catch ( Exception e ) {
+ }
}
- protected synchronized void stepToFrame(IStackFrame frame) throws DebugException {
- super.stepToFrame( frame );
- }
+ public List getInternalfStackFrames() {
+ try {
+ java.lang.reflect.Field field = JDIThread.class.getDeclaredField( "fStackFrames" );
- /* (non-Javadoc)
- * @see org.eclipse.jdt.internal.debug.core.model.JDIThread#newInstance(com.sun.jdi.ClassType, com.sun.jdi.Method, java.util.List)
- */
- public ObjectReference newInstance(ClassType receiverClass,
- Method constructor,
- List args) throws DebugException {
- return super.newInstance( receiverClass,
- constructor,
- args );
- }
+ field.setAccessible( true );
- public synchronized void stepOver() throws DebugException {
-
- // Detection for active stackframe
- if ( !(getTopStackFrame() instanceof MVELStackFrame) ) {
- super.stepOver();
- return;
+ return (List) field.get( this );
+ } catch ( Exception e ) {
+ return null;
}
-
- //MVEL step over
- MVELStackFrame mvelStack = (MVELStackFrame) getTopStackFrame();
-
- if ( !canStepOver() || !mvelStack.canStepOver() ) {
- return;
- }
-
- if ( !setRemoteOnBreakReturn( Debugger.STEP ) ) {
- return;
- }
-
- setRunning( true );
-
- preserveStackFrames();
-
- fireEvent(new DebugEvent(this, DebugEvent.RESUME, DebugEvent.STEP_OVER));
-
- try {
- getUnderlyingThread().resume();
- } catch ( RuntimeException e ) {
- //stepEnd();
- targetRequestFailed( MessageFormat.format( JDIDebugModelMessages.JDIThread_exception_stepping,
- new String[]{e.toString()} ),
- e );
- }
-
}
- private boolean setRemoteOnBreakReturn(int step_over) throws DebugException {
-
- JDIStackFrame top = (JDIStackFrame) getTopStackFrame();
- if ( top == null || (!(top instanceof MVELStackFrame)) ) {
- return false;
- }
-
- Iterator handleriter = getVM().classesByName( "org.drools.base.mvel.MVELDebugHandler" ).iterator();
- Object debugHandlerClass = handleriter.next();
-
- int line = step_over;
-
- ReferenceType refType = (ReferenceType) debugHandlerClass;
- Method m = (Method) refType.methodsByName( "setOnBreakReturn" ).iterator().next();
- List args = new ArrayList();
- IntegerValue lineVal = getVM().mirrorOf( line );
- //ObjectReference realVal = val.getUnderlyingObject();
- args.add( lineVal );
-
+ private List getInternalUnderlyingFrames() throws DebugException {
try {
- ClassType tt = (ClassType) debugHandlerClass;
- tt.invokeMethod( getUnderlyingThread(),
- m,
- args,
- ObjectReference.INVOKE_SINGLE_THREADED );
+ java.lang.reflect.Method method = JDIThread.class.getDeclaredMethod( "getUnderlyingFrames",
+ null );
+ method.setAccessible( true );
+
+ return (List) method.invoke( this,
+ null );
} catch ( Exception e ) {
- DroolsEclipsePlugin.log( e );
- return false;
+ return null;
}
- return true;
}
- public synchronized void resume() throws DebugException {
- // clear up the step over flag. step over button never calls this method.
- setRemoteOnBreakReturn( Debugger.CONTINUE );
- super.resume();
- }
-
- public void setInvokingMethod(boolean invoking) {
- super.setInvokingMethod( invoking );
- }
-
}
Modified: labs/jbossrules/trunk/drools-eclipse/org.drools.eclipse/src/main/java/org/drools/eclipse/debug/core/MVELStackFrame.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/org.drools.eclipse/src/main/java/org/drools/eclipse/debug/core/MVELStackFrame.java 2009-05-11 19:54:59 UTC (rev 26463)
+++ labs/jbossrules/trunk/drools-eclipse/org.drools.eclipse/src/main/java/org/drools/eclipse/debug/core/MVELStackFrame.java 2009-05-12 11:29:17 UTC (rev 26464)
@@ -24,6 +24,7 @@
import org.eclipse.jdt.debug.core.IJavaObject;
import org.eclipse.jdt.debug.core.IJavaReferenceType;
import org.eclipse.jdt.debug.core.IJavaValue;
+import org.eclipse.jdt.internal.debug.core.model.JDILocalVariable;
import org.eclipse.jdt.internal.debug.core.model.JDIObjectValue;
import org.eclipse.jdt.internal.debug.core.model.JDIStackFrame;
@@ -75,12 +76,6 @@
}
- private AtomicInteger evaluating = new AtomicInteger( 0 );
-
- private final Object varLock = new Object();
-
- private final Object genericLock = new Object();
-
/**
* Dummy type with changed stratum to force debugger's LaunchView to show proper stackframe name
*/
@@ -169,6 +164,18 @@
}
+ public RuleInfo getExecutingRuleInfo() {
+ try {
+ String type = getDeclaringTypeName();
+
+ return DroolsEclipsePlugin.getDefault().getRuleInfoByClass( type );
+
+ } catch ( DebugException exc ) {
+ DroolsEclipsePlugin.log( exc );
+ }
+ return null;
+ }
+
public IVariable[] getVariables() throws DebugException {
if ( !isSuspended() ) {
return new IVariable[0];
@@ -180,10 +187,7 @@
return ctx.cacheVariables;
}
- synchronized ( varLock ) {
- evaluating.incrementAndGet();
-
- try {
+ synchronized ( getThread() ) {
List result = new ArrayList( 0 );
Method method = getUnderlyingMethod(); // onBreak
@@ -193,8 +197,8 @@
Object var = method.variables().get( 0 );
LocalVariable v2 = (LocalVariable) var;
- DroolsLocalVariable frameLocal = new DroolsLocalVariable( this,
- v2 );
+ JDILocalVariable frameLocal = new JDILocalVariable( this,
+ v2 );
IValue knownVars = DebugUtil.getValueByExpression( "return getFactory().getKnownVariables().toArray(new String[0]);",
frameLocal.getValue() );
@@ -252,74 +256,9 @@
} );
ctx.cacheVariables = vararr;
return vararr;
- } finally {
- evaluating.decrementAndGet();
- evalEnd();
- }
}
}
- private boolean internalHasNext(Value iter) throws InvalidTypeException,
- ClassNotLoadedException,
- IncompatibleThreadStateException,
- InvocationException,
- DebugException {
- BooleanValue hasNext = (BooleanValue) runMethod( iter,
- "hasNext" );
- return hasNext.booleanValue();
- }
-
- private Value fetchField(Value factoryVar,
- String fieldName) throws ClassNotLoadedException,
- DebugException {
- return fetchField( (ObjectReference) factoryVar,
- fieldName );
- }
-
- private Value runMethod(Value val,
- String methodName) throws InvalidTypeException,
- ClassNotLoadedException,
- IncompatibleThreadStateException,
- InvocationException,
- DebugException {
-
- ObjectReference refObj = (ObjectReference) val;
- ReferenceType t = refObj.referenceType();
- Method m2 = (Method) t.methodsByName( methodName ).iterator().next();
- ThreadReference thread = ((DroolsThread) getThread()).getUnderlyingThread();
-
- Value res = refObj.invokeMethod( thread,
- m2,
- new ArrayList(),
- 0 );
-
- return res;
- }
-
- private Value fetchField(DroolsLocalVariable frameLocal,
- String fieldName) throws DebugException,
- ClassNotLoadedException {
- ObjectReference objRef = ((JDIObjectValue) frameLocal.getValue()).getUnderlyingObject();
- return fetchField( objRef,
- fieldName );
- }
-
- private Value fetchField(ObjectReference ref,
- String fieldName) throws ClassNotLoadedException,
- DebugException {
- ClassType varType = (ClassType) ref.type();
- Field field = varType.fieldByName( fieldName );
- Value res = ref.getValue( field );
- return res;
- }
-
- protected DroolsStackFrame createNewDroolsFrame(StackFrame frame,
- int depth) {
- return new MVELStackFrame( (DroolsThread) getThread(),
- frame,
- depth );
- }
-
public int getLineNumber() throws DebugException {
//if (true) return 9;
@@ -334,9 +273,7 @@
// return -1;
}
- synchronized ( genericLock ) {
- evaluating.incrementAndGet();
- try {
+ synchronized ( getThread() ) {
DroolsDebugTarget t = (DroolsDebugTarget) getDebugTarget();
//int lineNr = getBreakpointLineNumber();
@@ -368,90 +305,60 @@
}
ctx.cacheLineNumber = res;
return res;
- } finally {
- evaluating.decrementAndGet();
- evalEnd();
- }
}
}
- public RuleInfo getExecutingRuleInfo() {
- try {
- String type = getDeclaringTypeName();
-
- return DroolsEclipsePlugin.getDefault().getRuleInfoByClass( type );
-
- } catch ( DebugException exc ) {
- DroolsEclipsePlugin.log( exc );
- }
- return null;
- }
-
- public int getBreakpointLineNumber() {
+ private int getBreakpointLineNumber() {
MVELStackFrameContext ctx = local.get();
if ( ctx.cacheBreakpointLineNumber != -1 ) {
return ctx.cacheBreakpointLineNumber;
}
- if ( !isSuspended() ) {
- System.out.println( "Not suspended!" );
- return -1;
+ // Drools 4
+ try {
+ Object o = getRemoteVar( "lineNumber" );
+ if ( o == null ) {
+ return -1;
+ }
+ IntegerValue val = (IntegerValue) o;
+ int realval = val.value();
+ /* if (realval==-1) {
+ System.out.println("-1!!");
+ }
+ */
+ ctx.cacheBreakpointLineNumber = realval;
+ return realval;
+ } catch ( NullPointerException e ) {
+ // Drools 5+
+ } catch ( Throwable e ) {
+ DroolsEclipsePlugin.log( e );
}
- synchronized ( getThread() ) {
- evaluating.incrementAndGet();
- try {
-
- // Drools 4
- try {
- Object o = getRemoteVar( "lineNumber" );
- if ( o == null ) {
- return -1;
- }
- IntegerValue val = (IntegerValue) o;
- int realval = val.value();
- /* if (realval==-1) {
- System.out.println("-1!!");
- }
- */
- ctx.cacheBreakpointLineNumber = realval;
- return realval;
- } catch ( NullPointerException e ) {
- // Drools 5+
- } catch ( Throwable e ) {
- DroolsEclipsePlugin.log( e );
- }
-
- // Drools 5
- try {
- Object o = getRemoteVar( "label" );
- if ( o == null ) {
- return -1;
- }
- ObjectReference obj = (ObjectReference) o;
- ClassType frameType = (ClassType) obj.type();
- Field field = frameType.fieldByName( "lineNumber" );
- o = obj.getValue( field );
- if ( o == null ) {
- return -1;
- }
- IntegerValue val = (IntegerValue) o;
- int realval = val.value();
- ctx.cacheBreakpointLineNumber = realval;
- return realval;
- } catch ( NullPointerException e ) {
- // Drools 5+
- } catch ( Throwable e ) {
- DroolsEclipsePlugin.log( e );
- }
-
+ // Drools 5
+ try {
+ Object o = getRemoteVar( "label" );
+ if ( o == null ) {
return -1;
- } finally {
- evaluating.decrementAndGet();
- evalEnd();
}
+ ObjectReference obj = (ObjectReference) o;
+ ClassType frameType = (ClassType) obj.type();
+ Field field = frameType.fieldByName( "lineNumber" );
+ o = obj.getValue( field );
+ if ( o == null ) {
+ return -1;
+ }
+ IntegerValue val = (IntegerValue) o;
+ int realval = val.value();
+ ctx.cacheBreakpointLineNumber = realval;
+ return realval;
+ } catch ( NullPointerException e ) {
+ // Drools 5+
+ } catch ( Throwable e ) {
+ DroolsEclipsePlugin.log( e );
}
+
+ return -1;
}
public String getMVELName() {
@@ -465,53 +372,44 @@
return ctx.cacheMVELName;
}
- synchronized ( genericLock ) {
- evaluating.incrementAndGet();
- try {
+ // Drools 4
+ try {
+ Object rem = getRemoteVar( "sourceName" );
+ if ( rem == null ) {
+ return null;
+ }
+ StringReference res = (StringReference) rem;
+ String realres = res.value();
+ ctx.cacheMVELName = realres;
+ return realres;
+ } catch ( NullPointerException e ) {
+ // Drools 5
+ } catch ( Throwable e ) {
+ DroolsEclipsePlugin.log( e );
+ }
- // Drools 4
- try {
- Object rem = getRemoteVar( "sourceName" );
- if ( rem == null ) {
- return null;
- }
- StringReference res = (StringReference) rem;
- String realres = res.value();
- ctx.cacheMVELName = realres;
- return realres;
- } catch ( NullPointerException e ) {
- // Drools 5
- } catch ( Throwable e ) {
- DroolsEclipsePlugin.log( e );
- }
-
- // Drools 5
- try {
- Object rem = getRemoteVar( "label" );
- if ( rem == null ) {
- return null;
- }
- ObjectReference obj = (ObjectReference) rem;
- ClassType frameType = (ClassType) obj.type();
- Field field = frameType.fieldByName( "sourceFile" );
- rem = obj.getValue( field );
- if ( rem == null ) {
- return null;
- }
- StringReference res = (StringReference) rem;
- String realres = res.value();
- ctx.cacheMVELName = realres;
- return realres;
- } catch ( Throwable e ) {
- DroolsEclipsePlugin.log( e );
- }
-
- return "Unavailable";
- } finally {
- evaluating.decrementAndGet();
- evalEnd();
+ // Drools 5
+ try {
+ Object rem = getRemoteVar( "label" );
+ if ( rem == null ) {
+ return null;
}
+ ObjectReference obj = (ObjectReference) rem;
+ ClassType frameType = (ClassType) obj.type();
+ Field field = frameType.fieldByName( "sourceFile" );
+ rem = obj.getValue( field );
+ if ( rem == null ) {
+ return null;
+ }
+ StringReference res = (StringReference) rem;
+ String realres = res.value();
+ ctx.cacheMVELName = realres;
+ return realres;
+ } catch ( Throwable e ) {
+ DroolsEclipsePlugin.log( e );
}
+
+ return "Unavailable";
}
private void evalEnd() {
@@ -559,13 +457,17 @@
return getMVELName();
}
+ public String getSourceName() throws DebugException {
+ return getMVELName();
+ }
+
public boolean canStepInto() {
return false;
}
public boolean canStepOver() {
// while not synchronised, this is thread safe due to the atomic evaluating.
- return exists() && !isObsolete() && evaluating.get() == 0;
+ return exists() && !isObsolete(); //&& evaluating.get() == 0;
}
public boolean canDropToFrame() {
@@ -584,10 +486,6 @@
return REF_TYPE;
}
- public String getSourceName() throws DebugException {
- return getMVELName();
- }
-
protected JDIStackFrame bind(StackFrame frame,
int depth) {
clearCachedData();
@@ -597,19 +495,10 @@
}
protected void clearCachedData() {
- super.clearCachedData();
- if ( local != null ) {
- local.get().clear();
- }
+ // super.clearCachedData();
+ // if ( local != null ) {
+ // local.get().clear();
+ // }
}
- @Override
- public boolean isSuspended() {
- boolean suspended = getThread().isSuspended();
- if ( !suspended ) {
- System.err.println( "NOT SUSPENDED!" );
- }
- return suspended;
- }
-
}
\ No newline at end of file
More information about the jboss-svn-commits
mailing list