Skip to content

Commit da8fcf2

Browse files
authored
Add new attach failure detectors, emit meaningful msgs (#745)
* Add new attach failure detectors, emit meaningful msgs to the user about why the attach/process launch failed. * Fix TARGET_OS_OSX Targetconditional use.
1 parent 053704d commit da8fcf2

File tree

5 files changed

+277
-41
lines changed

5 files changed

+277
-41
lines changed

lldb/tools/debugserver/source/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ endif ()
8282

8383
check_library_exists(compression compression_encode_buffer "" HAVE_LIBCOMPRESSION)
8484

85+
find_library(SECURITY_LIBRARY Security)
86+
8587
add_subdirectory(MacOSX)
8688

8789
set(LLDB_CODESIGN_IDENTITY "" CACHE STRING
@@ -202,6 +204,8 @@ target_link_libraries(lldbDebugserverCommon
202204
${LOCKDOWN_LIBRARY}
203205
lldbDebugserverArchSupport
204206
lldbDebugserverDarwin_DarwinLog
207+
${FOUNDATION_LIBRARY}
208+
${SECURITY_LIBRARY}
205209
${LIBCOMPRESSION})
206210
if(HAVE_LIBCOMPRESSION)
207211
set_property(TARGET lldbDebugserverCommon APPEND PROPERTY
@@ -265,6 +269,7 @@ if(IOS)
265269
${FOUNDATION_LIBRARY}
266270
lldbDebugserverArchSupport
267271
lldbDebugserverDarwin_DarwinLog
272+
${SECURITY_LIBRARY}
268273
${LIBCOMPRESSION})
269274
if(HAVE_LIBCOMPRESSION)
270275
set_property(TARGET lldbDebugserverCommon_NonUI APPEND PROPERTY

lldb/tools/debugserver/source/DNB.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ typedef std::map<nub_process_t, MachProcessSP> ProcessMap;
5757
typedef ProcessMap::iterator ProcessMapIter;
5858
typedef ProcessMap::const_iterator ProcessMapConstIter;
5959

60-
size_t GetAllInfos(std::vector<struct kinfo_proc> &proc_infos);
6160
static size_t
6261
GetAllInfosMatchingName(const char *process_name,
6362
std::vector<struct kinfo_proc> &matching_proc_infos);
@@ -520,7 +519,7 @@ nub_process_t DNBProcessAttach(nub_process_t attach_pid,
520519
return INVALID_NUB_PROCESS;
521520
}
522521

523-
size_t GetAllInfos(std::vector<struct kinfo_proc> &proc_infos) {
522+
size_t DNBGetAllInfos(std::vector<struct kinfo_proc> &proc_infos) {
524523
size_t size = 0;
525524
int name[] = {CTL_KERN, KERN_PROC, KERN_PROC_ALL};
526525
u_int namelen = sizeof(name) / sizeof(int);
@@ -573,7 +572,7 @@ GetAllInfosMatchingName(const char *full_process_name,
573572

574573
const size_t process_name_len = strlen(process_name);
575574
std::vector<struct kinfo_proc> proc_infos;
576-
const size_t num_proc_infos = GetAllInfos(proc_infos);
575+
const size_t num_proc_infos = DNBGetAllInfos(proc_infos);
577576
if (num_proc_infos > 0) {
578577
uint32_t i;
579578
for (i = 0; i < num_proc_infos; i++) {

lldb/tools/debugserver/source/DNB.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ nub_size_t DNBProcessGetAvailableProfileData(nub_process_t pid, char *buf,
150150
nub_size_t buf_size) DNB_EXPORT;
151151
nub_size_t DNBProcessGetStopCount(nub_process_t pid) DNB_EXPORT;
152152
uint32_t DNBProcessGetCPUType(nub_process_t pid) DNB_EXPORT;
153+
size_t DNBGetAllInfos(std::vector<struct kinfo_proc> &proc_infos);
153154

154155
// Process executable and arguments
155156
const char *DNBProcessGetExecutablePath(nub_process_t pid);

0 commit comments

Comments
 (0)