Commit Graph

203 Commits

Author SHA1 Message Date
slembcke bb50e102b4 Started on an eval test. 2019-02-27 16:50:00 -06:00
slembcke f568106f31 Up/down and where tests. 2019-02-27 16:23:07 -06:00
slembcke 17290abef0 Don't make dbg.write do string formatting. 2019-02-27 16:22:48 -06:00
slembcke 5920ebc34a More tests. 2019-02-27 14:59:00 -06:00
slembcke a9bdb4f05e Experimenting with automated testing 2019-02-27 13:56:51 -06:00
slembcke 2ae3dab39a Merge branch 'patch-59' 2019-02-27 11:13:11 -06:00
slembcke 54f3c3513b Fixes for #59 2019-02-25 13:40:35 -06:00
George Fotopoulos f9f0a2813a
Probably solves #35 2019-02-23 03:52:39 +02:00
Alec Larson 867284deeb fix: frame_has_file (#56) 2018-10-30 08:11:52 -04:00
Alec Larson de7bcaa463
feat: add where command (#22) 2018-10-16 16:07:10 -04:00
aleclarson 67f19c40ac fix: implicit evaluation bugs 2018-05-01 09:13:41 -04:00
Alec Larson bd5ea3c2af
fix: cmd_down past stack_top again (#47) 2018-04-27 23:31:09 -04:00
Alec Larson 503b42b854
feat: support implicit evaluation (#46)
Evaluate statements and print expressions without using the 'e' or 'p' commands.
To avoid cognitive stress, one-letter variables require the 'p' command to view.
But assigning to one-letter variables does *not* require the 'e' command. :)

Also included:
- default to "h" for empty commands when no previous command exists
- avoid overwriting previous command for specific commands not worth repeating
- avoid overwriting previous command with an invalid command
- avoid overwriting previous command with an implicit evaluation
2018-04-27 22:44:30 -04:00
Alec Larson ec7abeb5f6
fix: use fenv for autocomplete instead of global scope (#45)
The fenv may be the global scope, though. ;)
2018-04-27 21:32:05 -04:00
Alec Larson 6662219ac0
fix: varargs binding (#44)
Using the # operator on varargs returns zero when the first vararg equals nil.
2018-04-27 21:31:49 -04:00
Alec Larson 964474e350
feat: support variable assignment (#31)
* feat: support variable assignment

- locals and upvalues can be overwritten
- declaring new variables must be done like `_G.foo = 1`

* doc: add eval to help message

* fix: cmd_print with tuple expression

* nit: require a space after print/eval commands
2018-04-27 21:31:29 -04:00
Alec Larson f045da6092
fix: assume what="main" frames have a file (#43) 2018-04-27 15:10:44 -04:00
Alec Larson 07beb8d60a
fix: cmd_down past stack_top (#42) 2018-04-27 01:09:04 -04:00
Alec Larson 4cc1189b23
fix: ignore any frame that has no file (#41) 2018-04-26 13:55:45 -04:00
Alec Larson 7c4f15ea32
reset inspected frame on step/next/finish (#29)
* feat: step/next now return to the bottom frame

Previously, the inspected frame would not change, which could be
confusing.

* feat: make (f)inish work relative to the inspected frame

* doc: cmd_finish exits the inspected frame

..not the current function.

Clarify that the up/down commands change the inspected frame.
2018-04-20 10:00:40 -04:00
Alec Larson 64e49a79ab fix: use table.pack instead of table.maxn (#40)
Now, the print command works with:

    -- ordinary tuples
    p 1, 2, 3

    -- sparse tuples
    p 1, nil, 2

    -- trailing nils
    p 1, 2, nil

    -- just nil
    p nil

    -- nothing
    p (function() end)()
2018-04-20 00:09:47 -04:00
Alec Larson ee4da2ed66
fix: use table.maxn in cmd_print (#39)
The print command should print all return values, even if nil precedes the value(s).
2018-04-19 20:02:33 -04:00
Alec Larson 42de39c31b feat: always print empty tables with dbg.pretty (#38) 2018-04-19 12:48:53 -04:00
Alec Larson 7f5b3343c3
feat: change dbg.pretty 'recurse' argument to 'max_depth' (#37)
The max depth defaults to 1.
Set it to 0 to avoid printing table properties.
2018-04-19 12:35:48 -04:00
Alec Larson 3206c69eac
improve dbg.call parity with pcall (#20)
* fix: return tuple from dbg.call

* feat: make dbg.call pass varargs to the guarded function

* fix: return the error caught by dbg.call

This makes `dbg.call` identical to `pcall`
2018-04-19 10:48:44 -04:00
Alec Larson 4696ec5303
feat: shorten filename of inspected frame (#27) 2018-04-19 10:21:47 -04:00
Alec Larson 458a965fae
avoid expanding tables in cmd_locals (#23) 2018-04-19 10:21:03 -04:00
Alec Larson 8f52594bf2
feat: skip stack frames for C functions (#30)
With this commit, the up and down commands hop over any C function calls. This provides a better experience, since you can't do anything on C frames anyway.

The trace command will continue to show C function calls, though.
2018-04-19 10:19:28 -04:00
aleclarson de4de095cd feat: add cmd_go
For example, use `g0` to jump to the bottom of the stack.
Trying to jump out of range triggers cmd_trace instead.
2018-04-14 19:14:34 -04:00
Scott Lembcke 68db632733
Merge pull request #5 from achalddave/patch-1
Fix rockspec to point to raw lua file
2018-03-29 12:13:53 -05:00
Scott Lembcke 7ccf8300d6
Merge pull request #21 from aleclarson/ansi-prompt
enable ansi prompt for linenoise
2018-03-04 22:09:54 -06:00
Scott Lembcke b8f902dc23
Merge pull request #19 from aleclarson/help-typo
fix: typo in help_message
2018-03-04 22:08:18 -06:00
aleclarson 03a4e0ba2a fix: typo in help_message 2018-03-04 16:04:00 -05:00
aleclarson 2ce1b41856 enable ansi prompt for linenoise 2018-03-04 16:03:34 -05:00
slembcke d9a1558212 merging 2018-02-23 14:47:09 -06:00
slembcke 989407737d Merge branch 'master' of github.com:slembcke/debugger.lua 2018-02-23 14:39:58 -06:00
Scott Lembcke cf59ee7c1b
Merge pull request #13 from roddehugo/patch-1
Fix typo in debugger.h file
2018-02-14 15:43:07 -06:00
aleclarson f4ca4eac5e feat: add linenoise support 2018-02-14 16:00:28 -05:00
Scott Lembcke 642f064ebf
Merge pull request #17 from aleclarson/quit
Added the "q(uit)" command.
2018-02-14 11:28:00 -06:00
Joseph Ciurej 2d07214f9e Added the "q(uit)" command. 2018-02-14 10:13:20 -05:00
Hugo Rodde 58d521d45b Fix typo in debugger.h file 2017-06-24 14:12:54 +02:00
slembcke f7b64575ce add support for evaluating expressions (part of the variable assignment fix) 2016-08-06 20:28:11 -05:00
slembcke 59bb2a3433 Fix crash when a result string contains a '%'. 2016-06-28 13:39:24 -05:00
slembcke 571ca1d0cb More helpful error message. 2016-06-28 13:12:24 -05:00
Scott Lembcke d3a6ad845d Update README.md 2016-06-05 09:40:32 -05:00
Scott Lembcke 68bb989617 Update README.md 2016-06-05 09:39:13 -05:00
Achal Dave 11508dafb8 Fix rockspec to point to raw lua file
Earlier, this pointed to an HTML file.
2016-05-20 15:37:20 -04:00
Scott Lembcke 54a02bd0fe Fixed a typo. 2016-04-06 14:30:06 -05:00
slembcke 34e0ec1508 Merge branch 'master' of github.com:slembcke/debugger.lua 2016-02-08 20:38:38 -06:00
slembcke e27337f833 Add Lua 5.3 to the officially supported versions list. 2016-02-08 20:38:33 -06:00