about summary refs log tree commit diff
path: root/src/test/debuginfo
diff options
context:
space:
mode:
authorMichael Woerister <michaelwoerister@posteo>2014-08-20 12:53:50 +0200
committerMichael Woerister <michaelwoerister@posteo>2014-08-27 15:19:14 +0200
commit849ae5d8815c54d135eb9d58cae77c2e6dcac55a (patch)
treeceb472feaae7c7a2b63305c2a5dce26663252326 /src/test/debuginfo
parent6974b4f1b52556e191ade6653e9a9440d1d19610 (diff)
downloadrust-849ae5d8815c54d135eb9d58cae77c2e6dcac55a.tar.gz
rust-849ae5d8815c54d135eb9d58cae77c2e6dcac55a.zip
debuginfo: Emit different autotest debugger scripts depending on GDB version.
Diffstat (limited to 'src/test/debuginfo')
-rw-r--r--src/test/debuginfo/gdb-pretty-struct-and-enums-pre-gdb-7-7.rs75
-rw-r--r--src/test/debuginfo/gdb-pretty-struct-and-enums.rs7
2 files changed, 81 insertions, 1 deletions
diff --git a/src/test/debuginfo/gdb-pretty-struct-and-enums-pre-gdb-7-7.rs b/src/test/debuginfo/gdb-pretty-struct-and-enums-pre-gdb-7-7.rs
new file mode 100644
index 00000000000..e9daf31be2c
--- /dev/null
+++ b/src/test/debuginfo/gdb-pretty-struct-and-enums-pre-gdb-7-7.rs
@@ -0,0 +1,75 @@
+// Copyright 2013-2014 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.
+
+// This test uses only GDB Python API features which should be available in
+// older versions of GDB too. A more extensive test can be found in
+// gdb-pretty-struct-and-enums.rs
+
+// ignore-tidy-linelength
+// ignore-lldb
+// ignore-android: FIXME(#10381)
+// compile-flags:-g
+// gdb-use-pretty-printer
+
+// The following line actually doesn't have to do anything with pretty printing,
+// it just tells GDB to print values on one line:
+// gdb-command: set print pretty off
+
+// gdb-command: rbreak zzz
+// gdb-command: run
+// gdb-command: finish
+
+// gdb-command: print regular_struct
+// gdb-check:$1 = RegularStruct = {the_first_field = 101, the_second_field = 102.5, the_third_field = false}
+
+// gdb-command: print empty_struct
+// gdb-check:$2 = EmptyStruct
+
+// gdb-command: print c_style_enum1
+// gdb-check:$3 = CStyleEnumVar1
+
+// gdb-command: print c_style_enum2
+// gdb-check:$4 = CStyleEnumVar2
+
+// gdb-command: print c_style_enum3
+// gdb-check:$5 = CStyleEnumVar3
+
+struct RegularStruct {
+    the_first_field: int,
+    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 = CStyleEnumVar1;
+    let c_style_enum2 = CStyleEnumVar2;
+    let c_style_enum3 = CStyleEnumVar3;
+
+    zzz();
+}
+
+fn zzz() { () }
diff --git a/src/test/debuginfo/gdb-pretty-struct-and-enums.rs b/src/test/debuginfo/gdb-pretty-struct-and-enums.rs
index 51dad709b6f..5ef63da71af 100644
--- a/src/test/debuginfo/gdb-pretty-struct-and-enums.rs
+++ b/src/test/debuginfo/gdb-pretty-struct-and-enums.rs
@@ -14,6 +14,11 @@
 // compile-flags:-g
 // gdb-use-pretty-printer
 
+// This test uses some GDB Python API features (e.g. accessing anonymous fields)
+// which are only available in newer GDB version. The following directive will
+// case the test runner to ignore this test if an older GDB version is used:
+// min-gdb-version 7.7
+
 // The following line actually doesn't have to do anything with pretty printing,
 // it just tells GDB to print values on one line:
 // gdb-command: set print pretty off
@@ -164,4 +169,4 @@ fn main() {
     zzz();
 }
 
-fn zzz() { () }
\ No newline at end of file
+fn zzz() { () }