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

Function test_special_maps

tests/unit/test_maps.py:224–293  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

222
223
224def test_special_maps():
225 # GIVEN
226
227 map_text = """
228555f1ab1c000-555f1ab3d000 rw-p 00000000 00:00 0 [heap]
2297ffdf8102000-7ffdf8124000 rw-p 00000000 00:00 0 [stack]
2307ffdf8152000-7ffdf8155000 r--p 00000000 00:00 0 [vvar]
2317ffdf8155000-7ffdf8156000 r-xp 00000000 00:00 0 [vdso]
232ffffffffff600000-ffffffffff601000 --xp 00000000 00:00 0 [vsyscall]
233 """
234
235 # WHEN
236
237 with patch("builtins.open", mock_open(read_data=map_text)):
238 maps = list(generate_maps_for_process(1))
239
240 # THEN
241
242 assert maps == [
243 VirtualMap(
244 start=93866958110720,
245 end=93866958245888,
246 filesize=135168,
247 offset=0,
248 device="00:00",
249 flags="rw-p",
250 inode=0,
251 path=Path("[heap]"),
252 ),
253 VirtualMap(
254 start=140728765259776,
255 end=140728765399040,
256 filesize=139264,
257 offset=0,
258 device="00:00",
259 flags="rw-p",
260 inode=0,
261 path=Path("[stack]"),
262 ),
263 VirtualMap(
264 start=140728765587456,
265 end=140728765599744,
266 filesize=12288,
267 offset=0,
268 device="00:00",
269 flags="r--p",
270 inode=0,
271 path=Path("[vvar]"),
272 ),
273 VirtualMap(
274 start=140728765599744,
275 end=140728765603840,
276 filesize=4096,
277 offset=0,
278 device="00:00",
279 flags="r-xp",
280 inode=0,
281 path=Path("[vdso]"),

Callers

nothing calls this directly

Calls 2

VirtualMapClass · 0.90

Tested by

no test coverage detected