Skip to content

Commit

Permalink
Dbg backend for debugger (#974)
Browse files Browse the repository at this point in the history
* add dbg backend

* break on dbg

* continue

* stop session

* properly get module code

* overwrite bindings

* step through pipes

* pass env to eval

* add tests

* continue dbg session

* fix tests on < 1.14

* fixing tests

* remove not needed asserts

* make dbg breakpoints work when debugging in non interpreted mode

* port bugfix from elixir

* get stacktrace from Process.info if not in interpreted mode

* remove not relevant todos

* fix breakpoint type detection

* make sure process is dead
  • Loading branch information
lukaszsamson authored Aug 29, 2023
1 parent e878de4 commit 28de664
Show file tree
Hide file tree
Showing 5 changed files with 969 additions and 68 deletions.
16 changes: 13 additions & 3 deletions apps/elixir_ls_debugger/lib/debugger.ex
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,26 @@ defmodule ElixirLS.Debugger do

use Application
alias ElixirLS.Debugger.Output
alias ElixirLS.Debugger.Server

@impl Application
def start(_type, _args) do
# We don't start this as a worker because if the debugger crashes, we want
# this process to remain alive to print errors
{:ok, _pid} = Output.start(Output)

children = [
{ElixirLS.Debugger.Server, name: ElixirLS.Debugger.Server}
]
if Version.match?(System.version(), ">= 1.14.0") do
Application.put_env(:elixir, :dbg_callback, {Server, :dbg, []})
end

children =
if Mix.env() != :test do
[
{Server, name: Server}
]
else
[]
end

opts = [strategy: :one_for_one, name: ElixirLS.Debugger.Supervisor, max_restarts: 0]
Supervisor.start_link(children, opts)
Expand Down
Loading

0 comments on commit 28de664

Please sign in to comment.