[Lldb-commits] [PATCH] D155037: Improve error messaging when debugserver fails to complete attaching to another process on Darwin systems

Jason Molenda via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Jul 11 18:56:45 PDT 2023


jasonmolenda created this revision.
jasonmolenda added a reviewer: jingham.
jasonmolenda added a project: LLDB.
Herald added a subscriber: JDevlieghere.
Herald added a project: All.
jasonmolenda requested review of this revision.
Herald added a subscriber: lldb-commits.

On Darwin, we first get a process' mach task port with task_for_pid(), and then we do a ptrace(PT_ATTACHEXC).  We need to complete both before we are successfully attached.  There are unusual failures where we get the task port and the ptrace may not have completed entirely, so lldb is going to exit out.  An error message isn't created at the layer where this failure was detected, and then at a higher layer where we try to find a reason why the attach failed, we notice that the process is being "debugged" -- by ourselves -- and emit an error message saying it's being debugged.

This patch adds an error string at all the points where we can fail to complete this two-step attach process, and also adds a refinement to the "last ditch error reporting" scheme to confirm that the process' parent process isn't already this debugserver.  (we half-attached to it)


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D155037

Files:
  lldb/tools/debugserver/source/MacOSX/MachProcess.mm
  lldb/tools/debugserver/source/RNBRemote.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D155037.539357.patch
Type: text/x-patch
Size: 4408 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20230712/099a1dbc/attachment-0001.bin>


More information about the lldb-commits mailing list