summaryrefslogtreecommitdiff
path: root/ldebug.c
diff options
context:
space:
mode:
Diffstat (limited to 'ldebug.c')
-rw-r--r--ldebug.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/ldebug.c b/ldebug.c
index 044eb57f..9fca89ec 100644
--- a/ldebug.c
+++ b/ldebug.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ldebug.c,v 2.4 2004/04/30 20:13:38 roberto Exp roberto $ 2** $Id: ldebug.c,v 2.5 2004/05/31 18:51:50 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*/
@@ -35,7 +35,7 @@ static const char *getfuncname (CallInfo *ci, const char **name);
35 35
36static int currentpc (CallInfo *ci) { 36static int currentpc (CallInfo *ci) {
37 if (!isLua(ci)) return -1; /* function is not a Lua function? */ 37 if (!isLua(ci)) return -1; /* function is not a Lua function? */
38 return pcRel(ci->u.l.savedpc, ci_func(ci)->l.p); 38 return pcRel(ci->savedpc, ci_func(ci)->l.p);
39} 39}
40 40
41 41
@@ -86,7 +86,7 @@ LUA_API int lua_getstack (lua_State *L, int level, lua_Debug *ar) {
86 for (ci = L->ci; level > 0 && ci > L->base_ci; ci--) { 86 for (ci = L->ci; level > 0 && ci > L->base_ci; ci--) {
87 level--; 87 level--;
88 if (f_isLua(ci)) /* Lua function? */ 88 if (f_isLua(ci)) /* Lua function? */
89 level -= ci->u.l.tailcalls; /* skip lost tail calls */ 89 level -= ci->tailcalls; /* skip lost tail calls */
90 } 90 }
91 if (level > 0 || ci == L->base_ci) status = 0; /* there is no such level */ 91 if (level > 0 || ci == L->base_ci) status = 0; /* there is no such level */
92 else if (level < 0) { /* level is of a lost tail call */ 92 else if (level < 0) { /* level is of a lost tail call */
@@ -255,8 +255,9 @@ static int precheck (const Proto *pt) {
255} 255}
256 256
257 257
258static int checkopenop (const Proto *pt, int pc) { 258#define checkopenop(pt,pc) luaG_checkopenop((pt)->code[(pc)+1])
259 Instruction i = pt->code[pc+1]; 259
260int luaG_checkopenop (Instruction i) {
260 switch (GET_OPCODE(i)) { 261 switch (GET_OPCODE(i)) {
261 case OP_CALL: 262 case OP_CALL:
262 case OP_TAILCALL: 263 case OP_TAILCALL:
@@ -487,7 +488,7 @@ static const char *getobjname (CallInfo *ci, int stackpos, const char **name) {
487 488
488static const char *getfuncname (CallInfo *ci, const char **name) { 489static const char *getfuncname (CallInfo *ci, const char **name) {
489 Instruction i; 490 Instruction i;
490 if ((isLua(ci) && ci->u.l.tailcalls > 0) || !isLua(ci - 1)) 491 if ((isLua(ci) && ci->tailcalls > 0) || !isLua(ci - 1))
491 return NULL; /* calling function is not Lua (or is unknown) */ 492 return NULL; /* calling function is not Lua (or is unknown) */
492 ci--; /* calling function */ 493 ci--; /* calling function */
493 i = ci_func(ci)->l.p->code[currentpc(ci)]; 494 i = ci_func(ci)->l.p->code[currentpc(ci)];