I'm running a cross compiled python for aarch64. I've a setup qemu-aarch64 as the interpreter at /proc/sys/fs/binfmt_misc/qemu-aarch64 to be able to run the cross compiled program.
>>> import psutil
>>> import os
>>> p = psutil.Process(os.getpid())
>>> p.memory_maps()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/path/to/prefix/lib/python3.12/site-packages/psutil/__init__.py", line 1178, in memory_maps
it = self._proc.memory_maps()
^^^^^^^^^^^^^^^^^^^^^^^^
File "/path/to/prefix/lib/python3.12/site-packages/psutil/_pslinux.py", line 1717, in wrapper
return fun(self, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/path/to/prefix/lib/python3.12/site-packages/psutil/_pslinux.py", line 2091, in memory_maps
for header, data in get_blocks(lines, current_block):
File "/path/to/prefix/lib/python3.12/site-packages/psutil/_pslinux.py", line 2069, in get_blocks
data[fields[0]] = int(fields[1]) * 1024
~~~~~~^^^
IndexError: list index out of range
As one can see, there is no value in front of VmFlags (in the very first entry):
Summary
Description
I'm running a cross compiled python for aarch64. I've a setup
qemu-aarch64
as the interpreter at/proc/sys/fs/binfmt_misc/qemu-aarch64
to be able to run the cross compiled program.As one can see, there is no value in front of VmFlags (in the very first entry):
The following diff resolves the issue, but I'm not 100% sure if it is the right fix as it seems more like a workaround:
Interestingly enough, if I read the
/proc/<pid>/smaps
file directly, VmFlags isn't unset: