In Debugging section, "Invalid beam file or no abstract code"

following guide, debug section, in iex create the module Example, then :debugger.start() which does start the monitor window. However, the next step listed, :int.ni(Example) gives the subject error, and I cannot find my new way past this… the double_sum function within the module works, so the module “Is there” but the :debugger and :int appear to not know of it. the Monitor window Modules menu does not show it. what is missing here?
Running this on Win 10 Pro, most recent release (1903)

Welcome to the forum!

I assume you are referring to:

One thing I notice is this:

$ iex -S mix

This implies that the Example module exists within a mix project.

You haven’t mentioned whether you have created the Example module within a mix project.

mix projects aren’t discussed until later in:

1 Like

I just now figured that part out -I had to move forward to OTP/mix section, create the new project, edit the lib\example.ex file to the guide sample code, then do the ‘elixirc example.ex’ to get the environment properly set for the debugging discussion. The guide could use some sequencing validation.

After iex -S mix you should have seen something like:

** (Mix) "mix" with no arguments must be executed in a directory with a mix.exs file

Usage: mix [task]

Examples:

    mix             - Invokes the default task (mix run) in a project
    mix new PATH    - Creates a new Elixir project at the given path
    mix help        - Lists all available tasks
    mix help TASK   - Prints documentation for a given task

The --help and --version options can be given instead of a task for usage and versioning information.

to indicate that something was amiss.

Inside of iex you can get help with

> h()

or on a command with

> h(r)

I’m not sure there is a strict sequence to the Getting Started topics - while in general each builds on what came before, the more you progress towards the end, the more it becomes a loose discussion of topics.

2 Likes

Faced the same problem. How to reproduce:

  1. Create example.ex file with content from the guide
  2. Run iex
  3. Compile module with c "example.ex"
  4. Start debugger with :debugger.start()
  5. Run :int.ni(Example)
  6. Get error: ** Invalid beam file or no abstract code: 'Elixir.Example'

What I figured out, that you should not compile module from IEx. So you should compile module beforehand.

This sequence will work:

  1. Create example.ex file with content from the guide
  2. Compile module with elixirc example.ex
  3. Run iex
  4. Start debugger with :debugger.start()
  5. Run :int.ni(Example)
  6. Run :int.break(Example, 3)

Moreover for this sequence if you compile module from IEx with c "example.ex" even if Elixir.Example.beam file exists, you will get an error again.

Fixed here: