You do not need to attach to the extension of your application manually. Xcode should take care of all this automatically.
Look at the launcher editor for your extension schema. The executable file will be installed in your application or "Ask for launch". In any case, launching the target will lead to the launch of the application you have selected.
Go to this application on your device, create / select everything that is in the application that you want to provide, click the sharing icon, select the extension in the list of active sharing extensions. Then, when your distribution extension starts, the debugger automatically connects to it. This may take a couple of seconds, but you will see that your extension with all its threads appears in the Navigator Navigator, and if you set any breakpoints, it should stop at them.
If you do this like this, the debugger will also connect to stdout so that you see the log messages in the debugger console.
source share