2014-10-09 14:31:03 +00:00
|
|
|
// min-lldb-version: 310
|
2014-04-24 09:35:48 +00:00
|
|
|
|
|
|
|
// compile-flags:-g
|
2014-07-09 12:46:09 +00:00
|
|
|
|
|
|
|
// === GDB TESTS ===================================================================================
|
|
|
|
|
2014-04-24 09:35:48 +00:00
|
|
|
// gdb-command:run
|
|
|
|
// gdb-command:print empty.length
|
|
|
|
// gdb-check:$1 = 0
|
|
|
|
|
|
|
|
// gdb-command:print singleton.length
|
|
|
|
// gdb-check:$2 = 1
|
2016-10-11 19:21:40 +00:00
|
|
|
// gdbg-command:print *((i64[1]*)(singleton.data_ptr))
|
2022-01-17 16:31:13 +00:00
|
|
|
// gdbr-command:print *(singleton.data_ptr as *const [i64; 1])
|
2016-10-25 21:32:04 +00:00
|
|
|
// gdbg-check:$3 = {1}
|
|
|
|
// gdbr-check:$3 = [1]
|
2014-04-24 09:35:48 +00:00
|
|
|
|
|
|
|
// gdb-command:print multiple.length
|
|
|
|
// gdb-check:$4 = 4
|
2016-10-11 19:21:40 +00:00
|
|
|
// gdbg-command:print *((i64[4]*)(multiple.data_ptr))
|
2022-01-17 16:31:13 +00:00
|
|
|
// gdbr-command:print *(multiple.data_ptr as *const [i64; 4])
|
2016-10-25 21:32:04 +00:00
|
|
|
// gdbg-check:$5 = {2, 3, 4, 5}
|
|
|
|
// gdbr-check:$5 = [2, 3, 4, 5]
|
2014-04-24 09:35:48 +00:00
|
|
|
|
|
|
|
// gdb-command:print slice_of_slice.length
|
|
|
|
// gdb-check:$6 = 2
|
2016-10-11 19:21:40 +00:00
|
|
|
// gdbg-command:print *((i64[2]*)(slice_of_slice.data_ptr))
|
2022-01-17 16:31:13 +00:00
|
|
|
// gdbr-command:print *(slice_of_slice.data_ptr as *const [i64; 2])
|
2016-10-25 21:32:04 +00:00
|
|
|
// gdbg-check:$7 = {3, 4}
|
|
|
|
// gdbr-check:$7 = [3, 4]
|
2014-04-24 09:35:48 +00:00
|
|
|
|
|
|
|
// gdb-command:print padded_tuple.length
|
|
|
|
// gdb-check:$8 = 2
|
|
|
|
// gdb-command:print padded_tuple.data_ptr[0]
|
2016-10-25 21:32:04 +00:00
|
|
|
// gdbg-check:$9 = {__0 = 6, __1 = 7}
|
|
|
|
// gdbr-check:$9 = (6, 7)
|
2014-04-24 09:35:48 +00:00
|
|
|
// gdb-command:print padded_tuple.data_ptr[1]
|
2016-10-25 21:32:04 +00:00
|
|
|
// gdbg-check:$10 = {__0 = 8, __1 = 9}
|
|
|
|
// gdbr-check:$10 = (8, 9)
|
2014-04-24 09:35:48 +00:00
|
|
|
|
|
|
|
// gdb-command:print padded_struct.length
|
|
|
|
// gdb-check:$11 = 2
|
|
|
|
// gdb-command:print padded_struct.data_ptr[0]
|
2016-10-25 21:32:04 +00:00
|
|
|
// gdbg-check:$12 = {x = 10, y = 11, z = 12}
|
|
|
|
// gdbr-check:$12 = vec_slices::AStruct {x: 10, y: 11, z: 12}
|
2014-04-24 09:35:48 +00:00
|
|
|
// gdb-command:print padded_struct.data_ptr[1]
|
2016-10-25 21:32:04 +00:00
|
|
|
// gdbg-check:$13 = {x = 13, y = 14, z = 15}
|
|
|
|
// gdbr-check:$13 = vec_slices::AStruct {x: 13, y: 14, z: 15}
|
2014-04-24 09:35:48 +00:00
|
|
|
|
2022-01-17 16:31:13 +00:00
|
|
|
// gdb-command:print mut_slice.length
|
2022-01-25 11:14:17 +00:00
|
|
|
// gdb-check:$14 = 5
|
2022-01-17 16:31:13 +00:00
|
|
|
// gdbg-command:print *((i64[5]*)(mut_slice.data_ptr))
|
|
|
|
// gdbr-command:print *(mut_slice.data_ptr as *const [i64; 5])
|
2022-01-25 11:14:17 +00:00
|
|
|
// gdbg-check:$15 = {1, 2, 3, 4, 5}
|
|
|
|
// gdbr-check:$15 = [1, 2, 3, 4, 5]
|
2016-06-29 14:34:06 +00:00
|
|
|
|
2022-01-25 11:14:17 +00:00
|
|
|
// 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]
|
2014-07-09 12:46:09 +00:00
|
|
|
|
|
|
|
// === LLDB TESTS ==================================================================================
|
|
|
|
|
|
|
|
// lldb-command:run
|
|
|
|
|
|
|
|
// lldb-command:print empty
|
2019-05-14 12:50:58 +00:00
|
|
|
// lldbg-check:[...]$0 = size=0
|
|
|
|
// lldbr-check:(&[i64]) empty = size=0
|
2014-07-09 12:46:09 +00:00
|
|
|
|
|
|
|
// lldb-command:print singleton
|
2019-05-14 12:50:58 +00:00
|
|
|
// lldbg-check:[...]$1 = size=1 { [0] = 1 }
|
2018-10-02 16:13:30 +00:00
|
|
|
// lldbr-check:(&[i64]) singleton = &[1]
|
2014-07-09 12:46:09 +00:00
|
|
|
|
|
|
|
// lldb-command:print multiple
|
2019-05-14 12:50:58 +00:00
|
|
|
// 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 }
|
2014-07-09 12:46:09 +00:00
|
|
|
|
|
|
|
// lldb-command:print slice_of_slice
|
2019-05-14 12:50:58 +00:00
|
|
|
// lldbg-check:[...]$3 = size=2 { [0] = 3 [1] = 4 }
|
|
|
|
// lldbr-check:(&[i64]) slice_of_slice = size=2 { [0] = 3 [1] = 4 }
|
2014-07-09 12:46:09 +00:00
|
|
|
|
|
|
|
// lldb-command:print padded_tuple
|
2019-05-14 12:50:58 +00:00
|
|
|
// 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 } }
|
2014-07-09 12:46:09 +00:00
|
|
|
|
|
|
|
// lldb-command:print padded_struct
|
2019-05-14 12:50:58 +00:00
|
|
|
// 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 } }
|
2014-07-09 12:46:09 +00:00
|
|
|
|
2015-04-22 04:53:07 +00:00
|
|
|
#![allow(dead_code, unused_variables)]
|
2015-09-19 20:33:47 +00:00
|
|
|
#![feature(omit_gdb_pretty_printer_section)]
|
2014-12-03 22:48:18 +00:00
|
|
|
#![omit_gdb_pretty_printer_section]
|
2014-04-24 09:35:48 +00:00
|
|
|
|
|
|
|
struct AStruct {
|
|
|
|
x: i16,
|
|
|
|
y: i32,
|
2022-01-25 11:14:17 +00:00
|
|
|
z: i16,
|
2014-04-24 09:35:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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];
|
2015-01-03 00:34:13 +00:00
|
|
|
let slice_of_slice = &multiple[1..3];
|
2014-04-24 09:35:48 +00:00
|
|
|
|
|
|
|
let padded_tuple: &[(i32, i16)] = &[(6, 7), (8, 9)];
|
|
|
|
|
2022-01-25 11:14:17 +00:00
|
|
|
let padded_struct: &[AStruct] =
|
|
|
|
&[AStruct { x: 10, y: 11, z: 12 }, AStruct { x: 13, y: 14, z: 15 }];
|
2014-04-24 09:35:48 +00:00
|
|
|
|
|
|
|
unsafe {
|
|
|
|
MUT_VECT_SLICE = VECT_SLICE;
|
|
|
|
}
|
|
|
|
|
2016-06-29 14:34:06 +00:00
|
|
|
let mut_slice: &mut [i64] = &mut [1, 2, 3, 4, 5];
|
|
|
|
|
2014-07-09 12:46:09 +00:00
|
|
|
zzz(); // #break
|
2014-04-24 09:35:48 +00:00
|
|
|
}
|
|
|
|
|
2022-01-25 11:14:17 +00:00
|
|
|
fn zzz() {
|
|
|
|
()
|
|
|
|
}
|