summaryrefslogtreecommitdiffstats
path: root/src/test/debuginfo
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:02:58 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:02:58 +0000
commit698f8c2f01ea549d77d7dc3338a12e04c11057b9 (patch)
tree173a775858bd501c378080a10dca74132f05bc50 /src/test/debuginfo
parentInitial commit. (diff)
downloadrustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.tar.xz
rustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.zip
Adding upstream version 1.64.0+dfsg1.upstream/1.64.0+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/debuginfo')
-rw-r--r--src/test/debuginfo/associated-types.rs155
-rw-r--r--src/test/debuginfo/auxiliary/cross_crate_debuginfo_type_uniquing.rs16
-rw-r--r--src/test/debuginfo/auxiliary/cross_crate_spans.rs19
-rw-r--r--src/test/debuginfo/auxiliary/dependency-with-embedded-visualizers.natvis10
-rw-r--r--src/test/debuginfo/auxiliary/dependency-with-embedded-visualizers.py23
-rw-r--r--src/test/debuginfo/auxiliary/dependency-with-embedded-visualizers.rs19
-rw-r--r--src/test/debuginfo/auxiliary/issue-13213-aux.rs19
-rw-r--r--src/test/debuginfo/auxiliary/macro-stepping.rs10
-rw-r--r--src/test/debuginfo/basic-types-globals-metadata.rs77
-rw-r--r--src/test/debuginfo/basic-types-globals.rs86
-rw-r--r--src/test/debuginfo/basic-types-metadata.rs95
-rw-r--r--src/test/debuginfo/basic-types-mut-globals.rs147
-rw-r--r--src/test/debuginfo/basic-types.rs159
-rw-r--r--src/test/debuginfo/borrowed-basic.rs161
-rw-r--r--src/test/debuginfo/borrowed-c-style-enum.rs56
-rw-r--r--src/test/debuginfo/borrowed-enum.rs71
-rw-r--r--src/test/debuginfo/borrowed-struct.rs89
-rw-r--r--src/test/debuginfo/borrowed-tuple.rs54
-rw-r--r--src/test/debuginfo/borrowed-unique-basic.rs164
-rw-r--r--src/test/debuginfo/box.rs37
-rw-r--r--src/test/debuginfo/boxed-struct.rs70
-rw-r--r--src/test/debuginfo/by-value-non-immediate-argument.rs126
-rw-r--r--src/test/debuginfo/by-value-self-argument-in-trait-impl.rs82
-rw-r--r--src/test/debuginfo/c-style-enum-in-composite.rs156
-rw-r--r--src/test/debuginfo/c-style-enum.rs194
-rw-r--r--src/test/debuginfo/captured-fields-1.rs96
-rw-r--r--src/test/debuginfo/captured-fields-2.rs55
-rw-r--r--src/test/debuginfo/closure-in-generic-function.rs60
-rw-r--r--src/test/debuginfo/constant-debug-locs.rs54
-rw-r--r--src/test/debuginfo/constant-in-match-pattern.rs84
-rw-r--r--src/test/debuginfo/cross-crate-spans.rs76
-rw-r--r--src/test/debuginfo/cross-crate-type-uniquing.rs14
-rw-r--r--src/test/debuginfo/destructured-fn-argument.rs499
-rw-r--r--src/test/debuginfo/destructured-for-loop-variable.rs243
-rw-r--r--src/test/debuginfo/destructured-local.rs373
-rw-r--r--src/test/debuginfo/drop-locations.rs83
-rw-r--r--src/test/debuginfo/duration-type.rs22
-rw-r--r--src/test/debuginfo/embedded-visualizer-point.natvis10
-rw-r--r--src/test/debuginfo/embedded-visualizer-point.py23
-rw-r--r--src/test/debuginfo/embedded-visualizer.natvis10
-rw-r--r--src/test/debuginfo/embedded-visualizer.py23
-rw-r--r--src/test/debuginfo/embedded-visualizer.rs112
-rw-r--r--src/test/debuginfo/empty-string.rs36
-rw-r--r--src/test/debuginfo/enum-thinlto.rs46
-rw-r--r--src/test/debuginfo/evec-in-struct.rs111
-rw-r--r--src/test/debuginfo/extern-c-fn.rs63
-rw-r--r--src/test/debuginfo/fixed-sized-array.rs39
-rw-r--r--src/test/debuginfo/function-arg-initialization.rs330
-rw-r--r--src/test/debuginfo/function-arguments.rs62
-rw-r--r--src/test/debuginfo/function-call.rs42
-rw-r--r--src/test/debuginfo/function-names.rs205
-rw-r--r--src/test/debuginfo/function-prologue-stepping-regular.rs226
-rw-r--r--src/test/debuginfo/gdb-char.rs23
-rw-r--r--src/test/debuginfo/gdb-pretty-struct-and-enums.rs62
-rw-r--r--src/test/debuginfo/generator-locals.rs87
-rw-r--r--src/test/debuginfo/generator-objects.rs103
-rw-r--r--src/test/debuginfo/generic-enum-with-different-disr-sizes.rs92
-rw-r--r--src/test/debuginfo/generic-function.rs78
-rw-r--r--src/test/debuginfo/generic-functions-nested.rs88
-rw-r--r--src/test/debuginfo/generic-method-on-generic-struct.rs163
-rw-r--r--src/test/debuginfo/generic-static-method-on-struct-and-enum.rs58
-rw-r--r--src/test/debuginfo/generic-struct-style-enum.rs76
-rw-r--r--src/test/debuginfo/generic-struct.rs85
-rw-r--r--src/test/debuginfo/generic-tuple-style-enum.rs93
-rw-r--r--src/test/debuginfo/include_string.rs45
-rw-r--r--src/test/debuginfo/issue-12886.rs30
-rw-r--r--src/test/debuginfo/issue-13213.rs16
-rw-r--r--src/test/debuginfo/issue-14411.rs15
-rw-r--r--src/test/debuginfo/issue-22656.rs48
-rw-r--r--src/test/debuginfo/issue-57822.rs55
-rw-r--r--src/test/debuginfo/issue-7712.rs16
-rw-r--r--src/test/debuginfo/lexical-scope-in-for-loop.rs109
-rw-r--r--src/test/debuginfo/lexical-scope-in-if-let.rs100
-rw-r--r--src/test/debuginfo/lexical-scope-in-if.rs190
-rw-r--r--src/test/debuginfo/lexical-scope-in-match.rs210
-rw-r--r--src/test/debuginfo/lexical-scope-in-parameterless-closure.rs12
-rw-r--r--src/test/debuginfo/lexical-scope-in-stack-closure.rs103
-rw-r--r--src/test/debuginfo/lexical-scope-in-unconditional-loop.rs182
-rw-r--r--src/test/debuginfo/lexical-scope-in-unique-closure.rs104
-rw-r--r--src/test/debuginfo/lexical-scope-in-while.rs178
-rw-r--r--src/test/debuginfo/lexical-scope-with-macro.rs177
-rw-r--r--src/test/debuginfo/lexical-scopes-in-block-expression.rs562
-rw-r--r--src/test/debuginfo/limited-debuginfo.rs51
-rw-r--r--src/test/debuginfo/macro-stepping.inc7
-rw-r--r--src/test/debuginfo/macro-stepping.rs121
-rw-r--r--src/test/debuginfo/marker-types.rs49
-rw-r--r--src/test/debuginfo/method-on-enum.rs148
-rw-r--r--src/test/debuginfo/method-on-generic-struct.rs163
-rw-r--r--src/test/debuginfo/method-on-struct.rs161
-rw-r--r--src/test/debuginfo/method-on-trait.rs167
-rw-r--r--src/test/debuginfo/method-on-tuple-struct.rs159
-rw-r--r--src/test/debuginfo/msvc-pretty-enums.rs102
-rw-r--r--src/test/debuginfo/msvc-scalarpair-params.rs101
-rw-r--r--src/test/debuginfo/multi-byte-chars.rs15
-rw-r--r--src/test/debuginfo/multi-cgu.rs58
-rw-r--r--src/test/debuginfo/multiple-functions-equal-var-names.rs66
-rw-r--r--src/test/debuginfo/multiple-functions.rs66
-rw-r--r--src/test/debuginfo/mutable-locs.rs104
-rw-r--r--src/test/debuginfo/mutex.rs38
-rw-r--r--src/test/debuginfo/name-shadowing-and-scope-nesting.rs137
-rw-r--r--src/test/debuginfo/no_mangle-info.rs40
-rw-r--r--src/test/debuginfo/numeric-types.rs206
-rw-r--r--src/test/debuginfo/option-like-enum.rs163
-rw-r--r--src/test/debuginfo/packed-struct-with-destructor.rs259
-rw-r--r--src/test/debuginfo/packed-struct.rs132
-rw-r--r--src/test/debuginfo/pretty-huge-vec.rs30
-rw-r--r--src/test/debuginfo/pretty-slices.rs46
-rw-r--r--src/test/debuginfo/pretty-std-collections-hash.rs106
-rw-r--r--src/test/debuginfo/pretty-std-collections.rs163
-rw-r--r--src/test/debuginfo/pretty-std.rs191
-rw-r--r--src/test/debuginfo/pretty-uninitialized-vec.rs26
-rw-r--r--src/test/debuginfo/range-types.rs49
-rw-r--r--src/test/debuginfo/rc_arc.rs145
-rw-r--r--src/test/debuginfo/recursive-enum.rs23
-rw-r--r--src/test/debuginfo/recursive-struct.rs215
-rw-r--r--src/test/debuginfo/result-types.rs28
-rw-r--r--src/test/debuginfo/rwlock-read.rs32
-rw-r--r--src/test/debuginfo/rwlock-write.rs27
-rw-r--r--src/test/debuginfo/self-in-default-method.rs162
-rw-r--r--src/test/debuginfo/self-in-generic-default-method.rs163
-rw-r--r--src/test/debuginfo/shadowed-argument.rs81
-rw-r--r--src/test/debuginfo/shadowed-variable.rs114
-rw-r--r--src/test/debuginfo/should-fail.rs35
-rw-r--r--src/test/debuginfo/simd.rs103
-rw-r--r--src/test/debuginfo/simple-lexical-scope.rs115
-rw-r--r--src/test/debuginfo/simple-struct.rs233
-rw-r--r--src/test/debuginfo/simple-tuple.rs211
-rw-r--r--src/test/debuginfo/static-method-on-struct-and-enum.rs85
-rw-r--r--src/test/debuginfo/step-into-match.rs383
-rw-r--r--src/test/debuginfo/struct-in-enum.rs85
-rw-r--r--src/test/debuginfo/struct-in-struct.rs178
-rw-r--r--src/test/debuginfo/struct-namespace.rs64
-rw-r--r--src/test/debuginfo/struct-style-enum.rs90
-rw-r--r--src/test/debuginfo/struct-with-destructor.rs144
-rw-r--r--src/test/debuginfo/text-to-include-1.txt1
-rw-r--r--src/test/debuginfo/text-to-include-2.txt1
-rw-r--r--src/test/debuginfo/text-to-include-3.txt1
-rw-r--r--src/test/debuginfo/thread-names.rs51
-rw-r--r--src/test/debuginfo/thread.rs31
-rw-r--r--src/test/debuginfo/trait-pointers.rs27
-rw-r--r--src/test/debuginfo/tuple-in-struct.rs153
-rw-r--r--src/test/debuginfo/tuple-in-tuple.rs147
-rw-r--r--src/test/debuginfo/tuple-struct.rs89
-rw-r--r--src/test/debuginfo/tuple-style-enum.rs90
-rw-r--r--src/test/debuginfo/type-names.cdb.js17
-rw-r--r--src/test/debuginfo/type-names.rs473
-rw-r--r--src/test/debuginfo/union-smoke.rs48
-rw-r--r--src/test/debuginfo/unique-enum.rs74
-rw-r--r--src/test/debuginfo/unit-type.rs71
-rw-r--r--src/test/debuginfo/unreachable-locals.rs158
-rw-r--r--src/test/debuginfo/unsized.rs93
-rw-r--r--src/test/debuginfo/var-captured-in-nested-closure.rs174
-rw-r--r--src/test/debuginfo/var-captured-in-sendable-closure.rs81
-rw-r--r--src/test/debuginfo/var-captured-in-stack-closure.rs159
-rw-r--r--src/test/debuginfo/vec-slices.rs133
-rw-r--r--src/test/debuginfo/vec.rs42
156 files changed, 16206 insertions, 0 deletions
diff --git a/src/test/debuginfo/associated-types.rs b/src/test/debuginfo/associated-types.rs
new file mode 100644
index 000000000..0a0ce3c67
--- /dev/null
+++ b/src/test/debuginfo/associated-types.rs
@@ -0,0 +1,155 @@
+// Some versions of the non-rust-enabled LLDB print the wrong generic
+// parameter type names in this test.
+// rust-lldb
+
+// compile-flags:-g
+
+// === GDB TESTS ===================================================================================
+// gdb-command:run
+
+// gdb-command:print arg
+// gdbg-check:$1 = {b = -1, b1 = 0}
+// gdbr-check:$1 = associated_types::Struct<i32> {b: -1, b1: 0}
+// gdb-command:continue
+
+// gdb-command:print inferred
+// gdb-check:$2 = 1
+// gdb-command:print explicitly
+// gdb-check:$3 = 1
+// gdb-command:continue
+
+// gdb-command:print arg
+// gdb-check:$4 = 2
+// gdb-command:continue
+
+// gdb-command:print arg
+// gdbg-check:$5 = {__0 = 4, __1 = 5}
+// gdbr-check:$5 = (4, 5)
+// gdb-command:continue
+
+// gdb-command:print a
+// gdb-check:$6 = 6
+// gdb-command:print b
+// gdb-check:$7 = 7
+// gdb-command:continue
+
+// gdb-command:print a
+// gdb-check:$8 = 8
+// gdb-command:print b
+// gdb-check:$9 = 9
+// gdb-command:continue
+
+// === LLDB TESTS ==================================================================================
+// lldb-command:run
+
+// lldb-command:print arg
+// lldbg-check:[...]$0 = { b = -1, b1 = 0 }
+// lldbr-check:(associated_types::Struct<i32>) arg = { b = -1, b1 = 0 }
+// lldb-command:continue
+
+// lldb-command:print inferred
+// lldbg-check:[...]$1 = 1
+// lldbr-check:(i64) inferred = 1
+// lldb-command:print explicitly
+// lldbg-check:[...]$2 = 1
+// lldbr-check:(i64) explicitly = 1
+// lldb-command:continue
+
+// lldb-command:print arg
+// lldbg-check:[...]$3 = 2
+// lldbr-check:(i64) arg = 2
+// lldb-command:continue
+
+// lldb-command:print arg
+// lldbg-check:[...]$4 = (4, 5)
+// lldbr-check:((i32, i64)) arg = { = 4 = 5 }
+// lldb-command:continue
+
+// lldb-command:print a
+// lldbg-check:[...]$5 = 6
+// lldbr-check:(i32) a = 6
+// lldb-command:print b
+// lldbg-check:[...]$6 = 7
+// lldbr-check:(i64) b = 7
+// lldb-command:continue
+
+// lldb-command:print a
+// lldbg-check:[...]$7 = 8
+// lldbr-check:(i64) a = 8
+// lldb-command:print b
+// lldbg-check:[...]$8 = 9
+// lldbr-check:(i32) b = 9
+// lldb-command:continue
+
+#![allow(unused_variables)]
+#![allow(dead_code)]
+#![feature(omit_gdb_pretty_printer_section)]
+#![omit_gdb_pretty_printer_section]
+
+trait TraitWithAssocType {
+ type Type;
+
+ fn get_value(&self) -> Self::Type;
+}
+impl TraitWithAssocType for i32 {
+ type Type = i64;
+
+ fn get_value(&self) -> i64 { *self as i64 }
+}
+
+struct Struct<T: TraitWithAssocType> {
+ b: T,
+ b1: T::Type,
+}
+
+enum Enum<T: TraitWithAssocType> {
+ Variant1(T, T::Type),
+ Variant2(T::Type, T)
+}
+
+fn assoc_struct<T: TraitWithAssocType>(arg: Struct<T>) {
+ zzz(); // #break
+}
+
+fn assoc_local<T: TraitWithAssocType>(x: T) {
+ let inferred = x.get_value();
+ let explicitly: T::Type = x.get_value();
+
+ zzz(); // #break
+}
+
+fn assoc_arg<T: TraitWithAssocType>(arg: T::Type) {
+ zzz(); // #break
+}
+
+fn assoc_return_value<T: TraitWithAssocType>(arg: T) -> T::Type {
+ return arg.get_value();
+}
+
+fn assoc_tuple<T: TraitWithAssocType>(arg: (T, T::Type)) {
+ zzz(); // #break
+}
+
+fn assoc_enum<T: TraitWithAssocType>(arg: Enum<T>) {
+
+ match arg {
+ Enum::Variant1(a, b) => {
+ zzz(); // #break
+ }
+ Enum::Variant2(a, b) => {
+ zzz(); // #break
+ }
+ }
+}
+
+fn main() {
+ assoc_struct(Struct { b: -1, b1: 0 });
+ assoc_local(1);
+ assoc_arg::<i32>(2);
+ assoc_return_value(3);
+ assoc_tuple((4, 5));
+ assoc_enum(Enum::Variant1(6, 7));
+ assoc_enum(Enum::Variant2(8, 9));
+}
+
+fn zzz() { () }
diff --git a/src/test/debuginfo/auxiliary/cross_crate_debuginfo_type_uniquing.rs b/src/test/debuginfo/auxiliary/cross_crate_debuginfo_type_uniquing.rs
new file mode 100644
index 000000000..b9bb3ba72
--- /dev/null
+++ b/src/test/debuginfo/auxiliary/cross_crate_debuginfo_type_uniquing.rs
@@ -0,0 +1,16 @@
+// no-prefer-dynamic
+#![crate_type = "rlib"]
+// compile-flags:-g
+
+struct S1;
+
+impl S1 {
+ fn f(&mut self) { }
+}
+
+
+struct S2;
+
+impl S2 {
+ fn f(&mut self) { }
+}
diff --git a/src/test/debuginfo/auxiliary/cross_crate_spans.rs b/src/test/debuginfo/auxiliary/cross_crate_spans.rs
new file mode 100644
index 000000000..efe5e4195
--- /dev/null
+++ b/src/test/debuginfo/auxiliary/cross_crate_spans.rs
@@ -0,0 +1,19 @@
+#![crate_type = "rlib"]
+
+#![allow(unused_variables)]
+#![feature(omit_gdb_pretty_printer_section)]
+#![omit_gdb_pretty_printer_section]
+
+// no-prefer-dynamic
+// compile-flags:-g
+
+pub fn generic_function<T: Clone>(val: T) -> (T, T) {
+ let result = (val.clone(), val.clone());
+ let a_variable: u32 = 123456789;
+ let another_variable: f64 = 123456789.5;
+ zzz();
+ result
+}
+
+#[inline(never)]
+fn zzz() {()}
diff --git a/src/test/debuginfo/auxiliary/dependency-with-embedded-visualizers.natvis b/src/test/debuginfo/auxiliary/dependency-with-embedded-visualizers.natvis
new file mode 100644
index 000000000..5900fcc01
--- /dev/null
+++ b/src/test/debuginfo/auxiliary/dependency-with-embedded-visualizers.natvis
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
+ <Type Name="dependency_with_embedded_visualizers::Person">
+ <DisplayString>{name} is {age} years old.</DisplayString>
+ <Expand>
+ <Item Name="[name]">name</Item>
+ <Item Name="[age]">age</Item>
+ </Expand>
+ </Type>
+</AutoVisualizer>
diff --git a/src/test/debuginfo/auxiliary/dependency-with-embedded-visualizers.py b/src/test/debuginfo/auxiliary/dependency-with-embedded-visualizers.py
new file mode 100644
index 000000000..2635ed487
--- /dev/null
+++ b/src/test/debuginfo/auxiliary/dependency-with-embedded-visualizers.py
@@ -0,0 +1,23 @@
+import gdb
+
+class PersonPrinter:
+ "Print a Person"
+
+ def __init__(self, val):
+ self.val = val
+ self.name = val["name"]
+ self.age = int(val["age"])
+
+ def to_string(self):
+ return "{} is {} years old.".format(self.name, self.age)
+
+def lookup(val):
+ lookup_tag = val.type.tag
+ if lookup_tag is None:
+ return None
+ if "dependency_with_embedded_visualizers::Person" == lookup_tag:
+ return PersonPrinter(val)
+
+ return None
+
+gdb.current_objfile().pretty_printers.append(lookup)
diff --git a/src/test/debuginfo/auxiliary/dependency-with-embedded-visualizers.rs b/src/test/debuginfo/auxiliary/dependency-with-embedded-visualizers.rs
new file mode 100644
index 000000000..327515b10
--- /dev/null
+++ b/src/test/debuginfo/auxiliary/dependency-with-embedded-visualizers.rs
@@ -0,0 +1,19 @@
+// compile-flags:-g
+// ignore-lldb
+// no-prefer-dynamic
+
+#![feature(debugger_visualizer)]
+#![debugger_visualizer(natvis_file = "dependency-with-embedded-visualizers.natvis")]
+#![debugger_visualizer(gdb_script_file = "dependency-with-embedded-visualizers.py")]
+#![crate_type = "rlib"]
+
+pub struct Person {
+ name: String,
+ age: i32,
+}
+
+impl Person {
+ pub fn new(name: String, age: i32) -> Person {
+ Person { name: name, age: age }
+ }
+}
diff --git a/src/test/debuginfo/auxiliary/issue-13213-aux.rs b/src/test/debuginfo/auxiliary/issue-13213-aux.rs
new file mode 100644
index 000000000..bde98b445
--- /dev/null
+++ b/src/test/debuginfo/auxiliary/issue-13213-aux.rs
@@ -0,0 +1,19 @@
+#![crate_type = "lib"]
+// compile-flags:-g
+
+pub use private::P;
+
+#[derive(Copy, Clone)]
+pub struct S {
+ p: P,
+}
+
+mod private {
+ #[derive(Copy, Clone)]
+ pub struct P {
+ p: i32,
+ }
+ pub const THREE: P = P { p: 3 };
+}
+
+pub static A: S = S { p: private::THREE };
diff --git a/src/test/debuginfo/auxiliary/macro-stepping.rs b/src/test/debuginfo/auxiliary/macro-stepping.rs
new file mode 100644
index 000000000..4447dd22d
--- /dev/null
+++ b/src/test/debuginfo/auxiliary/macro-stepping.rs
@@ -0,0 +1,10 @@
+// compile-flags:-g
+
+#![crate_type = "rlib"]
+
+#[macro_export]
+macro_rules! new_scope {
+ () => {
+ let x = 1;
+ }
+}
diff --git a/src/test/debuginfo/basic-types-globals-metadata.rs b/src/test/debuginfo/basic-types-globals-metadata.rs
new file mode 100644
index 000000000..3934d3c7a
--- /dev/null
+++ b/src/test/debuginfo/basic-types-globals-metadata.rs
@@ -0,0 +1,77 @@
+// min-lldb-version: 310
+// ignore-gdb // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155
+
+// compile-flags:-g
+// gdb-command:run
+// gdbg-command:whatis 'basic_types_globals_metadata::B'
+// gdbr-command:whatis basic_types_globals_metadata::B
+// gdb-check:type = bool
+// gdbg-command:whatis 'basic_types_globals_metadata::I'
+// gdbr-command:whatis basic_types_globals_metadata::I
+// gdb-check:type = isize
+// gdbg-command:whatis 'basic_types_globals_metadata::C'
+// gdbr-command:whatis basic_types_globals_metadata::C
+// gdb-check:type = char
+// gdbg-command:whatis 'basic_types_globals_metadata::I8'
+// gdbr-command:whatis basic_types_globals_metadata::I8
+// gdb-check:type = i8
+// gdbg-command:whatis 'basic_types_globals_metadata::I16'
+// gdbr-command:whatis basic_types_globals_metadata::I16
+// gdb-check:type = i16
+// gdbg-command:whatis 'basic_types_globals_metadata::I32'
+// gdbr-command:whatis basic_types_globals_metadata::I32
+// gdb-check:type = i32
+// gdbg-command:whatis 'basic_types_globals_metadata::I64'
+// gdbr-command:whatis basic_types_globals_metadata::I64
+// gdb-check:type = i64
+// gdbg-command:whatis 'basic_types_globals_metadata::U'
+// gdbr-command:whatis basic_types_globals_metadata::U
+// gdb-check:type = usize
+// gdbg-command:whatis 'basic_types_globals_metadata::U8'
+// gdbr-command:whatis basic_types_globals_metadata::U8
+// gdb-check:type = u8
+// gdbg-command:whatis 'basic_types_globals_metadata::U16'
+// gdbr-command:whatis basic_types_globals_metadata::U16
+// gdb-check:type = u16
+// gdbg-command:whatis 'basic_types_globals_metadata::U32'
+// gdbr-command:whatis basic_types_globals_metadata::U32
+// gdb-check:type = u32
+// gdbg-command:whatis 'basic_types_globals_metadata::U64'
+// gdbr-command:whatis basic_types_globals_metadata::U64
+// gdb-check:type = u64
+// gdbg-command:whatis 'basic_types_globals_metadata::F32'
+// gdbr-command:whatis basic_types_globals_metadata::F32
+// gdb-check:type = f32
+// gdbg-command:whatis 'basic_types_globals_metadata::F64'
+// gdbr-command:whatis basic_types_globals_metadata::F64
+// gdb-check:type = f64
+// gdb-command:continue
+
+#![allow(unused_variables)]
+#![allow(dead_code)]
+#![feature(omit_gdb_pretty_printer_section)]
+#![omit_gdb_pretty_printer_section]
+
+// N.B. These are `mut` only so they don't constant fold away.
+static mut B: bool = false;
+static mut I: isize = -1;
+static mut C: char = 'a';
+static mut I8: i8 = 68;
+static mut I16: i16 = -16;
+static mut I32: i32 = -32;
+static mut I64: i64 = -64;
+static mut U: usize = 1;
+static mut U8: u8 = 100;
+static mut U16: u16 = 16;
+static mut U32: u32 = 32;
+static mut U64: u64 = 64;
+static mut F32: f32 = 2.5;
+static mut F64: f64 = 3.5;
+
+fn main() {
+ _zzz(); // #break
+
+ let a = unsafe { (B, I, C, I8, I16, I32, I64, U, U8, U16, U32, U64, F32, F64) };
+}
+
+fn _zzz() {()}
diff --git a/src/test/debuginfo/basic-types-globals.rs b/src/test/debuginfo/basic-types-globals.rs
new file mode 100644
index 000000000..8a3df8ba2
--- /dev/null
+++ b/src/test/debuginfo/basic-types-globals.rs
@@ -0,0 +1,86 @@
+// Caveat - gdb doesn't know about UTF-32 character encoding and will print a
+// rust char as only its numerical value.
+
+// min-lldb-version: 310
+// min-gdb-version: 8.0
+
+// revisions: lto no-lto
+
+// compile-flags:-g
+
+// [lto] compile-flags:-C lto
+// [lto] no-prefer-dynamic
+
+// gdb-command:run
+// gdbg-command:print 'basic_types_globals::B'
+// gdbr-command:print B
+// gdb-check:$1 = false
+// gdbg-command:print 'basic_types_globals::I'
+// gdbr-command:print I
+// gdb-check:$2 = -1
+// gdbg-command:print 'basic_types_globals::C'
+// gdbr-command:print/d C
+// gdbg-check:$3 = 97
+// gdbr-check:$3 = 97
+// gdbg-command:print/d 'basic_types_globals::I8'
+// gdbr-command:print I8
+// gdb-check:$4 = 68
+// gdbg-command:print 'basic_types_globals::I16'
+// gdbr-command:print I16
+// gdb-check:$5 = -16
+// gdbg-command:print 'basic_types_globals::I32'
+// gdbr-command:print I32
+// gdb-check:$6 = -32
+// gdbg-command:print 'basic_types_globals::I64'
+// gdbr-command:print I64
+// gdb-check:$7 = -64
+// gdbg-command:print 'basic_types_globals::U'
+// gdbr-command:print U
+// gdb-check:$8 = 1
+// gdbg-command:print/d 'basic_types_globals::U8'
+// gdbr-command:print U8
+// gdb-check:$9 = 100
+// gdbg-command:print 'basic_types_globals::U16'
+// gdbr-command:print U16
+// gdb-check:$10 = 16
+// gdbg-command:print 'basic_types_globals::U32'
+// gdbr-command:print U32
+// gdb-check:$11 = 32
+// gdbg-command:print 'basic_types_globals::U64'
+// gdbr-command:print U64
+// gdb-check:$12 = 64
+// gdbg-command:print 'basic_types_globals::F32'
+// gdbr-command:print F32
+// gdb-check:$13 = 2.5
+// gdbg-command:print 'basic_types_globals::F64'
+// gdbr-command:print F64
+// gdb-check:$14 = 3.5
+// gdb-command:continue
+
+#![allow(unused_variables)]
+#![feature(omit_gdb_pretty_printer_section)]
+#![omit_gdb_pretty_printer_section]
+
+// N.B. These are `mut` only so they don't constant fold away.
+static mut B: bool = false;
+static mut I: isize = -1;
+static mut C: char = 'a';
+static mut I8: i8 = 68;
+static mut I16: i16 = -16;
+static mut I32: i32 = -32;
+static mut I64: i64 = -64;
+static mut U: usize = 1;
+static mut U8: u8 = 100;
+static mut U16: u16 = 16;
+static mut U32: u32 = 32;
+static mut U64: u64 = 64;
+static mut F32: f32 = 2.5;
+static mut F64: f64 = 3.5;
+
+fn main() {
+ _zzz(); // #break
+
+ let a = unsafe { (B, I, C, I8, I16, I32, I64, U, U8, U16, U32, U64, F32, F64) };
+}
+
+fn _zzz() {()}
diff --git a/src/test/debuginfo/basic-types-metadata.rs b/src/test/debuginfo/basic-types-metadata.rs
new file mode 100644
index 000000000..ca0a6e232
--- /dev/null
+++ b/src/test/debuginfo/basic-types-metadata.rs
@@ -0,0 +1,95 @@
+// min-lldb-version: 310
+// ignore-gdb // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155
+
+// compile-flags:-g
+// gdb-command:run
+// gdb-command:whatis unit
+// gdb-check:type = ()
+// gdb-command:whatis b
+// gdb-check:type = bool
+// gdb-command:whatis i
+// gdb-check:type = isize
+// gdb-command:whatis c
+// gdb-check:type = char
+// gdb-command:whatis i8
+// gdb-check:type = i8
+// gdb-command:whatis i16
+// gdb-check:type = i16
+// gdb-command:whatis i32
+// gdb-check:type = i32
+// gdb-command:whatis i64
+// gdb-check:type = i64
+// gdb-command:whatis u
+// gdb-check:type = usize
+// gdb-command:whatis u8
+// gdb-check:type = u8
+// gdb-command:whatis u16
+// gdb-check:type = u16
+// gdb-command:whatis u32
+// gdb-check:type = u32
+// gdb-command:whatis u64
+// gdb-check:type = u64
+// gdb-command:whatis f32
+// gdb-check:type = f32
+// gdb-command:whatis f64
+// gdb-check:type = f64
+// gdb-command:whatis fnptr
+// gdb-check:type = [...] (*)([...])
+// gdb-command:info functions _yyy
+// gdbg-check:[...]![...]_yyy([...]);
+// gdbr-check:static fn basic_types_metadata::_yyy() -> !;
+// gdb-command:ptype closure_0
+// gdbr-check: type = struct closure
+// gdbg-check: type = struct closure {
+// gdbg-check: <no data fields>
+// gdbg-check: }
+// gdb-command:ptype closure_1
+// gdbg-check: type = struct closure {
+// gdbg-check: bool *__0;
+// gdbg-check: }
+// gdbr-check: type = struct closure (
+// gdbr-check: bool *,
+// gdbr-check: )
+// gdb-command:ptype closure_2
+// gdbg-check: type = struct closure {
+// gdbg-check: bool *__0;
+// gdbg-check: isize *__1;
+// gdbg-check: }
+// gdbr-check: type = struct closure (
+// gdbr-check: bool *,
+// gdbr-check: isize *,
+// gdbr-check: )
+
+//
+// gdb-command:continue
+
+#![allow(unused_variables)]
+#![feature(omit_gdb_pretty_printer_section)]
+#![omit_gdb_pretty_printer_section]
+
+fn main() {
+ let unit: () = ();
+ let b: bool = false;
+ let i: isize = -1;
+ let c: char = 'a';
+ let i8: i8 = 68;
+ let i16: i16 = -16;
+ let i32: i32 = -32;
+ let i64: i64 = -64;
+ let u: usize = 1;
+ let u8: u8 = 100;
+ let u16: u16 = 16;
+ let u32: u32 = 32;
+ let u64: u64 = 64;
+ let f32: f32 = 2.5;
+ let f64: f64 = 3.5;
+ let fnptr : fn() = _zzz;
+ let closure_0 = || {};
+ let closure_1 = || { b; };
+ let closure_2 = || { if b { i } else { i }; };
+ _zzz(); // #break
+ if 1 == 1 { _yyy(); }
+}
+
+fn _zzz() {()}
+fn _yyy() -> ! {panic!()}
diff --git a/src/test/debuginfo/basic-types-mut-globals.rs b/src/test/debuginfo/basic-types-mut-globals.rs
new file mode 100644
index 000000000..9b0c46fa4
--- /dev/null
+++ b/src/test/debuginfo/basic-types-mut-globals.rs
@@ -0,0 +1,147 @@
+// Caveats - gdb prints any 8-bit value (meaning rust I8 and u8 values)
+// as its numerical value along with its associated ASCII char, there
+// doesn't seem to be any way around this. Also, gdb doesn't know
+// about UTF-32 character encoding and will print a rust char as only
+// its numerical value.
+
+// min-lldb-version: 310
+// ignore-gdb // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155
+
+// compile-flags:-g
+
+// gdb-command:run
+
+// Check initializers
+// gdbg-command:print 'basic_types_mut_globals::B'
+// gdbr-command:print B
+// gdb-check:$1 = false
+// gdbg-command:print 'basic_types_mut_globals::I'
+// gdbr-command:print I
+// gdb-check:$2 = -1
+// gdbg-command:print/d 'basic_types_mut_globals::C'
+// gdbr-command:print C
+// gdbg-check:$3 = 97
+// gdbr-check:$3 = 97 'a'
+// gdbg-command:print/d 'basic_types_mut_globals::I8'
+// gdbr-command:print I8
+// gdb-check:$4 = 68
+// gdbg-command:print 'basic_types_mut_globals::I16'
+// gdbr-command:print I16
+// gdb-check:$5 = -16
+// gdbg-command:print 'basic_types_mut_globals::I32'
+// gdbr-command:print I32
+// gdb-check:$6 = -32
+// gdbg-command:print 'basic_types_mut_globals::I64'
+// gdbr-command:print I64
+// gdb-check:$7 = -64
+// gdbg-command:print 'basic_types_mut_globals::U'
+// gdbr-command:print U
+// gdb-check:$8 = 1
+// gdbg-command:print/d 'basic_types_mut_globals::U8'
+// gdbr-command:print U8
+// gdb-check:$9 = 100
+// gdbg-command:print 'basic_types_mut_globals::U16'
+// gdbr-command:print U16
+// gdb-check:$10 = 16
+// gdbg-command:print 'basic_types_mut_globals::U32'
+// gdbr-command:print U32
+// gdb-check:$11 = 32
+// gdbg-command:print 'basic_types_mut_globals::U64'
+// gdbr-command:print U64
+// gdb-check:$12 = 64
+// gdbg-command:print 'basic_types_mut_globals::F32'
+// gdbr-command:print F32
+// gdb-check:$13 = 2.5
+// gdbg-command:print 'basic_types_mut_globals::F64'
+// gdbr-command:print F64
+// gdb-check:$14 = 3.5
+// gdb-command:continue
+
+// Check new values
+// gdbg-command:print 'basic_types_mut_globals'::B
+// gdbr-command:print B
+// gdb-check:$15 = true
+// gdbg-command:print 'basic_types_mut_globals'::I
+// gdbr-command:print I
+// gdb-check:$16 = 2
+// gdbg-command:print/d 'basic_types_mut_globals'::C
+// gdbr-command:print C
+// gdbg-check:$17 = 102
+// gdbr-check:$17 = 102 'f'
+// gdbg-command:print/d 'basic_types_mut_globals'::I8
+// gdbr-command:print/d I8
+// gdb-check:$18 = 78
+// gdbg-command:print 'basic_types_mut_globals'::I16
+// gdbr-command:print I16
+// gdb-check:$19 = -26
+// gdbg-command:print 'basic_types_mut_globals'::I32
+// gdbr-command:print I32
+// gdb-check:$20 = -12
+// gdbg-command:print 'basic_types_mut_globals'::I64
+// gdbr-command:print I64
+// gdb-check:$21 = -54
+// gdbg-command:print 'basic_types_mut_globals'::U
+// gdbr-command:print U
+// gdb-check:$22 = 5
+// gdbg-command:print/d 'basic_types_mut_globals'::U8
+// gdbr-command:print/d U8
+// gdb-check:$23 = 20
+// gdbg-command:print 'basic_types_mut_globals'::U16
+// gdbr-command:print U16
+// gdb-check:$24 = 32
+// gdbg-command:print 'basic_types_mut_globals'::U32
+// gdbr-command:print U32
+// gdb-check:$25 = 16
+// gdbg-command:print 'basic_types_mut_globals'::U64
+// gdbr-command:print U64
+// gdb-check:$26 = 128
+// gdbg-command:print 'basic_types_mut_globals'::F32
+// gdbr-command:print F32
+// gdb-check:$27 = 5.75
+// gdbg-command:print 'basic_types_mut_globals'::F64
+// gdbr-command:print F64
+// gdb-check:$28 = 9.25
+
+#![allow(unused_variables)]
+#![feature(omit_gdb_pretty_printer_section)]
+#![omit_gdb_pretty_printer_section]
+
+static mut B: bool = false;
+static mut I: isize = -1;
+static mut C: char = 'a';
+static mut I8: i8 = 68;
+static mut I16: i16 = -16;
+static mut I32: i32 = -32;
+static mut I64: i64 = -64;
+static mut U: usize = 1;
+static mut U8: u8 = 100;
+static mut U16: u16 = 16;
+static mut U32: u32 = 32;
+static mut U64: u64 = 64;
+static mut F32: f32 = 2.5;
+static mut F64: f64 = 3.5;
+
+fn main() {
+ _zzz(); // #break
+
+ unsafe {
+ B = true;
+ I = 2;
+ C = 'f';
+ I8 = 78;
+ I16 = -26;
+ I32 = -12;
+ I64 = -54;
+ U = 5;
+ U8 = 20;
+ U16 = 32;
+ U32 = 16;
+ U64 = 128;
+ F32 = 5.75;
+ F64 = 9.25;
+ }
+
+ _zzz(); // #break
+}
+
+fn _zzz() {()}
diff --git a/src/test/debuginfo/basic-types.rs b/src/test/debuginfo/basic-types.rs
new file mode 100644
index 000000000..07d33be2a
--- /dev/null
+++ b/src/test/debuginfo/basic-types.rs
@@ -0,0 +1,159 @@
+// Caveats - gdb prints any 8-bit value (meaning rust i8 and u8 values)
+// as its numerical value along with its associated ASCII char, there
+// doesn't seem to be any way around this. Also, gdb doesn't know
+// about UTF-32 character encoding and will print a rust char as only
+// its numerical value.
+
+// min-lldb-version: 310
+
+// This fails on lldb 6.0.1 on x86-64 Fedora 28; so ignore Linux for now.
+// ignore-linux
+
+// compile-flags:-g
+
+// === GDB TESTS ===================================================================================
+
+// gdb-command:run
+// gdb-command:print b
+// gdb-check:$1 = false
+// gdb-command:print i
+// gdb-check:$2 = -1
+// gdb-command:print c
+// gdbg-check:$3 = 97
+// gdbr-check:$3 = 97 'a'
+// gdb-command:print/d i8
+// gdb-check:$4 = 68
+// gdb-command:print i16
+// gdb-check:$5 = -16
+// gdb-command:print i32
+// gdb-check:$6 = -32
+// gdb-command:print i64
+// gdb-check:$7 = -64
+// gdb-command:print u
+// gdb-check:$8 = 1
+// gdb-command:print/d u8
+// gdb-check:$9 = 100
+// gdb-command:print u16
+// gdb-check:$10 = 16
+// gdb-command:print u32
+// gdb-check:$11 = 32
+// gdb-command:print u64
+// gdb-check:$12 = 64
+// gdb-command:print f32
+// gdb-check:$13 = 2.5
+// gdb-command:print f64
+// gdb-check:$14 = 3.5
+// gdb-command:print s
+// gdbg-check:$15 = {data_ptr = [...] "Hello, World!", length = 13}
+// gdbr-check:$15 = "Hello, World!"
+
+
+// === LLDB TESTS ==================================================================================
+
+// lldb-command:run
+// lldb-command:print b
+// lldbg-check:[...]$0 = false
+// lldbr-check:(bool) b = false
+// lldb-command:print i
+// lldbg-check:[...]$1 = -1
+// lldbr-check:(isize) i = -1
+
+// NOTE: only rust-enabled lldb supports 32bit chars
+// lldbr-command:print c
+// lldbr-check:(char) c = 'a'
+
+// lldb-command:print i8
+// lldbg-check:[...]$2 = 'D'
+// lldbr-check:(i8) i8 = 68
+// lldb-command:print i16
+// lldbg-check:[...]$3 = -16
+// lldbr-check:(i16) i16 = -16
+// lldb-command:print i32
+// lldbg-check:[...]$4 = -32
+// lldbr-check:(i32) i32 = -32
+// lldb-command:print i64
+// lldbg-check:[...]$5 = -64
+// lldbr-check:(i64) i64 = -64
+// lldb-command:print u
+// lldbg-check:[...]$6 = 1
+// lldbr-check:(usize) u = 1
+// lldb-command:print u8
+// lldbg-check:[...]$7 = 'd'
+// lldbr-check:(u8) u8 = 100
+// lldb-command:print u16
+// lldbg-check:[...]$8 = 16
+// lldbr-check:(u16) u16 = 16
+// lldb-command:print u32
+// lldbg-check:[...]$9 = 32
+// lldbr-check:(u32) u32 = 32
+// lldb-command:print u64
+// lldbg-check:[...]$10 = 64
+// lldbr-check:(u64) u64 = 64
+// lldb-command:print f32
+// lldbg-check:[...]$11 = 2.5
+// lldbr-check:(f32) f32 = 2.5
+// lldb-command:print f64
+// lldbg-check:[...]$12 = 3.5
+// lldbr-check:(f64) f64 = 3.5
+
+
+// === CDB TESTS ===================================================================================
+
+// cdb-command:g
+// cdb-command:dx b
+// cdb-check:b : false [Type: bool]
+// cdb-command:dx i
+// cdb-check:i : -1 [Type: [...]]
+// cdb-command:dx c
+// cdb-check:c : 0x61 'a' [Type: char32_t]
+// cdb-command:dx i8
+// cdb-check:i8 : 68 [Type: char]
+// cdb-command:dx i16
+// cdb-check:i16 : -16 [Type: short]
+// cdb-command:dx i32
+// cdb-check:i32 : -32 [Type: int]
+// cdb-command:dx i64
+// cdb-check:i64 : -64 [Type: __int64]
+// cdb-command:dx u
+// cdb-check:u : 0x1 [Type: [...]]
+// cdb-command:dx u8
+// cdb-check:u8 : 0x64 [Type: unsigned char]
+// cdb-command:dx u16
+// cdb-check:u16 : 0x10 [Type: unsigned short]
+// cdb-command:dx u32
+// cdb-check:u32 : 0x20 [Type: unsigned int]
+// cdb-command:dx u64
+// cdb-check:u64 : 0x40 [Type: unsigned __int64]
+// cdb-command:dx f32
+// cdb-check:f32 : 2.500000 [Type: float]
+// cdb-command:dx f64
+// cdb-check:f64 : 3.500000 [Type: double]
+// cdb-command:.enable_unicode 1
+// FIXME(#88840): The latest version of the Windows SDK broke the visualizer for str.
+// cdb-command:dx s
+// cdb-check:s : [...] [Type: str]
+
+#![allow(unused_variables)]
+#![feature(omit_gdb_pretty_printer_section)]
+#![omit_gdb_pretty_printer_section]
+
+fn main() {
+ let b: bool = false;
+ let i: isize = -1;
+ let c: char = 'a';
+ let i8: i8 = 68;
+ let i16: i16 = -16;
+ let i32: i32 = -32;
+ let i64: i64 = -64;
+ let u: usize = 1;
+ let u8: u8 = 100;
+ let u16: u16 = 16;
+ let u32: u32 = 32;
+ let u64: u64 = 64;
+ let f32: f32 = 2.5;
+ let f64: f64 = 3.5;
+ let s: &str = "Hello, World!";
+ _zzz(); // #break
+}
+
+fn _zzz() {()}
diff --git a/src/test/debuginfo/borrowed-basic.rs b/src/test/debuginfo/borrowed-basic.rs
new file mode 100644
index 000000000..45f5df228
--- /dev/null
+++ b/src/test/debuginfo/borrowed-basic.rs
@@ -0,0 +1,161 @@
+// compile-flags:-g
+// min-lldb-version: 310
+
+// === GDB TESTS ===================================================================================
+
+// gdb-command:run
+// gdb-command:print *bool_ref
+// gdb-check:$1 = true
+
+// gdb-command:print *int_ref
+// gdb-check:$2 = -1
+
+// gdb-command:print/d *char_ref
+// gdb-check:$3 = 97
+
+// gdb-command:print *i8_ref
+// gdbg-check:$4 = 68 'D'
+// gdbr-check:$4 = 68
+
+// gdb-command:print *i16_ref
+// gdb-check:$5 = -16
+
+// gdb-command:print *i32_ref
+// gdb-check:$6 = -32
+
+// gdb-command:print *i64_ref
+// gdb-check:$7 = -64
+
+// gdb-command:print *uint_ref
+// gdb-check:$8 = 1
+
+// gdb-command:print *u8_ref
+// gdbg-check:$9 = 100 'd'
+// gdbr-check:$9 = 100
+
+// gdb-command:print *u16_ref
+// gdb-check:$10 = 16
+
+// gdb-command:print *u32_ref
+// gdb-check:$11 = 32
+
+// gdb-command:print *u64_ref
+// gdb-check:$12 = 64
+
+// gdb-command:print *f32_ref
+// gdb-check:$13 = 2.5
+
+// gdb-command:print *f64_ref
+// gdb-check:$14 = 3.5
+
+
+// === LLDB TESTS ==================================================================================
+
+// lldb-command:run
+// lldb-command:print *bool_ref
+// lldbg-check:[...]$0 = true
+// lldbr-check:(bool) *bool_ref = true
+
+// lldb-command:print *int_ref
+// lldbg-check:[...]$1 = -1
+// lldbr-check:(isize) *int_ref = -1
+
+// NOTE: only rust-enabled lldb supports 32bit chars
+// lldbr-command:print *char_ref
+// lldbr-check:(char) *char_ref = 'a'
+
+// lldb-command:print *i8_ref
+// lldbg-check:[...]$2 = 'D'
+// lldbr-check:(i8) *i8_ref = 68
+
+// lldb-command:print *i16_ref
+// lldbg-check:[...]$3 = -16
+// lldbr-check:(i16) *i16_ref = -16
+
+// lldb-command:print *i32_ref
+// lldbg-check:[...]$4 = -32
+// lldbr-check:(i32) *i32_ref = -32
+
+// lldb-command:print *i64_ref
+// lldbg-check:[...]$5 = -64
+// lldbr-check:(i64) *i64_ref = -64
+
+// lldb-command:print *uint_ref
+// lldbg-check:[...]$6 = 1
+// lldbr-check:(usize) *uint_ref = 1
+
+// lldb-command:print *u8_ref
+// lldbg-check:[...]$7 = 'd'
+// lldbr-check:(u8) *u8_ref = 100
+
+// lldb-command:print *u16_ref
+// lldbg-check:[...]$8 = 16
+// lldbr-check:(u16) *u16_ref = 16
+
+// lldb-command:print *u32_ref
+// lldbg-check:[...]$9 = 32
+// lldbr-check:(u32) *u32_ref = 32
+
+// lldb-command:print *u64_ref
+// lldbg-check:[...]$10 = 64
+// lldbr-check:(u64) *u64_ref = 64
+
+// lldb-command:print *f32_ref
+// lldbg-check:[...]$11 = 2.5
+// lldbr-check:(f32) *f32_ref = 2.5
+
+// lldb-command:print *f64_ref
+// lldbg-check:[...]$12 = 3.5
+// lldbr-check:(f64) *f64_ref = 3.5
+
+#![allow(unused_variables)]
+#![feature(omit_gdb_pretty_printer_section)]
+#![omit_gdb_pretty_printer_section]
+
+fn main() {
+ let bool_val: bool = true;
+ let bool_ref: &bool = &bool_val;
+
+ let int_val: isize = -1;
+ let int_ref: &isize = &int_val;
+
+ let char_val: char = 'a';
+ let char_ref: &char = &char_val;
+
+ let i8_val: i8 = 68;
+ let i8_ref: &i8 = &i8_val;
+
+ let i16_val: i16 = -16;
+ let i16_ref: &i16 = &i16_val;
+
+ let i32_val: i32 = -32;
+ let i32_ref: &i32 = &i32_val;
+
+ let i64_val: i64 = -64;
+ let i64_ref: &i64 = &i64_val;
+
+ let uint_val: usize = 1;
+ let uint_ref: &usize = &uint_val;
+
+ let u8_val: u8 = 100;
+ let u8_ref: &u8 = &u8_val;
+
+ let u16_val: u16 = 16;
+ let u16_ref: &u16 = &u16_val;
+
+ let u32_val: u32 = 32;
+ let u32_ref: &u32 = &u32_val;
+
+ let u64_val: u64 = 64;
+ let u64_ref: &u64 = &u64_val;
+
+ let f32_val: f32 = 2.5;
+ let f32_ref: &f32 = &f32_val;
+
+ let f64_val: f64 = 3.5;
+ let f64_ref: &f64 = &f64_val;
+
+ zzz(); // #break
+}
+
+fn zzz() {()}
diff --git a/src/test/debuginfo/borrowed-c-style-enum.rs b/src/test/debuginfo/borrowed-c-style-enum.rs
new file mode 100644
index 000000000..f212ff395
--- /dev/null
+++ b/src/test/debuginfo/borrowed-c-style-enum.rs
@@ -0,0 +1,56 @@
+// compile-flags:-g
+// min-lldb-version: 310
+
+// === GDB TESTS ===================================================================================
+
+// gdb-command:run
+
+// gdb-command:print *the_a_ref
+// gdbg-check:$1 = TheA
+// gdbr-check:$1 = borrowed_c_style_enum::ABC::TheA
+
+// gdb-command:print *the_b_ref
+// gdbg-check:$2 = TheB
+// gdbr-check:$2 = borrowed_c_style_enum::ABC::TheB
+
+// gdb-command:print *the_c_ref
+// gdbg-check:$3 = TheC
+// gdbr-check:$3 = borrowed_c_style_enum::ABC::TheC
+
+
+// === LLDB TESTS ==================================================================================
+
+// lldb-command:run
+
+// lldb-command:print *the_a_ref
+// lldbg-check:[...]$0 = TheA
+// lldbr-check:(borrowed_c_style_enum::ABC) *the_a_ref = borrowed_c_style_enum::ABC::TheA
+
+// lldb-command:print *the_b_ref
+// lldbg-check:[...]$1 = TheB
+// lldbr-check:(borrowed_c_style_enum::ABC) *the_b_ref = borrowed_c_style_enum::ABC::TheB
+
+// lldb-command:print *the_c_ref
+// lldbg-check:[...]$2 = TheC
+// lldbr-check:(borrowed_c_style_enum::ABC) *the_c_ref = borrowed_c_style_enum::ABC::TheC
+
+#![allow(unused_variables)]
+#![feature(omit_gdb_pretty_printer_section)]
+#![omit_gdb_pretty_printer_section]
+
+enum ABC { TheA, TheB, TheC }
+
+fn main() {
+ let the_a = ABC::TheA;
+ let the_a_ref: &ABC = &the_a;
+
+ let the_b = ABC::TheB;
+ let the_b_ref: &ABC = &the_b;
+
+ let the_c = ABC::TheC;
+ let the_c_ref: &ABC = &the_c;
+
+ zzz(); // #break
+}
+
+fn zzz() {()}
diff --git a/src/test/debuginfo/borrowed-enum.rs b/src/test/debuginfo/borrowed-enum.rs
new file mode 100644
index 000000000..f3e465dc6
--- /dev/null
+++ b/src/test/debuginfo/borrowed-enum.rs
@@ -0,0 +1,71 @@
+// Require a gdb or lldb that can read DW_TAG_variant_part.
+// min-gdb-version: 8.2
+// rust-lldb
+
+// compile-flags:-g
+
+// === GDB TESTS ===================================================================================
+
+// gdb-command:run
+
+// gdb-command:print *the_a_ref
+// gdbr-check:$1 = borrowed_enum::ABC::TheA{x: 0, y: 8970181431921507452}
+
+// gdb-command:print *the_b_ref
+// gdbr-check:$2 = borrowed_enum::ABC::TheB(0, 286331153, 286331153)
+
+// gdb-command:print *univariant_ref
+// gdbr-check:$3 = borrowed_enum::Univariant::TheOnlyCase(4820353753753434)
+
+
+// === LLDB TESTS ==================================================================================
+
+// lldb-command:run
+
+// lldb-command:print *the_a_ref
+// lldbr-check:(borrowed_enum::ABC::TheA) *the_a_ref = TheA { TheA: 0, TheB: 8970181431921507452 }
+// lldb-command:print *the_b_ref
+// lldbr-check:(borrowed_enum::ABC::TheB) *the_b_ref = { = 0 = 286331153 = 286331153 }
+// lldb-command:print *univariant_ref
+// lldbr-check:(borrowed_enum::Univariant) *univariant_ref = { TheOnlyCase = { = 4820353753753434 } }
+
+#![allow(unused_variables)]
+#![feature(omit_gdb_pretty_printer_section)]
+#![omit_gdb_pretty_printer_section]
+
+// The first element is to ensure proper alignment, irrespective of the machines word size. Since
+// the size of the discriminant value is machine dependent, this has be taken into account when
+// datatype layout should be predictable as in this case.
+enum ABC {
+ TheA { x: i64, y: i64 },
+ TheB (i64, i32, i32),
+}
+
+// This is a special case since it does not have the implicit discriminant field.
+enum Univariant {
+ TheOnlyCase(i64)
+}
+
+fn main() {
+
+ // 0b0111110001111100011111000111110001111100011111000111110001111100 = 8970181431921507452
+ // 0b01111100011111000111110001111100 = 2088533116
+ // 0b0111110001111100 = 31868
+ // 0b01111100 = 124
+ let the_a = ABC::TheA { x: 0, y: 8970181431921507452 };
+ let the_a_ref: &ABC = &the_a;
+
+ // 0b0001000100010001000100010001000100010001000100010001000100010001 = 1229782938247303441
+ // 0b00010001000100010001000100010001 = 286331153
+ // 0b0001000100010001 = 4369
+ // 0b00010001 = 17
+ let the_b = ABC::TheB (0, 286331153, 286331153);
+ let the_b_ref: &ABC = &the_b;
+
+ let univariant = Univariant::TheOnlyCase(4820353753753434);
+ let univariant_ref: &Univariant = &univariant;
+
+ zzz(); // #break
+}
+
+fn zzz() {()}
diff --git a/src/test/debuginfo/borrowed-struct.rs b/src/test/debuginfo/borrowed-struct.rs
new file mode 100644
index 000000000..fe945266b
--- /dev/null
+++ b/src/test/debuginfo/borrowed-struct.rs
@@ -0,0 +1,89 @@
+// compile-flags:-g
+// min-lldb-version: 310
+
+// === GDB TESTS ===================================================================================
+
+// gdb-command:run
+
+// gdb-command:print *stack_val_ref
+// gdbg-check:$1 = {x = 10, y = 23.5}
+// gdbr-check:$1 = borrowed_struct::SomeStruct {x: 10, y: 23.5}
+
+// gdb-command:print *stack_val_interior_ref_1
+// gdb-check:$2 = 10
+
+// gdb-command:print *stack_val_interior_ref_2
+// gdb-check:$3 = 23.5
+
+// gdb-command:print *ref_to_unnamed
+// gdbg-check:$4 = {x = 11, y = 24.5}
+// gdbr-check:$4 = borrowed_struct::SomeStruct {x: 11, y: 24.5}
+
+// gdb-command:print *unique_val_ref
+// gdbg-check:$5 = {x = 13, y = 26.5}
+// gdbr-check:$5 = borrowed_struct::SomeStruct {x: 13, y: 26.5}
+
+// gdb-command:print *unique_val_interior_ref_1
+// gdb-check:$6 = 13
+
+// gdb-command:print *unique_val_interior_ref_2
+// gdb-check:$7 = 26.5
+
+
+// === LLDB TESTS ==================================================================================
+
+// lldb-command:run
+
+// lldb-command:print *stack_val_ref
+// lldbg-check:[...]$0 = { x = 10 y = 23.5 }
+// lldbr-check:(borrowed_struct::SomeStruct) *stack_val_ref = (x = 10, y = 23.5)
+
+// lldb-command:print *stack_val_interior_ref_1
+// lldbg-check:[...]$1 = 10
+// lldbr-check:(isize) *stack_val_interior_ref_1 = 10
+
+// lldb-command:print *stack_val_interior_ref_2
+// lldbg-check:[...]$2 = 23.5
+// lldbr-check:(f64) *stack_val_interior_ref_2 = 23.5
+
+// lldb-command:print *ref_to_unnamed
+// lldbg-check:[...]$3 = { x = 11 y = 24.5 }
+// lldbr-check:(borrowed_struct::SomeStruct) *ref_to_unnamed = (x = 11, y = 24.5)
+
+// lldb-command:print *unique_val_ref
+// lldbg-check:[...]$4 = { x = 13 y = 26.5 }
+// lldbr-check:(borrowed_struct::SomeStruct) *unique_val_ref = (x = 13, y = 26.5)
+
+// lldb-command:print *unique_val_interior_ref_1
+// lldbg-check:[...]$5 = 13
+// lldbr-check:(isize) *unique_val_interior_ref_1 = 13
+
+// lldb-command:print *unique_val_interior_ref_2
+// lldbg-check:[...]$6 = 26.5
+// lldbr-check:(f64) *unique_val_interior_ref_2 = 26.5
+
+#![allow(unused_variables)]
+#![feature(omit_gdb_pretty_printer_section)]
+#![omit_gdb_pretty_printer_section]
+
+struct SomeStruct {
+ x: isize,
+ y: f64
+}
+
+fn main() {
+ let stack_val: SomeStruct = SomeStruct { x: 10, y: 23.5 };
+ let stack_val_ref: &SomeStruct = &stack_val;
+ let stack_val_interior_ref_1: &isize = &stack_val.x;
+ let stack_val_interior_ref_2: &f64 = &stack_val.y;
+ let ref_to_unnamed: &SomeStruct = &SomeStruct { x: 11, y: 24.5 };
+
+ let unique_val: Box<_> = Box::new(SomeStruct { x: 13, y: 26.5 });
+ let unique_val_ref: &SomeStruct = &*unique_val;
+ let unique_val_interior_ref_1: &isize = &unique_val.x;
+ let unique_val_interior_ref_2: &f64 = &unique_val.y;
+
+ zzz(); // #break
+}
+
+fn zzz() {()}
diff --git a/src/test/debuginfo/borrowed-tuple.rs b/src/test/debuginfo/borrowed-tuple.rs
new file mode 100644
index 000000000..cc28e49c4
--- /dev/null
+++ b/src/test/debuginfo/borrowed-tuple.rs
@@ -0,0 +1,54 @@
+// min-lldb-version: 310
+
+// compile-flags:-g
+
+// === GDB TESTS ===================================================================================
+
+// gdb-command:run
+
+// gdb-command:print *stack_val_ref
+// gdbg-check:$1 = {__0 = -14, __1 = -19}
+// gdbr-check:$1 = (-14, -19)
+
+// gdb-command:print *ref_to_unnamed
+// gdbg-check:$2 = {__0 = -15, __1 = -20}
+// gdbr-check:$2 = (-15, -20)
+
+// gdb-command:print *unique_val_ref
+// gdbg-check:$3 = {__0 = -17, __1 = -22}
+// gdbr-check:$3 = (-17, -22)
+
+
+// === LLDB TESTS ==================================================================================
+
+// lldb-command:run
+
+// lldb-command:print *stack_val_ref
+// lldbg-check:[...]$0 = { 0 = -14 1 = -19 }
+// lldbr-check:((i16, f32)) *stack_val_ref = { 0 = -14 1 = -19 }
+
+// lldb-command:print *ref_to_unnamed
+// lldbg-check:[...]$1 = { 0 = -15 1 = -20 }
+// lldbr-check:((i16, f32)) *ref_to_unnamed = { 0 = -15 1 = -20 }
+
+// lldb-command:print *unique_val_ref
+// lldbg-check:[...]$2 = { 0 = -17 1 = -22 }
+// lldbr-check:((i16, f32)) *unique_val_ref = { 0 = -17 1 = -22 }
+
+
+#![allow(unused_variables)]
+#![feature(omit_gdb_pretty_printer_section)]
+#![omit_gdb_pretty_printer_section]
+
+fn main() {
+ let stack_val: (i16, f32) = (-14, -19f32);
+ let stack_val_ref: &(i16, f32) = &stack_val;
+ let ref_to_unnamed: &(i16, f32) = &(-15, -20f32);
+
+ let unique_val: Box<(i16, f32)> = Box::new((-17, -22f32));
+ let unique_val_ref: &(i16, f32) = &*unique_val;
+
+ zzz(); // #break
+}
+
+fn zzz() {()}
diff --git a/src/test/debuginfo/borrowed-unique-basic.rs b/src/test/debuginfo/borrowed-unique-basic.rs
new file mode 100644
index 000000000..94229bf27
--- /dev/null
+++ b/src/test/debuginfo/borrowed-unique-basic.rs
@@ -0,0 +1,164 @@
+// min-lldb-version: 310
+
+// compile-flags:-g
+
+// === GDB TESTS ===================================================================================
+
+// gdb-command:run
+
+// gdb-command:print *bool_ref
+// gdb-check:$1 = true
+
+// gdb-command:print *int_ref
+// gdb-check:$2 = -1
+
+// gdb-command:print/d *char_ref
+// gdb-check:$3 = 97
+
+// gdb-command:print/d *i8_ref
+// gdb-check:$4 = 68
+
+// gdb-command:print *i16_ref
+// gdb-check:$5 = -16
+
+// gdb-command:print *i32_ref
+// gdb-check:$6 = -32
+
+// gdb-command:print *i64_ref
+// gdb-check:$7 = -64
+
+// gdb-command:print *uint_ref
+// gdb-check:$8 = 1
+
+// gdb-command:print/d *u8_ref
+// gdb-check:$9 = 100
+
+// gdb-command:print *u16_ref
+// gdb-check:$10 = 16
+
+// gdb-command:print *u32_ref
+// gdb-check:$11 = 32
+
+// gdb-command:print *u64_ref
+// gdb-check:$12 = 64
+
+// gdb-command:print *f32_ref
+// gdb-check:$13 = 2.5
+
+// gdb-command:print *f64_ref
+// gdb-check:$14 = 3.5
+
+
+// === LLDB TESTS ==================================================================================
+
+// lldb-command:type format add -f decimal char
+// lldb-command:type format add -f decimal 'unsigned char'
+// lldb-command:run
+
+// lldb-command:print *bool_ref
+// lldbg-check:[...]$0 = true
+// lldbr-check:(bool) *bool_ref = true
+
+// lldb-command:print *int_ref
+// lldbg-check:[...]$1 = -1
+// lldbr-check:(isize) *int_ref = -1
+
+// NOTE: only rust-enabled lldb supports 32bit chars
+// lldbr-command:print *char_ref
+// lldbr-check:(char) *char_ref = 97
+
+// lldb-command:print *i8_ref
+// lldbg-check:[...]$2 = 68
+// lldbr-check:(i8) *i8_ref = 68
+
+// lldb-command:print *i16_ref
+// lldbg-check:[...]$3 = -16
+// lldbr-check:(i16) *i16_ref = -16
+
+// lldb-command:print *i32_ref
+// lldbg-check:[...]$4 = -32
+// lldbr-check:(i32) *i32_ref = -32
+
+// lldb-command:print *i64_ref
+// lldbg-check:[...]$5 = -64
+// lldbr-check:(i64) *i64_ref = -64
+
+// lldb-command:print *uint_ref
+// lldbg-check:[...]$6 = 1
+// lldbr-check:(usize) *uint_ref = 1
+
+// lldb-command:print *u8_ref
+// lldbg-check:[...]$7 = 100
+// lldbr-check:(u8) *u8_ref = 100
+
+// lldb-command:print *u16_ref
+// lldbg-check:[...]$8 = 16
+// lldbr-check:(u16) *u16_ref = 16
+
+// lldb-command:print *u32_ref
+// lldbg-check:[...]$9 = 32
+// lldbr-check:(u32) *u32_ref = 32
+
+// lldb-command:print *u64_ref
+// lldbg-check:[...]$10 = 64
+// lldbr-check:(u64) *u64_ref = 64
+
+// lldb-command:print *f32_ref
+// lldbg-check:[...]$11 = 2.5
+// lldbr-check:(f32) *f32_ref = 2.5
+
+// lldb-command:print *f64_ref
+// lldbg-check:[...]$12 = 3.5
+// lldbr-check:(f64) *f64_ref = 3.5
+
+#![allow(unused_variables)]
+#![feature(omit_gdb_pretty_printer_section)]
+#![omit_gdb_pretty_printer_section]
+
+fn main() {
+ let bool_box: Box<bool> = Box::new(true);
+ let bool_ref: &bool = &*bool_box;
+
+ let int_box: Box<isize> = Box::new(-1);
+ let int_ref: &isize = &*int_box;
+
+ let char_box: Box<char> = Box::new('a');
+ let char_ref: &char = &*char_box;
+
+ let i8_box: Box<i8> = Box::new(68);
+ let i8_ref: &i8 = &*i8_box;
+
+ let i16_box: Box<i16> = Box::new(-16);
+ let i16_ref: &i16 = &*i16_box;
+
+ let i32_box: Box<i32> = Box::new(-32);
+ let i32_ref: &i32 = &*i32_box;
+
+ let i64_box: Box<i64> = Box::new(-64);
+ let i64_ref: &i64 = &*i64_box;
+
+ let uint_box: Box<usize> = Box::new(1);
+ let uint_ref: &usize = &*uint_box;
+
+ let u8_box: Box<u8> = Box::new(100);
+ let u8_ref: &u8 = &*u8_box;
+
+ let u16_box: Box<u16> = Box::new(16);
+ let u16_ref: &u16 = &*u16_box;
+
+ let u32_box: Box<u32> = Box::new(32);
+ let u32_ref: &u32 = &*u32_box;
+
+ let u64_box: Box<u64> = Box::new(64);
+ let u64_ref: &u64 = &*u64_box;
+
+ let f32_box: Box<f32> = Box::new(2.5);
+ let f32_ref: &f32 = &*f32_box;
+
+ let f64_box: Box<f64> = Box::new(3.5);
+ let f64_ref: &f64 = &*f64_box;
+
+ zzz(); // #break
+}
+
+fn zzz() {()}
diff --git a/src/test/debuginfo/box.rs b/src/test/debuginfo/box.rs
new file mode 100644
index 000000000..3713c8c13
--- /dev/null
+++ b/src/test/debuginfo/box.rs
@@ -0,0 +1,37 @@
+// min-lldb-version: 310
+
+// compile-flags:-g
+
+// === GDB TESTS ===================================================================================
+
+// gdb-command:run
+
+// gdb-command:print *a
+// gdb-check:$1 = 1
+// gdb-command:print *b
+// gdbg-check:$2 = {__0 = 2, __1 = 3.5}
+// gdbr-check:$2 = (2, 3.5)
+
+
+// === LLDB TESTS ==================================================================================
+
+// lldb-command:run
+// lldb-command:print *a
+// lldbg-check:[...]$0 = 1
+// lldbr-check:(i32) *a = 1
+// lldb-command:print *b
+// lldbg-check:[...]$1 = { 0 = 2 1 = 3.5 }
+// lldbr-check:((i32, f64)) *b = { 0 = 2 1 = 3.5 }
+
+#![allow(unused_variables)]
+#![feature(omit_gdb_pretty_printer_section)]
+#![omit_gdb_pretty_printer_section]
+
+fn main() {
+ let a = Box::new(1);
+ let b = Box::new((2, 3.5f64));
+
+ zzz(); // #break
+}
+
+fn zzz() { () }
diff --git a/src/test/debuginfo/boxed-struct.rs b/src/test/debuginfo/boxed-struct.rs
new file mode 100644
index 000000000..64bc12475
--- /dev/null
+++ b/src/test/debuginfo/boxed-struct.rs
@@ -0,0 +1,70 @@
+// min-lldb-version: 310
+
+// compile-flags:-g
+
+// === GDB TESTS ===================================================================================
+
+// gdb-command:run
+
+// gdb-command:print *boxed_with_padding
+// gdbg-check:$1 = {x = 99, y = 999, z = 9999, w = 99999}
+// gdbr-check:$1 = boxed_struct::StructWithSomePadding {x: 99, y: 999, z: 9999, w: 99999}
+
+// gdb-command:print *boxed_with_dtor
+// gdbg-check:$2 = {x = 77, y = 777, z = 7777, w = 77777}
+// gdbr-check:$2 = boxed_struct::StructWithDestructor {x: 77, y: 777, z: 7777, w: 77777}
+
+
+// === LLDB TESTS ==================================================================================
+
+// lldb-command:run
+
+// lldb-command:print *boxed_with_padding
+// lldbg-check:[...]$0 = { x = 99 y = 999 z = 9999 w = 99999 }
+// lldbr-check:(boxed_struct::StructWithSomePadding) *boxed_with_padding = { x = 99 y = 999 z = 9999 w = 99999 }
+
+// lldb-command:print *boxed_with_dtor
+// lldbg-check:[...]$1 = { x = 77 y = 777 z = 7777 w = 77777 }
+// lldbr-check:(boxed_struct::StructWithDestructor) *boxed_with_dtor = { x = 77 y = 777 z = 7777 w = 77777 }
+
+#![allow(unused_variables)]
+#![feature(omit_gdb_pretty_printer_section)]
+#![omit_gdb_pretty_printer_section]
+
+struct StructWithSomePadding {
+ x: i16,
+ y: i32,
+ z: i32,
+ w: i64
+}
+
+struct StructWithDestructor {
+ x: i16,
+ y: i32,
+ z: i32,
+ w: i64
+}
+
+impl Drop for StructWithDestructor {
+ fn drop(&mut self) {}
+}
+
+fn main() {
+
+ let boxed_with_padding: Box<_> = Box::new(StructWithSomePadding {
+ x: 99,
+ y: 999,
+ z: 9999,
+ w: 99999,
+ });
+
+ let boxed_with_dtor: Box<_> = Box::new(StructWithDestructor {
+ x: 77,
+ y: 777,
+ z: 7777,
+ w: 77777,
+ });
+ zzz(); // #break
+}
+
+fn zzz() { () }
diff --git a/src/test/debuginfo/by-value-non-immediate-argument.rs b/src/test/debuginfo/by-value-non-immediate-argument.rs
new file mode 100644
index 000000000..b417567dc
--- /dev/null
+++ b/src/test/debuginfo/by-value-non-immediate-argument.rs
@@ -0,0 +1,126 @@
+// ignore-test // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155
+// min-lldb-version: 310
+
+// compile-flags:-g
+
+// === GDB TESTS ===================================================================================
+
+// gdb-command:run
+
+// gdb-command:print s
+// gdbg-check:$1 = {a = 1, b = 2.5}
+// gdbr-check:$1 = by_value_non_immediate_argument::Struct {a: 1, b: 2.5}
+// gdb-command:continue
+
+// gdb-command:print x
+// gdbg-check:$2 = {a = 3, b = 4.5}
+// gdbr-check:$2 = by_value_non_immediate_argument::Struct {a: 3, b: 4.5}
+// gdb-command:print y
+// gdb-check:$3 = 5
+// gdb-command:print z
+// gdb-check:$4 = 6.5
+// gdb-command:continue
+
+// gdb-command:print a
+// gdbg-check:$5 = {__0 = 7, __1 = 8, __2 = 9.5, __3 = 10.5}
+// gdbr-check:$5 = (7, 8, 9.5, 10.5)
+// gdb-command:continue
+
+// gdb-command:print a
+// gdbg-check:$6 = {__0 = 11.5, __1 = 12.5, __2 = 13, __3 = 14}
+// gdbr-check:$6 = by_value_non_immediate_argument::Newtype (11.5, 12.5, 13, 14)
+// gdb-command:continue
+
+// gdb-command:print x
+// gdbg-check:$7 = {{RUST$ENUM$DISR = Case1, x = 0, y = 8970181431921507452}, {RUST$ENUM$DISR = Case1, [...]}}
+// gdbr-check:$7 = by_value_non_immediate_argument::Enum::Case1{x: 0, y: 8970181431921507452}
+// gdb-command:continue
+
+
+// === LLDB TESTS ==================================================================================
+
+// lldb-command:run
+
+// lldb-command:print s
+// lldb-check:[...]$0 = Struct { a: 1, b: 2.5 }
+// lldb-command:continue
+
+// lldb-command:print x
+// lldb-check:[...]$1 = Struct { a: 3, b: 4.5 }
+// lldb-command:print y
+// lldb-check:[...]$2 = 5
+// lldb-command:print z
+// lldb-check:[...]$3 = 6.5
+// lldb-command:continue
+
+// lldb-command:print a
+// lldb-check:[...]$4 = (7, 8, 9.5, 10.5)
+// lldb-command:continue
+
+// lldb-command:print a
+// lldb-check:[...]$5 = Newtype(11.5, 12.5, 13, 14)
+// lldb-command:continue
+
+// lldb-command:print x
+// lldb-check:[...]$6 = Case1 { x: 0, y: 8970181431921507452 }
+// lldb-command:continue
+
+#![feature(omit_gdb_pretty_printer_section)]
+#![omit_gdb_pretty_printer_section]
+
+#[derive(Clone)]
+struct Struct {
+ a: isize,
+ b: f64
+}
+
+#[derive(Clone)]
+struct StructStruct {
+ a: Struct,
+ b: Struct
+}
+
+fn fun(s: Struct) {
+ zzz(); // #break
+}
+
+fn fun_fun(StructStruct { a: x, b: Struct { a: y, b: z } }: StructStruct) {
+ zzz(); // #break
+}
+
+fn tup(a: (isize, usize, f64, f64)) {
+ zzz(); // #break
+}
+
+struct Newtype(f64, f64, isize, usize);
+
+fn new_type(a: Newtype) {
+ zzz(); // #break
+}
+
+// The first element is to ensure proper alignment, irrespective of the machines word size. Since
+// the size of the discriminant value is machine dependent, this has be taken into account when
+// datatype layout should be predictable as in this case.
+enum Enum {
+ Case1 { x: i64, y: i64 },
+ Case2 (i64, i32, i32),
+}
+
+fn by_val_enum(x: Enum) {
+ zzz(); // #break
+}
+
+fn main() {
+ fun(Struct { a: 1, b: 2.5 });
+ fun_fun(StructStruct { a: Struct { a: 3, b: 4.5 }, b: Struct { a: 5, b: 6.5 } });
+ tup((7, 8, 9.5, 10.5));
+ new_type(Newtype(11.5, 12.5, 13, 14));
+
+ // 0b0111110001111100011111000111110001111100011111000111110001111100 = 8970181431921507452
+ // 0b01111100011111000111110001111100 = 2088533116
+ // 0b0111110001111100 = 31868
+ // 0b01111100 = 124
+ by_val_enum(Enum::Case1 { x: 0, y: 8970181431921507452 });
+}
+
+fn zzz() { () }
diff --git a/src/test/debuginfo/by-value-self-argument-in-trait-impl.rs b/src/test/debuginfo/by-value-self-argument-in-trait-impl.rs
new file mode 100644
index 000000000..e60cfc924
--- /dev/null
+++ b/src/test/debuginfo/by-value-self-argument-in-trait-impl.rs
@@ -0,0 +1,82 @@
+// min-lldb-version: 310
+
+// compile-flags:-g
+
+// === GDB TESTS ===================================================================================
+
+// gdb-command:run
+
+// gdb-command:print self
+// gdb-check:$1 = 1111
+// gdb-command:continue
+
+// gdb-command:print self
+// gdbg-check:$2 = {x = 2222, y = 3333}
+// gdbr-check:$2 = by_value_self_argument_in_trait_impl::Struct {x: 2222, y: 3333}
+// gdb-command:continue
+
+// gdb-command:print self
+// gdbg-check:$3 = {__0 = 4444.5, __1 = 5555, __2 = 6666, __3 = 7777.5}
+// gdbr-check:$3 = (4444.5, 5555, 6666, 7777.5)
+// gdb-command:continue
+
+
+// === LLDB TESTS ==================================================================================
+
+// lldb-command:run
+
+// lldb-command:print self
+// lldbg-check:[...]$0 = 1111
+// lldbr-check:(isize) self = 1111
+// lldb-command:continue
+
+// lldb-command:print self
+// lldbg-check:[...]$1 = { x = 2222 y = 3333 }
+// lldbr-check:(by_value_self_argument_in_trait_impl::Struct) self = { x = 2222 y = 3333 }
+// lldb-command:continue
+
+// lldb-command:print self
+// lldbg-check:[...] $2 = { 0 = 4444.5 1 = 5555 2 = 6666 3 = 7777.5 }
+// lldbr-check:((f64, isize, isize, f64)) self = { 0 = 4444.5 1 = 5555 2 = 6666 3 = 7777.5 }
+// lldb-command:continue
+
+#![feature(omit_gdb_pretty_printer_section)]
+#![omit_gdb_pretty_printer_section]
+
+trait Trait {
+ fn method(self) -> Self;
+}
+
+impl Trait for isize {
+ fn method(self) -> isize {
+ zzz(); // #break
+ self
+ }
+}
+
+struct Struct {
+ x: usize,
+ y: usize,
+}
+
+impl Trait for Struct {
+ fn method(self) -> Struct {
+ zzz(); // #break
+ self
+ }
+}
+
+impl Trait for (f64, isize, isize, f64) {
+ fn method(self) -> (f64, isize, isize, f64) {
+ zzz(); // #break
+ self
+ }
+}
+
+fn main() {
+ let _ = (1111 as isize).method();
+ let _ = Struct { x: 2222, y: 3333 }.method();
+ let _ = (4444.5, 5555, 6666, 7777.5).method();
+}
+
+fn zzz() { () }
diff --git a/src/test/debuginfo/c-style-enum-in-composite.rs b/src/test/debuginfo/c-style-enum-in-composite.rs
new file mode 100644
index 000000000..2ed49de58
--- /dev/null
+++ b/src/test/debuginfo/c-style-enum-in-composite.rs
@@ -0,0 +1,156 @@
+// min-lldb-version: 310
+
+// compile-flags:-g
+
+// === GDB TESTS ===================================================================================
+
+// gdb-command:run
+
+// gdb-command:print tuple_interior_padding
+// gdbg-check:$1 = {__0 = 0, __1 = OneHundred}
+// gdbr-check:$1 = (0, c_style_enum_in_composite::AnEnum::OneHundred)
+
+// gdb-command:print tuple_padding_at_end
+// gdbg-check:$2 = {__0 = {__0 = 1, __1 = OneThousand}, __1 = 2}
+// gdbr-check:$2 = ((1, c_style_enum_in_composite::AnEnum::OneThousand), 2)
+
+// gdb-command:print tuple_different_enums
+// gdbg-check:$3 = {__0 = OneThousand, __1 = MountainView, __2 = OneMillion, __3 = Vienna}
+// gdbr-check:$3 = (c_style_enum_in_composite::AnEnum::OneThousand, c_style_enum_in_composite::AnotherEnum::MountainView, c_style_enum_in_composite::AnEnum::OneMillion, c_style_enum_in_composite::AnotherEnum::Vienna)
+
+// gdb-command:print padded_struct
+// gdbg-check:$4 = {a = 3, b = OneMillion, c = 4, d = Toronto, e = 5}
+// gdbr-check:$4 = c_style_enum_in_composite::PaddedStruct {a: 3, b: c_style_enum_in_composite::AnEnum::OneMillion, c: 4, d: c_style_enum_in_composite::AnotherEnum::Toronto, e: 5}
+
+// gdb-command:print packed_struct
+// gdbg-check:$5 = {a = 6, b = OneHundred, c = 7, d = Vienna, e = 8}
+// gdbr-check:$5 = c_style_enum_in_composite::PackedStruct {a: 6, b: c_style_enum_in_composite::AnEnum::OneHundred, c: 7, d: c_style_enum_in_composite::AnotherEnum::Vienna, e: 8}
+
+// gdb-command:print non_padded_struct
+// gdbg-check:$6 = {a = OneMillion, b = MountainView, c = OneThousand, d = Toronto}
+// gdbr-check:$6 = c_style_enum_in_composite::NonPaddedStruct {a: c_style_enum_in_composite::AnEnum::OneMillion, b: c_style_enum_in_composite::AnotherEnum::MountainView, c: c_style_enum_in_composite::AnEnum::OneThousand, d: c_style_enum_in_composite::AnotherEnum::Toronto}
+
+// gdb-command:print struct_with_drop
+// gdbg-check:$7 = {__0 = {a = OneHundred, b = Vienna}, __1 = 9}
+// gdbr-check:$7 = (c_style_enum_in_composite::StructWithDrop {a: c_style_enum_in_composite::AnEnum::OneHundred, b: c_style_enum_in_composite::AnotherEnum::Vienna}, 9)
+
+// === LLDB TESTS ==================================================================================
+
+// lldb-command:run
+
+// lldb-command:print tuple_interior_padding
+// lldbg-check:[...]$0 = { 0 = 0 1 = OneHundred }
+// lldbr-check:((i16, c_style_enum_in_composite::AnEnum)) tuple_interior_padding = { 0 = 0 1 = OneHundred }
+
+// lldb-command:print tuple_padding_at_end
+// lldbg-check:[...]$1 = { 0 = { 0 = 1 1 = OneThousand } 1 = 2 }
+// lldbr-check:(((u64, c_style_enum_in_composite::AnEnum), u64)) tuple_padding_at_end = { 0 = { 0 = 1 1 = OneThousand } 1 = 2 }
+
+// lldb-command:print tuple_different_enums
+// lldbg-check:[...]$2 = { 0 = OneThousand 1 = MountainView 2 = OneMillion 3 = Vienna }
+// lldbr-check:((c_style_enum_in_composite::AnEnum, c_style_enum_in_composite::AnotherEnum, c_style_enum_in_composite::AnEnum, c_style_enum_in_composite::AnotherEnum)) tuple_different_enums = { 0 = c_style_enum_in_composite::AnEnum::OneThousand 1 = c_style_enum_in_composite::AnotherEnum::MountainView 2 = c_style_enum_in_composite::AnEnum::OneMillion 3 = c_style_enum_in_composite::AnotherEnum::Vienna }
+
+// lldb-command:print padded_struct
+// lldbg-check:[...]$3 = { a = 3 b = OneMillion c = 4 d = Toronto e = 5 }
+// lldbr-check:(c_style_enum_in_composite::PaddedStruct) padded_struct = { a = 3 b = c_style_enum_in_composite::AnEnum::OneMillion c = 4 d = Toronto e = 5 }
+
+// lldb-command:print packed_struct
+// lldbg-check:[...]$4 = { a = 6 b = OneHundred c = 7 d = Vienna e = 8 }
+// lldbr-check:(c_style_enum_in_composite::PackedStruct) packed_struct = { a = 6 b = c_style_enum_in_composite::AnEnum::OneHundred c = 7 d = Vienna e = 8 }
+
+// lldb-command:print non_padded_struct
+// lldbg-check:[...]$5 = { a = OneMillion b = MountainView c = OneThousand d = Toronto }
+// lldbr-check:(c_style_enum_in_composite::NonPaddedStruct) non_padded_struct = { a = c_style_enum_in_composite::AnEnum::OneMillion, b = c_style_enum_in_composite::AnotherEnum::MountainView, c = c_style_enum_in_composite::AnEnum::OneThousand, d = c_style_enum_in_composite::AnotherEnum::Toronto }
+
+// lldb-command:print struct_with_drop
+// lldbg-check:[...]$6 = { 0 = { a = OneHundred b = Vienna } 1 = 9 }
+// lldbr-check:((c_style_enum_in_composite::StructWithDrop, i64)) struct_with_drop = { 0 = { a = c_style_enum_in_composite::AnEnum::OneHundred b = c_style_enum_in_composite::AnotherEnum::Vienna } 1 = 9 }
+
+#![allow(unused_variables)]
+#![feature(omit_gdb_pretty_printer_section)]
+#![omit_gdb_pretty_printer_section]
+
+use self::AnEnum::{OneHundred, OneThousand, OneMillion};
+use self::AnotherEnum::{MountainView, Toronto, Vienna};
+
+enum AnEnum {
+ OneHundred = 100,
+ OneThousand = 1000,
+ OneMillion = 1000000
+}
+
+enum AnotherEnum {
+ MountainView,
+ Toronto,
+ Vienna
+}
+
+struct PaddedStruct {
+ a: i16,
+ b: AnEnum,
+ c: i16,
+ d: AnotherEnum,
+ e: i16
+}
+
+#[repr(packed)]
+struct PackedStruct {
+ a: i16,
+ b: AnEnum,
+ c: i16,
+ d: AnotherEnum,
+ e: i16
+}
+
+struct NonPaddedStruct {
+ a: AnEnum,
+ b: AnotherEnum,
+ c: AnEnum,
+ d: AnotherEnum
+}
+
+struct StructWithDrop {
+ a: AnEnum,
+ b: AnotherEnum
+}
+
+impl Drop for StructWithDrop {
+ fn drop(&mut self) {()}
+}
+
+fn main() {
+
+ let tuple_interior_padding = (0_i16, OneHundred);
+ // It will depend on the machine architecture if any padding is actually involved here
+ let tuple_padding_at_end = ((1_u64, OneThousand), 2_u64);
+ let tuple_different_enums = (OneThousand, MountainView, OneMillion, Vienna);
+
+ let padded_struct = PaddedStruct {
+ a: 3,
+ b: OneMillion,
+ c: 4,
+ d: Toronto,
+ e: 5
+ };
+
+ let packed_struct = PackedStruct {
+ a: 6,
+ b: OneHundred,
+ c: 7,
+ d: Vienna,
+ e: 8
+ };
+
+ let non_padded_struct = NonPaddedStruct {
+ a: OneMillion,
+ b: MountainView,
+ c: OneThousand,
+ d: Toronto
+ };
+
+ let struct_with_drop = (StructWithDrop { a: OneHundred, b: Vienna }, 9_i64);
+
+ zzz(); // #break
+}
+
+fn zzz() { () }
diff --git a/src/test/debuginfo/c-style-enum.rs b/src/test/debuginfo/c-style-enum.rs
new file mode 100644
index 000000000..dce34fc0d
--- /dev/null
+++ b/src/test/debuginfo/c-style-enum.rs
@@ -0,0 +1,194 @@
+// ignore-aarch64
+// ignore-gdb // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155
+// min-lldb-version: 310
+
+// compile-flags:-g
+
+// === GDB TESTS ===================================================================================
+
+// gdbg-command:print 'c_style_enum::SINGLE_VARIANT'
+// gdbr-command:print c_style_enum::SINGLE_VARIANT
+// gdbg-check:$1 = TheOnlyVariant
+// gdbr-check:$1 = c_style_enum::SingleVariant::TheOnlyVariant
+
+// gdbg-command:print 'c_style_enum::AUTO_ONE'
+// gdbr-command:print c_style_enum::AUTO_ONE
+// gdbg-check:$2 = One
+// gdbr-check:$2 = c_style_enum::AutoDiscriminant::One
+
+// gdbg-command:print 'c_style_enum::AUTO_TWO'
+// gdbr-command:print c_style_enum::AUTO_TWO
+// gdbg-check:$3 = One
+// gdbr-check:$3 = c_style_enum::AutoDiscriminant::One
+
+// gdbg-command:print 'c_style_enum::AUTO_THREE'
+// gdbr-command:print c_style_enum::AUTO_THREE
+// gdbg-check:$4 = One
+// gdbr-check:$4 = c_style_enum::AutoDiscriminant::One
+
+// gdbg-command:print 'c_style_enum::MANUAL_ONE'
+// gdbr-command:print c_style_enum::MANUAL_ONE
+// gdbg-check:$5 = OneHundred
+// gdbr-check:$5 = c_style_enum::ManualDiscriminant::OneHundred
+
+// gdbg-command:print 'c_style_enum::MANUAL_TWO'
+// gdbr-command:print c_style_enum::MANUAL_TWO
+// gdbg-check:$6 = OneHundred
+// gdbr-check:$6 = c_style_enum::ManualDiscriminant::OneHundred
+
+// gdbg-command:print 'c_style_enum::MANUAL_THREE'
+// gdbr-command:print c_style_enum::MANUAL_THREE
+// gdbg-check:$7 = OneHundred
+// gdbr-check:$7 = c_style_enum::ManualDiscriminant::OneHundred
+
+// gdb-command:run
+
+// gdb-command:print auto_one
+// gdbg-check:$8 = One
+// gdbr-check:$8 = c_style_enum::AutoDiscriminant::One
+
+// gdb-command:print auto_two
+// gdbg-check:$9 = Two
+// gdbr-check:$9 = c_style_enum::AutoDiscriminant::Two
+
+// gdb-command:print auto_three
+// gdbg-check:$10 = Three
+// gdbr-check:$10 = c_style_enum::AutoDiscriminant::Three
+
+// gdb-command:print manual_one_hundred
+// gdbg-check:$11 = OneHundred
+// gdbr-check:$11 = c_style_enum::ManualDiscriminant::OneHundred
+
+// gdb-command:print manual_one_thousand
+// gdbg-check:$12 = OneThousand
+// gdbr-check:$12 = c_style_enum::ManualDiscriminant::OneThousand
+
+// gdb-command:print manual_one_million
+// gdbg-check:$13 = OneMillion
+// gdbr-check:$13 = c_style_enum::ManualDiscriminant::OneMillion
+
+// gdb-command:print single_variant
+// gdbg-check:$14 = TheOnlyVariant
+// gdbr-check:$14 = c_style_enum::SingleVariant::TheOnlyVariant
+
+// gdbg-command:print 'c_style_enum::AUTO_TWO'
+// gdbr-command:print AUTO_TWO
+// gdbg-check:$15 = Two
+// gdbr-check:$15 = c_style_enum::AutoDiscriminant::Two
+
+// gdbg-command:print 'c_style_enum::AUTO_THREE'
+// gdbr-command:print AUTO_THREE
+// gdbg-check:$16 = Three
+// gdbr-check:$16 = c_style_enum::AutoDiscriminant::Three
+
+// gdbg-command:print 'c_style_enum::MANUAL_TWO'
+// gdbr-command:print MANUAL_TWO
+// gdbg-check:$17 = OneThousand
+// gdbr-check:$17 = c_style_enum::ManualDiscriminant::OneThousand
+
+// gdbg-command:print 'c_style_enum::MANUAL_THREE'
+// gdbr-command:print MANUAL_THREE
+// gdbg-check:$18 = OneMillion
+// gdbr-check:$18 = c_style_enum::ManualDiscriminant::OneMillion
+
+
+// === LLDB TESTS ==================================================================================
+
+// lldb-command:run
+
+// lldb-command:print auto_one
+// lldbg-check:[...]$0 = One
+// lldbr-check:(c_style_enum::AutoDiscriminant) auto_one = c_style_enum::AutoDiscriminant::One
+
+// lldb-command:print auto_two
+// lldbg-check:[...]$1 = Two
+// lldbr-check:(c_style_enum::AutoDiscriminant) auto_two = c_style_enum::AutoDiscriminant::Two
+
+// lldb-command:print auto_three
+// lldbg-check:[...]$2 = Three
+// lldbr-check:(c_style_enum::AutoDiscriminant) auto_three = c_style_enum::AutoDiscriminant::Three
+
+// lldb-command:print manual_one_hundred
+// lldbg-check:[...]$3 = OneHundred
+// lldbr-check:(c_style_enum::ManualDiscriminant) manual_one_hundred = c_style_enum::ManualDiscriminant::OneHundred
+
+// lldb-command:print manual_one_thousand
+// lldbg-check:[...]$4 = OneThousand
+// lldbr-check:(c_style_enum::ManualDiscriminant) manual_one_thousand = c_style_enum::ManualDiscriminant::OneThousand
+
+// lldb-command:print manual_one_million
+// lldbg-check:[...]$5 = OneMillion
+// lldbr-check:(c_style_enum::ManualDiscriminant) manual_one_million = c_style_enum::ManualDiscriminant::OneMillion
+
+// lldb-command:print single_variant
+// lldbg-check:[...]$6 = TheOnlyVariant
+// lldbr-check:(c_style_enum::SingleVariant) single_variant = c_style_enum::SingleVariant::TheOnlyVariant
+
+#![allow(unused_variables)]
+#![allow(dead_code)]
+#![feature(omit_gdb_pretty_printer_section)]
+#![omit_gdb_pretty_printer_section]
+
+use self::AutoDiscriminant::{One, Two, Three};
+use self::ManualDiscriminant::{OneHundred, OneThousand, OneMillion};
+use self::SingleVariant::TheOnlyVariant;
+
+#[derive(Copy, Clone)]
+enum AutoDiscriminant {
+ One,
+ Two,
+ Three
+}
+
+#[derive(Copy, Clone)]
+enum ManualDiscriminant {
+ OneHundred = 100,
+ OneThousand = 1000,
+ OneMillion = 1000000
+}
+
+#[derive(Copy, Clone)]
+#[repr(u8)]
+enum SingleVariant {
+ TheOnlyVariant
+}
+
+static SINGLE_VARIANT: SingleVariant = TheOnlyVariant;
+
+static mut AUTO_ONE: AutoDiscriminant = One;
+static mut AUTO_TWO: AutoDiscriminant = One;
+static mut AUTO_THREE: AutoDiscriminant = One;
+
+static mut MANUAL_ONE: ManualDiscriminant = OneHundred;
+static mut MANUAL_TWO: ManualDiscriminant = OneHundred;
+static mut MANUAL_THREE: ManualDiscriminant = OneHundred;
+
+fn main() {
+
+ let auto_one = One;
+ let auto_two = Two;
+ let auto_three = Three;
+
+ let manual_one_hundred = OneHundred;
+ let manual_one_thousand = OneThousand;
+ let manual_one_million = OneMillion;
+
+ let single_variant = TheOnlyVariant;
+
+ unsafe {
+ AUTO_TWO = Two;
+ AUTO_THREE = Three;
+
+ MANUAL_TWO = OneThousand;
+ MANUAL_THREE = OneMillion;
+ };
+
+ zzz(); // #break
+
+ // Borrow to avoid an eager load of the constant value in the static.
+ let a = &SINGLE_VARIANT;
+ let a = unsafe { AUTO_ONE };
+ let a = unsafe { MANUAL_ONE };
+}
+
+fn zzz() { () }
diff --git a/src/test/debuginfo/captured-fields-1.rs b/src/test/debuginfo/captured-fields-1.rs
new file mode 100644
index 000000000..afbf942d4
--- /dev/null
+++ b/src/test/debuginfo/captured-fields-1.rs
@@ -0,0 +1,96 @@
+// compile-flags:-g
+
+// === GDB TESTS ===================================================================================
+
+// gdb-command:run
+// gdb-command:print test
+// gdbr-check:$1 = captured_fields_1::main::{closure_env#0} {_ref__my_ref__my_field1: 0x[...]}
+// gdb-command:continue
+// gdb-command:print test
+// gdbr-check:$2 = captured_fields_1::main::{closure_env#1} {_ref__my_ref__my_field2: 0x[...]}
+// gdb-command:continue
+// gdb-command:print test
+// gdbr-check:$3 = captured_fields_1::main::{closure_env#2} {_ref__my_ref: 0x[...]}
+// gdb-command:continue
+// gdb-command:print test
+// gdbr-check:$4 = captured_fields_1::main::{closure_env#3} {my_ref: 0x[...]}
+// gdb-command:continue
+// gdb-command:print test
+// gdbr-check:$5 = captured_fields_1::main::{closure_env#4} {my_var__my_field2: 22}
+// gdb-command:continue
+// gdb-command:print test
+// gdbr-check:$6 = captured_fields_1::main::{closure_env#5} {my_var: captured_fields_1::MyStruct {my_field1: 11, my_field2: 22}}
+// gdb-command:continue
+
+// === LLDB TESTS ==================================================================================
+
+// lldb-command:run
+// lldb-command:print test
+// lldbg-check:(captured_fields_1::main::{closure_env#0}) $0 = { _ref__my_ref__my_field1 = 0x[...] }
+// lldb-command:continue
+// lldb-command:print test
+// lldbg-check:(captured_fields_1::main::{closure_env#1}) $1 = { _ref__my_ref__my_field2 = 0x[...] }
+// lldb-command:continue
+// lldb-command:print test
+// lldbg-check:(captured_fields_1::main::{closure_env#2}) $2 = { _ref__my_ref = 0x[...] }
+// lldb-command:continue
+// lldb-command:print test
+// lldbg-check:(captured_fields_1::main::{closure_env#3}) $3 = { my_ref = 0x[...] }
+// lldb-command:continue
+// lldb-command:print test
+// lldbg-check:(captured_fields_1::main::{closure_env#4}) $4 = { my_var__my_field2 = 22 }
+// lldb-command:continue
+// lldb-command:print test
+// lldbg-check:(captured_fields_1::main::{closure_env#5}) $5 = { my_var = { my_field1 = 11 my_field2 = 22 } }
+// lldb-command:continue
+
+#![feature(capture_disjoint_fields)]
+#![allow(unused)]
+
+struct MyStruct {
+ my_field1: u32,
+ my_field2: u32,
+}
+
+fn main() {
+ let mut my_var = MyStruct { my_field1: 11, my_field2: 22 };
+ let my_ref = &mut my_var;
+
+ let test = || {
+ let a = &mut my_ref.my_field1;
+ };
+
+ _zzz(); // #break
+
+ let test = || {
+ let a = &my_ref.my_field2;
+ };
+
+ _zzz(); // #break
+
+ let test = || {
+ let a = &my_ref;
+ };
+
+ _zzz(); // #break
+
+ let test = || {
+ let a = my_ref;
+ };
+
+ _zzz(); // #break
+
+ let test = move || {
+ let a = my_var.my_field2;
+ };
+
+ _zzz(); // #break
+
+ let test = || {
+ let a = my_var;
+ };
+
+ _zzz(); // #break
+}
+
+fn _zzz() {}
diff --git a/src/test/debuginfo/captured-fields-2.rs b/src/test/debuginfo/captured-fields-2.rs
new file mode 100644
index 000000000..c872354a9
--- /dev/null
+++ b/src/test/debuginfo/captured-fields-2.rs
@@ -0,0 +1,55 @@
+// compile-flags:-g
+
+// === GDB TESTS ===================================================================================
+
+// gdb-command:run
+// gdb-command:print my_ref__my_field1
+// gdbr-check:$1 = 11
+// gdb-command:continue
+// gdb-command:print my_var__my_field2
+// gdbr-check:$2 = 22
+// gdb-command:continue
+
+// === LLDB TESTS ==================================================================================
+
+// lldb-command:run
+// lldb-command:print my_ref__my_field1
+// lldbg-check:(unsigned int) $0 = 11
+// lldb-command:continue
+// lldb-command:print my_var__my_field2
+// lldbg-check:(unsigned int) $1 = 22
+// lldb-command:continue
+
+#![feature(capture_disjoint_fields)]
+#![allow(unused)]
+
+struct MyStruct {
+ my_field1: u32,
+ my_field2: u32,
+}
+
+fn main() {
+ let mut my_var = MyStruct {
+ my_field1: 11,
+ my_field2: 22,
+ };
+ let my_ref = &mut my_var;
+
+ let test = || {
+ let a = my_ref.my_field1;
+
+ _zzz(); // #break
+ };
+
+ test();
+
+ let test = move || {
+ let a = my_var.my_field2;
+
+ _zzz(); // #break
+ };
+
+ test();
+}
+
+fn _zzz() {}
diff --git a/src/test/debuginfo/closure-in-generic-function.rs b/src/test/debuginfo/closure-in-generic-function.rs
new file mode 100644
index 000000000..91d7ddc54
--- /dev/null
+++ b/src/test/debuginfo/closure-in-generic-function.rs
@@ -0,0 +1,60 @@
+// min-lldb-version: 310
+
+// compile-flags:-g
+
+// === GDB TESTS ===================================================================================
+
+// gdb-command:run
+
+// gdb-command:print x
+// gdb-check:$1 = 0.5
+// gdb-command:print y
+// gdb-check:$2 = 10
+// gdb-command:continue
+
+// gdb-command:print *x
+// gdb-check:$3 = 29
+// gdb-command:print *y
+// gdb-check:$4 = 110
+// gdb-command:continue
+
+
+// === LLDB TESTS ==================================================================================
+
+// lldb-command:run
+
+// lldb-command:print x
+// lldbg-check:[...]$0 = 0.5
+// lldbr-check:(f64) x = 0.5
+// lldb-command:print y
+// lldbg-check:[...]$1 = 10
+// lldbr-check:(i32) y = 10
+// lldb-command:continue
+
+// lldb-command:print *x
+// lldbg-check:[...]$2 = 29
+// lldbr-check:(i32) *x = 29
+// lldb-command:print *y
+// lldbg-check:[...]$3 = 110
+// lldbr-check:(i32) *y = 110
+// lldb-command:continue
+
+#![feature(omit_gdb_pretty_printer_section)]
+#![omit_gdb_pretty_printer_section]
+
+fn some_generic_fun<T1, T2>(a: T1, b: T2) -> (T2, T1) {
+
+ let closure = |x, y| {
+ zzz(); // #break
+ (y, x)
+ };
+
+ closure(a, b)
+}
+
+fn main() {
+ some_generic_fun(0.5f64, 10);
+ some_generic_fun(&29, Box::new(110));
+}
+
+fn zzz() { () }
diff --git a/src/test/debuginfo/constant-debug-locs.rs b/src/test/debuginfo/constant-debug-locs.rs
new file mode 100644
index 000000000..bf85fdca4
--- /dev/null
+++ b/src/test/debuginfo/constant-debug-locs.rs
@@ -0,0 +1,54 @@
+// min-lldb-version: 310
+
+// compile-flags:-g
+
+#![allow(dead_code, unused_variables)]
+#![feature(omit_gdb_pretty_printer_section)]
+#![omit_gdb_pretty_printer_section]
+
+// This test makes sure that the compiler doesn't crash when trying to assign
+// debug locations to const-expressions.
+
+use std::cell::UnsafeCell;
+
+const CONSTANT: u64 = 3 + 4;
+
+struct Struct {
+ a: isize,
+ b: usize,
+}
+const STRUCT: Struct = Struct { a: 1, b: 2 };
+
+struct TupleStruct(u32);
+const TUPLE_STRUCT: TupleStruct = TupleStruct(4);
+
+enum Enum {
+ Variant1(char),
+ Variant2 { a: u8 },
+ Variant3
+}
+
+const VARIANT1: Enum = Enum::Variant1('v');
+const VARIANT2: Enum = Enum::Variant2 { a: 2 };
+const VARIANT3: Enum = Enum::Variant3;
+
+const STRING: &'static str = "String";
+
+const VEC: [u32; 8] = [0; 8];
+
+const NESTED: (Struct, TupleStruct) = (STRUCT, TUPLE_STRUCT);
+
+const UNSAFE_CELL: UnsafeCell<bool> = UnsafeCell::new(false);
+
+fn main() {
+ let mut _constant = CONSTANT;
+ let mut _struct = STRUCT;
+ let mut _tuple_struct = TUPLE_STRUCT;
+ let mut _variant1 = VARIANT1;
+ let mut _variant2 = VARIANT2;
+ let mut _variant3 = VARIANT3;
+ let mut _string = STRING;
+ let mut _vec = VEC;
+ let mut _nested = NESTED;
+ let mut _unsafe_cell = UNSAFE_CELL;
+}
diff --git a/src/test/debuginfo/constant-in-match-pattern.rs b/src/test/debuginfo/constant-in-match-pattern.rs
new file mode 100644
index 000000000..e1b533b72
--- /dev/null
+++ b/src/test/debuginfo/constant-in-match-pattern.rs
@@ -0,0 +1,84 @@
+// min-lldb-version: 310
+
+// compile-flags:-g
+
+#![allow(dead_code, unused_variables)]
+#![feature(omit_gdb_pretty_printer_section)]
+#![omit_gdb_pretty_printer_section]
+
+// This test makes sure that the compiler doesn't crash when trying to assign
+// debug locations to 'constant' patterns in match expressions.
+
+const CONSTANT: u64 = 3;
+
+#[derive(PartialEq, Eq)]
+struct Struct {
+ a: isize,
+ b: usize,
+}
+const STRUCT: Struct = Struct { a: 1, b: 2 };
+
+#[derive(PartialEq, Eq)]
+struct TupleStruct(u32);
+const TUPLE_STRUCT: TupleStruct = TupleStruct(4);
+
+#[derive(PartialEq, Eq)]
+enum Enum {
+ Variant1(char),
+ Variant2 { a: u8 },
+ Variant3
+}
+const VARIANT1: Enum = Enum::Variant1('v');
+const VARIANT2: Enum = Enum::Variant2 { a: 2 };
+const VARIANT3: Enum = Enum::Variant3;
+
+const STRING: &'static str = "String";
+
+fn main() {
+
+ match 1 {
+ CONSTANT => {}
+ _ => {}
+ };
+
+ // if let 3 = CONSTANT {}
+
+ match (Struct { a: 2, b: 2 }) {
+ STRUCT => {}
+ _ => {}
+ };
+
+ // if let STRUCT = STRUCT {}
+
+ match TupleStruct(3) {
+ TUPLE_STRUCT => {}
+ _ => {}
+ };
+
+ // if let TupleStruct(4) = TUPLE_STRUCT {}
+
+ match VARIANT3 {
+ VARIANT1 => {},
+ VARIANT2 => {},
+ VARIANT3 => {},
+ _ => {}
+ };
+
+ match (VARIANT3, VARIANT2) {
+ (VARIANT1, VARIANT3) => {},
+ (VARIANT2, VARIANT2) => {},
+ (VARIANT3, VARIANT1) => {},
+ _ => {}
+ };
+
+ // if let VARIANT1 = Enum::Variant3 {}
+ // if let VARIANT2 = Enum::Variant3 {}
+ // if let VARIANT3 = Enum::Variant3 {}
+
+ match "abc" {
+ STRING => {},
+ _ => {}
+ }
+
+ if let STRING = "def" {}
+}
diff --git a/src/test/debuginfo/cross-crate-spans.rs b/src/test/debuginfo/cross-crate-spans.rs
new file mode 100644
index 000000000..7c58e1db2
--- /dev/null
+++ b/src/test/debuginfo/cross-crate-spans.rs
@@ -0,0 +1,76 @@
+#![feature(omit_gdb_pretty_printer_section)]
+#![omit_gdb_pretty_printer_section]
+
+// min-lldb-version: 310
+
+// This fails on lldb 6.0.1 on x86-64 Fedora 28; so mark it macOS-only
+// for now.
+// only-macos
+
+// aux-build:cross_crate_spans.rs
+extern crate cross_crate_spans;
+
+// compile-flags:-g
+
+
+// === GDB TESTS ===================================================================================
+
+// gdb-command:break cross_crate_spans.rs:14
+// gdb-command:run
+
+// gdb-command:print result
+// gdbg-check:$1 = {__0 = 17, __1 = 17}
+// gdbr-check:$1 = (17, 17)
+// gdb-command:print a_variable
+// gdb-check:$2 = 123456789
+// gdb-command:print another_variable
+// gdb-check:$3 = 123456789.5
+// gdb-command:continue
+
+// gdb-command:print result
+// gdbg-check:$4 = {__0 = 1212, __1 = 1212}
+// gdbr-check:$4 = (1212, 1212)
+// gdb-command:print a_variable
+// gdb-check:$5 = 123456789
+// gdb-command:print another_variable
+// gdb-check:$6 = 123456789.5
+// gdb-command:continue
+
+
+
+// === LLDB TESTS ==================================================================================
+
+// lldb-command:b cross_crate_spans.rs:14
+// lldb-command:run
+
+// lldb-command:print result
+// lldbg-check:[...]$0 = { 0 = 17 1 = 17 }
+// lldbr-check:((u32, u32)) result = { 0 = 17 1 = 17 }
+// lldb-command:print a_variable
+// lldbg-check:[...]$1 = 123456789
+// lldbr-check:(u32) a_variable = 123456789
+// lldb-command:print another_variable
+// lldbg-check:[...]$2 = 123456789.5
+// lldbr-check:(f64) another_variable = 123456789.5
+// lldb-command:continue
+
+// lldb-command:print result
+// lldbg-check:[...]$3 = { 0 = 1212 1 = 1212 }
+// lldbr-check:((i16, i16)) result = { 0 = 1212 1 = 1212 }
+// lldb-command:print a_variable
+// lldbg-check:[...]$4 = 123456789
+// lldbr-check:(u32) a_variable = 123456789
+// lldb-command:print another_variable
+// lldbg-check:[...]$5 = 123456789.5
+// lldbr-check:(f64) another_variable = 123456789.5
+// lldb-command:continue
+
+
+// This test makes sure that we can break in functions inlined from other crates.
+
+fn main() {
+
+ let _ = cross_crate_spans::generic_function(17u32);
+ let _ = cross_crate_spans::generic_function(1212i16);
+
+}
diff --git a/src/test/debuginfo/cross-crate-type-uniquing.rs b/src/test/debuginfo/cross-crate-type-uniquing.rs
new file mode 100644
index 000000000..5974ddb3a
--- /dev/null
+++ b/src/test/debuginfo/cross-crate-type-uniquing.rs
@@ -0,0 +1,14 @@
+// min-lldb-version: 310
+
+// aux-build:cross_crate_debuginfo_type_uniquing.rs
+extern crate cross_crate_debuginfo_type_uniquing;
+
+// no-prefer-dynamic
+// compile-flags:-g -C lto
+
+pub struct C;
+pub fn p() -> C {
+ C
+}
+
+fn main() { }
diff --git a/src/test/debuginfo/destructured-fn-argument.rs b/src/test/debuginfo/destructured-fn-argument.rs
new file mode 100644
index 000000000..9cd3874a5
--- /dev/null
+++ b/src/test/debuginfo/destructured-fn-argument.rs
@@ -0,0 +1,499 @@
+// min-lldb-version: 310
+
+// compile-flags:-g
+
+// === GDB TESTS ===================================================================================
+
+// gdb-command:run
+
+// gdb-command:print a
+// gdb-check:$1 = 1
+// gdb-command:print b
+// gdb-check:$2 = false
+// gdb-command:continue
+
+// gdb-command:print a
+// gdb-check:$3 = 2
+// gdb-command:print b
+// gdb-check:$4 = 3
+// gdb-command:print c
+// gdb-check:$5 = 4
+// gdb-command:continue
+
+// gdb-command:print a
+// gdb-check:$6 = 5
+// gdb-command:print b
+// gdbg-check:$7 = {__0 = 6, __1 = 7}
+// gdbr-check:$7 = (6, 7)
+// gdb-command:continue
+
+// gdb-command:print h
+// gdb-check:$8 = 8
+// gdb-command:print i
+// gdbg-check:$9 = {a = 9, b = 10}
+// gdbr-check:$9 = destructured_fn_argument::Struct {a: 9, b: 10}
+// gdb-command:print j
+// gdb-check:$10 = 11
+// gdb-command:continue
+
+// gdb-command:print k
+// gdb-check:$11 = 12
+// gdb-command:print l
+// gdb-check:$12 = 13
+// gdb-command:continue
+
+// gdb-command:print m
+// gdb-check:$13 = 14
+// gdb-command:print n
+// gdb-check:$14 = 16
+// gdb-command:continue
+
+// gdb-command:print o
+// gdb-check:$15 = 18
+// gdb-command:continue
+
+// gdb-command:print p
+// gdb-check:$16 = 19
+// gdb-command:print q
+// gdb-check:$17 = 20
+// gdb-command:print r
+// gdbg-check:$18 = {a = 21, b = 22}
+// gdbr-check:$18 = destructured_fn_argument::Struct {a: 21, b: 22}
+// gdb-command:continue
+
+// gdb-command:print s
+// gdb-check:$19 = 24
+// gdb-command:print t
+// gdb-check:$20 = 23
+// gdb-command:continue
+
+// gdb-command:print u
+// gdb-check:$21 = 25
+// gdb-command:print v
+// gdb-check:$22 = 26
+// gdb-command:print w
+// gdb-check:$23 = 27
+// gdb-command:print x
+// gdb-check:$24 = 28
+// gdb-command:print y
+// gdb-check:$25 = 29
+// gdb-command:print z
+// gdb-check:$26 = 30
+// gdb-command:print ae
+// gdb-check:$27 = 31
+// gdb-command:print oe
+// gdb-check:$28 = 32
+// gdb-command:print ue
+// gdb-check:$29 = 33
+// gdb-command:continue
+
+// gdb-command:print aa
+// gdbg-check:$30 = {__0 = 34, __1 = 35}
+// gdbr-check:$30 = (34, 35)
+// gdb-command:continue
+
+// gdb-command:print bb
+// gdbg-check:$31 = {__0 = 36, __1 = 37}
+// gdbr-check:$31 = (36, 37)
+// gdb-command:continue
+
+// gdb-command:print cc
+// gdb-check:$32 = 38
+// gdb-command:continue
+
+// gdb-command:print dd
+// gdbg-check:$33 = {__0 = 40, __1 = 41, __2 = 42}
+// gdbr-check:$33 = (40, 41, 42)
+// gdb-command:continue
+
+// gdb-command:print *ee
+// gdbg-check:$34 = {__0 = 43, __1 = 44, __2 = 45}
+// gdbr-check:$34 = (43, 44, 45)
+// gdb-command:continue
+
+// gdb-command:print *ff
+// gdb-check:$35 = 46
+// gdb-command:print gg
+// gdbg-check:$36 = {__0 = 47, __1 = 48}
+// gdbr-check:$36 = (47, 48)
+// gdb-command:continue
+
+// gdb-command:print *hh
+// gdb-check:$37 = 50
+// gdb-command:continue
+
+// gdb-command:print ii
+// gdb-check:$38 = 51
+// gdb-command:continue
+
+// gdb-command:print *jj
+// gdb-check:$39 = 52
+// gdb-command:continue
+
+// gdb-command:print kk
+// gdb-check:$40 = 53
+// gdb-command:print ll
+// gdb-check:$41 = 54
+// gdb-command:continue
+
+// gdb-command:print mm
+// gdb-check:$42 = 55
+// gdb-command:print *nn
+// gdb-check:$43 = 56
+// gdb-command:continue
+
+// gdb-command:print oo
+// gdb-check:$44 = 57
+// gdb-command:print pp
+// gdb-check:$45 = 58
+// gdb-command:print qq
+// gdb-check:$46 = 59
+// gdb-command:continue
+
+// gdb-command:print rr
+// gdb-check:$47 = 60
+// gdb-command:print ss
+// gdb-check:$48 = 61
+// gdb-command:print tt
+// gdb-check:$49 = 62
+// gdb-command:continue
+
+
+// === LLDB TESTS ==================================================================================
+
+// lldb-command:run
+
+// lldb-command:print a
+// lldbg-check:[...]$0 = 1
+// lldbr-check:(isize) a = 1
+// lldb-command:print b
+// lldbg-check:[...]$1 = false
+// lldbr-check:(bool) b = false
+// lldb-command:continue
+
+// lldb-command:print a
+// lldbg-check:[...]$2 = 2
+// lldbr-check:(isize) a = 2
+// lldb-command:print b
+// lldbg-check:[...]$3 = 3
+// lldbr-check:(u16) b = 3
+// lldb-command:print c
+// lldbg-check:[...]$4 = 4
+// lldbr-check:(u16) c = 4
+// lldb-command:continue
+
+// lldb-command:print a
+// lldbg-check:[...]$5 = 5
+// lldbr-check:(isize) a = 5
+// lldb-command:print b
+// lldbg-check:[...]$6 = { 0 = 6 1 = 7 }
+// lldbr-check:((u32, u32)) b = { 0 = 6 1 = 7 }
+// lldb-command:continue
+
+// lldb-command:print h
+// lldbg-check:[...]$7 = 8
+// lldbr-check:(i16) h = 8
+// lldb-command:print i
+// lldbg-check:[...]$8 = { a = 9 b = 10 }
+// lldbr-check:(destructured_fn_argument::Struct) i = { a = 9 b = 10 }
+// lldb-command:print j
+// lldbg-check:[...]$9 = 11
+// lldbr-check:(i16) j = 11
+// lldb-command:continue
+
+// lldb-command:print k
+// lldbg-check:[...]$10 = 12
+// lldbr-check:(i64) k = 12
+// lldb-command:print l
+// lldbg-check:[...]$11 = 13
+// lldbr-check:(i32) l = 13
+// lldb-command:continue
+
+// lldb-command:print m
+// lldbg-check:[...]$12 = 14
+// lldbr-check:(isize) m = 14
+// lldb-command:print n
+// lldbg-check:[...]$13 = 16
+// lldbr-check:(i32) n = 16
+// lldb-command:continue
+
+// lldb-command:print o
+// lldbg-check:[...]$14 = 18
+// lldbr-check:(i32) o = 18
+// lldb-command:continue
+
+// lldb-command:print p
+// lldbg-check:[...]$15 = 19
+// lldbr-check:(i64) p = 19
+// lldb-command:print q
+// lldbg-check:[...]$16 = 20
+// lldbr-check:(i32) q = 20
+// lldb-command:print r
+// lldbg-check:[...]$17 = { a = 21 b = 22 }
+// lldbr-check:(destructured_fn_argument::Struct) r = { a = 21, b = 22 }
+// lldb-command:continue
+
+// lldb-command:print s
+// lldbg-check:[...]$18 = 24
+// lldbr-check:(i32) s = 24
+// lldb-command:print t
+// lldbg-check:[...]$19 = 23
+// lldbr-check:(i64) t = 23
+// lldb-command:continue
+
+// lldb-command:print u
+// lldbg-check:[...]$20 = 25
+// lldbr-check:(i16) u = 25
+// lldb-command:print v
+// lldbg-check:[...]$21 = 26
+// lldbr-check:(i32) v = 26
+// lldb-command:print w
+// lldbg-check:[...]$22 = 27
+// lldbr-check:(i64) w = 27
+// lldb-command:print x
+// lldbg-check:[...]$23 = 28
+// lldbr-check:(i32) x = 28
+// lldb-command:print y
+// lldbg-check:[...]$24 = 29
+// lldbr-check:(i64) y = 29
+// lldb-command:print z
+// lldbg-check:[...]$25 = 30
+// lldbr-check:(i32) z = 30
+// lldb-command:print ae
+// lldbg-check:[...]$26 = 31
+// lldbr-check:(i64) ae = 31
+// lldb-command:print oe
+// lldbg-check:[...]$27 = 32
+// lldbr-check:(i32) oe = 32
+// lldb-command:print ue
+// lldbg-check:[...]$28 = 33
+// lldbr-check:(u16) ue = 33
+// lldb-command:continue
+
+// lldb-command:print aa
+// lldbg-check:[...]$29 = { 0 = 34 1 = 35 }
+// lldbr-check:((isize, isize)) aa = { 0 = 34 1 = 35 }
+// lldb-command:continue
+
+// lldb-command:print bb
+// lldbg-check:[...]$30 = { 0 = 36 1 = 37 }
+// lldbr-check:((isize, isize)) bb = { 0 = 36 1 = 37 }
+// lldb-command:continue
+
+// lldb-command:print cc
+// lldbg-check:[...]$31 = 38
+// lldbr-check:(isize) cc = 38
+// lldb-command:continue
+
+// lldb-command:print dd
+// lldbg-check:[...]$32 = { 0 = 40 1 = 41 2 = 42 }
+// lldbr-check:((isize, isize, isize)) dd = { 0 = 40 1 = 41 2 = 42 }
+// lldb-command:continue
+
+// lldb-command:print *ee
+// lldbg-check:[...]$33 = { 0 = 43 1 = 44 2 = 45 }
+// lldbr-check:((isize, isize, isize)) *ee = { 0 = 43 1 = 44 2 = 45 }
+// lldb-command:continue
+
+// lldb-command:print *ff
+// lldbg-check:[...]$34 = 46
+// lldbr-check:(isize) *ff = 46
+// lldb-command:print gg
+// lldbg-check:[...]$35 = { 0 = 47 1 = 48 }
+// lldbr-check:((isize, isize)) gg = { 0 = 47 1 = 48 }
+// lldb-command:continue
+
+// lldb-command:print *hh
+// lldbg-check:[...]$36 = 50
+// lldbr-check:(i32) *hh = 50
+// lldb-command:continue
+
+// lldb-command:print ii
+// lldbg-check:[...]$37 = 51
+// lldbr-check:(i32) ii = 51
+// lldb-command:continue
+
+// lldb-command:print *jj
+// lldbg-check:[...]$38 = 52
+// lldbr-check:(i32) *jj = 52
+// lldb-command:continue
+
+// lldb-command:print kk
+// lldbg-check:[...]$39 = 53
+// lldbr-check:(f64) kk = 53
+// lldb-command:print ll
+// lldbg-check:[...]$40 = 54
+// lldbr-check:(isize) ll = 54
+// lldb-command:continue
+
+// lldb-command:print mm
+// lldbg-check:[...]$41 = 55
+// lldbr-check:(f64) mm = 55
+// lldb-command:print *nn
+// lldbg-check:[...]$42 = 56
+// lldbr-check:(isize) *nn = 56
+// lldb-command:continue
+
+// lldb-command:print oo
+// lldbg-check:[...]$43 = 57
+// lldbr-check:(isize) oo = 57
+// lldb-command:print pp
+// lldbg-check:[...]$44 = 58
+// lldbr-check:(isize) pp = 58
+// lldb-command:print qq
+// lldbg-check:[...]$45 = 59
+// lldbr-check:(isize) qq = 59
+// lldb-command:continue
+
+// lldb-command:print rr
+// lldbg-check:[...]$46 = 60
+// lldbr-check:(isize) rr = 60
+// lldb-command:print ss
+// lldbg-check:[...]$47 = 61
+// lldbr-check:(isize) ss = 61
+// lldb-command:print tt
+// lldbg-check:[...]$48 = 62
+// lldbr-check:(isize) tt = 62
+// lldb-command:continue
+
+#![allow(unused_variables)]
+#![feature(box_patterns)]
+#![feature(omit_gdb_pretty_printer_section)]
+#![omit_gdb_pretty_printer_section]
+
+use self::Univariant::Unit;
+
+struct Struct {
+ a: i64,
+ b: i32
+}
+
+enum Univariant {
+ Unit(i32)
+}
+
+struct TupleStruct (f64, isize);
+
+
+fn simple_tuple((a, b): (isize, bool)) {
+ zzz(); // #break
+}
+
+fn nested_tuple((a, (b, c)): (isize, (u16, u16))) {
+ zzz(); // #break
+}
+
+fn destructure_only_first_level((a, b): (isize, (u32, u32))) {
+ zzz(); // #break
+}
+
+fn struct_as_tuple_element((h, i, j): (i16, Struct, i16)) {
+ zzz(); // #break
+}
+
+fn struct_pattern(Struct { a: k, b: l }: Struct) {
+ zzz(); // #break
+}
+
+fn ignored_tuple_element((m, _, n): (isize, u16, i32)) {
+ zzz(); // #break
+}
+
+fn ignored_struct_field(Struct { b: o, .. }: Struct) {
+ zzz(); // #break
+}
+
+fn one_struct_destructured_one_not((Struct { a: p, b: q }, r): (Struct, Struct)) {
+ zzz(); // #break
+}
+
+fn different_order_of_struct_fields(Struct { b: s, a: t }: Struct ) {
+ zzz(); // #break
+}
+
+fn complex_nesting(((u, v ), ((w, (x, Struct { a: y, b: z})), Struct { a: ae, b: oe }), ue ):
+ ((i16, i32), ((i64, (i32, Struct, )), Struct ), u16))
+{
+ zzz(); // #break
+}
+
+fn managed_box(&aa: &(isize, isize)) {
+ zzz(); // #break
+}
+
+fn borrowed_pointer(&bb: &(isize, isize)) {
+ zzz(); // #break
+}
+
+fn contained_borrowed_pointer((&cc, _): (&isize, isize)) {
+ zzz(); // #break
+}
+
+fn unique_pointer(box dd: Box<(isize, isize, isize)>) {
+ zzz(); // #break
+}
+
+fn ref_binding(ref ee: (isize, isize, isize)) {
+ zzz(); // #break
+}
+
+fn ref_binding_in_tuple((ref ff, gg): (isize, (isize, isize))) {
+ zzz(); // #break
+}
+
+fn ref_binding_in_struct(Struct { b: ref hh, .. }: Struct) {
+ zzz(); // #break
+}
+
+fn univariant_enum(Unit(ii): Univariant) {
+ zzz(); // #break
+}
+
+fn univariant_enum_with_ref_binding(Unit(ref jj): Univariant) {
+ zzz(); // #break
+}
+
+fn tuple_struct(TupleStruct(kk, ll): TupleStruct) {
+ zzz(); // #break
+}
+
+fn tuple_struct_with_ref_binding(TupleStruct(mm, ref nn): TupleStruct) {
+ zzz(); // #break
+}
+
+fn multiple_arguments((oo, pp): (isize, isize), qq : isize) {
+ zzz(); // #break
+}
+
+fn main() {
+ simple_tuple((1, false));
+ nested_tuple((2, (3, 4)));
+ destructure_only_first_level((5, (6, 7)));
+ struct_as_tuple_element((8, Struct { a: 9, b: 10 }, 11));
+ struct_pattern(Struct { a: 12, b: 13 });
+ ignored_tuple_element((14, 15, 16));
+ ignored_struct_field(Struct { a: 17, b: 18 });
+ one_struct_destructured_one_not((Struct { a: 19, b: 20 }, Struct { a: 21, b: 22 }));
+ different_order_of_struct_fields(Struct { a: 23, b: 24 });
+ complex_nesting(((25, 26), ((27, (28, Struct { a: 29, b: 30})), Struct { a: 31, b: 32 }), 33));
+ managed_box(&(34, 35));
+ borrowed_pointer(&(36, 37));
+ contained_borrowed_pointer((&38, 39));
+ unique_pointer(Box::new((40, 41, 42)));
+ ref_binding((43, 44, 45));
+ ref_binding_in_tuple((46, (47, 48)));
+ ref_binding_in_struct(Struct { a: 49, b: 50 });
+ univariant_enum(Unit(51));
+ univariant_enum_with_ref_binding(Unit(52));
+ tuple_struct(TupleStruct(53.0, 54));
+ tuple_struct_with_ref_binding(TupleStruct(55.0, 56));
+ multiple_arguments((57, 58), 59);
+
+ fn nested_function(rr: isize, (ss, tt): (isize, isize)) {
+ zzz(); // #break
+ }
+
+ nested_function(60, (61, 62));
+}
+
+fn zzz() { () }
diff --git a/src/test/debuginfo/destructured-for-loop-variable.rs b/src/test/debuginfo/destructured-for-loop-variable.rs
new file mode 100644
index 000000000..15cb88ef2
--- /dev/null
+++ b/src/test/debuginfo/destructured-for-loop-variable.rs
@@ -0,0 +1,243 @@
+// min-lldb-version: 310
+
+// This fails on lldb 6.0.1 on x86-64 Fedora 28; so mark it macOS-only
+// for now.
+// only-macos
+
+// compile-flags:-g
+
+// === GDB TESTS ===================================================================================
+
+// gdb-command:run
+
+// DESTRUCTURED STRUCT
+// gdb-command:print x
+// gdb-check:$1 = 400
+// gdb-command:print y
+// gdb-check:$2 = 401.5
+// gdb-command:print z
+// gdb-check:$3 = true
+// gdb-command:continue
+
+// DESTRUCTURED TUPLE
+// gdb-command:print/x _i8
+// gdb-check:$4 = 0x6f
+// gdb-command:print/x _u8
+// gdb-check:$5 = 0x70
+// gdb-command:print _i16
+// gdb-check:$6 = -113
+// gdb-command:print _u16
+// gdb-check:$7 = 114
+// gdb-command:print _i32
+// gdb-check:$8 = -115
+// gdb-command:print _u32
+// gdb-check:$9 = 116
+// gdb-command:print _i64
+// gdb-check:$10 = -117
+// gdb-command:print _u64
+// gdb-check:$11 = 118
+// gdb-command:print _f32
+// gdb-check:$12 = 119.5
+// gdb-command:print _f64
+// gdb-check:$13 = 120.5
+// gdb-command:continue
+
+// MORE COMPLEX CASE
+// gdb-command:print v1
+// gdb-check:$14 = 80000
+// gdb-command:print x1
+// gdb-check:$15 = 8000
+// gdb-command:print *y1
+// gdb-check:$16 = 80001.5
+// gdb-command:print z1
+// gdb-check:$17 = false
+// gdb-command:print *x2
+// gdb-check:$18 = -30000
+// gdb-command:print y2
+// gdb-check:$19 = -300001.5
+// gdb-command:print *z2
+// gdb-check:$20 = true
+// gdb-command:print v2
+// gdb-check:$21 = 854237.5
+// gdb-command:continue
+
+// SIMPLE IDENTIFIER
+// gdb-command:print i
+// gdb-check:$22 = 1234
+// gdb-command:continue
+
+// gdb-command:print simple_struct_ident
+// gdbg-check:$23 = {x = 3537, y = 35437.5, z = true}
+// gdbr-check:$23 = destructured_for_loop_variable::Struct {x: 3537, y: 35437.5, z: true}
+// gdb-command:continue
+
+// gdb-command:print simple_tuple_ident
+// gdbg-check:$24 = {__0 = 34903493, __1 = 232323}
+// gdbr-check:$24 = (34903493, 232323)
+// gdb-command:continue
+
+// === LLDB TESTS ==================================================================================
+
+// lldb-command:type format add --format hex char
+// lldb-command:type format add --format hex 'unsigned char'
+
+// lldb-command:run
+
+// DESTRUCTURED STRUCT
+// lldb-command:print x
+// lldbg-check:[...]$0 = 400
+// lldbr-check:(i16) x = 400
+// lldb-command:print y
+// lldbg-check:[...]$1 = 401.5
+// lldbr-check:(f32) y = 401.5
+// lldb-command:print z
+// lldbg-check:[...]$2 = true
+// lldbr-check:(bool) z = true
+// lldb-command:continue
+
+// DESTRUCTURED TUPLE
+// lldb-command:print _i8
+// lldbg-check:[...]$3 = 0x6f
+// lldbr-check:(i8) _i8 = 111
+// lldb-command:print _u8
+// lldbg-check:[...]$4 = 0x70
+// lldbr-check:(u8) _u8 = 112
+// lldb-command:print _i16
+// lldbg-check:[...]$5 = -113
+// lldbr-check:(i16) _i16 = -113
+// lldb-command:print _u16
+// lldbg-check:[...]$6 = 114
+// lldbr-check:(u16) _u16 = 114
+// lldb-command:print _i32
+// lldbg-check:[...]$7 = -115
+// lldbr-check:(i32) _i32 = -115
+// lldb-command:print _u32
+// lldbg-check:[...]$8 = 116
+// lldbr-check:(u32) _u32 = 116
+// lldb-command:print _i64
+// lldbg-check:[...]$9 = -117
+// lldbr-check:(i64) _i64 = -117
+// lldb-command:print _u64
+// lldbg-check:[...]$10 = 118
+// lldbr-check:(u64) _u64 = 118
+// lldb-command:print _f32
+// lldbg-check:[...]$11 = 119.5
+// lldbr-check:(f32) _f32 = 119.5
+// lldb-command:print _f64
+// lldbg-check:[...]$12 = 120.5
+// lldbr-check:(f64) _f64 = 120.5
+// lldb-command:continue
+
+// MORE COMPLEX CASE
+// lldb-command:print v1
+// lldbg-check:[...]$13 = 80000
+// lldbr-check:(i32) v1 = 80000
+// lldb-command:print x1
+// lldbg-check:[...]$14 = 8000
+// lldbr-check:(i16) x1 = 8000
+// lldb-command:print *y1
+// lldbg-check:[...]$15 = 80001.5
+// lldbr-check:(f32) *y1 = 80001.5
+// lldb-command:print z1
+// lldbg-check:[...]$16 = false
+// lldbr-check:(bool) z1 = false
+// lldb-command:print *x2
+// lldbg-check:[...]$17 = -30000
+// lldbr-check:(i16) *x2 = -30000
+// lldb-command:print y2
+// lldbg-check:[...]$18 = -300001.5
+// lldbr-check:(f32) y2 = -300001.5
+// lldb-command:print *z2
+// lldbg-check:[...]$19 = true
+// lldbr-check:(bool) *z2 = true
+// lldb-command:print v2
+// lldbg-check:[...]$20 = 854237.5
+// lldbr-check:(f64) v2 = 854237.5
+// lldb-command:continue
+
+// SIMPLE IDENTIFIER
+// lldb-command:print i
+// lldbg-check:[...]$21 = 1234
+// lldbr-check:(i32) i = 1234
+// lldb-command:continue
+
+// lldb-command:print simple_struct_ident
+// lldbg-check:[...]$22 = { x = 3537 y = 35437.5 z = true }
+// lldbr-check:(destructured_for_loop_variable::Struct) simple_struct_ident = { x = 3537 y = 35437.5 z = true }
+// lldb-command:continue
+
+// lldb-command:print simple_tuple_ident
+// lldbg-check:[...]$23 = { 0 = 34903493 1 = 232323 }
+// lldbr-check:((u32, i64)) simple_tuple_ident = { 0 = 34903493 1 = 232323 }
+// lldb-command:continue
+
+#![allow(unused_variables)]
+#![feature(box_patterns)]
+#![feature(omit_gdb_pretty_printer_section)]
+#![omit_gdb_pretty_printer_section]
+
+struct Struct {
+ x: i16,
+ y: f32,
+ z: bool
+}
+
+fn main() {
+
+ let s = Struct {
+ x: 400,
+ y: 401.5,
+ z: true
+ };
+
+ for &Struct { x, y, z } in &[s] {
+ zzz(); // #break
+ }
+
+ let tuple: (i8, u8, i16, u16, i32, u32, i64, u64, f32, f64) =
+ (0x6f, 0x70, -113, 114, -115, 116, -117, 118, 119.5, 120.5);
+
+ for &(_i8, _u8, _i16, _u16, _i32, _u32, _i64, _u64, _f32, _f64) in &[tuple] {
+ zzz(); // #break
+ }
+
+ let more_complex: (i32, &Struct, Struct, Box<f64>) =
+ (80000,
+ &Struct {
+ x: 8000,
+ y: 80001.5,
+ z: false
+ },
+ Struct {
+ x: -30000,
+ y: -300001.5,
+ z: true
+ },
+ Box::new(854237.5));
+
+ for &(v1,
+ &Struct { x: x1, y: ref y1, z: z1 },
+ Struct { x: ref x2, y: y2, z: ref z2 },
+ box v2) in [more_complex].iter() {
+ zzz(); // #break
+ }
+
+ for i in 1234..1235 {
+ zzz(); // #break
+ }
+
+ for simple_struct_ident in
+ vec![Struct {
+ x: 3537,
+ y: 35437.5,
+ z: true
+ }].into_iter() {
+ zzz(); // #break
+ }
+
+ for simple_tuple_ident in vec![(34903493u32, 232323i64)] {
+ zzz(); // #break
+ }
+}
+
+fn zzz() {()}
diff --git a/src/test/debuginfo/destructured-local.rs b/src/test/debuginfo/destructured-local.rs
new file mode 100644
index 000000000..3a2a88977
--- /dev/null
+++ b/src/test/debuginfo/destructured-local.rs
@@ -0,0 +1,373 @@
+// min-lldb-version: 310
+
+// compile-flags:-g
+
+// === GDB TESTS ===================================================================================
+
+// gdb-command:run
+
+// gdb-command:print a
+// gdb-check:$1 = 1
+// gdb-command:print b
+// gdb-check:$2 = false
+
+// gdb-command:print c
+// gdb-check:$3 = 2
+// gdb-command:print d
+// gdb-check:$4 = 3
+// gdb-command:print e
+// gdb-check:$5 = 4
+
+// gdb-command:print f
+// gdb-check:$6 = 5
+// gdb-command:print g
+// gdbg-check:$7 = {__0 = 6, __1 = 7}
+// gdbr-check:$7 = (6, 7)
+
+// gdb-command:print h
+// gdb-check:$8 = 8
+// gdb-command:print i
+// gdbg-check:$9 = {a = 9, b = 10}
+// gdbr-check:$9 = destructured_local::Struct {a: 9, b: 10}
+// gdb-command:print j
+// gdb-check:$10 = 11
+
+// gdb-command:print k
+// gdb-check:$11 = 12
+// gdb-command:print l
+// gdb-check:$12 = 13
+
+// gdb-command:print m
+// gdb-check:$13 = 14
+// gdb-command:print n
+// gdb-check:$14 = 16
+
+// gdb-command:print o
+// gdb-check:$15 = 18
+
+// gdb-command:print p
+// gdb-check:$16 = 19
+// gdb-command:print q
+// gdb-check:$17 = 20
+// gdb-command:print r
+// gdbg-check:$18 = {a = 21, b = 22}
+// gdbr-check:$18 = destructured_local::Struct {a: 21, b: 22}
+
+// gdb-command:print s
+// gdb-check:$19 = 24
+// gdb-command:print t
+// gdb-check:$20 = 23
+
+// gdb-command:print u
+// gdb-check:$21 = 25
+// gdb-command:print v
+// gdb-check:$22 = 26
+// gdb-command:print w
+// gdb-check:$23 = 27
+// gdb-command:print x
+// gdb-check:$24 = 28
+// gdb-command:print y
+// gdb-check:$25 = 29
+// gdb-command:print z
+// gdb-check:$26 = 30
+// gdb-command:print ae
+// gdb-check:$27 = 31
+// gdb-command:print oe
+// gdb-check:$28 = 32
+// gdb-command:print ue
+// gdb-check:$29 = 33
+
+// gdb-command:print aa
+// gdbg-check:$30 = {__0 = 34, __1 = 35}
+// gdbr-check:$30 = (34, 35)
+
+// gdb-command:print bb
+// gdbg-check:$31 = {__0 = 36, __1 = 37}
+// gdbr-check:$31 = (36, 37)
+
+// gdb-command:print cc
+// gdb-check:$32 = 38
+
+// gdb-command:print dd
+// gdbg-check:$33 = {__0 = 40, __1 = 41, __2 = 42}
+// gdbr-check:$33 = (40, 41, 42)
+
+// gdb-command:print *ee
+// gdbg-check:$34 = {__0 = 43, __1 = 44, __2 = 45}
+// gdbr-check:$34 = (43, 44, 45)
+
+// gdb-command:print *ff
+// gdb-check:$35 = 46
+
+// gdb-command:print gg
+// gdbg-check:$36 = {__0 = 47, __1 = 48}
+// gdbr-check:$36 = (47, 48)
+
+// gdb-command:print *hh
+// gdb-check:$37 = 50
+
+// gdb-command:print ii
+// gdb-check:$38 = 51
+
+// gdb-command:print *jj
+// gdb-check:$39 = 52
+
+// gdb-command:print kk
+// gdb-check:$40 = 53
+
+// gdb-command:print ll
+// gdb-check:$41 = 54
+
+// gdb-command:print mm
+// gdb-check:$42 = 55
+
+// gdb-command:print *nn
+// gdb-check:$43 = 56
+
+
+// === LLDB TESTS ==================================================================================
+
+// lldb-command:run
+
+// lldb-command:print a
+// lldbg-check:[...]$0 = 1
+// lldbr-check:(isize) a = 1
+// lldb-command:print b
+// lldbg-check:[...]$1 = false
+// lldbr-check:(bool) b = false
+
+// lldb-command:print c
+// lldbg-check:[...]$2 = 2
+// lldbr-check:(isize) c = 2
+// lldb-command:print d
+// lldbg-check:[...]$3 = 3
+// lldbr-check:(u16) d = 3
+// lldb-command:print e
+// lldbg-check:[...]$4 = 4
+// lldbr-check:(u16) e = 4
+
+// lldb-command:print f
+// lldbg-check:[...]$5 = 5
+// lldbr-check:(isize) f = 5
+// lldb-command:print g
+// lldbg-check:[...]$6 = { 0 = 6 1 = 7 }
+// lldbr-check:((u32, u32)) g = { 0 = 6 1 = 7 }
+
+// lldb-command:print h
+// lldbg-check:[...]$7 = 8
+// lldbr-check:(i16) h = 8
+// lldb-command:print i
+// lldbg-check:[...]$8 = { a = 9 b = 10 }
+// lldbr-check:(destructured_local::Struct) i = { a = 9 b = 10 }
+// lldb-command:print j
+// lldbg-check:[...]$9 = 11
+// lldbr-check:(i16) j = 11
+
+// lldb-command:print k
+// lldbg-check:[...]$10 = 12
+// lldbr-check:(i64) k = 12
+// lldb-command:print l
+// lldbg-check:[...]$11 = 13
+// lldbr-check:(i32) l = 13
+
+// lldb-command:print m
+// lldbg-check:[...]$12 = 14
+// lldbr-check:(i32) m = 14
+// lldb-command:print n
+// lldbg-check:[...]$13 = 16
+// lldbr-check:(i32) n = 16
+
+// lldb-command:print o
+// lldbg-check:[...]$14 = 18
+// lldbr-check:(i32) o = 18
+
+// lldb-command:print p
+// lldbg-check:[...]$15 = 19
+// lldbr-check:(i64) p = 19
+// lldb-command:print q
+// lldbg-check:[...]$16 = 20
+// lldbr-check:(i32) q = 20
+// lldb-command:print r
+// lldbg-check:[...]$17 = { a = 21 b = 22 }
+// lldbr-check:(destructured_local::Struct) r = { a = 21 b = 22 }
+
+// lldb-command:print s
+// lldbg-check:[...]$18 = 24
+// lldbr-check:(i32) s = 24
+// lldb-command:print t
+// lldbg-check:[...]$19 = 23
+// lldbr-check:(i64) t = 23
+
+// lldb-command:print u
+// lldbg-check:[...]$20 = 25
+// lldbr-check:(i32) u = 25
+// lldb-command:print v
+// lldbg-check:[...]$21 = 26
+// lldbr-check:(i32) v = 26
+// lldb-command:print w
+// lldbg-check:[...]$22 = 27
+// lldbr-check:(i32) w = 27
+// lldb-command:print x
+// lldbg-check:[...]$23 = 28
+// lldbr-check:(i32) x = 28
+// lldb-command:print y
+// lldbg-check:[...]$24 = 29
+// lldbr-check:(i64) y = 29
+// lldb-command:print z
+// lldbg-check:[...]$25 = 30
+// lldbr-check:(i32) z = 30
+// lldb-command:print ae
+// lldbg-check:[...]$26 = 31
+// lldbr-check:(i64) ae = 31
+// lldb-command:print oe
+// lldbg-check:[...]$27 = 32
+// lldbr-check:(i32) oe = 32
+// lldb-command:print ue
+// lldbg-check:[...]$28 = 33
+// lldbr-check:(i32) ue = 33
+
+// lldb-command:print aa
+// lldbg-check:[...]$29 = { 0 = 34 1 = 35 }
+// lldbr-check:((i32, i32)) aa = { 0 = 34 1 = 35 }
+
+// lldb-command:print bb
+// lldbg-check:[...]$30 = { 0 = 36 1 = 37 }
+// lldbr-check:((i32, i32)) bb = { 0 = 36 1 = 37 }
+
+// lldb-command:print cc
+// lldbg-check:[...]$31 = 38
+// lldbr-check:(i32) cc = 38
+
+// lldb-command:print dd
+// lldbg-check:[...]$32 = { 0 = 40 1 = 41 2 = 42 }
+// lldbr-check:((i32, i32, i32)) dd = { 0 = 40 1 = 41 2 = 42}
+
+// lldb-command:print *ee
+// lldbg-check:[...]$33 = { 0 = 43 1 = 44 2 = 45 }
+// lldbr-check:((i32, i32, i32)) *ee = { 0 = 43 1 = 44 2 = 45}
+
+// lldb-command:print *ff
+// lldbg-check:[...]$34 = 46
+// lldbr-check:(i32) *ff = 46
+
+// lldb-command:print gg
+// lldbg-check:[...]$35 = { 0 = 47 1 = 48 }
+// lldbr-check:((i32, i32)) gg = { 0 = 47 1 = 48 }
+
+// lldb-command:print *hh
+// lldbg-check:[...]$36 = 50
+// lldbr-check:(i32) *hh = 50
+
+// lldb-command:print ii
+// lldbg-check:[...]$37 = 51
+// lldbr-check:(i32) ii = 51
+
+// lldb-command:print *jj
+// lldbg-check:[...]$38 = 52
+// lldbr-check:(i32) *jj = 52
+
+// lldb-command:print kk
+// lldbg-check:[...]$39 = 53
+// lldbr-check:(f64) kk = 53
+
+// lldb-command:print ll
+// lldbg-check:[...]$40 = 54
+// lldbr-check:(isize) ll = 54
+
+// lldb-command:print mm
+// lldbg-check:[...]$41 = 55
+// lldbr-check:(f64) mm = 55
+
+// lldb-command:print *nn
+// lldbg-check:[...]$42 = 56
+// lldbr-check:(isize) *nn = 56
+
+
+#![allow(unused_variables)]
+#![feature(box_patterns)]
+#![feature(omit_gdb_pretty_printer_section)]
+#![omit_gdb_pretty_printer_section]
+
+use self::Univariant::Unit;
+
+struct Struct {
+ a: i64,
+ b: i32
+}
+
+enum Univariant {
+ Unit(i32)
+}
+
+struct TupleStruct (f64, isize);
+
+
+fn main() {
+ // simple tuple
+ let (a, b) : (isize, bool) = (1, false);
+
+ // nested tuple
+ let (c, (d, e)) : (isize, (u16, u16)) = (2, (3, 4));
+
+ // bind tuple-typed value to one name (destructure only first level)
+ let (f, g) : (isize, (u32, u32)) = (5, (6, 7));
+
+ // struct as tuple element
+ let (h, i, j) : (i16, Struct, i16) = (8, Struct { a: 9, b: 10 }, 11);
+
+ // struct pattern
+ let Struct { a: k, b: l } = Struct { a: 12, b: 13 };
+
+ // ignored tuple element
+ let (m, _, n) = (14, 15, 16);
+
+ // ignored struct field
+ let Struct { b: o, .. } = Struct { a: 17, b: 18 };
+
+ // one struct destructured, one not
+ let (Struct { a: p, b: q }, r) = (Struct { a: 19, b: 20 }, Struct { a: 21, b: 22 });
+
+ // different order of struct fields
+ let Struct { b: s, a: t } = Struct { a: 23, b: 24 };
+
+ // complex nesting
+ let ((u, v), ((w, (x, Struct { a: y, b: z})), Struct { a: ae, b: oe }), ue) =
+ ((25, 26), ((27, (28, Struct { a: 29, b: 30})), Struct { a: 31, b: 32 }), 33);
+
+ // reference
+ let &aa = &(34, 35);
+
+ // reference
+ let &bb = &(36, 37);
+
+ // contained reference
+ let (&cc, _) = (&38, 39);
+
+ // unique pointer
+ let box dd = Box::new((40, 41, 42));
+
+ // ref binding
+ let ref ee = (43, 44, 45);
+
+ // ref binding in tuple
+ let (ref ff, gg) = (46, (47, 48));
+
+ // ref binding in struct
+ let Struct { b: ref hh, .. } = Struct { a: 49, b: 50 };
+
+ // univariant enum
+ let Unit(ii) = Unit(51);
+
+ // univariant enum with ref binding
+ let &Unit(ref jj) = &Unit(52);
+
+ // tuple struct
+ let &TupleStruct(kk, ll) = &TupleStruct(53.0, 54);
+
+ // tuple struct with ref binding
+ let &TupleStruct(mm, ref nn) = &TupleStruct(55.0, 56);
+
+ zzz(); // #break
+}
+
+fn zzz() { () }
diff --git a/src/test/debuginfo/drop-locations.rs b/src/test/debuginfo/drop-locations.rs
new file mode 100644
index 000000000..c195f4620
--- /dev/null
+++ b/src/test/debuginfo/drop-locations.rs
@@ -0,0 +1,83 @@
+// ignore-windows
+// ignore-android
+// ignore-test // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155
+// min-lldb-version: 310
+
+#![allow(unused)]
+
+// compile-flags:-g -O -C no-prepopulate-passes
+// -O -C no-prepopulate-passes added to work around https://bugs.llvm.org/show_bug.cgi?id=32123
+
+// This test checks that drop glue code gets attributed to scope's closing brace,
+// and function epilogues - to function's closing brace.
+
+// === GDB TESTS ===================================================================================
+
+// gdb-command:run
+// gdb-command:next
+// gdb-command:frame
+// gdb-check:[...]#loc1[...]
+// gdb-command:next
+// gdb-command:frame
+// gdb-check:[...]#loc2[...]
+// gdb-command:next
+// gdb-command:frame
+// gdb-check:[...]#loc3[...]
+// gdb-command:next
+// gdb-command:frame
+// gdb-check:[...]#loc4[...]
+// gdb-command:next
+// gdb-command:frame
+// gdb-check:[...]#loc5[...]
+// gdb-command:next
+// gdb-command:frame
+// gdb-check:[...]#loc6[...]
+
+// === LLDB TESTS ==================================================================================
+
+// lldb-command:set set stop-line-count-before 0
+// lldb-command:set set stop-line-count-after 1
+// Can't set both to zero or lldb will stop printing source at all. So it will output the current
+// line and the next. We deal with this by having at least 2 lines between the #loc's
+
+// lldb-command:run
+// lldb-command:next
+// lldb-command:frame select
+// lldb-check:[...]#loc1[...]
+// lldb-command:next
+// lldb-command:frame select
+// lldb-check:[...]#loc2[...]
+// lldb-command:next
+// lldb-command:frame select
+// lldb-check:[...]#loc3[...]
+// lldb-command:next
+// lldb-command:frame select
+// lldb-check:[...]#loc4[...]
+// lldb-command:next
+// lldb-command:frame select
+// lldb-check:[...]#loc5[...]
+// lldb-command:next
+// lldb-command:frame select
+// lldb-check:[...]#loc6[...]
+
+fn main() {
+
+ foo();
+
+ zzz(); // #loc5
+
+} // #loc6
+
+fn foo() {
+ {
+ let s = String::from("s"); // #break
+
+ zzz(); // #loc1
+
+ } // #loc2
+
+ zzz(); // #loc3
+
+} // #loc4
+
+fn zzz() {()}
diff --git a/src/test/debuginfo/duration-type.rs b/src/test/debuginfo/duration-type.rs
new file mode 100644
index 000000000..bc0266d64
--- /dev/null
+++ b/src/test/debuginfo/duration-type.rs
@@ -0,0 +1,22 @@
+// only-cdb
+// compile-flags:-g
+
+// === CDB TESTS ==================================================================================
+
+// cdb-command: g
+
+// cdb-command: dx duration
+// cdb-check:duration : 5s 12ns [Type: core::time::Duration]
+// cdb-check: [<Raw View>] [Type: core::time::Duration]
+// cdb-check: seconds : 5 [Type: unsigned __int64]
+// cdb-check: nanoseconds : 12 [Type: unsigned int]
+
+use std::time::Duration;
+
+fn main() {
+ let duration = Duration::new(5, 12);
+
+ zzz(); // #break
+}
+
+fn zzz() { }
diff --git a/src/test/debuginfo/embedded-visualizer-point.natvis b/src/test/debuginfo/embedded-visualizer-point.natvis
new file mode 100644
index 000000000..d7bf6885d
--- /dev/null
+++ b/src/test/debuginfo/embedded-visualizer-point.natvis
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
+ <Type Name="embedded_visualizer::point::Point">
+ <DisplayString>({x}, {y})</DisplayString>
+ <Expand>
+ <Item Name="[x]">x</Item>
+ <Item Name="[y]">y</Item>
+ </Expand>
+ </Type>
+</AutoVisualizer>
diff --git a/src/test/debuginfo/embedded-visualizer-point.py b/src/test/debuginfo/embedded-visualizer-point.py
new file mode 100644
index 000000000..d6b1af007
--- /dev/null
+++ b/src/test/debuginfo/embedded-visualizer-point.py
@@ -0,0 +1,23 @@
+import gdb
+
+class PointPrinter:
+ "Print a Point"
+
+ def __init__(self, val):
+ self.val = val
+ self.x = int(val["x"])
+ self.y = int(val["y"])
+
+ def to_string(self):
+ return "({}, {})".format(self.x, self.y)
+
+def lookup(val):
+ lookup_tag = val.type.tag
+ if lookup_tag is None:
+ return None
+ if "embedded_visualizer::point::Point" == lookup_tag:
+ return PointPrinter(val)
+
+ return None
+
+gdb.current_objfile().pretty_printers.append(lookup)
diff --git a/src/test/debuginfo/embedded-visualizer.natvis b/src/test/debuginfo/embedded-visualizer.natvis
new file mode 100644
index 000000000..100437f90
--- /dev/null
+++ b/src/test/debuginfo/embedded-visualizer.natvis
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
+ <Type Name="embedded_visualizer::Line">
+ <DisplayString>({a}, {b})</DisplayString>
+ <Expand>
+ <Item Name="[a]">a</Item>
+ <Item Name="[b]">b</Item>
+ </Expand>
+ </Type>
+</AutoVisualizer>
diff --git a/src/test/debuginfo/embedded-visualizer.py b/src/test/debuginfo/embedded-visualizer.py
new file mode 100644
index 000000000..8e4fab616
--- /dev/null
+++ b/src/test/debuginfo/embedded-visualizer.py
@@ -0,0 +1,23 @@
+import gdb
+
+class LinePrinter:
+ "Print a Line"
+
+ def __init__(self, val):
+ self.val = val
+ self.a = val["a"]
+ self.b = val["b"]
+
+ def to_string(self):
+ return "({}, {})".format(self.a, self.b)
+
+def lookup(val):
+ lookup_tag = val.type.tag
+ if lookup_tag is None:
+ return None
+ if "embedded_visualizer::Line" == lookup_tag:
+ return LinePrinter(val)
+
+ return None
+
+gdb.current_objfile().pretty_printers.append(lookup)
diff --git a/src/test/debuginfo/embedded-visualizer.rs b/src/test/debuginfo/embedded-visualizer.rs
new file mode 100644
index 000000000..0269015b4
--- /dev/null
+++ b/src/test/debuginfo/embedded-visualizer.rs
@@ -0,0 +1,112 @@
+// compile-flags:-g
+// min-gdb-version: 8.1
+// ignore-lldb
+
+// === CDB TESTS ==================================================================================
+
+// cdb-command: g
+
+// The .nvlist command in cdb does not always have a deterministic output
+// for the order that NatVis files are displayed.
+
+// cdb-command: .nvlist
+// cdb-check: [...].exe (embedded NatVis "[...]embedded_visualizer-0.natvis")
+
+// cdb-command: .nvlist
+// cdb-check: [...].exe (embedded NatVis "[...]embedded_visualizer-1.natvis")
+
+// cdb-command: .nvlist
+// cdb-check: [...].exe (embedded NatVis "[...]embedded_visualizer-2.natvis")
+
+// cdb-command: dx point_a
+// cdb-check:point_a : (0, 0) [Type: embedded_visualizer::point::Point]
+// cdb-check: [<Raw View>] [Type: embedded_visualizer::point::Point]
+// cdb-check: [x] : 0 [Type: int]
+// cdb-check: [y] : 0 [Type: int]
+
+// cdb-command: dx point_b
+// cdb-check:point_b : (5, 8) [Type: embedded_visualizer::point::Point]
+// cdb-check: [<Raw View>] [Type: embedded_visualizer::point::Point]
+// cdb-check: [x] : 5 [Type: int]
+// cdb-check: [y] : 8 [Type: int]
+
+// cdb-command: dx line
+// cdb-check:line : ((0, 0), (5, 8)) [Type: embedded_visualizer::Line]
+// cdb-check: [<Raw View>] [Type: embedded_visualizer::Line]
+// cdb-check: [a] : (0, 0) [Type: embedded_visualizer::point::Point]
+// cdb-check: [b] : (5, 8) [Type: embedded_visualizer::point::Point]
+
+// cdb-command: dx person
+// cdb-check:person : "Person A" is 10 years old. [Type: dependency_with_embedded_visualizers::Person]
+// cdb-check: [<Raw View>] [Type: dependency_with_embedded_visualizers::Person]
+// cdb-check: [name] : "Person A" [Type: alloc::string::String]
+// cdb-check: [age] : 10 [Type: int]
+
+// === GDB TESTS ===================================================================================
+
+// gdb-command: run
+
+// gdb-command: info auto-load python-scripts
+// gdb-check:Yes pretty-printer-embedded_visualizer-0
+// gdb-check:Yes pretty-printer-embedded_visualizer-1
+// gdb-command: print point_a
+// gdb-check:$1 = (0, 0)
+// gdb-command: print point_b
+// gdb-check:$2 = (5, 8)
+// gdb-command: print line
+// gdb-check:$3 = ((0, 0), (5, 8))
+// gdb-command: print person
+// gdb-check:$4 = "Person A" is 10 years old.
+
+#![allow(unused_variables)]
+#![feature(debugger_visualizer)]
+#![debugger_visualizer(natvis_file = "embedded-visualizer.natvis")]
+#![debugger_visualizer(gdb_script_file = "embedded-visualizer.py")]
+
+// aux-build: dependency-with-embedded-visualizers.rs
+extern crate dependency_with_embedded_visualizers;
+
+use dependency_with_embedded_visualizers::Person;
+
+#[debugger_visualizer(natvis_file = "embedded-visualizer-point.natvis")]
+#[debugger_visualizer(gdb_script_file = "embedded-visualizer-point.py")]
+mod point {
+ pub struct Point {
+ x: i32,
+ y: i32,
+ }
+
+ impl Point {
+ pub fn new(x: i32, y: i32) -> Point {
+ Point { x: x, y: y }
+ }
+ }
+}
+
+use point::Point;
+
+pub struct Line {
+ a: Point,
+ b: Point,
+}
+
+impl Line {
+ pub fn new(a: Point, b: Point) -> Line {
+ Line { a: a, b: b }
+ }
+}
+
+fn main() {
+ let point_a = Point::new(0, 0);
+ let point_b = Point::new(5, 8);
+ let line = Line::new(point_a, point_b);
+
+ let name = String::from("Person A");
+ let person = Person::new(name, 10);
+
+ zzz(); // #break
+}
+
+fn zzz() {
+ ()
+}
diff --git a/src/test/debuginfo/empty-string.rs b/src/test/debuginfo/empty-string.rs
new file mode 100644
index 000000000..66eb8bae2
--- /dev/null
+++ b/src/test/debuginfo/empty-string.rs
@@ -0,0 +1,36 @@
+// ignore-windows failing on win32 bot
+// ignore-android: FIXME(#10381)
+// compile-flags:-g
+// min-gdb-version: 8.1
+// ignore-gdb-version: 7.11.90 - 8.0.9
+// min-lldb-version: 310
+
+// === GDB TESTS ===================================================================================
+
+// gdb-command: run
+
+// gdb-command: print empty_string
+// gdb-check:$1 = ""
+
+// gdb-command: print empty_str
+// gdb-check:$2 = ""
+
+// === LLDB TESTS ==================================================================================
+
+// lldb-command: run
+
+// lldb-command: fr v empty_string
+// lldb-check:[...]empty_string = "" { vec = size=0 }
+
+// lldb-command: fr v empty_str
+// lldb-check:[...]empty_str = "" { data_ptr = [...] length = 0 }
+
+fn main() {
+ let empty_string = String::new();
+
+ let empty_str = "";
+
+ zzz(); // #break
+}
+
+fn zzz() {}
diff --git a/src/test/debuginfo/enum-thinlto.rs b/src/test/debuginfo/enum-thinlto.rs
new file mode 100644
index 000000000..b10e04a4a
--- /dev/null
+++ b/src/test/debuginfo/enum-thinlto.rs
@@ -0,0 +1,46 @@
+// Require a gdb that can read DW_TAG_variant_part.
+// min-gdb-version: 8.2
+
+// compile-flags:-g -Z thinlto
+
+// === GDB TESTS ===================================================================================
+
+// gdb-command:run
+
+// gdb-command:print *abc
+// gdbr-check:$1 = enum_thinlto::ABC::TheA{x: 0, y: 8970181431921507452}
+
+// === LLDB TESTS ==================================================================================
+
+// lldb-command:run
+
+// lldb-command:print *abc
+// lldbg-check:(enum_thinlto::ABC) $0 =
+// lldbr-check:(enum_thinlto::ABC) *abc = (x = 0, y = 8970181431921507452)
+
+#![allow(unused_variables)]
+#![feature(omit_gdb_pretty_printer_section)]
+#![omit_gdb_pretty_printer_section]
+
+// The first element is to ensure proper alignment, irrespective of the machines word size. Since
+// the size of the discriminant value is machine dependent, this has be taken into account when
+// datatype layout should be predictable as in this case.
+#[derive(Debug)]
+enum ABC {
+ TheA { x: i64, y: i64 },
+ TheB (i64, i32, i32),
+}
+
+fn main() {
+ let abc = ABC::TheA { x: 0, y: 0x7c7c_7c7c_7c7c_7c7c };
+
+ f(&abc);
+}
+
+fn f(abc: &ABC) {
+ zzz(); // #break
+
+ println!("{:?}", abc);
+}
+
+fn zzz() {()}
diff --git a/src/test/debuginfo/evec-in-struct.rs b/src/test/debuginfo/evec-in-struct.rs
new file mode 100644
index 000000000..0d94cd224
--- /dev/null
+++ b/src/test/debuginfo/evec-in-struct.rs
@@ -0,0 +1,111 @@
+// min-lldb-version: 310
+
+// compile-flags:-g
+
+// === GDB TESTS ===================================================================================
+
+// gdb-command:run
+
+// gdb-command:print no_padding1
+// gdbg-check:$1 = {x = {0, 1, 2}, y = -3, z = {4.5, 5.5}}
+// gdbr-check:$1 = evec_in_struct::NoPadding1 {x: [0, 1, 2], y: -3, z: [4.5, 5.5]}
+// gdb-command:print no_padding2
+// gdbg-check:$2 = {x = {6, 7, 8}, y = {{9, 10}, {11, 12}}}
+// gdbr-check:$2 = evec_in_struct::NoPadding2 {x: [6, 7, 8], y: [[9, 10], [11, 12]]}
+
+// gdb-command:print struct_internal_padding
+// gdbg-check:$3 = {x = {13, 14}, y = {15, 16}}
+// gdbr-check:$3 = evec_in_struct::StructInternalPadding {x: [13, 14], y: [15, 16]}
+
+// gdb-command:print single_vec
+// gdbg-check:$4 = {x = {17, 18, 19, 20, 21}}
+// gdbr-check:$4 = evec_in_struct::SingleVec {x: [17, 18, 19, 20, 21]}
+
+// gdb-command:print struct_padded_at_end
+// gdbg-check:$5 = {x = {22, 23}, y = {24, 25}}
+// gdbr-check:$5 = evec_in_struct::StructPaddedAtEnd {x: [22, 23], y: [24, 25]}
+
+
+// === LLDB TESTS ==================================================================================
+
+// lldb-command:run
+
+// lldb-command:print no_padding1
+// lldbg-check:[...]$0 = { x = { [0] = 0 [1] = 1 [2] = 2 } y = -3 z = { [0] = 4.5 [1] = 5.5 } }
+// lldbr-check:(evec_in_struct::NoPadding1) no_padding1 = { x = { [0] = 0 [1] = 1 [2] = 2 } y = -3 z = { [0] = 4.5 [1] = 5.5 } }
+// lldb-command:print no_padding2
+// lldbg-check:[...]$1 = { x = { [0] = 6 [1] = 7 [2] = 8 } y = { [0] = { [0] = 9 [1] = 10 } [1] = { [0] = 11 [1] = 12 } } }
+// lldbr-check:(evec_in_struct::NoPadding2) no_padding2 = { x = { [0] = 6 [1] = 7 [2] = 8 } y = { [0] = { [0] = 9 [1] = 10 } [1] = { [0] = 11 [1] = 12 } } }
+
+// lldb-command:print struct_internal_padding
+// lldbg-check:[...]$2 = { x = { [0] = 13 [1] = 14 } y = { [0] = 15 [1] = 16 } }
+// lldbr-check:(evec_in_struct::StructInternalPadding) struct_internal_padding = { x = { [0] = 13 [1] = 14 } y = { [0] = 15 [1] = 16 } }
+
+// lldb-command:print single_vec
+// lldbg-check:[...]$3 = { x = { [0] = 17 [1] = 18 [2] = 19 [3] = 20 [4] = 21 } }
+// lldbr-check:(evec_in_struct::SingleVec) single_vec = { x = { [0] = 17 [1] = 18 [2] = 19 [3] = 20 [4] = 21 } }
+
+// lldb-command:print struct_padded_at_end
+// lldbg-check:[...]$4 = { x = { [0] = 22 [1] = 23 } y = { [0] = 24 [1] = 25 } }
+// lldbr-check:(evec_in_struct::StructPaddedAtEnd) struct_padded_at_end = { x = { [0] = 22 [1] = 23 } y = { [0] = 24 [1] = 25 } }
+
+#![allow(unused_variables)]
+#![feature(omit_gdb_pretty_printer_section)]
+#![omit_gdb_pretty_printer_section]
+
+struct NoPadding1 {
+ x: [u32; 3],
+ y: i32,
+ z: [f32; 2]
+}
+
+struct NoPadding2 {
+ x: [u32; 3],
+ y: [[u32; 2]; 2]
+}
+
+struct StructInternalPadding {
+ x: [i16; 2],
+ y: [i64; 2]
+}
+
+struct SingleVec {
+ x: [i16; 5]
+}
+
+struct StructPaddedAtEnd {
+ x: [i64; 2],
+ y: [i16; 2]
+}
+
+fn main() {
+
+ let no_padding1 = NoPadding1 {
+ x: [0, 1, 2],
+ y: -3,
+ z: [4.5, 5.5]
+ };
+
+ let no_padding2 = NoPadding2 {
+ x: [6, 7, 8],
+ y: [[9, 10], [11, 12]]
+ };
+
+ let struct_internal_padding = StructInternalPadding {
+ x: [13, 14],
+ y: [15, 16]
+ };
+
+ let single_vec = SingleVec {
+ x: [17, 18, 19, 20, 21]
+ };
+
+ let struct_padded_at_end = StructPaddedAtEnd {
+ x: [22, 23],
+ y: [24, 25]
+ };
+
+ zzz(); // #break
+}
+
+fn zzz() { () }
diff --git a/src/test/debuginfo/extern-c-fn.rs b/src/test/debuginfo/extern-c-fn.rs
new file mode 100644
index 000000000..17a452ec6
--- /dev/null
+++ b/src/test/debuginfo/extern-c-fn.rs
@@ -0,0 +1,63 @@
+// min-lldb-version: 310
+
+// compile-flags:-g
+
+// === GDB TESTS ===================================================================================
+// gdb-command:run
+
+// gdb-command:printf "s = \"%s\"\n", s
+// gdb-check:s = "abcd"
+// gdb-command:print len
+// gdb-check:$1 = 20
+// gdb-command:print local0
+// gdb-check:$2 = 19
+// gdb-command:print local1
+// gdb-check:$3 = true
+// gdb-command:print local2
+// gdb-check:$4 = 20.5
+
+// gdb-command:continue
+
+// === LLDB TESTS ==================================================================================
+// lldb-command:run
+
+// lldb-command:print len
+// lldbg-check:[...]$0 = 20
+// lldbr-check:(i32) len = 20
+// lldb-command:print local0
+// lldbg-check:[...]$1 = 19
+// lldbr-check:(i32) local0 = 19
+// lldb-command:print local1
+// lldbg-check:[...]$2 = true
+// lldbr-check:(bool) local1 = true
+// lldb-command:print local2
+// lldbg-check:[...]$3 = 20.5
+// lldbr-check:(f64) local2 = 20.5
+
+// lldb-command:continue
+
+#![allow(unused_variables)]
+#![allow(dead_code)]
+#![feature(omit_gdb_pretty_printer_section)]
+#![omit_gdb_pretty_printer_section]
+
+
+#[no_mangle]
+pub unsafe extern "C" fn fn_with_c_abi(s: *const u8, len: i32) -> i32 {
+ let local0 = len - 1;
+ let local1 = len > 2;
+ let local2 = (len as f64) + 0.5;
+
+ zzz(); // #break
+
+ return 0;
+}
+
+fn main() {
+ unsafe {
+ fn_with_c_abi(b"abcd\0".as_ptr(), 20);
+ }
+}
+
+#[inline(never)]
+fn zzz() {()}
diff --git a/src/test/debuginfo/fixed-sized-array.rs b/src/test/debuginfo/fixed-sized-array.rs
new file mode 100644
index 000000000..d8899224d
--- /dev/null
+++ b/src/test/debuginfo/fixed-sized-array.rs
@@ -0,0 +1,39 @@
+// Testing the display of fixed sized arrays in cdb.
+
+// cdb-only
+// min-cdb-version: 10.0.18317.1001
+// compile-flags:-g
+
+// === CDB TESTS ==================================================================================
+
+// cdb-command: g
+
+// cdb-command: dx xs,d
+// cdb-check:xs,d [Type: int [5]]
+// cdb-check: [0] : 1 [Type: int]
+// cdb-check: [1] : 2 [Type: int]
+// cdb-check: [2] : 3 [Type: int]
+// cdb-check: [3] : 4 [Type: int]
+// cdb-check: [4] : 5 [Type: int]
+
+// cdb-command: dx ys,d
+// cdb-check:ys,d [Type: int [3]]
+// cdb-check: [0] : 0 [Type: int]
+// cdb-check: [1] : 0 [Type: int]
+// cdb-check: [2] : 0 [Type: int]
+
+fn main() {
+ // Fixed-size array (type signature is superfluous)
+ let xs: [i32; 5] = [1, 2, 3, 4, 5];
+
+ // All elements can be initialized to the same value
+ let ys: [i32; 3] = [0; 3];
+
+ // Indexing starts at 0
+ println!("first element of the array: {}", xs[0]);
+ println!("second element of the array: {}", xs[1]);
+
+ zzz(); // #break
+}
+
+fn zzz() { () }
diff --git a/src/test/debuginfo/function-arg-initialization.rs b/src/test/debuginfo/function-arg-initialization.rs
new file mode 100644
index 000000000..dea133951
--- /dev/null
+++ b/src/test/debuginfo/function-arg-initialization.rs
@@ -0,0 +1,330 @@
+// ignore-test // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155
+// min-lldb-version: 310
+
+// This test case checks if function arguments already have the correct value
+// when breaking at the first line of the function, that is if the function
+// prologue has already been executed at the first line. Note that because of
+// the __morestack part of the prologue GDB incorrectly breaks at before the
+// arguments have been properly loaded when setting the breakpoint via the
+// function name.
+
+// compile-flags:-g
+
+// === GDB TESTS ===================================================================================
+
+// gdb-command:run
+
+// IMMEDIATE ARGS
+// gdb-command:print a
+// gdb-check:$1 = 1
+// gdb-command:print b
+// gdb-check:$2 = true
+// gdb-command:print c
+// gdb-check:$3 = 2.5
+// gdb-command:continue
+
+// NON IMMEDIATE ARGS
+// gdb-command:print a
+// gdbg-check:$4 = {a = 3, b = 4, c = 5, d = 6, e = 7, f = 8, g = 9, h = 10}
+// gdbt-check:$4 = function_arg_initialization::BigStruct {a: 3, b: 4, c: 5, d: 6, e: 7, f: 8, g: 9, h: 10}
+// gdb-command:print b
+// gdbg-check:$5 = {a = 11, b = 12, c = 13, d = 14, e = 15, f = 16, g = 17, h = 18}
+// gdbt-check:$5 = function_arg_initialization::BigStruct {a: 11, b: 12, c: 13, d: 14, e: 15, f: 16, g: 17, h: 18}
+// gdb-command:continue
+
+// BINDING
+// gdb-command:print a
+// gdb-check:$6 = 19
+// gdb-command:print b
+// gdb-check:$7 = 20
+// gdb-command:print c
+// gdb-check:$8 = 21.5
+// gdb-command:continue
+
+// ASSIGNMENT
+// gdb-command:print a
+// gdb-check:$9 = 22
+// gdb-command:print b
+// gdb-check:$10 = 23
+// gdb-command:print c
+// gdb-check:$11 = 24.5
+// gdb-command:continue
+
+// FUNCTION CALL
+// gdb-command:print x
+// gdb-check:$12 = 25
+// gdb-command:print y
+// gdb-check:$13 = 26
+// gdb-command:print z
+// gdb-check:$14 = 27.5
+// gdb-command:continue
+
+// EXPR
+// gdb-command:print x
+// gdb-check:$15 = 28
+// gdb-command:print y
+// gdb-check:$16 = 29
+// gdb-command:print z
+// gdb-check:$17 = 30.5
+// gdb-command:continue
+
+// RETURN EXPR
+// gdb-command:print x
+// gdb-check:$18 = 31
+// gdb-command:print y
+// gdb-check:$19 = 32
+// gdb-command:print z
+// gdb-check:$20 = 33.5
+// gdb-command:continue
+
+// ARITHMETIC EXPR
+// gdb-command:print x
+// gdb-check:$21 = 34
+// gdb-command:print y
+// gdb-check:$22 = 35
+// gdb-command:print z
+// gdb-check:$23 = 36.5
+// gdb-command:continue
+
+// IF EXPR
+// gdb-command:print x
+// gdb-check:$24 = 37
+// gdb-command:print y
+// gdb-check:$25 = 38
+// gdb-command:print z
+// gdb-check:$26 = 39.5
+// gdb-command:continue
+
+// WHILE EXPR
+// gdb-command:print x
+// gdb-check:$27 = 40
+// gdb-command:print y
+// gdb-check:$28 = 41
+// gdb-command:print z
+// gdb-check:$29 = 42
+// gdb-command:continue
+
+// LOOP EXPR
+// gdb-command:print x
+// gdb-check:$30 = 43
+// gdb-command:print y
+// gdb-check:$31 = 44
+// gdb-command:print z
+// gdb-check:$32 = 45
+// gdb-command:continue
+
+
+// === LLDB TESTS ==================================================================================
+
+// lldb-command:run
+
+// IMMEDIATE ARGS
+// lldb-command:print a
+// lldb-check:[...]$0 = 1
+// lldb-command:print b
+// lldb-check:[...]$1 = true
+// lldb-command:print c
+// lldb-check:[...]$2 = 2.5
+// lldb-command:continue
+
+// NON IMMEDIATE ARGS
+// lldb-command:print a
+// lldb-check:[...]$3 = BigStruct { a: 3, b: 4, c: 5, d: 6, e: 7, f: 8, g: 9, h: 10 }
+// lldb-command:print b
+// lldb-check:[...]$4 = BigStruct { a: 11, b: 12, c: 13, d: 14, e: 15, f: 16, g: 17, h: 18 }
+// lldb-command:continue
+
+// BINDING
+// lldb-command:print a
+// lldb-check:[...]$5 = 19
+// lldb-command:print b
+// lldb-check:[...]$6 = 20
+// lldb-command:print c
+// lldb-check:[...]$7 = 21.5
+// lldb-command:continue
+
+// ASSIGNMENT
+// lldb-command:print a
+// lldb-check:[...]$8 = 22
+// lldb-command:print b
+// lldb-check:[...]$9 = 23
+// lldb-command:print c
+// lldb-check:[...]$10 = 24.5
+// lldb-command:continue
+
+// FUNCTION CALL
+// lldb-command:print x
+// lldb-check:[...]$11 = 25
+// lldb-command:print y
+// lldb-check:[...]$12 = 26
+// lldb-command:print z
+// lldb-check:[...]$13 = 27.5
+// lldb-command:continue
+
+// EXPR
+// lldb-command:print x
+// lldb-check:[...]$14 = 28
+// lldb-command:print y
+// lldb-check:[...]$15 = 29
+// lldb-command:print z
+// lldb-check:[...]$16 = 30.5
+// lldb-command:continue
+
+// RETURN EXPR
+// lldb-command:print x
+// lldb-check:[...]$17 = 31
+// lldb-command:print y
+// lldb-check:[...]$18 = 32
+// lldb-command:print z
+// lldb-check:[...]$19 = 33.5
+// lldb-command:continue
+
+// ARITHMETIC EXPR
+// lldb-command:print x
+// lldb-check:[...]$20 = 34
+// lldb-command:print y
+// lldb-check:[...]$21 = 35
+// lldb-command:print z
+// lldb-check:[...]$22 = 36.5
+// lldb-command:continue
+
+// IF EXPR
+// lldb-command:print x
+// lldb-check:[...]$23 = 37
+// lldb-command:print y
+// lldb-check:[...]$24 = 38
+// lldb-command:print z
+// lldb-check:[...]$25 = 39.5
+// lldb-command:continue
+
+// WHILE EXPR
+// lldb-command:print x
+// lldb-check:[...]$26 = 40
+// lldb-command:print y
+// lldb-check:[...]$27 = 41
+// lldb-command:print z
+// lldb-check:[...]$28 = 42
+// lldb-command:continue
+
+// LOOP EXPR
+// lldb-command:print x
+// lldb-check:[...]$29 = 43
+// lldb-command:print y
+// lldb-check:[...]$30 = 44
+// lldb-command:print z
+// lldb-check:[...]$31 = 45
+// lldb-command:continue
+
+
+#![allow(unused_variables)]
+#![feature(omit_gdb_pretty_printer_section)]
+#![omit_gdb_pretty_printer_section]
+
+fn immediate_args(a: isize, b: bool, c: f64) {
+ zzz(); // #break
+}
+
+struct BigStruct {
+ a: u64,
+ b: u64,
+ c: u64,
+ d: u64,
+ e: u64,
+ f: u64,
+ g: u64,
+ h: u64
+}
+
+fn non_immediate_args(a: BigStruct, b: BigStruct) {
+ zzz(); // #break
+}
+
+fn binding(a: i64, b: u64, c: f64) {
+ let x = 0; // #break
+ println!()
+}
+
+fn assignment(mut a: u64, b: u64, c: f64) {
+ a = b; // #break
+ println!()
+}
+
+fn function_call(x: u64, y: u64, z: f64) {
+ zzz(); // #break
+}
+
+fn identifier(x: u64, y: u64, z: f64) -> u64 {
+ x // #break
+}
+
+fn return_expr(x: u64, y: u64, z: f64) -> u64 {
+ return x; // #break
+}
+
+fn arithmetic_expr(x: u64, y: u64, z: f64) -> u64 {
+ x + y // #break
+}
+
+fn if_expr(x: u64, y: u64, z: f64) -> u64 {
+ if x + y < 1000 { // #break
+ x
+ } else {
+ y
+ }
+}
+
+fn while_expr(mut x: u64, y: u64, z: u64) -> u64 {
+ while x + y > 1000 { // #break
+ x += z
+ }
+ return x;
+}
+
+fn loop_expr(mut x: u64, y: u64, z: u64) -> u64 {
+ loop {
+ x += z; // #break
+
+ if x + y > 1000 {
+ return x;
+ }
+ }
+}
+
+fn main() {
+ immediate_args(1, true, 2.5);
+
+ non_immediate_args(
+ BigStruct {
+ a: 3,
+ b: 4,
+ c: 5,
+ d: 6,
+ e: 7,
+ f: 8,
+ g: 9,
+ h: 10
+ },
+ BigStruct {
+ a: 11,
+ b: 12,
+ c: 13,
+ d: 14,
+ e: 15,
+ f: 16,
+ g: 17,
+ h: 18
+ }
+ );
+
+ binding(19, 20, 21.5);
+ assignment(22, 23, 24.5);
+ function_call(25, 26, 27.5);
+ identifier(28, 29, 30.5);
+ return_expr(31, 32, 33.5);
+ arithmetic_expr(34, 35, 36.5);
+ if_expr(37, 38, 39.5);
+ while_expr(40, 41, 42);
+ loop_expr(43, 44, 45);
+}
+
+fn zzz() {()}
diff --git a/src/test/debuginfo/function-arguments.rs b/src/test/debuginfo/function-arguments.rs
new file mode 100644
index 000000000..5cfd7d1f8
--- /dev/null
+++ b/src/test/debuginfo/function-arguments.rs
@@ -0,0 +1,62 @@
+// min-lldb-version: 310
+
+// compile-flags:-g
+
+// === GDB TESTS ===================================================================================
+
+// gdb-command:run
+
+// gdb-command:print x
+// gdb-check:$1 = 111102
+// gdb-command:print y
+// gdb-check:$2 = true
+// gdb-command:continue
+
+// gdb-command:print a
+// gdb-check:$3 = 2000
+// gdb-command:print b
+// gdb-check:$4 = 3000
+// gdb-command:continue
+
+// === LLDB TESTS ==================================================================================
+
+// lldb-command:run
+
+// lldb-command:print x
+// lldbg-check:[...]$0 = 111102
+// lldbr-check:(isize) x = 111102
+// lldb-command:print y
+// lldbg-check:[...]$1 = true
+// lldbr-check:(bool) y = true
+// lldb-command:continue
+
+// lldb-command:print a
+// lldbg-check:[...]$2 = 2000
+// lldbr-check:(i32) a = 2000
+// lldb-command:print b
+// lldbg-check:[...]$3 = 3000
+// lldbr-check:(i64) b = 3000
+// lldb-command:continue
+
+
+#![feature(omit_gdb_pretty_printer_section)]
+#![omit_gdb_pretty_printer_section]
+
+fn main() {
+
+ fun(111102, true);
+ nested(2000, 3000);
+
+ fn nested(a: i32, b: i64) -> (i32, i64) {
+ zzz(); // #break
+ (a, b)
+ }
+}
+
+fn fun(x: isize, y: bool) -> (isize, bool) {
+ zzz(); // #break
+
+ (x, y)
+}
+
+fn zzz() { () }
diff --git a/src/test/debuginfo/function-call.rs b/src/test/debuginfo/function-call.rs
new file mode 100644
index 000000000..75334558b
--- /dev/null
+++ b/src/test/debuginfo/function-call.rs
@@ -0,0 +1,42 @@
+// This test does not passed with gdb < 8.0. See #53497.
+// min-gdb-version: 10.1
+
+// compile-flags:-g
+
+// === GDB TESTS ===================================================================================
+
+// gdb-command:run
+
+// gdb-command:print fun(45, true)
+// gdb-check:$1 = true
+// gdb-command:print fun(444, false)
+// gdb-check:$2 = false
+
+// gdb-command:print r.get_x()
+// gdb-check:$3 = 4
+
+#![allow(dead_code, unused_variables)]
+
+struct RegularStruct {
+ x: i32
+}
+
+impl RegularStruct {
+ fn get_x(&self) -> i32 {
+ self.x
+ }
+}
+
+fn main() {
+ let _ = fun(4, true);
+ let r = RegularStruct{x: 4};
+ let _ = r.get_x();
+
+ zzz(); // #break
+}
+
+fn fun(x: isize, y: bool) -> bool {
+ y
+}
+
+fn zzz() { () }
diff --git a/src/test/debuginfo/function-names.rs b/src/test/debuginfo/function-names.rs
new file mode 100644
index 000000000..60fb06d40
--- /dev/null
+++ b/src/test/debuginfo/function-names.rs
@@ -0,0 +1,205 @@
+// Function names are formatted differently in old versions of GDB
+// min-gdb-version: 10.1
+
+// compile-flags:-g
+
+// === GDB TESTS ===================================================================================
+
+// Top-level function
+// gdb-command:info functions -q function_names::main
+// gdb-check:[...]static fn function_names::main();
+// gdb-command:info functions -q function_names::generic_func<*
+// gdb-check:[...]static fn function_names::generic_func<i32>(i32) -> i32;
+
+// Implementations
+// gdb-command:info functions -q function_names::.*::impl_function.*
+// gdb-check:[...]static fn function_names::GenericStruct<i32, i32>::impl_function<i32, i32>();
+// gdb-check:[...]static fn function_names::Mod1::TestStruct2::impl_function();
+// gdb-check:[...]static fn function_names::TestStruct1::impl_function();
+
+// Trait implementations
+// gdb-command:info functions -q function_names::.*::trait_function.*
+// gdb-check:[...]static fn function_names::Mod1::{impl#1}::trait_function();
+// gdb-check:[...]static fn function_names::{impl#1}::trait_function();
+// gdb-check:[...]static fn function_names::{impl#3}::trait_function<i32>();
+// gdb-check:[...]static fn function_names::{impl#5}::trait_function3<function_names::TestStruct1>();
+// gdb-check:[...]static fn function_names::{impl#6}::trait_function<i32, 1>();
+
+// Closure
+// gdb-command:info functions -q function_names::.*::{closure.*
+// gdb-check:[...]static fn function_names::generic_func::{closure#0}<i32>(*mut function_names::generic_func::{closure_env#0}<i32>);
+// gdb-check:[...]static fn function_names::main::{closure#0}(*mut function_names::main::{closure_env#0});
+// gdb-check:[...]static fn function_names::{impl#2}::impl_function::{closure#0}<i32, i32>(*mut function_names::{impl#2}::impl_function::{closure_env#0}<i32, i32>);
+
+// Generator
+// Generators don't seem to appear in GDB's symbol table.
+
+// Const generic parameter
+// gdb-command:info functions -q function_names::const_generic_fn.*
+// gdb-check:[...]static fn function_names::const_generic_fn_bool<false>();
+// gdb-check:[...]static fn function_names::const_generic_fn_non_int<{CONST#6348c650c7b26618}>();
+// gdb-check:[...]static fn function_names::const_generic_fn_signed_int<-7>();
+// gdb-check:[...]static fn function_names::const_generic_fn_unsigned_int<14>();
+
+// === CDB TESTS ===================================================================================
+
+// Top-level function
+// cdb-command:x a!function_names::main
+// cdb-check:[...] a!function_names::main (void)
+// cdb-command:x a!function_names::generic_func<*
+// cdb-check:[...] a!function_names::generic_func<i32> (int)
+
+// Implementations
+// cdb-command:x a!function_names::*::impl_function*
+// cdb-check:[...] a!function_names::Mod1::TestStruct2::impl_function (void)
+// cdb-check:[...] a!function_names::TestStruct1::impl_function (void)
+// cdb-check:[...] a!function_names::GenericStruct<i32,i32>::impl_function<i32,i32> (void)
+
+// Trait implementations
+// cdb-command:x a!function_names::*::trait_function*
+// cdb-check:[...] a!function_names::impl$3::trait_function<i32> (void)
+// cdb-check:[...] a!function_names::impl$6::trait_function<i32,1> (void)
+// cdb-check:[...] a!function_names::impl$1::trait_function (void)
+// cdb-check:[...] a!function_names::impl$5::trait_function3<function_names::TestStruct1> (void)
+// cdb-check:[...] a!function_names::Mod1::impl$1::trait_function (void)
+
+// Closure
+// cdb-command:x a!function_names::*::closure*
+// cdb-check:[...] a!function_names::impl$2::impl_function::closure$0<i32,i32> (void)
+// cdb-check:[...] a!function_names::main::closure$0 (void)
+// cdb-check:[...] a!function_names::generic_func::closure$0<i32> (void)
+
+// Generator
+// cdb-command:x a!function_names::*::generator*
+// cdb-check:[...] a!function_names::main::generator$1 (void)
+
+// Const generic parameter
+// cdb-command:x a!function_names::const_generic_fn*
+// cdb-check:[...] a!function_names::const_generic_fn_bool<false> (void)
+// cdb-check:[...] a!function_names::const_generic_fn_non_int<CONST$6348c650c7b26618> (void)
+// cdb-check:[...] a!function_names::const_generic_fn_unsigned_int<14> (void)
+// cdb-check:[...] a!function_names::const_generic_fn_signed_int<-7> (void)
+
+#![allow(unused_variables)]
+#![feature(omit_gdb_pretty_printer_section)]
+#![omit_gdb_pretty_printer_section]
+#![feature(adt_const_params, generators, generator_trait)]
+#![allow(incomplete_features)]
+
+use std::ops::Generator;
+use std::pin::Pin;
+use Mod1::TestTrait2;
+
+fn main() {
+ // Implementations
+ TestStruct1::impl_function();
+ Mod1::TestStruct2::impl_function();
+ GenericStruct::<i32, i32>::impl_function();
+
+ // Trait implementations
+ TestStruct1::trait_function();
+ Mod1::TestStruct2::trait_function();
+ GenericStruct::<i32, i32>::trait_function();
+ GenericStruct::<[i32; 1], f32>::trait_function();
+ GenericStruct::<TestStruct1, usize>::trait_function3();
+
+ // Generic function
+ let _ = generic_func(42i32);
+
+ // Closure
+ let closure = || TestStruct1;
+ closure();
+
+ // Generator
+ let mut generator = || {
+ yield;
+ return;
+ };
+ Pin::new(&mut generator).resume(());
+
+ // Const generic functions
+ const_generic_fn_bool::<false>();
+ const_generic_fn_non_int::<{ () }>();
+ const_generic_fn_signed_int::<-7>();
+ const_generic_fn_unsigned_int::<14>();
+}
+
+struct TestStruct1;
+trait TestTrait1 {
+ fn trait_function();
+}
+
+// Implementation
+impl TestStruct1 {
+ pub fn impl_function() {}
+}
+
+// Implementation for a trait
+impl TestTrait1 for TestStruct1 {
+ fn trait_function() {}
+}
+
+// Implementation and implementation within a mod
+mod Mod1 {
+ pub struct TestStruct2;
+ pub trait TestTrait2 {
+ fn trait_function();
+ }
+
+ impl TestStruct2 {
+ pub fn impl_function() {}
+ }
+
+ impl TestTrait2 for TestStruct2 {
+ fn trait_function() {}
+ }
+}
+
+struct GenericStruct<T1, T2>(std::marker::PhantomData<(T1, T2)>);
+
+// Generic implementation
+impl<T1, T2> GenericStruct<T1, T2> {
+ pub fn impl_function() {
+ // Closure in a generic implementation
+ let closure = || TestStruct1;
+ closure();
+ }
+}
+
+// Generic trait implementation
+impl<T> TestTrait1 for GenericStruct<T, i32> {
+ fn trait_function() {}
+}
+
+// Implementation based on associated type
+trait TestTrait3 {
+ type AssocType;
+ fn trait_function3();
+}
+impl TestTrait3 for TestStruct1 {
+ type AssocType = usize;
+ fn trait_function3() {}
+}
+impl<T: TestTrait3> TestTrait3 for GenericStruct<T, T::AssocType> {
+ type AssocType = T::AssocType;
+ fn trait_function3() {}
+}
+
+// Generic trait implementation with const generics
+impl<T, const N: usize> TestTrait1 for GenericStruct<[T; N], f32> {
+ fn trait_function() {}
+}
+
+// Generic function
+fn generic_func<T>(value: T) -> T {
+ // Closure in a generic function
+ let closure = || TestStruct1;
+ closure();
+
+ value
+}
+
+fn const_generic_fn_bool<const C: bool>() {}
+fn const_generic_fn_non_int<const C: ()>() {}
+fn const_generic_fn_signed_int<const C: i64>() {}
+fn const_generic_fn_unsigned_int<const C: u32>() {}
diff --git a/src/test/debuginfo/function-prologue-stepping-regular.rs b/src/test/debuginfo/function-prologue-stepping-regular.rs
new file mode 100644
index 000000000..699ff84ee
--- /dev/null
+++ b/src/test/debuginfo/function-prologue-stepping-regular.rs
@@ -0,0 +1,226 @@
+// This test case checks if function arguments already have the correct value when breaking at the
+// beginning of a function.
+
+// min-lldb-version: 310
+// ignore-gdb
+// ignore-test // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155
+// compile-flags:-g
+
+// lldb-command:breakpoint set --name immediate_args
+// lldb-command:breakpoint set --name non_immediate_args
+// lldb-command:breakpoint set --name binding
+// lldb-command:breakpoint set --name assignment
+// lldb-command:breakpoint set --name function_call
+// lldb-command:breakpoint set --name identifier
+// lldb-command:breakpoint set --name return_expr
+// lldb-command:breakpoint set --name arithmetic_expr
+// lldb-command:breakpoint set --name if_expr
+// lldb-command:breakpoint set --name while_expr
+// lldb-command:breakpoint set --name loop_expr
+// lldb-command:run
+
+// IMMEDIATE ARGS
+// lldb-command:print a
+// lldb-check:[...]$0 = 1
+// lldb-command:print b
+// lldb-check:[...]$1 = true
+// lldb-command:print c
+// lldb-check:[...]$2 = 2.5
+// lldb-command:continue
+
+// NON IMMEDIATE ARGS
+// lldb-command:print a
+// lldb-check:[...]$3 = { a = 3, b = 4, c = 5, d = 6, e = 7, f = 8, g = 9, h = 10 }
+// lldb-command:print b
+// lldb-check:[...]$4 = { a = 11, b = 12, c = 13, d = 14, e = 15, f = 16, g = 17, h = 18 }
+// lldb-command:continue
+
+// BINDING
+// lldb-command:print a
+// lldb-check:[...]$5 = 19
+// lldb-command:print b
+// lldb-check:[...]$6 = 20
+// lldb-command:print c
+// lldb-check:[...]$7 = 21.5
+// lldb-command:continue
+
+// ASSIGNMENT
+// lldb-command:print a
+// lldb-check:[...]$8 = 22
+// lldb-command:print b
+// lldb-check:[...]$9 = 23
+// lldb-command:print c
+// lldb-check:[...]$10 = 24.5
+// lldb-command:continue
+
+// FUNCTION CALL
+// lldb-command:print x
+// lldb-check:[...]$11 = 25
+// lldb-command:print y
+// lldb-check:[...]$12 = 26
+// lldb-command:print z
+// lldb-check:[...]$13 = 27.5
+// lldb-command:continue
+
+// EXPR
+// lldb-command:print x
+// lldb-check:[...]$14 = 28
+// lldb-command:print y
+// lldb-check:[...]$15 = 29
+// lldb-command:print z
+// lldb-check:[...]$16 = 30.5
+// lldb-command:continue
+
+// RETURN EXPR
+// lldb-command:print x
+// lldb-check:[...]$17 = 31
+// lldb-command:print y
+// lldb-check:[...]$18 = 32
+// lldb-command:print z
+// lldb-check:[...]$19 = 33.5
+// lldb-command:continue
+
+// ARITHMETIC EXPR
+// lldb-command:print x
+// lldb-check:[...]$20 = 34
+// lldb-command:print y
+// lldb-check:[...]$21 = 35
+// lldb-command:print z
+// lldb-check:[...]$22 = 36.5
+// lldb-command:continue
+
+// IF EXPR
+// lldb-command:print x
+// lldb-check:[...]$23 = 37
+// lldb-command:print y
+// lldb-check:[...]$24 = 38
+// lldb-command:print z
+// lldb-check:[...]$25 = 39.5
+// lldb-command:continue
+
+// WHILE EXPR
+// lldb-command:print x
+// lldb-check:[...]$26 = 40
+// lldb-command:print y
+// lldb-check:[...]$27 = 41
+// lldb-command:print z
+// lldb-check:[...]$28 = 42
+// lldb-command:continue
+
+// LOOP EXPR
+// lldb-command:print x
+// lldb-check:[...]$29 = 43
+// lldb-command:print y
+// lldb-check:[...]$30 = 44
+// lldb-command:print z
+// lldb-check:[...]$31 = 45
+// lldb-command:continue
+
+#![allow(unused_variables)]
+#![feature(omit_gdb_pretty_printer_section)]
+#![omit_gdb_pretty_printer_section]
+
+fn immediate_args(a: isize, b: bool, c: f64) {
+ ()
+}
+
+struct BigStruct {
+ a: u64,
+ b: u64,
+ c: u64,
+ d: u64,
+ e: u64,
+ f: u64,
+ g: u64,
+ h: u64
+}
+
+fn non_immediate_args(a: BigStruct, b: BigStruct) {
+ ()
+}
+
+fn binding(a: i64, b: u64, c: f64) {
+ let x = 0;
+}
+
+fn assignment(mut a: u64, b: u64, c: f64) {
+ a = b;
+}
+
+fn function_call(x: u64, y: u64, z: f64) {
+ println!("Hi!")
+}
+
+fn identifier(x: u64, y: u64, z: f64) -> u64 {
+ x
+}
+
+fn return_expr(x: u64, y: u64, z: f64) -> u64 {
+ return x;
+}
+
+fn arithmetic_expr(x: u64, y: u64, z: f64) -> u64 {
+ x + y
+}
+
+fn if_expr(x: u64, y: u64, z: f64) -> u64 {
+ if x + y < 1000 {
+ x
+ } else {
+ y
+ }
+}
+
+fn while_expr(mut x: u64, y: u64, z: u64) -> u64 {
+ while x + y < 1000 {
+ x += z
+ }
+ return x;
+}
+
+fn loop_expr(mut x: u64, y: u64, z: u64) -> u64 {
+ loop {
+ x += z;
+
+ if x + y > 1000 {
+ return x;
+ }
+ }
+}
+
+fn main() {
+ immediate_args(1, true, 2.5);
+
+ non_immediate_args(
+ BigStruct {
+ a: 3,
+ b: 4,
+ c: 5,
+ d: 6,
+ e: 7,
+ f: 8,
+ g: 9,
+ h: 10
+ },
+ BigStruct {
+ a: 11,
+ b: 12,
+ c: 13,
+ d: 14,
+ e: 15,
+ f: 16,
+ g: 17,
+ h: 18
+ }
+ );
+
+ binding(19, 20, 21.5);
+ assignment(22, 23, 24.5);
+ function_call(25, 26, 27.5);
+ identifier(28, 29, 30.5);
+ return_expr(31, 32, 33.5);
+ arithmetic_expr(34, 35, 36.5);
+ if_expr(37, 38, 39.5);
+ while_expr(40, 41, 42);
+ loop_expr(43, 44, 45);
+}
diff --git a/src/test/debuginfo/gdb-char.rs b/src/test/debuginfo/gdb-char.rs
new file mode 100644
index 000000000..1863405bf
--- /dev/null
+++ b/src/test/debuginfo/gdb-char.rs
@@ -0,0 +1,23 @@
+// GDB got support for DW_ATE_UTF in 11.2, see
+// https://sourceware.org/bugzilla/show_bug.cgi?id=28637.
+
+// min-gdb-version: 11.2
+// compile-flags: -g
+
+// === GDB TESTS ===================================================================================
+
+// gdb-command:run
+// gdb-command:print ch
+// gdb-check:$1 = 97 'a'
+
+#![allow(unused_variables)]
+#![feature(omit_gdb_pretty_printer_section)]
+#![omit_gdb_pretty_printer_section]
+
+fn main() {
+ let ch: char = 'a';
+
+ zzz(); // #break
+}
+
+fn zzz() {()}
diff --git a/src/test/debuginfo/gdb-pretty-struct-and-enums.rs b/src/test/debuginfo/gdb-pretty-struct-and-enums.rs
new file mode 100644
index 000000000..3314f0a4e
--- /dev/null
+++ b/src/test/debuginfo/gdb-pretty-struct-and-enums.rs
@@ -0,0 +1,62 @@
+// ignore-lldb
+// ignore-android: FIXME(#10381)
+// min-gdb-version: 8.1
+
+// compile-flags:-g
+
+// gdb-command: run
+
+// gdb-command: print regular_struct
+// gdbg-check:$1 = {the_first_field = 101, the_second_field = 102.5, the_third_field = false}
+// gdbr-check:$1 = gdb_pretty_struct_and_enums::RegularStruct {the_first_field: 101, the_second_field: 102.5, the_third_field: false}
+
+// gdb-command: print empty_struct
+// gdbg-check:$2 = EmptyStruct
+// gdbr-check:$2 = gdb_pretty_struct_and_enums::EmptyStruct
+
+// gdb-command: print c_style_enum1
+// gdbg-check:$3 = CStyleEnumVar1
+// gdbr-check:$3 = gdb_pretty_struct_and_enums::CStyleEnum::CStyleEnumVar1
+
+// gdb-command: print c_style_enum2
+// gdbg-check:$4 = CStyleEnumVar2
+// gdbr-check:$4 = gdb_pretty_struct_and_enums::CStyleEnum::CStyleEnumVar2
+
+// gdb-command: print c_style_enum3
+// gdbg-check:$5 = CStyleEnumVar3
+// gdbr-check:$5 = gdb_pretty_struct_and_enums::CStyleEnum::CStyleEnumVar3
+
+#![allow(dead_code, unused_variables)]
+
+struct RegularStruct {
+ the_first_field: isize,
+ the_second_field: f64,
+ the_third_field: bool,
+}
+
+struct EmptyStruct;
+
+enum CStyleEnum {
+ CStyleEnumVar1,
+ CStyleEnumVar2,
+ CStyleEnumVar3,
+}
+
+fn main() {
+
+ let regular_struct = RegularStruct {
+ the_first_field: 101,
+ the_second_field: 102.5,
+ the_third_field: false
+ };
+
+ let empty_struct = EmptyStruct;
+
+ let c_style_enum1 = CStyleEnum::CStyleEnumVar1;
+ let c_style_enum2 = CStyleEnum::CStyleEnumVar2;
+ let c_style_enum3 = CStyleEnum::CStyleEnumVar3;
+
+ zzz(); // #break
+}
+
+fn zzz() { () }
diff --git a/src/test/debuginfo/generator-locals.rs b/src/test/debuginfo/generator-locals.rs
new file mode 100644
index 000000000..fd46c1a8b
--- /dev/null
+++ b/src/test/debuginfo/generator-locals.rs
@@ -0,0 +1,87 @@
+// min-lldb-version: 310
+
+// compile-flags:-g
+
+// === GDB TESTS ===================================================================================
+
+// gdb-command:run
+// gdb-command:print a
+// gdb-check:$1 = 5
+// gdb-command:print c
+// gdb-check:$2 = 6
+// gdb-command:print d
+// gdb-check:$3 = 7
+// gdb-command:continue
+// gdb-command:print a
+// gdb-check:$4 = 7
+// gdb-command:print c
+// gdb-check:$5 = 6
+// gdb-command:print e
+// gdb-check:$6 = 8
+// gdb-command:continue
+// gdb-command:print a
+// gdb-check:$7 = 8
+// gdb-command:print c
+// gdb-check:$8 = 6
+
+// === LLDB TESTS ==================================================================================
+
+// lldb-command:run
+// lldb-command:print a
+// lldbg-check:(int) $0 = 5
+// lldbr-check:(int) a = 5
+// lldb-command:print c
+// lldbg-check:(int) $1 = 6
+// lldbr-check:(int) c = 6
+// lldb-command:print d
+// lldbg-check:(int) $2 = 7
+// lldbr-check:(int) d = 7
+// lldb-command:continue
+// lldb-command:print a
+// lldbg-check:(int) $3 = 7
+// lldbr-check:(int) a = 7
+// lldb-command:print c
+// lldbg-check:(int) $4 = 6
+// lldbr-check:(int) c = 6
+// lldb-command:print e
+// lldbg-check:(int) $5 = 8
+// lldbr-check:(int) e = 8
+// lldb-command:continue
+// lldb-command:print a
+// lldbg-check:(int) $6 = 8
+// lldbr-check:(int) a = 8
+// lldb-command:print c
+// lldbg-check:(int) $7 = 6
+// lldbr-check:(int) c = 6
+
+#![feature(omit_gdb_pretty_printer_section, generators, generator_trait)]
+#![omit_gdb_pretty_printer_section]
+
+use std::ops::Generator;
+use std::pin::Pin;
+
+fn main() {
+ let mut a = 5;
+ let mut b = || {
+ let c = 6; // Live across multiple yield points
+
+ let d = 7; // Live across only one yield point
+ yield;
+ _zzz(); // #break
+ a = d;
+
+ let e = 8; // Live across zero yield points
+ _zzz(); // #break
+ a = e;
+
+ yield;
+ _zzz(); // #break
+ a = c;
+ };
+ Pin::new(&mut b).resume(());
+ Pin::new(&mut b).resume(());
+ Pin::new(&mut b).resume(());
+ _zzz(); // #break
+}
+
+fn _zzz() {()}
diff --git a/src/test/debuginfo/generator-objects.rs b/src/test/debuginfo/generator-objects.rs
new file mode 100644
index 000000000..d6d7e5b44
--- /dev/null
+++ b/src/test/debuginfo/generator-objects.rs
@@ -0,0 +1,103 @@
+// Require a gdb that can read DW_TAG_variant_part.
+// min-gdb-version: 8.2
+
+// LLDB without native Rust support cannot read DW_TAG_variant_part,
+// so it prints nothing for generators. But those tests are kept to
+// ensure that LLDB won't crash at least (like #57822).
+
+// compile-flags:-g
+
+// === GDB TESTS ===================================================================================
+
+// gdb-command:run
+// gdb-command:print b
+// gdb-check:$1 = generator_objects::main::{generator_env#0}::Unresumed{_ref__a: 0x[...]}
+// gdb-command:continue
+// gdb-command:print b
+// gdb-check:$2 = generator_objects::main::{generator_env#0}::Suspend0{c: 6, d: 7, _ref__a: 0x[...]}
+// gdb-command:continue
+// gdb-command:print b
+// gdb-check:$3 = generator_objects::main::{generator_env#0}::Suspend1{c: 7, d: 8, _ref__a: 0x[...]}
+// gdb-command:continue
+// gdb-command:print b
+// gdb-check:$4 = generator_objects::main::{generator_env#0}::Returned{_ref__a: 0x[...]}
+
+// === LLDB TESTS ==================================================================================
+
+// lldb-command:run
+// lldb-command:print b
+// lldbg-check:(generator_objects::main::{generator_env#0}) $0 =
+// lldb-command:continue
+// lldb-command:print b
+// lldbg-check:(generator_objects::main::{generator_env#0}) $1 =
+// lldb-command:continue
+// lldb-command:print b
+// lldbg-check:(generator_objects::main::{generator_env#0}) $2 =
+// lldb-command:continue
+// lldb-command:print b
+// lldbg-check:(generator_objects::main::{generator_env#0}) $3 =
+
+// === CDB TESTS ===================================================================================
+
+// cdb-command: g
+// cdb-command: dx b
+// cdb-check: b : Unresumed [Type: enum$<generator_objects::main::generator_env$0>]
+// cdb-check: [variant] : Unresumed
+// cdb-check: [+0x[...]] _ref__a : 0x[...] : 5 [Type: int *]
+
+// cdb-command: g
+// cdb-command: dx b
+// cdb-check: b : Suspend0 [Type: enum$<generator_objects::main::generator_env$0>]
+// cdb-check: [variant] : Suspend0
+// cdb-check: [+0x[...]] c : 6 [Type: int]
+// cdb-check: [+0x[...]] d : 7 [Type: int]
+// cdb-check: [+0x[...]] _ref__a : 0x[...] : 5 [Type: int *]
+
+// cdb-command: g
+// cdb-command: dx b
+// cdb-check: b : Suspend1 [Type: enum$<generator_objects::main::generator_env$0>]
+// cdb-check: [variant] : Suspend1
+// cdb-check: [+0x[...]] c : 7 [Type: int]
+// cdb-check: [+0x[...]] d : 8 [Type: int]
+// cdb-check: [+0x[...]] _ref__a : 0x[...] : 6 [Type: int *]
+
+// cdb-command: g
+// cdb-command: dx b
+// cdb-check: b : Returned [Type: enum$<generator_objects::main::generator_env$0>]
+// cdb-check: [<Raw View>] [Type: enum$<generator_objects::main::generator_env$0>]
+// cdb-check: [variant] : Returned
+// cdb-check: [+0x[...]] _ref__a : 0x[...] : 6 [Type: int *]
+
+#![feature(omit_gdb_pretty_printer_section, generators, generator_trait)]
+#![omit_gdb_pretty_printer_section]
+
+use std::ops::Generator;
+use std::pin::Pin;
+
+fn main() {
+ let mut a = 5;
+ let mut b = || {
+ let mut c = 6;
+ let mut d = 7;
+
+ yield;
+ a += 1;
+ c += 1;
+ d += 1;
+
+ yield;
+ println!("{} {} {}", a, c, d);
+ };
+ _zzz(); // #break
+ Pin::new(&mut b).resume(());
+ _zzz(); // #break
+ Pin::new(&mut b).resume(());
+ _zzz(); // #break
+ Pin::new(&mut b).resume(());
+ _zzz(); // #break
+}
+
+#[inline(never)]
+fn _zzz() {
+ ()
+}
diff --git a/src/test/debuginfo/generic-enum-with-different-disr-sizes.rs b/src/test/debuginfo/generic-enum-with-different-disr-sizes.rs
new file mode 100644
index 000000000..adcb04da3
--- /dev/null
+++ b/src/test/debuginfo/generic-enum-with-different-disr-sizes.rs
@@ -0,0 +1,92 @@
+// ignore-lldb: FIXME(#27089)
+// min-lldb-version: 310
+
+// Require a gdb that can read DW_TAG_variant_part.
+// min-gdb-version: 8.2
+
+// compile-flags:-g
+
+// === GDB TESTS ===================================================================================
+// gdb-command:run
+
+// gdb-command:print eight_bytes1
+// gdbr-check:$1 = generic_enum_with_different_disr_sizes::Enum<f64>::Variant1(100)
+
+// gdb-command:print four_bytes1
+// gdbr-check:$2 = generic_enum_with_different_disr_sizes::Enum<i32>::Variant1(101)
+
+// gdb-command:print two_bytes1
+// gdbr-check:$3 = generic_enum_with_different_disr_sizes::Enum<i16>::Variant1(102)
+
+// gdb-command:print one_byte1
+// gdbr-check:$4 = generic_enum_with_different_disr_sizes::Enum<u8>::Variant1(65)
+
+
+// gdb-command:print eight_bytes2
+// gdbr-check:$5 = generic_enum_with_different_disr_sizes::Enum<f64>::Variant2(100)
+
+// gdb-command:print four_bytes2
+// gdbr-check:$6 = generic_enum_with_different_disr_sizes::Enum<i32>::Variant2(101)
+
+// gdb-command:print two_bytes2
+// gdbr-check:$7 = generic_enum_with_different_disr_sizes::Enum<i16>::Variant2(102)
+
+// gdb-command:print one_byte2
+// gdbr-check:$8 = generic_enum_with_different_disr_sizes::Enum<u8>::Variant2(65)
+
+// gdb-command:continue
+
+// === LLDB TESTS ==================================================================================
+// lldb-command:run
+
+// lldb-command:print eight_bytes1
+// lldb-check:[...]$0 = Variant1(100)
+// lldb-command:print four_bytes1
+// lldb-check:[...]$1 = Variant1(101)
+// lldb-command:print two_bytes1
+// lldb-check:[...]$2 = Variant1(102)
+// lldb-command:print one_byte1
+// lldb-check:[...]$3 = Variant1('A')
+
+// lldb-command:print eight_bytes2
+// lldb-check:[...]$4 = Variant2(100)
+// lldb-command:print four_bytes2
+// lldb-check:[...]$5 = Variant2(101)
+// lldb-command:print two_bytes2
+// lldb-check:[...]$6 = Variant2(102)
+// lldb-command:print one_byte2
+// lldb-check:[...]$7 = Variant2('A')
+
+// lldb-command:continue
+
+#![allow(unused_variables)]
+#![allow(dead_code)]
+#![feature(omit_gdb_pretty_printer_section)]
+#![omit_gdb_pretty_printer_section]
+
+// This test case makes sure that we get correct type descriptions for the enum
+// discriminant of different instantiations of the same generic enum type where,
+// dependending on the generic type parameter(s), the discriminant has a
+// different size in memory.
+
+enum Enum<T> {
+ Variant1(T),
+ Variant2(T)
+}
+
+fn main() {
+ // These are ordered for descending size on purpose
+ let eight_bytes1 = Enum::Variant1(100.0f64);
+ let four_bytes1 = Enum::Variant1(101i32);
+ let two_bytes1 = Enum::Variant1(102i16);
+ let one_byte1 = Enum::Variant1(65u8);
+
+ let eight_bytes2 = Enum::Variant2(100.0f64);
+ let four_bytes2 = Enum::Variant2(101i32);
+ let two_bytes2 = Enum::Variant2(102i16);
+ let one_byte2 = Enum::Variant2(65u8);
+
+ zzz(); // #break
+}
+
+fn zzz() { () }
diff --git a/src/test/debuginfo/generic-function.rs b/src/test/debuginfo/generic-function.rs
new file mode 100644
index 000000000..e8f3940c8
--- /dev/null
+++ b/src/test/debuginfo/generic-function.rs
@@ -0,0 +1,78 @@
+// min-lldb-version: 310
+
+// compile-flags:-g
+
+// === GDB TESTS ===================================================================================
+
+// gdb-command:run
+
+// gdb-command:print *t0
+// gdb-check:$1 = 1
+// gdb-command:print *t1
+// gdb-check:$2 = 2.5
+// gdb-command:continue
+
+// gdb-command:print *t0
+// gdb-check:$3 = 3.5
+// gdb-command:print *t1
+// gdb-check:$4 = 4
+// gdb-command:continue
+
+// gdb-command:print *t0
+// gdb-check:$5 = 5
+// gdb-command:print *t1
+// gdbg-check:$6 = {a = 6, b = 7.5}
+// gdbr-check:$6 = generic_function::Struct {a: 6, b: 7.5}
+// gdb-command:continue
+
+// === LLDB TESTS ==================================================================================
+
+// lldb-command:run
+
+// lldb-command:print *t0
+// lldbg-check:[...]$0 = 1
+// lldbr-check:(i32) *t0 = 1
+// lldb-command:print *t1
+// lldbg-check:[...]$1 = 2.5
+// lldbr-check:(f64) *t1 = 2.5
+// lldb-command:continue
+
+// lldb-command:print *t0
+// lldbg-check:[...]$2 = 3.5
+// lldbr-check:(f64) *t0 = 3.5
+// lldb-command:print *t1
+// lldbg-check:[...]$3 = 4
+// lldbr-check:(u16) *t1 = 4
+// lldb-command:continue
+
+// lldb-command:print *t0
+// lldbg-check:[...]$4 = 5
+// lldbr-check:(i32) *t0 = 5
+// lldb-command:print *t1
+// lldbg-check:[...]$5 = { a = 6 b = 7.5 }
+// lldbr-check:(generic_function::Struct) *t1 = { a = 6 b = 7.5 }
+// lldb-command:continue
+
+#![feature(omit_gdb_pretty_printer_section)]
+#![omit_gdb_pretty_printer_section]
+
+#[derive(Clone)]
+struct Struct {
+ a: isize,
+ b: f64
+}
+
+fn dup_tup<T0: Clone, T1: Clone>(t0: &T0, t1: &T1) -> ((T0, T1), (T1, T0)) {
+ let ret = ((t0.clone(), t1.clone()), (t1.clone(), t0.clone()));
+ zzz(); // #break
+ ret
+}
+
+fn main() {
+
+ let _ = dup_tup(&1, &2.5f64);
+ let _ = dup_tup(&3.5f64, &4_u16);
+ let _ = dup_tup(&5, &Struct { a: 6, b: 7.5 });
+}
+
+fn zzz() {()}
diff --git a/src/test/debuginfo/generic-functions-nested.rs b/src/test/debuginfo/generic-functions-nested.rs
new file mode 100644
index 000000000..4c4297f94
--- /dev/null
+++ b/src/test/debuginfo/generic-functions-nested.rs
@@ -0,0 +1,88 @@
+// min-lldb-version: 310
+
+// compile-flags:-g
+
+// === GDB TESTS ===================================================================================
+
+// gdb-command:run
+
+// gdb-command:print x
+// gdb-check:$1 = -1
+// gdb-command:print y
+// gdb-check:$2 = 1
+// gdb-command:continue
+
+// gdb-command:print x
+// gdb-check:$3 = -1
+// gdb-command:print y
+// gdb-check:$4 = 2.5
+// gdb-command:continue
+
+// gdb-command:print x
+// gdb-check:$5 = -2.5
+// gdb-command:print y
+// gdb-check:$6 = 1
+// gdb-command:continue
+
+// gdb-command:print x
+// gdb-check:$7 = -2.5
+// gdb-command:print y
+// gdb-check:$8 = 2.5
+// gdb-command:continue
+
+
+// === LLDB TESTS ==================================================================================
+
+// lldb-command:run
+
+// lldb-command:print x
+// lldbg-check:[...]$0 = -1
+// lldbr-check:(i32) x = -1
+// lldb-command:print y
+// lldbg-check:[...]$1 = 1
+// lldbr-check:(i32) y = 1
+// lldb-command:continue
+
+// lldb-command:print x
+// lldbg-check:[...]$2 = -1
+// lldbr-check:(i32) x = -1
+// lldb-command:print y
+// lldbg-check:[...]$3 = 2.5
+// lldbr-check:(f64) y = 2.5
+// lldb-command:continue
+
+// lldb-command:print x
+// lldbg-check:[...]$4 = -2.5
+// lldbr-check:(f64) x = -2.5
+// lldb-command:print y
+// lldbg-check:[...]$5 = 1
+// lldbr-check:(i32) y = 1
+// lldb-command:continue
+
+// lldb-command:print x
+// lldbg-check:[...]$6 = -2.5
+// lldbr-check:(f64) x = -2.5
+// lldb-command:print y
+// lldbg-check:[...]$7 = 2.5
+// lldbr-check:(f64) y = 2.5
+// lldb-command:continue
+
+
+#![feature(omit_gdb_pretty_printer_section)]
+#![omit_gdb_pretty_printer_section]
+
+fn outer<TA: Clone>(a: TA) {
+ inner(a.clone(), 1);
+ inner(a.clone(), 2.5f64);
+
+ fn inner<TX, TY>(x: TX, y: TY) {
+ zzz(); // #break
+ }
+}
+
+fn main() {
+ outer(-1);
+ outer(-2.5f64);
+}
+
+fn zzz() { () }
diff --git a/src/test/debuginfo/generic-method-on-generic-struct.rs b/src/test/debuginfo/generic-method-on-generic-struct.rs
new file mode 100644
index 000000000..97609ef5d
--- /dev/null
+++ b/src/test/debuginfo/generic-method-on-generic-struct.rs
@@ -0,0 +1,163 @@
+// compile-flags:-g
+
+// Some versions of the non-rust-enabled LLDB print the wrong generic
+// parameter type names in this test.
+// rust-lldb
+
+// === GDB TESTS ===================================================================================
+
+// gdb-command:run
+
+// STACK BY REF
+// gdb-command:print *self
+// gdbg-check:$1 = {x = {__0 = 8888, __1 = -8888}}
+// gdbr-check:$1 = generic_method_on_generic_struct::Struct<(u32, i32)> {x: (8888, -8888)}
+// gdb-command:print arg1
+// gdb-check:$2 = -1
+// gdb-command:print arg2
+// gdb-check:$3 = 2
+// gdb-command:continue
+
+// STACK BY VAL
+// gdb-command:print self
+// gdbg-check:$4 = {x = {__0 = 8888, __1 = -8888}}
+// gdbr-check:$4 = generic_method_on_generic_struct::Struct<(u32, i32)> {x: (8888, -8888)}
+// gdb-command:print arg1
+// gdb-check:$5 = -3
+// gdb-command:print arg2
+// gdb-check:$6 = -4
+// gdb-command:continue
+
+// OWNED BY REF
+// gdb-command:print *self
+// gdbg-check:$7 = {x = 1234.5}
+// gdbr-check:$7 = generic_method_on_generic_struct::Struct<f64> {x: 1234.5}
+// gdb-command:print arg1
+// gdb-check:$8 = -5
+// gdb-command:print arg2
+// gdb-check:$9 = -6
+// gdb-command:continue
+
+// OWNED BY VAL
+// gdb-command:print self
+// gdbg-check:$10 = {x = 1234.5}
+// gdbr-check:$10 = generic_method_on_generic_struct::Struct<f64> {x: 1234.5}
+// gdb-command:print arg1
+// gdb-check:$11 = -7
+// gdb-command:print arg2
+// gdb-check:$12 = -8
+// gdb-command:continue
+
+// OWNED MOVED
+// gdb-command:print *self
+// gdbg-check:$13 = {x = 1234.5}
+// gdbr-check:$13 = generic_method_on_generic_struct::Struct<f64> {x: 1234.5}
+// gdb-command:print arg1
+// gdb-check:$14 = -9
+// gdb-command:print arg2
+// gdb-check:$15 = -10.5
+// gdb-command:continue
+
+
+// === LLDB TESTS ==================================================================================
+
+// lldb-command:run
+
+// STACK BY REF
+// lldb-command:print *self
+// lldbg-check:[...]$0 = { x = { 0 = 8888, 1 = -8888 } }
+// lldbr-check:(generic_method_on_generic_struct::Struct<(u32, i32)>) *self = { x = { 0 = 8888 1 = -8888 } }
+// lldb-command:print arg1
+// lldbg-check:[...]$1 = -1
+// lldbr-check:(isize) arg1 = -1
+// lldb-command:print arg2
+// lldbg-check:[...]$2 = 2
+// lldbr-check:(u16) arg2 = 2
+// lldb-command:continue
+
+// STACK BY VAL
+// lldb-command:print self
+// lldbg-check:[...]$3 = { x = { 0 = 8888, 1 = -8888 } }
+// lldbr-check:(generic_method_on_generic_struct::Struct<(u32, i32)>) self = { x = { 0 = 8888, 1 = -8888 } }
+// lldb-command:print arg1
+// lldbg-check:[...]$4 = -3
+// lldbr-check:(isize) arg1 = -3
+// lldb-command:print arg2
+// lldbg-check:[...]$5 = -4
+// lldbr-check:(i16) arg2 = -4
+// lldb-command:continue
+
+// OWNED BY REF
+// lldb-command:print *self
+// lldbg-check:[...]$6 = { x = 1234.5 }
+// lldbr-check:(generic_method_on_generic_struct::Struct<f64>) *self = { x = 1234.5 }
+// lldb-command:print arg1
+// lldbg-check:[...]$7 = -5
+// lldbr-check:(isize) arg1 = -5
+// lldb-command:print arg2
+// lldbg-check:[...]$8 = -6
+// lldbr-check:(i32) arg2 = -6
+// lldb-command:continue
+
+// OWNED BY VAL
+// lldb-command:print self
+// lldbg-check:[...]$9 = { x = 1234.5 }
+// lldbr-check:(generic_method_on_generic_struct::Struct<f64>) self = { x = 1234.5 }
+// lldb-command:print arg1
+// lldbg-check:[...]$10 = -7
+// lldbr-check:(isize) arg1 = -7
+// lldb-command:print arg2
+// lldbg-check:[...]$11 = -8
+// lldbr-check:(i64) arg2 = -8
+// lldb-command:continue
+
+// OWNED MOVED
+// lldb-command:print *self
+// lldbg-check:[...]$12 = { x = 1234.5 }
+// lldbr-check:(generic_method_on_generic_struct::Struct<f64>) *self = { x = 1234.5 }
+// lldb-command:print arg1
+// lldbg-check:[...]$13 = -9
+// lldbr-check:(isize) arg1 = -9
+// lldb-command:print arg2
+// lldbg-check:[...]$14 = -10.5
+// lldbr-check:(f32) arg2 = -10.5
+// lldb-command:continue
+
+#![feature(omit_gdb_pretty_printer_section)]
+#![omit_gdb_pretty_printer_section]
+
+#[derive(Copy, Clone)]
+struct Struct<T> {
+ x: T
+}
+
+impl<T1> Struct<T1> {
+
+ fn self_by_ref<T2>(&self, arg1: isize, arg2: T2) -> isize {
+ zzz(); // #break
+ arg1
+ }
+
+ fn self_by_val<T2>(self, arg1: isize, arg2: T2) -> isize {
+ zzz(); // #break
+ arg1
+ }
+
+ fn self_owned<T2>(self: Box<Struct<T1>>, arg1: isize, arg2: T2) -> isize {
+ zzz(); // #break
+ arg1
+ }
+}
+
+fn main() {
+ let stack = Struct { x: (8888_u32, -8888_i32) };
+ let _ = stack.self_by_ref(-1, 2_u16);
+ let _ = stack.self_by_val(-3, -4_i16);
+
+ let owned: Box<_> = Box::new(Struct { x: 1234.5f64 });
+ let _ = owned.self_by_ref(-5, -6_i32);
+ let _ = owned.self_by_val(-7, -8_i64);
+ let _ = owned.self_owned(-9, -10.5_f32);
+}
+
+fn zzz() {()}
diff --git a/src/test/debuginfo/generic-static-method-on-struct-and-enum.rs b/src/test/debuginfo/generic-static-method-on-struct-and-enum.rs
new file mode 100644
index 000000000..b0ac8ae85
--- /dev/null
+++ b/src/test/debuginfo/generic-static-method-on-struct-and-enum.rs
@@ -0,0 +1,58 @@
+// min-lldb-version: 310
+
+// compile-flags:-g
+
+// gdb-command:run
+
+// STRUCT
+// gdb-command:print arg1
+// gdb-check:$1 = 1
+// gdb-command:print arg2
+// gdb-check:$2 = 2
+// gdb-command:continue
+
+// ENUM
+// gdb-command:print arg1
+// gdb-check:$3 = -3
+// gdb-command:print arg2
+// gdb-check:$4 = 4.5
+// gdb-command:print arg3
+// gdb-check:$5 = 5
+// gdb-command:continue
+
+
+#![feature(omit_gdb_pretty_printer_section)]
+#![omit_gdb_pretty_printer_section]
+
+struct Struct {
+ x: isize
+}
+
+impl Struct {
+
+ fn static_method<T1, T2>(arg1: T1, arg2: T2) -> isize {
+ zzz(); // #break
+ return 0;
+ }
+}
+
+enum Enum {
+ Variant1 { x: isize },
+ Variant2,
+ Variant3(f64, isize, char),
+}
+
+impl Enum {
+
+ fn static_method<T1, T2, T3>(arg1: T1, arg2: T2, arg3: T3) -> isize {
+ zzz(); // #break
+ return 1;
+ }
+}
+
+fn main() {
+ Struct::static_method(1, 2);
+ Enum::static_method(-3, 4.5f64, 5);
+}
+
+fn zzz() {()}
diff --git a/src/test/debuginfo/generic-struct-style-enum.rs b/src/test/debuginfo/generic-struct-style-enum.rs
new file mode 100644
index 000000000..764330ae2
--- /dev/null
+++ b/src/test/debuginfo/generic-struct-style-enum.rs
@@ -0,0 +1,76 @@
+// min-lldb-version: 310
+
+// Require a gdb that can read DW_TAG_variant_part.
+// min-gdb-version: 8.2
+
+// compile-flags:-g
+
+// gdb-command:set print union on
+// gdb-command:run
+
+// gdb-command:print case1
+// gdbr-check:$1 = generic_struct_style_enum::Regular<u16, u32, i64>::Case1{a: 0, b: 31868, c: 31868, d: 31868, e: 31868}
+
+// gdb-command:print case2
+// gdbr-check:$2 = generic_struct_style_enum::Regular<i16, u32, i64>::Case2{a: 0, b: 286331153, c: 286331153}
+
+// gdb-command:print case3
+// gdbr-check:$3 = generic_struct_style_enum::Regular<u16, i32, u64>::Case3{a: 0, b: 6438275382588823897}
+
+// gdb-command:print univariant
+// gdbr-check:$4 = generic_struct_style_enum::Univariant<i32>::TheOnlyCase{a: -1}
+
+
+#![feature(omit_gdb_pretty_printer_section)]
+#![omit_gdb_pretty_printer_section]
+
+use self::Regular::{Case1, Case2, Case3};
+use self::Univariant::TheOnlyCase;
+
+// NOTE: This is a copy of the non-generic test case. The `Txx` type parameters have to be
+// substituted with something of size `xx` bits and the same alignment as an integer type of the
+// same size.
+
+// The first element is to ensure proper alignment, irrespective of the machines word size. Since
+// the size of the discriminant value is machine dependent, this has be taken into account when
+// datatype layout should be predictable as in this case.
+enum Regular<T16, T32, T64> {
+ Case1 { a: T64, b: T16, c: T16, d: T16, e: T16},
+ Case2 { a: T64, b: T32, c: T32},
+ Case3 { a: T64, b: T64 }
+}
+
+enum Univariant<T> {
+ TheOnlyCase { a: T }
+}
+
+fn main() {
+
+ // In order to avoid endianness trouble all of the following test values consist of a single
+ // repeated byte. This way each interpretation of the union should look the same, no matter if
+ // this is a big or little endian machine.
+
+ // 0b0111110001111100011111000111110001111100011111000111110001111100 = 8970181431921507452
+ // 0b01111100011111000111110001111100 = 2088533116
+ // 0b0111110001111100 = 31868
+ // 0b01111100 = 124
+ let case1: Regular<u16, u32, i64> = Case1 { a: 0, b: 31868, c: 31868, d: 31868, e: 31868 };
+
+ // 0b0001000100010001000100010001000100010001000100010001000100010001 = 1229782938247303441
+ // 0b00010001000100010001000100010001 = 286331153
+ // 0b0001000100010001 = 4369
+ // 0b00010001 = 17
+ let case2: Regular<i16, u32, i64> = Case2 { a: 0, b: 286331153, c: 286331153 };
+
+ // 0b0101100101011001010110010101100101011001010110010101100101011001 = 6438275382588823897
+ // 0b01011001010110010101100101011001 = 1499027801
+ // 0b0101100101011001 = 22873
+ // 0b01011001 = 89
+ let case3: Regular<u16, i32, u64> = Case3 { a: 0, b: 6438275382588823897 };
+
+ let univariant = TheOnlyCase { a: -1 };
+
+ zzz(); // #break
+}
+
+fn zzz() {()}
diff --git a/src/test/debuginfo/generic-struct.rs b/src/test/debuginfo/generic-struct.rs
new file mode 100644
index 000000000..5fa5ce800
--- /dev/null
+++ b/src/test/debuginfo/generic-struct.rs
@@ -0,0 +1,85 @@
+// Some versions of the non-rust-enabled LLDB print the wrong generic
+// parameter type names in this test.
+// rust-lldb
+
+// compile-flags:-g
+
+// === GDB TESTS ===================================================================================
+
+// gdb-command:run
+
+// gdb-command:print int_int
+// gdbg-check:$1 = {key = 0, value = 1}
+// gdbr-check:$1 = generic_struct::AGenericStruct<i32, i32> {key: 0, value: 1}
+// gdb-command:print int_float
+// gdbg-check:$2 = {key = 2, value = 3.5}
+// gdbr-check:$2 = generic_struct::AGenericStruct<i32, f64> {key: 2, value: 3.5}
+// gdb-command:print float_int
+// gdbg-check:$3 = {key = 4.5, value = 5}
+// gdbr-check:$3 = generic_struct::AGenericStruct<f64, i32> {key: 4.5, value: 5}
+// gdb-command:print float_int_float
+// gdbg-check:$4 = {key = 6.5, value = {key = 7, value = 8.5}}
+// gdbr-check:$4 = generic_struct::AGenericStruct<f64, generic_struct::AGenericStruct<i32, f64>> {key: 6.5, value: generic_struct::AGenericStruct<i32, f64> {key: 7, value: 8.5}}
+
+// === LLDB TESTS ==================================================================================
+
+// lldb-command:run
+
+// lldb-command:print int_int
+// lldbg-check:[...]$0 = AGenericStruct<i32, i32> { key: 0, value: 1 }
+// lldbr-check:(generic_struct::AGenericStruct<i32, i32>) int_int = AGenericStruct<i32, i32> { key: 0, value: 1 }
+// lldb-command:print int_float
+// lldbg-check:[...]$1 = AGenericStruct<i32, f64> { key: 2, value: 3.5 }
+// lldbr-check:(generic_struct::AGenericStruct<i32, f64>) int_float = AGenericStruct<i32, f64> { key: 2, value: 3.5 }
+// lldb-command:print float_int
+// lldbg-check:[...]$2 = AGenericStruct<f64, i32> { key: 4.5, value: 5 }
+// lldbr-check:(generic_struct::AGenericStruct<f64, i32>) float_int = AGenericStruct<f64, i32> { key: 4.5, value: 5 }
+
+// lldb-command:print float_int_float
+// lldbg-check:[...]$3 = AGenericStruct<f64, generic_struct::AGenericStruct<i32, f64>> { key: 6.5, value: AGenericStruct<i32, f64> { key: 7, value: 8.5 } }
+// lldbr-check:(generic_struct::AGenericStruct<f64, generic_struct::AGenericStruct<i32, f64>>) float_int_float = AGenericStruct<f64, generic_struct::AGenericStruct<i32, f64>> { key: 6.5, value: AGenericStruct<i32, f64> { key: 7, value: 8.5 } }
+
+// === CDB TESTS ===================================================================================
+
+// cdb-command:g
+
+// cdb-command:dx int_int
+// cdb-check:int_int [Type: generic_struct::AGenericStruct<i32,i32>]
+// cdb-check:[...]key : 0 [Type: int]
+// cdb-check:[...]value : 1 [Type: int]
+// cdb-command:dx int_float
+// cdb-check:int_float [Type: generic_struct::AGenericStruct<i32,f64>]
+// cdb-check:[...]key : 2 [Type: int]
+// cdb-check:[...]value : 3.500000 [Type: double]
+// cdb-command:dx float_int
+// cdb-check:float_int [Type: generic_struct::AGenericStruct<f64,i32>]
+// cdb-check:[...]key : 4.500000 [Type: double]
+// cdb-check:[...]value : 5 [Type: int]
+// cdb-command:dx float_int_float
+// cdb-check:float_int_float [Type: generic_struct::AGenericStruct<f64,generic_struct::AGenericStruct<i32,f64> >]
+// cdb-check:[...]key : 6.500000 [Type: double]
+// cdb-check:[...]value [Type: generic_struct::AGenericStruct<i32,f64>]
+
+
+#![feature(omit_gdb_pretty_printer_section)]
+#![omit_gdb_pretty_printer_section]
+
+struct AGenericStruct<TKey, TValue> {
+ key: TKey,
+ value: TValue
+}
+
+fn main() {
+
+ let int_int = AGenericStruct { key: 0, value: 1 };
+ let int_float = AGenericStruct { key: 2, value: 3.5f64 };
+ let float_int = AGenericStruct { key: 4.5f64, value: 5 };
+ let float_int_float = AGenericStruct {
+ key: 6.5f64,
+ value: AGenericStruct { key: 7, value: 8.5f64 },
+ };
+
+ zzz(); // #break
+}
+
+fn zzz() { () }
diff --git a/src/test/debuginfo/generic-tuple-style-enum.rs b/src/test/debuginfo/generic-tuple-style-enum.rs
new file mode 100644
index 000000000..60362e54e
--- /dev/null
+++ b/src/test/debuginfo/generic-tuple-style-enum.rs
@@ -0,0 +1,93 @@
+// Require a gdb or lldb that can read DW_TAG_variant_part.
+// min-gdb-version: 8.2
+// rust-lldb
+
+// compile-flags:-g
+
+// === GDB TESTS ===================================================================================
+
+// gdb-command:set print union on
+// gdb-command:run
+
+// gdb-command:print case1
+// gdbr-check:$1 = generic_tuple_style_enum::Regular<u16, u32, u64>::Case1(0, 31868, 31868, 31868, 31868)
+
+// gdb-command:print case2
+// gdbr-check:$2 = generic_tuple_style_enum::Regular<i16, i32, i64>::Case2(0, 286331153, 286331153)
+
+// gdb-command:print case3
+// gdbr-check:$3 = generic_tuple_style_enum::Regular<i16, i32, i64>::Case3(0, 6438275382588823897)
+
+// gdb-command:print univariant
+// gdbr-check:$4 = generic_tuple_style_enum::Univariant<i64>::TheOnlyCase(-1)
+
+
+// === LLDB TESTS ==================================================================================
+
+// lldb-command:run
+
+// lldb-command:print case1
+// lldbr-check:(generic_tuple_style_enum::Regular<u16, u32, u64>::Case1) case1 = { __0 = 0 __1 = 31868 __2 = 31868 __3 = 31868 __4 = 31868 }
+
+// lldb-command:print case2
+// lldbr-check:(generic_tuple_style_enum::Regular<i16, i32, i64>::Case2) case2 = Regular<i16, i32, i64>::Case2 { Case1: 0, Case2: 286331153, Case3: 286331153 }
+
+// lldb-command:print case3
+// lldbr-check:(generic_tuple_style_enum::Regular<i16, i32, i64>::Case3) case3 = Regular<i16, i32, i64>::Case3 { Case1: 0, Case2: 6438275382588823897 }
+
+// lldb-command:print univariant
+// lldbr-check:(generic_tuple_style_enum::Univariant<i64>) univariant = Univariant<i64> { TheOnlyCase: Univariant<i64>::TheOnlyCase(-1) }
+
+#![feature(omit_gdb_pretty_printer_section)]
+#![omit_gdb_pretty_printer_section]
+
+use self::Regular::{Case1, Case2, Case3};
+use self::Univariant::TheOnlyCase;
+
+// NOTE: This is a copy of the non-generic test case. The `Txx` type parameters have to be
+// substituted with something of size `xx` bits and the same alignment as an integer type of the
+// same size.
+
+// The first element is to ensure proper alignment, irrespective of the machines word size. Since
+// the size of the discriminant value is machine dependent, this has be taken into account when
+// datatype layout should be predictable as in this case.
+enum Regular<T16, T32, T64> {
+ Case1(T64, T16, T16, T16, T16),
+ Case2(T64, T32, T32),
+ Case3(T64, T64)
+}
+
+enum Univariant<T64> {
+ TheOnlyCase(T64)
+}
+
+fn main() {
+
+ // In order to avoid endianness trouble all of the following test values consist of a single
+ // repeated byte. This way each interpretation of the union should look the same, no matter if
+ // this is a big or little endian machine.
+
+ // 0b0111110001111100011111000111110001111100011111000111110001111100 = 8970181431921507452
+ // 0b01111100011111000111110001111100 = 2088533116
+ // 0b0111110001111100 = 31868
+ // 0b01111100 = 124
+ let case1: Regular<u16, u32, u64> = Case1(0_u64, 31868_u16, 31868_u16, 31868_u16, 31868_u16);
+
+ // 0b0001000100010001000100010001000100010001000100010001000100010001 = 1229782938247303441
+ // 0b00010001000100010001000100010001 = 286331153
+ // 0b0001000100010001 = 4369
+ // 0b00010001 = 17
+ let case2: Regular<i16, i32, i64> = Case2(0_i64, 286331153_i32, 286331153_i32);
+
+ // 0b0101100101011001010110010101100101011001010110010101100101011001 = 6438275382588823897
+ // 0b01011001010110010101100101011001 = 1499027801
+ // 0b0101100101011001 = 22873
+ // 0b01011001 = 89
+ let case3: Regular<i16, i32, i64> = Case3(0_i64, 6438275382588823897_i64);
+
+ let univariant = TheOnlyCase(-1_i64);
+
+ zzz(); // #break
+}
+
+fn zzz() { () }
diff --git a/src/test/debuginfo/include_string.rs b/src/test/debuginfo/include_string.rs
new file mode 100644
index 000000000..30e9deabb
--- /dev/null
+++ b/src/test/debuginfo/include_string.rs
@@ -0,0 +1,45 @@
+// min-lldb-version: 310
+
+// compile-flags:-g
+// gdb-command:run
+// gdb-command:print string1.length
+// gdb-check:$1 = 48
+// gdb-command:print string2.length
+// gdb-check:$2 = 49
+// gdb-command:print string3.length
+// gdb-check:$3 = 50
+// gdb-command:continue
+
+
+// === LLDB TESTS ==================================================================================
+
+// lldb-command:run
+
+// lldb-command:print string1.length
+// lldbg-check:[...]$0 = 48
+// lldbr-check:(usize) length = 48
+// lldb-command:print string2.length
+// lldbg-check:[...]$1 = 49
+// lldbr-check:(usize) length = 49
+// lldb-command:print string3.length
+// lldbg-check:[...]$2 = 50
+// lldbr-check:(usize) length = 50
+
+// lldb-command:continue
+
+#![allow(unused_variables)]
+#![feature(omit_gdb_pretty_printer_section)]
+#![omit_gdb_pretty_printer_section]
+
+// This test case makes sure that debug info does not ICE when include_str is
+// used multiple times (see issue #11322).
+
+fn main() {
+ let string1 = include_str!("text-to-include-1.txt");
+ let string2 = include_str!("text-to-include-2.txt");
+ let string3 = include_str!("text-to-include-3.txt");
+
+ zzz(); // #break
+}
+
+fn zzz() {()}
diff --git a/src/test/debuginfo/issue-12886.rs b/src/test/debuginfo/issue-12886.rs
new file mode 100644
index 000000000..389221cbb
--- /dev/null
+++ b/src/test/debuginfo/issue-12886.rs
@@ -0,0 +1,30 @@
+// ignore-windows failing on 64-bit bots FIXME #17638
+// ignore-lldb
+// ignore-aarch64
+
+// compile-flags:-g
+
+// gdb-command:run
+// gdb-command:next
+// gdb-check:[...]24[...]let s = Some(5).unwrap(); // #break
+// gdb-command:continue
+
+#![feature(omit_gdb_pretty_printer_section)]
+#![omit_gdb_pretty_printer_section]
+
+// IF YOU MODIFY THIS FILE, BE CAREFUL TO ADAPT THE LINE NUMBERS IN THE DEBUGGER COMMANDS
+
+// This test makes sure that gdb does not set unwanted breakpoints in inlined functions. If a
+// breakpoint existed in unwrap(), then calling `next` would (when stopped at `let s = ...`) stop
+// in unwrap() instead of stepping over the function invocation. By making sure that `s` is
+// contained in the output, after calling `next` just once, we can be sure that we did not stop in
+// unwrap(). (The testing framework doesn't allow for checking that some text is *not* contained in
+// the output, which is why we have to make the test in this kind of roundabout way)
+fn bar() -> isize {
+ let s = Some(5).unwrap(); // #break
+ s
+}
+
+fn main() {
+ let _ = bar();
+}
diff --git a/src/test/debuginfo/issue-13213.rs b/src/test/debuginfo/issue-13213.rs
new file mode 100644
index 000000000..393478460
--- /dev/null
+++ b/src/test/debuginfo/issue-13213.rs
@@ -0,0 +1,16 @@
+// min-lldb-version: 310
+// ignore-cdb: Fails with exit code 0xc0000135 ("the application failed to initialize properly")
+
+// aux-build:issue-13213-aux.rs
+
+extern crate issue_13213_aux;
+
+// compile-flags:-g
+
+// This tests make sure that we get no linker error when using a completely inlined static. Some
+// statics that are marked with AvailableExternallyLinkage in the importing crate, may actually not
+// be available because they have been optimized out from the exporting crate.
+fn main() {
+ let b: issue_13213_aux::S = issue_13213_aux::A;
+ println!("Nothing to do here...");
+}
diff --git a/src/test/debuginfo/issue-14411.rs b/src/test/debuginfo/issue-14411.rs
new file mode 100644
index 000000000..19609f428
--- /dev/null
+++ b/src/test/debuginfo/issue-14411.rs
@@ -0,0 +1,15 @@
+// min-lldb-version: 310
+
+// compile-flags:-g
+
+// No debugger interaction required: just make sure it compiles without
+// crashing.
+
+fn test(a: &Vec<u8>) {
+ print!("{}", a.len());
+}
+
+pub fn main() {
+ let data = vec![];
+ test(&data);
+}
diff --git a/src/test/debuginfo/issue-22656.rs b/src/test/debuginfo/issue-22656.rs
new file mode 100644
index 000000000..f28656627
--- /dev/null
+++ b/src/test/debuginfo/issue-22656.rs
@@ -0,0 +1,48 @@
+// This test makes sure that the LLDB pretty printer does not throw an exception
+// when trying to handle a Vec<> or anything else that contains zero-sized
+// fields.
+
+// min-lldb-version: 310
+// ignore-gdb
+
+// compile-flags:-g
+
+// === LLDB TESTS ==================================================================================
+// lldb-command:run
+
+// lldb-command:print v
+// lldbg-check:[...]$0 = size=3 { [0] = 1 [1] = 2 [2] = 3 }
+// lldbr-check:(alloc::vec::Vec<i32>) v = size=3 { [0] = 1 [1] = 2 [2] = 3 }
+// lldb-command:print zs
+// lldbg-check:[...]$1 = { x = y = 123 z = w = 456 }
+// lldbr-check:(issue_22656::StructWithZeroSizedField) zs = { x = y = 123 z = w = 456 }
+// lldbr-command:continue
+
+#![allow(unused_variables)]
+#![allow(dead_code)]
+#![feature(omit_gdb_pretty_printer_section)]
+#![omit_gdb_pretty_printer_section]
+
+struct ZeroSizedStruct;
+
+struct StructWithZeroSizedField {
+ x: ZeroSizedStruct,
+ y: u32,
+ z: ZeroSizedStruct,
+ w: u64
+}
+
+fn main() {
+ let v = vec![1,2,3];
+
+ let zs = StructWithZeroSizedField {
+ x: ZeroSizedStruct,
+ y: 123,
+ z: ZeroSizedStruct,
+ w: 456
+ };
+
+ zzz(); // #break
+}
+
+fn zzz() { () }
diff --git a/src/test/debuginfo/issue-57822.rs b/src/test/debuginfo/issue-57822.rs
new file mode 100644
index 000000000..62e7eb13c
--- /dev/null
+++ b/src/test/debuginfo/issue-57822.rs
@@ -0,0 +1,55 @@
+// This test makes sure that the LLDB pretty printer does not throw an exception
+// for nested closures and generators.
+
+// Require a gdb that can read DW_TAG_variant_part.
+// min-gdb-version: 8.2
+
+// compile-flags:-g
+
+// === GDB TESTS ===================================================================================
+
+// gdb-command:run
+
+// gdb-command:print g
+// gdb-check:$1 = issue_57822::main::{closure_env#1} {f: issue_57822::main::{closure_env#0} {x: 1}}
+
+// gdb-command:print b
+// gdb-check:$2 = issue_57822::main::{generator_env#3}::Unresumed{a: issue_57822::main::{generator_env#2}::Unresumed{y: 2}}
+
+// === LLDB TESTS ==================================================================================
+
+// lldb-command:run
+
+// lldb-command:print g
+// lldbg-check:(issue_57822::main::{closure_env#1}) $0 = { f = { x = 1 } }
+
+// lldb-command:print b
+// lldbg-check:(issue_57822::main::{generator_env#3}) $1 =
+
+#![feature(omit_gdb_pretty_printer_section, generators, generator_trait)]
+#![omit_gdb_pretty_printer_section]
+
+use std::ops::Generator;
+use std::pin::Pin;
+
+fn main() {
+ let mut x = 1;
+ let f = move || x;
+ let g = move || f();
+
+ let mut y = 2;
+ let mut a = move || {
+ y += 1;
+ yield;
+ };
+ let mut b = move || {
+ Pin::new(&mut a).resume(());
+ yield;
+ };
+
+ zzz(); // #break
+}
+
+fn zzz() {
+ ()
+}
diff --git a/src/test/debuginfo/issue-7712.rs b/src/test/debuginfo/issue-7712.rs
new file mode 100644
index 000000000..3a7565f55
--- /dev/null
+++ b/src/test/debuginfo/issue-7712.rs
@@ -0,0 +1,16 @@
+// compile-flags:-C debuginfo=1
+// min-lldb-version: 310
+
+pub trait TraitWithDefaultMethod : Sized {
+ fn method(self) {
+ ()
+ }
+}
+
+struct MyStruct;
+
+impl TraitWithDefaultMethod for MyStruct { }
+
+pub fn main() {
+ MyStruct.method();
+}
diff --git a/src/test/debuginfo/lexical-scope-in-for-loop.rs b/src/test/debuginfo/lexical-scope-in-for-loop.rs
new file mode 100644
index 000000000..28acab5cb
--- /dev/null
+++ b/src/test/debuginfo/lexical-scope-in-for-loop.rs
@@ -0,0 +1,109 @@
+// min-lldb-version: 310
+
+// compile-flags:-g
+
+// === GDB TESTS ===================================================================================
+
+// gdb-command:run
+
+// FIRST ITERATION
+// gdb-command:print x
+// gdb-check:$1 = 1
+// gdb-command:continue
+
+// gdb-command:print x
+// gdb-check:$2 = -1
+// gdb-command:continue
+
+// SECOND ITERATION
+// gdb-command:print x
+// gdb-check:$3 = 2
+// gdb-command:continue
+
+// gdb-command:print x
+// gdb-check:$4 = -2
+// gdb-command:continue
+
+// THIRD ITERATION
+// gdb-command:print x
+// gdb-check:$5 = 3
+// gdb-command:continue
+
+// gdb-command:print x
+// gdb-check:$6 = -3
+// gdb-command:continue
+
+// AFTER LOOP
+// gdb-command:print x
+// gdb-check:$7 = 1000000
+// gdb-command:continue
+
+
+// === LLDB TESTS ==================================================================================
+
+// lldb-command:run
+
+// FIRST ITERATION
+// lldb-command:print x
+// lldbg-check:[...]$0 = 1
+// lldbr-check:(i32) x = 1
+// lldb-command:continue
+
+// lldb-command:print x
+// lldbg-check:[...]$1 = -1
+// lldbr-check:(i32) x = -1
+// lldb-command:continue
+
+// SECOND ITERATION
+// lldb-command:print x
+// lldbg-check:[...]$2 = 2
+// lldbr-check:(i32) x = 2
+// lldb-command:continue
+
+// lldb-command:print x
+// lldbg-check:[...]$3 = -2
+// lldbr-check:(i32) x = -2
+// lldb-command:continue
+
+// THIRD ITERATION
+// lldb-command:print x
+// lldbg-check:[...]$4 = 3
+// lldbr-check:(i32) x = 3
+// lldb-command:continue
+
+// lldb-command:print x
+// lldbg-check:[...]$5 = -3
+// lldbr-check:(i32) x = -3
+// lldb-command:continue
+
+// AFTER LOOP
+// lldb-command:print x
+// lldbg-check:[...]$6 = 1000000
+// lldbr-check:(i32) x = 1000000
+// lldb-command:continue
+
+#![feature(omit_gdb_pretty_printer_section)]
+#![omit_gdb_pretty_printer_section]
+
+fn main() {
+
+ let range = [1, 2, 3];
+
+ let x = 1000000; // wan meeeljen doollaars!
+
+ for &x in &range {
+ zzz(); // #break
+ sentinel();
+
+ let x = -1 * x;
+
+ zzz(); // #break
+ sentinel();
+ }
+
+ zzz(); // #break
+ sentinel();
+}
+
+fn zzz() {()}
+fn sentinel() {()}
diff --git a/src/test/debuginfo/lexical-scope-in-if-let.rs b/src/test/debuginfo/lexical-scope-in-if-let.rs
new file mode 100644
index 000000000..cdc37ce48
--- /dev/null
+++ b/src/test/debuginfo/lexical-scope-in-if-let.rs
@@ -0,0 +1,100 @@
+// compile-flags:-g
+
+// === GDB TESTS ==================================================================================
+
+// gdb-command:run
+// gdb-command:info locals
+// gdb-check:a = 123
+
+// gdb-command:continue
+// gdb-command:info locals
+// gdb-check:x = 42
+// gdb-check:a = 123
+
+// gdb-command:continue
+// gdb-command:info locals
+// gdb-check:y = true
+// gdb-check:b = 456
+// gdb-check:x = 42
+// gdb-check:a = 123
+
+// gdb-command:continue
+// gdb-command:info locals
+// gdb-check:z = 10
+// gdb-check:c = 789
+// gdb-check:y = true
+// gdb-check:b = 456
+// gdb-check:x = 42
+// gdb-check:a = 123
+
+// === LLDB TESTS =================================================================================
+
+// lldb-command:run
+// lldb-command:frame variable
+// lldb-check:(int) a = 123
+
+// lldb-command:continue
+// lldb-command:frame variable
+// lldb-check:(int) a = 123 (int) x = 42
+
+// lldb-command:continue
+// lldb-command:frame variable
+// lldb-check:(int) a = 123 (int) x = 42 (int) b = 456 (bool) y = true
+
+// lldb-command:continue
+// lldb-command:frame variable
+// lldb-check:(int) a = 123 (int) x = 42 (int) b = 456 (bool) y = true (int) c = 789 (int) z = 10
+
+// === CDB TESTS ==================================================================================
+
+// cdb-command: g
+// cdb-command: dv
+// cdb-check:[...]a = 0n123
+
+// cdb-command: g
+// cdb-command: dv
+// cdb-check:[...]a = 0n123
+// cdb-check:[...]x = 0n42
+
+// cdb-command: g
+// cdb-command: dv
+// cdb-check:[...]y = true
+// cdb-check:[...]b = 0n456
+// cdb-check:[...]a = 0n123
+// cdb-check:[...]x = 0n42
+
+// cdb-command: g
+// cdb-command: dv
+// cdb-check:[...]z = 0n10
+// cdb-check:[...]c = 0n789
+// cdb-check:[...]y = true
+// cdb-check:[...]b = 0n456
+// cdb-check:[...]a = 0n123
+// cdb-check:[...]x = 0n42
+
+fn main() {
+ let a = id(123);
+
+ zzz(); // #break
+
+ if let Some(x) = id(Some(42)) {
+ zzz(); // #break
+
+ let b = id(456);
+
+ if let Ok(y) = id::<Result<bool, ()>>(Ok(true)) {
+ zzz(); // #break
+
+ let c = id(789);
+
+ if let (z, 42) = id((10, 42)) {
+ zzz(); // #break
+ }
+ }
+ }
+}
+
+#[inline(never)]
+fn id<T>(value: T) -> T { value }
+
+fn zzz() { }
diff --git a/src/test/debuginfo/lexical-scope-in-if.rs b/src/test/debuginfo/lexical-scope-in-if.rs
new file mode 100644
index 000000000..06bef329d
--- /dev/null
+++ b/src/test/debuginfo/lexical-scope-in-if.rs
@@ -0,0 +1,190 @@
+// min-lldb-version: 310
+
+// compile-flags:-g
+
+// === GDB TESTS ===================================================================================
+
+// gdb-command:run
+
+// BEFORE if
+// gdb-command:print x
+// gdb-check:$1 = 999
+// gdb-command:print y
+// gdb-check:$2 = -1
+// gdb-command:continue
+
+// AT BEGINNING of 'then' block
+// gdb-command:print x
+// gdb-check:$3 = 999
+// gdb-command:print y
+// gdb-check:$4 = -1
+// gdb-command:continue
+
+// AFTER 1st redeclaration of 'x'
+// gdb-command:print x
+// gdb-check:$5 = 1001
+// gdb-command:print y
+// gdb-check:$6 = -1
+// gdb-command:continue
+
+// AFTER 2st redeclaration of 'x'
+// gdb-command:print x
+// gdb-check:$7 = 1002
+// gdb-command:print y
+// gdb-check:$8 = 1003
+// gdb-command:continue
+
+// AFTER 1st if expression
+// gdb-command:print x
+// gdb-check:$9 = 999
+// gdb-command:print y
+// gdb-check:$10 = -1
+// gdb-command:continue
+
+// BEGINNING of else branch
+// gdb-command:print x
+// gdb-check:$11 = 999
+// gdb-command:print y
+// gdb-check:$12 = -1
+// gdb-command:continue
+
+// BEGINNING of else branch
+// gdb-command:print x
+// gdb-check:$13 = 1004
+// gdb-command:print y
+// gdb-check:$14 = 1005
+// gdb-command:continue
+
+// BEGINNING of else branch
+// gdb-command:print x
+// gdb-check:$15 = 999
+// gdb-command:print y
+// gdb-check:$16 = -1
+// gdb-command:continue
+
+
+// === LLDB TESTS ==================================================================================
+
+// lldb-command:run
+
+// BEFORE if
+// lldb-command:print x
+// lldbg-check:[...]$0 = 999
+// lldbr-check:(i32) x = 999
+// lldb-command:print y
+// lldbg-check:[...]$1 = -1
+// lldbr-check:(i32) y = -1
+// lldb-command:continue
+
+// AT BEGINNING of 'then' block
+// lldb-command:print x
+// lldbg-check:[...]$2 = 999
+// lldbr-check:(i32) x = 999
+// lldb-command:print y
+// lldbg-check:[...]$3 = -1
+// lldbr-check:(i32) y = -1
+// lldb-command:continue
+
+// AFTER 1st redeclaration of 'x'
+// lldb-command:print x
+// lldbg-check:[...]$4 = 1001
+// lldbr-check:(i32) x = 1001
+// lldb-command:print y
+// lldbg-check:[...]$5 = -1
+// lldbr-check:(i32) y = -1
+// lldb-command:continue
+
+// AFTER 2st redeclaration of 'x'
+// lldb-command:print x
+// lldbg-check:[...]$6 = 1002
+// lldbr-check:(i32) x = 1002
+// lldb-command:print y
+// lldbg-check:[...]$7 = 1003
+// lldbr-check:(i32) y = 1003
+// lldb-command:continue
+
+// AFTER 1st if expression
+// lldb-command:print x
+// lldbg-check:[...]$8 = 999
+// lldbr-check:(i32) x = 999
+// lldb-command:print y
+// lldbg-check:[...]$9 = -1
+// lldbr-check:(i32) y = -1
+// lldb-command:continue
+
+// BEGINNING of else branch
+// lldb-command:print x
+// lldbg-check:[...]$10 = 999
+// lldbr-check:(i32) x = 999
+// lldb-command:print y
+// lldbg-check:[...]$11 = -1
+// lldbr-check:(i32) y = -1
+// lldb-command:continue
+
+// BEGINNING of else branch
+// lldb-command:print x
+// lldbg-check:[...]$12 = 1004
+// lldbr-check:(i32) x = 1004
+// lldb-command:print y
+// lldbg-check:[...]$13 = 1005
+// lldbr-check:(i32) y = 1005
+// lldb-command:continue
+
+// BEGINNING of else branch
+// lldb-command:print x
+// lldbg-check:[...]$14 = 999
+// lldbr-check:(i32) x = 999
+// lldb-command:print y
+// lldbg-check:[...]$15 = -1
+// lldbr-check:(i32) y = -1
+// lldb-command:continue
+
+#![feature(omit_gdb_pretty_printer_section)]
+#![omit_gdb_pretty_printer_section]
+
+fn main() {
+
+ let x = 999;
+ let y = -1;
+
+ zzz(); // #break
+ sentinel();
+
+ if x < 1000 {
+ zzz(); // #break
+ sentinel();
+
+ let x = 1001;
+
+ zzz(); // #break
+ sentinel();
+
+ let x = 1002;
+ let y = 1003;
+ zzz(); // #break
+ sentinel();
+ } else {
+ unreachable!();
+ }
+
+ zzz(); // #break
+ sentinel();
+
+ if x > 1000 {
+ unreachable!();
+ } else {
+ zzz(); // #break
+ sentinel();
+
+ let x = 1004;
+ let y = 1005;
+ zzz(); // #break
+ sentinel();
+ }
+
+ zzz(); // #break
+ sentinel();
+}
+
+fn zzz() {()}
+fn sentinel() {()}
diff --git a/src/test/debuginfo/lexical-scope-in-match.rs b/src/test/debuginfo/lexical-scope-in-match.rs
new file mode 100644
index 000000000..64b7c809d
--- /dev/null
+++ b/src/test/debuginfo/lexical-scope-in-match.rs
@@ -0,0 +1,210 @@
+// min-lldb-version: 310
+
+// compile-flags:-g
+
+// === GDB TESTS ===================================================================================
+
+// gdb-command:run
+
+// gdb-command:print shadowed
+// gdb-check:$1 = 231
+// gdb-command:print not_shadowed
+// gdb-check:$2 = 232
+// gdb-command:continue
+
+// gdb-command:print shadowed
+// gdb-check:$3 = 233
+// gdb-command:print not_shadowed
+// gdb-check:$4 = 232
+// gdb-command:print local_to_arm
+// gdb-check:$5 = 234
+// gdb-command:continue
+
+// gdb-command:print shadowed
+// gdb-check:$6 = 236
+// gdb-command:print not_shadowed
+// gdb-check:$7 = 232
+// gdb-command:continue
+
+// gdb-command:print shadowed
+// gdb-check:$8 = 237
+// gdb-command:print not_shadowed
+// gdb-check:$9 = 232
+// gdb-command:print local_to_arm
+// gdb-check:$10 = 238
+// gdb-command:continue
+
+// gdb-command:print shadowed
+// gdb-check:$11 = 239
+// gdb-command:print not_shadowed
+// gdb-check:$12 = 232
+// gdb-command:continue
+
+// gdb-command:print shadowed
+// gdb-check:$13 = 241
+// gdb-command:print not_shadowed
+// gdb-check:$14 = 232
+// gdb-command:continue
+
+// gdb-command:print shadowed
+// gdb-check:$15 = 243
+// gdb-command:print *local_to_arm
+// gdb-check:$16 = 244
+// gdb-command:continue
+
+// gdb-command:print shadowed
+// gdb-check:$17 = 231
+// gdb-command:print not_shadowed
+// gdb-check:$18 = 232
+// gdb-command:continue
+
+
+// === LLDB TESTS ==================================================================================
+
+// lldb-command:run
+
+// lldb-command:print shadowed
+// lldbg-check:[...]$0 = 231
+// lldbr-check:(i32) shadowed = 231
+// lldb-command:print not_shadowed
+// lldbg-check:[...]$1 = 232
+// lldbr-check:(i32) not_shadowed = 232
+// lldb-command:continue
+
+// lldb-command:print shadowed
+// lldbg-check:[...]$2 = 233
+// lldbr-check:(i32) shadowed = 233
+// lldb-command:print not_shadowed
+// lldbg-check:[...]$3 = 232
+// lldbr-check:(i32) not_shadowed = 232
+// lldb-command:print local_to_arm
+// lldbg-check:[...]$4 = 234
+// lldbr-check:(i32) local_to_arm = 234
+// lldb-command:continue
+
+// lldb-command:print shadowed
+// lldbg-check:[...]$5 = 236
+// lldbr-check:(i32) shadowed = 236
+// lldb-command:print not_shadowed
+// lldbg-check:[...]$6 = 232
+// lldbr-check:(i32) not_shadowed = 232
+// lldb-command:continue
+
+// lldb-command:print shadowed
+// lldbg-check:[...]$7 = 237
+// lldbr-check:(isize) shadowed = 237
+// lldb-command:print not_shadowed
+// lldbg-check:[...]$8 = 232
+// lldbr-check:(i32) not_shadowed = 232
+// lldb-command:print local_to_arm
+// lldbg-check:[...]$9 = 238
+// lldbr-check:(isize) local_to_arm = 238
+// lldb-command:continue
+
+// lldb-command:print shadowed
+// lldbg-check:[...]$10 = 239
+// lldbr-check:(isize) shadowed = 239
+// lldb-command:print not_shadowed
+// lldbg-check:[...]$11 = 232
+// lldbr-check:(i32) not_shadowed = 232
+// lldb-command:continue
+
+// lldb-command:print shadowed
+// lldbg-check:[...]$12 = 241
+// lldbr-check:(isize) shadowed = 241
+// lldb-command:print not_shadowed
+// lldbg-check:[...]$13 = 232
+// lldbr-check:(i32) not_shadowed = 232
+// lldb-command:continue
+
+// lldb-command:print shadowed
+// lldbg-check:[...]$14 = 243
+// lldbr-check:(i32) shadowed = 243
+// lldb-command:print *local_to_arm
+// lldbg-check:[...]$15 = 244
+// lldbr-check:(i32) *local_to_arm = 244
+// lldb-command:continue
+
+// lldb-command:print shadowed
+// lldbg-check:[...]$16 = 231
+// lldbr-check:(i32) shadowed = 231
+// lldb-command:print not_shadowed
+// lldbg-check:[...]$17 = 232
+// lldbr-check:(i32) not_shadowed = 232
+// lldb-command:continue
+
+#![feature(omit_gdb_pretty_printer_section)]
+#![omit_gdb_pretty_printer_section]
+
+struct Struct {
+ x: isize,
+ y: isize
+}
+
+fn main() {
+
+ let shadowed = 231;
+ let not_shadowed = 232;
+
+ zzz(); // #break
+ sentinel();
+
+ match (233, 234) {
+ (shadowed, local_to_arm) => {
+
+ zzz(); // #break
+ sentinel();
+ }
+ }
+
+ match (235, 236) {
+ // with literal
+ (235, shadowed) => {
+
+ zzz(); // #break
+ sentinel();
+ }
+ _ => {}
+ }
+
+ match (Struct { x: 237, y: 238 }) {
+ Struct { x: shadowed, y: local_to_arm } => {
+
+ zzz(); // #break
+ sentinel();
+ }
+ }
+
+ match (Struct { x: 239, y: 240 }) {
+ // ignored field
+ Struct { x: shadowed, .. } => {
+
+ zzz(); // #break
+ sentinel();
+ }
+ }
+
+ match (Struct { x: 241, y: 242 }) {
+ // with literal
+ Struct { x: shadowed, y: 242 } => {
+
+ zzz(); // #break
+ sentinel();
+ }
+ _ => {}
+ }
+
+ match (243, 244) {
+ (shadowed, ref local_to_arm) => {
+
+ zzz(); // #break
+ sentinel();
+ }
+ }
+
+ zzz(); // #break
+ sentinel();
+}
+
+fn zzz() {()}
+fn sentinel() {()}
diff --git a/src/test/debuginfo/lexical-scope-in-parameterless-closure.rs b/src/test/debuginfo/lexical-scope-in-parameterless-closure.rs
new file mode 100644
index 000000000..d6b947fad
--- /dev/null
+++ b/src/test/debuginfo/lexical-scope-in-parameterless-closure.rs
@@ -0,0 +1,12 @@
+// min-lldb-version: 310
+
+// compile-flags:-C debuginfo=1
+
+// gdb-command:run
+// lldb-command:run
+
+// Nothing to do here really, just make sure it compiles. See issue #8513.
+fn main() {
+ let _ = ||();
+ let _ = (1_usize..3).map(|_| 5);
+}
diff --git a/src/test/debuginfo/lexical-scope-in-stack-closure.rs b/src/test/debuginfo/lexical-scope-in-stack-closure.rs
new file mode 100644
index 000000000..18d9a809e
--- /dev/null
+++ b/src/test/debuginfo/lexical-scope-in-stack-closure.rs
@@ -0,0 +1,103 @@
+// min-lldb-version: 310
+
+// compile-flags:-g
+
+// === GDB TESTS ===================================================================================
+
+// gdb-command:run
+
+// gdb-command:print x
+// gdb-check:$1 = false
+// gdb-command:continue
+
+// gdb-command:print x
+// gdb-check:$2 = false
+// gdb-command:continue
+
+// gdb-command:print x
+// gdb-check:$3 = 1000
+// gdb-command:continue
+
+// gdb-command:print x
+// gdb-check:$4 = 2.5
+// gdb-command:continue
+
+// gdb-command:print x
+// gdb-check:$5 = true
+// gdb-command:continue
+
+// gdb-command:print x
+// gdb-check:$6 = false
+// gdb-command:continue
+
+
+// === LLDB TESTS ==================================================================================
+
+// lldb-command:run
+
+// lldb-command:print x
+// lldbg-check:[...]$0 = false
+// lldbr-check:(bool) x = false
+// lldb-command:continue
+
+// lldb-command:print x
+// lldbg-check:[...]$1 = false
+// lldbr-check:(bool) x = false
+// lldb-command:continue
+
+// lldb-command:print x
+// lldbg-check:[...]$2 = 1000
+// lldbr-check:(isize) x = 1000
+// lldb-command:continue
+
+// lldb-command:print x
+// lldbg-check:[...]$3 = 2.5
+// lldbr-check:(f64) x = 2.5
+// lldb-command:continue
+
+// lldb-command:print x
+// lldbg-check:[...]$4 = true
+// lldbr-check:(bool) x = true
+// lldb-command:continue
+
+// lldb-command:print x
+// lldbg-check:[...]$5 = false
+// lldbr-check:(bool) x = false
+// lldb-command:continue
+
+#![feature(omit_gdb_pretty_printer_section)]
+#![omit_gdb_pretty_printer_section]
+
+fn main() {
+
+ let x = false;
+
+ zzz(); // #break
+ sentinel();
+
+ let closure = |x: isize| {
+ zzz(); // #break
+ sentinel();
+
+ let x = 2.5f64;
+
+ zzz(); // #break
+ sentinel();
+
+ let x = true;
+
+ zzz(); // #break
+ sentinel();
+ };
+
+ zzz(); // #break
+ sentinel();
+
+ closure(1000);
+
+ zzz(); // #break
+ sentinel();
+}
+
+fn zzz() {()}
+fn sentinel() {()}
diff --git a/src/test/debuginfo/lexical-scope-in-unconditional-loop.rs b/src/test/debuginfo/lexical-scope-in-unconditional-loop.rs
new file mode 100644
index 000000000..6b6af2063
--- /dev/null
+++ b/src/test/debuginfo/lexical-scope-in-unconditional-loop.rs
@@ -0,0 +1,182 @@
+// min-lldb-version: 310
+
+// compile-flags:-g
+
+// === GDB TESTS ===================================================================================
+
+// gdb-command:run
+
+// FIRST ITERATION
+// gdb-command:print x
+// gdb-check:$1 = 0
+// gdb-command:continue
+
+// gdb-command:print x
+// gdb-check:$2 = 1
+// gdb-command:continue
+
+// gdb-command:print x
+// gdb-check:$3 = 101
+// gdb-command:continue
+
+// gdb-command:print x
+// gdb-check:$4 = 101
+// gdb-command:continue
+
+// gdb-command:print x
+// gdb-check:$5 = -987
+// gdb-command:continue
+
+// gdb-command:print x
+// gdb-check:$6 = 101
+// gdb-command:continue
+
+
+// SECOND ITERATION
+// gdb-command:print x
+// gdb-check:$7 = 1
+// gdb-command:continue
+
+// gdb-command:print x
+// gdb-check:$8 = 2
+// gdb-command:continue
+
+// gdb-command:print x
+// gdb-check:$9 = 102
+// gdb-command:continue
+
+// gdb-command:print x
+// gdb-check:$10 = 102
+// gdb-command:continue
+
+// gdb-command:print x
+// gdb-check:$11 = -987
+// gdb-command:continue
+
+// gdb-command:print x
+// gdb-check:$12 = 102
+// gdb-command:continue
+
+// gdb-command:print x
+// gdb-check:$13 = 2
+// gdb-command:continue
+
+
+// === LLDB TESTS ==================================================================================
+
+// lldb-command:run
+
+// FIRST ITERATION
+// lldb-command:print x
+// lldbg-check:[...]$0 = 0
+// lldbr-check:(i32) x = 0
+// lldb-command:continue
+
+// lldb-command:print x
+// lldbg-check:[...]$1 = 1
+// lldbr-check:(i32) x = 1
+// lldb-command:continue
+
+// lldb-command:print x
+// lldbg-check:[...]$2 = 101
+// lldbr-check:(i32) x = 101
+// lldb-command:continue
+
+// lldb-command:print x
+// lldbg-check:[...]$3 = 101
+// lldbr-check:(i32) x = 101
+// lldb-command:continue
+
+// lldb-command:print x
+// lldbg-check:[...]$4 = -987
+// lldbr-check:(i32) x = -987
+// lldb-command:continue
+
+// lldb-command:print x
+// lldbg-check:[...]$5 = 101
+// lldbr-check:(i32) x = 101
+// lldb-command:continue
+
+
+// SECOND ITERATION
+// lldb-command:print x
+// lldbg-check:[...]$6 = 1
+// lldbr-check:(i32) x = 1
+// lldb-command:continue
+
+// lldb-command:print x
+// lldbg-check:[...]$7 = 2
+// lldbr-check:(i32) x = 2
+// lldb-command:continue
+
+// lldb-command:print x
+// lldbg-check:[...]$8 = 102
+// lldbr-check:(i32) x = 102
+// lldb-command:continue
+
+// lldb-command:print x
+// lldbg-check:[...]$9 = 102
+// lldbr-check:(i32) x = 102
+// lldb-command:continue
+
+// lldb-command:print x
+// lldbg-check:[...]$10 = -987
+// lldbr-check:(i32) x = -987
+// lldb-command:continue
+
+// lldb-command:print x
+// lldbg-check:[...]$11 = 102
+// lldbr-check:(i32) x = 102
+// lldb-command:continue
+
+// lldb-command:print x
+// lldbg-check:[...]$12 = 2
+// lldbr-check:(i32) x = 2
+// lldb-command:continue
+
+#![feature(omit_gdb_pretty_printer_section)]
+#![omit_gdb_pretty_printer_section]
+
+fn main() {
+
+ let mut x = 0;
+
+ loop {
+ if x >= 2 {
+ break;
+ }
+
+ zzz(); // #break
+ sentinel();
+
+ x += 1;
+ zzz(); // #break
+ sentinel();
+
+ // Shadow x
+ let x = x + 100;
+ zzz(); // #break
+ sentinel();
+
+ // open scope within loop's top level scope
+ {
+ zzz(); // #break
+ sentinel();
+
+ let x = -987;
+
+ zzz(); // #break
+ sentinel();
+ }
+
+ // Check that we get the x before the inner scope again
+ zzz(); // #break
+ sentinel();
+ }
+
+ zzz(); // #break
+ sentinel();
+}
+
+fn zzz() {()}
+fn sentinel() {()}
diff --git a/src/test/debuginfo/lexical-scope-in-unique-closure.rs b/src/test/debuginfo/lexical-scope-in-unique-closure.rs
new file mode 100644
index 000000000..9dd44ae8b
--- /dev/null
+++ b/src/test/debuginfo/lexical-scope-in-unique-closure.rs
@@ -0,0 +1,104 @@
+// min-lldb-version: 310
+
+// compile-flags:-g
+
+// === GDB TESTS ===================================================================================
+
+// gdb-command:run
+
+// gdb-command:print x
+// gdb-check:$1 = false
+// gdb-command:continue
+
+// gdb-command:print x
+// gdb-check:$2 = false
+// gdb-command:continue
+
+// gdb-command:print x
+// gdb-check:$3 = 1000
+// gdb-command:continue
+
+// gdb-command:print x
+// gdb-check:$4 = 2.5
+// gdb-command:continue
+
+// gdb-command:print x
+// gdb-check:$5 = true
+// gdb-command:continue
+
+// gdb-command:print x
+// gdb-check:$6 = false
+// gdb-command:continue
+
+
+// === LLDB TESTS ==================================================================================
+
+// lldb-command:run
+
+// lldb-command:print x
+// lldbg-check:[...]$0 = false
+// lldbr-check:(bool) x = false
+// lldb-command:continue
+
+// lldb-command:print x
+// lldbg-check:[...]$1 = false
+// lldbr-check:(bool) x = false
+// lldb-command:continue
+
+// lldb-command:print x
+// lldbg-check:[...]$2 = 1000
+// lldbr-check:(isize) x = 1000
+// lldb-command:continue
+
+// lldb-command:print x
+// lldbg-check:[...]$3 = 2.5
+// lldbr-check:(f64) x = 2.5
+// lldb-command:continue
+
+// lldb-command:print x
+// lldbg-check:[...]$4 = true
+// lldbr-check:(bool) x = true
+// lldb-command:continue
+
+// lldb-command:print x
+// lldbg-check:[...]$5 = false
+// lldbr-check:(bool) x = false
+// lldb-command:continue
+
+
+#![feature(omit_gdb_pretty_printer_section)]
+#![omit_gdb_pretty_printer_section]
+
+fn main() {
+
+ let x = false;
+
+ zzz(); // #break
+ sentinel();
+
+ let unique_closure = |x:isize| {
+ zzz(); // #break
+ sentinel();
+
+ let x = 2.5f64;
+
+ zzz(); // #break
+ sentinel();
+
+ let x = true;
+
+ zzz(); // #break
+ sentinel();
+ };
+
+ zzz(); // #break
+ sentinel();
+
+ unique_closure(1000);
+
+ zzz(); // #break
+ sentinel();
+}
+
+fn zzz() {()}
+fn sentinel() {()}
diff --git a/src/test/debuginfo/lexical-scope-in-while.rs b/src/test/debuginfo/lexical-scope-in-while.rs
new file mode 100644
index 000000000..07f4a846f
--- /dev/null
+++ b/src/test/debuginfo/lexical-scope-in-while.rs
@@ -0,0 +1,178 @@
+// min-lldb-version: 310
+
+// compile-flags:-g
+
+// === GDB TESTS ===================================================================================
+
+// gdb-command:run
+
+// FIRST ITERATION
+// gdb-command:print x
+// gdb-check:$1 = 0
+// gdb-command:continue
+
+// gdb-command:print x
+// gdb-check:$2 = 1
+// gdb-command:continue
+
+// gdb-command:print x
+// gdb-check:$3 = 101
+// gdb-command:continue
+
+// gdb-command:print x
+// gdb-check:$4 = 101
+// gdb-command:continue
+
+// gdb-command:print x
+// gdb-check:$5 = -987
+// gdb-command:continue
+
+// gdb-command:print x
+// gdb-check:$6 = 101
+// gdb-command:continue
+
+
+// SECOND ITERATION
+// gdb-command:print x
+// gdb-check:$7 = 1
+// gdb-command:continue
+
+// gdb-command:print x
+// gdb-check:$8 = 2
+// gdb-command:continue
+
+// gdb-command:print x
+// gdb-check:$9 = 102
+// gdb-command:continue
+
+// gdb-command:print x
+// gdb-check:$10 = 102
+// gdb-command:continue
+
+// gdb-command:print x
+// gdb-check:$11 = -987
+// gdb-command:continue
+
+// gdb-command:print x
+// gdb-check:$12 = 102
+// gdb-command:continue
+
+// gdb-command:print x
+// gdb-check:$13 = 2
+// gdb-command:continue
+
+
+// === LLDB TESTS ==================================================================================
+
+// lldb-command:run
+
+// FIRST ITERATION
+// lldb-command:print x
+// lldbg-check:[...]$0 = 0
+// lldbr-check:(i32) x = 0
+// lldb-command:continue
+
+// lldb-command:print x
+// lldbg-check:[...]$1 = 1
+// lldbr-check:(i32) x = 1
+// lldb-command:continue
+
+// lldb-command:print x
+// lldbg-check:[...]$2 = 101
+// lldbr-check:(i32) x = 101
+// lldb-command:continue
+
+// lldb-command:print x
+// lldbg-check:[...]$3 = 101
+// lldbr-check:(i32) x = 101
+// lldb-command:continue
+
+// lldb-command:print x
+// lldbg-check:[...]$4 = -987
+// lldbr-check:(i32) x = -987
+// lldb-command:continue
+
+// lldb-command:print x
+// lldbg-check:[...]$5 = 101
+// lldbr-check:(i32) x = 101
+// lldb-command:continue
+
+
+// SECOND ITERATION
+// lldb-command:print x
+// lldbg-check:[...]$6 = 1
+// lldbr-check:(i32) x = 1
+// lldb-command:continue
+
+// lldb-command:print x
+// lldbg-check:[...]$7 = 2
+// lldbr-check:(i32) x = 2
+// lldb-command:continue
+
+// lldb-command:print x
+// lldbg-check:[...]$8 = 102
+// lldbr-check:(i32) x = 102
+// lldb-command:continue
+
+// lldb-command:print x
+// lldbg-check:[...]$9 = 102
+// lldbr-check:(i32) x = 102
+// lldb-command:continue
+
+// lldb-command:print x
+// lldbg-check:[...]$10 = -987
+// lldbr-check:(i32) x = -987
+// lldb-command:continue
+
+// lldb-command:print x
+// lldbg-check:[...]$11 = 102
+// lldbr-check:(i32) x = 102
+// lldb-command:continue
+
+// lldb-command:print x
+// lldbg-check:[...]$12 = 2
+// lldbr-check:(i32) x = 2
+// lldb-command:continue
+
+#![feature(omit_gdb_pretty_printer_section)]
+#![omit_gdb_pretty_printer_section]
+
+fn main() {
+
+ let mut x = 0;
+
+ while x < 2 {
+ zzz(); // #break
+ sentinel();
+
+ x += 1;
+ zzz(); // #break
+ sentinel();
+
+ // Shadow x
+ let x = x + 100;
+ zzz(); // #break
+ sentinel();
+
+ // open scope within loop's top level scope
+ {
+ zzz(); // #break
+ sentinel();
+
+ let x = -987;
+
+ zzz(); // #break
+ sentinel();
+ }
+
+ // Check that we get the x before the inner scope again
+ zzz(); // #break
+ sentinel();
+ }
+
+ zzz(); // #break
+ sentinel();
+}
+
+fn zzz() {()}
+fn sentinel() {()}
diff --git a/src/test/debuginfo/lexical-scope-with-macro.rs b/src/test/debuginfo/lexical-scope-with-macro.rs
new file mode 100644
index 000000000..3dab79392
--- /dev/null
+++ b/src/test/debuginfo/lexical-scope-with-macro.rs
@@ -0,0 +1,177 @@
+// min-lldb-version: 310
+// ignore-lldb FIXME #48807
+
+// compile-flags:-g -Zdebug-macros
+
+// === GDB TESTS ===================================================================================
+
+// gdb-command:run
+
+// gdb-command:print a
+// gdb-check:$1 = 10
+// gdb-command:print b
+// gdb-check:$2 = 34
+// gdb-command:continue
+
+// gdb-command:print a
+// gdb-check:$3 = 890242
+// gdb-command:print b
+// gdb-check:$4 = 34
+// gdb-command:continue
+
+// gdb-command:print a
+// gdb-check:$5 = 10
+// gdb-command:print b
+// gdb-check:$6 = 34
+// gdb-command:continue
+
+// gdb-command:print a
+// gdb-check:$7 = 102
+// gdb-command:print b
+// gdb-check:$8 = 34
+// gdb-command:continue
+
+// gdb-command:print a
+// gdb-check:$9 = 110
+// gdb-command:print b
+// gdb-check:$10 = 34
+// gdb-command:continue
+
+// gdb-command:print a
+// gdb-check:$11 = 10
+// gdb-command:print b
+// gdb-check:$12 = 34
+// gdb-command:continue
+
+// gdb-command:print a
+// gdb-check:$13 = 10
+// gdb-command:print b
+// gdb-check:$14 = 34
+// gdb-command:print c
+// gdb-check:$15 = 400
+// gdb-command:continue
+
+
+// === LLDB TESTS ==================================================================================
+
+// lldb-command:run
+
+// lldb-command:print a
+// lldbg-check:[...]$0 = 10
+// lldbr-check:(i32) a = 10
+// lldb-command:print b
+// lldbg-check:[...]$1 = 34
+// lldbr-check:(i32) b = 34
+// lldb-command:continue
+
+// lldb-command:print a
+// lldbg-check:[...]$2 = 890242
+// lldbr-check:(i32) a = 10
+// lldb-command:print b
+// lldbg-check:[...]$3 = 34
+// lldbr-check:(i32) b = 34
+// lldb-command:continue
+
+// lldb-command:print a
+// lldbg-check:[...]$4 = 10
+// lldbr-check:(i32) a = 10
+// lldb-command:print b
+// lldbg-check:[...]$5 = 34
+// lldbr-check:(i32) b = 34
+// lldb-command:continue
+
+// lldb-command:print a
+// lldbg-check:[...]$6 = 102
+// lldbr-check:(i32) a = 10
+// lldb-command:print b
+// lldbg-check:[...]$7 = 34
+// lldbr-check:(i32) b = 34
+// lldb-command:continue
+
+// Don't test this with rust-enabled lldb for now; see issue #48807
+// lldbg-command:print a
+// lldbg-check:[...]$8 = 110
+// lldbg-command:print b
+// lldbg-check:[...]$9 = 34
+// lldbg-command:continue
+
+// lldbg-command:print a
+// lldbg-check:[...]$10 = 10
+// lldbg-command:print b
+// lldbg-check:[...]$11 = 34
+// lldbg-command:continue
+
+// lldbg-command:print a
+// lldbg-check:[...]$12 = 10
+// lldbg-command:print b
+// lldbg-check:[...]$13 = 34
+// lldbg-command:print c
+// lldbg-check:[...]$14 = 400
+// lldbg-command:continue
+
+
+#![feature(omit_gdb_pretty_printer_section)]
+#![omit_gdb_pretty_printer_section]
+
+macro_rules! trivial {
+ ($e1:expr) => ($e1)
+}
+
+macro_rules! no_new_scope {
+ ($e1:expr) => (($e1 + 2) - 1)
+}
+
+macro_rules! new_scope {
+ () => ({
+ let a = 890242;
+ zzz(); // #break
+ sentinel();
+ })
+}
+
+macro_rules! shadow_within_macro {
+ ($e1:expr) => ({
+ let a = $e1 + 2;
+
+ zzz(); // #break
+ sentinel();
+
+ let a = $e1 + 10;
+
+ zzz(); // #break
+ sentinel();
+ })
+}
+
+
+macro_rules! dup_expr {
+ ($e1:expr) => (($e1) + ($e1))
+}
+
+
+fn main() {
+
+ let a = trivial!(10);
+ let b = no_new_scope!(33);
+
+ zzz(); // #break
+ sentinel();
+
+ new_scope!();
+
+ zzz(); // #break
+ sentinel();
+
+ shadow_within_macro!(100);
+
+ zzz(); // #break
+ sentinel();
+
+ let c = dup_expr!(10 * 20);
+
+ zzz(); // #break
+ sentinel();
+}
+
+fn zzz() {()}
+fn sentinel() {()}
diff --git a/src/test/debuginfo/lexical-scopes-in-block-expression.rs b/src/test/debuginfo/lexical-scopes-in-block-expression.rs
new file mode 100644
index 000000000..72621ffc7
--- /dev/null
+++ b/src/test/debuginfo/lexical-scopes-in-block-expression.rs
@@ -0,0 +1,562 @@
+// min-lldb-version: 310
+// ignore-gdb // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155
+
+// compile-flags:-g
+
+// === GDB TESTS ===================================================================================
+
+// gdb-command:run
+
+// gdbg-command:print 'lexical_scopes_in_block_expression::MUT_INT'
+// gdbr-command:print lexical_scopes_in_block_expression::MUT_INT
+// gdb-check:$1 = 0
+
+// STRUCT EXPRESSION
+// gdb-command:print val
+// gdb-check:$2 = -1
+// gdb-command:print ten
+// gdb-check:$3 = 10
+// gdb-command:continue
+
+// gdb-command:print val
+// gdb-check:$4 = 11
+// gdbg-command:print 'lexical_scopes_in_block_expression::MUT_INT'
+// gdbr-command:print lexical_scopes_in_block_expression::MUT_INT
+// gdb-check:$5 = 1
+// gdb-command:print ten
+// gdb-check:$6 = 10
+// gdb-command:continue
+
+// gdb-command:print val
+// gdb-check:$7 = -1
+// gdb-command:print ten
+// gdb-check:$8 = 10
+// gdb-command:continue
+
+// FUNCTION CALL
+// gdb-command:print val
+// gdb-check:$9 = -1
+// gdb-command:print ten
+// gdb-check:$10 = 10
+// gdb-command:continue
+
+// gdb-command:print val
+// gdb-check:$11 = 12
+// gdbg-command:print 'lexical_scopes_in_block_expression::MUT_INT'
+// gdbr-command:print lexical_scopes_in_block_expression::MUT_INT
+// gdb-check:$12 = 2
+// gdb-command:print ten
+// gdb-check:$13 = 10
+// gdb-command:continue
+
+// gdb-command:print val
+// gdb-check:$14 = -1
+// gdb-command:print ten
+// gdb-check:$15 = 10
+// gdb-command:continue
+
+// TUPLE EXPRESSION
+// gdb-command:print val
+// gdb-check:$16 = -1
+// gdb-command:print ten
+// gdb-check:$17 = 10
+// gdb-command:continue
+
+// gdb-command:print val
+// gdb-check:$18 = 13
+// gdbg-command:print 'lexical_scopes_in_block_expression::MUT_INT'
+// gdbr-command:print lexical_scopes_in_block_expression::MUT_INT
+// gdb-check:$19 = 3
+// gdb-command:print ten
+// gdb-check:$20 = 10
+// gdb-command:continue
+
+// gdb-command:print val
+// gdb-check:$21 = -1
+// gdb-command:print ten
+// gdb-check:$22 = 10
+// gdb-command:continue
+
+// VEC EXPRESSION
+// gdb-command:print val
+// gdb-check:$23 = -1
+// gdb-command:print ten
+// gdb-check:$24 = 10
+// gdb-command:continue
+
+// gdb-command:print val
+// gdb-check:$25 = 14
+// gdbg-command:print 'lexical_scopes_in_block_expression::MUT_INT'
+// gdbr-command:print lexical_scopes_in_block_expression::MUT_INT
+// gdb-check:$26 = 4
+// gdb-command:print ten
+// gdb-check:$27 = 10
+// gdb-command:continue
+
+// gdb-command:print val
+// gdb-check:$28 = -1
+// gdb-command:print ten
+// gdb-check:$29 = 10
+// gdb-command:continue
+
+// REPEAT VEC EXPRESSION
+// gdb-command:print val
+// gdb-check:$30 = -1
+// gdb-command:print ten
+// gdb-check:$31 = 10
+// gdb-command:continue
+
+// gdb-command:print val
+// gdb-check:$32 = 15
+// gdbg-command:print 'lexical_scopes_in_block_expression::MUT_INT'
+// gdbr-command:print lexical_scopes_in_block_expression::MUT_INT
+// gdb-check:$33 = 5
+// gdb-command:print ten
+// gdb-check:$34 = 10
+// gdb-command:continue
+
+// gdb-command:print val
+// gdb-check:$35 = -1
+// gdb-command:print ten
+// gdb-check:$36 = 10
+// gdb-command:continue
+
+// ASSIGNMENT EXPRESSION
+// gdb-command:print val
+// gdb-check:$37 = -1
+// gdb-command:print ten
+// gdb-check:$38 = 10
+// gdb-command:continue
+
+// gdb-command:print val
+// gdb-check:$39 = 16
+// gdbg-command:print 'lexical_scopes_in_block_expression::MUT_INT'
+// gdbr-command:print lexical_scopes_in_block_expression::MUT_INT
+// gdb-check:$40 = 6
+// gdb-command:print ten
+// gdb-check:$41 = 10
+// gdb-command:continue
+
+// gdb-command:print val
+// gdb-check:$42 = -1
+// gdb-command:print ten
+// gdb-check:$43 = 10
+// gdb-command:continue
+
+
+// ARITHMETIC EXPRESSION
+// gdb-command:print val
+// gdb-check:$44 = -1
+// gdb-command:print ten
+// gdb-check:$45 = 10
+// gdb-command:continue
+
+// gdb-command:print val
+// gdb-check:$46 = 17
+// gdbg-command:print 'lexical_scopes_in_block_expression::MUT_INT'
+// gdbr-command:print lexical_scopes_in_block_expression::MUT_INT
+// gdb-check:$47 = 7
+// gdb-command:print ten
+// gdb-check:$48 = 10
+// gdb-command:continue
+
+// gdb-command:print val
+// gdb-check:$49 = -1
+// gdb-command:print ten
+// gdb-check:$50 = 10
+// gdb-command:continue
+
+// INDEX EXPRESSION
+// gdb-command:print val
+// gdb-check:$51 = -1
+// gdb-command:print ten
+// gdb-check:$52 = 10
+// gdb-command:continue
+
+// gdb-command:print val
+// gdb-check:$53 = 18
+// gdbg-command:print 'lexical_scopes_in_block_expression::MUT_INT'
+// gdbr-command:print lexical_scopes_in_block_expression::MUT_INT
+// gdb-check:$54 = 8
+// gdb-command:print ten
+// gdb-check:$55 = 10
+// gdb-command:continue
+
+// gdb-command:print val
+// gdb-check:$56 = -1
+// gdb-command:print ten
+// gdb-check:$57 = 10
+// gdb-command:continue
+
+
+// === LLDB TESTS ==================================================================================
+
+// lldb-command:run
+
+// STRUCT EXPRESSION
+// lldb-command:print val
+// lldbg-check:[...]$0 = -1
+// lldbr-check:(i32) val = -1
+// lldb-command:print ten
+// lldbg-check:[...]$1 = 10
+// lldbr-check:(isize) ten = 10
+// lldb-command:continue
+
+// lldb-command:print val
+// lldbg-check:[...]$2 = 11
+// lldbr-check:(isize) val = 11
+// lldb-command:print ten
+// lldbg-check:[...]$3 = 10
+// lldbr-check:(isize) ten = 10
+// lldb-command:continue
+
+// lldb-command:print val
+// lldbg-check:[...]$4 = -1
+// lldbr-check:(i32) val = -1
+// lldb-command:print ten
+// lldbg-check:[...]$5 = 10
+// lldbr-check:(isize) ten = 10
+// lldb-command:continue
+
+// FUNCTION CALL
+// lldb-command:print val
+// lldbg-check:[...]$6 = -1
+// lldbr-check:(i32) val = -1
+// lldb-command:print ten
+// lldbg-check:[...]$7 = 10
+// lldbr-check:(isize) ten = 10
+// lldb-command:continue
+
+// lldb-command:print val
+// lldbg-check:[...]$8 = 12
+// lldbr-check:(isize) val = 12
+// lldb-command:print ten
+// lldbg-check:[...]$9 = 10
+// lldbr-check:(isize) ten = 10
+// lldb-command:continue
+
+// lldb-command:print val
+// lldbg-check:[...]$10 = -1
+// lldbr-check:(i32) val = -1
+// lldb-command:print ten
+// lldbg-check:[...]$11 = 10
+// lldbr-check:(isize) ten = 10
+// lldb-command:continue
+
+// TUPLE EXPRESSION
+// lldb-command:print val
+// lldbg-check:[...]$12 = -1
+// lldbr-check:(i32) val = -1
+// lldb-command:print ten
+// lldbg-check:[...]$13 = 10
+// lldbr-check:(isize) ten = 10
+// lldb-command:continue
+
+// lldb-command:print val
+// lldbg-check:[...]$14 = 13
+// lldbr-check:(isize) val = 13
+// lldb-command:print ten
+// lldbg-check:[...]$15 = 10
+// lldbr-check:(isize) ten = 10
+// lldb-command:continue
+
+// lldb-command:print val
+// lldbg-check:[...]$16 = -1
+// lldbr-check:(i32) val = -1
+// lldb-command:print ten
+// lldbg-check:[...]$17 = 10
+// lldbr-check:(isize) ten = 10
+// lldb-command:continue
+
+// VEC EXPRESSION
+// lldb-command:print val
+// lldbg-check:[...]$18 = -1
+// lldbr-check:(i32) val = -1
+// lldb-command:print ten
+// lldbg-check:[...]$19 = 10
+// lldbr-check:(isize) ten = 10
+// lldb-command:continue
+
+// lldb-command:print val
+// lldbg-check:[...]$20 = 14
+// lldbr-check:(isize) val = 14
+// lldb-command:print ten
+// lldbg-check:[...]$21 = 10
+// lldbr-check:(isize) ten = 10
+// lldb-command:continue
+
+// lldb-command:print val
+// lldbg-check:[...]$22 = -1
+// lldbr-check:(i32) val = -1
+// lldb-command:print ten
+// lldbg-check:[...]$23 = 10
+// lldbr-check:(isize) ten = 10
+// lldb-command:continue
+
+// REPEAT VEC EXPRESSION
+// lldb-command:print val
+// lldbg-check:[...]$24 = -1
+// lldbr-check:(i32) val = -1
+// lldb-command:print ten
+// lldbg-check:[...]$25 = 10
+// lldbr-check:(isize) ten = 10
+// lldb-command:continue
+
+// lldb-command:print val
+// lldbg-check:[...]$26 = 15
+// lldbr-check:(isize) val = 15
+// lldb-command:print ten
+// lldbg-check:[...]$27 = 10
+// lldbr-check:(isize) ten = 10
+// lldb-command:continue
+
+// lldb-command:print val
+// lldbg-check:[...]$28 = -1
+// lldbr-check:(i32) val = -1
+// lldb-command:print ten
+// lldbg-check:[...]$29 = 10
+// lldbr-check:(isize) ten = 10
+// lldb-command:continue
+
+// ASSIGNMENT EXPRESSION
+// lldb-command:print val
+// lldbg-check:[...]$30 = -1
+// lldbr-check:(i32) val = -1
+// lldb-command:print ten
+// lldbg-check:[...]$31 = 10
+// lldbr-check:(isize) ten = 10
+// lldb-command:continue
+
+// lldb-command:print val
+// lldbg-check:[...]$32 = 16
+// lldbr-check:(isize) val = 16
+// lldb-command:print ten
+// lldbg-check:[...]$33 = 10
+// lldbr-check:(isize) ten = 10
+// lldb-command:continue
+
+// lldb-command:print val
+// lldbg-check:[...]$34 = -1
+// lldbr-check:(i32) val = -1
+// lldb-command:print ten
+// lldbg-check:[...]$35 = 10
+// lldbr-check:(isize) ten = 10
+// lldb-command:continue
+
+
+// ARITHMETIC EXPRESSION
+// lldb-command:print val
+// lldbg-check:[...]$36 = -1
+// lldbr-check:(i32) val = -1
+// lldb-command:print ten
+// lldbg-check:[...]$37 = 10
+// lldbr-check:(isize) ten = 10
+// lldb-command:continue
+
+// lldb-command:print val
+// lldbg-check:[...]$38 = 17
+// lldbr-check:(isize) val = 17
+// lldb-command:print ten
+// lldbg-check:[...]$39 = 10
+// lldbr-check:(isize) ten = 10
+// lldb-command:continue
+
+// lldb-command:print val
+// lldbg-check:[...]$40 = -1
+// lldbr-check:(i32) val = -1
+// lldb-command:print ten
+// lldbg-check:[...]$41 = 10
+// lldbr-check:(isize) ten = 10
+// lldb-command:continue
+
+// INDEX EXPRESSION
+// lldb-command:print val
+// lldbg-check:[...]$42 = -1
+// lldbr-check:(i32) val = -1
+// lldb-command:print ten
+// lldbg-check:[...]$43 = 10
+// lldbr-check:(isize) ten = 10
+// lldb-command:continue
+
+// lldb-command:print val
+// lldbg-check:[...]$44 = 18
+// lldbr-check:(isize) val = 18
+// lldb-command:print ten
+// lldbg-check:[...]$45 = 10
+// lldbr-check:(isize) ten = 10
+// lldb-command:continue
+
+// lldb-command:print val
+// lldbg-check:[...]$46 = -1
+// lldbr-check:(i32) val = -1
+// lldb-command:print ten
+// lldbg-check:[...]$47 = 10
+// lldbr-check:(isize) ten = 10
+// lldb-command:continue
+
+#![allow(unused_variables)]
+#![allow(unused_assignments)]
+#![feature(omit_gdb_pretty_printer_section)]
+#![omit_gdb_pretty_printer_section]
+
+static mut MUT_INT: isize = 0;
+
+struct Point {
+ x: isize,
+ y: isize
+}
+
+fn a_function(x: isize) -> isize {
+ x + 1
+}
+
+fn main() {
+
+ let val = -1;
+ let ten = 10;
+
+ // surrounded by struct expression
+ let point = Point {
+ x: {
+ zzz(); // #break
+ sentinel();
+
+ let val = ten + 1;
+ unsafe {MUT_INT = 1;};
+
+ zzz(); // #break
+ sentinel();
+
+ val
+ },
+ y: 10
+ };
+
+ zzz(); // #break
+ sentinel();
+
+ // surrounded by function call
+ let _ = a_function({
+ zzz(); // #break
+ sentinel();
+
+ let val = ten + 2;
+ unsafe {MUT_INT = 2;};
+
+ zzz(); // #break
+ sentinel();
+
+ val
+ });
+
+ zzz(); // #break
+ sentinel();
+
+
+ // surrounded by tup
+ let _ = ({
+ zzz(); // #break
+ sentinel();
+
+ let val = ten + 3;
+ unsafe {MUT_INT = 3;};
+
+ zzz(); // #break
+ sentinel();
+
+ val
+ }, 0);
+
+ zzz(); // #break
+ sentinel();
+
+ // surrounded by vec
+ let _ = [{
+ zzz(); // #break
+ sentinel();
+
+ let val = ten + 4;
+ unsafe {MUT_INT = 4;};
+
+ zzz(); // #break
+ sentinel();
+
+ val
+ }, 0, 0];
+
+ zzz(); // #break
+ sentinel();
+
+ // surrounded by repeat vec
+ let _ = [{
+ zzz(); // #break
+ sentinel();
+
+ let val = ten + 5;
+ unsafe {MUT_INT = 5;};
+
+ zzz(); // #break
+ sentinel();
+
+ val
+ }; 10];
+
+ zzz(); // #break
+ sentinel();
+
+ // assignment expression
+ let mut var = 0;
+ var = {
+ zzz(); // #break
+ sentinel();
+
+ let val = ten + 6;
+ unsafe {MUT_INT = 6;};
+
+ zzz(); // #break
+ sentinel();
+
+ val
+ };
+
+ zzz(); // #break
+ sentinel();
+
+ // arithmetic expression
+ var = 10 + -{
+ zzz(); // #break
+ sentinel();
+
+ let val = ten + 7;
+ unsafe {MUT_INT = 7;};
+
+ zzz(); // #break
+ sentinel();
+
+ val
+ } * 5;
+
+ zzz(); // #break
+ sentinel();
+
+ // index expression
+ let a_vector = [10; 20];
+ let _ = a_vector[{
+ zzz(); // #break
+ sentinel();
+
+ let val = ten + 8;
+ unsafe {MUT_INT = 8;};
+
+ zzz(); // #break
+ sentinel();
+
+ val as usize
+ }];
+
+ zzz(); // #break
+ sentinel();
+}
+
+fn zzz() {()}
+fn sentinel() {()}
diff --git a/src/test/debuginfo/limited-debuginfo.rs b/src/test/debuginfo/limited-debuginfo.rs
new file mode 100644
index 000000000..bd381cd0e
--- /dev/null
+++ b/src/test/debuginfo/limited-debuginfo.rs
@@ -0,0 +1,51 @@
+// ignore-lldb
+// ignore-gdb // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155
+
+// compile-flags:-C debuginfo=1
+
+// Make sure functions have proper names
+// gdb-command:info functions
+// gdbg-check:[...]void[...]main([...]);
+// gdbr-check:fn limited_debuginfo::main();
+// gdbg-check:[...]void[...]some_function([...]);
+// gdbr-check:fn limited_debuginfo::some_function();
+// gdbg-check:[...]void[...]some_other_function([...]);
+// gdbr-check:fn limited_debuginfo::some_other_function();
+// gdbg-check:[...]void[...]zzz([...]);
+// gdbr-check:fn limited_debuginfo::zzz();
+
+// gdb-command:run
+
+// Make sure there is no information about locals
+// gdb-command:info locals
+// gdb-check:No locals.
+// gdb-command:continue
+
+
+#![allow(unused_variables)]
+#![feature(omit_gdb_pretty_printer_section)]
+#![omit_gdb_pretty_printer_section]
+
+struct Struct {
+ a: i64,
+ b: i32
+}
+
+fn main() {
+ some_function(101, 202);
+ some_other_function(1, 2);
+}
+
+
+fn zzz() {()}
+
+fn some_function(a: isize, b: isize) {
+ let some_variable = Struct { a: 11, b: 22 };
+ let some_other_variable = 23;
+
+ for x in 0..1 {
+ zzz(); // #break
+ }
+}
+
+fn some_other_function(a: isize, b: isize) -> bool { true }
diff --git a/src/test/debuginfo/macro-stepping.inc b/src/test/debuginfo/macro-stepping.inc
new file mode 100644
index 000000000..1bcbcfd6c
--- /dev/null
+++ b/src/test/debuginfo/macro-stepping.inc
@@ -0,0 +1,7 @@
+fn included() {
+ foo!(); // #inc-loc1
+
+ foo2!(); // #inc-loc2
+
+ zzz(); // #inc-loc3
+}
diff --git a/src/test/debuginfo/macro-stepping.rs b/src/test/debuginfo/macro-stepping.rs
new file mode 100644
index 000000000..e4b2b7b79
--- /dev/null
+++ b/src/test/debuginfo/macro-stepping.rs
@@ -0,0 +1,121 @@
+// ignore-windows
+// ignore-android
+// ignore-aarch64
+// min-lldb-version: 310
+// ignore-gdb // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155
+
+// aux-build:macro-stepping.rs
+
+#![allow(unused)]
+
+#[macro_use]
+extern crate macro_stepping; // exports new_scope!()
+
+// compile-flags:-g
+
+// === GDB TESTS ===================================================================================
+
+// gdb-command:run
+// gdb-command:next
+// gdb-command:frame
+// gdb-check:[...]#loc1[...]
+// gdb-command:next
+// gdb-command:frame
+// gdb-check:[...]#loc2[...]
+// gdb-command:next
+// gdb-command:frame
+// gdb-check:[...]#loc3[...]
+// gdb-command:next
+// gdb-command:frame
+// gdb-check:[...]#loc4[...]
+// gdb-command:next
+// gdb-command:frame
+// gdb-check:[...]#loc5[...]
+// gdb-command:next
+// gdb-command:frame
+// gdb-check:[...]#loc6[...]
+
+// gdb-command:continue
+// gdb-command:step
+// gdb-command:frame
+// gdb-check:[...]#inc-loc1[...]
+// gdb-command:next
+// gdb-command:frame
+// gdb-check:[...]#inc-loc2[...]
+// gdb-command:next
+// gdb-command:frame
+// gdb-check:[...]#inc-loc3[...]
+
+// === LLDB TESTS ==================================================================================
+
+// lldb-command:set set stop-line-count-before 0
+// lldb-command:set set stop-line-count-after 1
+// Can't set both to zero or lldb will stop printing source at all. So it will output the current
+// line and the next. We deal with this by having at least 2 lines between the #loc's
+
+// lldb-command:run
+// lldb-command:next
+// lldb-command:frame select
+// lldb-check:[...]#loc1[...]
+// lldb-command:next
+// lldb-command:frame select
+// lldb-check:[...]#loc2[...]
+// lldb-command:next
+// lldb-command:frame select
+// lldb-check:[...]#loc3[...]
+// lldb-command:next
+// lldb-command:frame select
+// lldb-check:[...]#loc4[...]
+// lldb-command:next
+// lldb-command:frame select
+// lldb-check:[...]#loc5[...]
+
+// lldb-command:continue
+// lldb-command:step
+// lldb-command:frame select
+// lldb-check:[...]#inc-loc1[...]
+// lldb-command:next
+// lldb-command:frame select
+// lldb-check:[...]#inc-loc2[...]
+// lldb-command:next
+// lldb-command:frame select
+// lldb-check:[...]#inc-loc3[...]
+
+macro_rules! foo {
+ () => {
+ let a = 1;
+ let b = 2;
+ let c = 3;
+ }
+}
+
+macro_rules! foo2 {
+ () => {
+ foo!();
+ let x = 1;
+ foo!();
+ }
+}
+
+fn main() {
+ zzz(); // #break
+
+ foo!(); // #loc1
+
+ foo2!(); // #loc2
+
+ let x = vec![42]; // #loc3
+
+ new_scope!(); // #loc4
+
+ println!("Hello {}", // #loc5
+ "world");
+
+ zzz(); // #loc6
+
+ included(); // #break
+}
+
+fn zzz() {()}
+
+include!("macro-stepping.inc");
diff --git a/src/test/debuginfo/marker-types.rs b/src/test/debuginfo/marker-types.rs
new file mode 100644
index 000000000..8373d7856
--- /dev/null
+++ b/src/test/debuginfo/marker-types.rs
@@ -0,0 +1,49 @@
+// only-cdb
+// compile-flags:-g
+
+// === CDB TESTS ==================================================================================
+
+// cdb-command: g
+
+// cdb-command: dx nonnull
+// cdb-check:nonnull : NonNull(0x[...]: 0xc) [Type: core::ptr::non_null::NonNull<u32>]
+// cdb-check: [<Raw View>] [Type: core::ptr::non_null::NonNull<u32>]
+// cdb-check: 0xc [Type: unsigned int]
+
+// cdb-command: dx manuallydrop
+// cdb-check:manuallydrop : 12345 [Type: core::mem::manually_drop::ManuallyDrop<i32>]
+// cdb-check: [<Raw View>] [Type: core::mem::manually_drop::ManuallyDrop<i32>]
+
+// cdb-command: dx pin
+// cdb-check:pin : Pin(0x[...]: "this") [Type: core::pin::Pin<ref_mut$<alloc::string::String> >]
+// cdb-check: [<Raw View>] [Type: core::pin::Pin<ref_mut$<alloc::string::String> >]
+// cdb-check: [len] : 0x4 [Type: unsigned [...]]
+// cdb-check: [capacity] : 0x4 [Type: unsigned [...]]
+// cdb-check: [chars] : "this"
+
+// cdb-command: dx unique
+// cdb-check:unique : Unique(0x[...]: (0x2a, 4321)) [Type: core::ptr::unique::Unique<tuple$<u64,i32> >]
+// cdb-check: [<Raw View>] [Type: core::ptr::unique::Unique<tuple$<u64,i32> >]
+// cdb-check: [0] : 0x2a [Type: unsigned __int64]
+// cdb-check: [1] : 4321 [Type: int]
+
+#![feature(ptr_internals)]
+
+use std::mem::ManuallyDrop;
+use std::pin::Pin;
+use std::ptr::{NonNull, Unique};
+
+fn main() {
+ let nonnull: NonNull<_> = (&12u32).into();
+
+ let manuallydrop = ManuallyDrop::new(12345i32);
+
+ let mut s = "this".to_string();
+ let pin = Pin::new(&mut s);
+
+ let unique: Unique<_> = (&mut (42u64, 4321i32)).into();
+
+ zzz(); // #break
+}
+
+fn zzz() { }
diff --git a/src/test/debuginfo/method-on-enum.rs b/src/test/debuginfo/method-on-enum.rs
new file mode 100644
index 000000000..aaa9bd9d6
--- /dev/null
+++ b/src/test/debuginfo/method-on-enum.rs
@@ -0,0 +1,148 @@
+// min-lldb-version: 310
+// ignore-test // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155
+
+// compile-flags:-g
+
+// === GDB TESTS ===================================================================================
+
+// gdb-command:run
+
+// STACK BY REF
+// gdb-command:print *self
+// gdbg-check:$1 = {{RUST$ENUM$DISR = Variant2, [...]}, {RUST$ENUM$DISR = Variant2, __0 = 117901063}}
+// gdbr-check:$1 = method_on_enum::Enum::Variant2(117901063)
+// gdb-command:print arg1
+// gdb-check:$2 = -1
+// gdb-command:print arg2
+// gdb-check:$3 = -2
+// gdb-command:continue
+
+// STACK BY VAL
+// gdb-command:print self
+// gdbg-check:$4 = {{RUST$ENUM$DISR = Variant2, [...]}, {RUST$ENUM$DISR = Variant2, __0 = 117901063}}
+// gdbr-check:$4 = method_on_enum::Enum::Variant2(117901063)
+// gdb-command:print arg1
+// gdb-check:$5 = -3
+// gdb-command:print arg2
+// gdb-check:$6 = -4
+// gdb-command:continue
+
+// OWNED BY REF
+// gdb-command:print *self
+// gdbg-check:$7 = {{RUST$ENUM$DISR = Variant1, x = 1799, y = 1799}, {RUST$ENUM$DISR = Variant1, [...]}}
+// gdbr-check:$7 = method_on_enum::Enum::Variant1{x: 1799, y: 1799}
+// gdb-command:print arg1
+// gdb-check:$8 = -5
+// gdb-command:print arg2
+// gdb-check:$9 = -6
+// gdb-command:continue
+
+// OWNED BY VAL
+// gdb-command:print self
+// gdbg-check:$10 = {{RUST$ENUM$DISR = Variant1, x = 1799, y = 1799}, {RUST$ENUM$DISR = Variant1, [...]}}
+// gdbr-check:$10 = method_on_enum::Enum::Variant1{x: 1799, y: 1799}
+// gdb-command:print arg1
+// gdb-check:$11 = -7
+// gdb-command:print arg2
+// gdb-check:$12 = -8
+// gdb-command:continue
+
+// OWNED MOVED
+// gdb-command:print *self
+// gdbg-check:$13 = {{RUST$ENUM$DISR = Variant1, x = 1799, y = 1799}, {RUST$ENUM$DISR = Variant1, [...]}}
+// gdbr-check:$13 = method_on_enum::Enum::Variant1{x: 1799, y: 1799}
+// gdb-command:print arg1
+// gdb-check:$14 = -9
+// gdb-command:print arg2
+// gdb-check:$15 = -10
+// gdb-command:continue
+
+
+// === LLDB TESTS ==================================================================================
+
+// lldb-command:run
+
+// STACK BY REF
+// lldb-command:print *self
+// lldb-check:[...]$0 = Variant2(117901063)
+// lldb-command:print arg1
+// lldb-check:[...]$1 = -1
+// lldb-command:print arg2
+// lldb-check:[...]$2 = -2
+// lldb-command:continue
+
+// STACK BY VAL
+// lldb-command:print self
+// lldb-check:[...]$3 = Variant2(117901063)
+// lldb-command:print arg1
+// lldb-check:[...]$4 = -3
+// lldb-command:print arg2
+// lldb-check:[...]$5 = -4
+// lldb-command:continue
+
+// OWNED BY REF
+// lldb-command:print *self
+// lldb-check:[...]$6 = Variant1 { x: 1799, y: 1799 }
+// lldb-command:print arg1
+// lldb-check:[...]$7 = -5
+// lldb-command:print arg2
+// lldb-check:[...]$8 = -6
+// lldb-command:continue
+
+// OWNED BY VAL
+// lldb-command:print self
+// lldb-check:[...]$9 = Variant1 { x: 1799, y: 1799 }
+// lldb-command:print arg1
+// lldb-check:[...]$10 = -7
+// lldb-command:print arg2
+// lldb-check:[...]$11 = -8
+// lldb-command:continue
+
+// OWNED MOVED
+// lldb-command:print *self
+// lldb-check:[...]$12 = Variant1 { x: 1799, y: 1799 }
+// lldb-command:print arg1
+// lldb-check:[...]$13 = -9
+// lldb-command:print arg2
+// lldb-check:[...]$14 = -10
+// lldb-command:continue
+
+#![feature(omit_gdb_pretty_printer_section)]
+#![omit_gdb_pretty_printer_section]
+
+#[derive(Copy, Clone)]
+enum Enum {
+ Variant1 { x: u16, y: u16 },
+ Variant2 (u32)
+}
+
+impl Enum {
+
+ fn self_by_ref(&self, arg1: isize, arg2: isize) -> isize {
+ zzz(); // #break
+ arg1 + arg2
+ }
+
+ fn self_by_val(self, arg1: isize, arg2: isize) -> isize {
+ zzz(); // #break
+ arg1 + arg2
+ }
+
+ fn self_owned(self: Box<Enum>, arg1: isize, arg2: isize) -> isize {
+ zzz(); // #break
+ arg1 + arg2
+ }
+}
+
+fn main() {
+ let stack = Enum::Variant2(117901063);
+ let _ = stack.self_by_ref(-1, -2);
+ let _ = stack.self_by_val(-3, -4);
+
+ let owned: Box<_> = Box::new(Enum::Variant1{ x: 1799, y: 1799 });
+ let _ = owned.self_by_ref(-5, -6);
+ let _ = owned.self_by_val(-7, -8);
+ let _ = owned.self_owned(-9, -10);
+}
+
+fn zzz() {()}
diff --git a/src/test/debuginfo/method-on-generic-struct.rs b/src/test/debuginfo/method-on-generic-struct.rs
new file mode 100644
index 000000000..bf0474491
--- /dev/null
+++ b/src/test/debuginfo/method-on-generic-struct.rs
@@ -0,0 +1,163 @@
+// Some versions of the non-rust-enabled LLDB print the wrong generic
+// parameter type names in this test.
+// rust-lldb
+
+// compile-flags:-g
+
+// === GDB TESTS ===================================================================================
+
+// gdb-command:run
+
+// STACK BY REF
+// gdb-command:print *self
+// gdbg-check:$1 = {x = {__0 = 8888, __1 = -8888}}
+// gdbr-check:$1 = method_on_generic_struct::Struct<(u32, i32)> {x: (8888, -8888)}
+// gdb-command:print arg1
+// gdb-check:$2 = -1
+// gdb-command:print arg2
+// gdb-check:$3 = -2
+// gdb-command:continue
+
+// STACK BY VAL
+// gdb-command:print self
+// gdbg-check:$4 = {x = {__0 = 8888, __1 = -8888}}
+// gdbr-check:$4 = method_on_generic_struct::Struct<(u32, i32)> {x: (8888, -8888)}
+// gdb-command:print arg1
+// gdb-check:$5 = -3
+// gdb-command:print arg2
+// gdb-check:$6 = -4
+// gdb-command:continue
+
+// OWNED BY REF
+// gdb-command:print *self
+// gdbg-check:$7 = {x = 1234.5}
+// gdbr-check:$7 = method_on_generic_struct::Struct<f64> {x: 1234.5}
+// gdb-command:print arg1
+// gdb-check:$8 = -5
+// gdb-command:print arg2
+// gdb-check:$9 = -6
+// gdb-command:continue
+
+// OWNED BY VAL
+// gdb-command:print self
+// gdbg-check:$10 = {x = 1234.5}
+// gdbr-check:$10 = method_on_generic_struct::Struct<f64> {x: 1234.5}
+// gdb-command:print arg1
+// gdb-check:$11 = -7
+// gdb-command:print arg2
+// gdb-check:$12 = -8
+// gdb-command:continue
+
+// OWNED MOVED
+// gdb-command:print *self
+// gdbg-check:$13 = {x = 1234.5}
+// gdbr-check:$13 = method_on_generic_struct::Struct<f64> {x: 1234.5}
+// gdb-command:print arg1
+// gdb-check:$14 = -9
+// gdb-command:print arg2
+// gdb-check:$15 = -10
+// gdb-command:continue
+
+
+// === LLDB TESTS ==================================================================================
+
+// lldb-command:run
+
+// STACK BY REF
+// lldb-command:print *self
+// lldbg-check:[...]$0 = Struct<(u32, i32)> { x: (8888, -8888) }
+// lldbr-check:(method_on_generic_struct::Struct<(u32, i32)>) *self = { x = { = 8888 = -8888 } }
+// lldb-command:print arg1
+// lldbg-check:[...]$1 = -1
+// lldbr-check:(isize) arg1 = -1
+// lldb-command:print arg2
+// lldbg-check:[...]$2 = -2
+// lldbr-check:(isize) arg2 = -2
+// lldb-command:continue
+
+// STACK BY VAL
+// lldb-command:print self
+// lldbg-check:[...]$3 = Struct<(u32, i32)> { x: (8888, -8888) }
+// lldbr-check:(method_on_generic_struct::Struct<(u32, i32)>) self = { x = { = 8888 = -8888 } }
+// lldb-command:print arg1
+// lldbg-check:[...]$4 = -3
+// lldbr-check:(isize) arg1 = -3
+// lldb-command:print arg2
+// lldbg-check:[...]$5 = -4
+// lldbr-check:(isize) arg2 = -4
+// lldb-command:continue
+
+// OWNED BY REF
+// lldb-command:print *self
+// lldbg-check:[...]$6 = Struct<f64> { x: 1234.5 }
+// lldbr-check:(method_on_generic_struct::Struct<f64>) *self = Struct<f64> { x: 1234.5 }
+// lldb-command:print arg1
+// lldbg-check:[...]$7 = -5
+// lldbr-check:(isize) arg1 = -5
+// lldb-command:print arg2
+// lldbg-check:[...]$8 = -6
+// lldbr-check:(isize) arg2 = -6
+// lldb-command:continue
+
+// OWNED BY VAL
+// lldb-command:print self
+// lldbg-check:[...]$9 = Struct<f64> { x: 1234.5 }
+// lldbr-check:(method_on_generic_struct::Struct<f64>) self = Struct<f64> { x: 1234.5 }
+// lldb-command:print arg1
+// lldbg-check:[...]$10 = -7
+// lldbr-check:(isize) arg1 = -7
+// lldb-command:print arg2
+// lldbg-check:[...]$11 = -8
+// lldbr-check:(isize) arg2 = -8
+// lldb-command:continue
+
+// OWNED MOVED
+// lldb-command:print *self
+// lldbg-check:[...]$12 = Struct<f64> { x: 1234.5 }
+// lldbr-check:(method_on_generic_struct::Struct<f64>) *self = Struct<f64> { x: 1234.5 }
+// lldb-command:print arg1
+// lldbg-check:[...]$13 = -9
+// lldbr-check:(isize) arg1 = -9
+// lldb-command:print arg2
+// lldbg-check:[...]$14 = -10
+// lldbr-check:(isize) arg2 = -10
+// lldb-command:continue
+
+#![feature(omit_gdb_pretty_printer_section)]
+#![omit_gdb_pretty_printer_section]
+
+#[derive(Copy, Clone)]
+struct Struct<T> {
+ x: T
+}
+
+impl<T> Struct<T> {
+
+ fn self_by_ref(&self, arg1: isize, arg2: isize) -> isize {
+ zzz(); // #break
+ arg1 + arg2
+ }
+
+ fn self_by_val(self, arg1: isize, arg2: isize) -> isize {
+ zzz(); // #break
+ arg1 + arg2
+ }
+
+ fn self_owned(self: Box<Struct<T>>, arg1: isize, arg2: isize) -> isize {
+ zzz(); // #break
+ arg1 + arg2
+ }
+}
+
+fn main() {
+ let stack = Struct { x: (8888_u32, -8888_i32) };
+ let _ = stack.self_by_ref(-1, -2);
+ let _ = stack.self_by_val(-3, -4);
+
+ let owned: Box<_> = Box::new(Struct { x: 1234.5f64 });
+ let _ = owned.self_by_ref(-5, -6);
+ let _ = owned.self_by_val(-7, -8);
+ let _ = owned.self_owned(-9, -10);
+}
+
+fn zzz() {()}
diff --git a/src/test/debuginfo/method-on-struct.rs b/src/test/debuginfo/method-on-struct.rs
new file mode 100644
index 000000000..deed4f9cc
--- /dev/null
+++ b/src/test/debuginfo/method-on-struct.rs
@@ -0,0 +1,161 @@
+// min-lldb-version: 310
+
+// compile-flags:-g
+
+// === GDB TESTS ===================================================================================
+
+// gdb-command:run
+
+// STACK BY REF
+// gdb-command:print *self
+// gdbg-check:$1 = {x = 100}
+// gdbr-check:$1 = method_on_struct::Struct {x: 100}
+// gdb-command:print arg1
+// gdb-check:$2 = -1
+// gdb-command:print arg2
+// gdb-check:$3 = -2
+// gdb-command:continue
+
+// STACK BY VAL
+// gdb-command:print self
+// gdbg-check:$4 = {x = 100}
+// gdbr-check:$4 = method_on_struct::Struct {x: 100}
+// gdb-command:print arg1
+// gdb-check:$5 = -3
+// gdb-command:print arg2
+// gdb-check:$6 = -4
+// gdb-command:continue
+
+// OWNED BY REF
+// gdb-command:print *self
+// gdbg-check:$7 = {x = 200}
+// gdbr-check:$7 = method_on_struct::Struct {x: 200}
+// gdb-command:print arg1
+// gdb-check:$8 = -5
+// gdb-command:print arg2
+// gdb-check:$9 = -6
+// gdb-command:continue
+
+// OWNED BY VAL
+// gdb-command:print self
+// gdbg-check:$10 = {x = 200}
+// gdbr-check:$10 = method_on_struct::Struct {x: 200}
+// gdb-command:print arg1
+// gdb-check:$11 = -7
+// gdb-command:print arg2
+// gdb-check:$12 = -8
+// gdb-command:continue
+
+// OWNED MOVED
+// gdb-command:print *self
+// gdbg-check:$13 = {x = 200}
+// gdbr-check:$13 = method_on_struct::Struct {x: 200}
+// gdb-command:print arg1
+// gdb-check:$14 = -9
+// gdb-command:print arg2
+// gdb-check:$15 = -10
+// gdb-command:continue
+
+
+// === LLDB TESTS ==================================================================================
+
+// lldb-command:run
+
+// STACK BY REF
+// lldb-command:print *self
+// lldbg-check:[...]$0 = { x = 100 }
+// lldbr-check:(method_on_struct::Struct) *self = Struct { x: 100 }
+// lldb-command:print arg1
+// lldbg-check:[...]$1 = -1
+// lldbr-check:(isize) arg1 = -1
+// lldb-command:print arg2
+// lldbg-check:[...]$2 = -2
+// lldbr-check:(isize) arg2 = -2
+// lldb-command:continue
+
+// STACK BY VAL
+// lldb-command:print self
+// lldbg-check:[...]$3 = { x = 100 }
+// lldbr-check:(method_on_struct::Struct) self = Struct { x: 100 }
+// lldb-command:print arg1
+// lldbg-check:[...]$4 = -3
+// lldbr-check:(isize) arg1 = -3
+// lldb-command:print arg2
+// lldbg-check:[...]$5 = -4
+// lldbr-check:(isize) arg2 = -4
+// lldb-command:continue
+
+// OWNED BY REF
+// lldb-command:print *self
+// lldbg-check:[...]$6 = { x = 200 }
+// lldbr-check:(method_on_struct::Struct) *self = Struct { x: 200 }
+// lldb-command:print arg1
+// lldbg-check:[...]$7 = -5
+// lldbr-check:(isize) arg1 = -5
+// lldb-command:print arg2
+// lldbg-check:[...]$8 = -6
+// lldbr-check:(isize) arg2 = -6
+// lldb-command:continue
+
+// OWNED BY VAL
+// lldb-command:print self
+// lldbg-check:[...]$9 = { x = 200 }
+// lldbr-check:(method_on_struct::Struct) self = Struct { x: 200 }
+// lldb-command:print arg1
+// lldbg-check:[...]$10 = -7
+// lldbr-check:(isize) arg1 = -7
+// lldb-command:print arg2
+// lldbg-check:[...]$11 = -8
+// lldbr-check:(isize) arg2 = -8
+// lldb-command:continue
+
+// OWNED MOVED
+// lldb-command:print *self
+// lldbg-check:[...]$12 = { x = 200 }
+// lldbr-check:(method_on_struct::Struct) *self = Struct { x: 200 }
+// lldb-command:print arg1
+// lldbg-check:[...]$13 = -9
+// lldbr-check:(isize) arg1 = -9
+// lldb-command:print arg2
+// lldbg-check:[...]$14 = -10
+// lldbr-check:(isize) arg2 = -10
+// lldb-command:continue
+
+#![feature(omit_gdb_pretty_printer_section)]
+#![omit_gdb_pretty_printer_section]
+
+#[derive(Copy, Clone)]
+struct Struct {
+ x: isize
+}
+
+impl Struct {
+
+ fn self_by_ref(&self, arg1: isize, arg2: isize) -> isize {
+ zzz(); // #break
+ self.x + arg1 + arg2
+ }
+
+ fn self_by_val(self, arg1: isize, arg2: isize) -> isize {
+ zzz(); // #break
+ self.x + arg1 + arg2
+ }
+
+ fn self_owned(self: Box<Struct>, arg1: isize, arg2: isize) -> isize {
+ zzz(); // #break
+ self.x + arg1 + arg2
+ }
+}
+
+fn main() {
+ let stack = Struct { x: 100 };
+ let _ = stack.self_by_ref(-1, -2);
+ let _ = stack.self_by_val(-3, -4);
+
+ let owned: Box<_> = Box::new(Struct { x: 200 });
+ let _ = owned.self_by_ref(-5, -6);
+ let _ = owned.self_by_val(-7, -8);
+ let _ = owned.self_owned(-9, -10);
+}
+
+fn zzz() {()}
diff --git a/src/test/debuginfo/method-on-trait.rs b/src/test/debuginfo/method-on-trait.rs
new file mode 100644
index 000000000..7ebebfa72
--- /dev/null
+++ b/src/test/debuginfo/method-on-trait.rs
@@ -0,0 +1,167 @@
+// min-lldb-version: 310
+
+// compile-flags:-g
+
+// === GDB TESTS ===================================================================================
+
+// gdb-command:run
+
+// STACK BY REF
+// gdb-command:print *self
+// gdbg-check:$1 = {x = 100}
+// gdbr-check:$1 = method_on_trait::Struct {x: 100}
+// gdb-command:print arg1
+// gdb-check:$2 = -1
+// gdb-command:print arg2
+// gdb-check:$3 = -2
+// gdb-command:continue
+
+// STACK BY VAL
+// gdb-command:print self
+// gdbg-check:$4 = {x = 100}
+// gdbr-check:$4 = method_on_trait::Struct {x: 100}
+// gdb-command:print arg1
+// gdb-check:$5 = -3
+// gdb-command:print arg2
+// gdb-check:$6 = -4
+// gdb-command:continue
+
+// OWNED BY REF
+// gdb-command:print *self
+// gdbg-check:$7 = {x = 200}
+// gdbr-check:$7 = method_on_trait::Struct {x: 200}
+// gdb-command:print arg1
+// gdb-check:$8 = -5
+// gdb-command:print arg2
+// gdb-check:$9 = -6
+// gdb-command:continue
+
+// OWNED BY VAL
+// gdb-command:print self
+// gdbg-check:$10 = {x = 200}
+// gdbr-check:$10 = method_on_trait::Struct {x: 200}
+// gdb-command:print arg1
+// gdb-check:$11 = -7
+// gdb-command:print arg2
+// gdb-check:$12 = -8
+// gdb-command:continue
+
+// OWNED MOVED
+// gdb-command:print *self
+// gdbg-check:$13 = {x = 200}
+// gdbr-check:$13 = method_on_trait::Struct {x: 200}
+// gdb-command:print arg1
+// gdb-check:$14 = -9
+// gdb-command:print arg2
+// gdb-check:$15 = -10
+// gdb-command:continue
+
+
+// === LLDB TESTS ==================================================================================
+
+// lldb-command:run
+
+// STACK BY REF
+// lldb-command:print *self
+// lldbg-check:[...]$0 = { x = 100 }
+// lldbr-check:(method_on_trait::Struct) *self = { x = 100 }
+// lldb-command:print arg1
+// lldbg-check:[...]$1 = -1
+// lldbr-check:(isize) arg1 = -1
+// lldb-command:print arg2
+// lldbg-check:[...]$2 = -2
+// lldbr-check:(isize) arg2 = -2
+// lldb-command:continue
+
+// STACK BY VAL
+// lldb-command:print self
+// lldbg-check:[...]$3 = { x = 100 }
+// lldbr-check:(method_on_trait::Struct) self = { x = 100 }
+// lldb-command:print arg1
+// lldbg-check:[...]$4 = -3
+// lldbr-check:(isize) arg1 = -3
+// lldb-command:print arg2
+// lldbg-check:[...]$5 = -4
+// lldbr-check:(isize) arg2 = -4
+// lldb-command:continue
+
+// OWNED BY REF
+// lldb-command:print *self
+// lldbg-check:[...]$6 = { x = 200 }
+// lldbr-check:(method_on_trait::Struct) *self = { x = 200 }
+// lldb-command:print arg1
+// lldbg-check:[...]$7 = -5
+// lldbr-check:(isize) arg1 = -5
+// lldb-command:print arg2
+// lldbg-check:[...]$8 = -6
+// lldbr-check:(isize) arg2 = -6
+// lldb-command:continue
+
+// OWNED BY VAL
+// lldb-command:print self
+// lldbg-check:[...]$9 = { x = 200 }
+// lldbr-check:(method_on_trait::Struct) self = { x = 200 }
+// lldb-command:print arg1
+// lldbg-check:[...]$10 = -7
+// lldbr-check:(isize) arg1 = -7
+// lldb-command:print arg2
+// lldbg-check:[...]$11 = -8
+// lldbr-check:(isize) arg2 = -8
+// lldb-command:continue
+
+// OWNED MOVED
+// lldb-command:print *self
+// lldbg-check:[...]$12 = { x = 200 }
+// lldbr-check:(method_on_trait::Struct) *self = { x = 200 }
+// lldb-command:print arg1
+// lldbg-check:[...]$13 = -9
+// lldbr-check:(isize) arg1 = -9
+// lldb-command:print arg2
+// lldbg-check:[...]$14 = -10
+// lldbr-check:(isize) arg2 = -10
+// lldb-command:continue
+
+#![feature(omit_gdb_pretty_printer_section)]
+#![omit_gdb_pretty_printer_section]
+
+#[derive(Copy, Clone)]
+struct Struct {
+ x: isize
+}
+
+trait Trait {
+ fn self_by_ref(&self, arg1: isize, arg2: isize) -> isize;
+ fn self_by_val(self, arg1: isize, arg2: isize) -> isize;
+ fn self_owned(self: Box<Self>, arg1: isize, arg2: isize) -> isize;
+}
+
+impl Trait for Struct {
+
+ fn self_by_ref(&self, arg1: isize, arg2: isize) -> isize {
+ zzz(); // #break
+ self.x + arg1 + arg2
+ }
+
+ fn self_by_val(self, arg1: isize, arg2: isize) -> isize {
+ zzz(); // #break
+ self.x + arg1 + arg2
+ }
+
+ fn self_owned(self: Box<Struct>, arg1: isize, arg2: isize) -> isize {
+ zzz(); // #break
+ self.x + arg1 + arg2
+ }
+}
+
+fn main() {
+ let stack = Struct { x: 100 };
+ let _ = stack.self_by_ref(-1, -2);
+ let _ = stack.self_by_val(-3, -4);
+
+ let owned: Box<_> = Box::new(Struct { x: 200 });
+ let _ = owned.self_by_ref(-5, -6);
+ let _ = owned.self_by_val(-7, -8);
+ let _ = owned.self_owned(-9, -10);
+}
+
+fn zzz() {()}
diff --git a/src/test/debuginfo/method-on-tuple-struct.rs b/src/test/debuginfo/method-on-tuple-struct.rs
new file mode 100644
index 000000000..a5a87b2ad
--- /dev/null
+++ b/src/test/debuginfo/method-on-tuple-struct.rs
@@ -0,0 +1,159 @@
+// min-lldb-version: 310
+
+// compile-flags:-g
+
+// === GDB TESTS ===================================================================================
+
+// gdb-command:run
+
+// STACK BY REF
+// gdb-command:print *self
+// gdbg-check:$1 = {__0 = 100, __1 = -100.5}
+// gdbr-check:$1 = method_on_tuple_struct::TupleStruct (100, -100.5)
+// gdb-command:print arg1
+// gdb-check:$2 = -1
+// gdb-command:print arg2
+// gdb-check:$3 = -2
+// gdb-command:continue
+
+// STACK BY VAL
+// gdb-command:print self
+// gdbg-check:$4 = {__0 = 100, __1 = -100.5}
+// gdbr-check:$4 = method_on_tuple_struct::TupleStruct (100, -100.5)
+// gdb-command:print arg1
+// gdb-check:$5 = -3
+// gdb-command:print arg2
+// gdb-check:$6 = -4
+// gdb-command:continue
+
+// OWNED BY REF
+// gdb-command:print *self
+// gdbg-check:$7 = {__0 = 200, __1 = -200.5}
+// gdbr-check:$7 = method_on_tuple_struct::TupleStruct (200, -200.5)
+// gdb-command:print arg1
+// gdb-check:$8 = -5
+// gdb-command:print arg2
+// gdb-check:$9 = -6
+// gdb-command:continue
+
+// OWNED BY VAL
+// gdb-command:print self
+// gdbg-check:$10 = {__0 = 200, __1 = -200.5}
+// gdbr-check:$10 = method_on_tuple_struct::TupleStruct (200, -200.5)
+// gdb-command:print arg1
+// gdb-check:$11 = -7
+// gdb-command:print arg2
+// gdb-check:$12 = -8
+// gdb-command:continue
+
+// OWNED MOVED
+// gdb-command:print *self
+// gdbg-check:$13 = {__0 = 200, __1 = -200.5}
+// gdbr-check:$13 = method_on_tuple_struct::TupleStruct (200, -200.5)
+// gdb-command:print arg1
+// gdb-check:$14 = -9
+// gdb-command:print arg2
+// gdb-check:$15 = -10
+// gdb-command:continue
+
+
+// === LLDB TESTS ==================================================================================
+
+// lldb-command:run
+
+// STACK BY REF
+// lldb-command:print *self
+// lldbg-check:[...]$0 = { 0 = 100 1 = -100.5 }
+// lldbr-check:(method_on_tuple_struct::TupleStruct) *self = { 0 = 100 1 = -100.5 }
+// lldb-command:print arg1
+// lldbg-check:[...]$1 = -1
+// lldbr-check:(isize) arg1 = -1
+// lldb-command:print arg2
+// lldbg-check:[...]$2 = -2
+// lldbr-check:(isize) arg2 = -2
+// lldb-command:continue
+
+// STACK BY VAL
+// lldb-command:print self
+// lldbg-check:[...]$3 = { 0 = 100 1 = -100.5 }
+// lldbr-check:(method_on_tuple_struct::TupleStruct) self = { 0 = 100 1 = -100.5 }
+// lldb-command:print arg1
+// lldbg-check:[...]$4 = -3
+// lldbr-check:(isize) arg1 = -3
+// lldb-command:print arg2
+// lldbg-check:[...]$5 = -4
+// lldbr-check:(isize) arg2 = -4
+// lldb-command:continue
+
+// OWNED BY REF
+// lldb-command:print *self
+// lldbg-check:[...]$6 = { 0 = 200 1 = -200.5 }
+// lldbr-check:(method_on_tuple_struct::TupleStruct) *self = { 0 = 200 1 = -200.5 }
+// lldb-command:print arg1
+// lldbg-check:[...]$7 = -5
+// lldbr-check:(isize) arg1 = -5
+// lldb-command:print arg2
+// lldbg-check:[...]$8 = -6
+// lldbr-check:(isize) arg2 = -6
+// lldb-command:continue
+
+// OWNED BY VAL
+// lldb-command:print self
+// lldbg-check:[...]$9 = { 0 = 200 1 = -200.5 }
+// lldbr-check:(method_on_tuple_struct::TupleStruct) self = { 0 = 200 1 = -200.5 }
+// lldb-command:print arg1
+// lldbg-check:[...]$10 = -7
+// lldbr-check:(isize) arg1 = -7
+// lldb-command:print arg2
+// lldbg-check:[...]$11 = -8
+// lldbr-check:(isize) arg2 = -8
+// lldb-command:continue
+
+// OWNED MOVED
+// lldb-command:print *self
+// lldbg-check:[...]$12 = { 0 = 200 1 = -200.5 }
+// lldbr-check:(method_on_tuple_struct::TupleStruct) *self = { 0 = 200 1 = -200.5 }
+// lldb-command:print arg1
+// lldbg-check:[...]$13 = -9
+// lldbr-check:(isize) arg1 = -9
+// lldb-command:print arg2
+// lldbg-check:[...]$14 = -10
+// lldbr-check:(isize) arg2 = -10
+// lldb-command:continue
+
+#![feature(omit_gdb_pretty_printer_section)]
+#![omit_gdb_pretty_printer_section]
+
+#[derive(Copy, Clone)]
+struct TupleStruct(isize, f64);
+
+impl TupleStruct {
+
+ fn self_by_ref(&self, arg1: isize, arg2: isize) -> isize {
+ zzz(); // #break
+ arg1 + arg2
+ }
+
+ fn self_by_val(self, arg1: isize, arg2: isize) -> isize {
+ zzz(); // #break
+ arg1 + arg2
+ }
+
+ fn self_owned(self: Box<TupleStruct>, arg1: isize, arg2: isize) -> isize {
+ zzz(); // #break
+ arg1 + arg2
+ }
+}
+
+fn main() {
+ let stack = TupleStruct(100, -100.5);
+ let _ = stack.self_by_ref(-1, -2);
+ let _ = stack.self_by_val(-3, -4);
+
+ let owned: Box<_> = Box::new(TupleStruct(200, -200.5));
+ let _ = owned.self_by_ref(-5, -6);
+ let _ = owned.self_by_val(-7, -8);
+ let _ = owned.self_owned(-9, -10);
+}
+
+fn zzz() {()}
diff --git a/src/test/debuginfo/msvc-pretty-enums.rs b/src/test/debuginfo/msvc-pretty-enums.rs
new file mode 100644
index 000000000..a153a9a42
--- /dev/null
+++ b/src/test/debuginfo/msvc-pretty-enums.rs
@@ -0,0 +1,102 @@
+// only-cdb
+// compile-flags:-g
+
+// cdb-command: g
+
+// cdb-command: dx a
+// cdb-check:a : Some({...}) [Type: enum$<core::option::Option<msvc_pretty_enums::CStyleEnum>, 2, 16, Some>]
+// cdb-check: [<Raw View>] [Type: enum$<core::option::Option<msvc_pretty_enums::CStyleEnum>, 2, 16, Some>]
+// cdb-check: [variant] : Some
+// cdb-check: [+0x000] __0 : Low (0x2) [Type: msvc_pretty_enums::CStyleEnum]
+
+// cdb-command: dx b
+// cdb-check:b : None [Type: enum$<core::option::Option<msvc_pretty_enums::CStyleEnum>, 2, 16, Some>]
+// cdb-check: [<Raw View>] [Type: enum$<core::option::Option<msvc_pretty_enums::CStyleEnum>, 2, 16, Some>]
+// cdb-check: [variant] : None
+
+// cdb-command: dx c
+// cdb-check:c : Tag1 [Type: enum$<msvc_pretty_enums::NicheLayoutEnum, 2, 16, Data>]
+// cdb-check: [<Raw View>] [Type: enum$<msvc_pretty_enums::NicheLayoutEnum, 2, 16, Data>]
+// cdb-check: [variant] : Tag1
+
+// cdb-command: dx d
+// cdb-check:d : Data({...}) [Type: enum$<msvc_pretty_enums::NicheLayoutEnum, 2, 16, Data>]
+// cdb-check: [<Raw View>] [Type: enum$<msvc_pretty_enums::NicheLayoutEnum, 2, 16, Data>]
+// cdb-check: [variant] : Data
+// cdb-check: [+0x000] my_data : High (0x10) [Type: msvc_pretty_enums::CStyleEnum]
+
+// cdb-command: dx e
+// cdb-check:e : Tag2 [Type: enum$<msvc_pretty_enums::NicheLayoutEnum, 2, 16, Data>]
+// cdb-check: [<Raw View>] [Type: enum$<msvc_pretty_enums::NicheLayoutEnum, 2, 16, Data>]
+// cdb-check: [variant] : Tag2
+
+// cdb-command: dx f
+// cdb-check:f : Some({...}) [Type: enum$<core::option::Option<ref$<u32> >, 1, [...], Some>]
+// cdb-check: [<Raw View>] [Type: enum$<core::option::Option<ref$<u32> >, 1, [...], Some>]
+// cdb-check: [variant] : Some
+// cdb-check: [+0x000] __0 : 0x[...] : 0x1 [Type: unsigned int *]
+
+// cdb-command: dx g
+// cdb-check:g : None [Type: enum$<core::option::Option<ref$<u32> >, 1, [...], Some>]
+// cdb-check: [<Raw View>] [Type: enum$<core::option::Option<ref$<u32> >, 1, [...], Some>]
+// cdb-check: [variant] : None
+
+// cdb-command: dx h
+// cdb-check:h : Some [Type: enum$<core::option::Option<u32> >]
+// cdb-check: [<Raw View>] [Type: enum$<core::option::Option<u32> >]
+// cdb-check: [variant] : Some
+// cdb-check: [+0x004] __0 : 0xc [Type: unsigned int]
+
+// cdb-command: dx i
+// cdb-check:i : None [Type: enum$<core::option::Option<u32> >]
+// cdb-check: [<Raw View>] [Type: enum$<core::option::Option<u32> >]
+// cdb-check: [variant] : None
+
+// cdb-command: dx j
+// cdb-check:j : High (0x10) [Type: msvc_pretty_enums::CStyleEnum]
+
+// cdb-command: dx k
+// cdb-check:k : Some({...}) [Type: enum$<core::option::Option<alloc::string::String>, 1, [...], Some>]
+// cdb-check: [<Raw View>] [Type: enum$<core::option::Option<alloc::string::String>, 1, [...], Some>]
+// cdb-check: [variant] : Some
+// cdb-check: [+0x000] __0 : "IAMA optional string!" [Type: alloc::string::String]
+
+// cdb-command: dx l
+// cdb-check:l : Ok [Type: enum$<core::result::Result<u32,enum$<msvc_pretty_enums::Empty> >, Ok>]
+// cdb-check: [<Raw View>] [Type: enum$<core::result::Result<u32,enum$<msvc_pretty_enums::Empty> >, Ok>]
+// cdb-check: [variant] : Ok
+// cdb-check: [+0x000] __0 : 0x2a [Type: unsigned int]
+
+pub enum CStyleEnum {
+ Low = 2,
+ High = 16,
+}
+
+pub enum NicheLayoutEnum {
+ Tag1,
+ Data { my_data: CStyleEnum },
+ Tag2,
+}
+
+pub enum Empty {}
+
+fn main() {
+ let a = Some(CStyleEnum::Low);
+ let b = Option::<CStyleEnum>::None;
+ let c = NicheLayoutEnum::Tag1;
+ let d = NicheLayoutEnum::Data { my_data: CStyleEnum::High };
+ let e = NicheLayoutEnum::Tag2;
+ let f = Some(&1u32);
+ let g = Option::<&'static u32>::None;
+ let h = Some(12u32);
+ let i = Option::<u32>::None;
+ let j = CStyleEnum::High;
+ let k = Some("IAMA optional string!".to_string());
+ let l = Result::<u32, Empty>::Ok(42);
+
+ zzz(); // #break
+}
+
+fn zzz() {
+ ()
+}
diff --git a/src/test/debuginfo/msvc-scalarpair-params.rs b/src/test/debuginfo/msvc-scalarpair-params.rs
new file mode 100644
index 000000000..3846fb42f
--- /dev/null
+++ b/src/test/debuginfo/msvc-scalarpair-params.rs
@@ -0,0 +1,101 @@
+// only-cdb
+// compile-flags: -g
+
+// cdb-command: g
+
+// cdb-command: dx r1
+// cdb-check:r1 : (0xa..0xc) [Type: core::ops::range::Range<u32>]
+// cdb-command: dx r2
+// cdb-check:r2 : (0x14..0x1e) [Type: core::ops::range::Range<u64>]
+
+// cdb-command: g
+
+// cdb-command: dx r1
+// cdb-check:r1 : (0x9..0x64) [Type: core::ops::range::Range<u32>]
+// cdb-command: dx r2
+// cdb-check:r2 : (0xc..0x5a) [Type: core::ops::range::Range<u64>]
+
+// cdb-command: g
+
+// cdb-command: dx o1
+// cdb-check:o1 : Some [Type: enum$<core::option::Option<u32> >]
+// cdb-check: [variant] : Some
+// cdb-check: [+0x004] __0 : 0x4d2 [Type: [...]]
+// cdb-command: dx o2
+// cdb-check:o2 : Some [Type: enum$<core::option::Option<u64> >]
+// cdb-check: [variant] : Some
+// cdb-check: [+0x008] __0 : 0x162e [Type: unsigned __int64]
+
+// cdb-command: g
+
+// cdb-command: dx t1
+// cdb-check:t1 : (0xa, 0x14) [Type: tuple$<u32,u32>]
+// cdb-check: [0] : 0xa [Type: unsigned int]
+// cdb-check: [1] : 0x14 [Type: unsigned int]
+// cdb-command: dx t2
+// cdb-check:t2 : (0x1e, 0x28) [Type: tuple$<u64,u64>]
+// cdb-check: [0] : 0x1e [Type: unsigned __int64]
+// cdb-check: [1] : 0x28 [Type: unsigned __int64]
+
+// cdb-command: g
+
+// cdb-command: dx s
+// cdb-check:s : "this is a static str" [Type: str]
+// cdb-check: [len] : 0x14 [Type: unsigned [...]]
+// cdb-check: [chars]
+
+// cdb-command: g
+
+// cdb-command: dx s
+// cdb-check:s : { len=0x5 } [Type: slice$<u8>]
+// cdb-check: [len] : 0x5 [Type: unsigned [...]]
+// cdb-check: [0] : 0x1 [Type: unsigned char]
+// cdb-check: [1] : 0x2 [Type: unsigned char]
+// cdb-check: [2] : 0x3 [Type: unsigned char]
+// cdb-check: [3] : 0x4 [Type: unsigned char]
+// cdb-check: [4] : 0x5 [Type: unsigned char]
+
+use std::ops::Range;
+
+fn range(r1: Range<u32>, r2: Range<u64>) {
+ zzz(); // #break
+}
+
+fn range_mut(mut r1: Range<u32>, mut r2: Range<u64>) {
+ if r1.start == 9 {
+ r1.end = 100;
+ }
+
+ if r2.start == 12 {
+ r2.end = 90;
+ }
+
+ zzz(); // #break
+}
+
+fn option(o1: Option<u32>, o2: Option<u64>) {
+ zzz(); // #break
+}
+
+fn tuple(t1: (u32, u32), t2: (u64, u64)) {
+ zzz(); // #break
+}
+
+fn str(s: &str) {
+ zzz(); // #break
+}
+
+fn slice(s: &[u8]) {
+ zzz(); // #break
+}
+
+fn zzz() { }
+
+fn main() {
+ range(10..12, 20..30);
+ range_mut(9..20, 12..80);
+ option(Some(1234), Some(5678));
+ tuple((10, 20), (30, 40));
+ str("this is a static str");
+ slice(&[1, 2, 3, 4, 5]);
+}
diff --git a/src/test/debuginfo/multi-byte-chars.rs b/src/test/debuginfo/multi-byte-chars.rs
new file mode 100644
index 000000000..5c68a88f2
--- /dev/null
+++ b/src/test/debuginfo/multi-byte-chars.rs
@@ -0,0 +1,15 @@
+// min-lldb-version: 310
+
+// compile-flags:-g
+
+// This test checks whether debuginfo generation can handle multi-byte UTF-8
+// characters at the end of a block. There's no need to do anything in the
+// debugger -- just make sure that the compiler doesn't crash.
+// See also issue #18791.
+
+struct C { θ: u8 }
+
+fn main() {
+ let x = C { θ: 0 };
+ (|c: C| c.θ )(x);
+}
diff --git a/src/test/debuginfo/multi-cgu.rs b/src/test/debuginfo/multi-cgu.rs
new file mode 100644
index 000000000..0ca7ce60e
--- /dev/null
+++ b/src/test/debuginfo/multi-cgu.rs
@@ -0,0 +1,58 @@
+// This test case makes sure that we get proper break points for binaries
+// compiled with multiple codegen units. (see #39160)
+
+
+// min-lldb-version: 310
+
+// compile-flags:-g -Ccodegen-units=2
+
+// === GDB TESTS ===============================================================
+
+// gdb-command:run
+
+// gdb-command:print xxx
+// gdb-check:$1 = 12345
+// gdb-command:continue
+
+// gdb-command:print yyy
+// gdb-check:$2 = 67890
+// gdb-command:continue
+
+
+// === LLDB TESTS ==============================================================
+
+// lldb-command:run
+
+// lldb-command:print xxx
+// lldbg-check:[...]$0 = 12345
+// lldbr-check:(u32) xxx = 12345
+// lldb-command:continue
+
+// lldb-command:print yyy
+// lldbg-check:[...]$1 = 67890
+// lldbr-check:(u64) yyy = 67890
+// lldb-command:continue
+
+
+#![feature(omit_gdb_pretty_printer_section)]
+#![omit_gdb_pretty_printer_section]
+
+mod a {
+ pub fn foo(xxx: u32) {
+ super::_zzz(); // #break
+ }
+}
+
+mod b {
+ pub fn bar(yyy: u64) {
+ super::_zzz(); // #break
+ }
+}
+
+fn main() {
+ a::foo(12345);
+ b::bar(67890);
+}
+
+#[inline(never)]
+fn _zzz() {}
diff --git a/src/test/debuginfo/multiple-functions-equal-var-names.rs b/src/test/debuginfo/multiple-functions-equal-var-names.rs
new file mode 100644
index 000000000..32b639c7f
--- /dev/null
+++ b/src/test/debuginfo/multiple-functions-equal-var-names.rs
@@ -0,0 +1,66 @@
+// min-lldb-version: 310
+
+// compile-flags:-g
+
+// === GDB TESTS ===================================================================================
+
+// gdb-command:run
+
+// gdb-command:print abc
+// gdb-check:$1 = 10101
+// gdb-command:continue
+
+// gdb-command:print abc
+// gdb-check:$2 = 20202
+// gdb-command:continue
+
+// gdb-command:print abc
+// gdb-check:$3 = 30303
+
+
+// === LLDB TESTS ==================================================================================
+
+// lldb-command:run
+
+// lldb-command:print abc
+// lldbg-check:[...]$0 = 10101
+// lldbr-check:(i32) abc = 10101
+// lldb-command:continue
+
+// lldb-command:print abc
+// lldbg-check:[...]$1 = 20202
+// lldbr-check:(i32) abc = 20202
+// lldb-command:continue
+
+// lldb-command:print abc
+// lldbg-check:[...]$2 = 30303
+// lldbr-check:(i32) abc = 30303
+
+#![allow(unused_variables)]
+#![feature(omit_gdb_pretty_printer_section)]
+#![omit_gdb_pretty_printer_section]
+
+fn function_one() {
+ let abc = 10101;
+ zzz(); // #break
+}
+
+fn function_two() {
+ let abc = 20202;
+ zzz(); // #break
+}
+
+
+fn function_three() {
+ let abc = 30303;
+ zzz(); // #break
+}
+
+
+fn main() {
+ function_one();
+ function_two();
+ function_three();
+}
+
+fn zzz() {()}
diff --git a/src/test/debuginfo/multiple-functions.rs b/src/test/debuginfo/multiple-functions.rs
new file mode 100644
index 000000000..873857b6a
--- /dev/null
+++ b/src/test/debuginfo/multiple-functions.rs
@@ -0,0 +1,66 @@
+// min-lldb-version: 310
+
+// compile-flags:-g
+
+// === GDB TESTS ===================================================================================
+
+// gdb-command:run
+
+// gdb-command:print a
+// gdb-check:$1 = 10101
+// gdb-command:continue
+
+// gdb-command:print b
+// gdb-check:$2 = 20202
+// gdb-command:continue
+
+// gdb-command:print c
+// gdb-check:$3 = 30303
+
+
+// === LLDB TESTS ==================================================================================
+
+// lldb-command:run
+
+// lldb-command:print a
+// lldbg-check:[...]$0 = 10101
+// lldbr-check:(i32) a = 10101
+// lldb-command:continue
+
+// lldb-command:print b
+// lldbg-check:[...]$1 = 20202
+// lldbr-check:(i32) b = 20202
+// lldb-command:continue
+
+// lldb-command:print c
+// lldbg-check:[...]$2 = 30303
+// lldbr-check:(i32) c = 30303
+
+#![allow(unused_variables)]
+#![feature(omit_gdb_pretty_printer_section)]
+#![omit_gdb_pretty_printer_section]
+
+fn function_one() {
+ let a = 10101;
+ zzz(); // #break
+}
+
+fn function_two() {
+ let b = 20202;
+ zzz(); // #break
+}
+
+
+fn function_three() {
+ let c = 30303;
+ zzz(); // #break
+}
+
+
+fn main() {
+ function_one();
+ function_two();
+ function_three();
+}
+
+fn zzz() {()}
diff --git a/src/test/debuginfo/mutable-locs.rs b/src/test/debuginfo/mutable-locs.rs
new file mode 100644
index 000000000..688483e43
--- /dev/null
+++ b/src/test/debuginfo/mutable-locs.rs
@@ -0,0 +1,104 @@
+// Testing the display of Cell, RefCell, and RefMut in cdb.
+
+// cdb-only
+// min-cdb-version: 10.0.18317.1001
+// compile-flags:-g
+
+// === CDB TESTS ==================================================================================
+
+// cdb-command: g
+
+// cdb-command:dx static_c,d
+// cdb-check:static_c,d : 10 [Type: core::cell::Cell<i32>]
+// cdb-check: [<Raw View>] [Type: core::cell::Cell<i32>]
+
+// cdb-command: dx static_c.value,d
+// cdb-check:static_c.value,d : 10 [Type: core::cell::UnsafeCell<i32>]
+// cdb-check: [<Raw View>] [Type: core::cell::UnsafeCell<i32>]
+
+// cdb-command: dx dynamic_c,d
+// cdb-check:dynamic_c,d : 15 [Type: core::cell::RefCell<i32>]
+// cdb-check: [<Raw View>] [Type: core::cell::RefCell<i32>]
+// cdb-check: [Borrow state] : Unborrowed
+
+// cdb-command: dx dynamic_c.value,d
+// cdb-check:dynamic_c.value,d : 15 [Type: core::cell::UnsafeCell<i32>]
+// cdb-check: [<Raw View>] [Type: core::cell::UnsafeCell<i32>]
+
+// cdb-command: dx b,d
+// cdb-check:b,d : 42 [Type: core::cell::RefMut<i32>]
+// cdb-check: [<Raw View>] [Type: core::cell::RefMut<i32>]
+// cdb-check: 42 [Type: int]
+
+// cdb-command: g
+
+// cdb-command: dx dynamic_c,d
+// cdb-check:dynamic_c,d : 15 [Type: core::cell::RefCell<i32>]
+// cdb-check: [<Raw View>] [Type: core::cell::RefCell<i32>]
+// cdb-check: [Borrow state] : Immutably borrowed
+
+// cdb-command: dx r_borrow,d
+// cdb-check:r_borrow,d : 15 [Type: core::cell::Ref<i32>]
+// cdb-check: [<Raw View>] [Type: core::cell::Ref<i32>]
+// cdb-check: 15 [Type: int]
+
+// cdb-command: g
+
+// cdb-command: dx dynamic_c,d
+// cdb-check:dynamic_c,d : 15 [Type: core::cell::RefCell<i32>]
+// cdb-check: [<Raw View>] [Type: core::cell::RefCell<i32>]
+// cdb-check: [Borrow state] : Unborrowed
+
+// cdb-command: g
+
+// cdb-command: dx dynamic_c,d
+// cdb-check:dynamic_c,d : 15 [Type: core::cell::RefCell<i32>]
+// cdb-check: [<Raw View>] [Type: core::cell::RefCell<i32>]
+// cdb-check: [Borrow state] : Mutably borrowed
+
+// cdb-command: dx r_borrow_mut,d
+// cdb-check:r_borrow_mut,d : 15 [Type: core::cell::RefMut<i32>]
+// cdb-check: [<Raw View>] [Type: core::cell::RefMut<i32>]
+// cdb-check: 15 [Type: int]
+
+// cdb-command: g
+
+// cdb-command: dx dynamic_c,d
+// cdb-check:dynamic_c,d : 15 [Type: core::cell::RefCell<i32>]
+// cdb-check: [<Raw View>] [Type: core::cell::RefCell<i32>]
+// cdb-check: [Borrow state] : Unborrowed
+
+#![allow(unused_variables)]
+
+use std::cell::{Cell, RefCell};
+
+fn main() {
+ let static_c = Cell::new(5);
+ static_c.set(10);
+
+ let dynamic_c = RefCell::new(5);
+ dynamic_c.replace(15);
+
+ let dynamic_c_0 = RefCell::new(15);
+ let mut b = dynamic_c_0.borrow_mut();
+ *b = 42;
+
+ zzz(); // #break
+
+ // Check that `RefCell`'s borrow state visualizes correctly
+ {
+ let r_borrow = dynamic_c.borrow();
+ zzz(); // #break
+ }
+
+ zzz(); // #break
+
+ {
+ let r_borrow_mut = dynamic_c.borrow_mut();
+ zzz(); // #break
+ }
+
+ zzz(); // #break
+}
+
+fn zzz() {()}
diff --git a/src/test/debuginfo/mutex.rs b/src/test/debuginfo/mutex.rs
new file mode 100644
index 000000000..00dccf5f9
--- /dev/null
+++ b/src/test/debuginfo/mutex.rs
@@ -0,0 +1,38 @@
+// Testing the display of Mutex and MutexGuard in cdb.
+
+// cdb-only
+// min-cdb-version: 10.0.21287.1005
+// compile-flags:-g
+
+// === CDB TESTS ==================================================================================
+//
+// cdb-command:g
+//
+// cdb-command:dx m,d
+// cdb-check:m,d [Type: std::sync::mutex::Mutex<i32>]
+// cdb-check: [...] inner [Type: std::sys_common::mutex::MovableMutex]
+// cdb-check: [...] poison [Type: std::sync::poison::Flag]
+// cdb-check: [...] data : 0 [Type: core::cell::UnsafeCell<i32>]
+
+//
+// cdb-command:dx m.data,d
+// cdb-check:m.data,d : 0 [Type: core::cell::UnsafeCell<i32>]
+// cdb-check: [<Raw View>] [Type: core::cell::UnsafeCell<i32>]
+
+//
+// cdb-command:dx lock,d
+// cdb-check:lock,d : Ok [Type: enum$<core::result::Result<std::sync::mutex::MutexGuard<i32>,enum$<std::sync::poison::TryLockError<std::sync::mutex::MutexGuard<i32> >, 0, 1, Poisoned> > >]
+// cdb-check: [variant] : Ok
+// cdb-check: [...] __0 [Type: std::sync::mutex::MutexGuard<i32>]
+
+use std::sync::Mutex;
+
+#[allow(unused_variables)]
+fn main()
+{
+ let m = Mutex::new(0);
+ let lock = m.try_lock();
+ zzz(); // #break
+}
+
+fn zzz() {}
diff --git a/src/test/debuginfo/name-shadowing-and-scope-nesting.rs b/src/test/debuginfo/name-shadowing-and-scope-nesting.rs
new file mode 100644
index 000000000..6cee893ce
--- /dev/null
+++ b/src/test/debuginfo/name-shadowing-and-scope-nesting.rs
@@ -0,0 +1,137 @@
+// min-lldb-version: 310
+
+// compile-flags:-g
+
+// === GDB TESTS ===================================================================================
+
+// gdb-command:run
+
+// gdb-command:print x
+// gdb-check:$1 = false
+// gdb-command:print y
+// gdb-check:$2 = true
+// gdb-command:continue
+
+// gdb-command:print x
+// gdb-check:$3 = 10
+// gdb-command:print y
+// gdb-check:$4 = true
+// gdb-command:continue
+
+// gdb-command:print x
+// gdb-check:$5 = 10.5
+// gdb-command:print y
+// gdb-check:$6 = 20
+// gdb-command:continue
+
+// gdb-command:print x
+// gdb-check:$7 = true
+// gdb-command:print y
+// gdb-check:$8 = 2220
+// gdb-command:continue
+
+// gdb-command:print x
+// gdb-check:$9 = 203203.5
+// gdb-command:print y
+// gdb-check:$10 = 2220
+// gdb-command:continue
+
+// gdb-command:print x
+// gdb-check:$11 = 10.5
+// gdb-command:print y
+// gdb-check:$12 = 20
+// gdb-command:continue
+
+
+// === LLDB TESTS ==================================================================================
+
+// lldb-command:run
+
+// lldb-command:print x
+// lldbg-check:[...]$0 = false
+// lldbr-check:(bool) x = false
+// lldb-command:print y
+// lldbg-check:[...]$1 = true
+// lldbr-check:(bool) y = true
+// lldb-command:continue
+
+// lldb-command:print x
+// lldbg-check:[...]$2 = 10
+// lldbr-check:(i32) x = 10
+// lldb-command:print y
+// lldbg-check:[...]$3 = true
+// lldbr-check:(bool) y = true
+// lldb-command:continue
+
+// lldb-command:print x
+// lldbg-check:[...]$4 = 10.5
+// lldbr-check:(f64) x = 10.5
+// lldb-command:print y
+// lldbg-check:[...]$5 = 20
+// lldbr-check:(i32) y = 20
+// lldb-command:continue
+
+// lldb-command:print x
+// lldbg-check:[...]$6 = true
+// lldbr-check:(bool) x = true
+// lldb-command:print y
+// lldbg-check:[...]$7 = 2220
+// lldbr-check:(i32) y = 2220
+// lldb-command:continue
+
+// lldb-command:print x
+// lldbg-check:[...]$8 = 203203.5
+// lldbr-check:(f64) x = 203203.5
+// lldb-command:print y
+// lldbg-check:[...]$9 = 2220
+// lldbr-check:(i32) y = 2220
+// lldb-command:continue
+
+// lldb-command:print x
+// lldbg-check:[...]$10 = 10.5
+// lldbr-check:(f64) x = 10.5
+// lldb-command:print y
+// lldbg-check:[...]$11 = 20
+// lldbr-check:(i32) y = 20
+// lldb-command:continue
+
+#![feature(omit_gdb_pretty_printer_section)]
+#![omit_gdb_pretty_printer_section]
+
+fn main() {
+ let x = false;
+ let y = true;
+
+ zzz(); // #break
+ sentinel();
+
+ let x = 10;
+
+ zzz(); // #break
+ sentinel();
+
+ let x = 10.5f64;
+ let y = 20;
+
+ zzz(); // #break
+ sentinel();
+
+ {
+ let x = true;
+ let y = 2220;
+
+ zzz(); // #break
+ sentinel();
+
+ let x = 203203.5f64;
+
+ zzz(); // #break
+ sentinel();
+ }
+
+ zzz(); // #break
+ sentinel();
+}
+
+fn zzz() {()}
+fn sentinel() {()}
diff --git a/src/test/debuginfo/no_mangle-info.rs b/src/test/debuginfo/no_mangle-info.rs
new file mode 100644
index 000000000..e22d36874
--- /dev/null
+++ b/src/test/debuginfo/no_mangle-info.rs
@@ -0,0 +1,40 @@
+// compile-flags:-g
+// min-gdb-version: 10.1
+
+// === GDB TESTS ===================================================================================
+// gdb-command:run
+// gdb-command:p TEST
+// gdb-check:$1 = 3735928559
+// gdb-command:p no_mangle_info::namespace::OTHER_TEST
+// gdb-check:$2 = 42
+
+// === LLDB TESTS ==================================================================================
+// lldb-command:run
+// lldb-command:p TEST
+// lldb-check: (unsigned long) $0 = 3735928559
+// lldb-command:p OTHER_TEST
+// lldb-check: (unsigned long) $1 = 42
+
+// === CDB TESTS ==================================================================================
+// cdb-command: g
+// Note: LLDB and GDB allow referring to items that are in the same namespace of the symbol
+// we currently have a breakpoint on in an unqualified way. CDB does not, and thus we need to
+// refer to it in a fully qualified way.
+// cdb-command: dx a!no_mangle_info::TEST
+// cdb-check: a!no_mangle_info::TEST : 0xdeadbeef [Type: unsigned __int64]
+// cdb-command: dx a!no_mangle_info::namespace::OTHER_TEST
+// cdb-check: a!no_mangle_info::namespace::OTHER_TEST : 0x2a [Type: unsigned __int64]
+
+#[no_mangle]
+pub static TEST: u64 = 0xdeadbeef;
+
+// FIXME(rylev, wesleywiser): uncommenting this item breaks the test, and we're not sure why
+// pub static OTHER_TEST: u64 = 43;
+pub mod namespace {
+ pub static OTHER_TEST: u64 = 42;
+}
+
+pub fn main() {
+ println!("TEST: {}", TEST);
+ println!("OTHER TEST: {}", namespace::OTHER_TEST); // #break
+}
diff --git a/src/test/debuginfo/numeric-types.rs b/src/test/debuginfo/numeric-types.rs
new file mode 100644
index 000000000..2eae9239b
--- /dev/null
+++ b/src/test/debuginfo/numeric-types.rs
@@ -0,0 +1,206 @@
+// only-cdb
+// compile-flags:-g
+
+// Tests the visualizations for `NonZero{I,U}{8,16,32,64,128,size}`, `Wrapping<T>` and
+// `Atomic{Bool,I8,I16,I32,I64,Isize,U8,U16,U32,U64,Usize}` located in `libcore.natvis`.
+
+// === CDB TESTS ==================================================================================
+// cdb-command: g
+
+// cdb-command: dx nz_i8
+// cdb-check:nz_i8 : 11 [Type: core::num::nonzero::NonZeroI8]
+// cdb-check: [<Raw View>] [Type: core::num::nonzero::NonZeroI8]
+
+// cdb-command: dx nz_i16
+// cdb-check:nz_i16 : 22 [Type: core::num::nonzero::NonZeroI16]
+// cdb-check: [<Raw View>] [Type: core::num::nonzero::NonZeroI16]
+
+// cdb-command: dx nz_i32
+// cdb-check:nz_i32 : 33 [Type: core::num::nonzero::NonZeroI32]
+// cdb-check: [<Raw View>] [Type: core::num::nonzero::NonZeroI32]
+
+// cdb-command: dx nz_i64
+// cdb-check:nz_i64 : 44 [Type: core::num::nonzero::NonZeroI64]
+// cdb-check: [<Raw View>] [Type: core::num::nonzero::NonZeroI64]
+
+// 128-bit integers don't seem to work in CDB
+// cdb-command: dx nz_i128
+// cdb-check: [<Raw View>] [Type: core::num::nonzero::NonZeroI128]
+
+// cdb-command: dx nz_isize
+// cdb-check:nz_isize : 66 [Type: core::num::nonzero::NonZeroIsize]
+// cdb-check: [<Raw View>] [Type: core::num::nonzero::NonZeroIsize]
+
+// cdb-command: dx nz_u8
+// cdb-check:nz_u8 : 0x4d [Type: core::num::nonzero::NonZeroU8]
+// cdb-check: [<Raw View>] [Type: core::num::nonzero::NonZeroU8]
+
+// cdb-command: dx nz_u16
+// cdb-check:nz_u16 : 0x58 [Type: core::num::nonzero::NonZeroU16]
+// cdb-check: [<Raw View>] [Type: core::num::nonzero::NonZeroU16]
+
+// cdb-command: dx nz_u32
+// cdb-check:nz_u32 : 0x63 [Type: core::num::nonzero::NonZeroU32]
+// cdb-check: [<Raw View>] [Type: core::num::nonzero::NonZeroU32]
+
+// cdb-command: dx nz_u64
+// cdb-check:nz_u64 : 0x64 [Type: core::num::nonzero::NonZeroU64]
+// cdb-check: [<Raw View>] [Type: core::num::nonzero::NonZeroU64]
+
+// 128-bit integers don't seem to work in CDB
+// cdb-command: dx nz_u128
+// cdb-check: [<Raw View>] [Type: core::num::nonzero::NonZeroU128]
+
+// cdb-command: dx nz_usize
+// cdb-check:nz_usize : 0x7a [Type: core::num::nonzero::NonZeroUsize]
+// cdb-check: [<Raw View>] [Type: core::num::nonzero::NonZeroUsize]
+
+// cdb-command: dx w_i8
+// cdb-check:w_i8 : 10 [Type: core::num::wrapping::Wrapping<i8>]
+// cdb-check: [<Raw View>] [Type: core::num::wrapping::Wrapping<i8>]
+
+// cdb-command: dx w_i16
+// cdb-check:w_i16 : 20 [Type: core::num::wrapping::Wrapping<i16>]
+// cdb-check: [<Raw View>] [Type: core::num::wrapping::Wrapping<i16>]
+
+// cdb-command: dx w_i32
+// cdb-check:w_i32 : 30 [Type: core::num::wrapping::Wrapping<i32>]
+// cdb-check: [<Raw View>] [Type: core::num::wrapping::Wrapping<i32>]
+
+// cdb-command: dx w_i64
+// cdb-check:w_i64 : 40 [Type: core::num::wrapping::Wrapping<i64>]
+// cdb-check: [<Raw View>] [Type: core::num::wrapping::Wrapping<i64>]
+
+// 128-bit integers don't seem to work in CDB
+// cdb-command: dx w_i128
+// cdb-check:w_i128 [Type: core::num::wrapping::Wrapping<i128>]
+// cdb-check: [<Raw View>] [Type: core::num::wrapping::Wrapping<i128>]
+
+// cdb-command: dx w_isize
+// cdb-check:w_isize : 60 [Type: core::num::wrapping::Wrapping<isize>]
+// cdb-check: [<Raw View>] [Type: core::num::wrapping::Wrapping<isize>]
+
+// cdb-command: dx w_u8
+// cdb-check:w_u8 : 0x46 [Type: core::num::wrapping::Wrapping<u8>]
+// cdb-check: [<Raw View>] [Type: core::num::wrapping::Wrapping<u8>]
+
+// cdb-command: dx w_u16
+// cdb-check:w_u16 : 0x50 [Type: core::num::wrapping::Wrapping<u16>]
+// cdb-check: [<Raw View>] [Type: core::num::wrapping::Wrapping<u16>]
+
+// cdb-command: dx w_u32
+// cdb-check:w_u32 : 0x5a [Type: core::num::wrapping::Wrapping<u32>]
+// cdb-check: [<Raw View>] [Type: core::num::wrapping::Wrapping<u32>]
+
+// cdb-command: dx w_u64
+// cdb-check:w_u64 : 0x64 [Type: core::num::wrapping::Wrapping<u64>]
+// cdb-check: [<Raw View>] [Type: core::num::wrapping::Wrapping<u64>]
+
+// 128-bit integers don't seem to work in CDB
+// cdb-command: dx w_u128
+// cdb-check:w_u128 [Type: core::num::wrapping::Wrapping<u128>]
+// cdb-check: [<Raw View>] [Type: core::num::wrapping::Wrapping<u128>]
+
+// cdb-command: dx w_usize
+// cdb-check:w_usize : 0x78 [Type: core::num::wrapping::Wrapping<usize>]
+// cdb-check: [<Raw View>] [Type: core::num::wrapping::Wrapping<usize>]
+
+// cdb-command: dx a_bool_t
+// cdb-check:a_bool_t : true [Type: core::sync::atomic::AtomicBool]
+// cdb-check: [<Raw View>] [Type: core::sync::atomic::AtomicBool]
+
+// cdb-command: dx a_bool_f
+// cdb-check:a_bool_f : false [Type: core::sync::atomic::AtomicBool]
+// cdb-check: [<Raw View>] [Type: core::sync::atomic::AtomicBool]
+
+// cdb-command: dx a_i8
+// cdb-check:a_i8 : 2 [Type: core::sync::atomic::AtomicI8]
+// cdb-check: [<Raw View>] [Type: core::sync::atomic::AtomicI8]
+
+// cdb-command: dx a_i16
+// cdb-check:a_i16 : 4 [Type: core::sync::atomic::AtomicI16]
+// cdb-check: [<Raw View>] [Type: core::sync::atomic::AtomicI16]
+
+// cdb-command: dx a_i32
+// cdb-check:a_i32 : 8 [Type: core::sync::atomic::AtomicI32]
+// cdb-check: [<Raw View>] [Type: core::sync::atomic::AtomicI32]
+
+// cdb-command: dx a_i64
+// cdb-check:a_i64 : 16 [Type: core::sync::atomic::AtomicI64]
+// cdb-check: [<Raw View>] [Type: core::sync::atomic::AtomicI64]
+
+// cdb-command: dx a_isize
+// cdb-check:a_isize : 32 [Type: core::sync::atomic::AtomicIsize]
+// cdb-check: [<Raw View>] [Type: core::sync::atomic::AtomicIsize]
+
+// cdb-command: dx a_u8
+// cdb-check:a_u8 : 0x40 [Type: core::sync::atomic::AtomicU8]
+// cdb-check: [<Raw View>] [Type: core::sync::atomic::AtomicU8]
+
+// cdb-command: dx a_u16
+// cdb-check:a_u16 : 0x80 [Type: core::sync::atomic::AtomicU16]
+// cdb-check: [<Raw View>] [Type: core::sync::atomic::AtomicU16]
+
+// cdb-command: dx a_u32
+// cdb-check:a_u32 : 0x100 [Type: core::sync::atomic::AtomicU32]
+// cdb-check: [<Raw View>] [Type: core::sync::atomic::AtomicU32]
+
+// cdb-command: dx a_u64
+// cdb-check:a_u64 : 0x200 [Type: core::sync::atomic::AtomicU64]
+// cdb-check: [<Raw View>] [Type: core::sync::atomic::AtomicU64]
+
+// cdb-command: dx a_usize
+// cdb-check:a_usize : 0x400 [Type: core::sync::atomic::AtomicUsize]
+// cdb-check: [<Raw View>] [Type: core::sync::atomic::AtomicUsize]
+
+use std::num::*;
+use std::sync::atomic::*;
+
+fn main() {
+ let nz_i8 = NonZeroI8::new(11).unwrap();
+ let nz_i16 = NonZeroI16::new(22).unwrap();
+ let nz_i32 = NonZeroI32::new(33).unwrap();
+ let nz_i64 = NonZeroI64::new(44).unwrap();
+ let nz_i128 = NonZeroI128::new(55).unwrap();
+ let nz_isize = NonZeroIsize::new(66).unwrap();
+
+ let nz_u8 = NonZeroU8::new(77).unwrap();
+ let nz_u16 = NonZeroU16::new(88).unwrap();
+ let nz_u32 = NonZeroU32::new(99).unwrap();
+ let nz_u64 = NonZeroU64::new(100).unwrap();
+ let nz_u128 = NonZeroU128::new(111).unwrap();
+ let nz_usize = NonZeroUsize::new(122).unwrap();
+
+ let w_i8 = Wrapping(10i8);
+ let w_i16 = Wrapping(20i16);
+ let w_i32 = Wrapping(30i32);
+ let w_i64 = Wrapping(40i64);
+ let w_i128 = Wrapping(50i128);
+ let w_isize = Wrapping(60isize);
+
+ let w_u8 = Wrapping(70u8);
+ let w_u16 = Wrapping(80u16);
+ let w_u32 = Wrapping(90u32);
+ let w_u64 = Wrapping(100u64);
+ let w_u128 = Wrapping(110u128);
+ let w_usize = Wrapping(120usize);
+
+ let a_bool_t = AtomicBool::new(true);
+ let a_bool_f = AtomicBool::new(false);
+
+ let a_i8 = AtomicI8::new(2);
+ let a_i16 = AtomicI16::new(4);
+ let a_i32 = AtomicI32::new(8);
+ let a_i64 = AtomicI64::new(16);
+ let a_isize = AtomicIsize::new(32);
+
+ let a_u8 = AtomicU8::new(64);
+ let a_u16 = AtomicU16::new(128);
+ let a_u32 = AtomicU32::new(256);
+ let a_u64 = AtomicU64::new(512);
+ let a_usize = AtomicUsize::new(1024);
+
+ zzz(); // #break
+}
+
+fn zzz() { }
diff --git a/src/test/debuginfo/option-like-enum.rs b/src/test/debuginfo/option-like-enum.rs
new file mode 100644
index 000000000..04d08b9e6
--- /dev/null
+++ b/src/test/debuginfo/option-like-enum.rs
@@ -0,0 +1,163 @@
+// ignore-test // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155
+
+// min-lldb-version: 310
+
+// compile-flags:-g
+
+// === GDB TESTS ===================================================================================
+
+// gdb-command:run
+
+// gdb-command:print some
+// gdbg-check:$1 = {RUST$ENCODED$ENUM$0$None = {__0 = 0x12345678}}
+// gdbr-check:$1 = core::option::Option<&u32>::Some(0x12345678)
+
+// gdb-command:print none
+// gdbg-check:$2 = {RUST$ENCODED$ENUM$0$None = {__0 = 0x0}}
+// gdbr-check:$2 = core::option::Option<&u32>::None
+
+// gdb-command:print full
+// gdbg-check:$3 = {RUST$ENCODED$ENUM$1$Empty = {__0 = 454545, __1 = 0x87654321, __2 = 9988}}
+// gdbr-check:$3 = option_like_enum::MoreFields::Full(454545, 0x87654321, 9988)
+
+// gdbg-command:print empty_gdb->discr
+// gdbr-command:print empty_gdb.discr
+// gdb-check:$4 = (isize *) 0x0
+
+// gdb-command:print droid
+// gdbg-check:$5 = {RUST$ENCODED$ENUM$2$Void = {id = 675675, range = 10000001, internals = 0x43218765}}
+// gdbr-check:$5 = option_like_enum::NamedFields::Droid{id: 675675, range: 10000001, internals: 0x43218765}
+
+// gdbg-command:print void_droid_gdb->internals
+// gdbr-command:print void_droid_gdb.internals
+// gdb-check:$6 = (isize *) 0x0
+
+// gdb-command:print nested_non_zero_yep
+// gdbg-check:$7 = {RUST$ENCODED$ENUM$1$2$Nope = {__0 = 10.5, __1 = {a = 10, b = 20, c = [...]}}}
+// gdbr-check:$7 = option_like_enum::NestedNonZero::Yep(10.5, option_like_enum::NestedNonZeroField {a: 10, b: 20, c: 0x[...] "x[...]"})
+
+// gdb-command:print nested_non_zero_nope
+// gdbg-check:$8 = {RUST$ENCODED$ENUM$1$2$Nope = {__0 = [...], __1 = {a = [...], b = [...], c = 0x0}}}
+// gdbr-check:$8 = option_like_enum::NestedNonZero::Nope
+
+// gdb-command:continue
+
+
+// === LLDB TESTS ==================================================================================
+
+// lldb-command:run
+
+// lldb-command:print some
+// lldb-check:[...]$0 = Some(&0x12345678)
+
+// lldb-command:print none
+// lldb-check:[...]$1 = None
+
+// lldb-command:print full
+// lldb-check:[...]$2 = Full(454545, &0x87654321, 9988)
+
+// lldb-command:print empty
+// lldb-check:[...]$3 = Empty
+
+// lldb-command:print droid
+// lldb-check:[...]$4 = Droid { id: 675675, range: 10000001, internals: &0x43218765 }
+
+// lldb-command:print void_droid
+// lldb-check:[...]$5 = Void
+
+// lldb-command:print some_str
+// lldb-check:[...]$6 = Some("abc")
+
+// lldb-command:print none_str
+// lldb-check:[...]$7 = None
+
+// lldb-command:print nested_non_zero_yep
+// lldb-check:[...]$8 = Yep(10.5, NestedNonZeroField { a: 10, b: 20, c: &[...] })
+
+// lldb-command:print nested_non_zero_nope
+// lldb-check:[...]$9 = Nope
+
+
+#![feature(omit_gdb_pretty_printer_section)]
+#![omit_gdb_pretty_printer_section]
+
+// If a struct has exactly two variants, one of them is empty, and the other one
+// contains a non-nullable pointer, then this value is used as the discriminator.
+// The test cases in this file make sure that something readable is generated for
+// this kind of types.
+// If the non-empty variant contains a single non-nullable pointer than the whole
+// item is represented as just a pointer and not wrapped in a struct.
+// Unfortunately (for these test cases) the content of the non-discriminant fields
+// in the null-case is not defined. So we just read the discriminator field in
+// this case (by casting the value to a memory-equivalent struct).
+
+enum MoreFields<'a> {
+ Full(u32, &'a isize, i16),
+ Empty
+}
+
+struct MoreFieldsRepr<'a> {
+ a: u32,
+ discr: &'a isize,
+ b: i16
+}
+
+enum NamedFields<'a> {
+ Droid { id: i32, range: i64, internals: &'a isize },
+ Void
+}
+
+struct NamedFieldsRepr<'a> {
+ id: i32,
+ range: i64,
+ internals: &'a isize
+}
+
+struct NestedNonZeroField<'a> {
+ a: u16,
+ b: u32,
+ c: &'a char,
+}
+
+enum NestedNonZero<'a> {
+ Yep(f64, NestedNonZeroField<'a>),
+ Nope
+}
+
+fn main() {
+
+ let some_str: Option<&'static str> = Some("abc");
+ let none_str: Option<&'static str> = None;
+
+ let some: Option<&u32> = Some(unsafe { std::mem::transmute(0x12345678_usize) });
+ let none: Option<&u32> = None;
+
+ let full = MoreFields::Full(454545, unsafe { std::mem::transmute(0x87654321_usize) }, 9988);
+
+ let empty = MoreFields::Empty;
+ let empty_gdb: &MoreFieldsRepr = unsafe { std::mem::transmute(&MoreFields::Empty) };
+
+ let droid = NamedFields::Droid {
+ id: 675675,
+ range: 10000001,
+ internals: unsafe { std::mem::transmute(0x43218765_usize) }
+ };
+
+ let void_droid = NamedFields::Void;
+ let void_droid_gdb: &NamedFieldsRepr = unsafe { std::mem::transmute(&NamedFields::Void) };
+
+ let x = 'x';
+ let nested_non_zero_yep = NestedNonZero::Yep(
+ 10.5,
+ NestedNonZeroField {
+ a: 10,
+ b: 20,
+ c: &x
+ });
+
+ let nested_non_zero_nope = NestedNonZero::Nope;
+
+ zzz(); // #break
+}
+
+fn zzz() {()}
diff --git a/src/test/debuginfo/packed-struct-with-destructor.rs b/src/test/debuginfo/packed-struct-with-destructor.rs
new file mode 100644
index 000000000..196d85b41
--- /dev/null
+++ b/src/test/debuginfo/packed-struct-with-destructor.rs
@@ -0,0 +1,259 @@
+// min-lldb-version: 310
+
+// compile-flags:-g
+
+// === GDB TESTS ===================================================================================
+
+// gdb-command:run
+
+// gdb-command:print packed
+// gdbg-check:$1 = {x = 123, y = 234, z = 345}
+// gdbr-check:$1 = packed_struct_with_destructor::Packed {x: 123, y: 234, z: 345}
+
+// gdb-command:print packedInPacked
+// gdbg-check:$2 = {a = 1111, b = {x = 2222, y = 3333, z = 4444}, c = 5555, d = {x = 6666, y = 7777, z = 8888}}
+// gdbr-check:$2 = packed_struct_with_destructor::PackedInPacked {a: 1111, b: packed_struct_with_destructor::Packed {x: 2222, y: 3333, z: 4444}, c: 5555, d: packed_struct_with_destructor::Packed {x: 6666, y: 7777, z: 8888}}
+
+// gdb-command:print packedInUnpacked
+// gdbg-check:$3 = {a = -1111, b = {x = -2222, y = -3333, z = -4444}, c = -5555, d = {x = -6666, y = -7777, z = -8888}}
+// gdbr-check:$3 = packed_struct_with_destructor::PackedInUnpacked {a: -1111, b: packed_struct_with_destructor::Packed {x: -2222, y: -3333, z: -4444}, c: -5555, d: packed_struct_with_destructor::Packed {x: -6666, y: -7777, z: -8888}}
+
+// gdb-command:print unpackedInPacked
+// gdbg-check:$4 = {a = 987, b = {x = 876, y = 765, z = 654}, c = {x = 543, y = 432, z = 321}, d = 210}
+// gdbr-check:$4 = packed_struct_with_destructor::UnpackedInPacked {a: 987, b: packed_struct_with_destructor::Unpacked {x: 876, y: 765, z: 654}, c: packed_struct_with_destructor::Unpacked {x: 543, y: 432, z: 321}, d: 210}
+
+
+// gdb-command:print packedInPackedWithDrop
+// gdbg-check:$5 = {a = 11, b = {x = 22, y = 33, z = 44}, c = 55, d = {x = 66, y = 77, z = 88}}
+// gdbr-check:$5 = packed_struct_with_destructor::PackedInPackedWithDrop {a: 11, b: packed_struct_with_destructor::Packed {x: 22, y: 33, z: 44}, c: 55, d: packed_struct_with_destructor::Packed {x: 66, y: 77, z: 88}}
+
+// gdb-command:print packedInUnpackedWithDrop
+// gdbg-check:$6 = {a = -11, b = {x = -22, y = -33, z = -44}, c = -55, d = {x = -66, y = -77, z = -88}}
+// gdbr-check:$6 = packed_struct_with_destructor::PackedInUnpackedWithDrop {a: -11, b: packed_struct_with_destructor::Packed {x: -22, y: -33, z: -44}, c: -55, d: packed_struct_with_destructor::Packed {x: -66, y: -77, z: -88}}
+
+// gdb-command:print unpackedInPackedWithDrop
+// gdbg-check:$7 = {a = 98, b = {x = 87, y = 76, z = 65}, c = {x = 54, y = 43, z = 32}, d = 21}
+// gdbr-check:$7 = packed_struct_with_destructor::UnpackedInPackedWithDrop {a: 98, b: packed_struct_with_destructor::Unpacked {x: 87, y: 76, z: 65}, c: packed_struct_with_destructor::Unpacked {x: 54, y: 43, z: 32}, d: 21}
+
+// gdb-command:print deeplyNested
+// gdbg-check:$8 = {a = {a = 1, b = {x = 2, y = 3, z = 4}, c = 5, d = {x = 6, y = 7, z = 8}}, b = {a = 9, b = {x = 10, y = 11, z = 12}, c = {x = 13, y = 14, z = 15}, d = 16}, c = {a = 17, b = {x = 18, y = 19, z = 20}, c = 21, d = {x = 22, y = 23, z = 24}}, d = {a = 25, b = {x = 26, y = 27, z = 28}, c = 29, d = {x = 30, y = 31, z = 32}}, e = {a = 33, b = {x = 34, y = 35, z = 36}, c = {x = 37, y = 38, z = 39}, d = 40}, f = {a = 41, b = {x = 42, y = 43, z = 44}, c = 45, d = {x = 46, y = 47, z = 48}}}
+// gdbr-check:$8 = packed_struct_with_destructor::DeeplyNested {a: packed_struct_with_destructor::PackedInPacked {a: 1, b: packed_struct_with_destructor::Packed {x: 2, y: 3, z: 4}, c: 5, d: packed_struct_with_destructor::Packed {x: 6, y: 7, z: 8}}, b: packed_struct_with_destructor::UnpackedInPackedWithDrop {a: 9, b: packed_struct_with_destructor::Unpacked {x: 10, y: 11, z: 12}, c: packed_struct_with_destructor::Unpacked {x: 13, y: 14, z: 15}, d: 16}, c: packed_struct_with_destructor::PackedInUnpacked {a: 17, b: packed_struct_with_destructor::Packed {x: 18, y: 19, z: 20}, c: 21, d: packed_struct_with_destructor::Packed {x: 22, y: 23, z: 24}}, d: packed_struct_with_destructor::PackedInUnpackedWithDrop {a: 25, b: packed_struct_with_destructor::Packed {x: 26, y: 27, z: 28}, c: 29, d: packed_struct_with_destructor::Packed {x: 30, y: 31, z: 32}}, e: packed_struct_with_destructor::UnpackedInPacked {a: 33, b: packed_struct_with_destructor::Unpacked {x: 34, y: 35, z: 36}, c: packed_struct_with_destructor::Unpacked {x: 37, y: 38, z: 39}, d: 40}, f: packed_struct_with_destructor::PackedInPackedWithDrop {a: 41, b: packed_struct_with_destructor::Packed {x: 42, y: 43, z: 44}, c: 45, d: packed_struct_with_destructor::Packed {x: 46, y: 47, z: 48}}}
+
+
+// === LLDB TESTS ==================================================================================
+
+// lldb-command:run
+
+// lldb-command:print packed
+// lldbg-check:[...]$0 = { x = 123 y = 234 z = 345 }
+// lldbr-check:(packed_struct_with_destructor::Packed) packed = { x = 123 y = 234 z = 345 }
+
+// lldb-command:print packedInPacked
+// lldbg-check:[...]$1 = { a = 1111 b = { x = 2222 y = 3333 z = 4444 } c = 5555 d = { x = 6666 y = 7777 z = 8888 } }
+// lldbr-check:(packed_struct_with_destructor::PackedInPacked) packedInPacked = { a = 1111 b = { x = 2222 y = 3333 z = 4444 } c = 5555 d = { x = 6666 y = 7777 z = 8888 } }
+
+// lldb-command:print packedInUnpacked
+// lldbg-check:[...]$2 = { a = -1111 b = { x = -2222 y = -3333 z = -4444 } c = -5555 d = { x = -6666 y = -7777 z = -8888 } }
+// lldbr-check:(packed_struct_with_destructor::PackedInUnpacked) packedInUnpacked = { a = -1111 b = { x = -2222 y = -3333 z = -4444 } c = -5555 d = { x = -6666 y = -7777 z = -8888 } }
+
+// lldb-command:print unpackedInPacked
+// lldbg-check:[...]$3 = { a = 987 b = { x = 876 y = 765 z = 654 } c = { x = 543 y = 432 z = 321 } d = 210 }
+// lldbr-check:(packed_struct_with_destructor::UnpackedInPacked) unpackedInPacked = { a = 987 b = { x = 876 y = 765 z = 654 } c = { x = 543 y = 432 z = 321 } d = 210 }
+
+// lldb-command:print packedInPackedWithDrop
+// lldbg-check:[...]$4 = { a = 11 b = { x = 22 y = 33 z = 44 } c = 55 d = { x = 66 y = 77 z = 88 } }
+// lldbr-check:(packed_struct_with_destructor::PackedInPackedWithDrop) packedInPackedWithDrop = { a = 11 b = { x = 22 y = 33 z = 44 } c = 55 d = { x = 66 y = 77 z = 88 } }
+
+// lldb-command:print packedInUnpackedWithDrop
+// lldbg-check:[...]$5 = { a = -11 b = { x = -22 y = -33 z = -44 } c = -55 d = { x = -66 y = -77 z = -88 } }
+// lldbr-check:(packed_struct_with_destructor::PackedInUnpackedWithDrop) packedInUnpackedWithDrop = { a = -11 b = { x = -22 y = -33 z = -44 } c = -55 d = { x = -66 y = -77 z = -88 } }
+
+// lldb-command:print unpackedInPackedWithDrop
+// lldbg-check:[...]$6 = { a = 98 b = { x = 87 y = 76 z = 65 } c = { x = 54 y = 43 z = 32 } d = 21 }
+// lldbr-check:(packed_struct_with_destructor::UnpackedInPackedWithDrop) unpackedInPackedWithDrop = { a = 98 b = { x = 87 y = 76 z = 65 } c = { x = 54 y = 43 z = 32 } d = 21 }
+
+// lldb-command:print deeplyNested
+// lldbg-check:[...]$7 = { a = { a = 1 b = { x = 2 y = 3 z = 4 } c = 5 d = { x = 6 y = 7 z = 8 } } b = { a = 9 b = { x = 10 y = 11 z = 12 } c = { x = 13 y = 14 z = 15 } d = 16 } c = { a = 17 b = { x = 18 y = 19 z = 20 } c = 21 d = { x = 22 y = 23 z = 24 } } d = { a = 25 b = { x = 26 y = 27 z = 28 } c = 29 d = { x = 30 y = 31 z = 32 } } e = { a = 33 b = { x = 34 y = 35 z = 36 } c = { x = 37 y = 38 z = 39 } d = 40 } f = { a = 41 b = { x = 42 y = 43 z = 44 } c = 45 d = { x = 46 y = 47 z = 48 } } }
+// lldbr-check:(packed_struct_with_destructor::DeeplyNested) deeplyNested = { a = { a = 1 b = { x = 2 y = 3 z = 4 } c = 5 d = { x = 6 y = 7 z = 8 } } b = { a = 9 b = { x = 10 y = 11 z = 12 } c = { x = 13 y = 14 z = 15 } d = 16 } c = { a = 17 b = { x = 18 y = 19 z = 20 } c = 21 d = { x = 22 y = 23 z = 24 } } d = { a = 25 b = { x = 26 y = 27 z = 28 } c = 29 d = { x = 30 y = 31 z = 32 } } e = { a = 33 b = { x = 34 y = 35 z = 36 } c = { x = 37 y = 38 z = 39 } d = 40 } f = { a = 41 b = { x = 42 y = 43 z = 44 } c = 45 d = { x = 46 y = 47 z = 48 } } }
+
+
+#![allow(unused_variables)]
+#![feature(omit_gdb_pretty_printer_section)]
+#![omit_gdb_pretty_printer_section]
+
+#[repr(packed)]
+struct Packed {
+ x: i16,
+ y: i32,
+ z: i64
+}
+
+impl Drop for Packed {
+ fn drop(&mut self) {}
+}
+
+#[repr(packed)]
+struct PackedInPacked {
+ a: i32,
+ b: Packed,
+ c: i64,
+ d: Packed
+}
+
+struct PackedInUnpacked {
+ a: i32,
+ b: Packed,
+ c: i64,
+ d: Packed
+}
+
+struct Unpacked {
+ x: i64,
+ y: i32,
+ z: i16
+}
+
+impl Drop for Unpacked {
+ fn drop(&mut self) {}
+}
+
+#[repr(packed)]
+struct UnpackedInPacked {
+ a: i16,
+ b: Unpacked,
+ c: Unpacked,
+ d: i64
+}
+
+#[repr(packed)]
+struct PackedInPackedWithDrop {
+ a: i32,
+ b: Packed,
+ c: i64,
+ d: Packed
+}
+
+impl Drop for PackedInPackedWithDrop {
+ fn drop(&mut self) {}
+}
+
+struct PackedInUnpackedWithDrop {
+ a: i32,
+ b: Packed,
+ c: i64,
+ d: Packed
+}
+
+impl Drop for PackedInUnpackedWithDrop {
+ fn drop(&mut self) {}
+}
+
+#[repr(packed)]
+struct UnpackedInPackedWithDrop {
+ a: i16,
+ b: Unpacked,
+ c: Unpacked,
+ d: i64
+}
+
+impl Drop for UnpackedInPackedWithDrop {
+ fn drop(&mut self) {}
+}
+
+struct DeeplyNested {
+ a: PackedInPacked,
+ b: UnpackedInPackedWithDrop,
+ c: PackedInUnpacked,
+ d: PackedInUnpackedWithDrop,
+ e: UnpackedInPacked,
+ f: PackedInPackedWithDrop
+}
+
+fn main() {
+ let packed = Packed { x: 123, y: 234, z: 345 };
+
+ let packedInPacked = PackedInPacked {
+ a: 1111,
+ b: Packed { x: 2222, y: 3333, z: 4444 },
+ c: 5555,
+ d: Packed { x: 6666, y: 7777, z: 8888 }
+ };
+
+ let packedInUnpacked = PackedInUnpacked {
+ a: -1111,
+ b: Packed { x: -2222, y: -3333, z: -4444 },
+ c: -5555,
+ d: Packed { x: -6666, y: -7777, z: -8888 }
+ };
+
+ let unpackedInPacked = UnpackedInPacked {
+ a: 987,
+ b: Unpacked { x: 876, y: 765, z: 654 },
+ c: Unpacked { x: 543, y: 432, z: 321 },
+ d: 210
+ };
+
+ let packedInPackedWithDrop = PackedInPackedWithDrop {
+ a: 11,
+ b: Packed { x: 22, y: 33, z: 44 },
+ c: 55,
+ d: Packed { x: 66, y: 77, z: 88 }
+ };
+
+ let packedInUnpackedWithDrop = PackedInUnpackedWithDrop {
+ a: -11,
+ b: Packed { x: -22, y: -33, z: -44 },
+ c: -55,
+ d: Packed { x: -66, y: -77, z: -88 }
+ };
+
+ let unpackedInPackedWithDrop = UnpackedInPackedWithDrop {
+ a: 98,
+ b: Unpacked { x: 87, y: 76, z: 65 },
+ c: Unpacked { x: 54, y: 43, z: 32 },
+ d: 21
+ };
+
+ let deeplyNested = DeeplyNested {
+ a: PackedInPacked {
+ a: 1,
+ b: Packed { x: 2, y: 3, z: 4 },
+ c: 5,
+ d: Packed { x: 6, y: 7, z: 8 }
+ },
+ b: UnpackedInPackedWithDrop {
+ a: 9,
+ b: Unpacked { x: 10, y: 11, z: 12 },
+ c: Unpacked { x: 13, y: 14, z: 15 },
+ d: 16
+ },
+ c: PackedInUnpacked {
+ a: 17,
+ b: Packed { x: 18, y: 19, z: 20 },
+ c: 21,
+ d: Packed { x: 22, y: 23, z: 24 }
+ },
+ d: PackedInUnpackedWithDrop {
+ a: 25,
+ b: Packed { x: 26, y: 27, z: 28 },
+ c: 29,
+ d: Packed { x: 30, y: 31, z: 32 }
+ },
+ e: UnpackedInPacked {
+ a: 33,
+ b: Unpacked { x: 34, y: 35, z: 36 },
+ c: Unpacked { x: 37, y: 38, z: 39 },
+ d: 40
+ },
+ f: PackedInPackedWithDrop {
+ a: 41,
+ b: Packed { x: 42, y: 43, z: 44 },
+ c: 45,
+ d: Packed { x: 46, y: 47, z: 48 }
+ }
+ };
+
+ zzz(); // #break
+}
+
+fn zzz() {()}
diff --git a/src/test/debuginfo/packed-struct.rs b/src/test/debuginfo/packed-struct.rs
new file mode 100644
index 000000000..7d1893a94
--- /dev/null
+++ b/src/test/debuginfo/packed-struct.rs
@@ -0,0 +1,132 @@
+// min-lldb-version: 310
+// ignore-gdb-version: 7.11.90 - 7.12.9
+
+// compile-flags:-g
+
+// === GDB TESTS ===================================================================================
+
+// gdb-command:run
+
+// gdb-command:print packed
+// gdbg-check:$1 = {x = 123, y = 234, z = 345}
+// gdbr-check:$1 = packed_struct::Packed {x: 123, y: 234, z: 345}
+
+// gdb-command:print packedInPacked
+// gdbg-check:$2 = {a = 1111, b = {x = 2222, y = 3333, z = 4444}, c = 5555, d = {x = 6666, y = 7777, z = 8888}}
+// gdbr-check:$2 = packed_struct::PackedInPacked {a: 1111, b: packed_struct::Packed {x: 2222, y: 3333, z: 4444}, c: 5555, d: packed_struct::Packed {x: 6666, y: 7777, z: 8888}}
+
+// gdb-command:print packedInUnpacked
+// gdbg-check:$3 = {a = -1111, b = {x = -2222, y = -3333, z = -4444}, c = -5555, d = {x = -6666, y = -7777, z = -8888}}
+// gdbr-check:$3 = packed_struct::PackedInUnpacked {a: -1111, b: packed_struct::Packed {x: -2222, y: -3333, z: -4444}, c: -5555, d: packed_struct::Packed {x: -6666, y: -7777, z: -8888}}
+
+// gdb-command:print unpackedInPacked
+// gdbg-check:$4 = {a = 987, b = {x = 876, y = 765, z = 654, w = 543}, c = {x = 432, y = 321, z = 210, w = 109}, d = -98}
+// gdbr-check:$4 = packed_struct::UnpackedInPacked {a: 987, b: packed_struct::Unpacked {x: 876, y: 765, z: 654, w: 543}, c: packed_struct::Unpacked {x: 432, y: 321, z: 210, w: 109}, d: -98}
+
+// gdb-command:print sizeof(packed)
+// gdb-check:$5 = 14
+
+// gdb-command:print sizeof(packedInPacked)
+// gdb-check:$6 = 40
+
+
+// === LLDB TESTS ==================================================================================
+
+// lldb-command:run
+
+// lldb-command:print packed
+// lldbg-check:[...]$0 = { x = 123 y = 234 z = 345 }
+// lldbr-check:(packed_struct::Packed) packed = { x = 123 y = 234 z = 345 }
+
+// lldb-command:print packedInPacked
+// lldbg-check:[...]$1 = { a = 1111 b = { x = 2222 y = 3333 z = 4444 } c = 5555 d = { x = 6666 y = 7777 z = 8888 } }
+// lldbr-check:(packed_struct::PackedInPacked) packedInPacked = { a = 1111 b = { x = 2222 y = 3333 z = 4444 } c = 5555 d = { x = 6666 y = 7777 z = 8888 } }
+
+// lldb-command:print packedInUnpacked
+// lldbg-check:[...]$2 = { a = -1111 b = { x = -2222 y = -3333 z = -4444 } c = -5555 d = { x = -6666 y = -7777 z = -8888 } }
+// lldbr-check:(packed_struct::PackedInUnpacked) packedInUnpacked = { a = -1111 b = { x = -2222 y = -3333 z = -4444 } c = -5555 d = { x = -6666 y = -7777 z = -8888 } }
+
+// lldb-command:print unpackedInPacked
+// lldbg-check:[...]$3 = { a = 987 b = { x = 876 y = 765 z = 654 w = 543 } c = { x = 432 y = 321 z = 210 w = 109 } d = -98 }
+// lldbr-check:(packed_struct::UnpackedInPacked) unpackedInPacked = { a = 987 b = { x = 876 y = 765 z = 654 w = 543 } c = { x = 432 y = 321 z = 210 w = 109 } d = -98 }
+
+// lldb-command:print sizeof(packed)
+// lldbg-check:[...]$4 = 14
+// lldbr-check:(usize) = 14
+
+// lldb-command:print sizeof(packedInPacked)
+// lldbg-check:[...]$5 = 40
+// lldbr-check:(usize) = 40
+
+#![allow(unused_variables)]
+#![feature(omit_gdb_pretty_printer_section)]
+#![omit_gdb_pretty_printer_section]
+
+#[repr(packed)]
+struct Packed {
+ x: i16,
+ y: i32,
+ z: i64
+}
+
+#[repr(packed)]
+struct PackedInPacked {
+ a: i32,
+ b: Packed,
+ c: i64,
+ d: Packed
+}
+
+// layout (64 bit): aaaa bbbb bbbb bbbb bb.. .... cccc cccc dddd dddd dddd dd..
+struct PackedInUnpacked {
+ a: i32,
+ b: Packed,
+ c: i64,
+ d: Packed
+}
+
+// layout (64 bit): xx.. yyyy zz.. .... wwww wwww
+struct Unpacked {
+ x: i16,
+ y: i32,
+ z: i16,
+ w: i64
+}
+
+// layout (64 bit): aabb bbbb bbbb bbbb bbbb bbbb bbcc cccc cccc cccc cccc cccc ccdd dddd dd
+#[repr(packed)]
+struct UnpackedInPacked {
+ a: i16,
+ b: Unpacked,
+ c: Unpacked,
+ d: i64
+}
+
+fn main() {
+ let packed = Packed { x: 123, y: 234, z: 345 };
+
+ let packedInPacked = PackedInPacked {
+ a: 1111,
+ b: Packed { x: 2222, y: 3333, z: 4444 },
+ c: 5555,
+ d: Packed { x: 6666, y: 7777, z: 8888 }
+ };
+
+ let packedInUnpacked = PackedInUnpacked {
+ a: -1111,
+ b: Packed { x: -2222, y: -3333, z: -4444 },
+ c: -5555,
+ d: Packed { x: -6666, y: -7777, z: -8888 }
+ };
+
+ let unpackedInPacked = UnpackedInPacked {
+ a: 987,
+ b: Unpacked { x: 876, y: 765, z: 654, w: 543 },
+ c: Unpacked { x: 432, y: 321, z: 210, w: 109 },
+ d: -98
+ };
+
+ zzz(); // #break
+}
+
+fn zzz() {()}
diff --git a/src/test/debuginfo/pretty-huge-vec.rs b/src/test/debuginfo/pretty-huge-vec.rs
new file mode 100644
index 000000000..84f76ba4e
--- /dev/null
+++ b/src/test/debuginfo/pretty-huge-vec.rs
@@ -0,0 +1,30 @@
+// ignore-windows failing on win32 bot
+// ignore-freebsd: gdb package too new
+// ignore-android: FIXME(#10381)
+// compile-flags:-g
+// min-gdb-version: 8.1
+// min-lldb-version: 310
+
+// === GDB TESTS ===================================================================================
+
+// gdb-command: run
+
+// gdb-command: print vec
+// gdb-check:$1 = Vec(size=1000000000) = {[...]...}
+
+// gdb-command: print slice
+// gdb-check:$2 = &[u8](size=1000000000) = {[...]...}
+
+#![allow(unused_variables)]
+
+fn main() {
+
+ // Vec
+ let mut vec: Vec<u8> = Vec::with_capacity(1_000_000_000);
+ unsafe{ vec.set_len(1_000_000_000) }
+ let slice = &vec[..];
+
+ zzz(); // #break
+}
+
+fn zzz() { () }
diff --git a/src/test/debuginfo/pretty-slices.rs b/src/test/debuginfo/pretty-slices.rs
new file mode 100644
index 000000000..6adc8757b
--- /dev/null
+++ b/src/test/debuginfo/pretty-slices.rs
@@ -0,0 +1,46 @@
+// ignore-android: FIXME(#10381)
+// ignore-windows
+// compile-flags:-g
+
+// gdb-command: run
+
+// gdb-command: print slice
+// gdbg-check: $1 = struct &[i32](size=3) = {0, 1, 2}
+// gdbr-check: $1 = &[i32](size=3) = {0, 1, 2}
+
+// gdb-command: print mut_slice
+// gdbg-check: $2 = struct &mut [i32](size=4) = {2, 3, 5, 7}
+// gdbr-check: $2 = &mut [i32](size=4) = {2, 3, 5, 7}
+
+// gdb-command: print str_slice
+// gdb-check: $3 = "string slice"
+
+// gdb-command: print mut_str_slice
+// gdb-check: $4 = "mutable string slice"
+
+// lldb-command: run
+
+// lldb-command: print slice
+// lldb-check: (&[i32]) $0 = size=3 { [0] = 0 [1] = 1 [2] = 2 }
+
+// lldb-command: print mut_slice
+// lldb-check: (&mut [i32]) $1 = size=4 { [0] = 2 [1] = 3 [2] = 5 [3] = 7 }
+
+// lldb-command: print str_slice
+// lldb-check: (&str) $2 = "string slice" { data_ptr = [...] length = 12 }
+
+// lldb-command: print mut_str_slice
+// lldb-check: (&mut str) $3 = "mutable string slice" { data_ptr = [...] length = 20 }
+
+fn b() {}
+
+fn main() {
+ let slice: &[i32] = &[0, 1, 2];
+ let mut_slice: &mut [i32] = &mut [2, 3, 5, 7];
+
+ let str_slice: &str = "string slice";
+ let mut mut_str_slice_buffer = String::from("mutable string slice");
+ let mut_str_slice: &mut str = mut_str_slice_buffer.as_mut_str();
+
+ b(); // #break
+}
diff --git a/src/test/debuginfo/pretty-std-collections-hash.rs b/src/test/debuginfo/pretty-std-collections-hash.rs
new file mode 100644
index 000000000..40bde8606
--- /dev/null
+++ b/src/test/debuginfo/pretty-std-collections-hash.rs
@@ -0,0 +1,106 @@
+// CDB doesn't like how libstd.natvis casts to tuples before this version.
+// https://github.com/rust-lang/rust/issues/76352#issuecomment-687640746
+// min-cdb-version: 10.0.18362.1
+
+// cdb-only
+// compile-flags:-g
+
+// === CDB TESTS ==================================================================================
+
+// cdb-command: g
+
+// cdb-command: dx hash_set,d
+// cdb-check:hash_set,d [...] : { len=15 } [Type: [...]::HashSet<u64,[...]>]
+// cdb-check: [len] : 15 [Type: [...]]
+// cdb-check: [capacity] : [...]
+// cdb-check: [[...]] [...] : 0 [Type: u64]
+// cdb-command: dx hash_set,d
+// cdb-check: [[...]] [...] : 1 [Type: u64]
+// cdb-command: dx hash_set,d
+// cdb-check: [[...]] [...] : 2 [Type: u64]
+// cdb-command: dx hash_set,d
+// cdb-check: [[...]] [...] : 3 [Type: u64]
+// cdb-command: dx hash_set,d
+// cdb-check: [[...]] [...] : 4 [Type: u64]
+// cdb-command: dx hash_set,d
+// cdb-check: [[...]] [...] : 5 [Type: u64]
+// cdb-command: dx hash_set,d
+// cdb-check: [[...]] [...] : 6 [Type: u64]
+// cdb-command: dx hash_set,d
+// cdb-check: [[...]] [...] : 7 [Type: u64]
+// cdb-command: dx hash_set,d
+// cdb-check: [[...]] [...] : 8 [Type: u64]
+// cdb-command: dx hash_set,d
+// cdb-check: [[...]] [...] : 9 [Type: u64]
+// cdb-command: dx hash_set,d
+// cdb-check: [[...]] [...] : 10 [Type: u64]
+// cdb-command: dx hash_set,d
+// cdb-check: [[...]] [...] : 11 [Type: u64]
+// cdb-command: dx hash_set,d
+// cdb-check: [[...]] [...] : 12 [Type: u64]
+// cdb-command: dx hash_set,d
+// cdb-check: [[...]] [...] : 13 [Type: u64]
+// cdb-command: dx hash_set,d
+// cdb-check: [[...]] [...] : 14 [Type: u64]
+
+// cdb-command: dx hash_map,d
+// cdb-check:hash_map,d [...] : { len=15 } [Type: [...]::HashMap<u64,u64,[...]>]
+// cdb-check: [len] : 15 [Type: [...]]
+// cdb-check: [capacity] : [...]
+// cdb-check: ["0x0"] : 0 [Type: unsigned __int64]
+// cdb-command: dx hash_map,d
+// cdb-check: ["0x1"] : 1 [Type: unsigned __int64]
+// cdb-command: dx hash_map,d
+// cdb-check: ["0x2"] : 2 [Type: unsigned __int64]
+// cdb-command: dx hash_map,d
+// cdb-check: ["0x3"] : 3 [Type: unsigned __int64]
+// cdb-command: dx hash_map,d
+// cdb-check: ["0x4"] : 4 [Type: unsigned __int64]
+// cdb-command: dx hash_map,d
+// cdb-check: ["0x5"] : 5 [Type: unsigned __int64]
+// cdb-command: dx hash_map,d
+// cdb-check: ["0x6"] : 6 [Type: unsigned __int64]
+// cdb-command: dx hash_map,d
+// cdb-check: ["0x7"] : 7 [Type: unsigned __int64]
+// cdb-command: dx hash_map,d
+// cdb-check: ["0x8"] : 8 [Type: unsigned __int64]
+// cdb-command: dx hash_map,d
+// cdb-check: ["0x9"] : 9 [Type: unsigned __int64]
+// cdb-command: dx hash_map,d
+// cdb-check: ["0xa"] : 10 [Type: unsigned __int64]
+// cdb-command: dx hash_map,d
+// cdb-check: ["0xb"] : 11 [Type: unsigned __int64]
+// cdb-command: dx hash_map,d
+// cdb-check: ["0xc"] : 12 [Type: unsigned __int64]
+// cdb-command: dx hash_map,d
+// cdb-check: ["0xd"] : 13 [Type: unsigned __int64]
+// cdb-command: dx hash_map,d
+// cdb-check: ["0xe"] : 14 [Type: unsigned __int64]
+
+// cdb-command: dx x
+
+#![allow(unused_variables)]
+use std::collections::HashSet;
+use std::collections::HashMap;
+
+
+fn main() {
+ // HashSet
+ let mut hash_set = HashSet::new();
+ for i in 0..15 {
+ hash_set.insert(i as u64);
+ }
+
+ // HashMap
+ let mut hash_map = HashMap::new();
+ for i in 0..15 {
+ hash_map.insert(i as u64, i as u64);
+ }
+
+ let x = &(123u64, 456u64);
+ let string = "awefawefawe".to_string();
+
+ zzz(); // #break
+}
+
+fn zzz() { () }
diff --git a/src/test/debuginfo/pretty-std-collections.rs b/src/test/debuginfo/pretty-std-collections.rs
new file mode 100644
index 000000000..93597aa7e
--- /dev/null
+++ b/src/test/debuginfo/pretty-std-collections.rs
@@ -0,0 +1,163 @@
+// ignore-windows failing on win32 bot
+// ignore-freebsd: gdb package too new
+// ignore-android: FIXME(#10381)
+// ignore-macos: FIXME(#78665)
+// compile-flags:-g
+
+// The pretty printers being tested here require the patch from
+// https://sourceware.org/bugzilla/show_bug.cgi?id=21763
+// min-gdb-version: 8.1
+
+// min-lldb-version: 310
+
+// === GDB TESTS ===================================================================================
+
+// gdb-command: run
+
+// gdb-command: print btree_set
+// gdb-check:$1 = BTreeSet(size=15) = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14}
+
+// gdb-command: print empty_btree_set
+// gdb-check:$2 = BTreeSet(size=0)
+
+// gdb-command: print btree_map
+// gdb-check:$3 = BTreeMap(size=15) = {[0] = 0, [1] = 1, [2] = 2, [3] = 3, [4] = 4, [5] = 5, [6] = 6, [7] = 7, [8] = 8, [9] = 9, [10] = 10, [11] = 11, [12] = 12, [13] = 13, [14] = 14}
+
+// gdb-command: print empty_btree_map
+// gdb-check:$4 = BTreeMap(size=0)
+
+// gdb-command: print option_btree_map
+// gdb-check:$5 = BTreeMap(size=2) = {[false] = [...], [true] = [...]}
+// (abbreviated because both values vary wildly over gdb versions and/or linux distributions)
+
+// gdb-command: print nasty_btree_map
+// gdb-check:$6 = BTreeMap(size=15) = {[0] = pretty_std_collections::MyLeafNode (0), [...]}
+// (abbreviated because it's boring but we need enough elements to include internal nodes)
+
+// gdb-command: print zst_key_btree_map
+// gdb-check:$7 = BTreeMap(size=1) = {[()] = 1}
+
+// gdb-command: print zst_val_btree_map
+// gdb-check:$8 = BTreeMap(size=1) = {[1] = ()}
+
+// gdb-command: print zst_key_val_btree_map
+// gdb-check:$9 = BTreeMap(size=1) = {[()] = ()}
+
+// gdb-command: print vec_deque
+// gdb-check:$10 = VecDeque(size=3) = {5, 3, 7}
+
+// gdb-command: print vec_deque2
+// gdb-check:$11 = VecDeque(size=7) = {2, 3, 4, 5, 6, 7, 8}
+
+// gdb-command: print hash_map
+// gdb-check:$12 = HashMap(size=4) = {[1] = 10, [2] = 20, [3] = 30, [4] = 40}
+
+// gdb-command: print hash_set
+// gdb-check:$13 = HashSet(size=4) = {1, 2, 3, 4}
+
+// === LLDB TESTS ==================================================================================
+
+// lldb-command:run
+
+// lldb-command:print vec_deque
+// lldbg-check:[...]$0 = size=3 { [0] = 5 [1] = 3 [2] = 7 }
+// lldbr-check:(alloc::collections::vec_deque::VecDeque<i32>) vec_deque = size=3 = { [0] = 5 [1] = 3 [2] = 7 }
+
+// lldb-command:print vec_deque2
+// lldbg-check:[...]$1 = size=7 { [0] = 2 [1] = 3 [2] = 4 [3] = 5 [4] = 6 [5] = 7 [6] = 8 }
+// lldbr-check:(alloc::collections::vec_deque::VecDeque<i32>) vec_deque2 = size=7 = { [0] = 2 [1] = 3 [2] = 4 [3] = 5 [4] = 6 [5] = 7 [6] = 8 }
+
+// lldb-command:print hash_map
+// lldbg-check:[...]$2 = size=4 { [0] = { 0 = 1 1 = 10 } [1] = { 0 = 2 1 = 20 } [2] = { 0 = 3 1 = 30 } [3] = { 0 = 4 1 = 40 } }
+// lldbr-check:(std::collections::hash::map::HashMap<u64, u64, [...]>) hash_map = size=4 size=4 { [0] = { 0 = 1 1 = 10 } [1] = { 0 = 2 1 = 20 } [2] = { 0 = 3 1 = 30 } [3] = { 0 = 4 1 = 40 } }
+
+// lldb-command:print hash_set
+// lldbg-check:[...]$3 = size=4 { [0] = 1 [1] = 2 [2] = 3 [3] = 4 }
+// lldbr-check:(std::collections::hash::set::HashSet<u64, [...]>) hash_set = size=4 { [0] = 1 [1] = 2 [2] = 3 [3] = 4 }
+
+#![allow(unused_variables)]
+use std::collections::BTreeMap;
+use std::collections::BTreeSet;
+use std::collections::HashMap;
+use std::collections::HashSet;
+use std::collections::VecDeque;
+use std::hash::{BuildHasherDefault, Hasher};
+
+struct MyLeafNode(i32); // helps to ensure we don't blindly replace substring "LeafNode"
+
+#[derive(Default)]
+struct SimpleHasher { hash: u64 }
+
+impl Hasher for SimpleHasher {
+ fn finish(&self) -> u64 { self.hash }
+ fn write(&mut self, bytes: &[u8]) {}
+ fn write_u64(&mut self, i: u64) { self.hash = i }
+}
+
+fn main() {
+ // BTreeSet
+ let mut btree_set = BTreeSet::new();
+ for i in 0..15 {
+ btree_set.insert(i);
+ }
+
+ let empty_btree_set: BTreeSet<i32> = BTreeSet::new();
+
+ // BTreeMap
+ let mut btree_map = BTreeMap::new();
+ for i in 0..15 {
+ btree_map.insert(i, i);
+ }
+
+ let empty_btree_map: BTreeMap<i32, u32> = BTreeMap::new();
+
+ let mut option_btree_map: BTreeMap<bool, Option<bool>> = BTreeMap::new();
+ option_btree_map.insert(false, None);
+ option_btree_map.insert(true, Some(true));
+
+ let mut nasty_btree_map: BTreeMap<i32, MyLeafNode> = BTreeMap::new();
+ for i in 0..15 {
+ nasty_btree_map.insert(i, MyLeafNode(i));
+ }
+
+ let mut zst_key_btree_map: BTreeMap<(), i32> = BTreeMap::new();
+ zst_key_btree_map.insert((), 1);
+
+ let mut zst_val_btree_map: BTreeMap<i32, ()> = BTreeMap::new();
+ zst_val_btree_map.insert(1, ());
+
+ let mut zst_key_val_btree_map: BTreeMap<(), ()> = BTreeMap::new();
+ zst_key_val_btree_map.insert((), ());
+
+ // VecDeque
+ let mut vec_deque = VecDeque::new();
+ vec_deque.push_back(5);
+ vec_deque.push_back(3);
+ vec_deque.push_back(7);
+
+ // VecDeque where an element was popped.
+ let mut vec_deque2 = VecDeque::new();
+ for i in 1..8 {
+ vec_deque2.push_back(i)
+ }
+ vec_deque2.pop_front();
+ vec_deque2.push_back(8);
+
+ // HashMap
+ let mut hash_map = HashMap::<u64, u64, BuildHasherDefault<SimpleHasher>>::default();
+ for i in 1..5 {
+ hash_map.insert(i, i * 10);
+ }
+
+ // HashSet
+ let mut hash_set = HashSet::<u64, BuildHasherDefault<SimpleHasher>>::default();
+ for i in 1..5 {
+ hash_set.insert(i);
+ }
+
+ zzz(); // #break
+}
+
+fn zzz() {
+ ()
+}
diff --git a/src/test/debuginfo/pretty-std.rs b/src/test/debuginfo/pretty-std.rs
new file mode 100644
index 000000000..55a4ecc1c
--- /dev/null
+++ b/src/test/debuginfo/pretty-std.rs
@@ -0,0 +1,191 @@
+// ignore-freebsd: gdb package too new
+// only-cdb // "Temporarily" ignored on GDB/LLDB due to debuginfo tests being disabled, see PR 47155
+// ignore-android: FIXME(#10381)
+// compile-flags:-g
+// min-gdb-version: 7.7
+// min-lldb-version: 310
+// min-cdb-version: 10.0.18317.1001
+
+// === GDB TESTS ===================================================================================
+
+// gdb-command: run
+
+// gdb-command: print slice
+// gdb-check:$1 = &[i32](len: 4) = {0, 1, 2, 3}
+
+// gdb-command: print vec
+// gdb-check:$2 = Vec<u64, alloc::alloc::Global>(len: 4, cap: [...]) = {4, 5, 6, 7}
+
+// gdb-command: print str_slice
+// gdb-check:$3 = "IAMA string slice!"
+
+// gdb-command: print string
+// gdb-check:$4 = "IAMA string!"
+
+// gdb-command: print some
+// gdb-check:$5 = Some = {8}
+
+// gdb-command: print none
+// gdbg-check:$6 = None
+// gdbr-check:$6 = core::option::Option::None
+
+// gdb-command: print os_string
+// gdb-check:$7 = "IAMA OS string 😃"
+
+// gdb-command: print some_string
+// gdb-check:$8 = Some = {"IAMA optional string!"}
+
+// gdb-command: set print length 5
+// gdb-command: print some_string
+// gdb-check:$8 = Some = {"IAMA "...}
+
+
+// === LLDB TESTS ==================================================================================
+
+// lldb-command: run
+
+// lldb-command: print slice
+// lldb-check:[...]$0 = &[0, 1, 2, 3]
+
+// lldb-command: print vec
+// lldb-check:[...]$1 = vec![4, 5, 6, 7]
+
+// lldb-command: print str_slice
+// lldb-check:[...]$2 = "IAMA string slice!"
+
+// lldb-command: print string
+// lldb-check:[...]$3 = "IAMA string!"
+
+// lldb-command: print some
+// lldb-check:[...]$4 = Some(8)
+
+// lldb-command: print none
+// lldb-check:[...]$5 = None
+
+// lldb-command: print os_string
+// lldb-check:[...]$6 = "IAMA OS string 😃"[...]
+
+
+// === CDB TESTS ==================================================================================
+
+// cdb-command: g
+
+// cdb-command: dx slice,d
+// cdb-check:slice,d : { len=4 } [Type: slice$<i32>]
+// cdb-check: [len] : 4 [Type: [...]]
+// cdb-check: [0] : 0 [Type: int]
+// cdb-check: [1] : 1 [Type: int]
+// cdb-check: [2] : 2 [Type: int]
+// cdb-check: [3] : 3 [Type: int]
+
+// cdb-command: dx vec,d
+// cdb-check:vec,d [...] : { len=4 } [Type: [...]::Vec<u64,alloc::alloc::Global>]
+// cdb-check: [len] : 4 [Type: [...]]
+// cdb-check: [capacity] : [...] [Type: [...]]
+// cdb-check: [0] : 4 [Type: unsigned __int64]
+// cdb-check: [1] : 5 [Type: unsigned __int64]
+// cdb-check: [2] : 6 [Type: unsigned __int64]
+// cdb-check: [3] : 7 [Type: unsigned __int64]
+
+// cdb-command: dx str_slice
+// cdb-check:str_slice : "IAMA string slice!" [Type: str]
+
+// cdb-command: dx string
+// cdb-check:string : "IAMA string!" [Type: [...]::String]
+// cdb-check: [<Raw View>] [Type: [...]::String]
+// cdb-check: [len] : 0xc [Type: [...]]
+// cdb-check: [capacity] : 0xc [Type: [...]]
+
+// cdb-command: dx -r2 string
+// cdb-check: [0] : 73 'I' [Type: char]
+// cdb-check: [1] : 65 'A' [Type: char]
+// cdb-check: [2] : 77 'M' [Type: char]
+// cdb-check: [3] : 65 'A' [Type: char]
+// cdb-check: [4] : 32 ' ' [Type: char]
+// cdb-check: [5] : 115 's' [Type: char]
+// cdb-check: [6] : 116 't' [Type: char]
+// cdb-check: [7] : 114 'r' [Type: char]
+// cdb-check: [8] : 105 'i' [Type: char]
+// cdb-check: [9] : 110 'n' [Type: char]
+// cdb-check: [10] : 103 'g' [Type: char]
+// cdb-check: [11] : 33 '!' [Type: char]
+
+// cdb-command: dx os_string
+// NOTE: OSString is WTF-8 encoded which Windows debuggers don't understand. Verify the UTF-8
+// portion displays correctly.
+// cdb-check:os_string : "IAMA OS string [...]" [Type: std::ffi::os_str::OsString]
+// cdb-check: [<Raw View>] [Type: std::ffi::os_str::OsString]
+// cdb-check: [chars] : "IAMA OS string [...]"
+
+// cdb-command: dx some
+// cdb-check:some : Some [Type: enum$<core::option::Option<i16> >]
+// cdb-check: [<Raw View>] [Type: enum$<core::option::Option<i16> >]
+// cdb-check: [variant] : Some
+// cdb-check: [+0x002] __0 : 8 [Type: short]
+
+// cdb-command: dx none
+// cdb-check:none : None [Type: enum$<core::option::Option<i64> >]
+// cdb-check: [<Raw View>] [Type: enum$<core::option::Option<i64> >]
+// cdb-check: [variant] : None
+
+// cdb-command: dx some_string
+// cdb-check:some_string : Some({...}) [Type: enum$<core::option::Option<alloc::string::String>, 1, [...], Some>]
+// cdb-check: [<Raw View>] [Type: enum$<core::option::Option<alloc::string::String>, 1, [...], Some>]
+// cdb-check: [variant] : Some
+// cdb-check: [+0x000] __0 : "IAMA optional string!" [Type: alloc::string::String]
+
+// cdb-command: dx linkedlist
+// cdb-check:linkedlist : { len=0x2 } [Type: alloc::collections::linked_list::LinkedList<i32>]
+// cdb-check: [<Raw View>] [Type: alloc::collections::linked_list::LinkedList<i32>]
+// cdb-check: [0x0] : 128 [Type: int]
+// cdb-check: [0x1] : 42 [Type: int]
+
+// cdb-command: dx vecdeque
+// cdb-check:vecdeque : { len=0x2 } [Type: alloc::collections::vec_deque::VecDeque<i32,alloc::alloc::Global>]
+// cdb-check: [<Raw View>] [Type: alloc::collections::vec_deque::VecDeque<i32,alloc::alloc::Global>]
+// cdb-check: [len] : 0x2
+// cdb-check: [capacity] : 0x8 [Type: unsigned [...]]
+// cdb-check: [0x0] : 90 [Type: int]
+// cdb-check: [0x1] : 20 [Type: int]
+
+#![allow(unused_variables)]
+use std::collections::{LinkedList, VecDeque};
+use std::ffi::OsString;
+
+fn main() {
+
+ // &[]
+ let slice: &[i32] = &[0, 1, 2, 3];
+
+ // Vec
+ let vec = vec![4u64, 5, 6, 7];
+
+ // &str
+ let str_slice = "IAMA string slice!";
+
+ // String
+ let string = "IAMA string!".to_string();
+
+ // OsString
+ let os_string = OsString::from("IAMA OS string \u{1F603}");
+
+ // Option
+ let some = Some(8i16);
+ let none: Option<i64> = None;
+
+ let some_string = Some("IAMA optional string!".to_owned());
+
+ // LinkedList
+ let mut linkedlist = LinkedList::new();
+ linkedlist.push_back(42);
+ linkedlist.push_front(128);
+
+ // VecDeque
+ let mut vecdeque = VecDeque::new();
+ vecdeque.push_back(20);
+ vecdeque.push_front(90);
+
+ zzz(); // #break
+}
+
+fn zzz() { () }
diff --git a/src/test/debuginfo/pretty-uninitialized-vec.rs b/src/test/debuginfo/pretty-uninitialized-vec.rs
new file mode 100644
index 000000000..61791f48f
--- /dev/null
+++ b/src/test/debuginfo/pretty-uninitialized-vec.rs
@@ -0,0 +1,26 @@
+// ignore-windows failing on win32 bot
+// ignore-freebsd: gdb package too new
+// ignore-android: FIXME(#10381)
+// compile-flags:-g
+// min-gdb-version: 8.1
+// min-lldb-version: 310
+
+// === GDB TESTS ===================================================================================
+
+// gdb-command: run
+
+// gdb-command: print vec
+// gdb-check:$1 = Vec(size=[...])[...]
+
+
+#![allow(unused_variables)]
+
+fn main() {
+
+ let vec;
+ zzz(); // #break
+ vec = vec![0];
+
+}
+
+fn zzz() { () }
diff --git a/src/test/debuginfo/range-types.rs b/src/test/debuginfo/range-types.rs
new file mode 100644
index 000000000..7362a50a0
--- /dev/null
+++ b/src/test/debuginfo/range-types.rs
@@ -0,0 +1,49 @@
+// Testing the display of range types in cdb.
+
+// cdb-only
+// min-cdb-version: 10.0.18317.1001
+// compile-flags:-g
+
+// === CDB TESTS ==================================================================================
+
+// cdb-command: g
+
+// cdb-command: dx r1,d
+// cdb-check:r1,d : (3..5) [Type: core::ops::range::Range<i32>]
+// cdb-check: [<Raw View>] [Type: core::ops::range::Range<i32>]
+
+// cdb-command: dx r2,d
+// cdb-check:r2,d : (2..) [Type: core::ops::range::RangeFrom<i32>]
+// cdb-check: [<Raw View>] [Type: core::ops::range::RangeFrom<i32>]
+
+// cdb-command: dx r3,d
+// cdb-check:r3,d : (1..=4) [Type: core::ops::range::RangeInclusive<i32>]
+// cdb-check: [<Raw View>] [Type: core::ops::range::RangeInclusive<i32>]
+
+// cdb-command: dx r4,d
+// cdb-check:r4,d : (..10) [Type: core::ops::range::RangeTo<i32>]
+// cdb-check: [<Raw View>] [Type: core::ops::range::RangeTo<i32>]
+
+// cdb-command: dx r5,d
+// cdb-check:r5,d : (..=3) [Type: core::ops::range::RangeToInclusive<i32>]
+// cdb-check: [<Raw View>] [Type: core::ops::range::RangeToInclusive<i32>]
+
+// cdb-command: dx r6,d
+// cdb-check:r6,d [Type: core::ops::range::RangeFull]
+
+#[allow(unused_variables)]
+
+use std::ops::{Range, RangeFrom, RangeFull, RangeInclusive, RangeToInclusive};
+
+fn main()
+{
+ let r1 = (3..5);
+ let r2 = (2..);
+ let r3 = (1..=4);
+ let r4 = (..10);
+ let r5 = (..=3);
+ let r6 = (..);
+ zzz(); // #break
+}
+
+fn zzz() { () }
diff --git a/src/test/debuginfo/rc_arc.rs b/src/test/debuginfo/rc_arc.rs
new file mode 100644
index 000000000..c05c565d9
--- /dev/null
+++ b/src/test/debuginfo/rc_arc.rs
@@ -0,0 +1,145 @@
+// ignore-windows-gnu: pretty-printers are not loaded
+// compile-flags:-g
+
+// min-gdb-version: 8.1
+// min-cdb-version: 10.0.18317.1001
+
+// === GDB TESTS ==================================================================================
+
+// gdb-command:run
+
+// gdb-command:print rc
+// gdb-check:[...]$1 = Rc(strong=11, weak=1) = {value = 111, strong = 11, weak = 1}
+// gdb-command:print arc
+// gdb-check:[...]$2 = Arc(strong=21, weak=1) = {value = 222, strong = 21, weak = 1}
+
+// === LLDB TESTS ==================================================================================
+
+// lldb-command:run
+
+// lldb-command:print rc
+// lldb-check:[...]$0 = strong=11, weak=1 { value = 111 }
+// lldb-command:print arc
+// lldb-check:[...]$1 = strong=21, weak=1 { data = 222 }
+
+// === CDB TESTS ==================================================================================
+
+// cdb-command:g
+
+// cdb-command:dx rc,d
+// cdb-check:rc,d : 111 [Type: alloc::rc::Rc<i32>]
+// cdb-check: [Reference count] : 11 [Type: core::cell::Cell<usize>]
+// cdb-check: [Weak reference count] : 2 [Type: core::cell::Cell<usize>]
+
+// cdb-command:dx weak_rc,d
+// cdb-check:weak_rc,d : 111 [Type: alloc::rc::Weak<i32>]
+// cdb-check: [Reference count] : 11 [Type: core::cell::Cell<usize>]
+// cdb-check: [Weak reference count] : 2 [Type: core::cell::Cell<usize>]
+
+// cdb-command:dx arc,d
+// cdb-check:arc,d : 222 [Type: alloc::sync::Arc<i32>]
+// cdb-check: [Reference count] : 21 [Type: core::sync::atomic::AtomicUsize]
+// cdb-check: [Weak reference count] : 2 [Type: core::sync::atomic::AtomicUsize]
+
+// cdb-command:dx weak_arc,d
+// cdb-check:weak_arc,d : 222 [Type: alloc::sync::Weak<i32>]
+// cdb-check: [Reference count] : 21 [Type: core::sync::atomic::AtomicUsize]
+// cdb-check: [Weak reference count] : 2 [Type: core::sync::atomic::AtomicUsize]
+
+// cdb-command:dx dyn_rc,d
+// cdb-check:dyn_rc,d [Type: alloc::rc::Rc<dyn$<core::fmt::Debug> >]
+// cdb-check: [Reference count] : 31 [Type: core::cell::Cell<usize>]
+// cdb-check: [Weak reference count] : 2 [Type: core::cell::Cell<usize>]
+
+// cdb-command:dx dyn_rc_weak,d
+// cdb-check:dyn_rc_weak,d [Type: alloc::rc::Weak<dyn$<core::fmt::Debug> >]
+// cdb-check: [Reference count] : 31 [Type: core::cell::Cell<usize>]
+// cdb-check: [Weak reference count] : 2 [Type: core::cell::Cell<usize>]
+
+// cdb-command:dx slice_rc,d
+// cdb-check:slice_rc,d : { len=3 } [Type: alloc::rc::Rc<slice$<u32> >]
+// cdb-check: [Length] : 3 [Type: [...]]
+// cdb-check: [Reference count] : 41 [Type: core::cell::Cell<usize>]
+// cdb-check: [Weak reference count] : 2 [Type: core::cell::Cell<usize>]
+// cdb-check: [0] : 1 [Type: u32]
+// cdb-check: [1] : 2 [Type: u32]
+// cdb-check: [2] : 3 [Type: u32]
+
+// cdb-command:dx slice_rc_weak,d
+// cdb-check:slice_rc_weak,d : { len=3 } [Type: alloc::rc::Weak<slice$<u32> >]
+// cdb-check: [Length] : 3 [Type: [...]]
+// cdb-check: [Reference count] : 41 [Type: core::cell::Cell<usize>]
+// cdb-check: [Weak reference count] : 2 [Type: core::cell::Cell<usize>]
+// cdb-check: [0] : 1 [Type: u32]
+// cdb-check: [1] : 2 [Type: u32]
+// cdb-check: [2] : 3 [Type: u32]
+
+// cdb-command:dx dyn_arc,d
+// cdb-check:dyn_arc,d [Type: alloc::sync::Arc<dyn$<core::fmt::Debug> >]
+// cdb-check: [Reference count] : 51 [Type: core::sync::atomic::AtomicUsize]
+// cdb-check: [Weak reference count] : 2 [Type: core::sync::atomic::AtomicUsize]
+
+// cdb-command:dx dyn_arc_weak,d
+// cdb-check:dyn_arc_weak,d [Type: alloc::sync::Weak<dyn$<core::fmt::Debug> >]
+// cdb-check: [Reference count] : 51 [Type: core::sync::atomic::AtomicUsize]
+// cdb-check: [Weak reference count] : 2 [Type: core::sync::atomic::AtomicUsize]
+
+// cdb-command:dx slice_arc,d
+// cdb-check:slice_arc,d : { len=3 } [Type: alloc::sync::Arc<slice$<u32> >]
+// cdb-check: [Length] : 3 [Type: [...]]
+// cdb-check: [Reference count] : 61 [Type: core::sync::atomic::AtomicUsize]
+// cdb-check: [Weak reference count] : 2 [Type: core::sync::atomic::AtomicUsize]
+// cdb-check: [0] : 4 [Type: u32]
+// cdb-check: [1] : 5 [Type: u32]
+// cdb-check: [2] : 6 [Type: u32]
+
+// cdb-command:dx slice_arc_weak,d
+// cdb-check:slice_arc_weak,d : { len=3 } [Type: alloc::sync::Weak<slice$<u32> >]
+// cdb-check: [Length] : 3 [Type: [...]]
+// cdb-check: [Reference count] : 61 [Type: core::sync::atomic::AtomicUsize]
+// cdb-check: [Weak reference count] : 2 [Type: core::sync::atomic::AtomicUsize]
+// cdb-check: [0] : 4 [Type: u32]
+// cdb-check: [1] : 5 [Type: u32]
+// cdb-check: [2] : 6 [Type: u32]
+
+use std::fmt::Debug;
+use std::rc::Rc;
+use std::sync::Arc;
+
+fn main() {
+ let rc = Rc::new(111);
+ inc_ref_count(&rc, 10);
+ let weak_rc = Rc::downgrade(&rc);
+
+ let arc = Arc::new(222);
+ inc_ref_count(&arc, 20);
+ let weak_arc = Arc::downgrade(&arc);
+
+ let dyn_rc: Rc<dyn Debug> = Rc::new(333);
+ inc_ref_count(&dyn_rc, 30);
+ let dyn_rc_weak = Rc::downgrade(&dyn_rc);
+
+ let slice_rc: Rc<[u32]> = Rc::from(vec![1, 2, 3]);
+ inc_ref_count(&slice_rc, 40);
+ let slice_rc_weak = Rc::downgrade(&slice_rc);
+
+ let dyn_arc: Arc<dyn Debug> = Arc::new(444);
+ inc_ref_count(&dyn_arc, 50);
+ let dyn_arc_weak = Arc::downgrade(&dyn_arc);
+
+ let slice_arc: Arc<[u32]> = Arc::from(vec![4, 5, 6]);
+ inc_ref_count(&slice_arc, 60);
+ let slice_arc_weak = Arc::downgrade(&slice_arc);
+
+ zzz(); // #break
+}
+
+fn inc_ref_count<T: Clone>(rc: &T, count: usize) {
+ for _ in 0..count {
+ std::mem::forget(rc.clone());
+ }
+}
+
+fn zzz() {
+ ()
+}
diff --git a/src/test/debuginfo/recursive-enum.rs b/src/test/debuginfo/recursive-enum.rs
new file mode 100644
index 000000000..a62d4807a
--- /dev/null
+++ b/src/test/debuginfo/recursive-enum.rs
@@ -0,0 +1,23 @@
+// ignore-lldb
+
+// compile-flags:-g
+// gdb-command:run
+
+// Test whether compiling a recursive enum definition crashes debug info generation. The test case
+// is taken from issue #11083.
+
+#![allow(unused_variables)]
+#![feature(omit_gdb_pretty_printer_section)]
+#![omit_gdb_pretty_printer_section]
+
+pub struct Window<'a> {
+ callbacks: WindowCallbacks<'a>
+}
+
+struct WindowCallbacks<'a> {
+ pos_callback: Option<Box<FnMut(&Window, i32, i32) + 'a>>,
+}
+
+fn main() {
+ let x = WindowCallbacks { pos_callback: None };
+}
diff --git a/src/test/debuginfo/recursive-struct.rs b/src/test/debuginfo/recursive-struct.rs
new file mode 100644
index 000000000..eb14af8c5
--- /dev/null
+++ b/src/test/debuginfo/recursive-struct.rs
@@ -0,0 +1,215 @@
+// ignore-lldb
+
+// Require a gdb that can read DW_TAG_variant_part.
+// min-gdb-version: 8.2
+
+// compile-flags:-g
+
+// gdb-command:run
+
+// gdb-command:print stack_unique.value
+// gdb-check:$1 = 0
+// gdbr-command:print stack_unique.next.val.value
+// gdb-check:$2 = 1
+
+// gdbr-command:print unique_unique.value
+// gdb-check:$3 = 2
+// gdbr-command:print unique_unique.next.val.value
+// gdb-check:$4 = 3
+
+// gdb-command:print vec_unique[0].value
+// gdb-check:$5 = 6.5
+// gdbr-command:print vec_unique[0].next.val.value
+// gdb-check:$6 = 7.5
+
+// gdbr-command:print borrowed_unique.value
+// gdb-check:$7 = 8.5
+// gdbr-command:print borrowed_unique.next.val.value
+// gdb-check:$8 = 9.5
+
+// LONG CYCLE
+// gdb-command:print long_cycle1.value
+// gdb-check:$9 = 20
+// gdbr-command:print long_cycle1.next.value
+// gdb-check:$10 = 21
+// gdbr-command:print long_cycle1.next.next.value
+// gdb-check:$11 = 22
+// gdbr-command:print long_cycle1.next.next.next.value
+// gdb-check:$12 = 23
+
+// gdb-command:print long_cycle2.value
+// gdb-check:$13 = 24
+// gdbr-command:print long_cycle2.next.value
+// gdb-check:$14 = 25
+// gdbr-command:print long_cycle2.next.next.value
+// gdb-check:$15 = 26
+
+// gdb-command:print long_cycle3.value
+// gdb-check:$16 = 27
+// gdbr-command:print long_cycle3.next.value
+// gdb-check:$17 = 28
+
+// gdb-command:print long_cycle4.value
+// gdb-check:$18 = 29.5
+
+// gdbr-command:print long_cycle_w_anon_types.value
+// gdb-check:$19 = 30
+
+// gdbr-command:print long_cycle_w_anon_types.next.val.value
+// gdb-check:$20 = 31
+
+// gdb-command:continue
+
+#![allow(unused_variables)]
+#![feature(omit_gdb_pretty_printer_section)]
+#![omit_gdb_pretty_printer_section]
+
+use self::Opt::{Empty, Val};
+use std::boxed::Box as B;
+
+enum Opt<T> {
+ Empty,
+ Val { val: T }
+}
+
+struct UniqueNode<T> {
+ next: Opt<Box<UniqueNode<T>>>,
+ value: T
+}
+
+struct LongCycle1<T> {
+ next: Box<LongCycle2<T>>,
+ value: T,
+}
+
+struct LongCycle2<T> {
+ next: Box<LongCycle3<T>>,
+ value: T,
+}
+
+struct LongCycle3<T> {
+ next: Box<LongCycle4<T>>,
+ value: T,
+}
+
+struct LongCycle4<T> {
+ next: Option<Box<LongCycle1<T>>>,
+ value: T,
+}
+
+struct LongCycleWithAnonymousTypes {
+ next: Opt<Box<Box<Box<Box<Box<LongCycleWithAnonymousTypes>>>>>>,
+ value: usize,
+}
+
+// This test case makes sure that recursive structs are properly described. The Node structs are
+// generic so that we can have a new type (that newly needs to be described) for the different
+// cases. The potential problem with recursive types is that the DI generation algorithm gets
+// trapped in an endless loop. To make sure, we actually test this in the different cases, we have
+// to operate on a new type each time, otherwise we would just hit the DI cache for all but the
+// first case.
+
+// The different cases below (stack_*, unique_*, box_*, etc) are set up so that the type description
+// algorithm will enter the type reference cycle that is created by a recursive definition from a
+// different context each time.
+
+// The "long cycle" cases are constructed to span a longer, indirect recursion cycle between types.
+// The different locals will cause the DI algorithm to enter the type reference cycle at different
+// points.
+
+fn main() {
+ let stack_unique: UniqueNode<u16> = UniqueNode {
+ next: Val {
+ val: Box::new(UniqueNode {
+ next: Empty,
+ value: 1,
+ })
+ },
+ value: 0,
+ };
+
+ let unique_unique: Box<UniqueNode<u32>> = Box::new(UniqueNode {
+ next: Val {
+ val: Box::new(UniqueNode {
+ next: Empty,
+ value: 3,
+ })
+ },
+ value: 2,
+ });
+
+ let vec_unique: [UniqueNode<f32>; 1] = [UniqueNode {
+ next: Val {
+ val: Box::new(UniqueNode {
+ next: Empty,
+ value: 7.5,
+ })
+ },
+ value: 6.5,
+ }];
+
+ let borrowed_unique: &UniqueNode<f64> = &UniqueNode {
+ next: Val {
+ val: Box::new(UniqueNode {
+ next: Empty,
+ value: 9.5,
+ })
+ },
+ value: 8.5,
+ };
+
+ // LONG CYCLE
+ let long_cycle1: LongCycle1<u16> = LongCycle1 {
+ next: Box::new(LongCycle2 {
+ next: Box::new(LongCycle3 {
+ next: Box::new(LongCycle4 {
+ next: None,
+ value: 23,
+ }),
+ value: 22,
+ }),
+ value: 21
+ }),
+ value: 20
+ };
+
+ let long_cycle2: LongCycle2<u32> = LongCycle2 {
+ next: Box::new(LongCycle3 {
+ next: Box::new(LongCycle4 {
+ next: None,
+ value: 26,
+ }),
+ value: 25,
+ }),
+ value: 24
+ };
+
+ let long_cycle3: LongCycle3<u64> = LongCycle3 {
+ next: Box::new(LongCycle4 {
+ next: None,
+ value: 28,
+ }),
+ value: 27,
+ };
+
+ let long_cycle4: LongCycle4<f32> = LongCycle4 {
+ next: None,
+ value: 29.5,
+ };
+
+ // It's important that LongCycleWithAnonymousTypes is encountered only at the end of the
+ // `box` chain.
+ let long_cycle_w_anon_types = B::new(B::new(B::new(B::new(B::new(LongCycleWithAnonymousTypes {
+ next: Val {
+ val: Box::new(Box::new(Box::new(Box::new(Box::new(LongCycleWithAnonymousTypes {
+ next: Empty,
+ value: 31,
+ })))))
+ },
+ value: 30
+ })))));
+
+ zzz(); // #break
+}
+
+fn zzz() {()}
diff --git a/src/test/debuginfo/result-types.rs b/src/test/debuginfo/result-types.rs
new file mode 100644
index 000000000..c0d905a6a
--- /dev/null
+++ b/src/test/debuginfo/result-types.rs
@@ -0,0 +1,28 @@
+// cdb-only
+// min-cdb-version: 10.0.18317.1001
+// compile-flags:-g
+
+// === CDB TESTS ==================================================================================
+
+// cdb-command: g
+
+// cdb-command: dx x,d
+// cdb-check:x,d : Ok [Type: enum$<core::result::Result<i32,str> >]
+// cdb-check: [...] __0 : -3 [Type: int]
+
+// cdb-command: dx y
+// cdb-check:y : Err [Type: enum$<core::result::Result<i32,str> >]
+// cdb-check: [...] __0 : "Some error message" [Type: str]
+
+fn main()
+{
+ let x: Result<i32, &str> = Ok(-3);
+ assert_eq!(x.is_ok(), true);
+
+ let y: Result<i32, &str> = Err("Some error message");
+ assert_eq!(y.is_ok(), false);
+
+ zzz(); // #break.
+}
+
+fn zzz() { () }
diff --git a/src/test/debuginfo/rwlock-read.rs b/src/test/debuginfo/rwlock-read.rs
new file mode 100644
index 000000000..ed9aae16b
--- /dev/null
+++ b/src/test/debuginfo/rwlock-read.rs
@@ -0,0 +1,32 @@
+// Testing the display of RwLock and RwLockReadGuard in cdb.
+
+// cdb-only
+// min-cdb-version: 10.0.18317.1001
+// compile-flags:-g
+
+// === CDB TESTS ==================================================================================
+//
+// cdb-command:g
+//
+// cdb-command:dx l
+// cdb-check:l [Type: std::sync::rwlock::RwLock<i32>]
+// cdb-check: [...] poison [Type: std::sync::poison::Flag]
+// cdb-check: [...] data : 0 [Type: core::cell::UnsafeCell<i32>]
+//
+// cdb-command:dx r
+// cdb-check:r [Type: std::sync::rwlock::RwLockReadGuard<i32>]
+// cdb-check: [...] data : NonNull([...]: 0) [Type: core::ptr::non_null::NonNull<i32>]
+// cdb-check: [...] inner_lock : [...] [Type: std::sys_common::rwlock::MovableRwLock *]
+
+#[allow(unused_variables)]
+
+use std::sync::RwLock;
+
+fn main()
+{
+ let l = RwLock::new(0);
+ let r = l.read().unwrap();
+ zzz(); // #break
+}
+
+fn zzz() {}
diff --git a/src/test/debuginfo/rwlock-write.rs b/src/test/debuginfo/rwlock-write.rs
new file mode 100644
index 000000000..8decf54c1
--- /dev/null
+++ b/src/test/debuginfo/rwlock-write.rs
@@ -0,0 +1,27 @@
+// Testing the display of RwLockWriteGuard.
+
+// cdb-only
+// min-cdb-version: 10.0.18317.1001
+// compile-flags:-g
+
+// === CDB TESTS ==================================================================================
+//
+// cdb-command:g
+//
+// cdb-command:dx w
+// cdb-check:w [Type: std::sync::rwlock::RwLockWriteGuard<i32>]
+// cdb-check: [...] lock : [...] [Type: std::sync::rwlock::RwLock<i32> *]
+// cdb-check: [...] poison [Type: std::sync::poison::Guard]
+
+#[allow(unused_variables)]
+
+use std::sync::RwLock;
+
+fn main()
+{
+ let l = RwLock::new(0);
+ let w = l.write().unwrap();
+ zzz(); // #break
+}
+
+fn zzz() {}
diff --git a/src/test/debuginfo/self-in-default-method.rs b/src/test/debuginfo/self-in-default-method.rs
new file mode 100644
index 000000000..b8b5add09
--- /dev/null
+++ b/src/test/debuginfo/self-in-default-method.rs
@@ -0,0 +1,162 @@
+// min-lldb-version: 310
+
+// compile-flags:-g
+
+// === GDB TESTS ===================================================================================
+
+// gdb-command:run
+
+// STACK BY REF
+// gdb-command:print *self
+// gdbg-check:$1 = {x = 100}
+// gdbr-check:$1 = self_in_default_method::Struct {x: 100}
+// gdb-command:print arg1
+// gdb-check:$2 = -1
+// gdb-command:print arg2
+// gdb-check:$3 = -2
+// gdb-command:continue
+
+// STACK BY VAL
+// gdb-command:print self
+// gdbg-check:$4 = {x = 100}
+// gdbr-check:$4 = self_in_default_method::Struct {x: 100}
+// gdb-command:print arg1
+// gdb-check:$5 = -3
+// gdb-command:print arg2
+// gdb-check:$6 = -4
+// gdb-command:continue
+
+// OWNED BY REF
+// gdb-command:print *self
+// gdbg-check:$7 = {x = 200}
+// gdbr-check:$7 = self_in_default_method::Struct {x: 200}
+// gdb-command:print arg1
+// gdb-check:$8 = -5
+// gdb-command:print arg2
+// gdb-check:$9 = -6
+// gdb-command:continue
+
+// OWNED BY VAL
+// gdb-command:print self
+// gdbg-check:$10 = {x = 200}
+// gdbr-check:$10 = self_in_default_method::Struct {x: 200}
+// gdb-command:print arg1
+// gdb-check:$11 = -7
+// gdb-command:print arg2
+// gdb-check:$12 = -8
+// gdb-command:continue
+
+// OWNED MOVED
+// gdb-command:print *self
+// gdbg-check:$13 = {x = 200}
+// gdbr-check:$13 = self_in_default_method::Struct {x: 200}
+// gdb-command:print arg1
+// gdb-check:$14 = -9
+// gdb-command:print arg2
+// gdb-check:$15 = -10
+// gdb-command:continue
+
+
+// === LLDB TESTS ==================================================================================
+
+// lldb-command:run
+
+// STACK BY REF
+// lldb-command:print *self
+// lldbg-check:[...]$0 = { x = 100 }
+// lldbr-check:(self_in_default_method::Struct) *self = Struct { x: 100 }
+// lldb-command:print arg1
+// lldbg-check:[...]$1 = -1
+// lldbr-check:(isize) arg1 = -1
+// lldb-command:print arg2
+// lldbg-check:[...]$2 = -2
+// lldbr-check:(isize) arg2 = -2
+// lldb-command:continue
+
+// STACK BY VAL
+// lldb-command:print self
+// lldbg-check:[...]$3 = { x = 100 }
+// lldbr-check:(self_in_default_method::Struct) self = Struct { x: 100 }
+// lldb-command:print arg1
+// lldbg-check:[...]$4 = -3
+// lldbr-check:(isize) arg1 = -3
+// lldb-command:print arg2
+// lldbg-check:[...]$5 = -4
+// lldbr-check:(isize) arg2 = -4
+// lldb-command:continue
+
+// OWNED BY REF
+// lldb-command:print *self
+// lldbg-check:[...]$6 = { x = 200 }
+// lldbr-check:(self_in_default_method::Struct) *self = Struct { x: 200 }
+// lldb-command:print arg1
+// lldbg-check:[...]$7 = -5
+// lldbr-check:(isize) arg1 = -5
+// lldb-command:print arg2
+// lldbg-check:[...]$8 = -6
+// lldbr-check:(isize) arg2 = -6
+// lldb-command:continue
+
+// OWNED BY VAL
+// lldb-command:print self
+// lldbg-check:[...]$9 = { x = 200 }
+// lldbr-check:(self_in_default_method::Struct) self = Struct { x: 200 }
+// lldb-command:print arg1
+// lldbg-check:[...]$10 = -7
+// lldbr-check:(isize) arg1 = -7
+// lldb-command:print arg2
+// lldbg-check:[...]$11 = -8
+// lldbr-check:(isize) arg2 = -8
+// lldb-command:continue
+
+// OWNED MOVED
+// lldb-command:print *self
+// lldbg-check:[...]$12 = { x = 200 }
+// lldbr-check:(self_in_default_method::Struct) *self = Struct { x: 200 }
+// lldb-command:print arg1
+// lldbg-check:[...]$13 = -9
+// lldbr-check:(isize) arg1 = -9
+// lldb-command:print arg2
+// lldbg-check:[...]$14 = -10
+// lldbr-check:(isize) arg2 = -10
+// lldb-command:continue
+
+#![feature(omit_gdb_pretty_printer_section)]
+#![omit_gdb_pretty_printer_section]
+
+#[derive(Copy, Clone)]
+struct Struct {
+ x: isize
+}
+
+trait Trait : Sized {
+ fn self_by_ref(&self, arg1: isize, arg2: isize) -> isize {
+ zzz(); // #break
+ arg1 + arg2
+ }
+
+ fn self_by_val(self, arg1: isize, arg2: isize) -> isize {
+ zzz(); // #break
+ arg1 + arg2
+ }
+
+ fn self_owned(self: Box<Self>, arg1: isize, arg2: isize) -> isize {
+ zzz(); // #break
+ arg1 + arg2
+ }
+}
+
+impl Trait for Struct {}
+
+fn main() {
+ let stack = Struct { x: 100 };
+ let _ = stack.self_by_ref(-1, -2);
+ let _ = stack.self_by_val(-3, -4);
+
+ let owned: Box<_> = Box::new(Struct { x: 200 });
+ let _ = owned.self_by_ref(-5, -6);
+ let _ = owned.self_by_val(-7, -8);
+ let _ = owned.self_owned(-9, -10);
+}
+
+fn zzz() {()}
diff --git a/src/test/debuginfo/self-in-generic-default-method.rs b/src/test/debuginfo/self-in-generic-default-method.rs
new file mode 100644
index 000000000..efce449e3
--- /dev/null
+++ b/src/test/debuginfo/self-in-generic-default-method.rs
@@ -0,0 +1,163 @@
+// min-lldb-version: 310
+
+// compile-flags:-g
+
+// === GDB TESTS ===================================================================================
+
+// gdb-command:run
+
+// STACK BY REF
+// gdb-command:print *self
+// gdbg-check:$1 = {x = 987}
+// gdbr-check:$1 = self_in_generic_default_method::Struct {x: 987}
+// gdb-command:print arg1
+// gdb-check:$2 = -1
+// gdb-command:print arg2
+// gdb-check:$3 = 2
+// gdb-command:continue
+
+// STACK BY VAL
+// gdb-command:print self
+// gdbg-check:$4 = {x = 987}
+// gdbr-check:$4 = self_in_generic_default_method::Struct {x: 987}
+// gdb-command:print arg1
+// gdb-check:$5 = -3
+// gdb-command:print arg2
+// gdb-check:$6 = -4
+// gdb-command:continue
+
+// OWNED BY REF
+// gdb-command:print *self
+// gdbg-check:$7 = {x = 879}
+// gdbr-check:$7 = self_in_generic_default_method::Struct {x: 879}
+// gdb-command:print arg1
+// gdb-check:$8 = -5
+// gdb-command:print arg2
+// gdb-check:$9 = -6
+// gdb-command:continue
+
+// OWNED BY VAL
+// gdb-command:print self
+// gdbg-check:$10 = {x = 879}
+// gdbr-check:$10 = self_in_generic_default_method::Struct {x: 879}
+// gdb-command:print arg1
+// gdb-check:$11 = -7
+// gdb-command:print arg2
+// gdb-check:$12 = -8
+// gdb-command:continue
+
+// OWNED MOVED
+// gdb-command:print *self
+// gdbg-check:$13 = {x = 879}
+// gdbr-check:$13 = self_in_generic_default_method::Struct {x: 879}
+// gdb-command:print arg1
+// gdb-check:$14 = -9
+// gdb-command:print arg2
+// gdb-check:$15 = -10.5
+// gdb-command:continue
+
+
+// === LLDB TESTS ==================================================================================
+
+// lldb-command:run
+
+// STACK BY REF
+// lldb-command:print *self
+// lldbg-check:[...]$0 = { x = 987 }
+// lldbr-check:(self_in_generic_default_method::Struct) *self = Struct { x: 987 }
+// lldb-command:print arg1
+// lldbg-check:[...]$1 = -1
+// lldbr-check:(isize) arg1 = -1
+// lldb-command:print arg2
+// lldbg-check:[...]$2 = 2
+// lldbr-check:(u16) arg2 = 2
+// lldb-command:continue
+
+// STACK BY VAL
+// lldb-command:print self
+// lldbg-check:[...]$3 = { x = 987 }
+// lldbr-check:(self_in_generic_default_method::Struct) self = Struct { x: 987 }
+// lldb-command:print arg1
+// lldbg-check:[...]$4 = -3
+// lldbr-check:(isize) arg1 = -3
+// lldb-command:print arg2
+// lldbg-check:[...]$5 = -4
+// lldbr-check:(i16) arg2 = -4
+// lldb-command:continue
+
+// OWNED BY REF
+// lldb-command:print *self
+// lldbg-check:[...]$6 = { x = 879 }
+// lldbr-check:(self_in_generic_default_method::Struct) *self = Struct { x: 879 }
+// lldb-command:print arg1
+// lldbg-check:[...]$7 = -5
+// lldbr-check:(isize) arg1 = -5
+// lldb-command:print arg2
+// lldbg-check:[...]$8 = -6
+// lldbr-check:(i32) arg2 = -6
+// lldb-command:continue
+
+// OWNED BY VAL
+// lldb-command:print self
+// lldbg-check:[...]$9 = { x = 879 }
+// lldbr-check:(self_in_generic_default_method::Struct) self = Struct { x: 879 }
+// lldb-command:print arg1
+// lldbg-check:[...]$10 = -7
+// lldbr-check:(isize) arg1 = -7
+// lldb-command:print arg2
+// lldbg-check:[...]$11 = -8
+// lldbr-check:(i64) arg2 = -8
+// lldb-command:continue
+
+// OWNED MOVED
+// lldb-command:print *self
+// lldbg-check:[...]$12 = { x = 879 }
+// lldbr-check:(self_in_generic_default_method::Struct) *self = Struct { x: 879 }
+// lldb-command:print arg1
+// lldbg-check:[...]$13 = -9
+// lldbr-check:(isize) arg1 = -9
+// lldb-command:print arg2
+// lldbg-check:[...]$14 = -10.5
+// lldbr-check:(f32) arg2 = -10.5
+// lldb-command:continue
+
+#![feature(omit_gdb_pretty_printer_section)]
+#![omit_gdb_pretty_printer_section]
+
+#[derive(Copy, Clone)]
+struct Struct {
+ x: isize
+}
+
+trait Trait : Sized {
+
+ fn self_by_ref<T>(&self, arg1: isize, arg2: T) -> isize {
+ zzz(); // #break
+ arg1
+ }
+
+ fn self_by_val<T>(self, arg1: isize, arg2: T) -> isize {
+ zzz(); // #break
+ arg1
+ }
+
+ fn self_owned<T>(self: Box<Self>, arg1: isize, arg2: T) -> isize {
+ zzz(); // #break
+ arg1
+ }
+}
+
+impl Trait for Struct {}
+
+fn main() {
+ let stack = Struct { x: 987 };
+ let _ = stack.self_by_ref(-1, 2_u16);
+ let _ = stack.self_by_val(-3, -4_i16);
+
+ let owned: Box<_> = Box::new(Struct { x: 879 });
+ let _ = owned.self_by_ref(-5, -6_i32);
+ let _ = owned.self_by_val(-7, -8_i64);
+ let _ = owned.self_owned(-9, -10.5_f32);
+}
+
+fn zzz() {()}
diff --git a/src/test/debuginfo/shadowed-argument.rs b/src/test/debuginfo/shadowed-argument.rs
new file mode 100644
index 000000000..0835273ac
--- /dev/null
+++ b/src/test/debuginfo/shadowed-argument.rs
@@ -0,0 +1,81 @@
+// min-lldb-version: 310
+
+// compile-flags:-g
+
+// === GDB TESTS ===================================================================================
+
+// gdb-command:run
+
+// gdb-command:print x
+// gdb-check:$1 = false
+// gdb-command:print y
+// gdb-check:$2 = true
+// gdb-command:continue
+
+// gdb-command:print x
+// gdb-check:$3 = 10
+// gdb-command:print y
+// gdb-check:$4 = true
+// gdb-command:continue
+
+// gdb-command:print x
+// gdb-check:$5 = 10.5
+// gdb-command:print y
+// gdb-check:$6 = 20
+// gdb-command:continue
+
+
+// === LLDB TESTS ==================================================================================
+
+// lldb-command:run
+
+// lldb-command:print x
+// lldbg-check:[...]$0 = false
+// lldbr-check:(bool) x = false
+// lldb-command:print y
+// lldbg-check:[...]$1 = true
+// lldbr-check:(bool) y = true
+// lldb-command:continue
+
+// lldb-command:print x
+// lldbg-check:[...]$2 = 10
+// lldbr-check:(i32) x = 10
+// lldb-command:print y
+// lldbg-check:[...]$3 = true
+// lldbr-check:(bool) y = true
+// lldb-command:continue
+
+// lldb-command:print x
+// lldbg-check:[...]$4 = 10.5
+// lldbr-check:(f64) x = 10.5
+// lldb-command:print y
+// lldbg-check:[...]$5 = 20
+// lldbr-check:(i32) y = 20
+// lldb-command:continue
+
+
+#![feature(omit_gdb_pretty_printer_section)]
+#![omit_gdb_pretty_printer_section]
+
+fn a_function(x: bool, y: bool) {
+ zzz(); // #break
+ sentinel();
+
+ let x = 10;
+
+ zzz(); // #break
+ sentinel();
+
+ let x = 10.5f64;
+ let y = 20;
+
+ zzz(); // #break
+ sentinel();
+}
+
+fn main() {
+ a_function(false, true);
+}
+
+fn zzz() {()}
+fn sentinel() {()}
diff --git a/src/test/debuginfo/shadowed-variable.rs b/src/test/debuginfo/shadowed-variable.rs
new file mode 100644
index 000000000..9f060811f
--- /dev/null
+++ b/src/test/debuginfo/shadowed-variable.rs
@@ -0,0 +1,114 @@
+// min-lldb-version: 310
+// compile-flags:-g
+
+// === GDB TESTS ===================================================================================
+
+// gdb-command:run
+
+// gdb-command:print x
+// gdb-check:$1 = false
+// gdb-command:print y
+// gdb-check:$2 = true
+// gdb-command:continue
+
+// gdb-command:print x
+// gdb-check:$3 = 10
+// gdb-command:print y
+// gdb-check:$4 = true
+// gdb-command:continue
+
+// gdb-command:print x
+// gdb-check:$5 = 10.5
+// gdb-command:print y
+// gdb-check:$6 = 20
+// gdb-command:continue
+
+// gdb-command:print x
+// gdb-check:$7 = 10.5
+// gdb-command:print y
+// gdb-check:$8 = 20
+// gdb-command:continue
+
+// gdb-command:print x
+// gdb-check:$9 = 11.5
+// gdb-command:print y
+// gdb-check:$10 = 20
+// gdb-command:continue
+
+// === LLDB TESTS ==================================================================================
+
+// lldb-command:run
+
+// lldb-command:print x
+// lldbg-check:[...]$0 = false
+// lldbr-check:(bool) x = false
+// lldb-command:print y
+// lldbg-check:[...]$1 = true
+// lldbr-check:(bool) y = true
+// lldb-command:continue
+
+// lldb-command:print x
+// lldbg-check:[...]$2 = 10
+// lldbr-check:(i32) x = 10
+// lldb-command:print y
+// lldbg-check:[...]$3 = true
+// lldbr-check:(bool) y = true
+// lldb-command:continue
+
+// lldb-command:print x
+// lldbg-check:[...]$4 = 10.5
+// lldbr-check:(f64) x = 10.5
+// lldb-command:print y
+// lldbg-check:[...]$5 = 20
+// lldbr-check:(i32) y = 20
+// lldb-command:continue
+
+// lldb-command:print x
+// lldbg-check:[...]$6 = 10.5
+// lldbr-check:(f64) x = 10.5
+// lldb-command:print y
+// lldbg-check:[...]$7 = 20
+// lldbr-check:(i32) y = 20
+// lldb-command:continue
+
+// lldb-command:print x
+// lldbg-check:[...]$8 = 11.5
+// lldbr-check:(f64) x = 11.5
+// lldb-command:print y
+// lldbg-check:[...]$9 = 20
+// lldbr-check:(i32) y = 20
+// lldb-command:continue
+
+#![feature(omit_gdb_pretty_printer_section)]
+#![omit_gdb_pretty_printer_section]
+
+fn main() {
+ let x = false;
+ let y = true;
+
+ zzz(); // #break
+ sentinel();
+
+ let x = 10;
+
+ zzz(); // #break
+ sentinel();
+
+ let x = 10.5f64;
+ let y = 20;
+
+ zzz(); // #break
+ sentinel();
+
+ let x = {
+ zzz(); // #break
+ sentinel();
+ 11.5
+ };
+
+ zzz(); // #break
+ sentinel()
+}
+
+fn zzz() {()}
+fn sentinel() {()}
diff --git a/src/test/debuginfo/should-fail.rs b/src/test/debuginfo/should-fail.rs
new file mode 100644
index 000000000..eef6d99d2
--- /dev/null
+++ b/src/test/debuginfo/should-fail.rs
@@ -0,0 +1,35 @@
+// min-lldb-version: 310
+
+// == Test [gdb|lldb]-[command|check] are parsed correctly ===
+// should-fail
+// needs-run-enabled
+// compile-flags:-g
+
+// === GDB TESTS ===================================================================================
+
+// gdb-command: run
+
+// gdb-command: print x
+// gdb-check:$1 = 5
+
+// === LLDB TESTS ==================================================================================
+
+// lldb-command:run
+
+// lldb-command:print x
+// lldb-check:[...]$0 = 5
+
+// === CDB TESTS ==================================================================================
+
+// cdb-command:g
+
+// cdb-command:dx x
+// cdb-check:string [...] : 5 [Type: [...]]
+
+fn main() {
+ let x = 1;
+
+ zzz(); // #break
+}
+
+fn zzz() {()}
diff --git a/src/test/debuginfo/simd.rs b/src/test/debuginfo/simd.rs
new file mode 100644
index 000000000..b7bfe44b6
--- /dev/null
+++ b/src/test/debuginfo/simd.rs
@@ -0,0 +1,103 @@
+// Need a fix for LLDB first...
+// ignore-lldb
+
+// FIXME: LLVM generates invalid debug info for variables requiring
+// dynamic stack realignment, which is the case on s390x for vector
+// types with non-vector ABI.
+// ignore-s390x
+
+// compile-flags:-g
+// gdb-command:run
+
+// gdbg-command:print/d vi8x16
+// gdbr-command:print vi8x16
+// gdbg-check:$1 = {__0 = 0, __1 = 1, __2 = 2, __3 = 3, __4 = 4, __5 = 5, __6 = 6, __7 = 7, __8 = 8, __9 = 9, __10 = 10, __11 = 11, __12 = 12, __13 = 13, __14 = 14, __15 = 15}
+// gdbr-check:$1 = simd::i8x16 (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15)
+// gdbg-command:print/d vi16x8
+// gdbr-command:print vi16x8
+// gdbg-check:$2 = {__0 = 16, __1 = 17, __2 = 18, __3 = 19, __4 = 20, __5 = 21, __6 = 22, __7 = 23}
+// gdbr-check:$2 = simd::i16x8 (16, 17, 18, 19, 20, 21, 22, 23)
+// gdbg-command:print/d vi32x4
+// gdbr-command:print vi32x4
+// gdbg-check:$3 = {__0 = 24, __1 = 25, __2 = 26, __3 = 27}
+// gdbr-check:$3 = simd::i32x4 (24, 25, 26, 27)
+// gdbg-command:print/d vi64x2
+// gdbr-command:print vi64x2
+// gdbg-check:$4 = {__0 = 28, __1 = 29}
+// gdbr-check:$4 = simd::i64x2 (28, 29)
+
+// gdbg-command:print/d vu8x16
+// gdbr-command:print vu8x16
+// gdbg-check:$5 = {__0 = 30, __1 = 31, __2 = 32, __3 = 33, __4 = 34, __5 = 35, __6 = 36, __7 = 37, __8 = 38, __9 = 39, __10 = 40, __11 = 41, __12 = 42, __13 = 43, __14 = 44, __15 = 45}
+// gdbr-check:$5 = simd::u8x16 (30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45)
+// gdbg-command:print/d vu16x8
+// gdbr-command:print vu16x8
+// gdbg-check:$6 = {__0 = 46, __1 = 47, __2 = 48, __3 = 49, __4 = 50, __5 = 51, __6 = 52, __7 = 53}
+// gdbr-check:$6 = simd::u16x8 (46, 47, 48, 49, 50, 51, 52, 53)
+// gdbg-command:print/d vu32x4
+// gdbr-command:print vu32x4
+// gdbg-check:$7 = {__0 = 54, __1 = 55, __2 = 56, __3 = 57}
+// gdbr-check:$7 = simd::u32x4 (54, 55, 56, 57)
+// gdbg-command:print/d vu64x2
+// gdbr-command:print vu64x2
+// gdbg-check:$8 = {__0 = 58, __1 = 59}
+// gdbr-check:$8 = simd::u64x2 (58, 59)
+
+// gdb-command:print vf32x4
+// gdbg-check:$9 = {__0 = 60.5, __1 = 61.5, __2 = 62.5, __3 = 63.5}
+// gdbr-check:$9 = simd::f32x4 (60.5, 61.5, 62.5, 63.5)
+// gdb-command:print vf64x2
+// gdbg-check:$10 = {__0 = 64.5, __1 = 65.5}
+// gdbr-check:$10 = simd::f64x2 (64.5, 65.5)
+
+// gdb-command:continue
+
+#![allow(unused_variables)]
+#![feature(omit_gdb_pretty_printer_section)]
+#![omit_gdb_pretty_printer_section]
+#![feature(repr_simd)]
+
+#[repr(simd)]
+struct i8x16(i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8);
+#[repr(simd)]
+struct i16x8(i16, i16, i16, i16, i16, i16, i16, i16);
+#[repr(simd)]
+struct i32x4(i32, i32, i32, i32);
+#[repr(simd)]
+struct i64x2(i64, i64);
+#[repr(simd)]
+struct u8x16(u8, u8, u8, u8, u8, u8, u8, u8, u8, u8, u8, u8, u8, u8, u8, u8);
+#[repr(simd)]
+struct u16x8(u16, u16, u16, u16, u16, u16, u16, u16);
+#[repr(simd)]
+struct u32x4(u32, u32, u32, u32);
+#[repr(simd)]
+struct u64x2(u64, u64);
+#[repr(simd)]
+struct f32x4(f32, f32, f32, f32);
+#[repr(simd)]
+struct f64x2(f64, f64);
+
+fn main() {
+
+ let vi8x16 = i8x16(0, 1, 2, 3, 4, 5, 6, 7,
+ 8, 9, 10, 11, 12, 13, 14, 15);
+
+ let vi16x8 = i16x8(16, 17, 18, 19, 20, 21, 22, 23);
+ let vi32x4 = i32x4(24, 25, 26, 27);
+ let vi64x2 = i64x2(28, 29);
+
+ let vu8x16 = u8x16(30, 31, 32, 33, 34, 35, 36, 37,
+ 38, 39, 40, 41, 42, 43, 44, 45);
+ let vu16x8 = u16x8(46, 47, 48, 49, 50, 51, 52, 53);
+ let vu32x4 = u32x4(54, 55, 56, 57);
+ let vu64x2 = u64x2(58, 59);
+
+ let vf32x4 = f32x4(60.5f32, 61.5f32, 62.5f32, 63.5f32);
+ let vf64x2 = f64x2(64.5f64, 65.5f64);
+
+ zzz(); // #break
+}
+
+#[inline(never)]
+fn zzz() { () }
diff --git a/src/test/debuginfo/simple-lexical-scope.rs b/src/test/debuginfo/simple-lexical-scope.rs
new file mode 100644
index 000000000..01db79e1e
--- /dev/null
+++ b/src/test/debuginfo/simple-lexical-scope.rs
@@ -0,0 +1,115 @@
+// min-lldb-version: 310
+
+// compile-flags:-g
+
+// === GDB TESTS ===================================================================================
+
+// gdb-command:run
+
+// gdb-command:print x
+// gdb-check:$1 = false
+// gdb-command:continue
+
+// gdb-command:print x
+// gdb-check:$2 = false
+// gdb-command:continue
+
+// gdb-command:print x
+// gdb-check:$3 = 10
+// gdb-command:continue
+
+// gdb-command:print x
+// gdb-check:$4 = 10
+// gdb-command:continue
+
+// gdb-command:print x
+// gdb-check:$5 = 10.5
+// gdb-command:continue
+
+// gdb-command:print x
+// gdb-check:$6 = 10
+// gdb-command:continue
+
+// gdb-command:print x
+// gdb-check:$7 = false
+// gdb-command:continue
+
+
+// === LLDB TESTS ==================================================================================
+
+// lldb-command:run
+
+// lldb-command:print x
+// lldbg-check:[...]$0 = false
+// lldbr-check:(bool) x = false
+// lldb-command:continue
+
+// lldb-command:print x
+// lldbg-check:[...]$1 = false
+// lldbr-check:(bool) x = false
+// lldb-command:continue
+
+// lldb-command:print x
+// lldbg-check:[...]$2 = 10
+// lldbr-check:(i32) x = 10
+// lldb-command:continue
+
+// lldb-command:print x
+// lldbg-check:[...]$3 = 10
+// lldbr-check:(i32) x = 10
+// lldb-command:continue
+
+// lldb-command:print x
+// lldbg-check:[...]$4 = 10.5
+// lldbr-check:(f64) x = 10.5
+// lldb-command:continue
+
+// lldb-command:print x
+// lldbg-check:[...]$5 = 10
+// lldbr-check:(i32) x = 10
+// lldb-command:continue
+
+// lldb-command:print x
+// lldbg-check:[...]$6 = false
+// lldbr-check:(bool) x = false
+// lldb-command:continue
+
+
+#![feature(omit_gdb_pretty_printer_section)]
+#![omit_gdb_pretty_printer_section]
+
+fn main() {
+ let x = false;
+
+ zzz(); // #break
+ sentinel();
+
+ {
+ zzz(); // #break
+ sentinel();
+
+ let x = 10;
+
+ zzz(); // #break
+ sentinel();
+
+ {
+ zzz(); // #break
+ sentinel();
+
+ let x = 10.5f64;
+
+ zzz(); // #break
+ sentinel();
+ }
+
+ zzz(); // #break
+ sentinel();
+ }
+
+ zzz(); // #break
+ sentinel();
+}
+
+fn zzz() {()}
+fn sentinel() {()}
diff --git a/src/test/debuginfo/simple-struct.rs b/src/test/debuginfo/simple-struct.rs
new file mode 100644
index 000000000..aa3cf023a
--- /dev/null
+++ b/src/test/debuginfo/simple-struct.rs
@@ -0,0 +1,233 @@
+// min-lldb-version: 310
+// ignore-gdb // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155
+
+// compile-flags:-g
+
+// === GDB TESTS ===================================================================================
+
+// gdbg-command:print 'simple_struct::NO_PADDING_16'
+// gdbr-command:print simple_struct::NO_PADDING_16
+// gdbg-check:$1 = {x = 1000, y = -1001}
+// gdbr-check:$1 = simple_struct::NoPadding16 {x: 1000, y: -1001}
+
+// gdbg-command:print 'simple_struct::NO_PADDING_32'
+// gdbr-command:print simple_struct::NO_PADDING_32
+// gdbg-check:$2 = {x = 1, y = 2, z = 3}
+// gdbr-check:$2 = simple_struct::NoPadding32 {x: 1, y: 2, z: 3}
+
+// gdbg-command:print 'simple_struct::NO_PADDING_64'
+// gdbr-command:print simple_struct::NO_PADDING_64
+// gdbg-check:$3 = {x = 4, y = 5, z = 6}
+// gdbr-check:$3 = simple_struct::NoPadding64 {x: 4, y: 5, z: 6}
+
+// gdbg-command:print 'simple_struct::NO_PADDING_163264'
+// gdbr-command:print simple_struct::NO_PADDING_163264
+// gdbg-check:$4 = {a = 7, b = 8, c = 9, d = 10}
+// gdbr-check:$4 = simple_struct::NoPadding163264 {a: 7, b: 8, c: 9, d: 10}
+
+// gdbg-command:print 'simple_struct::INTERNAL_PADDING'
+// gdbr-command:print simple_struct::INTERNAL_PADDING
+// gdbg-check:$5 = {x = 11, y = 12}
+// gdbr-check:$5 = simple_struct::InternalPadding {x: 11, y: 12}
+
+// gdbg-command:print 'simple_struct::PADDING_AT_END'
+// gdbr-command:print simple_struct::PADDING_AT_END
+// gdbg-check:$6 = {x = 13, y = 14}
+// gdbr-check:$6 = simple_struct::PaddingAtEnd {x: 13, y: 14}
+
+// gdb-command:run
+
+// gdb-command:print no_padding16
+// gdbg-check:$7 = {x = 10000, y = -10001}
+// gdbr-check:$7 = simple_struct::NoPadding16 {x: 10000, y: -10001}
+
+// gdb-command:print no_padding32
+// gdbg-check:$8 = {x = -10002, y = -10003.5, z = 10004}
+// gdbr-check:$8 = simple_struct::NoPadding32 {x: -10002, y: -10003.5, z: 10004}
+
+// gdb-command:print no_padding64
+// gdbg-check:$9 = {x = -10005.5, y = 10006, z = 10007}
+// gdbr-check:$9 = simple_struct::NoPadding64 {x: -10005.5, y: 10006, z: 10007}
+
+// gdb-command:print no_padding163264
+// gdbg-check:$10 = {a = -10008, b = 10009, c = 10010, d = 10011}
+// gdbr-check:$10 = simple_struct::NoPadding163264 {a: -10008, b: 10009, c: 10010, d: 10011}
+
+// gdb-command:print internal_padding
+// gdbg-check:$11 = {x = 10012, y = -10013}
+// gdbr-check:$11 = simple_struct::InternalPadding {x: 10012, y: -10013}
+
+// gdb-command:print padding_at_end
+// gdbg-check:$12 = {x = -10014, y = 10015}
+// gdbr-check:$12 = simple_struct::PaddingAtEnd {x: -10014, y: 10015}
+
+// gdbg-command:print 'simple_struct::NO_PADDING_16'
+// gdbr-command:print simple_struct::NO_PADDING_16
+// gdbg-check:$13 = {x = 100, y = -101}
+// gdbr-check:$13 = simple_struct::NoPadding16 {x: 100, y: -101}
+
+// gdbg-command:print 'simple_struct::NO_PADDING_32'
+// gdbr-command:print simple_struct::NO_PADDING_32
+// gdbg-check:$14 = {x = -15, y = -16, z = 17}
+// gdbr-check:$14 = simple_struct::NoPadding32 {x: -15, y: -16, z: 17}
+
+// gdbg-command:print 'simple_struct::NO_PADDING_64'
+// gdbr-command:print simple_struct::NO_PADDING_64
+// gdbg-check:$15 = {x = -18, y = 19, z = 20}
+// gdbr-check:$15 = simple_struct::NoPadding64 {x: -18, y: 19, z: 20}
+
+// gdbg-command:print 'simple_struct::NO_PADDING_163264'
+// gdbr-command:print simple_struct::NO_PADDING_163264
+// gdbg-check:$16 = {a = -21, b = 22, c = 23, d = 24}
+// gdbr-check:$16 = simple_struct::NoPadding163264 {a: -21, b: 22, c: 23, d: 24}
+
+// gdbg-command:print 'simple_struct::INTERNAL_PADDING'
+// gdbr-command:print simple_struct::INTERNAL_PADDING
+// gdbg-check:$17 = {x = 25, y = -26}
+// gdbr-check:$17 = simple_struct::InternalPadding {x: 25, y: -26}
+
+// gdbg-command:print 'simple_struct::PADDING_AT_END'
+// gdbr-command:print simple_struct::PADDING_AT_END
+// gdbg-check:$18 = {x = -27, y = 28}
+// gdbr-check:$18 = simple_struct::PaddingAtEnd {x: -27, y: 28}
+
+// gdb-command:continue
+
+// === LLDB TESTS ==================================================================================
+
+// lldb-command:run
+
+// lldb-command:print no_padding16
+// lldbg-check:[...]$0 = { x = 10000 y = -10001 }
+// lldbr-check:(simple_struct::NoPadding16) no_padding16 = { x = 10000 y = -10001 }
+
+// lldb-command:print no_padding32
+// lldbg-check:[...]$1 = { x = -10002 y = -10003.5 z = 10004 }
+// lldbr-check:(simple_struct::NoPadding32) no_padding32 = { x = -10002 y = -10003.5 z = 10004 }
+
+// lldb-command:print no_padding64
+// lldbg-check:[...]$2 = { x = -10005.5 y = 10006 z = 10007 }
+// lldbr-check:(simple_struct::NoPadding64) no_padding64 = { x = -10005.5 y = 10006 z = 10007 }
+
+// lldb-command:print no_padding163264
+// lldbg-check:[...]$3 = { a = -10008 b = 10009 c = 10010 d = 10011 }
+// lldbr-check:(simple_struct::NoPadding163264) no_padding163264 = { a = -10008 b = 10009 c = 10010 d = 10011 }
+
+// lldb-command:print internal_padding
+// lldbg-check:[...]$4 = { x = 10012 y = -10013 }
+// lldbr-check:(simple_struct::InternalPadding) internal_padding = { x = 10012 y = -10013 }
+
+// lldb-command:print padding_at_end
+// lldbg-check:[...]$5 = { x = -10014 y = 10015 }
+// lldbr-check:(simple_struct::PaddingAtEnd) padding_at_end = { x = -10014 y = 10015 }
+
+#![allow(unused_variables)]
+#![allow(dead_code)]
+#![feature(omit_gdb_pretty_printer_section)]
+#![omit_gdb_pretty_printer_section]
+
+struct NoPadding16 {
+ x: u16,
+ y: i16
+}
+
+struct NoPadding32 {
+ x: i32,
+ y: f32,
+ z: u32
+}
+
+struct NoPadding64 {
+ x: f64,
+ y: i64,
+ z: u64
+}
+
+struct NoPadding163264 {
+ a: i16,
+ b: u16,
+ c: i32,
+ d: u64
+}
+
+struct InternalPadding {
+ x: u16,
+ y: i64
+}
+
+struct PaddingAtEnd {
+ x: i64,
+ y: u16
+}
+
+static mut NO_PADDING_16: NoPadding16 = NoPadding16 {
+ x: 1000,
+ y: -1001
+};
+
+static mut NO_PADDING_32: NoPadding32 = NoPadding32 {
+ x: 1,
+ y: 2.0,
+ z: 3
+};
+
+static mut NO_PADDING_64: NoPadding64 = NoPadding64 {
+ x: 4.0,
+ y: 5,
+ z: 6
+};
+
+static mut NO_PADDING_163264: NoPadding163264 = NoPadding163264 {
+ a: 7,
+ b: 8,
+ c: 9,
+ d: 10
+};
+
+static mut INTERNAL_PADDING: InternalPadding = InternalPadding {
+ x: 11,
+ y: 12
+};
+
+static mut PADDING_AT_END: PaddingAtEnd = PaddingAtEnd {
+ x: 13,
+ y: 14
+};
+
+fn main() {
+ let no_padding16 = NoPadding16 { x: 10000, y: -10001 };
+ let no_padding32 = NoPadding32 { x: -10002, y: -10003.5, z: 10004 };
+ let no_padding64 = NoPadding64 { x: -10005.5, y: 10006, z: 10007 };
+ let no_padding163264 = NoPadding163264 { a: -10008, b: 10009, c: 10010, d: 10011 };
+
+ let internal_padding = InternalPadding { x: 10012, y: -10013 };
+ let padding_at_end = PaddingAtEnd { x: -10014, y: 10015 };
+
+ unsafe {
+ NO_PADDING_16.x = 100;
+ NO_PADDING_16.y = -101;
+
+ NO_PADDING_32.x = -15;
+ NO_PADDING_32.y = -16.0;
+ NO_PADDING_32.z = 17;
+
+ NO_PADDING_64.x = -18.0;
+ NO_PADDING_64.y = 19;
+ NO_PADDING_64.z = 20;
+
+ NO_PADDING_163264.a = -21;
+ NO_PADDING_163264.b = 22;
+ NO_PADDING_163264.c = 23;
+ NO_PADDING_163264.d = 24;
+
+ INTERNAL_PADDING.x = 25;
+ INTERNAL_PADDING.y = -26;
+
+ PADDING_AT_END.x = -27;
+ PADDING_AT_END.y = 28;
+ }
+
+ zzz(); // #break
+}
+
+fn zzz() {()}
diff --git a/src/test/debuginfo/simple-tuple.rs b/src/test/debuginfo/simple-tuple.rs
new file mode 100644
index 000000000..0807cfedc
--- /dev/null
+++ b/src/test/debuginfo/simple-tuple.rs
@@ -0,0 +1,211 @@
+// min-lldb-version: 310
+// ignore-gdb // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155
+
+// compile-flags:-g
+
+// === GDB TESTS ===================================================================================
+
+// gdbg-command:print/d 'simple_tuple::NO_PADDING_8'
+// gdbr-command:print simple_tuple::NO_PADDING_8
+// gdbg-check:$1 = {__0 = -50, __1 = 50}
+// gdbr-check:$1 = (-50, 50)
+// gdbg-command:print 'simple_tuple::NO_PADDING_16'
+// gdbr-command:print simple_tuple::NO_PADDING_16
+// gdbg-check:$2 = {__0 = -1, __1 = 2, __2 = 3}
+// gdbr-check:$2 = (-1, 2, 3)
+// gdbg-command:print 'simple_tuple::NO_PADDING_32'
+// gdbr-command:print simple_tuple::NO_PADDING_32
+// gdbg-check:$3 = {__0 = 4, __1 = 5, __2 = 6}
+// gdbr-check:$3 = (4, 5, 6)
+// gdbg-command:print 'simple_tuple::NO_PADDING_64'
+// gdbr-command:print simple_tuple::NO_PADDING_64
+// gdbg-check:$4 = {__0 = 7, __1 = 8, __2 = 9}
+// gdbr-check:$4 = (7, 8, 9)
+
+// gdbg-command:print 'simple_tuple::INTERNAL_PADDING_1'
+// gdbr-command:print simple_tuple::INTERNAL_PADDING_1
+// gdbg-check:$5 = {__0 = 10, __1 = 11}
+// gdbr-check:$5 = (10, 11)
+// gdbg-command:print 'simple_tuple::INTERNAL_PADDING_2'
+// gdbr-command:print simple_tuple::INTERNAL_PADDING_2
+// gdbg-check:$6 = {__0 = 12, __1 = 13, __2 = 14, __3 = 15}
+// gdbr-check:$6 = (12, 13, 14, 15)
+
+// gdbg-command:print 'simple_tuple::PADDING_AT_END'
+// gdbr-command:print simple_tuple::PADDING_AT_END
+// gdbg-check:$7 = {__0 = 16, __1 = 17}
+// gdbr-check:$7 = (16, 17)
+
+// gdb-command:run
+
+// gdbg-command:print/d noPadding8
+// gdbr-command:print noPadding8
+// gdbg-check:$8 = {__0 = -100, __1 = 100}
+// gdbr-check:$8 = (-100, 100)
+// gdb-command:print noPadding16
+// gdbg-check:$9 = {__0 = 0, __1 = 1, __2 = 2}
+// gdbr-check:$9 = (0, 1, 2)
+// gdb-command:print noPadding32
+// gdbg-check:$10 = {__0 = 3, __1 = 4.5, __2 = 5}
+// gdbr-check:$10 = (3, 4.5, 5)
+// gdb-command:print noPadding64
+// gdbg-check:$11 = {__0 = 6, __1 = 7.5, __2 = 8}
+// gdbr-check:$11 = (6, 7.5, 8)
+
+// gdb-command:print internalPadding1
+// gdbg-check:$12 = {__0 = 9, __1 = 10}
+// gdbr-check:$12 = (9, 10)
+// gdb-command:print internalPadding2
+// gdbg-check:$13 = {__0 = 11, __1 = 12, __2 = 13, __3 = 14}
+// gdbr-check:$13 = (11, 12, 13, 14)
+
+// gdb-command:print paddingAtEnd
+// gdbg-check:$14 = {__0 = 15, __1 = 16}
+// gdbr-check:$14 = (15, 16)
+
+// gdbg-command:print/d 'simple_tuple::NO_PADDING_8'
+// gdbr-command:print simple_tuple::NO_PADDING_8
+// gdbg-check:$15 = {__0 = -127, __1 = 127}
+// gdbr-check:$15 = (-127, 127)
+// gdbg-command:print 'simple_tuple::NO_PADDING_16'
+// gdbr-command:print simple_tuple::NO_PADDING_16
+// gdbg-check:$16 = {__0 = -10, __1 = 10, __2 = 9}
+// gdbr-check:$16 = (-10, 10, 9)
+// gdbg-command:print 'simple_tuple::NO_PADDING_32'
+// gdbr-command:print simple_tuple::NO_PADDING_32
+// gdbg-check:$17 = {__0 = 14, __1 = 15, __2 = 16}
+// gdbr-check:$17 = (14, 15, 16)
+// gdbg-command:print 'simple_tuple::NO_PADDING_64'
+// gdbr-command:print simple_tuple::NO_PADDING_64
+// gdbg-check:$18 = {__0 = 17, __1 = 18, __2 = 19}
+// gdbr-check:$18 = (17, 18, 19)
+
+// gdbg-command:print 'simple_tuple::INTERNAL_PADDING_1'
+// gdbr-command:print simple_tuple::INTERNAL_PADDING_1
+// gdbg-check:$19 = {__0 = 110, __1 = 111}
+// gdbr-check:$19 = (110, 111)
+// gdbg-command:print 'simple_tuple::INTERNAL_PADDING_2'
+// gdbr-command:print simple_tuple::INTERNAL_PADDING_2
+// gdbg-check:$20 = {__0 = 112, __1 = 113, __2 = 114, __3 = 115}
+// gdbr-check:$20 = (112, 113, 114, 115)
+
+// gdbg-command:print 'simple_tuple::PADDING_AT_END'
+// gdbr-command:print simple_tuple::PADDING_AT_END
+// gdbg-check:$21 = {__0 = 116, __1 = 117}
+// gdbr-check:$21 = (116, 117)
+
+
+// === LLDB TESTS ==================================================================================
+
+// lldb-command:run
+
+// lldb-command:print/d noPadding8
+// lldbg-check:[...]$0 = { 0 = -100 1 = 100 }
+// lldbr-check:((i8, u8)) noPadding8 = { 0 = -100 1 = 100 }
+// lldb-command:print noPadding16
+// lldbg-check:[...]$1 = { 0 = 0 1 = 1 2 = 2 }
+// lldbr-check:((i16, i16, u16)) noPadding16 = { 0 = 0 1 = 1 2 = 2 }
+// lldb-command:print noPadding32
+// lldbg-check:[...]$2 = { 0 = 3 1 = 4.5 2 = 5 }
+// lldbr-check:((i32, f32, u32)) noPadding32 = { 0 = 3 1 = 4.5 2 = 5 }
+// lldb-command:print noPadding64
+// lldbg-check:[...]$3 = { 0 = 6 1 = 7.5 2 = 8 }
+// lldbr-check:((i64, f64, u64)) noPadding64 = { 0 = 6 1 = 7.5 2 = 8 }
+
+// lldb-command:print internalPadding1
+// lldbg-check:[...]$4 = { 0 = 9 1 = 10 }
+// lldbr-check:((i16, i32)) internalPadding1 = { 0 = 9 1 = 10 }
+// lldb-command:print internalPadding2
+// lldbg-check:[...]$5 = { 0 = 11 1 = 12 2 = 13 3 = 14 }
+// lldbr-check:((i16, i32, u32, u64)) internalPadding2 = { 0 = 11 1 = 12 2 = 13 3 = 14 }
+
+// lldb-command:print paddingAtEnd
+// lldbg-check:[...]$6 = { 0 = 15 1 = 16 }
+// lldbr-check:((i32, i16)) paddingAtEnd = { 0 = 15 1 = 16 }
+
+
+// === CDB TESTS ==================================================================================
+
+// cdb-command: g
+
+// cdb-command:dx noPadding8,d
+// cdb-check:noPadding8,d [...]: (-100, 100) [Type: tuple$<i8,u8>]
+// cdb-check:[...][0] : -100 [Type: [...]]
+// cdb-check:[...][1] : 100 [Type: [...]]
+// cdb-command:dx noPadding16,d
+// cdb-check:noPadding16,d [...]: (0, 1, 2) [Type: tuple$<i16,i16,u16>]
+// cdb-check:[...][0] : 0 [Type: [...]]
+// cdb-check:[...][1] : 1 [Type: [...]]
+// cdb-check:[...][2] : 2 [Type: [...]]
+// cdb-command:dx noPadding32,d
+// cdb-check:noPadding32,d [...]: (3, 4.5[...], 5) [Type: tuple$<i32,f32,u32>]
+// cdb-check:[...][0] : 3 [Type: [...]]
+// cdb-check:[...][1] : 4.5[...] [Type: [...]]
+// cdb-check:[...][2] : 5 [Type: [...]]
+// cdb-command:dx noPadding64,d
+// cdb-check:noPadding64,d [...]: (6, 7.5[...], 8) [Type: tuple$<i64,f64,u64>]
+// cdb-check:[...][0] : 6 [Type: [...]]
+// cdb-check:[...][1] : 7.500000 [Type: [...]]
+// cdb-check:[...][2] : 8 [Type: [...]]
+
+// cdb-command:dx internalPadding1,d
+// cdb-check:internalPadding1,d [...]: (9, 10) [Type: tuple$<i16,i32>]
+// cdb-check:[...][0] : 9 [Type: short]
+// cdb-check:[...][1] : 10 [Type: int]
+// cdb-command:dx internalPadding2,d
+// cdb-check:internalPadding2,d [...]: (11, 12, 13, 14) [Type: tuple$<i16,i32,u32,u64>]
+// cdb-check:[...][0] : 11 [Type: [...]]
+// cdb-check:[...][1] : 12 [Type: [...]]
+// cdb-check:[...][2] : 13 [Type: [...]]
+// cdb-check:[...][3] : 14 [Type: [...]]
+
+// cdb-command:dx paddingAtEnd,d
+// cdb-check:paddingAtEnd,d [...]: (15, 16) [Type: tuple$<i32,i16>]
+// cdb-check:[...][0] : 15 [Type: [...]]
+// cdb-check:[...][1] : 16 [Type: [...]]
+
+
+#![allow(unused_variables)]
+#![allow(dead_code)]
+#![feature(omit_gdb_pretty_printer_section)]
+#![omit_gdb_pretty_printer_section]
+
+static mut NO_PADDING_8: (i8, u8) = (-50, 50);
+static mut NO_PADDING_16: (i16, i16, u16) = (-1, 2, 3);
+
+static mut NO_PADDING_32: (i32, f32, u32) = (4, 5.0, 6);
+static mut NO_PADDING_64: (i64, f64, u64) = (7, 8.0, 9);
+
+static mut INTERNAL_PADDING_1: (i16, i32) = (10, 11);
+static mut INTERNAL_PADDING_2: (i16, i32, u32, u64) = (12, 13, 14, 15);
+
+static mut PADDING_AT_END: (i32, i16) = (16, 17);
+
+fn main() {
+ let noPadding8: (i8, u8) = (-100, 100);
+ let noPadding16: (i16, i16, u16) = (0, 1, 2);
+ let noPadding32: (i32, f32, u32) = (3, 4.5, 5);
+ let noPadding64: (i64, f64, u64) = (6, 7.5, 8);
+
+ let internalPadding1: (i16, i32) = (9, 10);
+ let internalPadding2: (i16, i32, u32, u64) = (11, 12, 13, 14);
+
+ let paddingAtEnd: (i32, i16) = (15, 16);
+
+ unsafe {
+ NO_PADDING_8 = (-127, 127);
+ NO_PADDING_16 = (-10, 10, 9);
+
+ NO_PADDING_32 = (14, 15.0, 16);
+ NO_PADDING_64 = (17, 18.0, 19);
+
+ INTERNAL_PADDING_1 = (110, 111);
+ INTERNAL_PADDING_2 = (112, 113, 114, 115);
+
+ PADDING_AT_END = (116, 117);
+ }
+
+ zzz(); // #break
+}
+
+fn zzz() {()}
diff --git a/src/test/debuginfo/static-method-on-struct-and-enum.rs b/src/test/debuginfo/static-method-on-struct-and-enum.rs
new file mode 100644
index 000000000..864c61c15
--- /dev/null
+++ b/src/test/debuginfo/static-method-on-struct-and-enum.rs
@@ -0,0 +1,85 @@
+// min-lldb-version: 310
+
+// compile-flags:-g
+
+// === GDB TESTS ===================================================================================
+
+// gdb-command:run
+
+// STRUCT
+// gdb-command:print arg1
+// gdb-check:$1 = 1
+// gdb-command:print arg2
+// gdb-check:$2 = 2
+// gdb-command:continue
+
+// ENUM
+// gdb-command:print arg1
+// gdb-check:$3 = -3
+// gdb-command:print arg2
+// gdb-check:$4 = 4.5
+// gdb-command:print arg3
+// gdb-check:$5 = 5
+// gdb-command:continue
+
+
+// === LLDB TESTS ==================================================================================
+
+// lldb-command:run
+
+// STRUCT
+// lldb-command:print arg1
+// lldbg-check:[...]$0 = 1
+// lldbr-check:(isize) arg1 = 1
+// lldb-command:print arg2
+// lldbg-check:[...]$1 = 2
+// lldbr-check:(isize) arg2 = 2
+// lldb-command:continue
+
+// ENUM
+// lldb-command:print arg1
+// lldbg-check:[...]$2 = -3
+// lldbr-check:(isize) arg1 = -3
+// lldb-command:print arg2
+// lldbg-check:[...]$3 = 4.5
+// lldbr-check:(f64) arg2 = 4.5
+// lldb-command:print arg3
+// lldbg-check:[...]$4 = 5
+// lldbr-check:(usize) arg3 = 5
+// lldb-command:continue
+
+#![feature(omit_gdb_pretty_printer_section)]
+#![omit_gdb_pretty_printer_section]
+
+struct Struct {
+ x: isize
+}
+
+impl Struct {
+
+ fn static_method(arg1: isize, arg2: isize) -> isize {
+ zzz(); // #break
+ arg1 + arg2
+ }
+}
+
+enum Enum {
+ Variant1 { x: isize },
+ Variant2,
+ Variant3(f64, isize, char),
+}
+
+impl Enum {
+
+ fn static_method(arg1: isize, arg2: f64, arg3: usize) -> isize {
+ zzz(); // #break
+ arg1
+ }
+}
+
+fn main() {
+ Struct::static_method(1, 2);
+ Enum::static_method(-3, 4.5, 5);
+}
+
+fn zzz() {()}
diff --git a/src/test/debuginfo/step-into-match.rs b/src/test/debuginfo/step-into-match.rs
new file mode 100644
index 000000000..4a5f78570
--- /dev/null
+++ b/src/test/debuginfo/step-into-match.rs
@@ -0,0 +1,383 @@
+// compile-flags: -g
+// ignore-android: FIXME(#10381)
+
+// === GDB TESTS ==============================================================
+
+// gdb-command: r
+
+// gdb-command: s
+// gdb-check:[...]match x {
+
+// gdb-command: s
+// gdb-check:[...] Some(42) => 1,
+
+// gdb-command: s
+// gdb-check:[...]}
+
+// gdb-command: s
+// gdb-check:[...]match_enum(Some(12));
+
+// gdb-command: s
+// gdb-check:[...]match x {
+
+// gdb-command: s
+// gdb-check:[...]Some(_) => 2,
+
+// gdb-command: s
+// gdb-check:[...]}
+
+// gdb-command: s
+// gdb-check:[...]match_enum(None);
+
+// gdb-command: s
+// gdb-check:[...]match x {
+
+// gdb-command: s
+// gdb-check:[...]None => 3,
+
+// gdb-command: s
+// gdb-check:[...]}
+
+// gdb-command: s
+// gdb-check:[...]match_int(1);
+
+// gdb-command: s
+// gdb-check:[...]match y {
+
+// gdb-command: s
+// gdb-check:[...]1 => 3,
+
+// gdb-command: s
+// gdb-check:[...]}
+
+// gdb-command: s
+// gdb-check:[...]match_int(2);
+
+// gdb-command: s
+// gdb-check:[...]match y {
+
+// gdb-command: s
+// gdb-check:[...]_ => 4,
+
+// gdb-command: s
+// gdb-check:[...]}
+
+// gdb-command: s
+// gdb-check:[...]match_int(0);
+
+// gdb-command: s
+// gdb-check:[...]match y {
+
+// gdb-command: s
+// gdb-check:[...]0 => 2,
+
+// gdb-command: s
+// gdb-check:[...]}
+
+// gdb-command: s
+// gdb-check:[...]match_int(-1);
+
+// gdb-command: s
+// gdb-check:[...]match y {
+
+// gdb-command: s
+// gdb-check:[...]-1 => 1,
+
+// gdb-command: s
+// gdb-check:[...]}
+
+// gdb-command: s
+// gdb-check:[...]match_tuple(5, 12);
+
+// gdb-command: s
+// gdb-check:[...]match (a, b) {
+
+// gdb-command: s
+// gdb-check:[...](5, 12) => 3,
+
+// gdb-command: s
+// gdb-check:[...]}
+
+// gdb-command: s
+// gdb-check:[...]match_tuple(29, 1);
+
+// gdb-command: s
+// gdb-check:[...]match (a, b) {
+
+// gdb-command: s
+// gdb-check:[...](29, _) => 2,
+
+// gdb-command: s
+// gdb-check:[...]}
+
+// gdb-command: s
+// gdb-check:[...]match_tuple(12, 12);
+
+// gdb-command: s
+// gdb-check:[...]match (a, b) {
+
+// gdb-command: s
+// gdb-check:[...](_, _) => 5
+
+// gdb-command: s
+// gdb-check:[...]}
+
+// gdb-command: s
+// gdb-check:[...]match_tuple(42, 12);
+
+// gdb-command: s
+// gdb-check:[...]match (a, b) {
+
+// gdb-command: s
+// gdb-check:[...](42, 12) => 1,
+
+// gdb-command: s
+// gdb-check:[...]}
+
+// gdb-command: s
+// gdb-check:[...]match_tuple(1, 9);
+
+// gdb-command: s
+// gdb-check:[...]match (a, b) {
+
+// gdb-command: s
+// gdb-check:[...](_, 9) => 4,
+
+// gdb-command: s
+// gdb-check:[...]}
+
+// gdb-command: s
+// gdb-check:[...]}
+
+// === CDB TESTS ==============================================================
+
+// Enable line-based debugging and print lines after stepping.
+// cdb-command: .lines -e
+// cdb-command: l+s
+// cdb-command: l+t
+
+// cdb-command: g
+
+// cdb-command: t
+// cdb-check: [...]: fn match_enum(x: Option<u32>) -> u8 {
+
+// cdb-command: t
+// cdb-check: [...]: match x {
+
+// cdb-command: t
+// cdb-check: [...]: Some(42) => 1,
+
+// cdb-command: t
+// cdb-check: [...]: }
+
+// cdb-command: t
+// cdb-check: [...]: match_enum(Some(12));
+
+// cdb-command: t
+// cdb-check: [...]: fn match_enum(x: Option<u32>) -> u8 {
+
+// cdb-command: t
+// cdb-check: [...]: match x {
+
+// cdb-command: t
+// cdb-check: [...]: Some(_) => 2,
+
+// cdb-command: t
+// cdb-check: [...]: }
+
+// cdb-command: t
+// cdb-check: [...]: match_enum(None);
+
+// cdb-command: t
+// cdb-check: [...]: fn match_enum(x: Option<u32>) -> u8 {
+
+// cdb-command: t
+// cdb-check: [...]: match x {
+
+// cdb-command: t
+// cdb-check: [...]: None => 3,
+
+// cdb-command: t
+// cdb-check: [...]: }
+
+// cdb-command: t
+// cdb-check: [...]: match_int(1);
+
+// cdb-command: t
+// cdb-check: [...]: fn match_int(y: i32) -> u16 {
+
+// cdb-command: t
+// cdb-check: [...]: match y {
+
+// cdb-command: t
+// cdb-check: [...]: 1 => 3,
+
+// cdb-command: t
+// cdb-check: [...]: }
+
+// cdb-command: t
+// cdb-check: [...]: match_int(2);
+
+// cdb-command: t
+// cdb-check: [...]: fn match_int(y: i32) -> u16 {
+
+// cdb-command: t
+// cdb-check: [...]: match y {
+
+// cdb-command: t
+// cdb-check: [...]: _ => 4,
+
+// cdb-command: t
+// cdb-check: [...]: }
+
+// cdb-command: t
+// cdb-check: [...]: match_int(0);
+
+// cdb-command: t
+// cdb-check: [...]: fn match_int(y: i32) -> u16 {
+
+// cdb-command: t
+// cdb-check: [...]: match y {
+
+// cdb-command: t
+// cdb-check: [...]: 0 => 2,
+
+// cdb-command: t
+// cdb-check: [...]: }
+
+// cdb-command: t
+// cdb-check: [...]: match_int(-1);
+
+// cdb-command: t
+// cdb-check: [...]: fn match_int(y: i32) -> u16 {
+
+// cdb-command: t
+// cdb-check: [...]: match y {
+
+// cdb-command: t
+// cdb-check: [...]: -1 => 1,
+
+// cdb-command: t
+// cdb-check: [...]: }
+
+// cdb-command: t
+// cdb-check: [...]: match_tuple(5, 12);
+
+// cdb-command: t
+// cdb-check: [...]: fn match_tuple(a: u8, b: i8) -> u32 {
+
+// cdb-command: t
+// cdb-check: [...]: match (a, b) {
+
+// cdb-command: t
+// cdb-check: [...]: (5, 12) => 3,
+
+// cdb-command: t
+// cdb-check: [...]: }
+
+// cdb-command: t
+// cdb-check: [...]: match_tuple(29, 1);
+
+// cdb-command: t
+// cdb-check: [...]: fn match_tuple(a: u8, b: i8) -> u32 {
+
+// cdb-command: t
+// cdb-check: [...]: match (a, b) {
+
+// cdb-command: t
+// cdb-check: [...]: (29, _) => 2,
+
+// cdb-command: t
+// cdb-check: [...]: }
+
+// cdb-command: t
+// cdb-check: [...]: match_tuple(12, 12);
+
+// cdb-command: t
+// cdb-check: [...]: fn match_tuple(a: u8, b: i8) -> u32 {
+
+// cdb-command: t
+// cdb-check: [...]: match (a, b) {
+
+// cdb-command: t
+// cdb-check: [...]: (_, _) => 5
+
+// cdb-command: t
+// cdb-check: [...]: }
+
+// cdb-command: t
+// cdb-check: [...]: match_tuple(42, 12);
+
+// cdb-command: t
+// cdb-check: [...]: fn match_tuple(a: u8, b: i8) -> u32 {
+
+// cdb-command: t
+// cdb-check: [...]: match (a, b) {
+
+// cdb-command: t
+// cdb-check: [...]: (42, 12) => 1,
+
+// cdb-command: t
+// cdb-check: [...]: }
+
+// cdb-command: t
+// cdb-check: [...]: match_tuple(1, 9);
+
+// cdb-command: t
+// cdb-check: [...]: fn match_tuple(a: u8, b: i8) -> u32 {
+
+// cdb-command: t
+// cdb-check: [...]: match (a, b) {
+
+// cdb-command: t
+// cdb-check: [...]: (_, 9) => 4,
+
+// cdb-command: t
+// cdb-check: [...]: }
+
+// cdb-command: t
+// cdb-check: [...]: }
+
+fn main() {
+ match_enum(Some(42)); // #break
+ match_enum(Some(12));
+ match_enum(None);
+
+ match_int(1);
+ match_int(2);
+ match_int(0);
+ match_int(-1);
+
+ match_tuple(5, 12);
+ match_tuple(29, 1);
+ match_tuple(12, 12);
+ match_tuple(42, 12);
+ match_tuple(1, 9);
+}
+
+fn match_enum(x: Option<u32>) -> u8 {
+ match x {
+ Some(42) => 1,
+ Some(_) => 2,
+ None => 3,
+ }
+}
+
+fn match_int(y: i32) -> u16 {
+ match y {
+ -1 => 1,
+ 0 => 2,
+ 1 => 3,
+ _ => 4,
+ }
+}
+
+fn match_tuple(a: u8, b: i8) -> u32 {
+ match (a, b) {
+ (42, 12) => 1,
+ (29, _) => 2,
+ (5, 12) => 3,
+ (_, 9) => 4,
+ (_, _) => 5
+ }
+}
diff --git a/src/test/debuginfo/struct-in-enum.rs b/src/test/debuginfo/struct-in-enum.rs
new file mode 100644
index 000000000..41d15af14
--- /dev/null
+++ b/src/test/debuginfo/struct-in-enum.rs
@@ -0,0 +1,85 @@
+// min-lldb-version: 310
+// ignore-gdb-version: 7.11.90 - 7.12.9
+// ignore-test // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155
+
+// compile-flags:-g
+
+// === GDB TESTS ===================================================================================
+
+// gdb-command:set print union on
+// gdb-command:run
+
+// gdb-command:print case1
+// gdbg-check:$1 = {{RUST$ENUM$DISR = Case1, __0 = 0, __1 = {x = 2088533116, y = 2088533116, z = 31868}}, {RUST$ENUM$DISR = Case1, [...]}}
+// gdbr-check:$1 = struct_in_enum::Regular::Case1(0, struct_in_enum::Struct {x: 2088533116, y: 2088533116, z: 31868})
+
+// gdb-command:print case2
+// gdbg-check:$2 = {{RUST$ENUM$DISR = Case2, [...]}, {RUST$ENUM$DISR = Case2, __0 = 0, __1 = 1229782938247303441, __2 = 4369}}
+// gdbr-check:$2 = struct_in_enum::Regular::Case2(0, 1229782938247303441, 4369)
+
+// gdb-command:print univariant
+// gdbg-check:$3 = {{__0 = {x = 123, y = 456, z = 789}}}
+// gdbr-check:$3 = struct_in_enum::Univariant::TheOnlyCase(struct_in_enum::Struct {x: 123, y: 456, z: 789})
+
+
+// === LLDB TESTS ==================================================================================
+
+// lldb-command:run
+
+// lldb-command:print case1
+// lldb-check:[...]$0 = Case1(0, Struct { x: 2088533116, y: 2088533116, z: 31868 })
+// lldb-command:print case2
+// lldb-check:[...]$1 = Case2(0, 1229782938247303441, 4369)
+
+// lldb-command:print univariant
+// lldb-check:[...]$2 = TheOnlyCase(Struct { x: 123, y: 456, z: 789 })
+
+#![allow(unused_variables)]
+#![feature(omit_gdb_pretty_printer_section)]
+#![omit_gdb_pretty_printer_section]
+
+use self::Regular::{Case1, Case2};
+use self::Univariant::TheOnlyCase;
+
+struct Struct {
+ x: u32,
+ y: i32,
+ z: i16
+}
+
+// The first element is to ensure proper alignment, irrespective of the machines word size. Since
+// the size of the discriminant value is machine dependent, this has be taken into account when
+// datatype layout should be predictable as in this case.
+enum Regular {
+ Case1(u64, Struct),
+ Case2(u64, u64, i16)
+}
+
+enum Univariant {
+ TheOnlyCase(Struct)
+}
+
+fn main() {
+
+ // In order to avoid endianness trouble all of the following test values consist of a single
+ // repeated byte. This way each interpretation of the union should look the same, no matter if
+ // this is a big or little endian machine.
+
+ // 0b0111110001111100011111000111110001111100011111000111110001111100 = 8970181431921507452
+ // 0b01111100011111000111110001111100 = 2088533116
+ // 0b0111110001111100 = 31868
+ // 0b01111100 = 124
+ let case1 = Case1(0, Struct { x: 2088533116, y: 2088533116, z: 31868 });
+
+ // 0b0001000100010001000100010001000100010001000100010001000100010001 = 1229782938247303441
+ // 0b00010001000100010001000100010001 = 286331153
+ // 0b0001000100010001 = 4369
+ // 0b00010001 = 17
+ let case2 = Case2(0, 1229782938247303441, 4369);
+
+ let univariant = TheOnlyCase(Struct { x: 123, y: 456, z: 789 });
+
+ zzz(); // #break
+}
+
+fn zzz() {()}
diff --git a/src/test/debuginfo/struct-in-struct.rs b/src/test/debuginfo/struct-in-struct.rs
new file mode 100644
index 000000000..a9e7797ec
--- /dev/null
+++ b/src/test/debuginfo/struct-in-struct.rs
@@ -0,0 +1,178 @@
+// min-lldb-version: 310
+
+// compile-flags:-g
+
+// === GDB TESTS ===================================================================================
+
+// gdb-command:run
+
+// gdb-command:print three_simple_structs
+// gdbg-check:$1 = {x = {x = 1}, y = {x = 2}, z = {x = 3}}
+// gdbr-check:$1 = struct_in_struct::ThreeSimpleStructs {x: struct_in_struct::Simple {x: 1}, y: struct_in_struct::Simple {x: 2}, z: struct_in_struct::Simple {x: 3}}
+
+// gdb-command:print internal_padding_parent
+// gdbg-check:$2 = {x = {x = 4, y = 5}, y = {x = 6, y = 7}, z = {x = 8, y = 9}}
+// gdbr-check:$2 = struct_in_struct::InternalPaddingParent {x: struct_in_struct::InternalPadding {x: 4, y: 5}, y: struct_in_struct::InternalPadding {x: 6, y: 7}, z: struct_in_struct::InternalPadding {x: 8, y: 9}}
+
+// gdb-command:print padding_at_end_parent
+// gdbg-check:$3 = {x = {x = 10, y = 11}, y = {x = 12, y = 13}, z = {x = 14, y = 15}}
+// gdbr-check:$3 = struct_in_struct::PaddingAtEndParent {x: struct_in_struct::PaddingAtEnd {x: 10, y: 11}, y: struct_in_struct::PaddingAtEnd {x: 12, y: 13}, z: struct_in_struct::PaddingAtEnd {x: 14, y: 15}}
+
+
+// === LLDB TESTS ==================================================================================
+
+// lldb-command:run
+
+// lldb-command:print three_simple_structs
+// lldbg-check:[...]$0 = { x = { x = 1 } y = { x = 2 } z = { x = 3 } }
+// lldbr-check:(struct_in_struct::ThreeSimpleStructs) three_simple_structs = { x = { x = 1 } y = { x = 2 } z = { x = 3 } }
+
+// lldb-command:print internal_padding_parent
+// lldbg-check:[...]$1 = { x = { x = 4 y = 5 } y = { x = 6 y = 7 } z = { x = 8 y = 9 } }
+// lldbr-check:(struct_in_struct::InternalPaddingParent) internal_padding_parent = { x = { x = 4 y = 5 } y = { x = 6 y = 7 } z = { x = 8 y = 9 } }
+
+// lldb-command:print padding_at_end_parent
+// lldbg-check:[...]$2 = { x = { x = 10 y = 11 } y = { x = 12 y = 13 } z = { x = 14 y = 15 } }
+// lldbr-check:(struct_in_struct::PaddingAtEndParent) padding_at_end_parent = { x = { x = 10 y = 11 } y = { x = 12 y = 13 } z = { x = 14 y = 15 } }
+
+// lldb-command:print mixed
+// lldbg-check:[...]$3 = { x = { x = 16 y = 17 } y = { x = 18 y = 19 } z = { x = 20 } w = 21 }
+// lldbr-check:(struct_in_struct::Mixed) mixed = { x = { x = 16 y = 17 } y = { x = 18 y = 19 } z = { x = 20 } w = 21 }
+
+// lldb-command:print bag
+// lldbg-check:[...]$4 = { x = { x = 22 } }
+// lldbr-check:(struct_in_struct::Bag) bag = { x = { x = 22 } }
+
+// lldb-command:print bag_in_bag
+// lldbg-check:[...]$5 = { x = { x = { x = 23 } } }
+// lldbr-check:(struct_in_struct::BagInBag) bag_in_bag = { x = { x = { x = 23 } } }
+
+// lldb-command:print tjo
+// lldbg-check:[...]$6 = { x = { x = { x = { x = 24 } } } }
+// lldbr-check:(struct_in_struct::ThatsJustOverkill) tjo = { x = { x = { x = { x = 24 } } } }
+
+// lldb-command:print tree
+// lldbg-check:[...]$7 = { x = { x = 25 } y = { x = { x = 26 y = 27 } y = { x = 28 y = 29 } z = { x = 30 y = 31 } } z = { x = { x = { x = 32 } } } }
+// lldbr-check:(struct_in_struct::Tree) tree = { x = { x = 25 } y = { x = { x = 26 y = 27 } y = { x = 28 y = 29 } z = { x = 30 y = 31 } } z = { x = { x = { x = 32 } } } }
+
+#![allow(unused_variables)]
+#![feature(omit_gdb_pretty_printer_section)]
+#![omit_gdb_pretty_printer_section]
+
+struct Simple {
+ x: i32
+}
+
+struct InternalPadding {
+ x: i32,
+ y: i64
+}
+
+struct PaddingAtEnd {
+ x: i64,
+ y: i32
+}
+
+struct ThreeSimpleStructs {
+ x: Simple,
+ y: Simple,
+ z: Simple
+}
+
+struct InternalPaddingParent {
+ x: InternalPadding,
+ y: InternalPadding,
+ z: InternalPadding
+}
+
+struct PaddingAtEndParent {
+ x: PaddingAtEnd,
+ y: PaddingAtEnd,
+ z: PaddingAtEnd
+}
+
+struct Mixed {
+ x: PaddingAtEnd,
+ y: InternalPadding,
+ z: Simple,
+ w: i16
+}
+
+struct Bag {
+ x: Simple
+}
+
+struct BagInBag {
+ x: Bag
+}
+
+struct ThatsJustOverkill {
+ x: BagInBag
+}
+
+struct Tree {
+ x: Simple,
+ y: InternalPaddingParent,
+ z: BagInBag
+}
+
+fn main() {
+
+ let three_simple_structs = ThreeSimpleStructs {
+ x: Simple { x: 1 },
+ y: Simple { x: 2 },
+ z: Simple { x: 3 }
+ };
+
+ let internal_padding_parent = InternalPaddingParent {
+ x: InternalPadding { x: 4, y: 5 },
+ y: InternalPadding { x: 6, y: 7 },
+ z: InternalPadding { x: 8, y: 9 }
+ };
+
+ let padding_at_end_parent = PaddingAtEndParent {
+ x: PaddingAtEnd { x: 10, y: 11 },
+ y: PaddingAtEnd { x: 12, y: 13 },
+ z: PaddingAtEnd { x: 14, y: 15 }
+ };
+
+ let mixed = Mixed {
+ x: PaddingAtEnd { x: 16, y: 17 },
+ y: InternalPadding { x: 18, y: 19 },
+ z: Simple { x: 20 },
+ w: 21
+ };
+
+ let bag = Bag { x: Simple { x: 22 } };
+ let bag_in_bag = BagInBag {
+ x: Bag {
+ x: Simple { x: 23 }
+ }
+ };
+
+ let tjo = ThatsJustOverkill {
+ x: BagInBag {
+ x: Bag {
+ x: Simple { x: 24 }
+ }
+ }
+ };
+
+ let tree = Tree {
+ x: Simple { x: 25 },
+ y: InternalPaddingParent {
+ x: InternalPadding { x: 26, y: 27 },
+ y: InternalPadding { x: 28, y: 29 },
+ z: InternalPadding { x: 30, y: 31 }
+ },
+ z: BagInBag {
+ x: Bag {
+ x: Simple { x: 32 }
+ }
+ }
+ };
+
+ zzz(); // #break
+}
+
+fn zzz() {()}
diff --git a/src/test/debuginfo/struct-namespace.rs b/src/test/debuginfo/struct-namespace.rs
new file mode 100644
index 000000000..81752c269
--- /dev/null
+++ b/src/test/debuginfo/struct-namespace.rs
@@ -0,0 +1,64 @@
+// ignore-gdb
+// compile-flags:-g
+// min-lldb-version: 310
+
+// Check that structs get placed in the correct namespace
+
+// lldb-command:run
+// lldb-command:p struct1
+// lldbg-check:(struct_namespace::Struct1) $0 = [...]
+// lldbr-check:(struct_namespace::Struct1) struct1 = Struct1 { a: 0, b: 1 }
+// lldb-command:p struct2
+// lldbg-check:(struct_namespace::Struct2) $1 = [...]
+// lldbr-check:(struct_namespace::Struct2) struct2 = { = 2 }
+
+// lldb-command:p mod1_struct1
+// lldbg-check:(struct_namespace::mod1::Struct1) $2 = [...]
+// lldbr-check:(struct_namespace::mod1::Struct1) mod1_struct1 = Struct1 { a: 3, b: 4 }
+// lldb-command:p mod1_struct2
+// lldbg-check:(struct_namespace::mod1::Struct2) $3 = [...]
+// lldbr-check:(struct_namespace::mod1::Struct2) mod1_struct2 = { = 5 }
+
+#![allow(unused_variables)]
+#![allow(dead_code)]
+#![feature(omit_gdb_pretty_printer_section)]
+#![omit_gdb_pretty_printer_section]
+
+struct Struct1 {
+ a: u32,
+ b: u64,
+}
+
+struct Struct2(u32);
+
+mod mod1 {
+
+ pub struct Struct1 {
+ pub a: u32,
+ pub b: u64,
+ }
+
+ pub struct Struct2(pub u32);
+}
+
+
+fn main() {
+ let struct1 = Struct1 {
+ a: 0,
+ b: 1,
+ };
+
+ let struct2 = Struct2(2);
+
+ let mod1_struct1 = mod1::Struct1 {
+ a: 3,
+ b: 4,
+ };
+
+ let mod1_struct2 = mod1::Struct2(5);
+
+ zzz(); // #break
+}
+
+#[inline(never)]
+fn zzz() {()}
diff --git a/src/test/debuginfo/struct-style-enum.rs b/src/test/debuginfo/struct-style-enum.rs
new file mode 100644
index 000000000..3d819e368
--- /dev/null
+++ b/src/test/debuginfo/struct-style-enum.rs
@@ -0,0 +1,90 @@
+// Require a gdb or lldb that can read DW_TAG_variant_part.
+// min-gdb-version: 8.2
+// rust-lldb
+
+// compile-flags:-g
+
+// === GDB TESTS ===================================================================================
+
+// gdb-command:set print union on
+// gdb-command:run
+
+// gdb-command:print case1
+// gdbr-check:$1 = struct_style_enum::Regular::Case1{a: 0, b: 31868, c: 31868, d: 31868, e: 31868}
+
+// gdb-command:print case2
+// gdbr-check:$2 = struct_style_enum::Regular::Case2{a: 0, b: 286331153, c: 286331153}
+
+// gdb-command:print case3
+// gdbr-check:$3 = struct_style_enum::Regular::Case3{a: 0, b: 6438275382588823897}
+
+// gdb-command:print univariant
+// gdbr-check:$4 = struct_style_enum::Univariant::TheOnlyCase{a: -1}
+
+
+// === LLDB TESTS ==================================================================================
+
+// lldb-command:run
+
+// lldb-command:print case1
+// lldbr-check:(struct_style_enum::Regular::Case1) case1 = { a = 0 b = 31868 c = 31868 d = 31868 e = 31868 }
+
+// lldb-command:print case2
+// lldbr-check:(struct_style_enum::Regular::Case2) case2 = Case2 { Case1: 0, Case2: 286331153, Case3: 286331153 }
+
+// lldb-command:print case3
+// lldbr-check:(struct_style_enum::Regular::Case3) case3 = Case3 { Case1: 0, Case2: 6438275382588823897 }
+
+// lldb-command:print univariant
+// lldbr-check:(struct_style_enum::Univariant) univariant = Univariant { TheOnlyCase: TheOnlyCase { a: -1 } }
+
+#![allow(unused_variables)]
+#![feature(omit_gdb_pretty_printer_section)]
+#![omit_gdb_pretty_printer_section]
+
+use self::Regular::{Case1, Case2, Case3};
+use self::Univariant::TheOnlyCase;
+
+// The first element is to ensure proper alignment, irrespective of the machines word size. Since
+// the size of the discriminant value is machine dependent, this has be taken into account when
+// datatype layout should be predictable as in this case.
+enum Regular {
+ Case1 { a: u64, b: u16, c: u16, d: u16, e: u16},
+ Case2 { a: u64, b: u32, c: u32},
+ Case3 { a: u64, b: u64 }
+}
+
+enum Univariant {
+ TheOnlyCase { a: i64 }
+}
+
+fn main() {
+
+ // In order to avoid endianness trouble all of the following test values consist of a single
+ // repeated byte. This way each interpretation of the union should look the same, no matter if
+ // this is a big or little endian machine.
+
+ // 0b0111110001111100011111000111110001111100011111000111110001111100 = 8970181431921507452
+ // 0b01111100011111000111110001111100 = 2088533116
+ // 0b0111110001111100 = 31868
+ // 0b01111100 = 124
+ let case1 = Case1 { a: 0, b: 31868, c: 31868, d: 31868, e: 31868 };
+
+ // 0b0001000100010001000100010001000100010001000100010001000100010001 = 1229782938247303441
+ // 0b00010001000100010001000100010001 = 286331153
+ // 0b0001000100010001 = 4369
+ // 0b00010001 = 17
+ let case2 = Case2 { a: 0, b: 286331153, c: 286331153 };
+
+ // 0b0101100101011001010110010101100101011001010110010101100101011001 = 6438275382588823897
+ // 0b01011001010110010101100101011001 = 1499027801
+ // 0b0101100101011001 = 22873
+ // 0b01011001 = 89
+ let case3 = Case3 { a: 0, b: 6438275382588823897 };
+
+ let univariant = TheOnlyCase { a: -1 };
+
+ zzz(); // #break
+}
+
+fn zzz() {()}
diff --git a/src/test/debuginfo/struct-with-destructor.rs b/src/test/debuginfo/struct-with-destructor.rs
new file mode 100644
index 000000000..4334cd902
--- /dev/null
+++ b/src/test/debuginfo/struct-with-destructor.rs
@@ -0,0 +1,144 @@
+// min-lldb-version: 310
+
+// compile-flags:-g
+
+// === GDB TESTS ===================================================================================
+
+// gdb-command:run
+// gdb-command:print simple
+// gdbg-check:$1 = {x = 10, y = 20}
+// gdbr-check:$1 = struct_with_destructor::WithDestructor {x: 10, y: 20}
+
+// gdb-command:print noDestructor
+// gdbg-check:$2 = {a = {x = 10, y = 20}, guard = -1}
+// gdbr-check:$2 = struct_with_destructor::NoDestructorGuarded {a: struct_with_destructor::NoDestructor {x: 10, y: 20}, guard: -1}
+
+// gdb-command:print withDestructor
+// gdbg-check:$3 = {a = {x = 10, y = 20}, guard = -1}
+// gdbr-check:$3 = struct_with_destructor::WithDestructorGuarded {a: struct_with_destructor::WithDestructor {x: 10, y: 20}, guard: -1}
+
+// gdb-command:print nested
+// gdbg-check:$4 = {a = {a = {x = 7890, y = 9870}}}
+// gdbr-check:$4 = struct_with_destructor::NestedOuter {a: struct_with_destructor::NestedInner {a: struct_with_destructor::WithDestructor {x: 7890, y: 9870}}}
+
+
+// === LLDB TESTS ==================================================================================
+
+// lldb-command:run
+// lldb-command:print simple
+// lldbg-check:[...]$0 = { x = 10 y = 20 }
+// lldbr-check:(struct_with_destructor::WithDestructor) simple = { x = 10 y = 20 }
+
+// lldb-command:print noDestructor
+// lldbg-check:[...]$1 = { a = { x = 10 y = 20 } guard = -1 }
+// lldbr-check:(struct_with_destructor::NoDestructorGuarded) noDestructor = { a = { x = 10 y = 20 } guard = -1 }
+
+// lldb-command:print withDestructor
+// lldbg-check:[...]$2 = { a = { x = 10 y = 20 } guard = -1 }
+// lldbr-check:(struct_with_destructor::WithDestructorGuarded) withDestructor = { a = { x = 10 y = 20 } guard = -1 }
+
+// lldb-command:print nested
+// lldbg-check:[...]$3 = { a = { a = { x = 7890 y = 9870 } } }
+// lldbr-check:(struct_with_destructor::NestedOuter) nested = { a = { a = { x = 7890 y = 9870 } } }
+
+#![allow(unused_variables)]
+#![feature(omit_gdb_pretty_printer_section)]
+#![omit_gdb_pretty_printer_section]
+
+struct NoDestructor {
+ x: i32,
+ y: i64
+}
+
+struct WithDestructor {
+ x: i32,
+ y: i64
+}
+
+impl Drop for WithDestructor {
+ fn drop(&mut self) {}
+}
+
+struct NoDestructorGuarded {
+ a: NoDestructor,
+ guard: i64
+}
+
+struct WithDestructorGuarded {
+ a: WithDestructor,
+ guard: i64
+}
+
+struct NestedInner {
+ a: WithDestructor
+}
+
+impl Drop for NestedInner {
+ fn drop(&mut self) {}
+}
+
+struct NestedOuter {
+ a: NestedInner
+}
+
+
+// The compiler adds a 'destructed' boolean field to structs implementing Drop. This field is used
+// at runtime to prevent drop() to be executed more than once.
+// This field must be incorporated by the debug info generation. Otherwise the debugger assumes a
+// wrong size/layout for the struct.
+fn main() {
+
+ let simple = WithDestructor { x: 10, y: 20 };
+
+ let noDestructor = NoDestructorGuarded {
+ a: NoDestructor { x: 10, y: 20 },
+ guard: -1
+ };
+
+ // If the destructor flag field is not incorporated into the debug info for 'WithDestructor'
+ // then the debugger will have an invalid offset for the field 'guard' and thus should not be
+ // able to read its value correctly (dots are padding bytes, D is the boolean destructor flag):
+ //
+ // 64 bit
+ //
+ // NoDestructorGuarded = 0000....00000000FFFFFFFF
+ // <--------------><------>
+ // NoDestructor guard
+ //
+ //
+ // withDestructorGuarded = 0000....00000000D.......FFFFFFFF
+ // <--------------><------> // How debug info says it is
+ // WithDestructor guard
+ //
+ // <----------------------><------> // How it actually is
+ // WithDestructor guard
+ //
+ // 32 bit
+ //
+ // NoDestructorGuarded = 000000000000FFFFFFFF
+ // <----------><------>
+ // NoDestructor guard
+ //
+ //
+ // withDestructorGuarded = 000000000000D...FFFFFFFF
+ // <----------><------> // How debug info says it is
+ // WithDestructor guard
+ //
+ // <--------------><------> // How it actually is
+ // WithDestructor guard
+ //
+ let withDestructor = WithDestructorGuarded {
+ a: WithDestructor { x: 10, y: 20 },
+ guard: -1
+ };
+
+ // expected layout (64 bit) = xxxx....yyyyyyyyD.......D...
+ // <--WithDestructor------>
+ // <-------NestedInner-------->
+ // <-------NestedOuter-------->
+ let nested = NestedOuter { a: NestedInner { a: WithDestructor { x: 7890, y: 9870 } } };
+
+ zzz(); // #break
+}
+
+fn zzz() {()}
diff --git a/src/test/debuginfo/text-to-include-1.txt b/src/test/debuginfo/text-to-include-1.txt
new file mode 100644
index 000000000..ba055272a
--- /dev/null
+++ b/src/test/debuginfo/text-to-include-1.txt
@@ -0,0 +1 @@
+some text to include in another file as string 1 \ No newline at end of file
diff --git a/src/test/debuginfo/text-to-include-2.txt b/src/test/debuginfo/text-to-include-2.txt
new file mode 100644
index 000000000..a59d2057e
--- /dev/null
+++ b/src/test/debuginfo/text-to-include-2.txt
@@ -0,0 +1 @@
+some text to include in another file as string 2. \ No newline at end of file
diff --git a/src/test/debuginfo/text-to-include-3.txt b/src/test/debuginfo/text-to-include-3.txt
new file mode 100644
index 000000000..6163f7dd4
--- /dev/null
+++ b/src/test/debuginfo/text-to-include-3.txt
@@ -0,0 +1 @@
+some text to include in another file as string 3.. \ No newline at end of file
diff --git a/src/test/debuginfo/thread-names.rs b/src/test/debuginfo/thread-names.rs
new file mode 100644
index 000000000..7a35a5189
--- /dev/null
+++ b/src/test/debuginfo/thread-names.rs
@@ -0,0 +1,51 @@
+// compile-flags:-g
+// We can't set the main thread name on Linux because it renames the process (#97191)
+// ignore-linux
+// ignore-android
+// ignore-dragonfly
+// ignore-emscripten
+// ignore-freebsd
+// ignore-haiku
+// ignore-ios
+// ignore-netbsd
+// ignore-openbsd
+// ignore-solaris
+// ignore-sgx
+// ignore-windows-gnu
+
+// === GDB TESTS ==================================================================================
+//
+// gdb-command:run
+//
+// gdb-command:info threads
+// gdb-check: 1 Thread [...] [...] "main" [...]
+// gdb-check:* 2 Thread [...] [...] "my new thread" [...]
+
+// === LLDB TESTS =================================================================================
+//
+// lldb-command:run
+//
+// lldb-command:thread info 1
+// lldb-check:thread #1:[...]name = 'main'[...]
+// lldb-command:thread info 2
+// lldb-check:thread #2:[...]name = 'my new thread'[...]
+
+// === CDB TESTS ==================================================================================
+//
+// cdb-command:g
+//
+// cdb-command:~
+// cdb-check: 0 Id: [...] Suspend: 1 Teb: [...] Unfrozen "main"
+// cdb-check:. [...] Id: [...] Suspend: 1 Teb: [...] Unfrozen "my new thread"
+
+use std::thread;
+
+fn main() {
+ let handle = thread::Builder::new().name("my new thread".into()).spawn(|| {
+ zzz(); // #break
+ }).unwrap();
+
+ handle.join().unwrap();
+}
+
+fn zzz() {}
diff --git a/src/test/debuginfo/thread.rs b/src/test/debuginfo/thread.rs
new file mode 100644
index 000000000..388d50c5c
--- /dev/null
+++ b/src/test/debuginfo/thread.rs
@@ -0,0 +1,31 @@
+// Testing the the display of JoinHandle and Thread in cdb.
+
+// cdb-only
+// min-cdb-version: 10.0.18317.1001
+// compile-flags:-g
+
+// === CDB TESTS ==================================================================================
+//
+// cdb-command:g
+//
+// cdb-command:dx join_handle,d
+// cdb-check:join_handle,d [Type: std::thread::JoinHandle<tuple$<> >]
+// cdb-check: [...] __0 [Type: std::thread::JoinInner<tuple$<> >]
+//
+// cdb-command:dx t,d
+// cdb-check:t,d : [...] [Type: std::thread::Thread *]
+// cdb-check:[...] inner [...][Type: core::pin::Pin<alloc::sync::Arc<std::thread::Inner> >]
+
+use std::thread;
+
+#[allow(unused_variables)]
+fn main()
+{
+ let join_handle = thread::spawn(|| {
+ println!("Initialize a thread");
+ });
+ let t = join_handle.thread();
+ zzz(); // #break
+}
+
+fn zzz() {}
diff --git a/src/test/debuginfo/trait-pointers.rs b/src/test/debuginfo/trait-pointers.rs
new file mode 100644
index 000000000..e12daaf11
--- /dev/null
+++ b/src/test/debuginfo/trait-pointers.rs
@@ -0,0 +1,27 @@
+// min-lldb-version: 310
+
+// compile-flags:-g
+// gdb-command:run
+// lldb-command:run
+
+#![allow(unused_variables)]
+#![feature(omit_gdb_pretty_printer_section)]
+#![omit_gdb_pretty_printer_section]
+
+trait Trait {
+ fn method(&self) -> isize { 0 }
+}
+
+struct Struct {
+ a: isize,
+ b: f64
+}
+
+impl Trait for Struct {}
+
+// There is no real test here yet. Just make sure that it compiles without crashing.
+fn main() {
+ let stack_struct = Struct { a:0, b: 1.0 };
+ let reference: &Trait = &stack_struct as &Trait;
+ let unique: Box<Trait> = Box::new(Struct { a:2, b: 3.0 }) as Box<Trait>;
+}
diff --git a/src/test/debuginfo/tuple-in-struct.rs b/src/test/debuginfo/tuple-in-struct.rs
new file mode 100644
index 000000000..759eab8e8
--- /dev/null
+++ b/src/test/debuginfo/tuple-in-struct.rs
@@ -0,0 +1,153 @@
+// min-lldb-version: 310
+
+// compile-flags:-g
+
+// gdb-command:run
+
+// gdb-command:print no_padding1
+// gdbg-check:$1 = {x = {__0 = 0, __1 = 1}, y = 2, z = {__0 = 3, __1 = 4, __2 = 5}}
+// gdbr-check:$1 = tuple_in_struct::NoPadding1 {x: (0, 1), y: 2, z: (3, 4, 5)}
+// gdb-command:print no_padding2
+// gdbg-check:$2 = {x = {__0 = 6, __1 = 7}, y = {__0 = {__0 = 8, __1 = 9}, __1 = 10}}
+// gdbr-check:$2 = tuple_in_struct::NoPadding2 {x: (6, 7), y: ((8, 9), 10)}
+
+// gdb-command:print tuple_internal_padding
+// gdbg-check:$3 = {x = {__0 = 11, __1 = 12}, y = {__0 = 13, __1 = 14}}
+// gdbr-check:$3 = tuple_in_struct::TupleInternalPadding {x: (11, 12), y: (13, 14)}
+// gdb-command:print struct_internal_padding
+// gdbg-check:$4 = {x = {__0 = 15, __1 = 16}, y = {__0 = 17, __1 = 18}}
+// gdbr-check:$4 = tuple_in_struct::StructInternalPadding {x: (15, 16), y: (17, 18)}
+// gdb-command:print both_internally_padded
+// gdbg-check:$5 = {x = {__0 = 19, __1 = 20, __2 = 21}, y = {__0 = 22, __1 = 23}}
+// gdbr-check:$5 = tuple_in_struct::BothInternallyPadded {x: (19, 20, 21), y: (22, 23)}
+
+// gdb-command:print single_tuple
+// gdbg-check:$6 = {x = {__0 = 24, __1 = 25, __2 = 26}}
+// gdbr-check:$6 = tuple_in_struct::SingleTuple {x: (24, 25, 26)}
+
+// gdb-command:print tuple_padded_at_end
+// gdbg-check:$7 = {x = {__0 = 27, __1 = 28}, y = {__0 = 29, __1 = 30}}
+// gdbr-check:$7 = tuple_in_struct::TuplePaddedAtEnd {x: (27, 28), y: (29, 30)}
+// gdb-command:print struct_padded_at_end
+// gdbg-check:$8 = {x = {__0 = 31, __1 = 32}, y = {__0 = 33, __1 = 34}}
+// gdbr-check:$8 = tuple_in_struct::StructPaddedAtEnd {x: (31, 32), y: (33, 34)}
+// gdb-command:print both_padded_at_end
+// gdbg-check:$9 = {x = {__0 = 35, __1 = 36, __2 = 37}, y = {__0 = 38, __1 = 39}}
+// gdbr-check:$9 = tuple_in_struct::BothPaddedAtEnd {x: (35, 36, 37), y: (38, 39)}
+
+// gdb-command:print mixed_padding
+// gdbg-check:$10 = {x = {__0 = {__0 = 40, __1 = 41, __2 = 42}, __1 = {__0 = 43, __1 = 44}}, y = {__0 = 45, __1 = 46, __2 = 47, __3 = 48}}
+// gdbr-check:$10 = tuple_in_struct::MixedPadding {x: ((40, 41, 42), (43, 44)), y: (45, 46, 47, 48)}
+
+#![allow(unused_variables)]
+#![feature(omit_gdb_pretty_printer_section)]
+#![omit_gdb_pretty_printer_section]
+
+struct NoPadding1 {
+ x: (i32, i32),
+ y: i32,
+ z: (i32, i32, i32)
+}
+
+struct NoPadding2 {
+ x: (i32, i32),
+ y: ((i32, i32), i32)
+}
+
+struct TupleInternalPadding {
+ x: (i16, i32),
+ y: (i32, i64)
+}
+
+struct StructInternalPadding {
+ x: (i16, i16),
+ y: (i64, i64)
+}
+
+struct BothInternallyPadded {
+ x: (i16, i32, i32),
+ y: (i32, i64)
+}
+
+struct SingleTuple {
+ x: (i16, i32, i64)
+}
+
+struct TuplePaddedAtEnd {
+ x: (i32, i16),
+ y: (i64, i32)
+}
+
+struct StructPaddedAtEnd {
+ x: (i64, i64),
+ y: (i16, i16)
+}
+
+struct BothPaddedAtEnd {
+ x: (i32, i32, i16),
+ y: (i64, i32)
+}
+
+// Data-layout (padding signified by dots, one column = 2 bytes):
+// [a.bbc...ddddee..ffffg.hhi...]
+struct MixedPadding {
+ x: ((i16, i32, i16), (i64, i32)),
+ y: (i64, i16, i32, i16)
+}
+
+
+fn main() {
+ let no_padding1 = NoPadding1 {
+ x: (0, 1),
+ y: 2,
+ z: (3, 4, 5)
+ };
+
+ let no_padding2 = NoPadding2 {
+ x: (6, 7),
+ y: ((8, 9), 10)
+ };
+
+ let tuple_internal_padding = TupleInternalPadding {
+ x: (11, 12),
+ y: (13, 14)
+ };
+
+ let struct_internal_padding = StructInternalPadding {
+ x: (15, 16),
+ y: (17, 18)
+ };
+
+ let both_internally_padded = BothInternallyPadded {
+ x: (19, 20, 21),
+ y: (22, 23)
+ };
+
+ let single_tuple = SingleTuple {
+ x: (24, 25, 26)
+ };
+
+ let tuple_padded_at_end = TuplePaddedAtEnd {
+ x: (27, 28),
+ y: (29, 30)
+ };
+
+ let struct_padded_at_end = StructPaddedAtEnd {
+ x: (31, 32),
+ y: (33, 34)
+ };
+
+ let both_padded_at_end = BothPaddedAtEnd {
+ x: (35, 36, 37),
+ y: (38, 39)
+ };
+
+ let mixed_padding = MixedPadding {
+ x: ((40, 41, 42), (43, 44)),
+ y: (45, 46, 47, 48)
+ };
+
+ zzz(); // #break
+}
+
+fn zzz() {()}
diff --git a/src/test/debuginfo/tuple-in-tuple.rs b/src/test/debuginfo/tuple-in-tuple.rs
new file mode 100644
index 000000000..578db74e9
--- /dev/null
+++ b/src/test/debuginfo/tuple-in-tuple.rs
@@ -0,0 +1,147 @@
+// min-lldb-version: 310
+
+// compile-flags:-g
+
+// === GDB TESTS ===================================================================================
+
+// gdb-command:run
+
+// gdb-command:print no_padding1
+// gdbg-check:$1 = {__0 = {__0 = 0, __1 = 1}, __1 = 2, __2 = 3}
+// gdbr-check:$1 = ((0, 1), 2, 3)
+// gdb-command:print no_padding2
+// gdbg-check:$2 = {__0 = 4, __1 = {__0 = 5, __1 = 6}, __2 = 7}
+// gdbr-check:$2 = (4, (5, 6), 7)
+// gdb-command:print no_padding3
+// gdbg-check:$3 = {__0 = 8, __1 = 9, __2 = {__0 = 10, __1 = 11}}
+// gdbr-check:$3 = (8, 9, (10, 11))
+
+// gdb-command:print internal_padding1
+// gdbg-check:$4 = {__0 = 12, __1 = {__0 = 13, __1 = 14}}
+// gdbr-check:$4 = (12, (13, 14))
+// gdb-command:print internal_padding2
+// gdbg-check:$5 = {__0 = 15, __1 = {__0 = 16, __1 = 17}}
+// gdbr-check:$5 = (15, (16, 17))
+
+// gdb-command:print padding_at_end1
+// gdbg-check:$6 = {__0 = 18, __1 = {__0 = 19, __1 = 20}}
+// gdbr-check:$6 = (18, (19, 20))
+// gdb-command:print padding_at_end2
+// gdbg-check:$7 = {__0 = {__0 = 21, __1 = 22}, __1 = 23}
+// gdbr-check:$7 = ((21, 22), 23)
+
+
+// === LLDB TESTS ==================================================================================
+
+// lldb-command:run
+
+// lldb-command:print no_padding1
+// lldbg-check:[...]$0 = { 0 = { 0 = 0 1 = 1 } 1 = 2 2 = 3 }
+// lldbr-check:(((u32, u32), u32, u32)) no_padding1 = { 0 = { 0 = 0 1 = 1 } 1 = 2 2 = 3 }
+// lldb-command:print no_padding2
+// lldbg-check:[...]$1 = { 0 = 4 1 = { 0 = 5 1 = 6 } 2 = 7 }
+// lldbr-check:((u32, (u32, u32), u32)) no_padding2 = { 0 = 4 1 = { 0 = 5 1 = 6 } 2 = 7 }
+// lldb-command:print no_padding3
+// lldbg-check:[...]$2 = { 0 = 8 1 = 9 2 = { 0 = 10 1 = 11 } }
+// lldbr-check:((u32, u32, (u32, u32))) no_padding3 = { 0 = 8 1 = 9 2 = { 0 = 10 1 = 11 } }
+
+// lldb-command:print internal_padding1
+// lldbg-check:[...]$3 = { 0 = 12 1 = { 0 = 13 1 = 14 } }
+// lldbr-check:((i16, (i32, i32))) internal_padding1 = { 0 = 12 1 = { 0 = 13 1 = 14 } }
+// lldb-command:print internal_padding2
+// lldbg-check:[...]$4 = { 0 = 15 1 = { 0 = 16 1 = 17 } }
+// lldbr-check:((i16, (i16, i32))) internal_padding2 = { 0 = 15 1 = { 0 = 16 1 = 17 } }
+
+// lldb-command:print padding_at_end1
+// lldbg-check:[...]$5 = { 0 = 18 1 = { 0 = 19 1 = 20 } }
+// lldbr-check:((i32, (i32, i16))) padding_at_end1 = { 0 = 18 1 = { 0 = 19 1 = 20 } }
+// lldb-command:print padding_at_end2
+// lldbg-check:[...]$6 = { 0 = { 0 = 21 1 = 22 } 1 = 23 }
+// lldbr-check:(((i32, i16), i32)) padding_at_end2 = { 0 = { 0 = 21 1 = 22 } 1 = 23 }
+
+
+// === CDB TESTS ==================================================================================
+
+// cdb-command: g
+
+// cdb-command:dx no_padding1,d
+// cdb-check:no_padding1,d [...]: ((0, 1), 2, 3) [Type: tuple$<tuple$<u32,u32>,u32,u32>]
+// cdb-check:[...][0] : (0, 1) [Type: tuple$<u32,u32>]
+// cdb-check:[...][1] : 2 [Type: [...]]
+// cdb-check:[...][2] : 3 [Type: [...]]
+// cdb-command:dx no_padding1.__0,d
+// cdb-check:no_padding1.__0,d [...]: (0, 1) [Type: tuple$<u32,u32>]
+// cdb-check:[...][0] : 0 [Type: [...]]
+// cdb-check:[...][1] : 1 [Type: [...]]
+// cdb-command:dx no_padding2,d
+// cdb-check:no_padding2,d [...]: (4, (5, 6), 7) [Type: tuple$<u32,tuple$<u32,u32>,u32>]
+// cdb-check:[...][0] : 4 [Type: [...]]
+// cdb-check:[...][1] : (5, 6) [Type: tuple$<u32,u32>]
+// cdb-check:[...][2] : 7 [Type: [...]]
+// cdb-command:dx no_padding2.__1,d
+// cdb-check:no_padding2.__1,d [...]: (5, 6) [Type: tuple$<u32,u32>]
+// cdb-check:[...][0] : 5 [Type: [...]]
+// cdb-check:[...][1] : 6 [Type: [...]]
+// cdb-command:dx no_padding3,d
+// cdb-check:no_padding3,d [...]: (8, 9, (10, 11)) [Type: tuple$<u32,u32,tuple$<u32,u32> >]
+// cdb-check:[...][0] : 8 [Type: [...]]
+// cdb-check:[...][1] : 9 [Type: [...]]
+// cdb-check:[...][2] : (10, 11) [Type: tuple$<u32,u32>]
+// cdb-command:dx no_padding3.__2,d
+// cdb-check:no_padding3.__2,d [...]: (10, 11) [Type: tuple$<u32,u32>]
+// cdb-check:[...][0] : 10 [Type: [...]]
+// cdb-check:[...][1] : 11 [Type: [...]]
+
+// cdb-command:dx internal_padding1,d
+// cdb-check:internal_padding1,d [...]: (12, (13, 14)) [Type: tuple$<i16,tuple$<i32,i32> >]
+// cdb-check:[...][0] : 12 [Type: [...]]
+// cdb-check:[...][1] : (13, 14) [Type: tuple$<i32,i32>]
+// cdb-command:dx internal_padding1.__1,d
+// cdb-check:internal_padding1.__1,d [...]: (13, 14) [Type: tuple$<i32,i32>]
+// cdb-check:[...][0] : 13 [Type: [...]]
+// cdb-check:[...][1] : 14 [Type: [...]]
+// cdb-command:dx internal_padding2,d
+// cdb-check:internal_padding2,d [...]: (15, (16, 17)) [Type: tuple$<i16,tuple$<i16,i32> >]
+// cdb-check:[...][0] : 15 [Type: [...]]
+// cdb-check:[...][1] : (16, 17) [Type: tuple$<i16,i32>]
+// cdb-command:dx internal_padding2.__1,d
+// cdb-check:internal_padding2.__1,d [...]: (16, 17) [Type: tuple$<i16,i32>]
+// cdb-check:[...][0] : 16 [Type: [...]]
+// cdb-check:[...][1] : 17 [Type: [...]]
+
+// cdb-command:dx padding_at_end1,d
+// cdb-check:padding_at_end1,d [...]: (18, (19, 20)) [Type: tuple$<i32,tuple$<i32,i16> >]
+// cdb-check:[...][0] : 18 [Type: [...]]
+// cdb-check:[...][1] : (19, 20) [Type: tuple$<i32,i16>]
+// cdb-command:dx padding_at_end1.__1,d
+// cdb-check:padding_at_end1.__1,d [...][Type: tuple$<i32,i16>]
+// cdb-check:[...][0] : 19 [Type: [...]]
+// cdb-check:[...][1] : 20 [Type: [...]]
+// cdb-command:dx padding_at_end2,d
+// cdb-check:padding_at_end2,d [...]: ((21, 22), 23) [Type: tuple$<tuple$<i32,i16>,i32>]
+// cdb-check:[...][0] : (21, 22) [Type: tuple$<i32,i16>]
+// cdb-check:[...][1] : 23 [Type: [...]]
+// cdb-command:dx padding_at_end2.__0,d
+// cdb-check:padding_at_end2.__0,d [...]: (21, 22) [Type: tuple$<i32,i16>]
+// cdb-check:[...][0] : 21 [Type: [...]]
+// cdb-check:[...][1] : 22 [Type: [...]]
+
+#![allow(unused_variables)]
+#![feature(omit_gdb_pretty_printer_section)]
+#![omit_gdb_pretty_printer_section]
+
+fn main() {
+ let no_padding1: ((u32, u32), u32, u32) = ((0, 1), 2, 3);
+ let no_padding2: (u32, (u32, u32), u32) = (4, (5, 6), 7);
+ let no_padding3: (u32, u32, (u32, u32)) = (8, 9, (10, 11));
+
+ let internal_padding1: (i16, (i32, i32)) = (12, (13, 14));
+ let internal_padding2: (i16, (i16, i32)) = (15, (16, 17));
+
+ let padding_at_end1: (i32, (i32, i16)) = (18, (19, 20));
+ let padding_at_end2: ((i32, i16), i32) = ((21, 22), 23);
+
+ zzz(); // #break
+}
+
+fn zzz() {()}
diff --git a/src/test/debuginfo/tuple-struct.rs b/src/test/debuginfo/tuple-struct.rs
new file mode 100644
index 000000000..b8702f970
--- /dev/null
+++ b/src/test/debuginfo/tuple-struct.rs
@@ -0,0 +1,89 @@
+// min-lldb-version: 310
+
+// compile-flags:-g
+
+// === GDB TESTS ===================================================================================
+
+// gdb-command:run
+
+// gdb-command:print no_padding16
+// gdbg-check:$1 = {__0 = 10000, __1 = -10001}
+// gdbr-check:$1 = tuple_struct::NoPadding16 (10000, -10001)
+
+// gdb-command:print no_padding32
+// gdbg-check:$2 = {__0 = -10002, __1 = -10003.5, __2 = 10004}
+// gdbr-check:$2 = tuple_struct::NoPadding32 (-10002, -10003.5, 10004)
+
+// gdb-command:print no_padding64
+// gdbg-check:$3 = {__0 = -10005.5, __1 = 10006, __2 = 10007}
+// gdbr-check:$3 = tuple_struct::NoPadding64 (-10005.5, 10006, 10007)
+
+// gdb-command:print no_padding163264
+// gdbg-check:$4 = {__0 = -10008, __1 = 10009, __2 = 10010, __3 = 10011}
+// gdbr-check:$4 = tuple_struct::NoPadding163264 (-10008, 10009, 10010, 10011)
+
+// gdb-command:print internal_padding
+// gdbg-check:$5 = {__0 = 10012, __1 = -10013}
+// gdbr-check:$5 = tuple_struct::InternalPadding (10012, -10013)
+
+// gdb-command:print padding_at_end
+// gdbg-check:$6 = {__0 = -10014, __1 = 10015}
+// gdbr-check:$6 = tuple_struct::PaddingAtEnd (-10014, 10015)
+
+
+// === LLDB TESTS ==================================================================================
+
+// lldb-command:run
+
+// lldb-command:print no_padding16
+// lldbg-check:[...]$0 = { 0 = 10000 1 = -10001 }
+// lldbr-check:(tuple_struct::NoPadding16) no_padding16 = { 0 = 10000 1 = -10001 }
+
+// lldb-command:print no_padding32
+// lldbg-check:[...]$1 = { 0 = -10002 1 = -10003.5 2 = 10004 }
+// lldbr-check:(tuple_struct::NoPadding32) no_padding32 = { 0 = -10002 1 = -10003.5 2 = 10004 }
+
+// lldb-command:print no_padding64
+// lldbg-check:[...]$2 = { 0 = -10005.5 1 = 10006 2 = 10007 }
+// lldbr-check:(tuple_struct::NoPadding64) no_padding64 = { 0 = -10005.5 1 = 10006 2 = 10007 }
+
+// lldb-command:print no_padding163264
+// lldbg-check:[...]$3 = { 0 = -10008 1 = 10009 2 = 10010 3 = 10011 }
+// lldbr-check:(tuple_struct::NoPadding163264) no_padding163264 = { 0 = -10008 1 = 10009 2 = 10010 3 = 10011 }
+
+// lldb-command:print internal_padding
+// lldbg-check:[...]$4 = { 0 = 10012 1 = -10013 }
+// lldbr-check:(tuple_struct::InternalPadding) internal_padding = { 0 = 10012 1 = -10013 }
+
+// lldb-command:print padding_at_end
+// lldbg-check:[...]$5 = { 0 = -10014 1 = 10015 }
+// lldbr-check:(tuple_struct::PaddingAtEnd) padding_at_end = { 0 = -10014 1 = 10015 }
+
+// This test case mainly makes sure that no field names are generated for tuple structs (as opposed
+// to all fields having the name "<unnamed_field>"). Otherwise they are handled the same a normal
+// structs.
+
+
+#![feature(omit_gdb_pretty_printer_section)]
+#![omit_gdb_pretty_printer_section]
+
+struct NoPadding16(u16, i16);
+struct NoPadding32(i32, f32, u32);
+struct NoPadding64(f64, i64, u64);
+struct NoPadding163264(i16, u16, i32, u64);
+struct InternalPadding(u16, i64);
+struct PaddingAtEnd(i64, u16);
+
+fn main() {
+ let no_padding16 = NoPadding16(10000, -10001);
+ let no_padding32 = NoPadding32(-10002, -10003.5, 10004);
+ let no_padding64 = NoPadding64(-10005.5, 10006, 10007);
+ let no_padding163264 = NoPadding163264(-10008, 10009, 10010, 10011);
+
+ let internal_padding = InternalPadding(10012, -10013);
+ let padding_at_end = PaddingAtEnd(-10014, 10015);
+
+ zzz(); // #break
+}
+
+fn zzz() {()}
diff --git a/src/test/debuginfo/tuple-style-enum.rs b/src/test/debuginfo/tuple-style-enum.rs
new file mode 100644
index 000000000..39ead172e
--- /dev/null
+++ b/src/test/debuginfo/tuple-style-enum.rs
@@ -0,0 +1,90 @@
+// Require a gdb or lldb that can read DW_TAG_variant_part.
+// min-gdb-version: 8.2
+// rust-lldb
+
+// compile-flags:-g
+
+// === GDB TESTS ===================================================================================
+
+// gdb-command:set print union on
+// gdb-command:run
+
+// gdb-command:print case1
+// gdbr-check:$1 = tuple_style_enum::Regular::Case1(0, 31868, 31868, 31868, 31868)
+
+// gdb-command:print case2
+// gdbr-check:$2 = tuple_style_enum::Regular::Case2(0, 286331153, 286331153)
+
+// gdb-command:print case3
+// gdbr-check:$3 = tuple_style_enum::Regular::Case3(0, 6438275382588823897)
+
+// gdb-command:print univariant
+// gdbr-check:$4 = tuple_style_enum::Univariant::TheOnlyCase(-1)
+
+
+// === LLDB TESTS ==================================================================================
+
+// lldb-command:run
+
+// lldb-command:print case1
+// lldbr-check:(tuple_style_enum::Regular::Case1) case1 = { = 0 = 31868 = 31868 = 31868 = 31868 }
+
+// lldb-command:print case2
+// lldbr-check:(tuple_style_enum::Regular::Case2) case2 = Case2 { Case1: 0, Case2: 286331153, Case3: 286331153 }
+
+// lldb-command:print case3
+// lldbr-check:(tuple_style_enum::Regular::Case3) case3 = Case3 { Case1: 0, Case2: 6438275382588823897 }
+
+// lldb-command:print univariant
+// lldbr-check:(tuple_style_enum::Univariant) univariant = { TheOnlyCase = { = -1 } }
+
+#![allow(unused_variables)]
+#![feature(omit_gdb_pretty_printer_section)]
+#![omit_gdb_pretty_printer_section]
+
+use self::Regular::{Case1, Case2, Case3};
+use self::Univariant::TheOnlyCase;
+
+// The first element is to ensure proper alignment, irrespective of the machines word size. Since
+// the size of the discriminant value is machine dependent, this has be taken into account when
+// datatype layout should be predictable as in this case.
+enum Regular {
+ Case1(u64, u16, u16, u16, u16),
+ Case2(u64, u32, u32),
+ Case3(u64, u64)
+}
+
+enum Univariant {
+ TheOnlyCase(i64)
+}
+
+fn main() {
+
+ // In order to avoid endianness trouble all of the following test values consist of a single
+ // repeated byte. This way each interpretation of the union should look the same, no matter if
+ // this is a big or little endian machine.
+
+ // 0b0111110001111100011111000111110001111100011111000111110001111100 = 8970181431921507452
+ // 0b01111100011111000111110001111100 = 2088533116
+ // 0b0111110001111100 = 31868
+ // 0b01111100 = 124
+ let case1 = Case1(0, 31868, 31868, 31868, 31868);
+
+ // 0b0001000100010001000100010001000100010001000100010001000100010001 = 1229782938247303441
+ // 0b00010001000100010001000100010001 = 286331153
+ // 0b0001000100010001 = 4369
+ // 0b00010001 = 17
+ let case2 = Case2(0, 286331153, 286331153);
+
+ // 0b0101100101011001010110010101100101011001010110010101100101011001 = 6438275382588823897
+ // 0b01011001010110010101100101011001 = 1499027801
+ // 0b0101100101011001 = 22873
+ // 0b01011001 = 89
+ let case3 = Case3(0, 6438275382588823897);
+
+ let univariant = TheOnlyCase(-1);
+
+ zzz(); // #break
+}
+
+fn zzz() {()}
diff --git a/src/test/debuginfo/type-names.cdb.js b/src/test/debuginfo/type-names.cdb.js
new file mode 100644
index 000000000..8f8b20bfa
--- /dev/null
+++ b/src/test/debuginfo/type-names.cdb.js
@@ -0,0 +1,17 @@
+// Helper functions for running the type-names.rs test under CDB
+
+// CDB exposes an "object model" via JavaScript that allows you to inspect debugging info - in this
+// case we want to ask the object model for the return and parameter types for a local variable
+// that is a function pointer to make sure that we are emitting the function pointer type in such a
+// way that CDB understands how to parse it.
+
+"use strict";
+
+function getFunctionDetails(name)
+{
+ var localVariable = host.currentThread.Stack.Frames[0].LocalVariables[name];
+ var functionPointerType = localVariable.targetType.genericArguments[0];
+ var functionType = functionPointerType.baseType;
+ host.diagnostics.debugLog("Return Type: ", functionType.functionReturnType, "\n");
+ host.diagnostics.debugLog("Parameter Types: ", functionType.functionParameterTypes, "\n");
+}
diff --git a/src/test/debuginfo/type-names.rs b/src/test/debuginfo/type-names.rs
new file mode 100644
index 000000000..b040a6e74
--- /dev/null
+++ b/src/test/debuginfo/type-names.rs
@@ -0,0 +1,473 @@
+// ignore-lldb
+
+// GDB changed the way that it formatted Foreign types
+// min-gdb-version: 9.2
+
+// compile-flags:-g
+
+// === GDB TESTS ===================================================================================
+
+// gdb-command:run
+
+// STRUCTS
+// gdb-command:whatis simple_struct
+// gdb-check:type = type_names::Struct1
+
+// gdb-command:whatis generic_struct1
+// gdb-check:type = type_names::GenericStruct<type_names::mod1::Struct2, type_names::mod1::mod2::Struct3>
+
+// gdb-command:whatis generic_struct2
+// gdb-check:type = type_names::GenericStruct<type_names::Struct1, extern "fastcall" fn(isize) -> usize>
+
+// gdb-command:whatis mod_struct
+// gdb-check:type = type_names::mod1::Struct2
+
+// ENUMS
+// gdb-command:whatis simple_enum_1
+// gdb-check:type = type_names::Enum1
+
+// gdb-command:whatis simple_enum_2
+// gdb-check:type = type_names::Enum1
+
+// gdb-command:whatis simple_enum_3
+// gdb-check:type = type_names::mod1::Enum2
+
+// gdb-command:whatis generic_enum_1
+// gdb-check:type = type_names::mod1::mod2::Enum3<type_names::mod1::Struct2>
+
+// gdb-command:whatis generic_enum_2
+// gdb-check:type = type_names::mod1::mod2::Enum3<type_names::Struct1>
+
+// TUPLES
+// gdb-command:whatis tuple1
+// gdb-check:type = (u32, type_names::Struct1, type_names::mod1::mod2::Enum3<type_names::mod1::Struct2>)
+
+// gdb-command:whatis tuple2
+// gdb-check:type = ((type_names::Struct1, type_names::mod1::mod2::Struct3), type_names::mod1::Enum2, char)
+
+// BOX
+// gdb-command:whatis box1
+// gdb-check:type = (alloc::boxed::Box<f32, alloc::alloc::Global>, i32)
+
+// gdb-command:whatis box2
+// gdb-check:type = (alloc::boxed::Box<type_names::mod1::mod2::Enum3<f32>, alloc::alloc::Global>, i32)
+
+// REFERENCES
+// gdb-command:whatis ref1
+// gdb-check:type = (&type_names::Struct1, i32)
+
+// gdb-command:whatis ref2
+// gdb-check:type = (&type_names::GenericStruct<char, type_names::Struct1>, i32)
+
+// gdb-command:whatis mut_ref1
+// gdb-check:type = (&mut type_names::Struct1, i32)
+
+// gdb-command:whatis mut_ref2
+// gdb-check:type = (&mut type_names::GenericStruct<type_names::mod1::Enum2, f64>, i32)
+
+// RAW POINTERS
+// gdb-command:whatis mut_ptr1
+// gdb-check:type = (*mut type_names::Struct1, isize)
+
+// gdb-command:whatis mut_ptr2
+// gdb-check:type = (*mut isize, isize)
+
+// gdb-command:whatis mut_ptr3
+// gdb-check:type = (*mut type_names::mod1::mod2::Enum3<type_names::Struct1>, isize)
+
+// gdb-command:whatis const_ptr1
+// gdb-check:type = (*const type_names::Struct1, isize)
+
+// gdb-command:whatis const_ptr2
+// gdb-check:type = (*const isize, isize)
+
+// gdb-command:whatis const_ptr3
+// gdb-check:type = (*const type_names::mod1::mod2::Enum3<type_names::Struct1>, isize)
+
+// VECTORS
+// gdb-command:whatis fixed_size_vec1
+// gdb-check:type = ([type_names::Struct1; 3], i16)
+
+// gdb-command:whatis fixed_size_vec2
+// gdb-check:type = ([usize; 3], i16)
+
+// gdb-command:whatis slice1
+// gdb-check:type = &[usize]
+
+// gdb-command:whatis slice2
+// gdb-check:type = &[type_names::mod1::Enum2]
+
+// TRAITS
+// gdb-command:whatis box_trait
+// gdb-check:type = alloc::boxed::Box<dyn type_names::Trait1, alloc::alloc::Global>
+
+// gdb-command:whatis ref_trait
+// gdb-check:type = &dyn type_names::Trait1
+
+// gdb-command:whatis mut_ref_trait
+// gdb-check:type = &mut dyn type_names::Trait1
+
+// gdb-command:whatis generic_box_trait
+// gdb-check:type = alloc::boxed::Box<dyn type_names::Trait2<i32, type_names::mod1::Struct2>, alloc::alloc::Global>
+
+// gdb-command:whatis generic_ref_trait
+// gdb-check:type = &dyn type_names::Trait2<type_names::Struct1, type_names::Struct1>
+
+// gdb-command:whatis generic_mut_ref_trait
+// gdb-check:type = &mut dyn type_names::Trait2<type_names::mod1::mod2::Struct3, type_names::GenericStruct<usize, isize>>
+
+// gdb-command:whatis no_principal_trait
+// gdb-check:type = alloc::boxed::Box<(dyn core::marker::Send + core::marker::Sync), alloc::alloc::Global>
+
+// gdb-command:whatis has_associated_type_trait
+// gdb-check:type = &(dyn type_names::Trait3<u32, AssocType=isize> + core::marker::Send)
+
+// gdb-command:whatis has_associated_type_but_no_generics_trait
+// gdb-check:type = &dyn type_names::TraitNoGenericsButWithAssocType<Output=isize>
+
+// BARE FUNCTIONS
+// gdb-command:whatis rust_fn
+// gdb-check:type = (fn(core::option::Option<isize>, core::option::Option<&type_names::mod1::Struct2>), usize)
+
+// gdb-command:whatis extern_c_fn
+// gdb-check:type = (extern "C" fn(isize), usize)
+
+// gdb-command:whatis unsafe_fn
+// gdb-check:type = (unsafe fn(core::result::Result<char, f64>), usize)
+
+// gdb-command:whatis rust_fn_with_return_value
+// gdb-check:type = (fn(f64) -> usize, usize)
+
+// gdb-command:whatis extern_c_fn_with_return_value
+// gdb-check:type = (extern "C" fn() -> type_names::Struct1, usize)
+
+// gdb-command:whatis unsafe_fn_with_return_value
+// gdb-check:type = (unsafe fn(type_names::GenericStruct<u16, u8>) -> type_names::mod1::Struct2, usize)
+
+// gdb-command:whatis generic_function_int
+// gdb-check:type = (fn(isize) -> isize, usize)
+
+// gdb-command:whatis generic_function_struct3
+// gdb-check:type = (fn(type_names::mod1::mod2::Struct3) -> type_names::mod1::mod2::Struct3, usize)
+
+// gdb-command:whatis variadic_function
+// gdb-check:type = (unsafe extern "C" fn(*const u8, ...) -> isize, usize)
+
+// CLOSURES
+// gdb-command:whatis closure1
+// gdb-check:type = (type_names::main::{closure_env#0}, usize)
+
+// gdb-command:whatis closure2
+// gdb-check:type = (type_names::main::{closure_env#1}, usize)
+
+// FOREIGN TYPES
+// gdb-command:whatis foreign1
+// gdb-check:type = *mut type_names::{extern#0}::ForeignType1
+
+// gdb-command:whatis foreign2
+// gdb-check:type = *mut type_names::mod1::{extern#0}::ForeignType2
+
+// === CDB TESTS ==================================================================================
+
+// cdb-command: g
+
+// STRUCTS
+// 0-sized structs appear to be optimized away in some cases, so only check the structs that do
+// actually appear.
+// cdb-command:dv /t *_struct
+// cdb-check:struct type_names::GenericStruct<enum$<type_names::mod1::Enum2>,f64> mut_generic_struct = [...]
+
+// ENUMS
+// cdb-command:dv /t *_enum_*
+// cdb-check:union enum$<type_names::Enum1> simple_enum_1 = [...]
+// cdb-check:union enum$<type_names::Enum1> simple_enum_2 = [...]
+// cdb-check:union enum$<type_names::mod1::Enum2> simple_enum_3 = [...]
+// cdb-check:union enum$<type_names::mod1::mod2::Enum3<type_names::mod1::Struct2> > generic_enum_1 = [...]
+// cdb-check:union enum$<type_names::mod1::mod2::Enum3<type_names::Struct1> > generic_enum_2 = [...]
+
+// TUPLES
+// cdb-command:dv /t tuple*
+// cdb-check:struct tuple$<u32,type_names::Struct1,enum$<type_names::mod1::mod2::Enum3<type_names::mod1::Struct2> > > tuple1 = [...]
+// cdb-check:struct tuple$<tuple$<type_names::Struct1,type_names::mod1::mod2::Struct3>,enum$<type_names::mod1::Enum2>,char> tuple2 = [...]
+
+// BOX
+// cdb-command:dv /t box*
+// cdb-check:struct tuple$<alloc::boxed::Box<f32,alloc::alloc::Global>,i32> box1 = [...]
+// cdb-check:struct tuple$<alloc::boxed::Box<enum$<type_names::mod1::mod2::Enum3<f32> >,alloc::alloc::Global>,i32> box2 = [...]
+
+// REFERENCES
+// cdb-command:dv /t *ref*
+// cdb-check:struct tuple$<ref$<type_names::Struct1>,i32> ref1 = [...]
+// cdb-check:struct tuple$<ref$<type_names::GenericStruct<char,type_names::Struct1> >,i32> ref2 = [...]
+// cdb-check:struct tuple$<ref_mut$<type_names::Struct1>,i32> mut_ref1 = [...]
+// cdb-check:struct tuple$<ref_mut$<type_names::GenericStruct<enum$<type_names::mod1::Enum2>,f64> >,i32> mut_ref2 = [...]
+
+// RAW POINTERS
+// cdb-command:dv /t *_ptr*
+// cdb-check:struct tuple$<ptr_mut$<type_names::Struct1>,isize> mut_ptr1 = [...]
+// cdb-check:struct tuple$<ptr_mut$<isize>,isize> mut_ptr2 = [...]
+// cdb-check:struct tuple$<ptr_mut$<enum$<type_names::mod1::mod2::Enum3<type_names::Struct1> > >,isize> mut_ptr3 = [...]
+// cdb-check:struct tuple$<ptr_const$<type_names::Struct1>,isize> const_ptr1 = [...]
+// cdb-check:struct tuple$<ptr_const$<isize>,isize> const_ptr2 = [...]
+// cdb-check:struct tuple$<ptr_const$<enum$<type_names::mod1::mod2::Enum3<type_names::Struct1> > >,isize> const_ptr3 = [...]
+
+// VECTORS
+// cdb-command:dv /t *vec*
+// cdb-check:struct tuple$<array$<type_names::Struct1,3>,i16> fixed_size_vec1 = [...]
+// cdb-check:struct tuple$<array$<usize,3>,i16> fixed_size_vec2 = [...]
+// cdb-check:struct alloc::vec::Vec<usize,alloc::alloc::Global> vec1 = [...]
+// cdb-check:struct alloc::vec::Vec<enum$<type_names::mod1::Enum2>,alloc::alloc::Global> vec2 = [...]
+// cdb-command:dv /t slice*
+// cdb-check:struct slice$<usize> slice1 = [...]
+// cdb-check:struct slice$<enum$<type_names::mod1::Enum2> > slice2 = [...]
+
+// TRAITS
+// cdb-command:dv /t *_trait
+// cdb-check:struct ref_mut$<dyn$<type_names::Trait2<type_names::mod1::mod2::Struct3,type_names::GenericStruct<usize,isize> > > > generic_mut_ref_trait = [...]
+// cdb-check:struct ref$<dyn$<type_names::Trait2<type_names::Struct1,type_names::Struct1> > > generic_ref_trait = [...]
+// cdb-check:struct alloc::boxed::Box<dyn$<type_names::Trait2<i32,type_names::mod1::Struct2> >,alloc::alloc::Global> generic_box_trait = [...]
+// cdb-check:struct alloc::boxed::Box<dyn$<type_names::Trait1>,alloc::alloc::Global> box_trait = [...]
+// cdb-check:struct ref$<dyn$<type_names::Trait1> > ref_trait = [...]
+// cdb-check:struct ref_mut$<dyn$<type_names::Trait1> > mut_ref_trait = [...]
+// cdb-check:struct alloc::boxed::Box<dyn$<core::marker::Send,core::marker::Sync>,alloc::alloc::Global> no_principal_trait = [...]
+// cdb-check:struct ref$<dyn$<type_names::Trait3<u32,assoc$<AssocType,isize> >,core::marker::Send> > has_associated_type_trait = struct ref$<dyn$<type_names::Trait3<u32,assoc$<AssocType,isize> >,core::marker::Send> >
+// cdb-check:struct ref$<dyn$<type_names::TraitNoGenericsButWithAssocType<assoc$<Output,isize> > > > has_associated_type_but_no_generics_trait = struct ref$<dyn$<type_names::TraitNoGenericsButWithAssocType<assoc$<Output,isize> > > >
+
+// BARE FUNCTIONS
+// cdb-command:dv /t *_fn*
+// cdb-check:struct tuple$<type_names::mod1::Struct2 (*)(type_names::GenericStruct<u16,u8>),usize> unsafe_fn_with_return_value = [...]
+// cdb-check:struct tuple$<type_names::Struct1 (*)(),usize> extern_c_fn_with_return_value = [...]
+// cdb-check:struct tuple$<usize (*)(f64),usize> rust_fn_with_return_value = [...]
+// cdb-check:struct tuple$<void (*)(enum$<core::result::Result<char,f64> >),usize> unsafe_fn = [...]
+// cdb-check:struct tuple$<void (*)(isize),usize> extern_c_fn = [...]
+// cdb-check:struct tuple$<void (*)(enum$<core::option::Option<isize> >,enum$<core::option::Option<ref$<type_names::mod1::Struct2> >, 1, [...], Some>),usize> rust_fn = [...]
+// cdb-command:dv /t *_function*
+// cdb-check:struct tuple$<isize (*)(ptr_const$<u8>, ...),usize> variadic_function = [...]
+// cdb-check:struct tuple$<type_names::mod1::mod2::Struct3 (*)(type_names::mod1::mod2::Struct3),usize> generic_function_struct3 = [...]
+// cdb-check:struct tuple$<isize (*)(isize),usize> generic_function_int = [...]
+// cdb-command:dx Debugger.State.Scripts.@"type-names.cdb".Contents.getFunctionDetails("rust_fn")
+// cdb-check:Return Type: void
+// cdb-check:Parameter Types: enum$<core::option::Option<isize> >,enum$<core::option::Option<ref$<type_names::mod1::Struct2> >, 1, [...], Some>
+// cdb-command:dx Debugger.State.Scripts.@"type-names.cdb".Contents.getFunctionDetails("rust_fn_with_return_value")
+// cdb-check:Return Type: usize
+// cdb-check:Parameter Types: f64
+// cdb-command:dx Debugger.State.Scripts.@"type-names.cdb".Contents.getFunctionDetails("extern_c_fn_with_return_value")
+// cdb-check:Return Type: type_names::Struct1
+// cdb-check:Parameter Types:
+
+// CLOSURES
+// cdb-command:dv /t closure*
+// cdb-check:struct tuple$<type_names::main::closure_env$1,usize> closure2 = [...]
+// cdb-check:struct tuple$<type_names::main::closure_env$0,usize> closure1 = [...]
+
+// FOREIGN TYPES
+// cdb-command:dv /t foreign*
+// cdb-check:struct type_names::mod1::extern$0::ForeignType2 * foreign2 = [...]
+// cdb-check:struct type_names::extern$0::ForeignType1 * foreign1 = [...]
+
+#![allow(unused_variables)]
+#![feature(omit_gdb_pretty_printer_section)]
+#![omit_gdb_pretty_printer_section]
+#![feature(extern_types)]
+
+use self::Enum1::{Variant1, Variant2};
+use std::marker::PhantomData;
+use std::ptr;
+
+pub struct Struct1;
+struct GenericStruct<T1, T2>(PhantomData<(T1, T2)>);
+
+enum Enum1 {
+ Variant1,
+ Variant2(isize),
+}
+
+extern "C" {
+ type ForeignType1;
+}
+
+mod mod1 {
+ pub struct Struct2;
+
+ pub enum Enum2 {
+ Variant1,
+ Variant2(super::Struct1),
+ }
+
+ pub mod mod2 {
+ pub use self::Enum3::{Variant1, Variant2};
+ pub struct Struct3;
+
+ pub enum Enum3<T> {
+ Variant1,
+ Variant2(T),
+ }
+ }
+
+ extern "C" {
+ pub type ForeignType2;
+ }
+}
+
+trait Trait1 {
+ fn dummy(&self) {}
+}
+trait Trait2<T1, T2> {
+ fn dummy(&self, _: T1, _: T2) {}
+}
+trait Trait3<T> {
+ type AssocType;
+ fn dummy(&self) -> T {
+ panic!()
+ }
+}
+trait TraitNoGenericsButWithAssocType {
+ type Output;
+ fn foo(&self) -> Self::Output;
+}
+
+impl Trait1 for isize {}
+impl<T1, T2> Trait2<T1, T2> for isize {}
+impl<T> Trait3<T> for isize {
+ type AssocType = isize;
+}
+impl TraitNoGenericsButWithAssocType for isize {
+ type Output = isize;
+ fn foo(&self) -> Self::Output {
+ *self
+ }
+}
+
+fn rust_fn(_: Option<isize>, _: Option<&mod1::Struct2>) {}
+extern "C" fn extern_c_fn(_: isize) {}
+unsafe fn unsafe_fn(_: Result<char, f64>) {}
+
+fn rust_fn_with_return_value(_: f64) -> usize {
+ 4
+}
+extern "C" fn extern_c_fn_with_return_value() -> Struct1 {
+ Struct1
+}
+unsafe fn unsafe_fn_with_return_value(_: GenericStruct<u16, u8>) -> mod1::Struct2 {
+ mod1::Struct2
+}
+
+fn generic_function<T>(x: T) -> T {
+ x
+}
+
+#[allow(improper_ctypes)]
+extern "C" {
+ fn printf(_: *const u8, ...) -> isize;
+}
+
+// In many of the cases below, the type that is actually under test is wrapped
+// in a tuple, e.g., Box<T>, references, raw pointers, fixed-size vectors, ...
+// This is because GDB will not print the type name from DWARF debuginfo for
+// some kinds of types (pointers, arrays, functions, ...)
+// Since tuples are structs as far as GDB is concerned, their name will be
+// printed correctly, so the tests below just construct a tuple type that will
+// then *contain* the type name that we want to see.
+fn main() {
+ // Structs
+ let simple_struct = Struct1;
+ let generic_struct1: GenericStruct<mod1::Struct2, mod1::mod2::Struct3> =
+ GenericStruct(PhantomData);
+ let generic_struct2: GenericStruct<Struct1, extern "fastcall" fn(isize) -> usize> =
+ GenericStruct(PhantomData);
+ let mod_struct = mod1::Struct2;
+
+ // Enums
+ let simple_enum_1 = Variant1;
+ let simple_enum_2 = Variant2(0);
+ let simple_enum_3 = mod1::Enum2::Variant2(Struct1);
+
+ let generic_enum_1: mod1::mod2::Enum3<mod1::Struct2> = mod1::mod2::Variant1;
+ let generic_enum_2 = mod1::mod2::Variant2(Struct1);
+
+ // Tuples
+ let tuple1 = (8u32, Struct1, mod1::mod2::Variant2(mod1::Struct2));
+ let tuple2 = ((Struct1, mod1::mod2::Struct3), mod1::Enum2::Variant1, 'x');
+
+ // Box
+ let box1 = (Box::new(1f32), 0i32);
+ let box2 = (Box::new(mod1::mod2::Variant2(1f32)), 0i32);
+
+ // References
+ let ref1 = (&Struct1, 0i32);
+ let ref2 = (&GenericStruct::<char, Struct1>(PhantomData), 0i32);
+
+ let mut mut_struct1 = Struct1;
+ let mut mut_generic_struct = GenericStruct::<mod1::Enum2, f64>(PhantomData);
+ let mut_ref1 = (&mut mut_struct1, 0i32);
+ let mut_ref2 = (&mut mut_generic_struct, 0i32);
+
+ // Raw Pointers
+ let mut_ptr1: (*mut Struct1, isize) = (ptr::null_mut(), 0);
+ let mut_ptr2: (*mut isize, isize) = (ptr::null_mut(), 0);
+ let mut_ptr3: (*mut mod1::mod2::Enum3<Struct1>, isize) = (ptr::null_mut(), 0);
+
+ let const_ptr1: (*const Struct1, isize) = (ptr::null(), 0);
+ let const_ptr2: (*const isize, isize) = (ptr::null(), 0);
+ let const_ptr3: (*const mod1::mod2::Enum3<Struct1>, isize) = (ptr::null(), 0);
+
+ // Vectors
+ let fixed_size_vec1 = ([Struct1, Struct1, Struct1], 0i16);
+ let fixed_size_vec2 = ([0_usize, 1, 2], 0i16);
+
+ let vec1 = vec![0_usize, 2, 3];
+ let slice1 = &*vec1;
+ let vec2 = vec![mod1::Enum2::Variant2(Struct1)];
+ let slice2 = &*vec2;
+
+ // Trait Objects
+ let box_trait = Box::new(0_isize) as Box<dyn Trait1>;
+ let ref_trait = &0_isize as &dyn Trait1;
+ let mut mut_int1 = 0_isize;
+ let mut_ref_trait = (&mut mut_int1) as &mut dyn Trait1;
+ let no_principal_trait = Box::new(0_isize) as Box<(dyn Send + Sync)>;
+ let has_associated_type_trait = &0_isize as &(dyn Trait3<u32, AssocType = isize> + Send);
+ let has_associated_type_but_no_generics_trait =
+ &0_isize as &dyn TraitNoGenericsButWithAssocType<Output = isize>;
+
+ let generic_box_trait = Box::new(0_isize) as Box<dyn Trait2<i32, mod1::Struct2>>;
+ let generic_ref_trait = (&0_isize) as &dyn Trait2<Struct1, Struct1>;
+
+ let mut generic_mut_ref_trait_impl = 0_isize;
+ let generic_mut_ref_trait = (&mut generic_mut_ref_trait_impl)
+ as &mut dyn Trait2<mod1::mod2::Struct3, GenericStruct<usize, isize>>;
+
+ // Bare Functions
+ let rust_fn = (rust_fn, 0_usize);
+ let extern_c_fn = (extern_c_fn, 0_usize);
+ let unsafe_fn = (unsafe_fn, 0_usize);
+
+ let rust_fn_with_return_value = (rust_fn_with_return_value, 0_usize);
+ let extern_c_fn_with_return_value = (extern_c_fn_with_return_value, 0_usize);
+ let unsafe_fn_with_return_value = (unsafe_fn_with_return_value, 0_usize);
+
+ let generic_function_int = (generic_function::<isize>, 0_usize);
+ let generic_function_struct3 = (generic_function::<mod1::mod2::Struct3>, 0_usize);
+
+ let variadic_function = (printf, 0_usize);
+
+ // Closures
+ // I (mw) am a bit unclear about the current state of closures, their
+ // various forms (boxed, unboxed, proc, capture-by-ref, by-val, once) and
+ // how that maps to rustc's internal representation of these forms.
+ // Once closures have reached their 1.0 form, the tests below should
+ // probably be expanded.
+ let closure1 = (|x: isize| {}, 0_usize);
+ let closure2 = (|x: i8, y: f32| (x as f32) + y, 0_usize);
+
+ // Foreign Types
+ let foreign1 = unsafe { 0 as *const ForeignType1 };
+ let foreign2 = unsafe { 0 as *const mod1::ForeignType2 };
+
+ zzz(); // #break
+}
+
+#[inline(never)]
+fn zzz() {
+ ()
+}
diff --git a/src/test/debuginfo/union-smoke.rs b/src/test/debuginfo/union-smoke.rs
new file mode 100644
index 000000000..4d4b6cc96
--- /dev/null
+++ b/src/test/debuginfo/union-smoke.rs
@@ -0,0 +1,48 @@
+// min-lldb-version: 310
+// ignore-gdb // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155
+
+// ignore-gdb-version: 7.11.90 - 7.12.9
+
+// compile-flags:-g
+
+// === GDB TESTS ===================================================================================
+
+// gdb-command:run
+// gdb-command:print u
+// gdbg-check:$1 = {a = {__0 = 2 '\002', __1 = 2 '\002'}, b = 514}
+// gdbr-check:$1 = union_smoke::U {a: (2, 2), b: 514}
+// gdb-command:print union_smoke::SU
+// gdbg-check:$2 = {a = {__0 = 1 '\001', __1 = 1 '\001'}, b = 257}
+// gdbr-check:$2 = union_smoke::U {a: (1, 1), b: 257}
+
+// === LLDB TESTS ==================================================================================
+
+// lldb-command:run
+// lldb-command:print u
+// lldbg-check:[...]$0 = { a = { 0 = '\x02' 1 = '\x02' } b = 514 }
+// lldbr-check:(union_smoke::U) u = { a = { 0 = '\x02' 1 = '\x02' } b = 514 }
+
+// Don't test this with rust-enabled lldb for now; see
+// https://github.com/rust-lang-nursery/lldb/issues/18
+// lldbg-command:print union_smoke::SU
+// lldbg-check:[...]$1 = { a = { 0 = '\x01' 1 = '\x01' } b = 257 }
+
+#![allow(unused)]
+#![feature(omit_gdb_pretty_printer_section)]
+#![omit_gdb_pretty_printer_section]
+
+union U {
+ a: (u8, u8),
+ b: u16,
+}
+
+static mut SU: U = U { a: (1, 1) };
+
+fn main() {
+ let u = U { b: (2 << 8) + 2 };
+ unsafe { SU = U { a: (1, 1) } }
+
+ zzz(); // #break
+}
+
+fn zzz() {()}
diff --git a/src/test/debuginfo/unique-enum.rs b/src/test/debuginfo/unique-enum.rs
new file mode 100644
index 000000000..d7dfaeefe
--- /dev/null
+++ b/src/test/debuginfo/unique-enum.rs
@@ -0,0 +1,74 @@
+// Require a gdb or lldb that can read DW_TAG_variant_part.
+// min-gdb-version: 8.2
+// rust-lldb
+
+// compile-flags:-g
+
+// === GDB TESTS ===================================================================================
+
+// gdb-command:run
+
+// gdb-command:print *the_a
+// gdbr-check:$1 = unique_enum::ABC::TheA{x: 0, y: 8970181431921507452}
+
+// gdb-command:print *the_b
+// gdbr-check:$2 = unique_enum::ABC::TheB(0, 286331153, 286331153)
+
+// gdb-command:print *univariant
+// gdbr-check:$3 = unique_enum::Univariant::TheOnlyCase(123234)
+
+
+// === LLDB TESTS ==================================================================================
+
+// lldb-command:run
+
+// lldb-command:print *the_a
+// lldbr-check:(unique_enum::ABC::TheA) *the_a = TheA { TheA: 0, TheB: 8970181431921507452 }
+
+// lldb-command:print *the_b
+// lldbr-check:(unique_enum::ABC::TheB) *the_b = { = 0 = 286331153 = 286331153 }
+
+// lldb-command:print *univariant
+// lldbr-check:(unique_enum::Univariant) *univariant = { TheOnlyCase = { = 123234 } }
+
+#![allow(unused_variables)]
+#![feature(omit_gdb_pretty_printer_section)]
+#![omit_gdb_pretty_printer_section]
+
+// The first element is to ensure proper alignment, irrespective of the machines word size. Since
+// the size of the discriminant value is machine dependent, this has be taken into account when
+// datatype layout should be predictable as in this case.
+enum ABC {
+ TheA { x: i64, y: i64 },
+ TheB (i64, i32, i32),
+}
+
+// This is a special case since it does not have the implicit discriminant field.
+enum Univariant {
+ TheOnlyCase(i64)
+}
+
+fn main() {
+
+ // In order to avoid endianness trouble all of the following test values consist of a single
+ // repeated byte. This way each interpretation of the union should look the same, no matter if
+ // this is a big or little endian machine.
+
+ // 0b0111110001111100011111000111110001111100011111000111110001111100 = 8970181431921507452
+ // 0b01111100011111000111110001111100 = 2088533116
+ // 0b0111110001111100 = 31868
+ // 0b01111100 = 124
+ let the_a: Box<_> = Box::new(ABC::TheA { x: 0, y: 8970181431921507452 });
+
+ // 0b0001000100010001000100010001000100010001000100010001000100010001 = 1229782938247303441
+ // 0b00010001000100010001000100010001 = 286331153
+ // 0b0001000100010001 = 4369
+ // 0b00010001 = 17
+ let the_b: Box<_> = Box::new(ABC::TheB (0, 286331153, 286331153));
+
+ let univariant: Box<_> = Box::new(Univariant::TheOnlyCase(123234));
+
+ zzz(); // #break
+}
+
+fn zzz() {()}
diff --git a/src/test/debuginfo/unit-type.rs b/src/test/debuginfo/unit-type.rs
new file mode 100644
index 000000000..7aab41a3e
--- /dev/null
+++ b/src/test/debuginfo/unit-type.rs
@@ -0,0 +1,71 @@
+// compile-flags:-g
+
+// We only test Rust-aware versions of GDB:
+// min-gdb-version: 8.2
+
+// === GDB TESTS ===================================================================================
+
+// gdb-command: run
+
+// gdb-command: print _ref
+// gdb-check: $1 = (*mut ()) 0x[...]
+
+// gdb-command: print _ptr
+// gdb-check: $2 = (*mut ()) 0x[...]
+
+// gdb-command: print _local
+// gdb-check: $3 = ()
+
+// gdb-command: print _field
+// gdb-check: $4 = unit_type::_TypeContainingUnitField {_a: 123, _unit: (), _b: 456}
+
+// Check that we can cast "void pointers" to their actual type in the debugger
+// gdb-command: print /x *(_ptr as *const u64)
+// gdb-check: $5 = 0x1122334455667788
+
+// === CDB TESTS ===================================================================================
+
+// cdb-command: g
+// cdb-check: Breakpoint 0 hit
+
+// cdb-command: dx _ref
+// cdb-check: _ref : 0x[...] : () [Type: tuple$<> *]
+
+// cdb-command: dx _ptr
+// cdb-check: _ptr : 0x[...] : () [Type: tuple$<> *]
+
+// cdb-command: dx _local
+// cdb-check: _local : () [Type: tuple$<>]
+
+// cdb-command: dx _field,d
+// cdb-check: _field,d [Type: unit_type::_TypeContainingUnitField]
+// cdb-check: [+0x[...]] _a : 123 [Type: unsigned int]
+// cdb-check: [+0x[...]] _unit : () [Type: tuple$<>]
+// cdb-check: [+0x[...]] _b : 456 [Type: unsigned __int64]
+
+// Check that we can cast "void pointers" to their actual type in the debugger
+// cdb-command: dx ((__int64 *)_ptr),x
+// cdb-check: ((__int64 *)_ptr),x : 0x[...] : 0x1122334455667788 [Type: __int64 *]
+// cdb-check: 0x1122334455667788 [Type: __int64]
+
+struct _TypeContainingUnitField {
+ _a: u32,
+ _unit: (),
+ _b: u64,
+}
+
+fn foo(_ref: &(), _ptr: *const ()) {
+ let _local = ();
+ let _field = _TypeContainingUnitField { _a: 123, _unit: (), _b: 456 };
+
+ zzz(); // #break
+}
+
+fn main() {
+ let pointee = 0x1122_3344_5566_7788i64;
+
+ foo(&(), &pointee as *const i64 as *const ());
+}
+
+#[inline(never)]
+fn zzz() {}
diff --git a/src/test/debuginfo/unreachable-locals.rs b/src/test/debuginfo/unreachable-locals.rs
new file mode 100644
index 000000000..5787f819c
--- /dev/null
+++ b/src/test/debuginfo/unreachable-locals.rs
@@ -0,0 +1,158 @@
+// min-lldb-version: 310
+
+// compile-flags:-g
+
+#![allow(unused_variables)]
+#![feature(omit_gdb_pretty_printer_section)]
+#![omit_gdb_pretty_printer_section]
+
+// No need to actually run the debugger, just make sure that the compiler can
+// handle locals in unreachable code.
+
+fn after_return() {
+ return;
+ let x = "0";
+ let (ref y,z) = (1i32, 2u32);
+ match (20i32, 'c') {
+ (a, ref b) => {}
+ }
+ for a in &[111i32] {}
+ let test = if some_predicate() { 1 } else { 2 };
+ while some_predicate() {
+ let abc = !some_predicate();
+ }
+ loop {
+ let abc = !some_predicate();
+ break;
+ }
+ // nested block
+ {
+ let abc = !some_predicate();
+
+ {
+ let def = !some_predicate();
+ }
+ }
+}
+
+fn after_panic() {
+ panic!();
+ let x = "0";
+ let (ref y,z) = (1i32, 2u32);
+ match (20i32, 'c') {
+ (a, ref b) => {}
+ }
+ for a in &[111i32] {}
+ let test = if some_predicate() { 1 } else { 2 };
+ while some_predicate() {
+ let abc = !some_predicate();
+ }
+ loop {
+ let abc = !some_predicate();
+ break;
+ }
+ // nested block
+ {
+ let abc = !some_predicate();
+
+ {
+ let def = !some_predicate();
+ }
+ }
+}
+
+fn after_diverging_function() {
+ diverge();
+ let x = "0";
+ let (ref y,z) = (1i32, 2u32);
+ match (20i32, 'c') {
+ (a, ref b) => {}
+ }
+ for a in &[111i32] {}
+ let test = if some_predicate() { 1 } else { 2 };
+ while some_predicate() {
+ let abc = !some_predicate();
+ }
+ loop {
+ let abc = !some_predicate();
+ break;
+ }
+ // nested block
+ {
+ let abc = !some_predicate();
+
+ {
+ let def = !some_predicate();
+ }
+ }
+}
+
+fn after_break() {
+ loop {
+ break;
+ let x = "0";
+ let (ref y,z) = (1i32, 2u32);
+ match (20i32, 'c') {
+ (a, ref b) => {}
+ }
+ for a in &[111i32] {}
+ let test = if some_predicate() { 1 } else { 2 };
+ while some_predicate() {
+ let abc = !some_predicate();
+ }
+ loop {
+ let abc = !some_predicate();
+ break;
+ }
+ // nested block
+ {
+ let abc = !some_predicate();
+
+ {
+ let def = !some_predicate();
+ }
+ }
+ }
+}
+
+fn after_continue() {
+ for _ in 0..10i32 {
+ continue;
+ let x = "0";
+ let (ref y,z) = (1i32, 2u32);
+ match (20i32, 'c') {
+ (a, ref b) => {}
+ }
+ for a in &[111i32] {}
+ let test = if some_predicate() { 1 } else { 2 };
+ while some_predicate() {
+ let abc = !some_predicate();
+ }
+ loop {
+ let abc = !some_predicate();
+ break;
+ }
+ // nested block
+ {
+ let abc = !some_predicate();
+
+ {
+ let def = !some_predicate();
+ }
+ }
+ }
+}
+
+fn main() {
+ after_return();
+ after_panic();
+ after_diverging_function();
+ after_break();
+ after_continue();
+}
+
+fn diverge() -> ! {
+ panic!();
+}
+
+fn some_predicate() -> bool { true || false }
diff --git a/src/test/debuginfo/unsized.rs b/src/test/debuginfo/unsized.rs
new file mode 100644
index 000000000..7cb0002ca
--- /dev/null
+++ b/src/test/debuginfo/unsized.rs
@@ -0,0 +1,93 @@
+// compile-flags:-g
+
+// === GDB TESTS ===================================================================================
+
+// gdb-command:run
+
+// gdb-command:print a
+// gdbg-check:$1 = {data_ptr = [...], length = 4}
+// gdbr-check:$1 = &unsized::Foo<[u8]> {data_ptr: [...], length: 4}
+
+// gdb-command:print b
+// gdbg-check:$2 = {data_ptr = [...], length = 4}
+// gdbr-check:$2 = &unsized::Foo<unsized::Foo<[u8]>> {data_ptr: [...], length: 4}
+
+// gdb-command:print c
+// gdbg-check:$3 = {pointer = [...], vtable = [...]}
+// gdbr-check:$3 = &unsized::Foo<dyn core::fmt::Debug> {pointer: [...], vtable: [...]}
+
+// gdb-command:print _box
+// gdbg-check:$4 = {pointer = [...], vtable = [...]}
+// gdbr-check:$4 = alloc::boxed::Box<unsized::Foo<dyn core::fmt::Debug>, alloc::alloc::Global> {pointer: [...], vtable: [...]}
+
+// gdb-command:print tuple_slice
+// gdbg-check:$5 = {data_ptr = [...], length = 2}
+// gdbr-check:$5 = &(i32, i32, [i32]) {data_ptr: [...], length: 2}
+
+// gdb-command:print tuple_dyn
+// gdbg-check:$6 = {pointer = [...], vtable = [...]}
+// gdbr-check:$6 = &(i32, i32, dyn core::fmt::Debug) {pointer: [...], vtable: [...]}
+
+// === CDB TESTS ===================================================================================
+
+// cdb-command: g
+// cdb-command:dx a
+// cdb-check:a [Type: ref$<unsized::Foo<slice$<u8> > >]
+// cdb-check: [+0x000] data_ptr : 0x[...] [Type: unsized::Foo<slice$<u8> > *]
+// cdb-check: [...] length : 0x4 [Type: unsigned [...]int[...]
+
+// cdb-command:dx b
+// cdb-check:b [Type: ref$<unsized::Foo<unsized::Foo<slice$<u8> > > >]
+// cdb-check: [+0x000] data_ptr : 0x[...] [Type: unsized::Foo<unsized::Foo<slice$<u8> > > *]
+// cdb-check: [...] length : 0x4 [Type: unsigned [...]int[...]
+
+// cdb-command:dx c
+// cdb-check:c [Type: ref$<unsized::Foo<dyn$<core::fmt::Debug> > >]
+// cdb-check: [+0x000] pointer : 0x[...] [Type: unsized::Foo<dyn$<core::fmt::Debug> > *]
+// cdb-check: [...] vtable : 0x[...] [Type: unsigned [...]int[...] (*)[3]]
+
+// cdb-command:dx _box
+// cdb-check:
+// cdb-check:_box [Type: alloc::boxed::Box<unsized::Foo<dyn$<core::fmt::Debug> >,alloc::alloc::Global>]
+// cdb-check:[+0x000] pointer : 0x[...] [Type: unsized::Foo<dyn$<core::fmt::Debug> > *]
+// cdb-check:[...] vtable : 0x[...] [Type: unsigned [...]int[...] (*)[3]]
+
+// cdb-command:dx tuple_slice
+// cdb-check:tuple_slice [Type: ref$<tuple$<i32,i32,slice$<i32> > >]
+// cdb-check: [+0x000] data_ptr : 0x[...] [Type: tuple$<i32,i32,slice$<i32> > *]
+// cdb-check: [...] length : 0x2 [Type: unsigned [...]int[...]
+
+// cdb-command:dx tuple_dyn
+// cdb-check:tuple_dyn [Type: ref$<tuple$<i32,i32,dyn$<core::fmt::Debug> > >]
+// cdb-check: [+0x000] pointer : 0x[...] [Type: tuple$<i32,i32,dyn$<core::fmt::Debug> > *]
+// cdb-check: [...] vtable : 0x[...] [Type: unsigned [...]int[...] (*)[3]]
+
+#![feature(unsized_tuple_coercion)]
+#![feature(omit_gdb_pretty_printer_section)]
+#![omit_gdb_pretty_printer_section]
+
+struct Foo<T: ?Sized> {
+ value: T,
+}
+
+fn main() {
+ let foo: Foo<Foo<[u8; 4]>> = Foo { value: Foo { value: *b"abc\0" } };
+
+ // We expect `a`, `b`, and `c` to all be fat pointers.
+ // `a` and `b` should be slice-like and thus have a `data_ptr` and `length` field.
+ // `c` should be trait-object-like and thus have a `pointer` and `vtable` field.
+ let a: &Foo<[u8]> = &foo.value;
+ let b: &Foo<Foo<[u8]>> = &foo;
+ let c: &Foo<dyn std::fmt::Debug> = &Foo { value: 7i32 };
+ let _box: Box<Foo<dyn std::fmt::Debug>> = Box::new(Foo { value: 8i32 });
+
+ // Also check unsized tuples
+ let tuple_slice: &(i32, i32, [i32]) = &(0, 1, [2, 3]);
+ let tuple_dyn: &(i32, i32, dyn std::fmt::Debug) = &(0, 1, &3u64);
+
+ zzz(); // #break
+}
+
+fn zzz() {
+ ()
+}
diff --git a/src/test/debuginfo/var-captured-in-nested-closure.rs b/src/test/debuginfo/var-captured-in-nested-closure.rs
new file mode 100644
index 000000000..537c0b50b
--- /dev/null
+++ b/src/test/debuginfo/var-captured-in-nested-closure.rs
@@ -0,0 +1,174 @@
+// min-lldb-version: 310
+
+// compile-flags:-g
+
+// === GDB TESTS ===================================================================================
+
+// gdb-command:run
+
+// gdb-command:print variable
+// gdb-check:$1 = 1
+// gdb-command:print constant
+// gdb-check:$2 = 2
+// gdb-command:print a_struct
+// gdbg-check:$3 = {a = -3, b = 4.5, c = 5}
+// gdbr-check:$3 = var_captured_in_nested_closure::Struct {a: -3, b: 4.5, c: 5}
+// gdb-command:print *struct_ref
+// gdbg-check:$4 = {a = -3, b = 4.5, c = 5}
+// gdbr-check:$4 = var_captured_in_nested_closure::Struct {a: -3, b: 4.5, c: 5}
+// gdb-command:print *owned
+// gdb-check:$5 = 6
+// gdb-command:print closure_local
+// gdb-check:$6 = 8
+// gdb-command:continue
+
+// gdb-command:print variable
+// gdb-check:$7 = 1
+// gdb-command:print constant
+// gdb-check:$8 = 2
+// gdb-command:print a_struct
+// gdbg-check:$9 = {a = -3, b = 4.5, c = 5}
+// gdbr-check:$9 = var_captured_in_nested_closure::Struct {a: -3, b: 4.5, c: 5}
+// gdb-command:print *struct_ref
+// gdbg-check:$10 = {a = -3, b = 4.5, c = 5}
+// gdbr-check:$10 = var_captured_in_nested_closure::Struct {a: -3, b: 4.5, c: 5}
+// gdb-command:print *owned
+// gdb-check:$11 = 6
+// gdb-command:print closure_local
+// gdb-check:$12 = 8
+// gdb-command:continue
+
+
+// === LLDB TESTS ==================================================================================
+
+// lldb-command:run
+
+// lldb-command:print variable
+// lldbg-check:[...]$0 = 1
+// lldbr-check:(isize) variable = 1
+// lldb-command:print constant
+// lldbg-check:[...]$1 = 2
+// lldbr-check:(isize) constant = 2
+// lldb-command:print a_struct
+// lldbg-check:[...]$2 = { a = -3 b = 4.5 c = 5 }
+// lldbr-check:(var_captured_in_nested_closure::Struct) a_struct = { a = -3 b = 4.5 c = 5 }
+// lldb-command:print *struct_ref
+// lldbg-check:[...]$3 = { a = -3 b = 4.5 c = 5 }
+// lldbr-check:(var_captured_in_nested_closure::Struct) *struct_ref = { a = -3 b = 4.5 c = 5 }
+// lldb-command:print *owned
+// lldbg-check:[...]$4 = 6
+// lldbr-check:(isize) *owned = 6
+// lldb-command:print closure_local
+// lldbg-check:[...]$5 = 8
+// lldbr-check:(isize) closure_local = 8
+// lldb-command:continue
+
+// lldb-command:print variable
+// lldbg-check:[...]$6 = 1
+// lldbr-check:(isize) variable = 1
+// lldb-command:print constant
+// lldbg-check:[...]$7 = 2
+// lldbr-check:(isize) constant = 2
+// lldb-command:print a_struct
+// lldbg-check:[...]$8 = { a = -3 b = 4.5 c = 5 }
+// lldbr-check:(var_captured_in_nested_closure::Struct) a_struct = { a = -3 b = 4.5 c = 5 }
+// lldb-command:print *struct_ref
+// lldbg-check:[...]$9 = { a = -3 b = 4.5 c = 5 }
+// lldbr-check:(var_captured_in_nested_closure::Struct) *struct_ref = { a = -3 b = 4.5 c = 5 }
+// lldb-command:print *owned
+// lldbg-check:[...]$10 = 6
+// lldbr-check:(isize) *owned = 6
+// lldb-command:print closure_local
+// lldbg-check:[...]$11 = 8
+// lldbr-check:(isize) closure_local = 8
+// lldb-command:continue
+
+
+// === CDB TESTS ===================================================================================
+
+// cdb-command: g
+
+// cdb-command: dx variable
+// cdb-check:variable : 1 [Type: [...]]
+// cdb-command: dx constant
+// cdb-check:constant : 2 [Type: [...]]
+// cdb-command: dx a_struct
+// cdb-check:a_struct [Type: var_captured_in_nested_closure::Struct]
+// cdb-check: [+0x[...]] a : -3 [Type: [...]]
+// cdb-check: [+0x[...]] b : 4.500000 [Type: [...]]
+// cdb-check: [+0x[...]] c : 0x5 [Type: unsigned [...]]
+// cdb-command: dx struct_ref
+// cdb-check:struct_ref : 0x[...] [Type: var_captured_in_nested_closure::Struct *]
+// cdb-check: [+0x[...]] a : -3 [Type: [...]]
+// cdb-check: [+0x[...]] b : 4.500000 [Type: [...]]
+// cdb-check: [+0x[...]] c : 0x5 [Type: unsigned [...]]
+// cdb-command: dx owned
+// cdb-check:owned : 0x[...] : 6 [Type: [...] *]
+// cdb-check: 6 [Type: [...]]
+// cdb-command: dx closure_local
+// cdb-check:closure_local : 8 [Type: [...]]
+// cdb-command: dx nested_closure
+// cdb-check:nested_closure [Type: var_captured_in_nested_closure::main::closure$0::closure_env$0]
+
+// cdb-command: g
+
+// cdb-command: dx variable
+// cdb-check:variable : 1 [Type: [...]]
+// cdb-command: dx constant
+// cdb-check:constant : 2 [Type: [...]]
+// cdb-command: dx a_struct
+// cdb-check:a_struct [Type: var_captured_in_nested_closure::Struct]
+// cdb-check: [+0x[...]] a : -3 [Type: [...]]
+// cdb-check: [+0x[...]] b : 4.500000 [Type: [...]]
+// cdb-check: [+0x[...]] c : 0x5 [Type: unsigned [...]]
+// cdb-command: dx struct_ref
+// cdb-check:struct_ref : 0x[...] [Type: var_captured_in_nested_closure::Struct *]
+// cdb-check: [+0x[...]] a : -3 [Type: [...]]
+// cdb-check: [+0x[...]] b : 4.500000 [Type: [...]]
+// cdb-check: [+0x[...]] c : 0x5 [Type: unsigned [...]]
+// cdb-command: dx owned
+// cdb-check:owned : 0x[...] : 6 [Type: [...] *]
+// cdb-check: 6 [Type: [...]]
+// cdb-command: dx closure_local
+// cdb-check:closure_local : 8 [Type: [...]]
+
+#![allow(unused_variables)]
+#![feature(omit_gdb_pretty_printer_section)]
+#![omit_gdb_pretty_printer_section]
+
+struct Struct {
+ a: isize,
+ b: f64,
+ c: usize
+}
+
+fn main() {
+ let mut variable = 1;
+ let constant = 2;
+
+ let a_struct = Struct {
+ a: -3,
+ b: 4.5,
+ c: 5
+ };
+
+ let struct_ref = &a_struct;
+ let owned: Box<_> = Box::new(6);
+
+ let mut closure = || {
+ let closure_local = 8;
+
+ let mut nested_closure = || {
+ zzz(); // #break
+ variable = constant + a_struct.a + struct_ref.a + *owned + closure_local;
+ };
+
+ zzz(); // #break
+
+ nested_closure();
+ };
+
+ closure();
+}
+
+fn zzz() {()}
diff --git a/src/test/debuginfo/var-captured-in-sendable-closure.rs b/src/test/debuginfo/var-captured-in-sendable-closure.rs
new file mode 100644
index 000000000..39930e04e
--- /dev/null
+++ b/src/test/debuginfo/var-captured-in-sendable-closure.rs
@@ -0,0 +1,81 @@
+// min-lldb-version: 310
+
+// compile-flags:-g
+
+// === GDB TESTS ===================================================================================
+
+// gdb-command:run
+
+// gdb-command:print constant
+// gdb-check:$1 = 1
+// gdb-command:print a_struct
+// gdbg-check:$2 = {a = -2, b = 3.5, c = 4}
+// gdbr-check:$2 = var_captured_in_sendable_closure::Struct {a: -2, b: 3.5, c: 4}
+// gdb-command:print *owned
+// gdb-check:$3 = 5
+// gdb-command:continue
+
+// gdb-command:print constant2
+// gdb-check:$4 = 6
+// gdb-command:continue
+
+// === LLDB TESTS ==================================================================================
+
+// lldb-command:run
+
+// lldb-command:print constant
+// lldbg-check:[...]$0 = 1
+// lldbr-check:(isize) constant = 1
+// lldb-command:print a_struct
+// lldbg-check:[...]$1 = { a = -2 b = 3.5 c = 4 }
+// lldbr-check:(var_captured_in_sendable_closure::Struct) a_struct = { a = -2 b = 3.5 c = 4 }
+// lldb-command:print *owned
+// lldbg-check:[...]$2 = 5
+// lldbr-check:(isize) *owned = 5
+
+#![allow(unused_variables)]
+#![feature(omit_gdb_pretty_printer_section)]
+#![omit_gdb_pretty_printer_section]
+
+struct Struct {
+ a: isize,
+ b: f64,
+ c: usize
+}
+
+fn main() {
+ let constant = 1;
+
+ let a_struct = Struct {
+ a: -2,
+ b: 3.5,
+ c: 4
+ };
+
+ let owned: Box<_> = Box::new(5);
+
+ let closure = move || {
+ zzz(); // #break
+ do_something(&constant, &a_struct.a, &*owned);
+ };
+
+ closure();
+
+ let constant2 = 6_usize;
+
+ // The `self` argument of the following closure should be passed by value
+ // to FnOnce::call_once(self, args), which gets codegened a bit differently
+ // than the regular case. Let's make sure this is supported too.
+ let immedate_env = move || {
+ zzz(); // #break
+ return constant2;
+ };
+
+ immedate_env();
+}
+
+fn do_something(_: &isize, _:&isize, _:&isize) {
+
+}
+
+fn zzz() {()}
diff --git a/src/test/debuginfo/var-captured-in-stack-closure.rs b/src/test/debuginfo/var-captured-in-stack-closure.rs
new file mode 100644
index 000000000..d68409a9d
--- /dev/null
+++ b/src/test/debuginfo/var-captured-in-stack-closure.rs
@@ -0,0 +1,159 @@
+// min-lldb-version: 310
+
+// compile-flags:-g
+
+// === GDB TESTS ===================================================================================
+
+// gdb-command:run
+
+// gdb-command:print variable
+// gdb-check:$1 = 1
+// gdb-command:print constant
+// gdb-check:$2 = 2
+// gdb-command:print a_struct
+// gdbg-check:$3 = {a = -3, b = 4.5, c = 5}
+// gdbr-check:$3 = var_captured_in_stack_closure::Struct {a: -3, b: 4.5, c: 5}
+// gdb-command:print *struct_ref
+// gdbg-check:$4 = {a = -3, b = 4.5, c = 5}
+// gdbr-check:$4 = var_captured_in_stack_closure::Struct {a: -3, b: 4.5, c: 5}
+// gdb-command:print *owned
+// gdb-check:$5 = 6
+
+// gdb-command:continue
+
+// gdb-command:print variable
+// gdb-check:$6 = 2
+// gdb-command:print constant
+// gdb-check:$7 = 2
+// gdb-command:print a_struct
+// gdbg-check:$8 = {a = -3, b = 4.5, c = 5}
+// gdbr-check:$8 = var_captured_in_stack_closure::Struct {a: -3, b: 4.5, c: 5}
+// gdb-command:print *struct_ref
+// gdbg-check:$9 = {a = -3, b = 4.5, c = 5}
+// gdbr-check:$9 = var_captured_in_stack_closure::Struct {a: -3, b: 4.5, c: 5}
+// gdb-command:print *owned
+// gdb-check:$10 = 6
+
+
+// === LLDB TESTS ==================================================================================
+
+// lldb-command:run
+
+// lldb-command:print variable
+// lldbg-check:[...]$0 = 1
+// lldbr-check:(isize) variable = 1
+// lldb-command:print constant
+// lldbg-check:[...]$1 = 2
+// lldbr-check:(isize) constant = 2
+// lldb-command:print a_struct
+// lldbg-check:[...]$2 = { a = -3 b = 4.5 c = 5 }
+// lldbr-check:(var_captured_in_stack_closure::Struct) a_struct = { a = -3 b = 4.5 c = 5 }
+// lldb-command:print *struct_ref
+// lldbg-check:[...]$3 = { a = -3 b = 4.5 c = 5 }
+// lldbr-check:(var_captured_in_stack_closure::Struct) *struct_ref = { a = -3 b = 4.5 c = 5 }
+// lldb-command:print *owned
+// lldbg-check:[...]$4 = 6
+// lldbr-check:(isize) *owned = 6
+
+// lldb-command:continue
+
+// lldb-command:print variable
+// lldbg-check:[...]$5 = 2
+// lldbr-check:(isize) variable = 2
+// lldb-command:print constant
+// lldbg-check:[...]$6 = 2
+// lldbr-check:(isize) constant = 2
+// lldb-command:print a_struct
+// lldbg-check:[...]$7 = { a = -3 b = 4.5 c = 5 }
+// lldbr-check:(var_captured_in_stack_closure::Struct) a_struct = { a = -3 b = 4.5 c = 5 }
+// lldb-command:print *struct_ref
+// lldbg-check:[...]$8 = { a = -3 b = 4.5 c = 5 }
+// lldbr-check:(var_captured_in_stack_closure::Struct) *struct_ref = { a = -3 b = 4.5 c = 5 }
+// lldb-command:print *owned
+// lldbg-check:[...]$9 = 6
+// lldbr-check:(isize) *owned = 6
+
+
+// === CDB TESTS ===================================================================================
+
+// cdb-command: g
+
+// cdb-command: dx variable
+// cdb-check:variable : 1 [Type: [...]]
+// cdb-command: dx constant
+// cdb-check:constant : 2 [Type: [...]]
+// cdb-command: dx a_struct
+// cdb-check:a_struct [Type: var_captured_in_stack_closure::Struct]
+// cdb-check: [+0x[...]] a : -3 [Type: [...]]
+// cdb-check: [+0x[...]] b : 4.500000 [Type: [...]]
+// cdb-check: [+0x[...]] c : 0x5 [Type: unsigned [...]]
+// cdb-command: dx struct_ref
+// cdb-check:struct_ref : 0x[...] [Type: var_captured_in_stack_closure::Struct *]
+// cdb-check: [+0x[...]] a : -3 [Type: [...]]
+// cdb-check: [+0x[...]] b : 4.500000 [Type: [...]]
+// cdb-check: [+0x[...]] c : 0x5 [Type: unsigned [...]]
+// cdb-command: dx owned
+// cdb-check:owned : 0x[...] : 6 [Type: [...] *]
+
+
+// cdb-command: g
+
+// cdb-command: dx variable
+// cdb-check:variable : 2 [Type: [...]]
+// cdb-command: dx constant
+// cdb-check:constant : 2 [Type: [...]]
+// cdb-command: dx a_struct
+// cdb-check:a_struct [Type: var_captured_in_stack_closure::Struct]
+// cdb-check: [+0x[...]] a : -3 [Type: [...]]
+// cdb-check: [+0x[...]] b : 4.500000 [Type: [...]]
+// cdb-check: [+0x[...]] c : 0x5 [Type: unsigned [...]]
+// cdb-command: dx struct_ref
+// cdb-check:struct_ref : 0x[...] [Type: var_captured_in_stack_closure::Struct *]
+// cdb-check: [+0x[...]] a : -3 [Type: [...]]
+// cdb-check: [+0x[...]] b : 4.500000 [Type: [...]]
+// cdb-check: [+0x[...]] c : 0x5 [Type: unsigned [...]]
+// cdb-command: dx owned
+// cdb-check:owned : 0x[...] : 6 [Type: [...] *]
+
+#![allow(unused_variables)]
+#![feature(omit_gdb_pretty_printer_section)]
+#![omit_gdb_pretty_printer_section]
+
+struct Struct {
+ a: isize,
+ b: f64,
+ c: usize
+}
+
+fn main() {
+ let mut variable = 1;
+ let constant = 2;
+
+ let a_struct = Struct {
+ a: -3,
+ b: 4.5,
+ c: 5
+ };
+
+ let struct_ref = &a_struct;
+ let owned: Box<_> = Box::new(6);
+
+ {
+ let mut first_closure = || {
+ zzz(); // #break
+ variable = constant + a_struct.a + struct_ref.a + *owned;
+ };
+
+ first_closure();
+ }
+
+ {
+ let mut second_closure = || {
+ zzz(); // #break
+ variable = constant + a_struct.a + struct_ref.a + *owned;
+ };
+ second_closure();
+ }
+}
+
+fn zzz() {()}
diff --git a/src/test/debuginfo/vec-slices.rs b/src/test/debuginfo/vec-slices.rs
new file mode 100644
index 000000000..7d88e45ca
--- /dev/null
+++ b/src/test/debuginfo/vec-slices.rs
@@ -0,0 +1,133 @@
+// ignore-windows
+// min-lldb-version: 310
+
+// compile-flags:-g
+
+// === GDB TESTS ===================================================================================
+
+// gdb-command:run
+// gdb-command:print empty.length
+// gdb-check:$1 = 0
+
+// gdb-command:print singleton.length
+// gdb-check:$2 = 1
+// gdbg-command:print *((i64[1]*)(singleton.data_ptr))
+// gdbr-command:print *(singleton.data_ptr as *const [i64; 1])
+// gdbg-check:$3 = {1}
+// gdbr-check:$3 = [1]
+
+// gdb-command:print multiple.length
+// gdb-check:$4 = 4
+// gdbg-command:print *((i64[4]*)(multiple.data_ptr))
+// gdbr-command:print *(multiple.data_ptr as *const [i64; 4])
+// gdbg-check:$5 = {2, 3, 4, 5}
+// gdbr-check:$5 = [2, 3, 4, 5]
+
+// gdb-command:print slice_of_slice.length
+// gdb-check:$6 = 2
+// gdbg-command:print *((i64[2]*)(slice_of_slice.data_ptr))
+// gdbr-command:print *(slice_of_slice.data_ptr as *const [i64; 2])
+// gdbg-check:$7 = {3, 4}
+// gdbr-check:$7 = [3, 4]
+
+// gdb-command:print padded_tuple.length
+// gdb-check:$8 = 2
+// gdb-command:print padded_tuple.data_ptr[0]
+// gdbg-check:$9 = {__0 = 6, __1 = 7}
+// gdbr-check:$9 = (6, 7)
+// gdb-command:print padded_tuple.data_ptr[1]
+// gdbg-check:$10 = {__0 = 8, __1 = 9}
+// gdbr-check:$10 = (8, 9)
+
+// gdb-command:print padded_struct.length
+// gdb-check:$11 = 2
+// gdb-command:print padded_struct.data_ptr[0]
+// gdbg-check:$12 = {x = 10, y = 11, z = 12}
+// gdbr-check:$12 = vec_slices::AStruct {x: 10, y: 11, z: 12}
+// gdb-command:print padded_struct.data_ptr[1]
+// gdbg-check:$13 = {x = 13, y = 14, z = 15}
+// gdbr-check:$13 = vec_slices::AStruct {x: 13, y: 14, z: 15}
+
+// gdb-command:print mut_slice.length
+// gdb-check:$14 = 5
+// gdbg-command:print *((i64[5]*)(mut_slice.data_ptr))
+// gdbr-command:print *(mut_slice.data_ptr as *const [i64; 5])
+// gdbg-check:$15 = {1, 2, 3, 4, 5}
+// gdbr-check:$15 = [1, 2, 3, 4, 5]
+
+// Some lines below are marked with [ignored] because old GDB versions seem to have trouble
+// accessing globals.
+
+// [ignored] gdbg-command:print 'vec_slices::MUT_VECT_SLICE'.length
+// gdbr-command:print MUT_VECT_SLICE.length
+// [ignored] gdbg-check:$16 = 2
+// gdbr-check:$16 = 2
+// [ignored] gdbg-command:print *((i64[2]*)('vec_slices::MUT_VECT_SLICE'.data_ptr))
+// gdbr-command:print *(MUT_VECT_SLICE.data_ptr as *const [i64; 2])
+// [ignored] gdbg-check:$17 = {64, 65}
+// gdbr-check:$17 = [64, 65]
+
+// === LLDB TESTS ==================================================================================
+
+// lldb-command:run
+
+// lldb-command:print empty
+// lldbg-check:[...]$0 = size=0
+// lldbr-check:(&[i64]) empty = size=0
+
+// lldb-command:print singleton
+// lldbg-check:[...]$1 = size=1 { [0] = 1 }
+// lldbr-check:(&[i64]) singleton = &[1]
+
+// lldb-command:print multiple
+// lldbg-check:[...]$2 = size=4 { [0] = 2 [1] = 3 [2] = 4 [3] = 5 }
+// lldbr-check:(&[i64]) multiple = size=4 { [0] = 2 [1] = 3 [2] = 4 [3] = 5 }
+
+// lldb-command:print slice_of_slice
+// lldbg-check:[...]$3 = size=2 { [0] = 3 [1] = 4 }
+// lldbr-check:(&[i64]) slice_of_slice = size=2 { [0] = 3 [1] = 4 }
+
+// lldb-command:print padded_tuple
+// lldbg-check:[...]$4 = size=2 { [0] = { 0 = 6 1 = 7 } [1] = { 0 = 8 1 = 9 } }
+// lldbr-check:(&[(i32, i16)]) padded_tuple = size=2 { [0] = { 0 = 6 1 = 7 } [1] = { 0 = 8 1 = 9 } }
+
+// lldb-command:print padded_struct
+// lldbg-check:[...]$5 = size=2 { [0] = { x = 10 y = 11 z = 12 } [1] = { x = 13 y = 14 z = 15 } }
+// lldbr-check:(&[vec_slices::AStruct]) padded_struct = size=2 { [0] = { x = 10 y = 11 z = 12 } [1] = { x = 13 y = 14 z = 15 } }
+
+#![allow(dead_code, unused_variables)]
+#![feature(omit_gdb_pretty_printer_section)]
+#![omit_gdb_pretty_printer_section]
+
+struct AStruct {
+ x: i16,
+ y: i32,
+ z: i16,
+}
+
+static VECT_SLICE: &'static [i64] = &[64, 65];
+static mut MUT_VECT_SLICE: &'static [i64] = &[32];
+
+fn main() {
+ let empty: &[i64] = &[];
+ let singleton: &[i64] = &[1];
+ let multiple: &[i64] = &[2, 3, 4, 5];
+ let slice_of_slice = &multiple[1..3];
+
+ let padded_tuple: &[(i32, i16)] = &[(6, 7), (8, 9)];
+
+ let padded_struct: &[AStruct] =
+ &[AStruct { x: 10, y: 11, z: 12 }, AStruct { x: 13, y: 14, z: 15 }];
+
+ unsafe {
+ MUT_VECT_SLICE = VECT_SLICE;
+ }
+
+ let mut_slice: &mut [i64] = &mut [1, 2, 3, 4, 5];
+
+ zzz(); // #break
+}
+
+fn zzz() {
+ ()
+}
diff --git a/src/test/debuginfo/vec.rs b/src/test/debuginfo/vec.rs
new file mode 100644
index 000000000..895661816
--- /dev/null
+++ b/src/test/debuginfo/vec.rs
@@ -0,0 +1,42 @@
+// min-lldb-version: 310
+// ignore-gdb // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155
+
+// compile-flags:-g
+
+// === GDB TESTS ===================================================================================
+
+// gdb-command:run
+// gdb-command:print a
+// gdbg-check:$1 = {1, 2, 3}
+// gdbr-check:$1 = [1, 2, 3]
+// gdb-command:print vec::VECT
+// gdbg-check:$2 = {4, 5, 6}
+// gdbr-check:$2 = [4, 5, 6]
+
+
+// === LLDB TESTS ==================================================================================
+
+// lldb-command:run
+// lldb-command:print a
+// lldbg-check:[...]$0 = { [0] = 1 [1] = 2 [2] = 3 }
+// lldbr-check:([i32; 3]) a = { [0] = 1 [1] = 2 [2] = 3 }
+
+#![allow(unused_variables)]
+#![feature(omit_gdb_pretty_printer_section)]
+#![omit_gdb_pretty_printer_section]
+
+static mut VECT: [i32; 3] = [1, 2, 3];
+
+fn main() {
+ let a = [1, 2, 3];
+
+ unsafe {
+ VECT[0] = 4;
+ VECT[1] = 5;
+ VECT[2] = 6;
+ }
+
+ zzz(); // #break
+}
+
+fn zzz() {()}