Browse Source

fix: call hook pc

Akeit0 7 months ago
parent
commit
069babf8e7
1 changed files with 2 additions and 2 deletions
  1. 2 2
      src/Lua/Runtime/LuaVirtualMachine.Debug.cs

+ 2 - 2
src/Lua/Runtime/LuaVirtualMachine.Debug.cs

@@ -38,7 +38,7 @@ public static partial class LuaVirtualMachine
                 stack.Push("count");
                 stack.Push(LuaValue.Nil);
                 context.Thread.IsInHook = true;
-                var frame = context.Thread.CurrentAccess.CreateCallStackFrame(hook, 2, top, context.Pc);
+                var frame = context.Thread.CurrentAccess.CreateCallStackFrame(hook, 2, top, pc);
                 var access = context.Thread.PushCallStackFrame(frame);
                 var funcContext = new LuaFunctionExecutionContext { Access = access, ArgumentCount = stack.Count - frame.Base, ReturnFrameBase = frame.ReturnBase };
                 await hook.Func(funcContext, context.CancellationToken);
@@ -113,7 +113,7 @@ public static partial class LuaVirtualMachine
 
             stack.Push(LuaValue.Nil);
             context.Thread.IsInHook = true;
-            var frame = context.Thread.CurrentAccess.CreateCallStackFrame(hook, 2, top, context.Thread.GetCurrentFrame().CallerInstructionIndex);
+            var frame = context.Thread.CurrentAccess.CreateCallStackFrame(hook, 2, top, 0);
             var access = context.Thread.PushCallStackFrame(frame);
             var funcContext = new LuaFunctionExecutionContext { Access = access, ArgumentCount = stack.Count - frame.Base, ReturnFrameBase = frame.ReturnBase };
             try