vadimcn / codelldb

A native debugger extension for VSCode based on LLDB
https://marketplace.visualstudio.com/items?itemName=vadimcn.vscode-lldb
MIT License
2.42k stars 237 forks source link

Issue with two processes sharing similar path when using attach #1007

Closed osaxma closed 9 months ago

osaxma commented 9 months ago

OS: macos_x64 (21G115) VSCode version: Version: 1.82.2 CodeLLDB version: v1.10.0 Compiler: Apple clang version 14.0.0 (clang-1400.0.29.202) Debuggee: Mach-O 64-bit executable x86_64

Issue

I am getting the following error message when I try to run an attach request:

Could not attach: more than one process named /Users/osaxma/Projects/dart-sdk-dev/sdk/xcodebuild/DebugX64/dart:
PID    PARENT USER       TRIPLE                         ARGUMENTS
====== ====== ========== ============================== ============================
8985   8021   osaxma     x86_64-apple-macosx             /Users/osaxma/Projects/dart-sdk-dev/sdk/xcodebuild/DebugX64/dart --verbose-debug --trace-deoptimization run --observe --pause-isolates-on-start /Users/osaxma/playground/dart_breakpoint_issue_53376/test/dart_breakpoint_issue_53376_test.dart
8048   8002   osaxma     x86_64-apple-macosx             /Users/osaxma/Projects/dart-sdk-dev/sdk/xcodebuild/DebugX64/dart-sdk/bin/dart language-server --protocol=lsp --client-id=VS-Code --client-version=3.74.0

I am trying to debug the following process:

/Users/osaxma/Projects/dart-sdk-dev/sdk/xcodebuild/DebugX64/dart

but there's already another process with the following path:

 /Users/osaxma/Projects/dart-sdk-dev/sdk/xcodebuild/DebugX64/dart-sdk/bin/dart

which the extension confuses (most likely because they match exactly until the -).


my launch config:

{
    "name": "LLDB VM Service (attach)",
    "type": "lldb",
    "request": "attach",
    "program": "${workspaceFolder:sdk}/xcodebuild/DebugX64/dart",
},

As a workaround, I am using "pid": "${command:pickMyProcess}" instead.

vadimcn commented 9 months ago

Process name matching for attach is implemented in LLDB, nothing I can change about that. I'd recommend looking into Python scripting to automate your scenario.

osaxma commented 9 months ago

Thanks @vadimcn -- I totally missed out that you could launch the extension using the code command.

Cheers