aboutsummaryrefslogtreecommitdiff
path: root/lvm.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2002-04-10 09:11:07 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2002-04-10 09:11:07 -0300
commit6c7334a9ac4b424a4fd52bfeb4d674bc7cfa4eb3 (patch)
treef6e3f9fb0bdbf3169426798b12391f8355d52432 /lvm.c
parent8e1e61860643baeb443efcdbf51bc25b0c006a88 (diff)
downloadlua-6c7334a9ac4b424a4fd52bfeb4d674bc7cfa4eb3.tar.gz
lua-6c7334a9ac4b424a4fd52bfeb4d674bc7cfa4eb3.tar.bz2
lua-6c7334a9ac4b424a4fd52bfeb4d674bc7cfa4eb3.zip
line trace uses `savedpc' to save last `pc' seen
Diffstat (limited to 'lvm.c')
-rw-r--r--lvm.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/lvm.c b/lvm.c
index bb1b9852..9079b32b 100644
--- a/lvm.c
+++ b/lvm.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lvm.c,v 1.223 2002/03/25 17:47:14 roberto Exp roberto $ 2** $Id: lvm.c,v 1.224 2002/04/09 19:47:44 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*/
@@ -64,15 +64,16 @@ int luaV_tostring (lua_State *L, TObject *obj) {
64 64
65static void traceexec (lua_State *L) { 65static void traceexec (lua_State *L) {
66 CallInfo *ci = L->ci; 66 CallInfo *ci = L->ci;
67 int *lineinfo = ci_func(ci)->l.p->lineinfo; 67 Proto *p = ci_func(ci)->l.p;
68 int pc = cast(int, *ci->pc - ci_func(ci)->l.p->code) - 1; 68 int newline = p->lineinfo[pcRel(*ci->pc, p)];
69 int newline = lineinfo[pc]; 69 if (pcRel(*ci->pc, p) == 0) /* tracing may be starting now? */
70 if (pc == 0) /* tracing may be starting now? */ 70 ci->savedpc = *ci->pc; /* initialize `savedpc' */
71 ci->lastpc = 0; /* initialize `lastpc' */
72 /* calls linehook when enters a new line or jumps back (loop) */ 71 /* calls linehook when enters a new line or jumps back (loop) */
73 if (pc <= ci->lastpc || newline != lineinfo[ci->lastpc]) 72 if (*ci->pc <= ci->savedpc || newline != p->lineinfo[pcRel(ci->savedpc, p)]) {
74 luaD_lineHook(L, newline); 73 luaD_lineHook(L, newline);
75 L->ci->lastpc = pc; 74 ci = L->ci; /* previous call may reallocate `ci' */
75 }
76 ci->savedpc = *ci->pc;
76} 77}
77 78
78 79