frostming · GitHub

Bug report

Bug description:

Run the following command on Linux:

sudo ./python -m pdb -p 5555

produces:

OSError: Cannot open process memory map file '/proc/5555/maps' for PID 5555 section search: No such file or directory
During handling of the above exception, another exception occurred:
RuntimeError: Failed to find the PyRuntime section in process 5555 on Linux platform
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
  File "/home/frost/workspace/cpython/Lib/runpy.py", line 198, in _run_module_as_main
    return _run_code(code, main_globals, None,
                     "__main__", mod_spec)
  File "/home/frost/workspace/cpython/Lib/runpy.py", line 88, in _run_code
    exec(code, run_globals)
    ~~~~^^^^^^^^^^^^^^^^^^^
  File "/home/frost/workspace/cpython/Lib/pdb.py", line 3650, in <module>
    pdb.main()
    ~~~~~~~~^^
  File "/home/frost/workspace/cpython/Lib/pdb.py", line 3579, in main
    attach(opts.pid, opts.commands)
    ~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/frost/workspace/cpython/Lib/pdb.py", line 3448, in attach
    sys.remote_exec(pid, connect_script.name)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: PyRuntime address lookup failed during debug offsets initialization

While ./python -m asyncio ps 5555 produces:

Error retrieving tasks: Cannot open process memory map file '/proc/5555/maps' for PID 5555 section search: No such file or directory

The latter is clearer.

CPython versions tested on:

CPython main branch

Operating systems tested on:

Linux

Linked PRs

Read the original on github.com ↗