diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2005-04-14 10:30:47 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2005-04-14 10:30:47 -0300 |
| commit | 8c3c3e769195facf6b8c061f4fab1d86e6606be8 (patch) | |
| tree | 0879acb63f923dc7c073fab0415e83e3038f868a | |
| parent | 04f657c7f892072d7cdc021e9e2635acc086f898 (diff) | |
| download | lua-8c3c3e769195facf6b8c061f4fab1d86e6606be8.tar.gz lua-8c3c3e769195facf6b8c061f4fab1d86e6606be8.tar.bz2 lua-8c3c3e769195facf6b8c061f4fab1d86e6606be8.zip | |
small bug for tail-recursive debugging
| -rw-r--r-- | ldebug.c | 12 |
1 files changed, 6 insertions, 6 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: ldebug.c,v 2.13 2005/04/04 18:12:51 roberto Exp roberto $ | 2 | ** $Id: ldebug.c,v 2.14 2005/04/05 13:41:29 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 | */ |
| @@ -90,15 +90,15 @@ LUA_API int lua_getstack (lua_State *L, int level, lua_Debug *ar) { | |||
| 90 | if (f_isLua(ci)) /* Lua function? */ | 90 | if (f_isLua(ci)) /* Lua function? */ |
| 91 | level -= ci->tailcalls; /* skip lost tail calls */ | 91 | level -= ci->tailcalls; /* skip lost tail calls */ |
| 92 | } | 92 | } |
| 93 | if (level > 0 || ci == L->base_ci) status = 0; /* there is no such level */ | 93 | if (level == 0 && ci > L->base_ci) { /* level found? */ |
| 94 | else if (level < 0) { /* level is of a lost tail call */ | ||
| 95 | status = 1; | 94 | status = 1; |
| 96 | ar->i_ci = 0; | 95 | ar->i_ci = ci - L->base_ci; |
| 97 | } | 96 | } |
| 98 | else { | 97 | else if (level < 0) { /* level is of a lost tail call? */ |
| 99 | status = 1; | 98 | status = 1; |
| 100 | ar->i_ci = ci - L->base_ci; | 99 | ar->i_ci = 0; |
| 101 | } | 100 | } |
| 101 | else status = 0; /* no such level */ | ||
| 102 | lua_unlock(L); | 102 | lua_unlock(L); |
| 103 | return status; | 103 | return status; |
| 104 | } | 104 | } |
