{"action":"closed","issue":{"url":"https://api.github.com/repos/rust-lang/rust/issues/55586","repository_url":"https://api.github.com/repos/rust-lang/rust","labels_url":"https://api.github.com/repos/rust-lang/rust/issues/55586/labels{/name}","comments_url":"https://api.github.com/repos/rust-lang/rust/issues/55586/comments","events_url":"https://api.github.com/repos/rust-lang/rust/issues/55586/events","html_url":"https://github.com/rust-lang/rust/issues/55586","id":376464031,"node_id":"MDU6SXNzdWUzNzY0NjQwMzE=","number":55586,"title":"Several bugs related to enum debugging","user":{"login":"ortem","id":4854600,"node_id":"MDQ6VXNlcjQ4NTQ2MDA=","avatar_url":"https://avatars2.githubusercontent.com/u/4854600?v=4","gravatar_id":"","url":"https://api.github.com/users/ortem","html_url":"https://github.com/ortem","followers_url":"https://api.github.com/users/ortem/followers","following_url":"https://api.github.com/users/ortem/following{/other_user}","gists_url":"https://api.github.com/users/ortem/gists{/gist_id}","starred_url":"https://api.github.com/users/ortem/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ortem/subscriptions","organizations_url":"https://api.github.com/users/ortem/orgs","repos_url":"https://api.github.com/users/ortem/repos","events_url":"https://api.github.com/users/ortem/events{/privacy}","received_events_url":"https://api.github.com/users/ortem/received_events","type":"User","site_admin":false},"labels":[{"id":203130,"node_id":"MDU6TGFiZWwyMDMxMzA=","url":"https://api.github.com/repos/rust-lang/rust/labels/A-debuginfo","name":"A-debuginfo","color":"f7e101","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":9,"created_at":"2018-11-01T16:18:50Z","updated_at":"2018-12-24T10:44:35Z","closed_at":"2018-12-24T10:44:35Z","author_association":"NONE","body":"I have found some bugs related to enum debug info.\r\nMy LLDB version is `lldb-1000.0.37` (MacOS), GDB is `8.1.0.20180409-git` (Ubuntu).\r\n\r\nHere they are:\r\n\r\n### Variants with the same names\r\n```\r\nenum Enum1<T> { A(T), B(T) }\r\nenum Enum2 { A { x: i32, y: i32 } }\r\n\r\nfn main() {\r\n    let e1 = Enum1::A(42);\r\n    let e2 = Enum2::A { x: 4, y: 5 };\r\n}\r\n```\r\nRun LLDB (without pretty-printers):\r\n```\r\n(lldb) print e2\r\n(test::Enum2) $1 = {\r\n   = (RUST$ENUM$DISR = 4, __0 = 5)\r\n}\r\n```\r\n`RUST$ENUM$DISR = 4`?\r\n\r\n### Variant disappears\r\n```\r\nenum Enum { A, B(i32, i32), C(i32, i32, i32) }\r\n\r\nfn main() {\r\n    let e = Enum::B(1, 2);\r\n}\r\n```\r\nRun LLDB (without pretty-printers):\r\n```\r\n(lldb) print e\r\n(test::Enum) $0 = {\r\n   = (RUST$ENUM$DISR = B)\r\n   = (RUST$ENUM$DISR = B, __0 = 1, __1 = 2, __2 = 32766)\r\n}\r\n```\r\nNo second variant?\r\n\r\n### Probably no discriminant\r\n```\r\nenum Enum { A(i32, i32), B(String, i32), C { x: i32 } }\r\n\r\nfn main() {\r\n    let e = Enum::B(String::from(\"abc\"), 42);\r\n}\r\n```\r\nRun GDB + default pretty-printers:\r\n```\r\n(gdb) print e\r\n\r\n  File \"rustlib/etc/gdb_rust_pretty_printing.py\", line 169, in rust_pretty_printer_lookup_function\r\n    discriminant_val = rustpp.get_discriminant_value_as_integer(val)\r\n  File \"rustlib/etc/debugger_pretty_printers_common.py\", line 340, in get_discriminant_value_as_integer\r\n    variant_val = enum_val.get_child_at_index(0)\r\n  File \"rustlib/etc/gdb_rust_pretty_printing.py\", line 75, in get_child_at_index\r\n    child = GdbValue(self.gdb_val[gdb_field])\r\ngdb.error: That operation is not available on integers of more than 8 bytes.\r\n```\r\nProbably `e` doesn't contain valid discriminant inside the first variant."}}
{"actor":{"display_login":"ortem"}}