aboutsummaryrefslogtreecommitdiff
path: root/ldo.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2002-06-18 14:42:52 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2002-06-18 14:42:52 -0300
commiteec0905173702423569222bfabae1eb0500b4626 (patch)
tree03f6d4f64b94685de10c6df72e810b63cf994bc6 /ldo.c
parenta44f37513becb25d0595df1e714851870b50b6dd (diff)
downloadlua-eec0905173702423569222bfabae1eb0500b4626.tar.gz
lua-eec0905173702423569222bfabae1eb0500b4626.tar.bz2
lua-eec0905173702423569222bfabae1eb0500b4626.zip
better tests (assertions) for debug hooks
Diffstat (limited to 'ldo.c')
-rw-r--r--ldo.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/ldo.c b/ldo.c
index e9bd41ae..be9b3d4d 100644
--- a/ldo.c
+++ b/ldo.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ldo.c,v 1.180 2002/06/18 15:19:27 roberto Exp roberto $ 2** $Id: ldo.c,v 1.181 2002/06/18 17:10:43 roberto Exp roberto $
3** Stack and Call structure of Lua 3** Stack and Call structure of Lua
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -138,6 +138,7 @@ static void luaD_openstack (lua_State *L, StkId pos) {
138static void dohook (lua_State *L, lua_Debug *ar, lua_Hook hook) { 138static void dohook (lua_State *L, lua_Debug *ar, lua_Hook hook) {
139 ptrdiff_t top = savestack(L, L->top); 139 ptrdiff_t top = savestack(L, L->top);
140 ptrdiff_t ci_top = savestack(L, L->ci->top); 140 ptrdiff_t ci_top = savestack(L, L->ci->top);
141 ar->i_ci = L->ci - L->base_ci;
141 luaD_checkstack(L, LUA_MINSTACK); /* ensure minimum stack size */ 142 luaD_checkstack(L, LUA_MINSTACK); /* ensure minimum stack size */
142 L->ci->top = L->top + LUA_MINSTACK; 143 L->ci->top = L->top + LUA_MINSTACK;
143 L->allowhooks = 0; /* cannot call hooks inside a hook */ 144 L->allowhooks = 0; /* cannot call hooks inside a hook */
@@ -155,7 +156,6 @@ void luaD_lineHook (lua_State *L, int line) {
155 if (L->allowhooks) { 156 if (L->allowhooks) {
156 lua_Debug ar; 157 lua_Debug ar;
157 ar.event = "line"; 158 ar.event = "line";
158 ar.i_ci = L->ci - L->base_ci;
159 ar.currentline = line; 159 ar.currentline = line;
160 dohook(L, &ar, L->linehook); 160 dohook(L, &ar, L->linehook);
161 } 161 }
@@ -166,7 +166,6 @@ static void luaD_callHook (lua_State *L, lua_Hook callhook, const char *event) {
166 if (L->allowhooks) { 166 if (L->allowhooks) {
167 lua_Debug ar; 167 lua_Debug ar;
168 ar.event = event; 168 ar.event = event;
169 ar.i_ci = L->ci - L->base_ci;
170 L->ci->pc = NULL; /* function is not active */ 169 L->ci->pc = NULL; /* function is not active */
171 L->ci->top = L->ci->base; /* `top' may not have a valid value yet */ 170 L->ci->top = L->ci->base; /* `top' may not have a valid value yet */
172 dohook(L, &ar, callhook); 171 dohook(L, &ar, callhook);