Catalog PyPI
Back to packageRELEASE DETAILS

0.1.2

PyPI

address-to-line

Convert addresses to source file and line number

Published11 May 2023
Direct dependencies0
Transitive dependenciesNot calculated

README

Version 0.1.2 documentation

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)

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Declared dependencies 0

Native requirements
0 direct targetsNot calculated transitive count
No declared dependencies in this collected response

Declarations describe requirements; they are not a resolved dependency graph.

Distribution files

2 collected
address_to_line-0.1.2-py3-none-any.whl

bdist_wheel · 7.72 KB · Python py3

Source file
address_to_line-0.1.2.tar.gz

sdist · 5.36 KB · Python source

Source file

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 19:23 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package_version:eeb89f80fe126148da653dab438b47ce49d8ed163f846e2f71ca254df0272127

Other collected versions

View all collected versions →