-
Notifications
You must be signed in to change notification settings - Fork 196
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handle cases when one line belongs to many modules in debugger (#939)
* break in all protocol implementations * test unsetting implementation breakpoint * add test * implement fallback to runtime modules inspection * more tests and logs * cache module_info of interpreted modules call to module_info may deadlock when stopped on a breakpoint Fixes #940 * format * Handle errors in setting breakpoints Disallow setting breakpoints in Inspect protocol implementations Disallow setting breakpoints in builtin protocols and JasonV.Encoder protocol Fixes #900 Fixes #903 Fixes #942
- Loading branch information
1 parent
303dafb
commit 7546fb1
Showing
6 changed files
with
836 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
defmodule ElixirLS.Debugger.ModuleInfoCache do | ||
@moduledoc """ | ||
Caches module_info of interpreted modules. There are cases when module_info call | ||
may deadlock (https://github.com/elixir-lsp/elixir-ls/issues/940) | ||
""" | ||
|
||
use Agent | ||
|
||
def start_link(args) do | ||
Agent.start_link(fn -> args end, name: __MODULE__) | ||
end | ||
|
||
def get(module) do | ||
Agent.get(__MODULE__, & &1[module]) | ||
end | ||
|
||
def store(module) do | ||
Agent.update(__MODULE__, fn map -> | ||
if Map.has_key?(map, module) do | ||
map | ||
else | ||
Map.put(map, module, module.module_info()) | ||
end | ||
end) | ||
end | ||
|
||
def clear() do | ||
Agent.update(__MODULE__, fn _map -> %{} end) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.