HomePhabricator

When debugserver fails to attach to a process on a Darwin
AuditedrL243511

Description

When debugserver fails to attach to a process on a Darwin
system, make a couple of additional checks to see if the
attach was denied via the System Integrity Protection that
is new in Mac OS X 10.11. If so, return a special E87
error code to indicate this to lldb.

Up in lldb, if we receive the E87 error code, be specific
about why the attach failed.

Also detect the more common case of general attach failure
and print a better error message than "lost connection".

I believe this code will all build on Mac OS X 10.10 systems.
It may not compile or run on earlier versions of the OS.
None of this should build on other non-darwin systems.

Details

Auditors
dawn
Committed
jmolendaJul 28 2015, 6:42 PM
Parents
rL243510: [lldb-mi] Fix tests added in r243484 for breakpoints using file:func syntax.
Branches
Unknown
Tags
Unknown

Event Timeline

dawn raised a concern with this commit.Jul 30 2015, 3:58 PM
dawn added a subscriber: dawn.

This broke the build on OSX Mavericks using cmake. Error is:

Undefined symbols for architecture x86_64:
  "_csr_check", referenced from:
      RNBRemote::HandlePacket_v(char const*) in liblldbDebugserverCommon.a(RNBRemote.cpp.o)
  "_rootless_allows_task_for_pid", referenced from:
      RNBRemote::HandlePacket_v(char const*) in liblldbDebugserverCommon.a(RNBRemote.cpp.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

link command (from "ninja -v") is:

[66/150] Linking CXX executable bin/debugserver
FAILED: : && /usr/bin/c++   -std=c++11 -stdlib=libc++ -fPIC -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wcovered-switch-default -std=c++11 -fcolor-diagnostics -Wno-deprecated-declarations -Wno-unknown-pragmas -Wno-deprecated-register  -fno-exceptions -fno-rtti -Wno-gnu-zero-variadic-macro-arguments -Wno-vla-extension -Wno-zero-length-array -Wno-extended-offsetof -g -Wl,-search_paths_first -Wl,-headerpad_max_install_names -stdlib=libc++ -Wl,-sectcreate,__TEXT,__info_plist,/Users/dawn/llvm_master/tools/lldb/tools/debugserver/source/../resources/lldb-debugserver-Info.plist tools/lldb/tools/debugserver/source/MacOSX/CMakeFiles/debugserver.dir/HasAVX.s.o tools/lldb/tools/debugserver/source/MacOSX/CMakeFiles/debugserver.dir/CFBundle.cpp.o tools/lldb/tools/debugserver/source/MacOSX/CMakeFiles/debugserver.dir/CFData.cpp.o tools/lldb/tools/debugserver/source/MacOSX/CMakeFiles/debugserver.dir/CFString.cpp.o tools/lldb/tools/debugserver/source/MacOSX/CMakeFiles/debugserver.dir/Genealogy.cpp.o tools/lldb/tools/debugserver/source/MacOSX/CMakeFiles/debugserver.dir/MachException.cpp.o tools/lldb/tools/debugserver/source/MacOSX/CMakeFiles/debugserver.dir/MachProcess.mm.o tools/lldb/tools/debugserver/source/MacOSX/CMakeFiles/debugserver.dir/MachTask.mm.o tools/lldb/tools/debugserver/source/MacOSX/CMakeFiles/debugserver.dir/MachThread.cpp.o tools/lldb/tools/debugserver/source/MacOSX/CMakeFiles/debugserver.dir/MachThreadList.cpp.o tools/lldb/tools/debugserver/source/MacOSX/CMakeFiles/debugserver.dir/MachVMMemory.cpp.o tools/lldb/tools/debugserver/source/MacOSX/CMakeFiles/debugserver.dir/MachVMRegion.cpp.o tools/lldb/tools/debugserver/source/MacOSX/CMakeFiles/debugserver.dir/mach_excServer.c.o tools/lldb/tools/debugserver/source/MacOSX/CMakeFiles/debugserver.dir/mach_excUser.c.o tools/lldb/tools/debugserver/source/MacOSX/CMakeFiles/debugserver.dir/debugserver_vers.c.o  -o bin/debugserver  lib/liblldbDebugserverCommon.a lib/liblldbUtility.a lib/liblldbDebugserverMacOSX_I386.a lib/liblldbDebugserverMacOSX_X86_64.a -framework Cocoa -Wl,-rpath,@executable_path/../lib && cd /Users/dawn/llvm_master/build_ninja/bin && CODESIGN_ALLOCATE=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate codesign --force --sign lldb_codesign debugserver
dawn accepted this commit.Jul 30 2015, 5:29 PM

Link issue on Mavericks was resolved by http://reviews.llvm.org/D11668 and committed in svn rev.243715..