swiftlang / vscode-swift

Visual Studio Code Extension for Swift
https://marketplace.visualstudio.com/items?itemName=sswg.swift-lang
Apache License 2.0
713 stars 47 forks source link

swift-lldb ignores the path when attaching to a process by program path #745

Closed tristanlabelle closed 3 months ago

tristanlabelle commented 3 months ago

Describe the bug swift-lldb attach debug configurations only match the executable filename despite being documented to match the full path: https://github.com/swift-server/vscode-swift/blob/f3b76be242feda0763170aa14ff555386b607527/package.json#L991

To Reproduce Steps to reproduce the behavior:

  1. Run two programs with the same filename from two different directories
  2. Create a launch.json configuration to attach to one of the program by full path
  3. Start debugging that configuration
  4. An error appears saying that the resolution is ambiguous:

image

Expected behavior The debugger attaches to the process whose full path matches the one requested.

Environment

tristanlabelle commented 3 months ago

I looked into this a bit and I'm not sure what component is doing the process listing and matching.

adam-fowler commented 3 months ago

I think this is a limitation of LLDB. The error message is coming from here https://github.com/apple/llvm-project/blob/00c794fb25f1085c060d5c46e34cbb6145837f1f/lldb/source/Target/Process.cpp#L3023

tristanlabelle commented 3 months ago

It looks like the name matching is only happening on the process filename, not full path: https://github.com/apple/llvm-project/blob/3cba3c783ca8712981734ee8ef7f2f56685a7a68/lldb/source/Utility/ProcessInfo.cpp#L301 .

I'll file a bug on lldb, but in the meanwhile the description of "program" is misleading.

tristanlabelle commented 3 months ago

Filed on LLDB as https://github.com/llvm/llvm-project/issues/88515 . Should we close this issue?

adam-fowler commented 3 months ago

Nothing we can do about it here