[Lldb-commits] [lldb] r188240 - Fixed a crash in objc_refs caused by improper

Sean Callanan scallanan at apple.com
Mon Aug 12 17:53:33 PDT 2013


Author: spyffe
Date: Mon Aug 12 19:53:33 2013
New Revision: 188240

URL: http://llvm.org/viewvc/llvm-project?rev=188240&view=rev
Log:
Fixed a crash in objc_refs caused by improper
resolution of class_getSuperclass.

<rdar://problem/14662686>

Modified:
    lldb/trunk/examples/darwin/heap_find/heap.py

Modified: lldb/trunk/examples/darwin/heap_find/heap.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/darwin/heap_find/heap.py?rev=188240&r1=188239&r2=188240&view=diff
==============================================================================
--- lldb/trunk/examples/darwin/heap_find/heap.py (original)
+++ lldb/trunk/examples/darwin/heap_find/heap.py Mon Aug 12 19:53:33 2013
@@ -1033,7 +1033,9 @@ compare_callback_t compare_callback = []
      if (a_ptr > b_ptr) return +1;
      return 0;
 };
+typedef Class (*class_getSuperclass_type)(void *isa);
 range_callback_t range_callback = [](task_t task, void *baton, unsigned type, uintptr_t ptr_addr, uintptr_t ptr_size) -> void {
+    class_getSuperclass_type class_getSuperclass_impl = (class_getSuperclass_type)class_getSuperclass;
     callback_baton_t *info = (callback_baton_t *)baton;
     if (sizeof(Class) <= ptr_size) {
         Class *curr_class_ptr = (Class *)ptr_addr;
@@ -1049,13 +1051,13 @@ range_callback_t range_callback = [](tas
                 if (info->isa == isa)
                     match = true;
                 else { // if (info->objc.match_superclasses) {
-                    Class super = (Class)class_getSuperclass(isa);
+                    Class super = class_getSuperclass_impl(isa);
                     while (super) {
                         if (super == info->isa) {
                             match = true;
                             break;
                         }
-                        super = (Class)class_getSuperclass(super);
+                        super = class_getSuperclass_impl(super);
                     }
                 }
             }





More information about the lldb-commits mailing list