about summary refs log tree commit diff
path: root/src/test/debuginfo
diff options
context:
space:
mode:
authorVadim Petrochenkov <vadim.petrochenkov@gmail.com>2016-08-22 21:11:22 +0300
committerVadim Petrochenkov <vadim.petrochenkov@gmail.com>2016-09-03 13:39:35 +0300
commit079c390d5089735b5eaa8b06ddb3beedcddbee7d (patch)
tree0ee26d3362956037a075eab5d8e1a433a0ba34da /src/test/debuginfo
parentd9b332bd69770cb716233b6998b11d345f6f184b (diff)
downloadrust-079c390d5089735b5eaa8b06ddb3beedcddbee7d.tar.gz
rust-079c390d5089735b5eaa8b06ddb3beedcddbee7d.zip
Generate debuginfo for unions
Diffstat (limited to 'src/test/debuginfo')
-rw-r--r--src/test/debuginfo/union-smoke.rs49
1 files changed, 49 insertions, 0 deletions
diff --git a/src/test/debuginfo/union-smoke.rs b/src/test/debuginfo/union-smoke.rs
new file mode 100644
index 00000000000..11ee5031ca7
--- /dev/null
+++ b/src/test/debuginfo/union-smoke.rs
@@ -0,0 +1,49 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// min-lldb-version: 310
+
+// compile-flags:-g
+
+// === GDB TESTS ===================================================================================
+
+// gdb-command:run
+// gdb-command:print u
+// gdb-check:$1 = {a = 11 '\v', b = 11}
+// gdb-command:print union_smoke::SU
+// gdb-check:$2 = {a = 10 '\n', b = 10}
+
+// === LLDB TESTS ==================================================================================
+
+// lldb-command:run
+// lldb-command:print a
+// lldb-check:[...]$0 = {a = 11 '\v', b = 11}
+// lldb-command:print union_smoke::SU
+// lldb-check:[...]$1 = {a = 10 '\n', b = 10}
+
+#![allow(unused)]
+#![feature(omit_gdb_pretty_printer_section)]
+#![omit_gdb_pretty_printer_section]
+#![feature(untagged_unions)]
+
+union U {
+    a: u8,
+    b: u64,
+}
+
+static SU: U = U { a: 10 };
+
+fn main() {
+    let u = U { b: 11 };
+
+    zzz(); // #break
+}
+
+fn zzz() {()}