Open okz opened 4 years ago
This feature is very much arch-specific, and we don't support it on ARM.
That said, this needs a better error message.
There are currently multiple issues for ARM/ARM64: https://github.com/microsoft/debugpy/issues/181 https://github.com/microsoft/debugpy/issues/182 https://github.com/microsoft/debugpy/issues/183 https://github.com/microsoft/debugpy/issues/184 https://github.com/microsoft/debugpy/issues/286
Should we close all of those and just let this one open to add support for ARM?
-- when the time comes to actually tackle it we can open minor items (if needed) to keep track of individual steps.
Or should this one used just to provide a better error message?
I think this one is about reporting the error clearly at this point.
Those other issues are separate, because the debugger itself already works on ARM platforms, just not the native bits like attach-to-PID. So there's no reason why we shouldn't be running CI on ARM today already, if we could easily do that.
Trying to attach a running process on an ARM processor, either in the command line or in vs code fails with:
Running gdb in target process. stdout: b'[New LWP 5629]\n[New LWP 5630]\n[Thread debugging using libthread_db enabled]\nUsing host libthread_db library "/lib/arm-linux-gnueabihf/libthread_db.so.1".\n0xb6f2fbf0 in poll () from /lib/arm-linux-gnueabihf/libc.so.6\n$1 = (void *) 0x0\n' stderr: b'Undefined item: "i386".\nNo symbol "DoAttach" in current context.\n'
VS code report attached.
Environment data
Actual behavior
XXX
Expected behavior
XXX
Steps to reproduce:
I+00000.149: Linux-4.9.0-xilinx-armv7l-with-Ubuntu-16.04-xenial armv7l CPython 3.5.2 (32-bit) debugpy 1.0.0b11
I+00000.187: debugpy.adapter startup environment:
I+00000.198: Listening for incoming Client connections on 127.0.0.1:35551...
I+00000.200: Connecting to client over stdio...
D+00000.204: Starting message loop for channel Client[1]
D+00000.212: Client[1] <-- { "seq": 1, "type": "event", "event": "output", "body": { "data": { "packageVersion": "1.0.0b11" }, "output": "ptvsd", "category": "telemetry" } }
D+00000.217: Client[1] <-- { "seq": 2, "type": "event", "event": "output", "body": { "data": { "packageVersion": "1.0.0b11" }, "output": "debugpy", "category": "telemetry" } }
D+00000.222: Client[1] --> { "seq": 1, "type": "request", "command": "initialize", "arguments": { "supportsVariableType": true, "clientName": "Visual Studio Code", "columnsStartAt1": true, "supportsProgressReporting": true, "clientID": "vscode", "locale": "en-us", "pathFormat": "path", "supportsVariablePaging": true, "adapterID": "python", "supportsRunInTerminalRequest": true, "linesStartAt1": true } }
D+00000.229: /handling #1 request "initialize" from Client[1]/ Capabilities: { "supportsVariableType": true, "supportsRunInTerminalRequest": true, "supportsMemoryReferences": false, "supportsVariablePaging": true }
D+00000.230: /handling #1 request "initialize" from Client[1]/ Expectations: { "columnsStartAt1": true, "locale": "en-us", "pathFormat": "path", "linesStartAt1": true }
D+00000.239: /handling #1 request "initialize" from Client[1]/ Client[1] <-- { "seq": 3, "type": "response", "request_seq": 1, "success": true, "command": "initialize", "body": { "supportsLogPoints": true, "supportsGotoTargetsRequest": true, "supportsExceptionOptions": true, "supportsDebuggerProperties": true, "supportsCompletionsRequest": true, "supportsValueFormattingOptions": true, "supportsDelayedStackTraceLoading": true, "supportsModulesRequest": true, "supportsTerminateDebuggee": true, "supportsExceptionInfoRequest": true, "supportsSetVariable": true, "exceptionBreakpointFilters": [ { "default": false, "label": "Raised Exceptions", "filter": "raised" }, { "default": true, "label": "Uncaught Exceptions", "filter": "uncaught" } ], "supportsConfigurationDoneRequest": true, "supportsEvaluateForHovers": true, "supportsSetExpression": true, "supportsConditionalBreakpoints": true, "supportsHitConditionalBreakpoints": true } }
D+00000.249: Client[1] --> { "seq": 2, "type": "request", "command": "attach", "arguments": { "logToFile": true, "name": "Python: Attach using Process Id", "justMyCode": true, "debugOptions": [ "RedirectOutput", "UnixClient", "ShowReturnValue" ], "pathMappings": [ { "remoteRoot": "/root/LDSSoftware", "localRoot": "/root/LDSSoftware" } ], "host": "localhost", "request": "attach", "__sessionId": "44be5c52-ead1-4c20-9572-00ada87c73fa", "processId": "2961", "showReturnValue": true, "workspaceFolder": "/root/LDSSoftware", "type": "python" } }
I+00000.252: /handling #2 request "attach" from Client[1]/ Listening for incoming Server connections on 127.0.0.1:40927...
I+00000.254: /handling #2 request "attach" from Client[1]/ Spawning attach-to-PID debugger injector: ['/usr/bin/python3', '/root/.vscode-server/extensions/ms-python.python-2020.5.86806/pythonFiles/lib/python/debugpy/no_wheels/debugpy', '--connect', '127.0.0.1:40927', '--adapter-access-token', '743df3e981173bf6b5d4aa196f062e65bd13982026f64051f51f4dce4098791b', '--pid', '2961']
D+00000.272: /handling #2 request "attach" from Client[1]/ Client[1] <-- { "seq": 4, "type": "event", "event": "debugpyWaitingForServer", "body": { "port": 40927, "host": "127.0.0.1" } }
I+00000.281: /handling #2 request "attach" from Client[1]/ Session[1] waiting for connection from debug server...
I+00009.245: Injector[PID=2961] output: b'Attaching with arch: i386'
I+00009.309: Injector[PID=2961] output: b'Running: gdb --nw --nh --nx --pid 2961 --batch --eval-command=\'set scheduler-locking off\' --eval-command=\'set architecture i386\' --eval-command=\'call (void*)dlopen("/root/.vscode-server/extensions/ms-python.python-2020.5.86806/pythonFiles/lib/python/debugpy/no_wheels/debugpy/_vendored/pydevd/pydevd_attach_to_process/attach_linux_x86.so", 2)\' --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([47, 114, 111, 111, 116, 47, 46, 118, 115, 99, 111, 100, 101, 45, 115, 101, 114, 118, 101, 114, 47, 101, 120, 116, 101, 110, 115, 105, 111, 110, 115, 47, 109, 115, 45, 112, 121, 116, 104, 111, 110, 46, 112, 121, 116, 104, 111, 110, 45, 50, 48, 50, 48, 46, 53, 46, 56, 54, 56, 48, 54, 47, 112, 121, 116, 104, 111, 110, 70, 105, 108, 101, 115, 47, 108, 105, 98, 47, 112, 121, 116, 104, 111, 110, 47, 100, 101, 98, 117, 103, 112, 121, 47, 110, 111, 95, 119, 104, 101, 101, 108, 115, 47, 100, 101, 98, 117, 103, 112, 121, 47, 46, 46, 47, 100, 101, 98, 117, 103, 112, 121, 47, 115, 101, 114, 118, 101, 114]);setup = json.loads(decode([123, 34, 119, 97, 105, 116, 95, 102, 111, 114, 95, 99, 108, 105, 101, 110, 116, 34, 58, 32, 102, 97, 108, 115, 101, 44, 32, 34, 97, 100, 100, 114, 101, 115, 115, 34, 58, 32, 91, 34, 49, 50, 55, 46, 48, 46, 48, 46, 49, 34, 44, 32, 52, 48, 57, 50, 55, 93, 44, 32, 34, 108, 111, 103, 95, 116, 111, 34, 58, 32, 110, 117, 108, 108, 44, 32, 34, 97, 100, 97, 112, 116, 101, 114, 95, 97, 99, 99, 101, 115, 115, 95, 116, 111, 107, 101, 110, 34, 58, 32, 34, 55, 52, 51, 100, 102, 51, 101, 57, 56, 49, 49, 55, 51, 98, 102, 54, 98, 53, 100, 52, 97, 97, 49, 57, 54, 102, 48, 54, 50, 101, 54, 53, 98, 100, 49, 51, 57, 56, 50, 48, 50, 54, 102, 54, 52, 48, 53, 49, 102, 53, 49, 102, 52, 100, 99, 101, 52, 48, 57, 56, 55, 57, 49, 98, 34, 44, 32, 34, 109, 111, 100, 101, 34, 58, 32, 34, 99, 111, 110, 110, 101, 99, 116, 34, 125]));sys.path.insert(0, script_dir);import attach_pid_injected;del sys.path[0];attach_pid_injected.attach(setup);", 0)\''
I+00009.310: Injector[PID=2961] output: b'Running gdb in target process.'
I+00009.339: Injector[PID=2961] output: b'stdout: b\'[New LWP 2962]\n[New LWP 2963]\n[Thread debugging using libthread_db enabled]\nUsing host libthread_db library "/lib/arm-linux-gnueabihf/libthread_db.so.1".\n0xb6f28bf0 in poll () from /lib/arm-linux-gnueabihf/libc.so.6\n$1 = (void *) 0x0\n\''
I+00009.341: Injector[PID=2961] output: b'stderr: b\'Undefined item: "i386".\nNo symbol "DoAttach" in current context.\n\''
I+00009.613: Injector[PID=2961] exited.
I+00010.292: All debug servers disconnected; waiting for remaining sessions...
E+00010.321: /handling #2 request "attach" from Client[1]/ Traceback (most recent call last): File "/root/.vscode-server/extensions/ms-python.python-2020.5.86806/pythonFiles/lib/python/debugpy/no_wheels/debugpy/adapter/../../debugpy/common/messaging.py", line 1058, in init raise self debugpy.common.messaging.MessageHandlingError: Timed out waiting for debug server to connect.
D+00010.328: /handling #2 request "attach" from Client[1]/ Client[1] <-- { "seq": 5, "type": "response", "request_seq": 2, "success": false, "command": "attach", "message": "Timed out waiting for debug server to connect." }
D+00010.338: Client[1] --> { "seq": 3, "type": "request", "command": "disconnect", "arguments": { "restart": false } }
E+00010.459: /handling #2 request "attach" from Client[1]/ Handler 'Client._start_message_handler..handle' (file '/root/.vscode-server/extensions/ms-python.python-2020.5.86806/pythonFiles/lib/python/debugpy/no_wheels/debugpy/adapter/../../debugpy/adapter/components.py', line 171)
couldn't handle #2 request "attach" from Client[1]:
Timed out waiting for debug server to connect.
I+00010.461: /handling #3 request "disconnect" from Client[1]/ client requested "disconnect"; finalizing Session[1].
D+00010.466: /handling #3 request "disconnect" from Client[1]/ Client[1] <-- { "seq": 6, "type": "event", "event": "terminated" }
I+00010.468: /handling #3 request "disconnect" from Client[1]/ Session[1] finalized.
D+00010.474: /handling #3 request "disconnect" from Client[1]/ Client[1] <-- { "seq": 7, "type": "response", "request_seq": 3, "success": true, "command": "disconnect" }