Skip to content

Commit f09a3db

Browse files
committed
Fixed a crash in objc_refs caused by improper
resolution of class_getSuperclass. <rdar://problem/14662686> llvm-svn: 188240
1 parent da71ea2 commit f09a3db

File tree

1 file changed

+4
-2
lines changed
  • lldb/examples/darwin/heap_find

1 file changed

+4
-2
lines changed

lldb/examples/darwin/heap_find/heap.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1033,7 +1033,9 @@ def objc_refs(debugger, command, result, dict):
10331033
if (a_ptr > b_ptr) return +1;
10341034
return 0;
10351035
};
1036+
typedef Class (*class_getSuperclass_type)(void *isa);
10361037
range_callback_t range_callback = [](task_t task, void *baton, unsigned type, uintptr_t ptr_addr, uintptr_t ptr_size) -> void {
1038+
class_getSuperclass_type class_getSuperclass_impl = (class_getSuperclass_type)class_getSuperclass;
10371039
callback_baton_t *info = (callback_baton_t *)baton;
10381040
if (sizeof(Class) <= ptr_size) {
10391041
Class *curr_class_ptr = (Class *)ptr_addr;
@@ -1049,13 +1051,13 @@ def objc_refs(debugger, command, result, dict):
10491051
if (info->isa == isa)
10501052
match = true;
10511053
else { // if (info->objc.match_superclasses) {
1052-
Class super = (Class)class_getSuperclass(isa);
1054+
Class super = class_getSuperclass_impl(isa);
10531055
while (super) {
10541056
if (super == info->isa) {
10551057
match = true;
10561058
break;
10571059
}
1058-
super = (Class)class_getSuperclass(super);
1060+
super = class_getSuperclass_impl(super);
10591061
}
10601062
}
10611063
}

0 commit comments

Comments
 (0)