Implements the "print" command (without arguments) of the Lua debugger. * Prints all the variables in the current stack frame. */
| 2487 | /* Implements the "print" command (without arguments) of the Lua debugger. |
| 2488 | * Prints all the variables in the current stack frame. */ |
| 2489 | void 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. */ |
| 2514 | void ldbBreak(sds *argv, int argc) { |
no test coverage detected