Skip to content

Commit

Permalink
Improved MicroDebugger trigger detection
Browse files Browse the repository at this point in the history
  • Loading branch information
lvcabral committed Nov 30, 2023
1 parent f7abf9b commit 54f60d3
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/interpreter/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1025,8 +1025,6 @@ export class Interpreter implements Expr.Visitor<BrsType>, Stmt.Visitor<BrsType>
this._lastDotGetAA = this.environment.getRootM();
}

this.checkBreakCommand();

return this.inSubEnv((subInterpreter) => {
subInterpreter.environment.setM(mPointer);
let funcLoc = callee.getLocation();
Expand Down Expand Up @@ -1657,7 +1655,7 @@ export class Interpreter implements Expr.Visitor<BrsType>, Stmt.Visitor<BrsType>
}

execute(this: Interpreter, statement: Stmt.Statement): BrsType {
if (this.debugMode) {
if (this.checkBreakCommand()) {
if (!(statement instanceof Stmt.Block)) {
if (!runDebugger(this, statement.location, this._prevLoc)) {
throw new BlockEnd("debug-exit", statement.location);
Expand All @@ -1676,10 +1674,12 @@ export class Interpreter implements Expr.Visitor<BrsType>, Stmt.Visitor<BrsType>
}

checkBreakCommand(): boolean {
const cmd = Atomics.load(this.sharedArray, this.type.DBG);
if (cmd === debugCommand.BREAK) {
Atomics.store(this.sharedArray, this.type.DBG, -1);
this.debugMode = true;
if (!this.debugMode) {
const cmd = Atomics.load(this.sharedArray, this.type.DBG);
if (cmd === debugCommand.BREAK) {
Atomics.store(this.sharedArray, this.type.DBG, -1);
this.debugMode = true;
}
}
return this.debugMode;
}
Expand Down

0 comments on commit 54f60d3

Please sign in to comment.