Skip to content

Procedure Debugger

Val edited this page Sep 13, 2016 · 2 revisions

proc-dbg-lanucher is an utility that translates RedisClient procedures into debuggeable LUA scripts, and launches a debugging session with the Redis LUA script debugger.

Source code available here.

The syntax is similar to LUA script debugger:

Usage proc-dbg-launcher [OPTIONS]
        -h <hostname>       Server hostname (default: 127.0.0.1).
        -p <port>           Server port (default: 6379).
        -s <socket>         Server socket (overrides hostname and port).
        -a <password>       Password to use when connecting to the server.
        --sync-mode         Uses the synchronous Lua debugger, in
                            this mode the server is blocked and script changes are
                            are not rolled back from the server memory.
        --help              Output this help and exit.
        --version           Output version and exit.

        --file <filename>   Name of the file with the procedure/s.
        --procedure <proc>  Name of the procedure to execute.
        --@<name> <value>   Name and value for a parameter.
                            Parameter values can contain arrays using square brackets.

Examples:
  --file test.rcproc --procedure ZPagination --@zset articles:bydate --@page 1 --@count 2
  --file test.rcproc --procedure SaveArticle --@article ['id', '1', 'Title', 'This is a test'] --@tags ['test']

Parameters are passed using the --@ syntax, for example --@myparameter 11. It is possible to pass arrays using square brackets --@array [1, 2, 3].

When executing the launcher, an additional window with the actual Redis LUA script debugger will spawn on screen.

There is a small catch though... Since vtortola.RedisClient injects some LUA code to make the parameter binding happen, such code appears during the debugging:

However you can see that part of the code is very well delimited by comments.

Configuration

There is a single configuration item in the app.config, one named RedisCliExeLocation that indicates where the actual redis-cli executable is.

Example

The file test.rcproc contains multiple procedures, and I would like to debug the one named ZPagination. That procedure, has the following signature:

proc ZPagination(zset, page, count)

So when launching the debugger, I will need to specify values for those parameters:

proc-dbg-launcher -h 192.168.0.16 --file test.rcproc --procedure ZPagination --@zset articles --@page 3 --@count 20
Clone this wiki locally