address_to_line
Translate return addresses into source locations using the readelf and addr2line utilities from the GNU Binutils package.
Requirements
This package depends on the readelf and addr2line utilities from the GNU Binutils package.
Usage
Converting return addresses captured from within some process requires a copy of that process' /proc/[pid]/maps file.
Command line:
python3 -m address_to_line <proc_map_file> <addresses>
where proc_map_file is a copy of a process' /proc/[pid]/maps file and addresses is a text file containing 1 (hexaecimal) return address per line.
Code:
from address_to_line import resolve_source_locations
proc_map_file = "memory_map.txt" # The relevant /proc/[pid]/maps file
addresses_file = "addresses.txt" # Contains 1 (hexadecimal) return address per line
with open(addresses_file, "r") as f:
addresses = [int(line, base=16) for line in f.readlines()]
# A list of named tuples of address, function, source file and line
source_locations = resolve_source_locations("memory_map.txt", addresses)
Metadata
Release files for address-to-line 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| address_to_line-0.1.2.tar.gz | 5.5 kB | Without provenance | Details for address_to_line-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| address_to_line-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for address_to_line-0.1.2-py3-none-any.whl |
Total release size: 13.4 kB
Release files / address_to_line-0.1.2.tar.gz
| Download URL | address_to_line-0.1.2.tar.gz |
|---|---|
| Size | 5.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a8a785d2de2e154a9ac24ef423815d70ad1839fd86894e0b0e768fa77951ccdc
|
|
BLAKE2b-256 checksum How to use checksums |
713442d50e8f9e74f3cf088ff717e32bb8c90ffdacffdeb2ce7b222aedefdeec
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.10
|
Release files / address_to_line-0.1.2-py3-none-any.whl
| Download URL | address_to_line-0.1.2-py3-none-any.whl |
|---|---|
| Size | 7.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
73f2a59b8ba76df160d4e9f1e2790c852c0c905ea21b8e7d3b4e56eb481ef6ea
|
|
BLAKE2b-256 checksum How to use checksums |
f6387b9dae4708728a8d054d29ffdac0bff066a1c545b5d977bafba218a2f9ff
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.10
|
Security for address-to-line 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.