Lua high-level debugger

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Lua high-level debugger

Dirk Laurie-2
Am I describing your module, or close?

1. It provides interactive debugging.
2. It takes max 5 minutes of studying the README to get up to speed.
3. You run your Lua code with `lua -l mydebug` or the like.
4. At some point in the program where you need debugging, you put
    mydebug().
5. That routine calls a REPL which can list, inspect and change
variables visible at that point of the program and return.

Example:

!> x?
upvalue, table 0x34bc80, has __index chain (3 levels)
!> x.a?
in __index(1), number, -nan
!> x.a = 0
!> exit

This is not a sneaky advertisement for a module I already almost have.
I wish to know what is on the shelf already.

Reply | Threaded
Open this post in threaded view
|

Re: Lua high-level debugger

Paul K-2
> I wish to know what is on the shelf already.

This (https://github.com/slembcke/debugger.lua) debugger seems to
provide similar functionality.

Paul.

On Tue, May 1, 2018 at 8:43 PM, Dirk Laurie <[hidden email]> wrote:

> Am I describing your module, or close?
>
> 1. It provides interactive debugging.
> 2. It takes max 5 minutes of studying the README to get up to speed.
> 3. You run your Lua code with `lua -l mydebug` or the like.
> 4. At some point in the program where you need debugging, you put
>     mydebug().
> 5. That routine calls a REPL which can list, inspect and change
> variables visible at that point of the program and return.
>
> Example:
>
> !> x?
> upvalue, table 0x34bc80, has __index chain (3 levels)
> !> x.a?
> in __index(1), number, -nan
> !> x.a = 0
> !> exit
>
> This is not a sneaky advertisement for a module I already almost have.
> I wish to know what is on the shelf already.
>

Reply | Threaded
Open this post in threaded view
|

Re: Lua high-level debugger

Daurnimator
In reply to this post by Dirk Laurie-2
On 2 May 2018 at 13:43, Dirk Laurie <[hidden email]> wrote:

> Am I describing your module, or close?
>
> 1. It provides interactive debugging.
> 2. It takes max 5 minutes of studying the README to get up to speed.
> 3. You run your Lua code with `lua -l mydebug` or the like.
> 4. At some point in the program where you need debugging, you put
>     mydebug().
> 5. That routine calls a REPL which can list, inspect and change
> variables visible at that point of the program and return.
>
> Example:
>
> !> x?
> upvalue, table 0x34bc80, has __index chain (3 levels)
> !> x.a?
> in __index(1), number, -nan
> !> x.a = 0
> !> exit
>
> This is not a sneaky advertisement for a module I already almost have.
> I wish to know what is on the shelf already.

Do you know about lua's built-in debug.debug()?
https://www.lua.org/manual/5.3/manual.html#pdf-debug.debug

Reply | Threaded
Open this post in threaded view
|

Re: Lua high-level debugger

Sean Conner
In reply to this post by Dirk Laurie-2
It was thus said that the Great Dirk Laurie once stated:
> Am I describing your module, or close?
>
> 1. It provides interactive debugging.

  Further clarification needed.

> 2. It takes max 5 minutes of studying the README to get up to speed.

  Erm ...

> 3. You run your Lua code with `lua -l mydebug` or the like.

  Yes.

> 4. At some point in the program where you need debugging, you put
>     mydebug().

  Yes.

> 5. That routine calls a REPL which can list, inspect and change
> variables visible at that point of the program and return.

  Yes to everything bug change variables.

> Example:
>
> !> x?
> upvalue, table 0x34bc80, has __index chain (3 levels)
> !> x.a?
> in __index(1), number, -nan
> !> x.a = 0
> !> exit
>
> This is not a sneaky advertisement for a module I already almost have.
> I wish to know what is on the shelf already.
  Does it need to be published?

  -spc (Screen shot attached)

luaview.gif (10K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Lua high-level debugger

Dirk Laurie-2
In reply to this post by Daurnimator
2018-05-02 6:07 GMT+02:00 Daurnimator <[hidden email]>:

> On 2 May 2018 at 13:43, Dirk Laurie <[hidden email]> wrote:
>> Am I describing your module, or close?
>>
>> 1. It provides interactive debugging.
>> 2. It takes max 5 minutes of studying the README to get up to speed.
>> 3. You run your Lua code with `lua -l mydebug` or the like.
>> 4. At some point in the program where you need debugging, you put
>>     mydebug().
>> 5. That routine calls a REPL which can list, inspect and change
>> variables visible at that point of the program and return.
> Do you know about lua's built-in debug.debug()?
> https://www.lua.org/manual/5.3/manual.html#pdf-debug.debug

"Note that commands for debug.debug are not lexically nested within
any function and so have no direct access to local variables."

Reply | Threaded
Open this post in threaded view
|

Re: Lua high-level debugger

Dirk Laurie-2
In reply to this post by Paul K-2
2018-05-02 6:01 GMT+02:00 Paul K <[hidden email]>:
>> I wish to know what is on the shelf already.
>
> This (https://github.com/slembcke/debugger.lua) debugger seems to
> provide similar functionality.

This is very close to what I had hoped for, and since it is in Lua,
easily customizable.

Thanks!
Dirk

Reply | Threaded
Open this post in threaded view
|

Re: Lua high-level debugger

Dirk Laurie-2
In reply to this post by Sean Conner
2018-05-02 6:18 GMT+02:00 Sean Conner <[hidden email]>:

> It was thus said that the Great Dirk Laurie once stated:
>> Am I describing your module, or close?
>>
>> 1. It provides interactive debugging.
>
>   Further clarification needed.
>
>> 2. It takes max 5 minutes of studying the README to get up to speed.
>
>   Erm ...
>
>> 3. You run your Lua code with `lua -l mydebug` or the like.
>
>   Yes.
>
>> 4. At some point in the program where you need debugging, you put
>>     mydebug().
>
>   Yes.
>
>> 5. That routine calls a REPL which can list, inspect and change
>> variables visible at that point of the program and return.
>
>   Yes to everything bug change variables.
>
>> Example:
>>
>> !> x?
>> upvalue, table 0x34bc80, has __index chain (3 levels)
>> !> x.a?
>> in __index(1), number, -nan
>> !> x.a = 0
>> !> exit
>>
>> This is not a sneaky advertisement for a module I already almost have.
>> I wish to know what is on the shelf already.
>
>   Does it need to be published?

Just being available in a repository will do.

Your screenshot brings back memories of Turbo Pascal ...

Dirk

Reply | Threaded
Open this post in threaded view
|

Re: Lua high-level debugger

Russell Haley
In reply to this post by Dirk Laurie-2


On Tue, May 1, 2018 at 8:43 PM, Dirk Laurie <[hidden email]> wrote:
Am I describing your module, or close?

1. It provides interactive debugging.
2. It takes max 5 minutes of studying the README to get up to speed.
3. You run your Lua code with `lua -l mydebug` or the like.
4. At some point in the program where you need debugging, you put
    mydebug().
5. That routine calls a REPL which can list, inspect and change
variables visible at that point of the program and return.

Example:

!> x?
upvalue, table 0x34bc80, has __index chain (3 levels)
!> x.a?
in __index(1), number, -nan
!> x.a = 0
!> exit

This is not a sneaky advertisement for a module I already almost have.
I wish to know what is on the shelf already.

There was a message on Lua-l from Gunnar last June about a CLI interface for mobdebug. I've used it successfully a few times. From his [ANN]: 

Hi,

this message is to announce the availability of debug.lua 0.10.
debug.lua is a terminal based standalone frontend for mobdebug,
that runs on Linux and MacOS X and probably other Unixen. Because
it is terminal based, it is navigated only with the keyboard, but it
does feature source navigation and a display for expressions that
change as you step through the source.

New in version 0.11:

* added simple config files to change the colors used by debug.lua
* fixed a bug where the output of the '=' command was getting formatted
  on a weird (and also wrong) way

You can get debug.lua from http://www.tset.de/debug.lua

or via luarocks install debug.lua.

Rgds,

Gunnar 

Reply | Threaded
Open this post in threaded view
|

Re: Lua high-level debugger

Bruce Hill

On May 1, 2018, at 10:20 PM, Russell Haley <[hidden email]> wrote:

There was a message on Lua-l from Gunnar last June about a CLI interface for mobdebug. I've used it successfully a few times.

Interesting. I've been working on a debugging tool that has some similarities. It's not quite finished yet (still needs the ability to step through execution and toggle breakpoints during runtime), but it's functional enough that I use it in my daily work for browsing through the callstack and variables when an uncaught error occurs. My debugger has a few features I'm pretty happy with, like color-coded file-tree-esque exploring of values, vim-like keybindings, full Moonscript support, watch expressions, the ability to launch your editor to a selected line, and the ability to run arbitrary code at different levels of the stack.

You can try it out here:
It's pretty stable and it's way better than just looking at a printout of a callstack. But, like I said, it doesn't yet support stepping through the code, only examining the state at a breakpoint or uncaught error.

--
Bruce

signature.asc (849 bytes) Download Attachment