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

Function ldbBreak

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

Implements the break command to list, add and remove breakpoints. */

Source from the content-addressed store, hash-verified

2512
2513/* Implements the break command to list, add and remove breakpoints. */
2514void ldbBreak(sds *argv, int argc) {
2515 if (argc == 1) {
2516 if (ldb.bpcount == 0) {
2517 ldbLog(sdsnew("No breakpoints set. Use 'b <line>' to add one."));
2518 return;
2519 } else {
2520 ldbLog(sdscatfmt(sdsempty(),"%i breakpoints set:",ldb.bpcount));
2521 int j;
2522 for (j = 0; j < ldb.bpcount; j++)
2523 ldbLogSourceLine(ldb.bp[j]);
2524 }
2525 } else {
2526 int j;
2527 for (j = 1; j < argc; j++) {
2528 char *arg = argv[j];
2529 long line;
2530 if (!string2l(arg,sdslen(arg),&line)) {
2531 ldbLog(sdscatfmt(sdsempty(),"Invalid argument:'%s'",arg));
2532 } else {
2533 if (line == 0) {
2534 ldb.bpcount = 0;
2535 ldbLog(sdsnew("All breakpoints removed."));
2536 } else if (line > 0) {
2537 if (ldb.bpcount == LDB_BREAKPOINTS_MAX) {
2538 ldbLog(sdsnew("Too many breakpoints set."));
2539 } else if (ldbAddBreakpoint(line)) {
2540 ldbList(line,1);
2541 } else {
2542 ldbLog(sdsnew("Wrong line number."));
2543 }
2544 } else if (line < 0) {
2545 if (ldbDelBreakpoint(-line))
2546 ldbLog(sdsnew("Breakpoint removed."));
2547 else
2548 ldbLog(sdsnew("No breakpoint in the specified line."));
2549 }
2550 }
2551 }
2552 }
2553}
2554
2555/* Implements the Lua debugger "eval" command. It just compiles the user
2556 * passed fragment of code and executes it, showing the result left on

Callers 1

ldbReplFunction · 0.85

Calls 10

ldbLogFunction · 0.85
sdsnewFunction · 0.85
sdscatfmtFunction · 0.85
sdsemptyFunction · 0.85
ldbLogSourceLineFunction · 0.85
string2lFunction · 0.85
sdslenFunction · 0.85
ldbAddBreakpointFunction · 0.85
ldbListFunction · 0.85
ldbDelBreakpointFunction · 0.85

Tested by

no test coverage detected