Skip to content

Commit

Permalink
debuginfo: always include disambiguator in type names
Browse files Browse the repository at this point in the history
  • Loading branch information
philipc committed Aug 27, 2019
1 parent fbe3f3e commit 61ff27a
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 20 deletions.
18 changes: 8 additions & 10 deletions src/librustc_codegen_ssa/debuginfo/type_names.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,18 +191,16 @@ pub fn push_debuginfo_type_name<'tcx>(
visited.remove(t);
},
ty::Closure(def_id, ..) => {
output.push_str("closure");
let disambiguator = tcx.def_key(def_id).disambiguated_data.disambiguator;
if disambiguator != 0 {
output.push_str(&format!("-{}", disambiguator));
}
output.push_str(&format!(
"closure-{}",
tcx.def_key(def_id).disambiguated_data.disambiguator
));
}
ty::Generator(def_id, ..) => {
output.push_str("generator");
let disambiguator = tcx.def_key(def_id).disambiguated_data.disambiguator;
if disambiguator != 0 {
output.push_str(&format!("-{}", disambiguator));
}
output.push_str(&format!(
"generator-{}",
tcx.def_key(def_id).disambiguated_data.disambiguator
));
}
ty::Error |
ty::Infer(_) |
Expand Down
16 changes: 8 additions & 8 deletions src/test/debuginfo/generator-objects.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,31 +10,31 @@

// gdb-command:run
// gdb-command:print b
// gdb-check:$1 = generator_objects::main::generator {__0: 0x[...], <<variant>>: {__state: 0, 0: generator_objects::main::generator::Unresumed, 1: generator_objects::main::generator::Returned, 2: generator_objects::main::generator::Panicked, 3: generator_objects::main::generator::Suspend0 {[...]}, 4: generator_objects::main::generator::Suspend1 {[...]}}}
// gdb-check:$1 = generator_objects::main::generator-0 {__0: 0x[...], <<variant>>: {__state: 0, 0: generator_objects::main::generator-0::Unresumed, 1: generator_objects::main::generator-0::Returned, 2: generator_objects::main::generator-0::Panicked, 3: generator_objects::main::generator-0::Suspend0 {[...]}, 4: generator_objects::main::generator-0::Suspend1 {[...]}}}
// gdb-command:continue
// gdb-command:print b
// gdb-check:$2 = generator_objects::main::generator {__0: 0x[...], <<variant>>: {__state: 3, 0: generator_objects::main::generator::Unresumed, 1: generator_objects::main::generator::Returned, 2: generator_objects::main::generator::Panicked, 3: generator_objects::main::generator::Suspend0 {c: 6, d: 7}, 4: generator_objects::main::generator::Suspend1 {[...]}}}
// gdb-check:$2 = generator_objects::main::generator-0 {__0: 0x[...], <<variant>>: {__state: 3, 0: generator_objects::main::generator-0::Unresumed, 1: generator_objects::main::generator-0::Returned, 2: generator_objects::main::generator-0::Panicked, 3: generator_objects::main::generator-0::Suspend0 {c: 6, d: 7}, 4: generator_objects::main::generator-0::Suspend1 {[...]}}}
// gdb-command:continue
// gdb-command:print b
// gdb-check:$3 = generator_objects::main::generator {__0: 0x[...], <<variant>>: {__state: 4, 0: generator_objects::main::generator::Unresumed, 1: generator_objects::main::generator::Returned, 2: generator_objects::main::generator::Panicked, 3: generator_objects::main::generator::Suspend0 {[...]}, 4: generator_objects::main::generator::Suspend1 {c: 7, d: 8}}}
// gdb-check:$3 = generator_objects::main::generator-0 {__0: 0x[...], <<variant>>: {__state: 4, 0: generator_objects::main::generator-0::Unresumed, 1: generator_objects::main::generator-0::Returned, 2: generator_objects::main::generator-0::Panicked, 3: generator_objects::main::generator-0::Suspend0 {[...]}, 4: generator_objects::main::generator-0::Suspend1 {c: 7, d: 8}}}
// gdb-command:continue
// gdb-command:print b
// gdb-check:$4 = generator_objects::main::generator {__0: 0x[...], <<variant>>: {__state: 1, 0: generator_objects::main::generator::Unresumed, 1: generator_objects::main::generator::Returned, 2: generator_objects::main::generator::Panicked, 3: generator_objects::main::generator::Suspend0 {[...]}, 4: generator_objects::main::generator::Suspend1 {[...]}}}
// gdb-check:$4 = generator_objects::main::generator-0 {__0: 0x[...], <<variant>>: {__state: 1, 0: generator_objects::main::generator-0::Unresumed, 1: generator_objects::main::generator-0::Returned, 2: generator_objects::main::generator-0::Panicked, 3: generator_objects::main::generator-0::Suspend0 {[...]}, 4: generator_objects::main::generator-0::Suspend1 {[...]}}}

// === LLDB TESTS ==================================================================================

// lldb-command:run
// lldb-command:print b
// lldbg-check:(generator_objects::main::generator) $0 = generator(&0x[...])
// lldbg-check:(generator_objects::main::generator-0) $0 = generator-0(&0x[...])
// lldb-command:continue
// lldb-command:print b
// lldbg-check:(generator_objects::main::generator) $1 = generator(&0x[...])
// lldbg-check:(generator_objects::main::generator-0) $1 = generator-0(&0x[...])
// lldb-command:continue
// lldb-command:print b
// lldbg-check:(generator_objects::main::generator) $2 = generator(&0x[...])
// lldbg-check:(generator_objects::main::generator-0) $2 = generator-0(&0x[...])
// lldb-command:continue
// lldb-command:print b
// lldbg-check:(generator_objects::main::generator) $3 = generator(&0x[...])
// lldbg-check:(generator_objects::main::generator-0) $3 = generator-0(&0x[...])

#![feature(omit_gdb_pretty_printer_section, generators, generator_trait)]
#![omit_gdb_pretty_printer_section]
Expand Down
4 changes: 2 additions & 2 deletions src/test/debuginfo/issue-57822.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// gdb-command:run

// gdb-command:print g
// gdb-check:$1 = issue_57822::main::closure-1 (issue_57822::main::closure (1))
// gdb-check:$1 = issue_57822::main::closure-1 (issue_57822::main::closure-0 (1))

// gdb-command:print b
// gdb-check:$2 = issue_57822::main::generator-3 {__0: issue_57822::main::generator-2 {__0: 2, <<variant>>: {[...]}}, <<variant>>: {[...]}}
Expand All @@ -23,7 +23,7 @@
// lldb-command:run

// lldb-command:print g
// lldbg-check:(issue_57822::main::closure-1) $0 = closure-1(closure(1))
// lldbg-check:(issue_57822::main::closure-1) $0 = closure-1(closure-0(1))

// lldb-command:print b
// lldbg-check:(issue_57822::main::generator-3) $1 = generator-3(generator-2(2))
Expand Down

0 comments on commit 61ff27a

Please sign in to comment.