{"action":"created","issue":{"url":"https://api.github.com/repos/rust-lang/rust/issues/33612","repository_url":"https://api.github.com/repos/rust-lang/rust","labels_url":"https://api.github.com/repos/rust-lang/rust/issues/33612/labels{/name}","comments_url":"https://api.github.com/repos/rust-lang/rust/issues/33612/comments","events_url":"https://api.github.com/repos/rust-lang/rust/issues/33612/events","html_url":"https://github.com/rust-lang/rust/pull/33612","id":154632587,"number":33612,"title":"gdb Pretty Print: generic encoded was failing on reference/pointer types","user":{"login":"royalstream","id":7918404,"avatar_url":"https://avatars.githubusercontent.com/u/7918404?v=3","gravatar_id":"","url":"https://api.github.com/users/royalstream","html_url":"https://github.com/royalstream","followers_url":"https://api.github.com/users/royalstream/followers","following_url":"https://api.github.com/users/royalstream/following{/other_user}","gists_url":"https://api.github.com/users/royalstream/gists{/gist_id}","starred_url":"https://api.github.com/users/royalstream/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/royalstream/subscriptions","organizations_url":"https://api.github.com/users/royalstream/orgs","repos_url":"https://api.github.com/users/royalstream/repos","events_url":"https://api.github.com/users/royalstream/events{/privacy}","received_events_url":"https://api.github.com/users/royalstream/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"nikomatsakis","id":155238,"avatar_url":"https://avatars.githubusercontent.com/u/155238?v=3","gravatar_id":"","url":"https://api.github.com/users/nikomatsakis","html_url":"https://github.com/nikomatsakis","followers_url":"https://api.github.com/users/nikomatsakis/followers","following_url":"https://api.github.com/users/nikomatsakis/following{/other_user}","gists_url":"https://api.github.com/users/nikomatsakis/gists{/gist_id}","starred_url":"https://api.github.com/users/nikomatsakis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nikomatsakis/subscriptions","organizations_url":"https://api.github.com/users/nikomatsakis/orgs","repos_url":"https://api.github.com/users/nikomatsakis/repos","events_url":"https://api.github.com/users/nikomatsakis/events{/privacy}","received_events_url":"https://api.github.com/users/nikomatsakis/received_events","type":"User","site_admin":false},"milestone":null,"comments":5,"created_at":"2016-05-13T04:39:02Z","updated_at":"2016-05-13T16:24:10Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/rust-lang/rust/pulls/33612","html_url":"https://github.com/rust-lang/rust/pull/33612","diff_url":"https://github.com/rust-lang/rust/pull/33612.diff","patch_url":"https://github.com/rust-lang/rust/pull/33612.patch"},"body":"If you debug this program using **gdb**\r\n```rust\r\nfn main() {\r\n    let x = 10;\r\n    let y = Some(&x);\r\n    // additional code\r\n}\r\n```\r\nAnd you try to print **y**'s value from the debugger, you get the following:\r\n```\r\n(gdb) print y\r\nPython Exception <class 'gdb.error'> Cannot convert value to int.: \r\n$1 = {RUST$ENCODED$ENUM$0$None = Some = {0x7fff5fbff97c}}\r\n```\r\nWhat happens is that inside **debugger_pretty_printers_common.py** the method `is_null_variant` doesn't have any special handling for pointer values so it ends up calling `.as_integer()` on `discriminant_val` (which holds a pointer) and fails. \r\n\r\nConsidering it needs to handle pointers and return _true_ when the pointer is _null_, I modified the `.as_integer()` method in **gdb_rust_pretty_printing.py** to take pointers into consideration. \r\n\r\nAfter this modification **gdb** prints **y** like this:\r\n```\r\n(gdb) print y\r\n$1 = Some = {0x7fff5fbff97c}\r\n```\r\nNow, it would be nice to print something useful (instead of a pointer address) but the pretty printer doesn't currently handle references/pointers so that's a completely different subject.\r\n \r\n"},"comment":{"url":"https://api.github.com/repos/rust-lang/rust/issues/comments/219091781","html_url":"https://github.com/rust-lang/rust/pull/33612#issuecomment-219091781","issue_url":"https://api.github.com/repos/rust-lang/rust/issues/33612","id":219091781,"user":{"login":"bors","id":3372342,"avatar_url":"https://avatars.githubusercontent.com/u/3372342?v=3","gravatar_id":"","url":"https://api.github.com/users/bors","html_url":"https://github.com/bors","followers_url":"https://api.github.com/users/bors/followers","following_url":"https://api.github.com/users/bors/following{/other_user}","gists_url":"https://api.github.com/users/bors/gists{/gist_id}","starred_url":"https://api.github.com/users/bors/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bors/subscriptions","organizations_url":"https://api.github.com/users/bors/orgs","repos_url":"https://api.github.com/users/bors/repos","events_url":"https://api.github.com/users/bors/events{/privacy}","received_events_url":"https://api.github.com/users/bors/received_events","type":"User","site_admin":false},"created_at":"2016-05-13T16:24:10Z","updated_at":"2016-05-13T16:24:10Z","body":":pushpin: Commit 04baf25 has been approved by `michaelwoerister`\n\n<!-- @bors r=michaelwoerister 04baf2593e782dafc979cfbfb6c9994e3a0d1e78 -->"}}