Skip to content

Commit

Permalink
Let Hint HPointer also display funRepr pointer
Browse files Browse the repository at this point in the history
  • Loading branch information
yuxiaomao committed Nov 21, 2024
1 parent 7112da2 commit 621b273
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions hld/Eval.hx
Original file line number Diff line number Diff line change
Expand Up @@ -932,8 +932,8 @@ class Eval {
default:
"\"" + escape(s) + "\"";
}
case VClosure(f, d, _), VMethod(f, d, _): funStr(f) + "[" + valueStr(d,maxStringRec) + "]";
case VFunction(f,_): funStr(f);
case VClosure(f, d, _), VMethod(f, d, _): funStr(f, v.hint == HPointer) + "[" + valueStr(d,maxStringRec) + "]";
case VFunction(f,_): funStr(f, v.hint == HPointer);
case VArray(_, length, read, _):
var hasDispValue = false;
for( i in 0...length ) {
Expand Down Expand Up @@ -1009,10 +1009,10 @@ class Eval {
}
}

public function funStr( f : FunRepr ) {
public function funStr( f : FunRepr, withAddr : Bool ) {
return switch( f ) {
case FUnknown(p): "fun(" + p.toString() + ")";
case FIndex(i): "fun(" + getFunctionName(i) + ")";
case FIndex(i, p): "fun(" + getFunctionName(i) + ( withAddr ? "@" + p.toString() : "") + ")";
}
}

Expand Down Expand Up @@ -1160,7 +1160,7 @@ class Eval {
var funPtr = readPointer(p.offset(align.ptr));
var hasValue = readI32(p.offset(align.ptr * 2));
var fidx = jit.functionFromAddr(funPtr);
var fval = fidx == null ? FUnknown(funPtr) : FIndex(fidx);
var fval = fidx == null ? FUnknown(funPtr) : FIndex(fidx, funPtr);
if( hasValue == 1 ) {
var value = readVal(p.offset(align.ptr * 3), HDyn);
v = VClosure(fval, value, p);
Expand Down Expand Up @@ -1353,7 +1353,7 @@ class Eval {
return readVal(ptr, t);
case AMethod(v, p, t):
var fidx = jit.functionFromAddr(p);
var fval = fidx == null ? FUnknown(p) : FIndex(fidx);
var fval = fidx == null ? FUnknown(p) : FIndex(fidx, p);
return { v : VMethod(fval,v,p), t : t };
case AEvaled(v):
return v;
Expand Down
2 changes: 1 addition & 1 deletion hld/Value.hx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ enum ValueRepr {

enum FunRepr {
FUnknown( p : Pointer );
FIndex( i : Int );
FIndex( i : Int, p : Pointer );
}

typedef InlinedField = { name : String, addr : Eval.VarAddress }
Expand Down
2 changes: 1 addition & 1 deletion src/HLAdapter.hx
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,7 @@ class HLAdapter extends DebugSession {
}
return { name : name, type : tstr, value : tstr+":"+len + pstr, evaluateName : evalName, variablesReference : allocValue(VValue(value, evalName)), indexedVariables : (len+15)>>4 };
case VClosure(f,context,_):
return { name : name, type : tstr, value : dbg.eval.funStr(f) + pstr, evaluateName : evalName, variablesReference : allocValue(VValue(value, evalName)), indexedVariables : 2 };
return { name : name, type : tstr, value : dbg.eval.funStr(f, value.hint == HPointer) + pstr, evaluateName : evalName, variablesReference : allocValue(VValue(value, evalName)), indexedVariables : 2 };
case VInlined(fields):
return { name : name, type : tstr, value : dbg.eval.valueStr(value), evaluateName : evalName, variablesReference : fields.length == 0 ? 0 : allocValue(VValue(value, evalName)), namedVariables : fields.length };
default:
Expand Down

0 comments on commit 621b273

Please sign in to comment.