Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERL-359: Enable debugging for Elixir sources with loader hack #3378

Open
OTP-Maintainer opened this issue Feb 13, 2017 · 0 comments
Open

ERL-359: Enable debugging for Elixir sources with loader hack #3378

OTP-Maintainer opened this issue Feb 13, 2017 · 0 comments
Labels
enhancement help wanted Issue not worked on by OTP; help wanted from the community priority:low team:VM Assigned to OTP team VM

Comments

@OTP-Maintainer
Copy link

Original reporter: bryanhunt
Affected version: OTP-20.0
Component: debugger
Migrated from: https://bugs.erlang.org/browse/ERL-359


If a user tries to load debug Elixir source code via Module -> Interpret -> Interpret Modules 

The following error is generated:

"Error when interpreting: EchoProtocol.ex: No Beam file"

On the console the following is output:

"Invalid beam file or no abstract code: "/common/elixir_ranch/lib/EchoProtocol.ex"

The work around to get this working is:

{code}{{iex(15)> {:ok,beam_bin} = File.read("_build/dev/lib/elixir_ranch/ebin/Elixir.ElixirRanch.beam")

{:ok,
 <<70, 79, 82, 49, 0, 0, 7, 68, 66, 69, 65, 77, 69, 120, 68, 99, 0, 0, 0, 226,
   131, 104, 2, 100, 0, 14, 101, 108, 105, 120, 105, 114, 95, 100, 111, 99, 115,
   95, 118, 49, 108, 0, 0, 0, 4, 104, 2, 100, 0, ...>>}

iex(16)> :int.i({ElixirRanch, 'lib/elixir_ranch.ex', '_build/dev/lib/elixir_ranch/ebin/Elixir.ElixirRanch.beam', beam_bin})
{:module, ElixirRanch}}}{code}

This workaround has been known for a long time (since 2014) and is described in depth by Josh Burroughs (qhool) here: http://qhool.github.io/elixir/2014/02/06/elixir-debug.html

I have also attached a PDF of that page in case the site vanishes some day.

It would be nice if this worked a little better, the obviously comparison will be with Java tooling which can handle any source files it pleases, provided line number info has been generated. 

@OTP-Maintainer OTP-Maintainer added enhancement help wanted Issue not worked on by OTP; help wanted from the community team:VM Assigned to OTP team VM priority:low labels Feb 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement help wanted Issue not worked on by OTP; help wanted from the community priority:low team:VM Assigned to OTP team VM
Projects
None yet
Development

No branches or pull requests

1 participant