about summary refs log tree commit diff
path: root/src/test/debuginfo/enum-thinlto.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2019-03-30 14:12:12 +0000
committerbors <bors@rust-lang.org>2019-03-30 14:12:12 +0000
commitfc8581d7420b63b2cc5eac1c57a40de785859448 (patch)
treecb9a00e632f44a35f9d2320df2f4d63fb785fc34 /src/test/debuginfo/enum-thinlto.rs
parent6c49da45441d29aadd5935dabbaa8dc09ebad33a (diff)
parent04ffaca71a16905d58161e51c1046daebe8dee0b (diff)
downloadrust-fc8581d7420b63b2cc5eac1c57a40de785859448.tar.gz
rust-fc8581d7420b63b2cc5eac1c57a40de785859448.zip
Auto merge of #59561 - Centril:rollup, r=Centril
Rollup of 5 pull requests

Successful merges:

 - #59343 (rustc(codegen): uncache `def_symbol_name` prefix from `symbol_name`.)
 - #59380 (Fix invalid DWARF for enums when using ThinLTO)
 - #59463 (skip dyn keyword lint under macros)
 - #59539 (Fix infinite recursion)
 - #59544 (manifest: only include miri on the nightly channel)

Failed merges:

r? @ghost
Diffstat (limited to 'src/test/debuginfo/enum-thinlto.rs')
-rw-r--r--src/test/debuginfo/enum-thinlto.rs48
1 files changed, 48 insertions, 0 deletions
diff --git a/src/test/debuginfo/enum-thinlto.rs b/src/test/debuginfo/enum-thinlto.rs
new file mode 100644
index 00000000000..7f15ed90e67
--- /dev/null
+++ b/src/test/debuginfo/enum-thinlto.rs
@@ -0,0 +1,48 @@
+// ignore-tidy-linelength
+
+// Require LLVM with DW_TAG_variant_part and a gdb that can read it.
+// min-system-llvm-version: 8.0
+// 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 = ABC { }
+
+#![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() {()}