Bug in XCode debugger?

北战南征 提交于 2019-12-05 23:33:09

UPDATE: target settings > Build tab > GCC 4.2 Code Generation > "Compile for Thumb"

I turned off this target setting and the gdb problem went away.

--

Hi John.

I understand what you're referring to. I'm also seeing a problem where gdb and NSLog() are giving me different results for pointers in certain parts of my code.

In a boiled-down example, gdb fails to report the proper value for "pointer" when I set a breakpoint on any line in this function:

id testPointer( id pointer )
{
    NSLog( @"pointer value: %p", pointer );

    @try
    {
        NSLog( @"foo" );
    }
    @catch ( NSException *e )
    { }
    @finally
    { }

    return pointer;
}

As zPesk notes, 0x0 is nil, which is a common value for objects that have not been initialized (particularly instance variables). I'm not certain what you mean by "point to the wrong thing." If you haven't initialized a local (stack) variable, it may point to any random address until it is initialized. What behavior are you having trouble with?

Were you ever able to resolve this issue? I, too, am noticing strange behavior in gdb when mixing Thumb and ARM modes. For example, it appears that the addresses of variables reported by gdb are off by exactly 64 bytes from the addresses reported using printf("%p\n") statements. Perhaps gdb needs to be explicitly told whether the current operating mode is ARM or Thumb...?

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!