File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -169,6 +169,26 @@ static BOOL strendswith(const char *str, const char *suffix) {
169169 NSString *executablePath = NSBundle .mainBundle .executablePath ;
170170 if (!executablePath) return nil ;
171171 const headerType *target_image_header = 0 ;
172+
173+ #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 180000
174+ #if DEBUG
175+ // Xcode16之后,优先查找debug.dylib
176+ NSString *debugImagePath = [NSString stringWithFormat: @" %@ .debug.dylib" , executablePath];
177+ for (uint32_t i = 0 ; i < imageCount; i++) {
178+ const char *image_name = _dyld_get_image_name (i);
179+ NSString *imagePath = [NSString stringWithUTF8String: image_name];
180+ if ([imagePath isEqualToString: debugImagePath]) {
181+ target_image_header = (headerType *)_dyld_get_image_header (i);
182+ break ;
183+ }
184+ }
185+
186+ if (target_image_header) {
187+ return target_image_header;
188+ }
189+ #endif
190+ #endif
191+
172192 for (uint32_t i = 0 ; i < imageCount; i++) {
173193 const char *image_name = _dyld_get_image_name (i);// name 是一串完整的文件路径,以 image 名结尾
174194 NSString *imagePath = [NSString stringWithUTF8String: image_name];
You can’t perform that action at this time.
0 commit comments