codelldb: Attaching to remote process using debugserver on Mac/iOS is not working

OS: macOS 11.5.2 VSCode version: 1.60.0 CodeLLDB version: v1.6.6 Debuggee: iOS app on iOS device

When trying to attach to an process on a remote iOS device using remote-ios platform, I get the following error.

process is connected and already has a listener, pass empty listener

Here is the config used.

{
	"name": "Attach",
	"type": "lldb",
	"request": "attach",
	"program": "<path to .app>",
	"pid": <pid>,
	"initCommands": [
		"platform select remote-ios",
	],
	"preRunCommands": [
		"process connect connect://127.0.0.1:5555", // iOS debugserver is exposed here
	],
},

Seems like the error is originating here: https://github.com/llvm/llvm-project/blob/main/lldb/source/API/SBTarget.cpp#L89

When the process is already connected it does not expect the event listener to be passed in the attach info object. And in this case, the process is already created and connected by running “process connect”.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 18 (16 by maintainers)

Most upvoted comments

Interesting… As far as I can tell, listener subscriptions in handle_initialize are sufficient to receive all debug events needed by codelldb. Care to try this build?

What all events do we expect via this route?

Process stopped/continued, etc, IIRC.

Curious: how does custom launch work around the event listener not attached to process issue?

https://github.com/vadimcn/vscode-lldb/blob/v1.6.6/adapter/src/debug_session.rs#L728

This isn’t very reliable, though, as in theory, an event could be emitted before we’ve had a change to add a listener.

it also work when app has launched