Skip to content

lldb doesn't print enums #58492

New issue

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

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

Already on GitHub? # to your account

Open
artemmukhin opened this issue Feb 15, 2019 · 3 comments
Open

lldb doesn't print enums #58492

artemmukhin opened this issue Feb 15, 2019 · 3 comments
Labels
A-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@artemmukhin
Copy link
Contributor

artemmukhin commented Feb 15, 2019

enum E1 { A, B }
enum E2 { A1 { x: i32, y: i32 }, B1(u8), C1 }
fn main() {
    let a = E1::A;
    let aa = E2::A1 { x: 42, y: 123 };
    let bb = E2::B1(10);
    let cc = E2::C1;
}

Run lldb (without pretty-printers, lldb-1000.0.38.2)

(lldb) p a
(main::E1) $0 = A
(lldb) p aa
(main::E2) $1 = {}
(lldb) p bb
(main::E2) $2 = {}
(lldb) p cc
(main::E2) $3 = {}

It affects both stable (1.32.0) and nightly (1.34.0) Rust toolchains.

@Centril Centril added the A-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.) label Feb 15, 2019
Centril added a commit to Centril/rust that referenced this issue Feb 24, 2019
rust-lldb: fix crash when printing empty string

Fixes rust-lang#52185.

Re-enables the pretty-std debuginfo test and tweaks the test as necessary to get it to pass again. This reveals that lldb's formatting of enums is broken (rust-lang#58492). I also removed the emoji from the test because I couldn't get the docker image's gdb to print the emoji, just octal escapes (https://github.com/rust-lang/rust/pull/53154/files#r208263904).
Centril added a commit to Centril/rust that referenced this issue Feb 25, 2019
rust-lldb: fix crash when printing empty string

Fixes rust-lang#52185.

~Re-enables the pretty-std debuginfo test and tweaks the test as necessary to get it to pass again. This reveals that lldb's formatting of enums is broken (rust-lang#58492). I also removed the emoji from the test because I couldn't get the docker image's gdb to print the emoji, just octal escapes (https://github.com/rust-lang/rust/pull/53154/files#r208263904).~
Centril added a commit to Centril/rust that referenced this issue Feb 27, 2019
rust-lldb: fix crash when printing empty string

Fixes rust-lang#52185.

~Re-enables the pretty-std debuginfo test and tweaks the test as necessary to get it to pass again. This reveals that lldb's formatting of enums is broken (rust-lang#58492). I also removed the emoji from the test because I couldn't get the docker image's gdb to print the emoji, just octal escapes (https://github.com/rust-lang/rust/pull/53154/files#r208263904).~
Centril added a commit to Centril/rust that referenced this issue Feb 27, 2019
rust-lldb: fix crash when printing empty string

Fixes rust-lang#52185.

~Re-enables the pretty-std debuginfo test and tweaks the test as necessary to get it to pass again. This reveals that lldb's formatting of enums is broken (rust-lang#58492). I also removed the emoji from the test because I couldn't get the docker image's gdb to print the emoji, just octal escapes (https://github.com/rust-lang/rust/pull/53154/files#r208263904).~
Centril added a commit to Centril/rust that referenced this issue Feb 27, 2019
rust-lldb: fix crash when printing empty string

Fixes rust-lang#52185.

~Re-enables the pretty-std debuginfo test and tweaks the test as necessary to get it to pass again. This reveals that lldb's formatting of enums is broken (rust-lang#58492). I also removed the emoji from the test because I couldn't get the docker image's gdb to print the emoji, just octal escapes (https://github.com/rust-lang/rust/pull/53154/files#r208263904).~
Centril added a commit to Centril/rust that referenced this issue Feb 28, 2019
rust-lldb: fix crash when printing empty string

Fixes rust-lang#52185.

~Re-enables the pretty-std debuginfo test and tweaks the test as necessary to get it to pass again. This reveals that lldb's formatting of enums is broken (rust-lang#58492). I also removed the emoji from the test because I couldn't get the docker image's gdb to print the emoji, just octal escapes (https://github.com/rust-lang/rust/pull/53154/files#r208263904).~
Centril added a commit to Centril/rust that referenced this issue Feb 28, 2019
rust-lldb: fix crash when printing empty string

