From 621b273f6c41ecb9932d978eb6b60eb098fc54a3 Mon Sep 17 00:00:00 2001 From: Yuxiao Mao Date: Thu, 21 Nov 2024 14:52:47 +0100 Subject: [PATCH] Let Hint HPointer also display funRepr pointer --- hld/Eval.hx | 12 ++++++------ hld/Value.hx | 2 +- src/HLAdapter.hx | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/hld/Eval.hx b/hld/Eval.hx index f4c0691..cfaf1ff 100644 --- a/hld/Eval.hx +++ b/hld/Eval.hx @@ -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 ) { @@ -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() : "") + ")"; } } @@ -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); @@ -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; diff --git a/hld/Value.hx b/hld/Value.hx index c65b9ad..205dc51 100644 --- a/hld/Value.hx +++ b/hld/Value.hx @@ -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 } diff --git a/src/HLAdapter.hx b/src/HLAdapter.hx index 6ba8da4..ee92f80 100644 --- a/src/HLAdapter.hx +++ b/src/HLAdapter.hx @@ -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: