diff options
Diffstat (limited to 'lvm.c')
-rw-r--r-- | lvm.c | 18 |
1 files changed, 12 insertions, 6 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lvm.c,v 1.119 2000/06/28 20:20:36 roberto Exp roberto $ | 2 | ** $Id: lvm.c,v 1.120 2000/06/30 14:35:17 roberto Exp roberto $ |
3 | ** Lua virtual machine | 3 | ** Lua virtual machine |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -69,14 +69,20 @@ int luaV_tostring (lua_State *L, TObject *obj) { /* LUA_NUMBER */ | |||
69 | 69 | ||
70 | static void traceexec (lua_State *L, StkId base, StkId top, lua_Hook linehook) { | 70 | static void traceexec (lua_State *L, StkId base, StkId top, lua_Hook linehook) { |
71 | CallInfo *ci = infovalue(base-1); | 71 | CallInfo *ci = infovalue(base-1); |
72 | int *lines = ci->func->f.l->lines; | 72 | int *lineinfo = ci->func->f.l->lineinfo; |
73 | int pc = (*ci->pc - 1) - ci->func->f.l->code; | 73 | int pc = (*ci->pc - 1) - ci->func->f.l->code; |
74 | if (lines) { | 74 | if (lineinfo) { |
75 | int newline; | ||
76 | if (ci->line == 0) { /* first time? */ | ||
77 | ci->line = 1; | ||
78 | ci->refi = 0; | ||
79 | } | ||
80 | newline = luaG_getline(lineinfo, pc, ci->line, &ci->refi); | ||
75 | /* calls linehook when enters a new line or jumps back (loop) */ | 81 | /* calls linehook when enters a new line or jumps back (loop) */ |
76 | if (lines[pc] != ci->line || pc <= ci->lastpc) { | 82 | if (newline != ci->line || pc <= ci->lastpc) { |
77 | ci->line = lines[pc]; | 83 | ci->line = newline; |
78 | L->top = top; | 84 | L->top = top; |
79 | luaD_lineHook(L, base-2, lines[pc], linehook); | 85 | luaD_lineHook(L, base-2, newline, linehook); |
80 | } | 86 | } |
81 | } | 87 | } |
82 | ci->lastpc = pc; | 88 | ci->lastpc = pc; |