kkurni
kkurni

Reputation: 1371

Using LLDB for IOS debug class member variable NSArray

Does anyone know how to get the value for class member variable in IOS ?

I try to use LLDB to debug NSArray in class member variable.

After I run this

__cellDataShadowArray2D = [[NSArray alloc] initWithObjects:[NSArray arrayWithObjects:obj1, obj2, nil], nil];

When I check the value using LLDB (print object), I always get this.

(lldb) po __cellDataShadowArray2D
(NSArray *) $66 = 0x001e8894 <object returned empty description>

(lldb) p __cellDataShadowArray2D
(NSArray *) $67 = 0x001e8894

(lldb) po [__cellDataShadowArray2D count]
2012-04-24 10:10:38.535 SOME [61985:15803] -[__NSCFConstantString count]: unrecognized selector sent to instance 0x1e8894
(id) $68 = 0x00000000 <nil>

(lldb) po [__cellDataShadowArray2D retainCount]
(id) $69 = 0xffffffff [no Objective-C description available]

(lldb) p (int) [__cellDataShadowArray2D retainCount]
(int) $70 = -1

(lldb) p (int) [__cellDataShadowArray2D count]
2012-04-24 10:11:31.333 SOME [61985:15803] -[__NSCFConstantString count]: unrecognized selector sent to instance 0x1e8894
(int) $71 = 0

Upvotes: 0

Views: 6293

Answers (3)

Valerio
Valerio

Reputation: 523

It is definitely a LLDB problem. I had the same, coud not debug at all. I switched back to GDB and it was ok

Upvotes: 0

bbum
bbum

Reputation: 162712

  • make sure the line of code is actually evaluated before doing the test.

It is clear that __cellDataShadowArray2D is pointing to an empty instance of a compiled constant string; @"". That means it cannot be an over-release or anything like that; it means that the assignment has not yet happened (or you are attempting to debug optimized code and the debugger is confused due to optimizations).

  • po of non-object types doesn't make sense

  • retainCount is useless. Don't call it.

Upvotes: 1

Related Questions