Issue |
132177
|
Summary |
[lldb] breakpoint condition always returns true for aggregate types
|
Labels |
new issue
|
Assignees |
|
Reporter |
k4lizen
|
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"
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs