Skip to content

Commit

Permalink
Merge PR #145: Improved #halt handling, WebSocket error reporting, ha…
Browse files Browse the repository at this point in the history
…ndling resume
  • Loading branch information
smarr committed May 4, 2017
2 parents ffcfd9b + 603f5e8 commit 3ed3c17
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 5 deletions.
5 changes: 4 additions & 1 deletion src/som/primitives/transactions/AtomicPrim.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.oracle.truffle.api.dsl.GenerateNodeFactory;
import com.oracle.truffle.api.dsl.Specialization;
import com.oracle.truffle.api.instrumentation.StandardTags.StatementTag;
import com.oracle.truffle.api.source.SourceSection;

import som.VM;
Expand Down Expand Up @@ -56,7 +57,9 @@ public final Object atomic(final SClass clazz, final SBlock block) {

@Override
protected boolean isTaggedWithIgnoringEagerness(final Class<?> tag) {
if (tag == Atomic.class || tag == ExpressionBreakpoint.class) {
if (tag == Atomic.class ||
tag == ExpressionBreakpoint.class ||
tag == StatementTag.class) {
return true;
}
return super.isTaggedWith(tag);
Expand Down
2 changes: 1 addition & 1 deletion src/tools/debugger/WebSocketHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public void onMessage(final WebSocket conn, final String message) {
try {
IncommingMessage respond = gson.fromJson(message, IncommingMessage.class);
respond.process(connector, conn);
} catch (Exception ex) {
} catch (Throwable ex) {
VM.errorPrint("Error while processing msg:" + message);
ex.printStackTrace();
}
Expand Down
26 changes: 25 additions & 1 deletion src/tools/debugger/entities/SteppingType.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,23 +46,29 @@ public void process(final Suspension susp) {
STEP_INTO("stepInto", "Step Into", Group.LOCAL_STEPPING, "arrow-down", null) {
@Override
public void process(final Suspension susp) {
startHandleFrameSkip(susp);
susp.getEvent().prepareStepInto(1);
completeHandleFrameSkip(susp);
}
},

@SerializedName("stepOver")
STEP_OVER("stepOver", "Step Over", Group.LOCAL_STEPPING, "arrow-right", null) {
@Override
public void process(final Suspension susp) {
startHandleFrameSkip(susp);
susp.getEvent().prepareStepOver(1);
completeHandleFrameSkip(susp);
}
},

@SerializedName("return")
STEP_RETURN("return", "Return from Method", Group.LOCAL_STEPPING, "arrow-left", null) {
@Override
public void process(final Suspension susp) {
startHandleFrameSkip(susp);
susp.getEvent().prepareStepOut();
completeHandleFrameSkip(susp);
}
},

Expand Down Expand Up @@ -105,7 +111,9 @@ public void process(final Suspension susp) {
},


STEP_TO_RECEIVER_MESSAGE("todo", "todo", Group.ACTOR_STEPPING, "arrow-right", null) { @Override public void process(final Suspension susp) { /* TODO */ } },
STEP_TO_RECEIVER_MESSAGE("todo", "todo", Group.ACTOR_STEPPING, "arrow-right", null) {
@Override public void process(final Suspension susp) { }
},
STEP_TO_PROMISE_RESOLUTION("todo", "todo", Group.ACTOR_STEPPING, "arrow-right", null) { @Override public void process(final Suspension susp) { /* TODO */ } },
STEP_TO_NEXT_MESSAGE("todo", "todo", Group.ACTOR_STEPPING, "arrow-right", null) { @Override public void process(final Suspension susp) { /* TODO */ } },
STEP_RETURN_TO_PROMISE_RESOLUTION("todo", "todo", Group.ACTOR_STEPPING, "arrow-right", null) { @Override public void process(final Suspension susp) { /* TODO */ } };
Expand All @@ -122,10 +130,26 @@ public enum Group {
Group(final String label) { this.label = label; }
}

private static void startHandleFrameSkip(final Suspension susp) {
if (susp.getFrameSkipCount() > 0) {
susp.getEvent().startComposedStepping();
for (int i = 0; i < susp.getFrameSkipCount(); i += 1) {
susp.getEvent().prepareStepOut();
}
}
}

private static void completeHandleFrameSkip(final Suspension susp) {
if (susp.getFrameSkipCount() > 0) {
susp.getEvent().prepareComposedStepping();
}
}

public final String name;
public final String label;
public final Group group;
public final String icon;

public final ActivityType[] forActivities;

/** Tag to identify the source sections at which this step operation makes sense.
Expand Down
2 changes: 1 addition & 1 deletion src/tools/debugger/frontend/Suspension.java
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ public void suspend() {
try {
continueWaiting = tasks.take().execute();
SteppingStrategy strategy = activityThread.getSteppingStrategy();
if (strategy != null) {
if (!continueWaiting && strategy != null) {
strategy.handleResumeExecution(activity);
}

Expand Down

0 comments on commit 3ed3c17

Please sign in to comment.