Reputation: 3885
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....
Upvotes: 1
Views: 67
Reputation: 27238
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.
Upvotes: 2