Intellij-rust: LLDB Debugger showing the wrong value

Created on 23 Jul 2020  路  3Comments  路  Source: intellij-rust/intellij-rust

Environment Information:

Hardware
Macbook Pro 16-inch
MacOS Catalina 10.15.6

Software
Rust Compiler Version:

  • rustc 1.45.0 (5c1f21c3b 2020-07-13)

Rust LLDB Version(Not using gdb):

  • lldb-1103.0.22.10
  • Apple Swift version 5.2.4 (swiftlang-1103.0.32.9 clang-1103.0.32.53)

IDE:

  • CLion 2020.1.2
  • Build #CL-201.7846.88, built on June 3, 2020
  • Runtime version: 11.0.7+10-b765.53 x86_64
  • VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
  • macOS 10.15.6

LLDB Version(bundled with IDE):

  • 9.0.1

C Compiler Info:

  • Apple clang version 11.0.3 (clang-1103.0.32.62)
  • Target: x86_64-apple-darwin19.6.0
  • Thread model: posix
  • InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

C++ Compiler Info:

  • Apple clang version 11.0.3 (clang-1103.0.32.62)
  • Target: x86_64-apple-darwin19.6.0
  • Thread model: posix
  • InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

Plugin Version:

  • 0.3.126.3220-201

Problem description

The debugger is showing the wrong value for the test variable in the following code:
```(rust)
fn main() {
let test: Ordering = 25.cmp(&15);

match test {
    Ordering::Less => println!("Too small!"),
    Ordering::Greater => println!("Too big!"),
    Ordering::Equal => println!("You win!"),
}

}


![Screen Shot 2020-07-23 at 1 02 59 AM](https://user-images.githubusercontent.com/17823824/88354358-9d54ee00-cd2e-11ea-9a1e-e6453b5724cf.png)


I would expect the value shown for test in the variables section to be `core::cmp::Ordering::Greater` but instead its `core::cmp::Ordering::Equal`.

The output from running the program is `Too big!` as expected - the debugger just isn't showing the correct value that the variable actually holds.

Has anyone seen this with other IDEs or environments? Or is there just something wrong with my debugger or setup?

## Steps to reproduce

1) run `cargo new some-app`

2) paste the following into `src/main.rs`:
```(rust)
use std::cmp::Ordering;

fn main() {
    let test: Ordering = 25.cmp(&15);

    match test {
        Ordering::Less => println!("Too small!"),
        Ordering::Greater => println!("Too big!"),
        Ordering::Equal => println!("You win!"),
    }
}

Run the debugger - the value of test should be shown as core::cmp::Ordering::Equal.

bug debugger

Most helpful comment

@es50678 this bug should be fixed in LLDB bundled with CLion but not in IJ Rust plugin. The good news is that I鈥檓 working on it so probably it will be fixed soon :)

All 3 comments

@es50678 Thank you for reporting! Unit-like (C-style) enums are not supported so far in LLDB. Please follow the corresponding meta issue: https://github.com/intellij-rust/intellij-rust/issues/4548

Also, note that you can use Create new issue action (can be called using cmd+shift+A) to open a pre-filled issue with all your environment information right from the IDE.

@ortem Thank you for responding and the link to the meta ticket!

How would one go about contributing a fix for this?

@es50678 this bug should be fixed in LLDB bundled with CLion but not in IJ Rust plugin. The good news is that I鈥檓 working on it so probably it will be fixed soon :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

marty30 picture marty30  路  3Comments

joslopgar picture joslopgar  路  3Comments

ralfbiedert picture ralfbiedert  路  3Comments

ragagno picture ragagno  路  3Comments

SomeoneToIgnore picture SomeoneToIgnore  路  3Comments