microsoft/debugpy

can debug with compileall

Closed this issue · 4 comments

Layty commented

I want to know does it work with python3 -m compileall -b a.py ?

how to set pathMappings , I have set same path in my device and pc , but failed ? I want to know where to see the log ?

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Python Debugger: Remote Attach",
            "type": "debugpy",
            "request": "attach",
            "connect": {
                "host": "10.1.6.137",
                "port": 8888
            },
            "pathMappings": [
                {
                    "localRoot": "/home/xx/xxx/abc",
                    "remoteRoot": "/home/xx/xxx/abc"
                }
            ]
        }
    ]
}
Layty commented

I can connect and see the debug output , but I can not break. when I use the py in /home/solax/solaxems/abc , everythins works well

if you set

"logToFile": true

The logs will show up in the extension folder for the debugpy extension. On my machine that's here:

C:\Users\rchiodo\.vscode\extensions\ms-python.debugpy-2024.15.2024121701-win32-x64
Layty commented

my remote dir list

abc_dir
    a.py
    a.pyc

run python3 -m debugpy --listen 0.0.0.0:7777 a.pyc

I can break in vscode.

but when I delete abc_dir/a.py in remote, I can not debug , the log in extension tells me

"message": "Breakpoint in file that does not exist.",

so debugpy support without py source file in remote ?

or how to set

how Client tells Adapter set break in pyc not py

15435 Client --> Adapter:
{
    "command": "setBreakpoints",
    "arguments": {
        "source": {
            "name": "v1.py",
            "path": "/home/api/v1.py"              #################set  pyc ? 
        },
        "lines": [
            228
        ],
        "breakpoints": [
            {
                "line": 228
            }
        ],
        "sourceModified": false
    },
    "type": "request",
    "seq": 11
}

You can't debug pyc files. They are just cached versions of the byte code for a py file. The debugger needs the .py file.