LiveDebugger.Services.CallbackTracingService (LiveDebugger v0.1.4)

View Source

It starts a tracing session for the given monitored PID via start_tracing/3. When session is started sends traces to the recipient PID via message {:new_trace, trace}. It stores traces in an ETS table with id created by CallbackTracingService.ets_table_id/1.

Traces ids starts from 0 and are decremented by 1 to make sure that they are ordered from the newest to the oldest. This is how ets ordered set works. It does not allow you to change the order manually, it is always ordered by the key.

The session should be stopped when monitored process is killed with stop_tracing/1.

Summary

Types

Represents a raw trace straight from :dbg. It should not be used outside of this module.

Functions

Starts a tracing for the given monitored PID. It sends traces to the recipient PID via message {:new_trace, trace}. It stores traces in an ETS table with id created by CallbackTracingService.ets_table_id/1.

Stops tracing.

Types

raw_trace()

@type raw_trace() :: {atom(), pid(), atom(), {atom(), atom(), [term()]}}

Represents a raw trace straight from :dbg. It should not be used outside of this module.

Functions

start_tracing(socket_id, monitored_pid, recipient_pid)

@spec start_tracing(
  socket_id :: String.t(),
  monitored_pid :: pid(),
  recipient_pid :: pid()
) :: {:ok, term()} | {:error, term()}

Starts a tracing for the given monitored PID. It sends traces to the recipient PID via message {:new_trace, trace}. It stores traces in an ETS table with id created by CallbackTracingService.ets_table_id/1.

Since session mechanism is available only in OTP >= 27 it is impossible to have multiple tracing sessions in earlier versions. Because of that when debugger is used in project with OTP < 27 user cannot open more than one debugger sessions at the same time. More info here https://www.erlang.org/docs/27/apps/runtime_tools/dbg#session/2

stop_tracing(session)

@spec stop_tracing(term()) :: :ok

Stops tracing.