45 stable releases (3 major)

12.12.3 Nov 26, 2024
12.12.0 Oct 1, 2024
12.10.0 Jul 24, 2024
12.8.0 Dec 1, 2023
9.2.1 Sep 30, 2022

#1166 in Parser implementations

Download history 3206/week @ 2024-08-24 4113/week @ 2024-08-31 3004/week @ 2024-09-07 3725/week @ 2024-09-14 4335/week @ 2024-09-21 4866/week @ 2024-09-28 3438/week @ 2024-10-05 3289/week @ 2024-10-12 2899/week @ 2024-10-19 2712/week @ 2024-10-26 2346/week @ 2024-11-02 2427/week @ 2024-11-09 2213/week @ 2024-11-16 2811/week @ 2024-11-23 2971/week @ 2024-11-30 2228/week @ 2024-12-07

10,623 downloads per month
Used in 3 crates (2 directly)

MIT license

205KB
3.5K SLoC

Provides support for reading Portable PDB files, specifically line information resolution for functions.

Portable PDB is a debugging information file format for Common Language Infrastructure (CLI) languages. It is an extension of the ECMA-335 format.

Functionality

Example

use symbolic_testutils::fixture;
use symbolic_ppdb::{LineInfo, PortablePdb, PortablePdbCacheConverter, PortablePdbCache};

let buf = std::fs::read(fixture("windows/portable.pdb")).unwrap();
let pdb = PortablePdb::parse(&buf).unwrap();

let mut converter = PortablePdbCacheConverter::new();
converter.process_portable_pdb(&pdb).unwrap();
let mut buf = Vec::new();
converter.serialize(&mut buf).unwrap();

let cache = PortablePdbCache::parse(&buf).unwrap();
let line_info = cache.lookup(7, 10).unwrap();
assert_eq!(line_info.line, 81);

Structure of a Portable PDB file

An ECMA-335 file is divided into sections called streams. The possible streams are:

  • #~ ("metadata"), comprising information about classes, methods, modules, &c., organized into tables adhering to various schemas. The original ECMA-335 tables are described in Section II.22 of the ECMA-335 spec, the tables added by Portable PDB are described in the Portable PDB spec. The MethodDebugInformation table is of particular interest to symbolic, as it contains line information for functions.
  • #Strings, comprising null-terminated UTF-8 strings.
  • #GUID, a list of GUIDs.
  • #US ("user strings"), comprising UTF-16 encoded strings.
  • #Blob, comprising blobs of data that don't fit in any of the other streams.

The Portable PDB format extends ECMA-335 by the addition of another steam, #PDB, as well as several tables to the #~ stream.

Dependencies

~2.2–3.5MB
~65K SLoC