Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

debuginfo: DWARF encoding of space-optimized enums not correct for fat pointers #19339

Closed
michaelwoerister opened this issue Nov 26, 2014 · 0 comments · Fixed by #19474
Closed
Labels
A-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.)

Comments

@michaelwoerister
Copy link
Member

Debuginfo for adt::RawNullablePointer (and probably also adt::StructWrappedNullablePointer) enums is not correct if the pointer that doubles as discriminant is a fat pointer.

Steps to reproduce:

(1) Compile the following program with -g

fn main() {
    let x = Some("abc");
    ::std::io::println(x.unwrap());
}

(2) Print the value of x in LLDB with pretty printers enabled:

Michaels-Mac-mini:option-fat-pointer mw$ rust-lldb ./main
Executing commands in '/tmp/rust-lldb-commands.66chQx'.
(lldb)  command script import "/Users/mw/rust/x86_64-apple-darwin/stage1/lib/rustlib/etc/lldb_rust_formatters.py"
(lldb)  type summary add --no-value --python-function lldb_rust_formatters.print_val -x ".*" --category Rust
(lldb)  type category enable Rust
Current executable set to './main' (x86_64).
(lldb) b 4
Breakpoint 1: where = main`main::main + 88 at main.rs:4, address = 0x0000000100001878
(lldb) r
Process 26375 launched: './main' (x86_64)
Process 26375 stopped
* thread #1: tid = 0x202ad, 0x0000000100001878 main`main::main + 88 at main.rs:4, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
    frame #0: 0x0000000100001878 main`main::main + 88 at main.rs:4
   1    
   2    fn main() {
   3        let x = Some("abc");
-> 4        ::std::io::println(x.unwrap());
   5    }
(lldb) p x
(core::option::Option<&str>) $0 = None
(lldb) 

This should print Some(0x12345678) instead of None.

Maybe it's just the LLDB pretty printer that needs to be adapted.

@michaelwoerister michaelwoerister added the A-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.) label Nov 26, 2014
@luqmana luqmana changed the title debuginfo: DWARF encoding of space-optimized enums no correct for fat pointers debuginfo: DWARF encoding of space-optimized enums not correct for fat pointers Dec 1, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant