summaryrefslogtreecommitdiff
path: root/ldblib.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2009-11-25 13:27:51 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2009-11-25 13:27:51 -0200
commitb0f2b288a6b860374b9578d4c51329fc9cd43022 (patch)
tree82bacf246458c8f97ec22424ff40832df67a52e5 /ldblib.c
parent2b25489b47ad94e6f970f5d9150937734322f24c (diff)
downloadlua-github-b0f2b288a6b860374b9578d4c51329fc9cd43022.tar.gz
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 'ldblib.c')
-rw-r--r--ldblib.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/ldblib.c b/ldblib.c
index c2294613..ce14d7dc 100644
--- a/ldblib.c
+++ b/ldblib.c
@@ -1,5 +1,5 @@
/*
-** $Id: ldblib.c,v 1.116 2009/11/18 15:50:18 roberto Exp roberto $
+** $Id: ldblib.c,v 1.117 2009/11/24 12:05:44 roberto Exp roberto $
** Interface from Lua to its debug API
** See Copyright Notice in lua.h
*/
@@ -100,7 +100,7 @@ static int db_getinfo (lua_State *L) {
lua_Debug ar;
int arg;
lua_State *L1 = getthread(L, &arg);
- const char *options = luaL_optstring(L, arg+2, "flnSu");
+ const char *options = luaL_optstring(L, arg+2, "flnStu");
if (lua_isnumber(L, arg+1)) {
if (!lua_getstack(L1, (int)lua_tointeger(L, arg+1), &ar)) {
lua_pushnil(L); /* level out of range */
@@ -133,6 +133,10 @@ static int db_getinfo (lua_State *L) {
settabss(L, "name", ar.name);
settabss(L, "namewhat", ar.namewhat);
}
+ if (strchr(options, 't')) {
+ lua_pushboolean(L, ar.istailcall);
+ lua_setfield(L, -2, "istailcall");
+ }
if (strchr(options, 'L'))
treatstackoption(L, L1, "activelines");
if (strchr(options, 'f'))
@@ -232,7 +236,7 @@ static const char KEY_HOOK = 'h';
static void hookf (lua_State *L, lua_Debug *ar) {
static const char *const hooknames[] =
- {"call", "return", "line", "count", "tail return"};
+ {"call", "return", "line", "count", "tail call"};
lua_pushlightuserdata(L, (void *)&KEY_HOOK);
lua_rawget(L, LUA_REGISTRYINDEX);
lua_pushlightuserdata(L, L);