如何设置Elixir,以便在Elixir 1.5中使用新的IEx断点?

时间:2017-09-21 17:16:22

标签: elixir

我使用Erlang 20和Elixir 1.5.0,我尝试在iex中使用break! URI.decode_query/2。然后我收到以下错误:

** (RuntimeError) could not set breakpoint, module URI was not compiled with debug_info (iex) lib/iex.ex:647: IEx.break!/4

我用什么选项编译Erlang以及如何编写?如果有帮助,我一直在使用kerl来构建和管理我的Erlang安装。

1 个答案:

答案 0 :(得分:1)

大多数版本管理器(包括kerl)都会安装elixir的预编译版本,这些版本不包含所需的调试信息。

但是,在下载源代码时,通过make进行编译并运行iex中的/bin/二进制文件,可以在这些模块上成功设置断点:

~/elixir_install/elixir-1.5.1/bin » ./iex
Erlang/OTP 20 [RELEASE CANDIDATE 2] [erts-9.0] [source] [64-bit] [smp:8:8 [ds:8:8:10] [async-threads:10] [hipe] [kernel-poll:false]

Interactive Elixir (1.5.1) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> break! URI.decode_query/2
1
iex(2)> URI.decode_query("percent=10", %{"starting" => "map"})
Break reached: URI.decode_query/2 (/home/johnny/elixir_install/elixir-1.5.1/lib/elixir/lib/uri.ex:136)

  134:   end
  135:
  136:   def decode_query(query, map) when is_binary(query) and is_map(map) do
  137:     decode_query_into_map(query, map)
  138:   end

pry(1)>