1 // Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
11 // ignore-tidy-linelength
14 // ignore-gdb // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155
15 // min-lldb-version: 310
19 // === GDB TESTS ===================================================================================
22 // gdb-command:print empty.length
25 // gdb-command:print singleton.length
27 // gdbg-command:print *((i64[1]*)(singleton.data_ptr))
28 // gdbr-command:print *(singleton.data_ptr as &[i64; 1])
29 // gdbg-check:$3 = {1}
30 // gdbr-check:$3 = [1]
32 // gdb-command:print multiple.length
34 // gdbg-command:print *((i64[4]*)(multiple.data_ptr))
35 // gdbr-command:print *(multiple.data_ptr as &[i64; 4])
36 // gdbg-check:$5 = {2, 3, 4, 5}
37 // gdbr-check:$5 = [2, 3, 4, 5]
39 // gdb-command:print slice_of_slice.length
41 // gdbg-command:print *((i64[2]*)(slice_of_slice.data_ptr))
42 // gdbr-command:print *(slice_of_slice.data_ptr as &[i64; 2])
43 // gdbg-check:$7 = {3, 4}
44 // gdbr-check:$7 = [3, 4]
46 // gdb-command:print padded_tuple.length
48 // gdb-command:print padded_tuple.data_ptr[0]
49 // gdbg-check:$9 = {__0 = 6, __1 = 7}
50 // gdbr-check:$9 = (6, 7)
51 // gdb-command:print padded_tuple.data_ptr[1]
52 // gdbg-check:$10 = {__0 = 8, __1 = 9}
53 // gdbr-check:$10 = (8, 9)
55 // gdb-command:print padded_struct.length
57 // gdb-command:print padded_struct.data_ptr[0]
58 // gdbg-check:$12 = {x = 10, y = 11, z = 12}
59 // gdbr-check:$12 = vec_slices::AStruct {x: 10, y: 11, z: 12}
60 // gdb-command:print padded_struct.data_ptr[1]
61 // gdbg-check:$13 = {x = 13, y = 14, z = 15}
62 // gdbr-check:$13 = vec_slices::AStruct {x: 13, y: 14, z: 15}
64 // gdbg-command:print 'vec_slices::MUT_VECT_SLICE'.length
65 // gdbr-command:print MUT_VECT_SLICE.length
67 // gdbg-command:print *((i64[2]*)('vec_slices::MUT_VECT_SLICE'.data_ptr))
68 // gdbr-command:print *(MUT_VECT_SLICE.data_ptr as &[i64; 2])
69 // gdbg-check:$15 = {64, 65}
70 // gdbr-check:$15 = [64, 65]
72 //gdb-command:print mut_slice.length
74 //gdbg-command:print *((i64[5]*)(mut_slice.data_ptr))
75 //gdbr-command:print *(mut_slice.data_ptr as &[i64; 5])
76 //gdbg-check:$17 = {1, 2, 3, 4, 5}
77 //gdbr-check:$17 = [1, 2, 3, 4, 5]
80 // === LLDB TESTS ==================================================================================
84 // lldb-command:print empty
85 // lldbg-check:[...]$0 = &[]
86 // lldbr-check:(&[i64]) empty = &[]
88 // lldb-command:print singleton
89 // lldbg-check:[...]$1 = &[1]
90 // lldbr-check:(&[i64]) singleton = &[1]
92 // lldb-command:print multiple
93 // lldbg-check:[...]$2 = &[2, 3, 4, 5]
94 // lldbr-check:(&[i64]) multiple = &[2, 3, 4, 5]
96 // lldb-command:print slice_of_slice
97 // lldbg-check:[...]$3 = &[3, 4]
98 // lldbr-check:(&[i64]) slice_of_slice = &[3, 4]
100 // lldb-command:print padded_tuple
101 // lldbg-check:[...]$4 = &[(6, 7), (8, 9)]
102 // lldbr-check:(&[(i32, i16)]) padded_tuple = { data_ptr = *0x555555554ff0 length = 2 }
104 // lldb-command:print padded_struct
105 // lldbg-check:[...]$5 = &[AStruct { x: 10, y: 11, z: 12 }, AStruct { x: 13, y: 14, z: 15 }]
106 // lldbr-check:(&[vec_slices::AStruct]) padded_struct = &[AStruct { x: 10, y: 11, z: 12 }, AStruct { x: 13, y: 14, z: 15 }]
108 #![allow(dead_code, unused_variables)]
109 #![feature(omit_gdb_pretty_printer_section)]
110 #![omit_gdb_pretty_printer_section]
118 static VECT_SLICE: &'static [i64] = &[64, 65];
119 static mut MUT_VECT_SLICE: &'static [i64] = &[32];
122 let empty: &[i64] = &[];
123 let singleton: &[i64] = &[1];
124 let multiple: &[i64] = &[2, 3, 4, 5];
125 let slice_of_slice = &multiple[1..3];
127 let padded_tuple: &[(i32, i16)] = &[(6, 7), (8, 9)];
129 let padded_struct: &[AStruct] = &[
130 AStruct { x: 10, y: 11, z: 12 },
131 AStruct { x: 13, y: 14, z: 15 }
135 MUT_VECT_SLICE = VECT_SLICE;
138 let mut_slice: &mut [i64] = &mut [1, 2, 3, 4, 5];