MCPcopy Create free account
hub / github.com/F-Stack/f-stack / ldbTrace

Function ldbTrace

app/redis-6.2.6/src/scripting.c:2621–2638  ·  view source on GitHub ↗

Implements "trace" command of the Lua debugger. It just prints a backtrace * querying Lua starting from the current callframe back to the outer one. */

Source from the content-addressed store, hash-verified

2619/* Implements "trace" command of the Lua debugger. It just prints a backtrace
2620 * querying Lua starting from the current callframe back to the outer one. */
2621void ldbTrace(lua_State *lua) {
2622 lua_Debug ar;
2623 int level = 0;
2624
2625 while(lua_getstack(lua,level,&ar)) {
2626 lua_getinfo(lua,"Snl",&ar);
2627 if(strstr(ar.short_src,"user_script") != NULL) {
2628 ldbLog(sdscatprintf(sdsempty(),"%s %s:",
2629 (level == 0) ? "In" : "From",
2630 ar.name ? ar.name : "top level"));
2631 ldbLogSourceLine(ar.currentline);
2632 }
2633 level++;
2634 }
2635 if (level == 0) {
2636 ldbLog(sdsnew("<error> Can't retrieve Lua stack."));
2637 }
2638}
2639
2640/* Implements the debugger "maxlen" command. It just queries or sets the
2641 * ldb.maxlen variable. */

Callers 1

ldbReplFunction · 0.85

Calls 8

strstrFunction · 0.85
ldbLogFunction · 0.85
sdscatprintfFunction · 0.85
sdsemptyFunction · 0.85
ldbLogSourceLineFunction · 0.85
sdsnewFunction · 0.85
lua_getstackFunction · 0.50
lua_getinfoFunction · 0.50

Tested by

no test coverage detected