debuginfo: Refactored vec slice code to use the new infrastructure. Added test cases for vec slices.
This commit is contained in:
parent
7a31a3e071
commit
36ea756831
3 changed files with 134 additions and 72 deletions
70
src/test/debug-info/vec-slices.rs
Normal file
70
src/test/debug-info/vec-slices.rs
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
// Copyright 2013 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.
|
||||
|
||||
// compile-flags:-Z extra-debug-info
|
||||
// debugger:set print pretty off
|
||||
// debugger:break zzz
|
||||
// debugger:run
|
||||
// debugger:finish
|
||||
// debugger:print empty.size_in_bytes
|
||||
// check:$1 = 0
|
||||
|
||||
// debugger:print singleton.size_in_bytes
|
||||
// check:$2 = 8
|
||||
// debugger:print *((int64_t[1]*)(singleton.data_ptr))
|
||||
// check:$3 = {1}
|
||||
|
||||
// debugger:print multiple.size_in_bytes
|
||||
// check:$4 = 32
|
||||
// debugger:print *((int64_t[4]*)(multiple.data_ptr))
|
||||
// check:$5 = {2, 3, 4, 5}
|
||||
|
||||
// debugger:print slice_of_slice.size_in_bytes
|
||||
// check:$6 = 16
|
||||
// debugger:print *((int64_t[2]*)(slice_of_slice.data_ptr))
|
||||
// check:$7 = {3, 4}
|
||||
|
||||
// debugger:print padded_tuple.size_in_bytes
|
||||
// check:$8 = 16
|
||||
// debugger:print padded_tuple.data_ptr[0]
|
||||
// check:$9 = {6, 7}
|
||||
// debugger:print padded_tuple.data_ptr[1]
|
||||
// check:$10 = {8, 9}
|
||||
|
||||
// debugger:print padded_struct.size_in_bytes
|
||||
// check:$11 = 24
|
||||
// debugger:print padded_struct.data_ptr[0]
|
||||
// check:$12 = {x = 10, y = 11, z = 12}
|
||||
// debugger:print padded_struct.data_ptr[1]
|
||||
// check:$13 = {x = 13, y = 14, z = 15}
|
||||
|
||||
struct AStruct {
|
||||
x: i16,
|
||||
y: i32,
|
||||
z: i16
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let empty : &[i64] = &[];
|
||||
let singleton : &[i64] = &[1];
|
||||
let multiple : &[i64] = &[2, 3, 4, 5];
|
||||
let slice_of_slice = multiple.slice(1,3);
|
||||
|
||||
let padded_tuple : &[(i32, i16)] = &[(6, 7), (8, 9)];
|
||||
|
||||
let padded_struct : &[AStruct] = &[
|
||||
AStruct { x: 10, y: 11, z: 12 },
|
||||
AStruct { x: 13, y: 14, z: 15 }
|
||||
];
|
||||
|
||||
zzz();
|
||||
}
|
||||
|
||||
fn zzz() {()}
|
||||
|
|
@ -8,28 +8,18 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// xfail-test
|
||||
|
||||
// compile-flags:-Z extra-debug-info
|
||||
// debugger:set print pretty off
|
||||
// debugger:break _zzz
|
||||
// debugger:break zzz
|
||||
// debugger:run
|
||||
// debugger:finish
|
||||
// debugger:print a
|
||||
// check:$1 = {1, 2, 3}
|
||||
// debugger:print b.vec[0]
|
||||
// check:$2 = 4
|
||||
// debugger:print c->boxed.data[1]
|
||||
// check:$3 = 8
|
||||
// debugger:print d->boxed.data[2]
|
||||
// check:$4 = 12
|
||||
|
||||
fn main() {
|
||||
let a = [1, 2, 3];
|
||||
let b = &[4, 5, 6];
|
||||
let c = @[7, 8, 9];
|
||||
let d = ~[10, 11, 12];
|
||||
_zzz();
|
||||
|
||||
zzz();
|
||||
}
|
||||
|
||||
fn _zzz() {()}
|
||||
fn zzz() {()}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue