Closed adam-fowler closed 1 year ago
Does the expression i==56
get evaluated correctly in the debug console?
Does the expression
i==56
get evaluated correctly in the debug console?
If you mean does po i==56
returns the correct value then yes
No, ?i==56
, or enter i==56
in WATCH panel.
Ok, ?i==56
return false regardless of value. Interestingly if I compare a string it works eg ?s=="test"
I'm not sure if it's related, so feel free to hide this comment if not, but I have a similarly odd behaviour where printing a variable in codelldb via watches or hover prints a different value from the usual po
or frame variable
commands:
This is CodeLLDB (this is the evaluate
request in commands mode with expressions
set to native
):
Console is in 'commands' mode, prefix expressions with '?'.
Launching: /Users/ben/.vim/bundle/vimspector/support/test/cpp/simple_c_program/test_char_u
Launched process 39381
> po foo
"ptr"
> frame variable foo
(char_u *) foo =
0x0000000100003f7c "ptr"
> ?foo
'p'
> ?foo,s
"ptr"
It does seem that LLDB's expression evaluator returns different representations for some things than the object printer. But then again, in lldb
commas line:
(lldb) expr foo
(char_u *) $2 = 0x0000000100003f7c "ptr"
(lldb) p foo
(char_u *) $3 = 0x0000000100003f7c "ptr"
I'm not sure how the simple expression evaluator interacts with Swift values... "Simple expressions" are evaluated using this Python class, which wraps the native LLDB SBValue. In particular I wonder how this bit does. As you can see, anything that is not a primitive int or float get converted to a string (potentially via used-defined type summary). This could be problematic if Swift doesn't use a primitive int type for its integers.
@adam-fowler, Since you use Swift-enabled liblldb, you might get better results using the native expressions.
So ?/nat i==56
works and /nat i==56
works in a breakpoint.
I'm guessing I can just set lldb > Launch: Expressions
to native
and I shouldn't need to add the /nat
prefix
I'm guessing I can just set lldb > Launch: Expressions to native
Yes, makes sense in your case.
Would this be a similar situation to where a pointer to data eg UnsafeMutableRawPointer
does not get treated as a pointer and does not get dereferenced in the variables view?
OS: macOS Ventura 13.2.1 (22D68) VSCode version: 1.77.3 CodeLLDB version: 1.9.1 Compiler: Swift 5.8 Debuggee: Swift Package Manager generated executable
If I set an expression on a breakpoint it is ignored on macOS. Conditional break points are working in LLDB when run independently of VS Code. This is also not a problem on Linux.
For a simple program like
If I add a conditional breakpoint on line 2 for when
i==56
I would expect it to stop when i equals 56. Instead if never stops.Verbose log
x86_64-apple-macosx13.0
I had to chop some of the log as GitHub wouldn't let me post all of it.