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.
To install symparsepy
, you need to build the package into a wheel file and then install it using pip
. Follow these steps:
-
Install Maturin:
pip install maturin
-
Build the Wheel: Run the following command in your terminal to build the wheel file:
maturin build
This will generate a
.whl
file in thetarget/wheels
directory. -
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
Here is an example of how to use symparsepy
in your Python code:
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.
[
{
"offset": "421376",
"section": "1",
"name": "symbol_name",
"code": "true",
"msil": "false",
"function": "true"
},
...
]
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.
To contribute to this project, follow these steps:
-
Clone the repository:
git clone https://github.com/P1tt1cus/SymparsePy cd SymparsePy
-
Install the development dependencies:
pip install maturin
-
Build the project:
maturin build
This project is licensed under the MIT License.