Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ Querying:
- `st`: show the "status" (current function, source code and current expression to run)
- `bt`: show a backtrace
- `fr [i::Int]`: show all variables in the current or `i`th frame
- `p`
- `p`: print all currently defined variables
- `p x` : print the value of the variable `x`

Evaluation:
- `w`
Expand Down
24 changes: 23 additions & 1 deletion src/commands.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

function assert_allow_step(state)
if state.broke_on_error
printstyled(stderr, "Cannot step after breaking on error\n"; color=Base.error_color())
Expand Down Expand Up @@ -140,6 +139,26 @@ function execute_command(state::DebuggerState, v::Union{Val{:up}, Val{:down}}, c
end
return execute_command(state, Val(:f), string("f ", state.level + offset))
end

function execute_command(state::DebuggerState, ::Val{:p}, cmd::AbstractString)
cmds = split(cmd, r" +")
io = Base.pipe_writer(state.terminal)
frame = active_frame(state)
if length(cmds) == 1
print_locals(io, frame)
else
vars = JuliaInterpreter.locals(frame)
for requested_var in cmds[2:end]
for var in vars
if string(var.name) == requested_var
print_var(io, var)
end
end
end
end
return false
end

function execute_command(state::DebuggerState, ::Val{:w}, cmd::AbstractString)
# TODO show some info messages?
cmds = split(cmd, r" +")
Expand Down Expand Up @@ -269,6 +288,9 @@ function execute_command(state::DebuggerState, ::Union{Val{:help}, Val{:?}}, cmd
- `st`: show the "status" (current function, source code and current expression to run)\\
- `bt`: show a backtrace\\
- `fr [i::Int]`: show all variables in the current or `i`th frame\\
- `p`\\
- `p`: print all currently defined variables\\
- `p x` : print the value of the variable `x`\\


Evaluation:\\
Expand Down