DalaDev.Debugger (dala_dev v0.0.5)

Copy Markdown View Source

Advanced debugging tools for remote Elixir nodes.

Provides process inspection, state introspection, remote code evaluation, and memory analysis for dala Elixir cluster debugging.

Examples

# Inspect a process on a remote node
{:ok, info} = DalaDev.Debugger.inspect_process(
  :"dala_qa@192.168.1.5",
  MyApp.Worker
)

# Get supervision tree
{:ok, tree} = DalaDev.Debugger.get_supervision_tree(node)

# Evaluate code on remote node
{:ok, result} = DalaDev.Debugger.eval_remote(
  node,
  "MyApp.Config.get(:api_key)"
)

# Get memory report
{:ok, report} = DalaDev.Debugger.memory_report(node)

Summary

Functions

Evaluate Elixir code on a remote node.

Gets the state of a process.

Get the supervision tree of a node.

Inspect a process on a remote node.

Get a detailed memory report for a node.

Trace messages sent to/from a process.

Types

node_ref()

@type node_ref() :: node() | DalaDev.Device.t() | String.t()

process_ref()

@type process_ref() :: pid() | atom() | {atom(), atom()} | module()

Functions

eval_remote(node_ref, code, opts \\ [])

@spec eval_remote(node_ref(), String.t(), keyword()) ::
  {:ok, any()} | {:error, term()}

Evaluate Elixir code on a remote node.

The code string is evaluated using Code.eval_string/1 on the remote node.

Options:

  • :timeout - RPC timeout in ms (default: 30_000)
  • :bindings - Variables to bind in the evaluation context

get_process_state_local(pid_or_name)

@spec get_process_state_local(pid() | atom() | {atom(), atom()}) :: term() | nil

Gets the state of a process.

Similar to :sys.get_state/1 from Erlang/OTP, this function retrieves the internal state of a process. The process must be a system process (e.g., a GenServer, GenStateMachine, or other process that implements the sys protocol).

Parameters

  • pid_or_name - A PID or registered name of the process

Returns

  • The process state, or nil if the process is not found or doesn't have state

See Also

get_supervision_tree(node_ref)

get_supervision_tree(node_ref, opts)

@spec get_supervision_tree(
  node_ref(),
  keyword()
) :: {:ok, map()} | {:error, term()}

Get the supervision tree of a node.

Returns a tree structure showing all supervisors and their children.

inspect_process(node_ref, process_ref, opts \\ [])

@spec inspect_process(node_ref(), process_ref(), keyword()) ::
  {:ok, map()} | {:error, term()}

Inspect a process on a remote node.

Returns detailed information including:

  • Process dictionary
  • Current state (if GenServer/GenStateMachine)
  • Message queue
  • Links and monitors
  • Memory usage

Options:

  • :timeout - RPC timeout in ms (default: 10_000)

memory_report(node_ref, opts \\ [])

@spec memory_report(
  node_ref(),
  keyword()
) :: {:ok, map()} | {:error, term()}

Get a detailed memory report for a node.

Returns memory breakdown including:

  • Total memory
  • Process memory
  • Binary memory
  • ETS memory
  • Atom memory

trace_messages(node_ref, process_ref, opts \\ [])

@spec trace_messages(node_ref(), process_ref(), keyword()) ::
  {:ok, [map()]} | {:error, term()}

Trace messages sent to/from a process.

Options:

  • :duration - Tracing duration in ms (default: 5_000)
  • :timeout - RPC timeout in ms (default: duration + 1_000)