<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/58670>58670</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
LLDB fails to print struct with _BitInts that are not a multiple of 8 bits
</td>
</tr>
<tr>
<th>Labels</th>
<td>
lldb
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
DavidSpickett
</td>
</tr>
</table>
<pre>
As follow up to https://github.com/llvm/llvm-project/issues/57910 I started looking at what clang produces from _BitInt.
This example works:
```
struct Foo {
_BitInt(8) i;
_BitInt(8) j;
_BitInt(8) k;
_BitInt(8) l;
};
int main() {
struct Foo f;
f.i = 9;
f.j = 10;
f.k = 11;
f.l = 12;
return 0;
}
```
lldb session:
```
$ ./bin/lldb /tmp/test.o
(lldb) target create "/tmp/test.o"
Current executable set to '/tmp/test.o' (aarch64).
(lldb) b main
Breakpoint 1: where = test.o`main at test.c:14:3, address = 0x0000000000000704
(lldb) run
Process 151548 launched: '/tmp/test.o' (aarch64)
Process 151548 stopped
<...>
(lldb) p f
(Foo) $0 = (i = '\t', j = '\n', k = '\v', l = '\f')
```
If the size of each _BitInt is 4 then I get:
```
(lldb) p f
Set value type to Scalar
loadaddress
error: Couldn't materialize: couldn't get the value of variable f: unable to extract DW_OP_bit_piece(bit_size = 4, bit_offset = 0) from an address value.
error: errored out in DoExecute, couldn't PrepareToExecuteJITExpression
```
I tried a few other values, 7 did not work, 16 did. My assumption is that multiples of 8 will work, otherwise I would get the error.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJylVV1v6jgQ_TXhZbSR80EID3ko0Epd3dVWaqV9rJxkQlxMHNkO0P31O3YCpZf26kqLUHDOjGeOZ46HUtXvxZ2BRkmpjjD0YBW01vYmSO6C-IG-W2HboQwrtacXKQ_nnz96rd6wsvQqjBnQ0GK-WEYMHsFYri3WIJXaiW4L3MKxpUclOb3RxnqokLJqtYfXlbC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