[Lldb-commits] [PATCH] D72963: When darwin-debug exec's inferior suspended, make debugserver know that suspend count is higher than normal

Jason Molenda via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Jan 17 15:39:59 PST 2020


jasonmolenda created this revision.
jasonmolenda added a reviewer: jingham.
jasonmolenda added a project: LLDB.
Herald added a subscriber: mgorny.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D72963

Files:
  lldb/tools/darwin-debug/CMakeLists.txt
  lldb/tools/debugserver/source/MacOSX/MachProcess.mm
  lldb/tools/debugserver/source/MacOSX/MachTask.h
  lldb/tools/debugserver/source/MacOSX/MachTask.mm

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D72963.238909.patch
Type: text/x-patch
Size: 5032 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20200117/a89342e9/attachment-0001.bin>


More information about the lldb-commits mailing list