Skip to content

Commit

Permalink
evalCall prevent singlestep, which can remove our breakpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
yuxiaomao committed Jun 18, 2024
1 parent fc4cc29 commit efd35a5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
3 changes: 2 additions & 1 deletion hld/Debugger.hx
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ class Debugger {
this.api = api;
eval = new Eval(module, api, jit);
eval.resumeDebug = evalResumeDebug;
eval.setSingleStep = singleStep;
if( !api.start() )
return false;
wait(); // wait first break
Expand Down Expand Up @@ -289,7 +290,7 @@ class Debugger {
while( true ) {
cmd = api.wait(customTimeout == null ? 1000 : Math.ceil(customTimeout * 1000));

if( cmd.r == Breakpoint && (nextStep >= 0 || onStep) ) {
if( cmd.r == Breakpoint && !onEvalCall && (nextStep >= 0 || onStep) ) {
// On Linux, singlestep is not reset
cmd.r = SingleStep;
singleStep(cmd.tid,false);
Expand Down
9 changes: 9 additions & 0 deletions hld/Eval.hx
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,12 @@ class Eval {
if( !api.write(eip, buffer, asmSize) )
throw "assert";
api.flush(eip, asmSize);
var isSingleStep = (api.readRegister(currentThread, EFlags).toInt() & 256) == 256;
if( isSingleStep )
setSingleStep(currentThread, false);
resumeDebug();
if( isSingleStep )
setSingleStep(currentThread, true);
// restore
api.write(eip, prevAsm, asmSize);
api.flush(eip, asmSize);
Expand All @@ -509,6 +514,10 @@ class Eval {
throw "Not implemented";
}

public dynamic function setSingleStep(tid : Int, set : Bool) {
throw "Not implemented";
}

function getNum( v : Value ) : Float {
return switch( v.v ) {
case VInt(i): i;
Expand Down

0 comments on commit efd35a5

Please sign in to comment.