lua-users home
lua-l archive

RE: LUA 5.0 Debugging Problem

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hi Jan-Eric, have a look at this post,
http://lua-users.org/lists/lua-l/2003-09/msg00324.html
I've been including <ldebug.h> and using luaG_inithooks( state ) as a workaround. 
Tai
-----Original Message-----
From: Jan-Eric Duden [mailto:jeduden@whisset.com]
Sent: Saturday, January 10, 2004 3:33 PM
To: Lua list
Subject: LUA 5.0 Debugging Problem
Hi!
While moving LuaIDE to Lua 5.0 I bumped into a weird problem
with the Lua Debugging Hooks.
It seems that the LUA_HOOKLINE event is not called for the first line of
this simple program:
line 1:print("Hello world");
line 2:io.read(1);
Consider lvm.c,v 1.284 2003年04月03日 13:35:34,line 76:
 if (mask & LUA_MASKLINE) {
 CallInfo *ci = L->ci;
 Proto *p = ci_func(ci)->l.p;
 int newline = getline(p, pcRel(*ci->u.l.pc, p));
 if (!L->hookinit) {
 luaG_inithooks(L);
 return;
 }
 lua_assert(ci->state & CI_HASFRAME);
 if (pcRel(*ci->u.l.pc, p) == 0) /* tracing may be starting now? */
 ci->u.l.savedpc = *ci->u.l.pc; /* initialize `savedpc' */
 /* calls linehook when enters a new line or jumps back (loop) */
 if (*ci->u.l.pc <= ci->u.l.savedpc ||
 newline != getline(p, pcRel(ci->u.l.savedpc, p))) {
 luaD_callhook(L, LUA_HOOKLINE, newline);
 ci = L->ci; /* previous call may reallocate `ci' */
 }
 ci->u.l.savedpc = *ci->u.l.pc;
 }
You can see that the very first time the LUA_HOOKLINE event is supposed to
be called,
L->hookinit is false and luaG_inithooks(L); will be called.
My question is why is there a return statement following luaG_inithooks? Is
that a bug ?
I'm not sure if getting rid of the return will fix the bug.
Any suggestions?
Jan-Eric Duden

AltStyle によって変換されたページ (->オリジナル) /