Skip to content
Snippets Groups Projects
Commit 6cec402c authored by Florian Angerer's avatar Florian Angerer
Browse files

[GR-2738] Enabling conditional breakpoints.

parents 84f5f871 40004450
Branches
No related tags found
No related merge requests found
...@@ -364,7 +364,7 @@ final class REngine implements Engine, Engine.Timings { ...@@ -364,7 +364,7 @@ final class REngine implements Engine, Engine.Timings {
} }
lastValue = calls[i].call(new Object[]{executionFrame != null ? executionFrame : newContext.stateREnvironment.getGlobalFrame()}); lastValue = calls[i].call(new Object[]{executionFrame != null ? executionFrame : newContext.stateREnvironment.getGlobalFrame()});
} }
return lastValue; return RRuntime.r2Java(lastValue);
} catch (ReturnException ex) { } catch (ReturnException ex) {
return ex.getResult(); return ex.getResult();
} catch (DebugExitException | JumpToTopLevelException | ExitException | ThreadDeath e) { } catch (DebugExitException | JumpToTopLevelException | ExitException | ThreadDeath e) {
......
...@@ -308,7 +308,9 @@ public class RCommand { ...@@ -308,7 +308,9 @@ public class RCommand {
private static boolean doEcho(PolyglotEngine vm) { private static boolean doEcho(PolyglotEngine vm) {
PolyglotEngine.Value echoValue = vm.eval(GET_ECHO); PolyglotEngine.Value echoValue = vm.eval(GET_ECHO);
Object echo = echoValue.get(); Object echo = echoValue.get();
if (echo instanceof TruffleObject) { if (echo instanceof Boolean) {
return (boolean) echo;
} else if (echo instanceof TruffleObject) {
RLogicalVector echoVec = echoValue.as(RLogicalVector.class); RLogicalVector echoVec = echoValue.as(RLogicalVector.class);
return RRuntime.fromLogical(echoVec.getDataAt(0)); return RRuntime.fromLogical(echoVec.getDataAt(0));
} else if (echo instanceof Byte) { } else if (echo instanceof Byte) {
......
...@@ -598,11 +598,14 @@ public class DebugHandling { ...@@ -598,11 +598,14 @@ public class DebugHandling {
public void onEnter(EventContext context, VirtualFrame frame) { public void onEnter(EventContext context, VirtualFrame frame) {
if (!RContext.getInstance().stateInstrumentation.debugGloballyDisabled()) { if (!RContext.getInstance().stateInstrumentation.debugGloballyDisabled()) {
CompilerDirectives.transferToInterpreter(); CompilerDirectives.transferToInterpreter();
FunctionDefinitionNode fdn = (FunctionDefinitionNode) context.getInstrumentedNode().getRootNode(); RootNode rootNode = context.getInstrumentedNode().getRootNode();
FunctionStatementsEventListener ensureSingleStep = ensureSingleStep(fdn); if (rootNode instanceof FunctionDefinitionNode) {
FunctionDefinitionNode fdn = (FunctionDefinitionNode) rootNode;
FunctionStatementsEventListener ensureSingleStep = ensureSingleStep(fdn);
functionStatementsEventListener.clearStepInstrument(); functionStatementsEventListener.clearStepInstrument();
ensureSingleStep.onEnter(context, frame); ensureSingleStep.onEnter(context, frame);
}
} }
} }
......
...@@ -24,6 +24,7 @@ package com.oracle.truffle.r.runtime.env; ...@@ -24,6 +24,7 @@ package com.oracle.truffle.r.runtime.env;
import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary; import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
import com.oracle.truffle.api.frame.Frame; import com.oracle.truffle.api.frame.Frame;
import com.oracle.truffle.api.frame.MaterializedFrame;
import com.oracle.truffle.api.interop.ForeignAccess; import com.oracle.truffle.api.interop.ForeignAccess;
import com.oracle.truffle.api.interop.Message; import com.oracle.truffle.api.interop.Message;
import com.oracle.truffle.api.interop.MessageResolution; import com.oracle.truffle.api.interop.MessageResolution;
...@@ -137,8 +138,16 @@ public final class RScope extends AbstractScope { ...@@ -137,8 +138,16 @@ public final class RScope extends AbstractScope {
return new RScope(node.getRootNode(), getEnv(frame)); return new RScope(node.getRootNode(), getEnv(frame));
} }
private static Object getInteropValue(Object value) { /**
return value; * Explicitly convert some known types to interop types.
*/
private static Object getInteropValue(Object obj) {
if (obj instanceof Frame) {
MaterializedFrame materialized = ((Frame) obj).materialize();
assert RArguments.isRFrame(materialized);
return REnvironment.frameToEnvironment(materialized);
}
return obj;
} }
static final class VariablesMapObject implements TruffleObject { static final class VariablesMapObject implements TruffleObject {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment