summaryrefslogtreecommitdiff
path: root/ldblib.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2003-02-27 08:52:30 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2003-02-27 08:52:30 -0300
commit92f6e0c1bfb27cad95d99e99912e2e0c509dcc30 (patch)
tree1ab713c16652a5a4e667457041ce7364256a6b2c /ldblib.c
parent5cd99b82b7fc11c527929e5e95f03767f6432d8e (diff)
downloadlua-92f6e0c1bfb27cad95d99e99912e2e0c509dcc30.tar.gz
lua-92f6e0c1bfb27cad95d99e99912e2e0c509dcc30.tar.bz2
lua-92f6e0c1bfb27cad95d99e99912e2e0c509dcc30.zip
no-nonsense debug information about tail calls
Diffstat (limited to 'ldblib.c')
-rw-r--r--ldblib.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/ldblib.c b/ldblib.c
index bef81bdd..9bffa2c8 100644
--- a/ldblib.c
+++ b/ldblib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ldblib.c,v 1.76 2002/12/19 11:11:55 roberto Exp roberto $ 2** $Id: ldblib.c,v 1.77 2002/12/20 10:26:33 roberto Exp roberto $
3** Interface from Lua to its debug API 3** Interface from Lua to its debug API
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -137,7 +137,8 @@ static const char KEY_HOOK = 'h';
137 137
138 138
139static void hookf (lua_State *L, lua_Debug *ar) { 139static void hookf (lua_State *L, lua_Debug *ar) {
140 static const char *const hooknames[] = {"call", "return", "line", "count"}; 140 static const char *const hooknames[] =
141 {"call", "return", "line", "count", "tail return"};
141 lua_pushlightuserdata(L, (void *)&KEY_HOOK); 142 lua_pushlightuserdata(L, (void *)&KEY_HOOK);
142 lua_rawget(L, LUA_REGISTRYINDEX); 143 lua_rawget(L, LUA_REGISTRYINDEX);
143 if (lua_isfunction(L, -1)) { 144 if (lua_isfunction(L, -1)) {
@@ -259,8 +260,8 @@ static int errorfb (lua_State *L) {
259 default: { 260 default: {
260 if (*ar.what == 'm') /* main? */ 261 if (*ar.what == 'm') /* main? */
261 lua_pushfstring(L, " in main chunk"); 262 lua_pushfstring(L, " in main chunk");
262 else if (*ar.what == 'C') /* C function? */ 263 else if (*ar.what == 'C' || *ar.what == 't')
263 lua_pushfstring(L, "%s", ar.short_src); 264 lua_pushliteral(L, " ?"); /* C function or tail call */
264 else 265 else
265 lua_pushfstring(L, " in function <%s:%d>", 266 lua_pushfstring(L, " in function <%s:%d>",
266 ar.short_src, ar.linedefined); 267 ar.short_src, ar.linedefined);