this repo has no description
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add coresymbolicationd stub service

This service is used by Xcode when it crashes to help symbolicate the
stack trace. However, stubbing it to return empty dictionary replies
seems to be enough to get by.

authored by

Ariel Abreu and committed by
Thomas A
ad4e30fe ad4e9aef

+119 -3
+17 -3
src/private-frameworks/CoreSymbolication/CMakeLists.txt
··· 7 7 set(DYLIB_COMPAT_VERSION "1.0.0") 8 8 set(DYLIB_CURRENT_VERSION "62046.0.0") 9 9 10 - file(GLOB CS_C src/*.c) 11 - 12 10 set(FRAMEWORK_VERSION "A") 13 11 14 12 generate_sdk_framework(CoreSymbolication ··· 24 22 VERSION ${FRAMEWORK_VERSION} 25 23 26 24 SOURCES 27 - ${CS_C} 25 + src/functions.c 28 26 29 27 DEPENDENCIES 30 28 system 31 29 ) 30 + 31 + add_darling_executable(coresymbolicationd src/daemon.c) 32 + 33 + install( 34 + TARGETS 35 + coresymbolicationd 36 + DESTINATION 37 + libexec/darling/usr/libexec 38 + ) 39 + 40 + install( 41 + FILES 42 + resources/com.apple.coresymbolicationd.plist 43 + DESTINATION 44 + libexec/darling/System/Library/LaunchDaemons 45 + )
+15
src/private-frameworks/CoreSymbolication/resources/com.apple.coresymbolicationd.plist
··· 1 + <?xml version="1.0" encoding="UTF-8"?> 2 + <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> 3 + <plist version="1.0"> 4 + <dict> 5 + <key>Label</key> 6 + <string>com.apple.coresymbolicationd</string> 7 + <key>Program</key> 8 + <string>/usr/libexec/coresymbolicationd</string> 9 + <key>MachServices</key> 10 + <dict> 11 + <key>com.apple.coresymbolicationd</key> 12 + <true/> 13 + </dict> 14 + </dict> 15 + </plist>
+87
src/private-frameworks/CoreSymbolication/src/daemon.c
··· 1 + /** 2 + * This file is part of Darling. 3 + * 4 + * Copyright (C) 2023 Darling developers 5 + * 6 + * Darling is free software: you can redistribute it and/or modify 7 + * it under the terms of the GNU General Public License as published by 8 + * the Free Software Foundation, either version 3 of the License, or 9 + * (at your option) any later version. 10 + * 11 + * Darling is distributed in the hope that it will be useful, 12 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 + * GNU General Public License for more details. 15 + * 16 + * You should have received a copy of the GNU General Public License 17 + * along with Darling. If not, see <http://www.gnu.org/licenses/>. 18 + */ 19 + 20 + #include <xpc/xpc.h> 21 + #include <xpc/connection.h> 22 + #include <stdlib.h> 23 + #include <stdio.h> 24 + 25 + #define SERVICE_NAME "com.apple.coresymbolicationd" 26 + 27 + #ifndef ENABLE_LOG 28 + #define ENABLE_LOG 0 29 + #endif 30 + 31 + #if ENABLE_LOG 32 + #define server_log(format, ...) do { printf("server connection: " format "\n", ## __VA_ARGS__); fflush(stdout); } while (0) 33 + #define server_error(format, ...) do { fprintf(stderr, "server connection: " format "\n", ## __VA_ARGS__); fflush(stderr); } while (0) 34 + #else 35 + #define server_log(format, ...) 36 + #define server_error(format, ...) 37 + #endif 38 + 39 + static void connection_handler(xpc_connection_t connection) { 40 + server_log("Got a new connection: %p\n", connection); 41 + 42 + xpc_connection_set_event_handler(connection, ^(xpc_object_t object) { 43 + char* desc = xpc_copy_description(object); 44 + xpc_type_t type = xpc_get_type(object); 45 + server_log("Received %s from connection %p: %s\n", (type == (xpc_type_t)XPC_TYPE_DICTIONARY) ? "message" : ((type == (xpc_type_t)XPC_TYPE_ERROR) ? "error" : "unexpected object"), connection, desc); 46 + free(desc); 47 + 48 + // stub reply 49 + xpc_object_t reply = xpc_dictionary_create_reply(object); 50 + xpc_connection_send_message(connection, reply); 51 + }); 52 + xpc_connection_resume(connection); 53 + }; 54 + 55 + static void handle_server_error(xpc_object_t error) { 56 + if (error == XPC_ERROR_CONNECTION_INVALID) { 57 + server_log("server died (or got cancelled)\n"); 58 + } else if (error == XPC_ERROR_TERMINATION_IMMINENT) { 59 + server_log("someone wants to kill us\n"); 60 + } else { 61 + server_error("received unexpected error: %s\n", xpc_copy_description(error)); 62 + exit(1); 63 + } 64 + }; 65 + 66 + int main(int arc, char** argv) { 67 + xpc_connection_t server = NULL; 68 + 69 + server = xpc_connection_create_mach_service(SERVICE_NAME, NULL, XPC_CONNECTION_MACH_SERVICE_LISTENER); 70 + 71 + xpc_connection_set_event_handler(server, ^(xpc_object_t object) { 72 + xpc_type_t obj_type = xpc_get_type(object); 73 + if (obj_type == (xpc_type_t)XPC_TYPE_CONNECTION) { 74 + connection_handler(object); 75 + } else if (obj_type == (xpc_type_t)XPC_TYPE_ERROR) { 76 + handle_server_error(object); 77 + } else { 78 + server_error("received non-connection, non-error object in event handler: %s\n", xpc_copy_description(object)); 79 + exit(1); 80 + } 81 + }); 82 + 83 + xpc_connection_resume(server); 84 + 85 + dispatch_main(); 86 + return 0; 87 + };