Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix an over-suspend bug with LaunchInNewTerminalWithAppleScript sessions
When launching an inferior in a new terminal window via AppleScript and the darwin-debug helper program, we could often end up with the inferior process having a too-high suspend count, and it would never resume execution. lldb tries to wait until darwin-debug has finished its work and has launched the inferior (WaitForProcessToSIGSTOP) but this wasn't working correctly - and cannot be made to work. This patch removes WaitForProcessToSIGSTOP, adds a special tiny segment to the darwin-debug executable so it can be identified as that binary (ExecExtraSuspend), and adds code to debugserver to detect this segment. When debugserver sees this segment, it notes that the next exec will be done with a launch-suspended flag. When the next exec happens, debugserver forces an extra task_resume when we resume the inferior. An alternative approach would be if lldb could detect when the inferior has been launched by darwin-debug unambiguously; monitoring when the unix socket between darwin-debug and lldb was closed would have been a reasonable way to do this too. <rdar://problem/29760580> Differential Revision: https://reviews.llvm.org/D72963 (cherry picked from commit 83a131b)
- Loading branch information
1 parent
03f5015
commit fee6a7a
Showing
5 changed files
with
44 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,11 @@ | ||
|
||
# Create an LC_SEGMENT with the special name ExecExtraSuspend which | ||
# debugserver can detect - it tells debugserver that it will exec a | ||
# process and that process will start suspended, so debugserver will | ||
# need to double-resume it to make it run. A random file is copied | ||
# into the segment. | ||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-sectcreate,ExecExtraSuspend,ExecExtraSuspend,${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt") | ||
|
||
add_lldb_tool(darwin-debug ADD_TO_FRAMEWORK | ||
darwin-debug.cpp | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters