summaryrefslogtreecommitdiff
path: root/ldebug.c
diff options
context:
space:
mode:
Diffstat (limited to 'ldebug.c')
-rw-r--r--ldebug.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/ldebug.c b/ldebug.c
index 209986c5..b9010bea 100644
--- a/ldebug.c
+++ b/ldebug.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ldebug.c,v 2.57 2009/10/13 19:07:40 roberto Exp roberto $ 2** $Id: ldebug.c,v 2.58 2009/11/25 15:27:51 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*/
@@ -34,17 +34,13 @@ static const char *getfuncname (lua_State *L, CallInfo *ci, const char **name);
34 34
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 lua_assert(isLua(ci));
38 return pcRel(ci->u.l.savedpc, ci_func(ci)->l.p); 38 return pcRel(ci->u.l.savedpc, ci_func(ci)->l.p);
39} 39}
40 40
41 41
42static int currentline (CallInfo *ci) { 42static int currentline (CallInfo *ci) {
43 int pc = currentpc(ci); 43 return getfuncline(ci_func(ci)->l.p, currentpc(ci));
44 if (pc < 0)
45 return -1; /* only active lua functions have current-line information */
46 else
47 return getfuncline(ci_func(ci)->l.p, pc);
48} 44}
49 45
50 46
@@ -187,7 +183,7 @@ static int auxgetinfo (lua_State *L, const char *what, lua_Debug *ar,
187 break; 183 break;
188 } 184 }
189 case 'l': { 185 case 'l': {
190 ar->currentline = (ci) ? currentline(ci) : -1; 186 ar->currentline = (ci && isLua(ci)) ? currentline(ci) : -1;
191 break; 187 break;
192 } 188 }
193 case 'u': { 189 case 'u': {