[all-commits] [llvm/llvm-project] 83a131: Fix an over-suspend bug with LaunchInNewTerminalWi...

Jason Molenda via All-commits all-commits at lists.llvm.org
Tue Jan 21 14:55:52 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 83a131b276426a0dc97f43c139a0f3b308f24154
      https://github.com/llvm/llvm-project/commit/83a131b276426a0dc97f43c139a0f3b308f24154
  Author: Jason Molenda <jmolenda at apple.com>
  Date:   2020-01-21 (Tue, 21 Jan 2020)

  Changed paths:
    M lldb/source/Host/macosx/objcxx/Host.mm
    M lldb/tools/darwin-debug/CMakeLists.txt
    M lldb/tools/debugserver/source/MacOSX/MachProcess.mm
    M lldb/tools/debugserver/source/MacOSX/MachTask.h
    M lldb/tools/debugserver/source/MacOSX/MachTask.mm

  Log Message:
  -----------
  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




More information about the All-commits mailing list