Cross-platform Python parser for Microsoft PDB files with no external dependencies
Project description
PurelyPDB
Cross-platform Python parser for Microsoft PDB files with no external dependencies.
Based on pdbparse with modifications and additional code.
Provides more complete parsing support and compatibility with as many Python versions as possible, including 2.7-3.13+.
Features
- Parse PDB files without external dependencies
- Extract function symbols with addresses and sizes
- Extract global variables with types and sizes
- Extract segment/section information
- Support for both PDB 2.0 and PDB 7.0 formats
Installation
pip install purelypdb
Or install from source:
pip install -e .
Usage
from purelypdb import parse, get_type_size
# Parse a PDB file
pdb = parse("example.pdb")
# Access global symbols
for sym in pdb.STREAM_GSYM.globals:
print(sym.name, sym.offset)
# Access section headers
for sec in pdb.STREAM_SECT_HDR.sections:
print(sec.Name, sec.VirtualAddress)
# Get type size
size = get_type_size(pdb.STREAM_TPI.types, typind)
API
| Function | Parameters | Returns | Description |
|---|---|---|---|
parse(filename, fast_load=False) |
filename: PDB file pathfast_load: Skip some streams |
PDB object | Parse PDB file (auto-detect version) |
get_type_size(tpi_types, typind) |
tpi_types: Types from STREAM_TPItypind: Type index |
int | Get type size in bytes |
PDB Object Attributes
| Attribute | Type | Description |
|---|---|---|
STREAM_GSYM |
Stream | Global symbols |
STREAM_GSYM.globals |
List | List of symbol objects |
STREAM_SECT_HDR |
Stream | Section headers |
STREAM_SECT_HDR.sections |
List | List of section objects |
STREAM_TPI |
Stream | Type information |
STREAM_TPI.types |
Dict | Type index to type mapping |
Symbol Types
| Type | Value | Description |
|---|---|---|
| S_PUB32 | 0x110E | Public symbol |
| S_GDATA32 | 0x110D | Global data |
| S_LDATA32 | 0x110C | Local (file static) data |
| S_GPROC32 | 0x1110 | Global procedure |
| S_LPROC32 | 0x110F | Local procedure |
| S_GPROC32_ID | 0x1127 | Global procedure (ID version) |
| S_LPROC32_ID | 0x1128 | Local procedure (ID version) |
| S_GDATA32_ST | 0x1009 | Global data (ST version) |
| S_LDATA32_ST | 0x1008 | Local data (ST version) |
| S_GPROC32_ST | 0x100A | Global procedure (ST version) |
| S_LPROC32_ST | 0x100B | Local procedure (ST version) |
| S_PROCREF | 0x1125 | Procedure reference |
| S_LPROCREF | 0x1126 | Local procedure reference |
License
GPL v2
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file purelypdb-1.0.0.tar.gz.
File metadata
- Download URL: purelypdb-1.0.0.tar.gz
- Upload date:
- Size: 28.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ffdbe94b43aa9369a3fe56e3f483f63f004d4bbd768d6631d61cbf8c063fc488
|
|
| MD5 |
96a6f8b2890c5203b4934ea20733f42b
|
|
| BLAKE2b-256 |
dec02c6a8d4be7abde156e196ebd7d9a3163ab019ce4e625887491ba6ae6124d
|
File details
Details for the file purelypdb-1.0.0-py3-none-any.whl.
File metadata
- Download URL: purelypdb-1.0.0-py3-none-any.whl
- Upload date:
- Size: 31.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9f029ac222a81ba36bee8b075b00ef516856cc14c82c6639319b6cf2ce3db6cb
|
|
| MD5 |
2b013e054b0fe300d67b7c0a08e56f6d
|
|
| BLAKE2b-256 |
3acfa3ff9992879390497c84851ae3d0e7de4ce7210c74db9d0b798c49b98c27
|