Skip to content

Commit

Permalink
Enable pause requests again (closes #6)
Browse files Browse the repository at this point in the history
  • Loading branch information
Gama11 committed Mar 12, 2017
1 parent 60f6478 commit d35a0e5
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 9 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
### 1.1.0 (to be released)

- added support for pause requests ([#6](https://github.com/vshaxe/vshaxe-debugadapter/issues/6))

### 1.0.3 (February 20, 2017)

- `JAVA_HOME` is now used if defined
Expand Down
23 changes: 15 additions & 8 deletions src/fdbAdapter/Parser.hx
Original file line number Diff line number Diff line change
Expand Up @@ -42,35 +42,42 @@ class Parser implements vshaxeDebug.IParser {
}

public function parseStackTrace(lines:Array<String>, pathProvider:String -> String):Array<StackFrame> {
var result = [];
function maybeAddSource(frame:StackFrame, name:String) {
if (name != "<null>") {
frame.source = { name : name, path : pathProvider(name)};
}
}

var result:Array<StackFrame> = [];
var rMethod = ~/#([0-9]+)\s+this = \[Object [0-9]+, class='(.+)'\]\.(.+)\(.*\) at (.*):([0-9]+).*/;
var anonFunction = ~/#([0-9]+)\s+this = \[Function [0-9]+, name='(.*)'\]\.([a-zA-Z0-9\/\$<>]+).*\) at (.*):([0-9]+).*/;
var globalCall = ~/#([0-9]+)\s+(.*)\(\) at (.*):([0-9]+)/;
for (l in lines) {
if (rMethod.match(l)) {
result.push({
var frame = {
id : Std.parseInt(rMethod.matched(1)),
name : rMethod.matched(2) + "." + rMethod.matched(3),
line : Std.parseInt( rMethod.matched(5)),
source : { name : rMethod.matched(4), path : pathProvider(rMethod.matched(4))},
column : 0
});
};
maybeAddSource(frame, rMethod.matched(4));
result.push(frame);
}
else if (anonFunction.match(l)) {
result.push({
var frame = {
id : Std.parseInt(anonFunction.matched(1)),
name : anonFunction.matched(2) + "." + anonFunction.matched(3),
line : Std.parseInt( anonFunction.matched(5)),
source : { name : anonFunction.matched(4), path : pathProvider(anonFunction.matched(4))},
column : 0
});
};
maybeAddSource(frame, anonFunction.matched(4));
result.push(frame);
}
else if (globalCall.match(l)) {
result.push({
id : Std.parseInt(globalCall.matched(1)),
name : globalCall.matched(2),
line : Std.parseInt( globalCall.matched(4)),
source : { path : "global", name: "global"},
column : 0
});
}
Expand Down
6 changes: 5 additions & 1 deletion src/vshaxeDebug/BaseAdapter.hx
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,11 @@ class BaseAdapter extends adapter.DebugSession {
}

override function pauseRequest(response:PauseResponse, args:PauseArguments) {
context.sendError(response, "Haxe Debug does not support pause requests for now");
debugger.queueSend(cmd.pause(), function(_):Bool {
sendResponse(response);
context.onEvent(Stop(StopReason.pause));
return true;
});
}

override function disconnectRequest(response:DisconnectResponse, args:DisconnectArguments) {
Expand Down

0 comments on commit d35a0e5

Please sign in to comment.