Skip to content

Module hb_debugger.erl

A module that provides bootstrapping interfaces for external debuggers to connect to HyperBEAM.

Description

The simplest way to utilize an external graphical debugger is to use the erlang-ls extension for VS Code, Emacs, or other Language Server Protocol (LSP) compatible editors. This repository contains a launch.json configuration file for VS Code that can be used to spawn a new HyperBEAM, attach the debugger to it, and execute the specified Module:Function(Args). Additionally, the node can be started with rebar3 debugging in order to allow access to the console while also allowing the debugger to attach.

Boot time is approximately 10 seconds.

Function Index

await_breakpoint/0Await a new breakpoint being set by the debugger.
await_breakpoint/1*
await_debugger/0*Await a debugger to be attached to the node.
await_debugger/1*
interpret/1*Attempt to interpret a specified module to load it into the debugger.
interpret_modules/1*Interpret modules from a list of atom prefixes.
is_debugging_node_connected/0*Is another Distributed Erlang node connected to us?.
start/0
start_and_break/2A bootstrapping function to wait for an external debugger to be attached, then add a breakpoint on the specified Module:Function(Args), then call it.
start_and_break/3
start_and_break/4

Function Details

await_breakpoint/0

await_breakpoint() -> any()

Await a new breakpoint being set by the debugger.

await_breakpoint/1 *

await_breakpoint(N) -> any()

await_debugger/0 *

await_debugger() -> any()

Await a debugger to be attached to the node.

await_debugger/1 *

await_debugger(N) -> any()

interpret/1 *

interpret(Module) -> any()

Attempt to interpret a specified module to load it into the debugger. int:i/1 seems to have an issue that will cause it to fail sporadically with error:undef on some modules. This error appears not to be catchable through the normal means. Subsequently, we attempt the load in a separate process and wait for it to complete. If we do not receive a response in a reasonable amount of time, we assume that the module failed to load and return false.

interpret_modules/1 *

interpret_modules(Prefixes) -> any()

Interpret modules from a list of atom prefixes.

is_debugging_node_connected/0 *

is_debugging_node_connected() -> any()

Is another Distributed Erlang node connected to us?

start/0

start() -> any()

start_and_break/2

start_and_break(Module, Function) -> any()

A bootstrapping function to wait for an external debugger to be attached, then add a breakpoint on the specified Module:Function(Args), then call it.

start_and_break/3

start_and_break(Module, Function, Args) -> any()

start_and_break/4

start_and_break(Module, Function, Args, DebuggerScope) -> any()