diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2000-10-06 09:45:25 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2000-10-06 09:45:25 -0300 |
| commit | ad3816d0d15b9e681a39dfe90b78ecd8e68aaec7 (patch) | |
| tree | b79618aaceaa71a89f2dfe4a571d34ed55d78c83 /ldebug.c | |
| parent | 046a3d6173792b7d4d4d26a4e063e2fe383c10a7 (diff) | |
| download | lua-ad3816d0d15b9e681a39dfe90b78ecd8e68aaec7.tar.gz lua-ad3816d0d15b9e681a39dfe90b78ecd8e68aaec7.tar.bz2 lua-ad3816d0d15b9e681a39dfe90b78ecd8e68aaec7.zip | |
luaD_call is more uniform
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 | ||
