Getting strange debugger message: Assertion failed: (cls), function getName: what is this?

前端 未结 6 823
一生所求
一生所求 2021-02-01 17:47

Since I upgraded from Xcode 3.2.3 to 3.2.4 and iOS 4.0.1 to iOS 4.1 SDK, when I set a breakpoint in my code and single-step over instructions, at each step, the debugger will sp

6条回答
  •  春和景丽
    2021-02-01 18:19

    I have exactly the same issue. I know it's not the complete answer but here's what I could find.

    The relevant function getName looks like this:

    /***********************************************************************
    * getName
    * fixme
    * Locking: runtimeLock must be held by the caller
    **********************************************************************/
    static const char *
    getName(struct class_t *cls)
    {
        // fixme hack rwlock_assert_writing(&runtimeLock);
        assert(cls);
    
        if (isRealized(cls)) {
            return cls->data->ro->name;
        } else {
            return ((const struct class_ro_t *)cls->data)->name;
        }
    }
    

    So gdb is complaining that the assertion assert(cls) is failing. Which means that getName somehow gets a NULL pointer as an argument.

    Which is kinda funny, where could we be asking for the name of a NULL class?

    Hope this helps...

提交回复
热议问题