19 unstable releases

0.11.0 Dec 13, 2023
0.10.4 Nov 15, 2022
0.10.2 Jul 25, 2022
0.7.1 Oct 3, 2021
0.4.0 Jun 13, 2021

#43 in Debugging

Download history 762/week @ 2023-12-23 991/week @ 2023-12-30 1779/week @ 2024-01-06 2266/week @ 2024-01-13 2509/week @ 2024-01-20 2751/week @ 2024-01-27 7114/week @ 2024-02-03 6014/week @ 2024-02-10 4954/week @ 2024-02-17 6248/week @ 2024-02-24 4863/week @ 2024-03-02 4127/week @ 2024-03-09 4250/week @ 2024-03-16 4086/week @ 2024-03-23 5205/week @ 2024-03-30 3730/week @ 2024-04-06

17,719 downloads per month
Used in 16 crates (4 directly)



crates.io page docs.rs page


Resolve addresses to function names, and to file name and line number information, with the help of a PDB file. Inline stacks are supported.

The API of this crate is intended to be similar to the API of the addr2line crate; the two Context APIs have comparable functionality. This crate is for PDB files whereas addr2line is for DWARF data (which is used in ELF and mach-o binaries, for example).

This crate also has a TypeFormatter API which can be used to get function signature strings independently from a Context.

To create a Context, use ContextPdbData.

The implementation makes use of the excellent pdb crate.


use pdb_addr2line::pdb; // (this is a re-export of the pdb crate)

fn look_up_addresses<'s, S: pdb::Source<'s> + 's>(stream: S, addresses: &[u32]) -> std::result::Result<(), pdb_addr2line::Error> {
    let pdb = pdb::PDB::open(stream)?;
    let context_data = pdb_addr2line::ContextPdbData::try_from_pdb(pdb)?;
    let context = context_data.make_context()?;

    for address in addresses {
        if let Some(procedure_frames) = context.find_frames(*address)? {
            eprintln!("0x{:x} - {} frames:", address, procedure_frames.frames.len());
            for frame in procedure_frames.frames {
                let line_str = frame.line.map(|l| format!("{}", l));
                    "     {} at {}:{}",
        } else {
            eprintln!("{:x} - no frames found", address);

Command-line usage

This repository also contains a CLI executable modelled after addr2line. You can install it using cargo install:

cargo install --examples pdb-addr2line

Here are some example uses:

$ curl -o dcomp.pdb -L "https://msdl.microsoft.com/download/symbols/dcomp.pdb/648B8DD0780A4E22FA7FA89B84633C231/dcomp.pdb"
$ pdb-addr2line --exe dcomp.pdb -fC 0x59aa0 0x52340 0x13498
std::map<unsigned int, Windows::UI::Composition::AnimationLoggingManager::ReferencedObject, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, Windows::UI::Composition::AnimationLoggingManager::ReferencedObject> > >::_Try_emplace<unsigned int const&>(unsigned int const&)
$ curl -o mozglue.pdb -L "https://github.com/mstange/profiler-get-symbols/raw/master/fixtures/win64-ci/mozglue.pdb"
$ pdb-addr2line -e mozglue.pdb -psfi 0x3b9fb
mozilla::JSONWriter::StartCollection(char const*, char const*, mozilla::JSONWriter::CollectionStyle) at JSONWriter.h:318
 (inlined by) mozilla::JSONWriter::StartArrayProperty(char const*, mozilla::JSONWriter::CollectionStyle) at JSONWriter.h:417
 (inlined by) mozilla::JSONWriter::StartArrayElement(mozilla::JSONWriter::CollectionStyle) at JSONWriter.h:422
 (inlined by) mozilla::baseprofiler::AutoArraySchemaWriter::AutoArraySchemaWriter(mozilla::baseprofiler::SpliceableJSONWriter&, mozilla::baseprofiler::UniqueJSONStrings&) at ProfileBufferEntry.cpp:141
 (inlined by) mozilla::baseprofiler::WriteSample(mozilla::baseprofiler::SpliceableJSONWriter&, mozilla::baseprofiler::UniqueJSONStrings&, mozilla::baseprofiler::ProfileSample const&) at ProfileBufferEntry.cpp:361
 (inlined by) mozilla::baseprofiler::ProfileBuffer::StreamSamplesToJSON::<unnamed-tag>::operator()(mozilla::ProfileChunkedBuffer::Reader*) const at ProfileBufferEntry.cpp:809


pdb-addr2line optimizes for speed over memory by caching parsed information. The debug information about inlines, files and line numbers is parsed lazily where possible.


Licensed under either of

at your option.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.


~44K SLoC