Open TestingPlant opened 2 years ago
@llvm/issue-subscribers-lldb
@llvm/issue-subscribers-bug
CC @danilashtefan may be related to https://reviews.llvm.org/D114403
Using g++ 7.5.0
to compile the test program via g++ -std=c++17 -g 53490.cpp
,
and using lldb 19 trunk @ 96d01a350ce9875a8f893ecdc1d470caf7ed5bcd
to debug the resulting ./a.out
,
I can't reproduce the crash but see a different error:
(lldb) target create "./a.out"
Current executable set to '~/llvm-project/a.out' (x86_64).
(lldb) b main
Breakpoint 1: where = a.out`main + 8 at 53490.cpp:5, address = 0x000000000040094f
(lldb) r
Process 112903 launched: '~/llvm-project/a.out' (x86_64)
Process 112903 stopped
* thread #1, name = 'a.out', stop reason = breakpoint 1.1
frame #0: 0x000000000040094f a.out`main at 53490.cpp:5
2 #include <string>
3
4 int main() {
-> 5 std::optional<std::string> foo;
6 }
(lldb) p foo
error: a.out 0x00000183: DW_TAG_member '_M_local_buf' refers to type 0x000000000000b0df which extends beyond the bounds of 0x0000017b
(std::optional<std::__cxx11::basic_string<char> >) Has Value=true {
Value = {
_M_dataplus = (_M_p = 0x0000000000000000)
_M_string_length = 0
= (_M_local_buf = "\xce\v@", _M_allocated_capacity = 4197326)
}
}
(this error doesn't show up when using clang 19 trunk @ 96d01a350ce9875a8f893ecdc1d470caf7ed5bcd
instead of g++
)
When compiling the below code with
g++ -g
, lldb crashes when usingp foo
. This doesn't occur if the code is compiled using clang.Output: