Module normalize

Module normalize 

Source
Expand description

Functionality for address normalization.

Address normalization is one step of address symbolization. Typically only used internally, it is also made accessible for users to enable remote symbolization work flows. Remote symbolization refers to performing symbolization on a system other than where the “raw” addresses were originally captured. This is useful when working with embedded or locked down systems, for example, where files necessary to perform the symbolization are not available or not accessible.

In such a setting address normalization would happen on the embedded device. The result of this normalization would then be transferred to another one that actually performs the symbolization.

The output of address normalization is a set of file offsets along with meta data. The meta data is expected to contain sufficient information to identify the symbolization source to use (e.g., the ELF file with symbols) on the symbolizing system.

use blazesym::normalize::Normalizer;
use blazesym::Addr;
use blazesym::Pid;

let normalizer = Normalizer::new();
let fopen_addr = libc::fopen as Addr;
let addrs = [fopen_addr];
let pid = Pid::Slf;
let normalized = normalizer.normalize_user_addrs(pid, &addrs).unwrap();
assert_eq!(normalized.outputs.len(), 1);

let (file_offset, meta_idx) = normalized.outputs[0];
// fopen (0x7f5f8e23a790) corresponds to file offset 0x77790 within
// Elf(Elf { path: "/usr/lib64/libc.so.6", build_id: Some([...]), ... })
println!(
  "fopen ({fopen_addr:#x}) corresponds to file offset {file_offset:#x} within {:?}",
  normalized.meta[meta_idx]
);

§Notes

Please note that blazesym does not concern itself with the transfer of data between systems. That is a task that is entirely in user’s hands.

Re-exports§

pub use symbolize::Reason;

Structs§

Apkapk
Meta information about an APK.
Builder
A builder for configurable construction of Normalizer objects.
Elf
Meta information about an ELF file (executable, shared object, …).
NormalizeOpts
Options influencing the address normalization process.
Normalizer
A normalizer for addresses.
Unknown
Meta information about an address that could not be determined to be belonging to a specific component.

Enums§

UserMeta
Meta information for an address.

Type Aliases§

UserOutput
A type representing the output of user addresses normalization.