Lines Matching refs:ldb
77 } ldb; variable
213 if (ldb.active && ldb.step) { in luaPushError()
452 if (ldb.active && ldb.step) { in luaRedisGenericCommand()
602 if (ldb.active && ldb.step) in luaRedisGenericCommand()
741 if (ldb.active) { in luaRedisBreakpointCommand()
742 ldb.luabp = 1; in luaRedisBreakpointCommand()
756 if (!ldb.active) return 0; in luaRedisDebugCommand()
758 sds log = sdscatprintf(sdsempty(),"<debug> line %d: ", ldb.currentline); in luaRedisDebugCommand()
1361 if (server.lua_time_limit > 0 && ldb.active == 0) { in evalGenericCommand()
1364 } else if (ldb.active) { in evalGenericCommand()
1562 ldb.fd = -1; in ldbInit()
1563 ldb.active = 0; in ldbInit()
1564 ldb.logs = listCreate(); in ldbInit()
1565 listSetFreeMethod(ldb.logs,(void (*)(void*))sdsfree); in ldbInit()
1566 ldb.children = listCreate(); in ldbInit()
1567 ldb.src = NULL; in ldbInit()
1568 ldb.lines = 0; in ldbInit()
1569 ldb.cbuf = sdsempty(); in ldbInit()
1583 ldbFlushLog(ldb.logs); in ldbEnable()
1584 ldb.fd = c->fd; in ldbEnable()
1585 ldb.step = 1; in ldbEnable()
1586 ldb.bpcount = 0; in ldbEnable()
1587 ldb.luabp = 0; in ldbEnable()
1588 sdsfree(ldb.cbuf); in ldbEnable()
1589 ldb.cbuf = sdsempty(); in ldbEnable()
1590 ldb.maxlen = LDB_MAX_LEN_DEFAULT; in ldbEnable()
1591 ldb.maxlen_hint_sent = 0; in ldbEnable()
1603 listAddNodeTail(ldb.logs,entry); in ldbLog()
1612 if (ldb.maxlen && sdslen(entry) > ldb.maxlen) { in ldbLogWithMaxLen()
1613 sdsrange(entry,0,ldb.maxlen-1); in ldbLogWithMaxLen()
1618 if (trimmed && ldb.maxlen_hint_sent == 0) { in ldbLogWithMaxLen()
1619 ldb.maxlen_hint_sent = 1; in ldbLogWithMaxLen()
1630 proto = sdscatfmt(proto,"*%i\r\n", (int)listLength(ldb.logs)); in ldbSendLogs()
1631 while(listLength(ldb.logs)) { in ldbSendLogs()
1632 listNode *ln = listFirst(ldb.logs); in ldbSendLogs()
1637 listDelNode(ldb.logs,ln); in ldbSendLogs()
1639 if (write(ldb.fd,proto,sdslen(proto)) == -1) { in ldbSendLogs()
1660 ldb.forked = (c->flags & CLIENT_LUA_DEBUG_SYNC) == 0; in ldbStartSession()
1661 if (ldb.forked) { in ldbStartSession()
1683 listAddNodeTail(ldb.children,(void*)(unsigned long)cp); in ldbStartSession()
1693 anetBlock(NULL,ldb.fd); in ldbStartSession()
1694 anetSendTimeout(NULL,ldb.fd,5000); in ldbStartSession()
1695 ldb.active = 1; in ldbStartSession()
1707 ldb.src = sdssplitlen(srcstring,sdslen(srcstring),"\n",1,&ldb.lines); in ldbStartSession()
1720 if (ldb.forked) { in ldbEndSession()
1730 anetNonBlock(NULL,ldb.fd); in ldbEndSession()
1731 anetSendTimeout(NULL,ldb.fd,0); in ldbEndSession()
1738 sdsfreesplitres(ldb.src,ldb.lines); in ldbEndSession()
1739 ldb.lines = 0; in ldbEndSession()
1740 ldb.active = 0; in ldbEndSession()
1747 listNode *ln = listSearchKey(ldb.children,(void*)(unsigned long)pid); in ldbRemoveChild()
1749 listDelNode(ldb.children,ln); in ldbRemoveChild()
1758 return listLength(ldb.children); in ldbPendingChildren()
1766 listRewind(ldb.children,&li); in ldbKillForkedSessions()
1772 listRelease(ldb.children); in ldbKillForkedSessions()
1773 ldb.children = listCreate(); in ldbKillForkedSessions()
1791 if (idx < 0 || idx >= ldb.lines) return "<out of range source code line>"; in ldbGetSourceLine()
1792 return ldb.src[idx]; in ldbGetSourceLine()
1799 for (j = 0; j < ldb.bpcount; j++) in ldbIsBreakpoint()
1800 if (ldb.bp[j] == line) return 1; in ldbIsBreakpoint()
1808 if (line <= 0 || line > ldb.lines) return 0; in ldbAddBreakpoint()
1809 if (!ldbIsBreakpoint(line) && ldb.bpcount != LDB_BREAKPOINTS_MAX) { in ldbAddBreakpoint()
1810 ldb.bp[ldb.bpcount++] = line; in ldbAddBreakpoint()
1821 for (j = 0; j < ldb.bpcount; j++) { in ldbDelBreakpoint()
1822 if (ldb.bp[j] == line) { in ldbDelBreakpoint()
1823 ldb.bpcount--; in ldbDelBreakpoint()
1824 memmove(ldb.bp+j,ldb.bp+j+1,ldb.bpcount-j); in ldbDelBreakpoint()
1837 if (sdslen(ldb.cbuf) == 0) return NULL; in ldbReplParseCommand()
1841 sds copy = sdsdup(ldb.cbuf); in ldbReplParseCommand()
1885 int current = ldb.currentline == lnum; in ldbLogSourceLine()
1907 for (j = 1; j <= ldb.lines; j++) { in ldbList()
2162 if (ldb.bpcount == 0) { in ldbBreak()
2166 ldbLog(sdscatfmt(sdsempty(),"%i breakpoints set:",ldb.bpcount)); in ldbBreak()
2168 for (j = 0; j < ldb.bpcount; j++) in ldbBreak()
2169 ldbLogSourceLine(ldb.bp[j]); in ldbBreak()
2180 ldb.bpcount = 0; in ldbBreak()
2183 if (ldb.bpcount == LDB_BREAKPOINTS_MAX) { in ldbBreak()
2245 ldb.step = 1; /* Force redis.call() to log. */ in ldbRedis()
2248 ldb.step = 0; /* Disable logging. */ in ldbRedis()
2279 ldb.maxlen_hint_sent = 1; /* User knows about this command. */ in ldbMaxlen()
2281 ldb.maxlen = newval; in ldbMaxlen()
2283 if (ldb.maxlen) { in ldbMaxlen()
2284 … ldbLog(sdscatprintf(sdsempty(),"<value> replies are truncated at %d bytes.",(int)ldb.maxlen)); in ldbMaxlen()
2302 int nread = read(ldb.fd,buf,sizeof(buf)); in ldbRepl()
2306 ldb.step = 0; in ldbRepl()
2307 ldb.bpcount = 0; in ldbRepl()
2310 ldb.cbuf = sdscatlen(ldb.cbuf,buf,nread); in ldbRepl()
2314 sdsfree(ldb.cbuf); in ldbRepl()
2315 ldb.cbuf = sdsempty(); in ldbRepl()
2352 ldb.step = 1; in ldbRepl()
2382 int around = ldb.currentline, ctx = 5; in ldbRepl()
2413 ldb.currentline = ar->currentline; in luaLdbLineHook()
2415 int bp = ldbIsBreakpoint(ldb.currentline) || ldb.luabp; in luaLdbLineHook()
2422 if (ar->event == LUA_HOOKCOUNT && ldb.step == 0 && bp == 0) { in luaLdbLineHook()
2428 ldb.step = 1; in luaLdbLineHook()
2434 if (ldb.step || bp) { in luaLdbLineHook()
2436 if (bp) reason = ldb.luabp ? "redis.breakpoint() called" : in luaLdbLineHook()
2439 ldb.step = 0; in luaLdbLineHook()
2440 ldb.luabp = 0; in luaLdbLineHook()
2443 ldb.currentline, reason)); in luaLdbLineHook()
2444 ldbLogSourceLine(ldb.currentline); in luaLdbLineHook()