简体   繁体   中英

Xcode weird debugger issue?

both integers, one is loaded from NSUserDefaults with the integerForKey: method. Has anyone seen a behaviour like this? The result should obviously be 2, or is it way too late and I should sleep? this is so weird....

在此处输入图片说明

Yes, this is a bug, please file it with the lldb.llvm.org bugzilla.

Note, po is just shorthand for: run the basic "expr" command to evaluate the arguments as an expression, then call the description method on the result.

The way the expression command works is if the expression is simple enough to interpret, we do that, and otherwise we JIT the expression and insert it into the debugee and run it. The bug is in the interpreter, apparently it can't do mod with signed integers. Unsigned integer types work correctly, and the JIT result is also correct. For instance, in Kurt's example:

(lldb) expr n % m
(int) $5 = 0

That's not right! But:

(lldb) expr (void) printf ("%d\n", n % m)
2
(lldb)

Because the expression involved a function call, we couldn't interpret it and had to JIT it, which got the calculation right. That's also a pretty gross workaround, but also please file a bug.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM