mirror of
https://github.com/darlinghq/darling.git
synced 2024-11-23 20:29:47 +00:00
dSYM generation improvements, thread name support for LLDB
This commit is contained in:
parent
47ebdceea1
commit
e8b0fd94dc
@ -1,12 +1,13 @@
|
||||
|
||||
function(dsym target)
|
||||
if (DSYMUTIL_EXE AND CMAKE_BUILD_TYPE MATCHES DEBUG)
|
||||
string(TOLOWER "${CMAKE_BUILD_TYPE}" build_type)
|
||||
if (DSYMUTIL_EXE AND build_type MATCHES debug)
|
||||
|
||||
add_custom_command(OUTPUT "${target}.dSYM" COMMAND ${CMAKE_COMMAND} -E env
|
||||
add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${target}.dSYM" DEPENDS "${target}" COMMAND ${CMAKE_COMMAND} -E env
|
||||
"PATH=${CMAKE_BINARY_DIR}/src/external/cctools-port/cctools/misc:$ENV{PATH}"
|
||||
"${DSYMUTIL_EXE}" "-flat" "-o" "${target}.dSYM" "$<TARGET_FILE:${target}>")
|
||||
|
||||
add_custom_target("${target}-dSYM" ALL DEPENDS "${target}" "${target}.dSYM" getuuid lipo)
|
||||
add_custom_target("${target}-dSYM" ALL DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/${target}.dSYM" getuuid lipo)
|
||||
|
||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${target}.dSYM" DESTINATION "${CMAKE_INSTALL_PREFIX}/libexec/darling/System/Library/Caches/dsym/files")
|
||||
install(DIRECTORY DESTINATION "${CMAKE_INSTALL_PREFIX}/libexec/darling/System/Library/Caches/dsym/uuid")
|
||||
@ -26,13 +27,13 @@ function(dsym target)
|
||||
endforeach (uuid)
|
||||
endif()
|
||||
")
|
||||
|
||||
endif ()
|
||||
|
||||
endfunction(dsym)
|
||||
|
||||
function(FindDsymutil)
|
||||
find_program(DSYMUTIL_EXE NAMES "llvm-dsymutil" "dsymutil" "llvm-dsymutil-7.0" "llvm-dsymutil-6.0" "llvm-dsymutil-5.0" "llvm-dsymutil-4.0" "llvm-dsymutil-3.9" "llvm-dsymutil-3.8" "llvm-dsymutil-3.7")
|
||||
# llvm-dsymutil-4.0 is not listed, because it's very buggy
|
||||
find_program(DSYMUTIL_EXE NAMES "llvm-dsymutil" "dsymutil" "llvm-dsymutil-7.0" "llvm-dsymutil-6.0" "llvm-dsymutil-5.0" "llvm-dsymutil-3.9" "llvm-dsymutil-3.8" "llvm-dsymutil-3.7")
|
||||
if (DSYMUTIL_EXE)
|
||||
message(STATUS "Found dsymutil: ${DSYMUTIL_EXE}")
|
||||
else (DSYMUTIL_EXE)
|
||||
|
@ -81,7 +81,7 @@ static long _proc_pidinfo_regionpathinfo(int32_t pid, uint64_t arg, void* buffer
|
||||
static long _proc_pidinfo_shortbsdinfo(int32_t pid, void* buffer, int32_t bufsize);
|
||||
static long _proc_pidonfo_uniqinfo(int32_t pid, void* buffer, int32_t bufsize);
|
||||
static long _proc_pidinfo_tbsdinfo(int32_t pid, void* buffer, int32_t bufsize);
|
||||
static long _proc_pidinfo_pidthreadinfo(int32_t pid, void* buffer, int32_t bufsize);
|
||||
static long _proc_pidinfo_pidthreadinfo(int32_t pid, uint64_t thread_handle, void* buffer, int32_t bufsize);
|
||||
|
||||
long _proc_pidinfo(int32_t pid, uint32_t flavor, uint64_t arg, void* buffer, int32_t bufsize)
|
||||
{
|
||||
@ -107,12 +107,10 @@ long _proc_pidinfo(int32_t pid, uint32_t flavor, uint64_t arg, void* buffer, int
|
||||
{
|
||||
return _proc_pidinfo_tbsdinfo(pid, buffer, bufsize);
|
||||
}
|
||||
/* Not implemented yet
|
||||
case PROC_PIDTHREADINFO:
|
||||
{
|
||||
return _proc_pidinfo_pidthreadinfo(pid, buffer, bufsize);
|
||||
return _proc_pidinfo_pidthreadinfo(pid, arg, buffer, bufsize);
|
||||
}
|
||||
*/
|
||||
default:
|
||||
{
|
||||
__simple_printf("sys_proc_info(): Unsupported pidinfo flavor: %d\n",
|
||||
@ -227,9 +225,33 @@ static long _proc_pidinfo_tbsdinfo(int32_t pid, void* buffer, int32_t bufsize)
|
||||
return err;
|
||||
}
|
||||
|
||||
static long _proc_pidinfo_pidthreadinfo(int32_t pid, void* buffer, int32_t bufsize)
|
||||
static long _proc_pidinfo_pidthreadinfo(int32_t pid, uint64_t thread_handle, void* buffer, int32_t bufsize)
|
||||
{
|
||||
// TODO
|
||||
char path[64], stat[1024];
|
||||
int32_t tid = (int32_t)(thread_handle & 0xffffffff);
|
||||
|
||||
// __simple_printf("Asking for pid/tid %d/%d\n", pid, tid);
|
||||
|
||||
struct proc_threadinfo* info = (struct proc_threadinfo*) buffer;
|
||||
if (bufsize < sizeof(*info))
|
||||
return -ENOSPC;
|
||||
|
||||
memset(buffer, 0, bufsize);
|
||||
|
||||
__simple_sprintf(path, "/proc/%d/task/%d/comm", pid, tid);
|
||||
// __simple_printf("Reading thread name from %s\n", path);
|
||||
if (!read_string(path, info->pth_name, sizeof(info->pth_name)))
|
||||
return -ESRCH;
|
||||
else
|
||||
{
|
||||
// Kill LF at the end of pth_name
|
||||
int length = strlen(info->pth_name);
|
||||
if (length > 0 && info->pth_name[length-1] == '\n')
|
||||
info->pth_name[length-1] = 0;
|
||||
}
|
||||
|
||||
// TODO: Other proc_threadinfo fields
|
||||
return 1;
|
||||
}
|
||||
|
||||
static long _proc_pidinfo_shortbsdinfo(int32_t pid, void* buffer, int32_t bufsize)
|
||||
|
2
src/lkm
2
src/lkm
@ -1 +1 @@
|
||||
Subproject commit 8e232d5c78902fbe5e58534a764c96816dd95bd1
|
||||
Subproject commit 1512a1a212dec9ae2ab7119ecbb0e2aa90bf8e6a
|
Loading…
Reference in New Issue
Block a user