Expand description

symsrv

This crate lets you download and cache pdb files from symbol servers, according to the rules from the _NT_SYMBOL_PATH environment variable.

It exposes an async API and uses of reqwest and tokio::fs.

The downloaded symbols are stored and never evicted.

Microsoft Documentation

Example

use std::path::PathBuf;
use symsrv::{get_symbol_path_from_environment, SymbolCache};

// Parse the _NT_SYMBOL_PATH environment variable.
let symbol_path =
    get_symbol_path_from_environment("srv**https://msdl.microsoft.com/download/symbols");

// Create a symbol cache which follows the _NT_SYMBOL_PATH recipe.
let symbol_cache = SymbolCache::new(symbol_path, false);
 
// Download and cache a PDB file.
let relative_path: PathBuf =
    ["dcomp.pdb", "648B8DD0780A4E22FA7FA89B84633C231", "dcomp.pdb"].iter().collect();
let file_contents = symbol_cache.get_pdb(&relative_path).await?;
 
// Use the PDB file contents.
use_pdb_bytes(&file_contents[..]);

Structs

Obtains symbols according to the instructions in the symbol path.

Enums

This is how the symbol file contents are returned. If there’s an uncompressed file in the store, then we return an Mmap of that uncompressed file. If there is no local file or the local file is compressed, then we load or uncompress the file into memory and return a Bytes wrapper of that memory.

The parsed representation of one entry in the (semicolon-separated list of entries in the) _NT_SYMBOL_PATH environment variable. The syntax of this string is documented at https://docs.microsoft.com/en-us/windows-hardware/drivers/debugger/advanced-symsrv-use.

Functions

Currently returns ~/sym.

Reads the _NT_SYMBOL_PATH environment variable and parses it. The parsed path entries use ~/sym as the default downstream store.

Parse the value of the _NT_SYMBOL_PATH variable. The format of this variable is a semicolon-separated list of entries, where each entry is an asterisk-separated hierarchy of symbol locations which can be either directories or server URLs.