Skip to content

Instantly share code, notes, and snippets.

@Ajwah
Created May 6, 2020 18:41
Show Gist options
  • Save Ajwah/b589bea83ee9ede2e246324ca8d544d2 to your computer and use it in GitHub Desktop.
Save Ajwah/b589bea83ee9ede2e246324ca8d544d2 to your computer and use it in GitHub Desktop.
Debugging Breakpoint VSCode Extension Elixir
Kindly see comments below
@Ajwah
Copy link
Author

Ajwah commented May 6, 2020

I forced the setting of a breakpoint by hardcoding the module as follows below in this function:

          if env.module == nil do
            {:error, "Could not determine module at line"}
            set_breakpoint(Dummy, line) # HARDCODED
          else
            set_breakpoint(env.module, line)
          end

This would in turn call this modified function:

  defp set_breakpoint(module, line) do
    IO.puts("set_breakpoint: #{inspect(module)} | #{inspect(line)}")
    case :int.ni(module) do
      {:module, _} ->
        :int.break(module, line)
        IO.inspect("Succeeded setting breakpoint")
        {:ok, module, line}

      _ ->
        {:error, "Cannot interpret module #{inspect(module)}"}
    end
  end

and when checking in the debug console I could see the message: Succeeded setting breakpoint
But despite that, the breakpoint would still not be triggered.
As such, in addition of the previous problem, there is also the issue that the plugin is not receiving the breakpoint event.

I tried finding the piece of code responsible for receiving a breakpoint event, and the below was the only one I could find:
Screen Shot 2020-05-06 at 5 35 05 AM

But as it can be seen, there is no client that uses breakpoint_reached. Where should I look for this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment