articles icon indicating copy to clipboard operation
articles copied to clipboard

Update 2014-12-08-lldb-debugging.md

Open croath opened this issue 10 years ago • 3 comments

correct the output and command of lldb

croath avatar Jun 08 '15 04:06 croath

I think it should be p, right? Not po? It's an integer.

chriseidhof avatar Jun 08 '15 05:06 chriseidhof

@chriseidhof It's true that po stands for print object as described in manual.

But according to the original article, the output is 3. If you try the commands in Xcode Debugger, you will get the result as:

(lldb) e NSArray *$array = @[ @"Saturday", @"Sunday", @"Monday" ]
(lldb) p [$array count]
(NSUInteger) $0 = 3
(lldb) po [$array count]
3
#there is an empty line

In a word if you're using p, the result is (NSUInteger) $0 = 3, If the result is only 3, the command should be po instead.

It's quite wired that po can print "description" of non-object value, but it just happened and I don't think it's a bug of LLDB, at most some kind of workaround or syntactic sugar.

I'm trying to figure it out but it's too difficult to me to read the source code of LLDB. Please let me know if you got the technical reason. :smile:

croath avatar Jun 08 '15 16:06 croath

@chriseidhof anything updated here?

croath avatar Jul 11 '15 08:07 croath