lua-users home
lua-l archive

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


Hmm... sent this email already... but it didn't seem to have made its way to the mailing list... well, here it is again:

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: John Paquin [mailto:jpaquin@breakawaygames.com]
Sent: Monday, January 12, 2004 8:52 AM
To: Lua list
Subject: RE: LUA 5.0 Debugging Problem


I hit this same problem.

Being lazy, however, I avoided it by putting something bogus on the first
line of each file.

If your solution works, let us know please!

Thanks.

-----Original Message-----
From: lua-bounces@bazar2.conectiva.com.br
[mailto:lua-bounces@bazar2.conectiva.com.br]On Behalf Of Jan-Eric Duden
Sent: Saturday, January 10, 2004 6: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