Skip to content

Console debugger for Lua #3195

Open
Open
@TarantoolBot

Description

@TarantoolBot

Related dev issue: tarantool/tarantool#7456
Product: Tarantool
Since: 2.11
Root document: TBD. Likely to be Tooling
SME: @ tsafin @ igormunkin

Details

Console debugger luadebug.lua

Module luadebug.lua is available as console debugger of Lua scripts.
It's activated via:

local debugger = require 'luadebug'
debugger()

Originally we have used 3rd-party code from slembcke/debugger.lua but
significantly refactored since then.

Currently available console shell commands are:

    c|cont|continue
    - continue execution
    d|down
    - move down the stack by one frame
    e|eval $expression
    - execute the statement
    f|finish|step_out
    - step forward until exiting the current function
    h|help|?
    - print this help message
    l|locals
    - print the function arguments, locals and upvalues
    n|next|step_over
    - step forward by one line (skipping over functions)
    p|print $expression
    - execute the expression and print the result
    q|quit
    - exit debugger
    s|st|step|step_into
    - step forward by one line (into functions)
    t|trace|bt
    - print the stack trace
    u|up
    - move up the stack by one frame
    w|where $linecount
    - print source code around the current line

Console debugger luadebug.lua allows to see sources of builtin
Tarantool module (e.g. @builtin/datetime.lua), and it uses new
function introduced for that purpose tarantool.debug.getsources(),
one could use this function in any external GUI debugger (i.e. vscode
or JetBrains) if need to show sources of builtin modules while they
have been debugged.

Please see third_party/lua/README-luadebug.md for a fuller description
of an original luadebug.lua implementation.
Requested by @tsafin in tarantool/tarantool@a2ba501.

Definition of done

  • Docs provide complete and correct info about using the new debugger.

Metadata

Metadata

Assignees

No one assigned

    Labels

    2.112.11 release and the associated technical debtdebuggerfeatureA new functionality

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions