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

Function ldbPrintAll

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

Implements the "print" command (without arguments) of the Lua debugger. * Prints all the variables in the current stack frame. */

Source from the content-addressed store, hash-verified

2487/* Implements the "print" command (without arguments) of the Lua debugger.
2488 * Prints all the variables in the current stack frame. */
2489void ldbPrintAll(lua_State *lua) {
2490 lua_Debug ar;
2491 int vars = 0;
2492
2493 if (lua_getstack(lua,0,&ar) != 0) {
2494 const char *name;
2495 int i = 1; /* Variable index. */
2496 while((name = lua_getlocal(lua,&ar,i)) != NULL) {
2497 i++;
2498 if (!strstr(name,"(*temporary)")) {
2499 sds prefix = sdscatprintf(sdsempty(),"<value> %s = ",name);
2500 ldbLogStackValue(lua,prefix);
2501 sdsfree(prefix);
2502 vars++;
2503 }
2504 lua_pop(lua,1);
2505 }
2506 }
2507
2508 if (vars == 0) {
2509 ldbLog(sdsnew("No local variables in the current context."));
2510 }
2511}
2512
2513/* Implements the break command to list, add and remove breakpoints. */
2514void ldbBreak(sds *argv, int argc) {

Callers 1

ldbReplFunction · 0.85

Calls 9

strstrFunction · 0.85
sdscatprintfFunction · 0.85
sdsemptyFunction · 0.85
ldbLogStackValueFunction · 0.85
sdsfreeFunction · 0.85
ldbLogFunction · 0.85
sdsnewFunction · 0.85
lua_getstackFunction · 0.50
lua_getlocalFunction · 0.50

Tested by

no test coverage detected