I am working on an iPhone app which is using an external library for which I have the source. During debugging some of the objects are listed as 0x0 in the debugger but the app runs fine. Also, some of the objects addresses point to the wrong thing. These symbols are in the external library. The addresses are fine if I am tracing through a file actually in the external library.
Does anyone have suggestions how to stop this behavior?
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...?
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?
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: