Skip to content

Commit

Permalink
Better error message when evalCall with string literal
Browse files Browse the repository at this point in the history
  • Loading branch information
yuxiaomao committed Oct 11, 2024
1 parent fec14da commit 2e579e6
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions hld/Eval.hx
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,13 @@ class Eval {
var v = haxe.io.FPHelper.doubleToI64(f);
setReg(r, Pointer.make(v.low, v.high));
case _ if( v.t.isPtr() ):
setReg(r, getPtr(v));
var ptr = getPtr(v);
if( ptr.isNull() ) {
var msg = "Unsupported arg "+valueStr(v)+":"+typeStr(v.t);
msg += v.v.match(VString(_)) ? " literal" : " null pointer";
throw msg;
}
setReg(r, ptr);
default:
throw "Unsupported arg "+valueStr(v)+":"+typeStr(v.t);
}
Expand Down Expand Up @@ -513,8 +519,11 @@ class Eval {
api.writeRegister(currentThread, Eip, eip);
api.writeRegister(currentThread, Esp, prevEsp);
var hasError = nip != asmSize;
if( hasError )
if( hasError ) {
if( Debugger.DEBUG || printEvalCall )
trace("EVAL Exception has occured");
throw "Exception has occured";
}
return convertVal(ptr, tret);
}

Expand Down

0 comments on commit 2e579e6

Please sign in to comment.