diff options
Diffstat (limited to 'ldebug.c')
-rw-r--r-- | ldebug.c | 11 |
1 files changed, 7 insertions, 4 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ldebug.c,v 1.44 2000/10/05 12:14:08 roberto Exp roberto $ | 2 | ** $Id: ldebug.c,v 1.45 2000/10/05 13:00:17 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 | */ |
@@ -92,8 +92,8 @@ static int lua_nups (StkId f) { | |||
92 | 92 | ||
93 | int luaG_getline (int *lineinfo, int pc, int refline, int *prefi) { | 93 | int luaG_getline (int *lineinfo, int pc, int refline, int *prefi) { |
94 | int refi; | 94 | int refi; |
95 | if (lineinfo == NULL) return -1; /* no line info */ | 95 | if (lineinfo == NULL || pc == -1) |
96 | else if (pc == -1) return refline; /* function preamble */ | 96 | return -1; /* no line info or function is not active */ |
97 | refi = prefi ? *prefi : 0; | 97 | refi = prefi ? *prefi : 0; |
98 | if (lineinfo[refi] < 0) | 98 | if (lineinfo[refi] < 0) |
99 | refline += -lineinfo[refi++]; | 99 | refline += -lineinfo[refi++]; |
@@ -124,7 +124,10 @@ int luaG_getline (int *lineinfo, int pc, int refline, int *prefi) { | |||
124 | static int lua_currentpc (StkId f) { | 124 | static int lua_currentpc (StkId f) { |
125 | CallInfo *ci = infovalue(f); | 125 | CallInfo *ci = infovalue(f); |
126 | LUA_ASSERT(isLmark(f), "function has no pc"); | 126 | LUA_ASSERT(isLmark(f), "function has no pc"); |
127 | return (*ci->pc - ci->func->f.l->code) - 1; | 127 | if (ci->pc) |
128 | return (*ci->pc - ci->func->f.l->code) - 1; | ||
129 | else | ||
130 | return -1; /* function is not active */ | ||
128 | } | 131 | } |
129 | 132 | ||
130 | 133 | ||