8 breaking releases

0.10.0 Feb 25, 2024
0.8.0 Jun 9, 2023
0.6.0 Mar 29, 2023
0.4.0 Dec 7, 2022
0.0.0 Nov 18, 2021

#191 in Debugging

Download history 133/week @ 2024-02-22 29/week @ 2024-02-29 6/week @ 2024-03-07 2/week @ 2024-03-14

170 downloads per month

MIT/Apache

8.5MB
47K SLoC

Contains (Windows DLL, 3.5MB) .windows/arm64/msdia140.dll, (Windows DLL, 2MB) .windows/x64/msdia140.dll, (Windows DLL, 1.5MB) .windows/x86/msdia140.dll, (DOS exe, 140KB) .windows/winmd/Microsoft.Dia.winmd, (static library, 2KB) .windows/arm64/msdia140.lib, (static library, 2KB) .windows/x64/msdia140.lib and 1 more.

crates.io

Rust for Debug Interface Access (DIA) SDK

The Microsoft Debug Interface Access Software Development Kit (DIA SDK) provides access to debug information stored in program database (.pdb) files generated by Microsoft postcompiler tools.

Start by adding windows and microsoft-dia dependencies to Cargo.toml:

[dependencies.windows]
version = "0.53.0"
features = [
    "Win32_System_Com"
]

[dependencies.microsoft-dia]
version = "0.10.0"

Make use of any DIA SDK APIs as needed.

use microsoft_dia::{nsfRegularExpression, DiaSource, IDiaDataSource, SymTagFunction};
use windows::{core::*, Win32::System::Com::{CoInitializeEx, COINIT_MULTITHREADED}};

fn main() -> windows::core::Result<()> {
    unsafe {
        CoInitializeEx(None, COINIT_MULTITHREADED)?;

        let source: IDiaDataSource = microsoft_dia::helpers::NoRegCoCreate(s!("msdia140.dll"), &DiaSource)?;
        let executable = std::env::current_exe().unwrap();
        source.loadDataForExe(&HSTRING::from(executable.as_os_str()), None, None)?;

        let session = source.openSession()?;
        let symbols = session.globalScope()?.findChildren(SymTagFunction, w!("sample_functions::*"), nsfRegularExpression.0 as u32)?;

        println!("Function symbols found in sample_functions::* ({}):", &executable.to_string_lossy());

        for i in 0..symbols.Count()? {
            println!("\t{}", symbols.Item(i as u32)?.name()?);
        }

        Ok(())
    }
}

Dependencies

~154MB
~2.5M SLoC