diff options
| -rw-r--r-- | ldebug.c | 4 | ||||
| -rw-r--r-- | ldebug.h | 4 | ||||
| -rw-r--r-- | lfunc.c | 5 | ||||
| -rw-r--r-- | ltests.c | 4 | ||||
| -rw-r--r-- | lvm.c | 6 |
5 files changed, 13 insertions, 10 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: ldebug.c,v 1.109 2002/04/22 14:40:23 roberto Exp roberto $ | 2 | ** $Id: ldebug.c,v 1.110 2002/04/24 20:07:46 roberto Exp roberto $ |
| 3 | ** Debug Interface | 3 | ** Debug Interface |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -48,7 +48,7 @@ static int currentline (lua_State *L, CallInfo *ci) { | |||
| 48 | if (pc < 0) | 48 | if (pc < 0) |
| 49 | return -1; /* only active lua functions have current-line information */ | 49 | return -1; /* only active lua functions have current-line information */ |
| 50 | else | 50 | else |
| 51 | return ci_func(ci)->l.p->lineinfo[pc]; | 51 | return getline(ci_func(ci)->l.p, pc); |
| 52 | } | 52 | } |
| 53 | 53 | ||
| 54 | 54 | ||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: ldebug.h,v 1.18 2002/03/25 17:47:14 roberto Exp roberto $ | 2 | ** $Id: ldebug.h,v 1.19 2002/04/10 12:11:07 roberto Exp roberto $ |
| 3 | ** Auxiliary functions from Debug Interface module | 3 | ** Auxiliary functions from Debug Interface module |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -14,6 +14,8 @@ | |||
| 14 | 14 | ||
| 15 | #define pcRel(pc, p) (cast(int, (pc) - (p)->code) - 1) | 15 | #define pcRel(pc, p) (cast(int, (pc) - (p)->code) - 1) |
| 16 | 16 | ||
| 17 | #define getline(f,pc) (((f)->lineinfo) ? (f)->lineinfo[pc] : 0) | ||
| 18 | |||
| 17 | void luaG_typeerror (lua_State *L, const TObject *o, const char *opname); | 19 | void luaG_typeerror (lua_State *L, const TObject *o, const char *opname); |
| 18 | void luaG_concaterror (lua_State *L, StkId p1, StkId p2); | 20 | void luaG_concaterror (lua_State *L, StkId p1, StkId p2); |
| 19 | void luaG_aritherror (lua_State *L, StkId p1, const TObject *p2); | 21 | void luaG_aritherror (lua_State *L, StkId p1, const TObject *p2); |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lfunc.c,v 1.54 2002/03/05 12:42:47 roberto Exp roberto $ | 2 | ** $Id: lfunc.c,v 1.55 2002/03/25 17:47:14 roberto Exp roberto $ |
| 3 | ** Auxiliary functions to manipulate prototypes and closures | 3 | ** Auxiliary functions to manipulate prototypes and closures |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -98,7 +98,8 @@ Proto *luaF_newproto (lua_State *L) { | |||
| 98 | 98 | ||
| 99 | void luaF_freeproto (lua_State *L, Proto *f) { | 99 | void luaF_freeproto (lua_State *L, Proto *f) { |
| 100 | luaM_freearray(L, f->code, f->sizecode, Instruction); | 100 | luaM_freearray(L, f->code, f->sizecode, Instruction); |
| 101 | luaM_freearray(L, f->lineinfo, f->sizecode, int); | 101 | if (f->lineinfo) |
| 102 | luaM_freearray(L, f->lineinfo, f->sizecode, int); | ||
| 102 | luaM_freearray(L, f->locvars, f->sizelocvars, struct LocVar); | 103 | luaM_freearray(L, f->locvars, f->sizelocvars, struct LocVar); |
| 103 | luaM_freearray(L, f->k, f->sizek, TObject); | 104 | luaM_freearray(L, f->k, f->sizek, TObject); |
| 104 | luaM_freearray(L, f->p, f->sizep, Proto *); | 105 | luaM_freearray(L, f->p, f->sizep, Proto *); |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: ltests.c,v 1.117 2002/04/24 20:07:46 roberto Exp roberto $ | 2 | ** $Id: ltests.c,v 1.118 2002/05/01 20:40:42 roberto Exp roberto $ |
| 3 | ** Internal Module for Debugging of the Lua Implementation | 3 | ** Internal Module for Debugging of the Lua Implementation |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -144,7 +144,7 @@ static char *buildop (Proto *p, int pc, char *buff) { | |||
| 144 | Instruction i = p->code[pc]; | 144 | Instruction i = p->code[pc]; |
| 145 | OpCode o = GET_OPCODE(i); | 145 | OpCode o = GET_OPCODE(i); |
| 146 | const char *name = luaP_opnames[o]; | 146 | const char *name = luaP_opnames[o]; |
| 147 | int line = p->lineinfo[pc]; | 147 | int line = getline(p, pc); |
| 148 | sprintf(buff, "(%4d) %4d - ", line, pc); | 148 | sprintf(buff, "(%4d) %4d - ", line, pc); |
| 149 | switch (getOpMode(o)) { | 149 | switch (getOpMode(o)) { |
| 150 | case iABC: | 150 | case iABC: |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lvm.c,v 1.226 2002/04/22 14:40:23 roberto Exp roberto $ | 2 | ** $Id: lvm.c,v 1.227 2002/04/24 20:07:46 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 | */ |
| @@ -65,11 +65,11 @@ int luaV_tostring (lua_State *L, TObject *obj) { | |||
| 65 | static void traceexec (lua_State *L) { | 65 | static void traceexec (lua_State *L) { |
| 66 | CallInfo *ci = L->ci; | 66 | CallInfo *ci = L->ci; |
| 67 | Proto *p = ci_func(ci)->l.p; | 67 | Proto *p = ci_func(ci)->l.p; |
| 68 | int newline = p->lineinfo[pcRel(*ci->pc, p)]; | 68 | int newline = getline(p, pcRel(*ci->pc, p)); |
| 69 | if (pcRel(*ci->pc, p) == 0) /* tracing may be starting now? */ | 69 | if (pcRel(*ci->pc, p) == 0) /* tracing may be starting now? */ |
| 70 | ci->savedpc = *ci->pc; /* initialize `savedpc' */ | 70 | ci->savedpc = *ci->pc; /* initialize `savedpc' */ |
| 71 | /* calls linehook when enters a new line or jumps back (loop) */ | 71 | /* calls linehook when enters a new line or jumps back (loop) */ |
| 72 | if (*ci->pc <= ci->savedpc || newline != p->lineinfo[pcRel(ci->savedpc, p)]) { | 72 | if (*ci->pc <= ci->savedpc || newline != getline(p, pcRel(ci->savedpc, p))) { |
| 73 | luaD_lineHook(L, newline); | 73 | luaD_lineHook(L, newline); |
| 74 | ci = L->ci; /* previous call may reallocate `ci' */ | 74 | ci = L->ci; /* previous call may reallocate `ci' */ |
| 75 | } | 75 | } |
