darwin-debug is used to launch a binary while setting the current working directory/env vars/architecture, exec'ing it stopped so lldb can attach to it. This is used on macOS to launch a binary in a new Terminal window via AppleScript. If lldb attaches to the inferior, stopped on the first instruction, all is good. But if lldb attaches before the inferior is running, it will attach to darwin-debug, see the Exec mach exception when the inferior is run, but instead of the normal suspend count of 1 at this point, because darwin-debug asked it to be launch suspended, the suspend count will be 2. debugserver needs to double-resume the inferior to make it run.
This patch adds a specially named segment to darwin-debug so that it can be detected unambiguously by debugserver.
In debugserver, if we attach to a process with the specially named segment, set a flag that will be checked the next time we received an Exec mach exception. When that Exec comes in, set a flag that will be checked the next time we go to resume the inferior to indicate that we need to resume it twice to allow it to run.