Skip to main content

symparsepy is a Rust-based Python package for parsing symbols from PDB files. This package leverages the pyo3 library to create Python bindings for Rust code.

Project description

symparsepy

symparsepy is a Rust-based Python package for parsing symbols from PDB files. This package leverages the pyo3 library to create Python bindings for Rust code.

Installation

To install symparsepy, you need to build the package into a wheel file and then install it using pip. Follow these steps:

  1. Install Maturin:

    pip install maturin
    
  2. Build the Wheel: Run the following command in your terminal to build the wheel file:

    maturin build
    

    This will generate a .whl file in the target/wheels directory.

  3. Install the Wheel: You can install the generated wheel file using pip:

    pip install target/wheels/symparsepy-0.1.0-cp39-cp39-win_amd64.whl
    

Usage

Here is an example of how to use symparsepy in your Python code:

Parsing PDB Files

The parse_pdb function parses symbols from a PDB file and returns a list of dictionaries, each containing the parsed symbol information.

import symparsepy

# Example usage
result = symparsepy.parse_pdb("path_to_pdb_file.pdb")
for symbol in result:
    print(symbol)

Each dictionary includes the following keys:

  • offset: The offset value of the symbol.
  • section: The section value of the symbol.
  • name: The name of the symbol.
  • code: Indicates if the symbol is code.
  • msil: Indicates if the symbol is MSIL.
  • function: Indicates if the symbol is a function.

Example Output

[
    {
        "offset": "421376",
        "section": "1",
        "name": "symbol_name",
        "code": "true",
        "msil": "false",
        "function": "true"
    },
    ...
]

Searching Symbols

The search_symbols function searches for symbols in a PDB file that match a given regex pattern and returns a list of dictionaries with the matching symbols.

import symparsepy

# Example usage
pattern = r"some_regex_pattern"
result = symparsepy.search_symbols("path_to_pdb_file.pdb", pattern)
for symbol in result:
    print(symbol)

Each dictionary includes the same keys as in the parse_pdb function.

Development

To contribute to this project, follow these steps:

  1. Clone the repository:

    git clone https://github.com/yourusername/symparsepy.git
    cd symparsepy
    
  2. Install the development dependencies:

    pip install maturin
    
  3. Build the project:

    maturin develop
    
  4. Run tests:

    pytest
    

License

This project is licensed under the MIT License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

symparsepy-0.1.0.tar.gz (5.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

symparsepy-0.1.0-cp312-cp312-manylinux_2_34_x86_64.whl (976.9 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.34+ x86-64

File details

Details for the file symparsepy-0.1.0.tar.gz.

File metadata

  • Download URL: symparsepy-0.1.0.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.7.4

File hashes

Hashes for symparsepy-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c772451a70af302f89f4ce394d2cf4af93b00f6b7ab04d923b7caad2cafef164
MD5 975b5a2aa516a2f9ba8abcbae218326e
BLAKE2b-256 1140dc75cf82bad0cfa6c9d118e5b77c11f89521ab2c3810b0274bdb2fc1fb22

See more details on using hashes here.

File details

Details for the file symparsepy-0.1.0-cp312-cp312-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for symparsepy-0.1.0-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 12d01cbab631b3504c31fdabc96eaf65f2c2a5f04614db3f9b5f3a1809989c19
MD5 78dffea9b4fd54a64fd3677fa7ac64be
BLAKE2b-256 580ec1dc4f476951cd696bd3c14672e3ff5147fd085513b3951c2287fe7e09fa

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page