Implements the "print" command (without arguments) of the Lua debugger. * Prints all the variables in the current stack frame. */
| 2510 | /* Implements the "print" command (without arguments) of the Lua debugger. |
| 2511 | * Prints all the variables in the current stack frame. */ |
| 2512 | void ldbPrintAll(lua_State *lua) { |
| 2513 | lua_Debug ar; |
| 2514 | int vars = 0; |
| 2515 | |
| 2516 | if (lua_getstack(lua,0,&ar) != 0) { |
| 2517 | const char *name; |
| 2518 | int i = 1; /* Variable index. */ |
| 2519 | while((name = lua_getlocal(lua,&ar,i)) != NULL) { |
| 2520 | i++; |
| 2521 | if (!strstr(name,"(*temporary)")) { |
| 2522 | sds prefix = sdscatprintf(sdsempty(),"<value> %s = ",name); |
| 2523 | ldbLogStackValue(lua,prefix); |
| 2524 | sdsfree(prefix); |
| 2525 | vars++; |
| 2526 | } |
| 2527 | lua_pop(lua,1); |
| 2528 | } |
| 2529 | } |
| 2530 | |
| 2531 | if (vars == 0) { |
| 2532 | ldbLog(sdsnew("No local variables in the current context.")); |
| 2533 | } |
| 2534 | } |
| 2535 | |
| 2536 | /* Implements the break command to list, add and remove breakpoints. */ |
| 2537 | void ldbBreak(sds *argv, int argc) { |
no test coverage detected