<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/132177>132177</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[lldb] breakpoint condition always returns true for aggregate types
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
k4lizen
</td>
</tr>
</table>
<pre>
This call
https://github.com/llvm/llvm-project/blob/main/lldb/source/Breakpoint/BreakpointLocation.cpp#L310
extracts the bytes of the result here
https://github.com/llvm/llvm-project/blob/01f04252b6711e281d9569172302ec20789e9bbe/lldb/source/Core/Value.cpp#L605
but the `GetValueAsScalar` call bails
https://github.com/llvm/llvm-project/blob/01f04252b6711e281d9569172302ec20789e9bbe/lldb/source/Core/Value.cpp#L608
when the result is an aggregate type
https://github.com/llvm/llvm-project/blob/main/lldb/source/Symbol/CompilerType.cpp#L1102
so in the end `Scalar &Value::ResolveValue` ends up returning a **host pointer** to process data which has been copied to the host. And thus, this always returns true
https://github.com/llvm/llvm-project/blob/01f04252b6711e281d9569172302ec20789e9bbe/lldb/source/ValueObject/ValueObject.cpp#L367
This whole sequence is a bit weird imo, but the end result is that if a user puts a struct/class/array as the condition the breakpoint will always break. This is probably not what the user intends, and instead an error should be thrown.
```cpp
#include <iostream>
struct Empty { };
int main() {
Empty emp;
std::cout << "break\n";
return 0;
}
// breakpoint set -f main.cpp -l 7 --condition "emp"
```
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJzMVUuP4zYT_DXUpTEG1dTDPuigmVl_lwU-ILvInZTaFrM0qfAxjvPrA1KeR4LNIdhDAhgwSDbVVdVVkgxBny3RwNpH1j5XMsXF-eFbY_TvZCvl5tvwddEBJmkM4-MS4xqYGBkeGR7POi5J7SZ3YXg05uX172H17heaIsOjMk4xPF6ktuVwzqvgkp-I4fHRk_y2Om3jnxaf3SSjdnY3rStD8VnUnPGRf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