【问题标题】:How to setup Elixir properlty to use the new IEx breakpoints with Elixir 1.5?如何设置 Elixir 属性以在 Elixir 1.5 中使用新的 IEx 断点?
【发布时间】:2017-09-22 01:44:17
【问题描述】:

我将 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 安装。

【问题讨论】:

  • 你是如何安装 Elixir 的?
  • 我用的是 kiex github.com/taylor/kiex
  • 我的猜测是 kiex 使用的是 elixir 的预编译版本,这样 iex 无法设置断点。您可能需要自己编译 elixir 才能使其工作...

标签: elixir


【解决方案1】:

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

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

~/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)>

【讨论】:

  • FWIW 我已经使用 Homebrew “Bottle”(编译的二进制文件)通过 Homebrew 安装了 Elixir,我可以在这个函数上放置一个断点。也许 kiex 在编译 Elixir 时传递的标志与 Homebrew 创建“瓶子”时传递的标志不同。
  • 有趣,刚刚查看了 kiex 的源代码,它确实只是调用了make compile,就像我对源代码所做的那样。
猜你喜欢
  • 1970-01-01
  • 2016-10-21
  • 2021-06-27
  • 1970-01-01
  • 2015-06-14
  • 2022-12-04
  • 2019-03-26
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多