Skip to content

Undocumented gdb Version (> 11.1) Requirements for Python Attach Mode  #1480

@realaslam786

Description

@realaslam786

Type: Bug

Behaviour

Expected vs. Actual

Minimum gdb version requirements need to be clearly specified.

Steps to reproduce:

Diagnostic data

  • Python version (& distribution if applicable, e.g. Anaconda): 3.9.18
  • Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): Unknown
  • Value of the python.languageServer setting: Default
There are undocumented (implicit) requirements on having gdb version > 11.1 available for Python Attach debug configuration to work.
  1. The requirement to have a gdb installation available in the Path is not documented as the pre-requisites for the extension. A gdb in Path is needed for the Python Attach mode debug configurations to work.

  2. The minimum gdb requirement is not specified. The extension fails to attach to an existing process with gdb version 11.1. However, it has been successfully tested with gdb version 12.1. With gdb version 11.1. The following is part of the error logs shown in the Debug Console for gdb version 11.1.

Attach to PID failed.

--- Starting attach to pid: xx---
[New LWP xx]
[New LWP xx]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
0x00007f4c08f5170c in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
The target architecture is set to "auto" (currently "i386:x86-64").
Couldn't write extended state status: Bad address.
No symbol "DoAttach" in current context.
[Inferior 1 (process 136643) detached]
E+00003.400: Code injection into PID=136643 failed

Traceback (most recent call last):
File "/.../ms-python.python-2023.20.0/pythonFiles/lib/python/debugpy/adapter/../../debugpy/../debugpy/server/cli.py", line 391, in attach_to_pid
add_code_to_python_process.run_python_code(
File "/.../ms-python.python-2023.20.0/pythonFiles/lib/python/debugpy/_vendored/pydevd/pydevd_attach_to_process/add_code_to_python_process.py", line 471, in run_python_code_linux
subprocess.check_call(' '.join(cmd), shell=True, env=env)
File "/...//python3.9/subprocess.py", line 373, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command 'gdb --nw --nh --nx --pid 136643 --batch --eval-command='set scheduler-locking off' --eval-command='set architecture auto' --eval-command='call (void*)dlopen("/.../ms-python.python-2023.20.0/pythonFiles/lib/python/debugpy/_vendored/pydevd/pydevd_attach_to_process/attach_linux_amd64.so", 2)' --eval-command='sharedlibrary attach_linux_amd64' --eval-command='call (int)DoAttach(0, "import codecs;import json;import sys;decode = lambda s: codecs.utf_8_decode(bytearray(s))[0] if s is not None else None;script_dir = decode ...

XXX

User Settings


languageServer: "Pylance"

Extension version: 2023.16.0
VS Code version: Code 1.85.0 (af28b32d7e553898b2a91af498b1fb666fdebe0c, 2023-12-06T20:48:09.019Z)
OS version: Windows_NT x64 10.0.22621
Modes:
Remote OS version: Linux x64 5.14.21-150400.22-default
Remote OS version: Linux x64 5.14.21-150400.22-default

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions