diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2009-11-25 13:27:51 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2009-11-25 13:27:51 -0200 |
commit | b0f2b288a6b860374b9578d4c51329fc9cd43022 (patch) | |
tree | 82bacf246458c8f97ec22424ff40832df67a52e5 /lauxlib.c | |
parent | 2b25489b47ad94e6f970f5d9150937734322f24c (diff) | |
download | lua-b0f2b288a6b860374b9578d4c51329fc9cd43022.tar.gz lua-b0f2b288a6b860374b9578d4c51329fc9cd43022.tar.bz2 lua-b0f2b288a6b860374b9578d4c51329fc9cd43022.zip |
new scheme for debug info about tail calls: no more 'fake' stack entries,
but stack entry knows whether it was tail called
Diffstat (limited to 'lauxlib.c')
-rw-r--r-- | lauxlib.c | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lauxlib.c,v 1.192 2009/09/28 12:36:40 roberto Exp roberto $ | 2 | ** $Id: lauxlib.c,v 1.193 2009/10/05 16:44:33 roberto Exp roberto $ |
3 | ** Auxiliary functions for building Lua libraries | 3 | ** Auxiliary functions for building Lua libraries |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -97,7 +97,7 @@ static void pushfuncname (lua_State *L, lua_Debug *ar) { | |||
97 | lua_remove(L, -2); /* remove name */ | 97 | lua_remove(L, -2); /* remove name */ |
98 | } | 98 | } |
99 | else | 99 | else |
100 | lua_pushliteral(L, "?"); /* C function or tail call */ | 100 | lua_pushliteral(L, "?"); |
101 | } | 101 | } |
102 | else | 102 | else |
103 | lua_pushfstring(L, "function <%s:%d>", ar->short_src, ar->linedefined); | 103 | lua_pushfstring(L, "function <%s:%d>", ar->short_src, ar->linedefined); |
@@ -133,12 +133,14 @@ LUALIB_API void luaL_traceback (lua_State *L, lua_State *L1, | |||
133 | level = numlevels - LEVELS2; /* and skip to last ones */ | 133 | level = numlevels - LEVELS2; /* and skip to last ones */ |
134 | } | 134 | } |
135 | else { | 135 | else { |
136 | lua_getinfo(L1, "Sln", &ar); | 136 | lua_getinfo(L1, "Slnt", &ar); |
137 | lua_pushfstring(L, "\n\t%s:", ar.short_src); | 137 | lua_pushfstring(L, "\n\t%s:", ar.short_src); |
138 | if (ar.currentline > 0) | 138 | if (ar.currentline > 0) |
139 | lua_pushfstring(L, "%d:", ar.currentline); | 139 | lua_pushfstring(L, "%d:", ar.currentline); |
140 | lua_pushliteral(L, " in "); | 140 | lua_pushliteral(L, " in "); |
141 | pushfuncname(L, &ar); | 141 | pushfuncname(L, &ar); |
142 | if (ar.istailcall) | ||
143 | lua_pushliteral(L, "\n\t(...tail calls...)"); | ||
142 | lua_concat(L, lua_gettop(L) - top); | 144 | lua_concat(L, lua_gettop(L) - top); |
143 | } | 145 | } |
144 | } | 146 | } |