Metadata-Version: 2.4
Name: purelypdb
Version: 1.0.0
Summary: Cross-platform Python parser for Microsoft PDB files with no external dependencies
Author: saileaxh
License: GPL-2.0-only
Project-URL: Homepage, https://github.com/dejavu-secure/PurelyPDB
Project-URL: Repository, https://github.com/dejavu-secure/PurelyPDB
Keywords: pdb,debug,symbols,microsoft,windows,parsing
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Debuggers
Classifier: Topic :: Software Development :: Disassemblers
Requires-Python: >=3.7
Description-Content-Type: text/markdown
License-File: LICENSE
Provides-Extra: dev
Requires-Dist: pytest; extra == "dev"
Requires-Dist: build; extra == "dev"
Requires-Dist: twine; extra == "dev"
Dynamic: license-file

# PurelyPDB

Cross-platform Python parser for Microsoft PDB files with no external dependencies.

Based on [pdbparse](https://github.com/moyix/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

```bash
pip install purelypdb
```

Or install from source:

```bash
pip install -e .
```

## Usage

```python
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 path<br>`fast_load`: Skip some streams | PDB object | Parse PDB file (auto-detect version) |
| `get_type_size(tpi_types, typind)` | `tpi_types`: Types from STREAM_TPI<br>`typind`: 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
