diff options
Diffstat (limited to 'ldebug.c')
| -rw-r--r-- | ldebug.c | 14 |
1 files changed, 8 insertions, 6 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: ldebug.c,v 1.128 2002/08/06 18:01:50 roberto Exp roberto $ | 2 | ** $Id: ldebug.c,v 1.129 2002/08/07 14:35:55 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 | */ |
| @@ -28,14 +28,16 @@ | |||
| 28 | static const char *getfuncname (CallInfo *ci, const char **name); | 28 | static const char *getfuncname (CallInfo *ci, const char **name); |
| 29 | 29 | ||
| 30 | 30 | ||
| 31 | static int isLua (CallInfo *ci) { | 31 | #define isLua(ci) (!((ci)->state & CI_C)) |
| 32 | return isLfunction (ci->base - 1); | 32 | |
| 33 | } | ||
| 34 | 33 | ||
| 35 | static int currentpc (CallInfo *ci) { | 34 | static int currentpc (CallInfo *ci) { |
| 36 | if (!isLua(ci)) return -1; /* function is not a Lua function? */ | 35 | if (!isLua(ci)) return -1; /* function is not a Lua function? */ |
| 37 | if (ci->pc != &luaV_callingmark) /* is not calling another Lua function? */ | 36 | if (!(ci->state & CI_SAVEDPC)) { /* savedpc outdated? */ |
| 38 | ci->u.l.savedpc = *ci->pc; /* `pc' may not be saved; save it */ | 37 | lua_assert(ci->state & CI_HASFRAME); |
| 38 | ci->u.l.savedpc = *ci->u.l.pc; | ||
| 39 | ci->state |= CI_SAVEDPC; | ||
| 40 | } | ||
| 39 | /* function's pc is saved */ | 41 | /* function's pc is saved */ |
| 40 | return pcRel(ci->u.l.savedpc, ci_func(ci)->l.p); | 42 | return pcRel(ci->u.l.savedpc, ci_func(ci)->l.p); |
| 41 | } | 43 | } |
