Skip to content

Instantly share code, notes, and snippets.

@illnyang
Created March 7, 2022 17:52
Show Gist options
  • Save illnyang/5bdbc04749f009ecc423f0f1dc978f68 to your computer and use it in GitHub Desktop.
Save illnyang/5bdbc04749f009ecc423f0f1dc978f68 to your computer and use it in GitHub Desktop.
convenience wrapper for llvm-pdbutil pretty dumpers (drag & drop)
@echo off
rem ----- usage: llvm-pdbutil-prettybatchdump.bat C:\input.pdb -----
rem ----- output will be put in "dump" folder, next to the pdb -----
rem ----- verbose vcvarsall output -----
rem set VSCMD_DEBUG=3
echo Loading VS environ
for /f "usebackq delims=#" %%a in (`"%programfiles(x86)%\Microsoft Visual Studio\Installer\vswhere" -latest -property installationPath`) do set VsDevCmd_Path=%%a\Common7\Tools\VsDevCmd.bat
rem ----- remove "-arch" param when using x86 LLVM -----
call "%VsDevCmd_Path%" -arch=amd64
rem ----- x64 LLVM, despite "(x86)" -----
set "PATH=C:\Program Files (x86)\LLVM\bin;%PATH%"
set "PRETTYFLAGS=--no-compiler-generated --no-system-libs --injected-sources --injected-source-content"
(mkdir dump 2> NUL)
echo Dumping types
(llvm-pdbutil pretty %PRETTYFLAGS% --types %~nx1 > dump\%~nx1.types.txt)
echo Dumping globals
(llvm-pdbutil pretty %PRETTYFLAGS% --globals %~nx1 > dump\%~nx1.globals.txt)
echo Dumping compilands
(llvm-pdbutil pretty %PRETTYFLAGS% --compilands %~nx1 > dump\%~nx1.compilands.txt)
echo Dumping funcsigs
(llvm-pdbutil pretty %PRETTYFLAGS% --funcsigs %~nx1 > dump\%~nx1.funcsigs.txt)
echo Dumping module-syms
(llvm-pdbutil pretty %PRETTYFLAGS% --module-syms %~nx1 > dump\%~nx1.module-syms.txt)
echo Dumping lines
(llvm-pdbutil pretty %PRETTYFLAGS% --lines %~nx1 > dump\%~nx1.lines.txt)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment