[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Potential bug in Lua when hooking functions
- From: Rob Kendrick <lua-l@...>
- Date: Mon, 20 Jul 2009 14:47:40 +0100
On Mon, 20 Jul 2009 14:37:22 +0100
Jonathan Shaw <Jonathan.Shaw@microsoft.com> wrote:
> Forgive my ignorance, but how would a traditional diff be best
> displayed in a text only format?
Traditionally, using the diff tool. For your patch, it generates the
following;
diff -aru lua-5.1.4/src/lvm.c lua-5.1.4-yeild-fix/src/lvm.c
--- lua-5.1.4/src/lvm.c 2009-03-20 18:03:04.517261443 +0000
+++ lua-5.1.4-yeild-fix/src/lvm.c 2009-07-20 14:44:18.067091491
+0100 @@ -616,11 +616,14 @@
StkId ra;
if ((L->hookmask & (LUA_MASKLINE | LUA_MASKCOUNT)) &&
(--L->hookcount == 0 || L->hookmask & LUA_MASKLINE)) {
+ const lu_byte saved_status = L->status;
+ L->status = 0;
traceexec(L, pc);
if (L->status == LUA_YIELD) { /* did hook yield? */
L->savedpc = pc - 1;
return;
}
+ L->status = saved_status;
base = L->base;
}
/* warning!! several calls may realloc the stack and invalidate `ra' */
(Incidentally, in my copy of Lua 5.1.4, this region starts around line
620, not on line 388; have you modified your copy of Lua in other ways?)
B.