4 releases (2 breaking)

0.3.0 Jan 24, 2024
0.2.0 Dec 13, 2023
0.1.5 Mar 19, 2021
0.1.4 Mar 13, 2021

#1703 in Parser implementations

Download history 2231/week @ 2024-06-28 3072/week @ 2024-07-05 3813/week @ 2024-07-12 3193/week @ 2024-07-19 3370/week @ 2024-07-26 4406/week @ 2024-08-02 4656/week @ 2024-08-09 5349/week @ 2024-08-16 5320/week @ 2024-08-23 3466/week @ 2024-08-30 2635/week @ 2024-09-06 2833/week @ 2024-09-13 4676/week @ 2024-09-20 3769/week @ 2024-09-27 2909/week @ 2024-10-04 3817/week @ 2024-10-11

15,665 downloads per month
Used in 11 crates (2 directly)

Apache-2.0

51KB
1K SLoC

dof

Prototype crate for parsing and ultimately generating DTrace Object Format.


lib.rs:

Tools for extracting and parsing data in DTrace Object Format (DOF).

The dof crate provides types and functions for reading and writing the DTrace Object Format, an ELF-like serialization format used to store information about DTrace providers and probes in object files. DOF sections are generated from source code at compile time, and used to communicate information to the in-kernel portions of DTrace about the providers and probes defined in the source.

Low-level bindings to the DOF C structures are contained in the dof_bindings module, however most client code with interact with the more convenient stuctures defined in the crate root. The Section type describes a complete DOF section as contained in an object file. It contains one or more Providers, each of which contains one or more Probes.

A Probe describes the names of the related components, such as the function in which it is called, the provider to which it belongs, and the probe name itself. It also contains information about the location of the probe callsite in the object file itself. This is used by DTrace to enable and disable the probe dynamically.

Users of the crate will most likely be interested in deserializing existing DOF data from an object file. The function extract_dof_sections may be used to pull all sections (and all providers and probes) from either an ELF or Mach-O object file.

The Section::from_bytes and Section::as_bytes methods can be used for ser/des of a section directly to DOF itself, i.e., ignoring the larger object file format.

Most useful methods and types are exported in the crate root. However, the lower-level Rust bindings to the raw C-structs are also exposed in the dof_bindings module, and may be extracted from a DOF byte slice with the des::deserialize_raw_sections function.

Dependencies

~1.4–2.7MB
~49K SLoC