Skip to content
Snippets Groups Projects
Commit ace88542 authored by Timur Safin's avatar Timur Safin Committed by Igor Munkin
Browse files

debugger: prevent running from Tarantool REPL

At the moment we are not yet compatible with readline
support inside of Tarantool console. Diagnose that situation
at the moment debugger started and bail out.

NO_TEST=interactive
NO_DOC=Markdown updated
parent a2ba5013
No related branches found
No related tags found
No related merge requests found
......@@ -4,3 +4,17 @@
builtin Lua modules;
* New Lua API created `tarantool.debug.getsources()` which allows
to see sources of builtin modules in any external debugger;
NB! Debugger REPL is not yet compatible with Tarantool console, i.e. this
code will hang in terminal
```lua
tarantool> dbg = require 'luadebug'
---
...
tarantool> dbg()
---
```
One should call debugger activation only in their instrumented code, not
from interactive console.
......@@ -114,6 +114,16 @@ Want to disable ANSI color support or disable GNU readline? Set the `NO_COLOR`.
Known Issues:
-
- Debugger REPL is not yet compatible with Tarantool console, i.e. this
code will hang in terminal
```lua
tarantool> dbg = require 'luadebug'
tarantool> dbg()
```
One should call debugger activation only in their instrumented code, not
from interactive console.
- Lua 5.1 lacks the API to access varargs. The workaround is to do something like `local args = {...}` and then use `unpack(args)` when you want to access them. In Lua 5.2+ and LuaJIT, you can simply use `...` in your expressions with the print command.
- You can't add breakpoints to a running program or remove them. Currently the only way to set them is by explicitly calling the `dbg()` function explicitly in your code. (This is sort of by design and sort of because it's difficult/slow otherwise.)
- Different interpreters (and versions) print out slightly different stack trace information.
......
......@@ -730,6 +730,15 @@ dbg = setmetatable({
return
end
--[[
Prevent debugger from running from inside of Tarantool console.
Check pointer, which Tarantool console stored to the console object
in the fiber.self().storage.console while inside of
REPL loop.
--]]
assert(require('fiber').self().storage.console == nil, DEBUGGER ..
' is not yet compatible with interactive Tarantool console')
top_offset = top_offset or 0
stack_inspect_offset = top_offset
stack_top = top_offset
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment