Closed cynecx closed 6 years ago
Thanks for the report. I'm looking into it.
Smaller failing test:
use std::option::Option;
enum Union { A(usize), B(usize) }
fn main() {
let union_none: Option<Union> = Option::None;
println!("yay");
}
In this example, I believe the Option
shares a tag slot with Union
, and in particular, None
is given a discriminant value of 2. However, the DWARF does not indicate this anywhere; this is one of the debuginfo regressions from the enum optimizations that went in a while ago. See https://github.com/rust-lang/rust/issues/32920 for details.
One thing I don't currently understand is why RustLanguageRuntime::GetDynamicTypeAndAddress
gets Union
as the type of the value it is inspecting. I would have expected Option
here. But maybe something is going wrong earlier.
There's still a bug here even with the fixed debuginfo:
(lldb) fr v
(core::option::Option<tt::Union>) union_none = {}
I think it should do something more like what gdb does:
(gdb) p union_none
$1 = core::option::Option<tt::Union>::None
I'll file a new bug.
I am currently on:
Testcase (taken from https://github.com/rust-lang-nursery/lldb/issues/14):
Calling
fr v
at theprintln!
triggers the segfault.Backtrace:
It seems that
idx = -1 (m_default)
inRustEnum::FindEnumVariant
triggers the segfault because this is basically an out-of-bounds access throughFieldAt
.Not sure what's the cause here as I am also not familiar with the code (seems that a discriminant record is missing?).