Skip to content

[lldb] Objective-C runtime: Work around a bug in the shared cache bui… #10197

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,14 @@ __lldb_apple_objc_v2_get_shared_cache_class_info (void *objc_opt_ro_ptr,

if (objc_opt->version == 16)
{
const objc_clsopt_v16_t* clsopt = (const objc_clsopt_v16_t*)((uint8_t *)objc_opt + objc_opt_v16->largeSharedCachesClassOffset);
int32_t large_offset = objc_opt_v16->largeSharedCachesClassOffset;
const objc_clsopt_v16_t* clsopt = (const objc_clsopt_v16_t*)((uint8_t *)objc_opt + large_offset);
// Work around a bug in some version shared cache builder where the offset overflows 2GiB (rdar://146432183).
uint32_t unsigned_offset = (uint32_t)large_offset;
if (unsigned_offset > 0x7fffffff && unsigned_offset < 0x82000000) {
clsopt = (const objc_clsopt_v16_t*)((uint8_t *)objc_opt + unsigned_offset);
DEBUG_PRINTF("warning: applying largeSharedCachesClassOffset overflow workaround!\n");
}
const size_t max_class_infos = class_infos_byte_size/sizeof(ClassInfo);

DEBUG_PRINTF("max_class_infos = %llu\n", (uint64_t)max_class_infos);
Expand Down