MCPcopy Create free account
hub / github.com/bloomberg/pystack / generate_maps_for_process

Function generate_maps_for_process

src/pystack/maps.py:108–127  ·  view source on GitHub ↗
(pid: int)

Source from the content-addressed store, hash-verified

106
107
108def generate_maps_for_process(pid: int) -> Iterable[VirtualMap]:
109 proc_maps_lines = _read_maps(pid)
110 for index, line in enumerate(proc_maps_lines):
111 line = line.rstrip("\n")
112 match = MAPS_REGEXP.match(line)
113 if not match:
114 LOGGER.debug("Line %r cannot be recognized!", line)
115 continue
116
117 path = match.group("pathname")
118 yield VirtualMap(
119 start=int(match.group("start"), 16),
120 end=int(match.group("end"), 16),
121 filesize=int(match.group("end"), 16) - int(match.group("start"), 16),
122 offset=int(match.group("offset"), 16),
123 device=match.group("dev"),
124 flags=match.group("permissions"),
125 inode=int(match.group("inode")),
126 path=Path(path) if path else None,
127 )
128
129
130def generate_maps_from_core_data(

Calls 2

_read_mapsFunction · 0.85
VirtualMapClass · 0.70