---
name: "dt"
section: "4"
platform: "openbsd"
package: "man"
version: "8.0-current-20261101"
release: "OpenBSD 8.0-current (2026-11-01)"
platforms: ["openbsd"]
url: "https://new.carta.tech/dt/4"
---

# dt(4)

dynamic tracer

## NAME

**dt** – dynamic tracer

## SYNOPSIS

**pseudo-device dt**

## DESCRIPTION

System and application tracing can happen in the kernel. It has to be configured and enabled through the [ioctl(2)](/ioctl/2.md) interface exposed by the pseudo-device */dev/dt*.

This device can only be opened when the *kern.allowdt* [sysctl(2)](/sysctl/2.md) variable is set.

## IOCTL INTERFACE

The [ioctl(2)](/ioctl/2.md) command codes below are defined in ⟨dev/dt/dtvar.h⟩.

- DTIOCGPLIST *struct dtioc\_probe \*dtpr*

  Get available probe entries.

  ```
  struct dtioc_probe {
  	size_t		 	 dtpr_size;
  	struct dtioc_probe_info	*dtpr_probes;
  };
  ```

  If *dtpr\_size* is non-zero, as many probes as possible that can fit into this size will be copied into the supplied buffer. On exit, *dtpr\_size* is always set to the total size required to hold all probe entries (i.e., it is set to sizeof(struct dtioc\_probe\_info) \* dt\_nprobes).

- DTIOCGSTATS *struct dtioc\_stat \*dtst*

  Get statistics for current recording.

  ```
  struct dtioc_stat {
  	uint64_t		 dtst_readevt;
  	uint64_t		 dtst_dropevt;
  };
  ```

- DTIOCRECORD *int on*

  Start or stop recording.

- DTIOCPRBENABLE *struct dtioc\_req \*dtrq*

  Enable the given probe for recording.

  ```
  struct dtioc_req {
  	uint32_t		 dtrq_pbn;
  	struct dt_filter	 dtrq_filter;
  	uint32_t		 dtrq_rate;
  	uint64_t		 dtrq_evtflags;
  };
  ```

- DTIOCRDVNODE *struct \*dtioc\_rdvn*

  Resolve the instruction pointer from the traced process to the ELF object.

  ```
  struct dtioc_rdvn {
  	pid_t			 dtrv_pid;
  	int			 dtrv_fd;
  	caddr_t			 dtrv_va;
  	caddr_t			 dtrv_offset;
  	caddr_t			 dtrv_start;
  	size_t			 dtrv_len;
  };
  ```

  The caller populates *dtrv\_pid* with the process ID of the traced process and *dtrv\_va* with the program counter address to look up.

  On success, the remaining members are populated. *dtrv\_fd* is the file descriptor to the DSO file that *dtrv\_va* belongs to. *dtrv\_len* is the length of the DSO file. *dtrv\_offset* and *dtrv\_start* are the relative offset of *dtrv\_va* to the start of the text segment and the base address of that segment respectively.

  To calculate the relative offset of *dtrv\_va* in the DSO the following calculation can be used:

  ```
  iOffset = dtrv_va - dtrv_start + dtrv_offset
  ```

  The segment can be found by walking the ELF program headers and looking for the mapping where iOffset is included in the range \[GElf\_Phdr.p\_offset, GElf\_Phdr.p\_offset + GElf\_Phdr.p\_filesz)

  Using the *GElf\_Phdr.p\_vaddr* the base address of the segment can be calculated by

  ```
  lbase = dtrv_start - GElf_Phdr.p_vaddr
  ```

  For symbol lookups the offset can now be calculated as

  ```
  symOffset = dtrv_va - lbase
  ```

## FILES

- */dev/dt*

  dynamic tracing device.

## ERRORS

An open of */dev/dt* will fail if:

- \[EPERM\]

  the *kern.allowdt* [sysctl(2)](/sysctl/2.md) variable wasn't set.

- \[ENOMEM\]

  not enough memory space was available.

## SEE ALSO

[ioctl(2)](/ioctl/2.md), [bt(5)](/bt/5.md), [btrace(8)](/btrace/8.md)

## HISTORY

The **dt** dynamic tracing mechanism first appeared in OpenBSD 6.7.
