'LLDB prints `i8` as "signed char"
I'm using the LLDB extension for VSCode, and my variables typed as i8
are printed as characters. Both in the VSCode debugging panel, and when using print
in the debugger console.
The variable is defined in the following way:
for y in 0..self.height
self.height
being an i8
.
I found How do I make the Xcode debugger show uint8_t values as numbers?, but even trying to add a fromat: type format add -f decimal int8_t
, print y
still outputs (signed char) $5 = '\a'
instead of (let me consult the C escape sequences and the ascii chart...) 7
.
Solution 1:[1]
If anybody else runs into this, this might be of use:
frame variable --format d y
The variable will be printed as "decimal" indicated by the d
. A list of all formats can (AFAIK) be found here: https://lldb.llvm.org/use/variable.html#id1.
After further trail and error, I figured out how to format all "signed char" in decimals, at least for the current session:
type format add --format d 'signed char'
This will work both when printing the variable in the debug console, and it will also update the values in the debug panel of VSCode immediately.
If anybody knows how to get this persistent, or even better, tell LLDB that the type is in fact not a char but an integer, please let me know.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 |