Files
Custom-Operating-System/utils/qprof/AddrResolver.py

17 lines
444 B
Python
Raw Normal View History

2025-02-12 09:54:05 -05:00
import subprocess
import os
class AddrResolver:
def __init__(self, path):
self.path = path
self.cache = {}
def get(self, addr):
if addr not in self.cache:
s = subprocess.check_output(
"i686-elf-addr2line --demangle -fsp -e " + self.path + " " + hex(addr), shell=True)
s = s.decode("ascii")
self.cache[addr] = s.split(" ")[0]
return self.cache[addr]