Fixes rust-lang#52185.

~Re-enables the pretty-std debuginfo test and tweaks the test as necessary to get it to pass again. This reveals that lldb's formatting of enums is broken (rust-lang#58492). I also removed the emoji from the test because I couldn't get the docker image's gdb to print the emoji, just octal escapes (https://github.com/rust-lang/rust/pull/53154/files#r208263904).~
Centril added a commit to Centril/rust that referenced this issue Feb 28, 2019
rust-lldb: fix crash when printing empty string

Fixes rust-lang#52185.

~Re-enables the pretty-std debuginfo test and tweaks the test as necessary to get it to pass again. This reveals that lldb's formatting of enums is broken (rust-lang#58492). I also removed the emoji from the test because I couldn't get the docker image's gdb to print the emoji, just octal escapes (https://github.com/rust-lang/rust/pull/53154/files#r208263904).~
pietroalbini added a commit to pietroalbini/rust that referenced this issue Mar 1, 2019
rust-lldb: fix crash when printing empty string

Fixes rust-lang#52185.

~Re-enables the pretty-std debuginfo test and tweaks the test as necessary to get it to pass again. This reveals that lldb's formatting of enums is broken (rust-lang#58492). I also removed the emoji from the test because I couldn't get the docker image's gdb to print the emoji, just octal escapes (https://github.com/rust-lang/rust/pull/53154/files#r208263904).~
Centril added a commit to Centril/rust that referenced this issue Mar 9, 2019
rust-lldb: fix crash when printing empty string

Fixes rust-lang#52185.

~Re-enables the pretty-std debuginfo test and tweaks the test as necessary to get it to pass again. This reveals that lldb's formatting of enums is broken (rust-lang#58492). I also removed the emoji from the test because I couldn't get the docker image's gdb to print the emoji, just octal escapes (https://github.com/rust-lang/rust/pull/53154/files#r208263904).~
Centril added a commit to Centril/rust that referenced this issue Mar 9, 2019
rust-lldb: fix crash when printing empty string

Fixes rust-lang#52185.

~Re-enables the pretty-std debuginfo test and tweaks the test as necessary to get it to pass again. This reveals that lldb's formatting of enums is broken (rust-lang#58492). I also removed the emoji from the test because I couldn't get the docker image's gdb to print the emoji, just octal escapes (https://github.com/rust-lang/rust/pull/53154/files#r208263904).~
Centril added a commit to Centril/rust that referenced this issue Mar 9, 2019
rust-lldb: fix crash when printing empty string

Fixes rust-lang#52185.

~Re-enables the pretty-std debuginfo test and tweaks the test as necessary to get it to pass again. This reveals that lldb's formatting of enums is broken (rust-lang#58492). I also removed the emoji from the test because I couldn't get the docker image's gdb to print the emoji, just octal escapes (https://github.com/rust-lang/rust/pull/53154/files#r208263904).~
@tromey
Copy link
Contributor

tromey commented Mar 18, 2022

This is a dup of #79530, or vice versa.

@Noratrieb Noratrieb added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Apr 5, 2023
@veera-sivarajan
Copy link
Contributor

Output from lldb-18:

(lldb) p a
(main::E1) A
(lldb) p bb
(main::E2) {
  $variants$ = {
    $variant$0 = {
      $discr$ = '\x01'
      value = (x = 0, y = -136351134)
    }
    $variant$1 = {
      $discr$ = '\x01'
      value = (__0 = '\n')
    }
    $variant$2 = ($discr$ = '\x01', value = hello::E2::C1:8 @ 0x00007fffffffda30)
  }
}
(lldb) p aa
(main::E2) {
  $variants$ = {
    $variant$0 = {
      $discr$ = '\0'
      value = (x = 42, y = 123)
    }
    $variant$1 = {
      $discr$ = '\0'
      value = (__0 = '\x7f')
    }
    $variant$2 = ($discr$ = '\0', value = hello::E2::C1:8 @ 0x00007fffffffda24)
  }
}

@tromey
Copy link
Contributor

tromey commented Oct 29, 2024

Did you try with rust-lldb? I think the pretty-printers there are supposed to hide the non-relevant variant parts. See #124781. Also, again, this is a dup of #79530 and should probably be closed.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

5 participants