2014-10-09 14:31:03 +00:00
//@ min-lldb-version: 310
2017-02-04 10:44:29 +00:00
//@ ignore-gdb-version: 7.11.90 - 7.12.9
2013-11-04 06:53:01 +00:00
2014-02-07 03:57:09 +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
2013-07-01 10:11:29 +00:00
2014-04-24 09:35:48 +00:00
// gdb-command:print packed
2016-10-25 21:32:04 +00:00
// gdbg-check:$1 = {x = 123, y = 234, z = 345}
// gdbr-check:$1 = packed_struct::Packed {x: 123, y: 234, z: 345}
2013-07-01 10:11:29 +00:00
2014-04-24 09:35:48 +00:00
// gdb-command:print packedInPacked
2016-10-25 21:32:04 +00:00
// gdbg-check:$2 = {a = 1111, b = {x = 2222, y = 3333, z = 4444}, c = 5555, d = {x = 6666, y = 7777, z = 8888}}
// gdbr-check:$2 = packed_struct::PackedInPacked {a: 1111, b: packed_struct::Packed {x: 2222, y: 3333, z: 4444}, c: 5555, d: packed_struct::Packed {x: 6666, y: 7777, z: 8888}}
2013-07-01 10:11:29 +00:00
2014-04-24 09:35:48 +00:00
// gdb-command:print packedInUnpacked
2016-10-25 21:32:04 +00:00
// gdbg-check:$3 = {a = -1111, b = {x = -2222, y = -3333, z = -4444}, c = -5555, d = {x = -6666, y = -7777, z = -8888}}
// gdbr-check:$3 = packed_struct::PackedInUnpacked {a: -1111, b: packed_struct::Packed {x: -2222, y: -3333, z: -4444}, c: -5555, d: packed_struct::Packed {x: -6666, y: -7777, z: -8888}}
2013-07-01 10:11:29 +00:00
2014-04-24 09:35:48 +00:00
// gdb-command:print unpackedInPacked
2016-10-25 21:32:04 +00:00
// gdbg-check:$4 = {a = 987, b = {x = 876, y = 765, z = 654, w = 543}, c = {x = 432, y = 321, z = 210, w = 109}, d = -98}
// gdbr-check:$4 = packed_struct::UnpackedInPacked {a: 987, b: packed_struct::Unpacked {x: 876, y: 765, z: 654, w: 543}, c: packed_struct::Unpacked {x: 432, y: 321, z: 210, w: 109}, d: -98}
2013-07-01 10:11:29 +00:00
2014-04-24 09:35:48 +00:00
// gdb-command:print sizeof(packed)
// gdb-check:$5 = 14
2013-07-01 10:11:29 +00:00
2014-04-24 09:35:48 +00:00
// gdb-command:print sizeof(packedInPacked)
// gdb-check:$6 = 40
2013-07-01 10:11:29 +00:00
2014-07-09 12:46:09 +00:00
// === LLDB TESTS ==================================================================================
// lldb-command:run
2024-03-15 14:05:57 +00:00
// lldb-command:v packed
2024-03-10 13:55:58 +00:00
// lldbg-check:[...] { x = 123 y = 234 z = 345 }
2019-05-14 12:50:58 +00:00
// lldbr-check:(packed_struct::Packed) packed = { x = 123 y = 234 z = 345 }
2014-07-09 12:46:09 +00:00
2024-03-15 14:05:57 +00:00
// lldb-command:v packedInPacked
2024-03-10 13:55:58 +00:00
// lldbg-check:[...] { a = 1111 b = { x = 2222 y = 3333 z = 4444 } c = 5555 d = { x = 6666 y = 7777 z = 8888 } }
2019-05-14 12:50:58 +00:00
// lldbr-check:(packed_struct::PackedInPacked) packedInPacked = { a = 1111 b = { x = 2222 y = 3333 z = 4444 } c = 5555 d = { x = 6666 y = 7777 z = 8888 } }
2014-07-09 12:46:09 +00:00
2024-03-15 14:05:57 +00:00
// lldb-command:v packedInUnpacked
2024-03-10 13:55:58 +00:00
// lldbg-check:[...] { a = -1111 b = { x = -2222 y = -3333 z = -4444 } c = -5555 d = { x = -6666 y = -7777 z = -8888 } }
2019-05-14 12:50:58 +00:00
// lldbr-check:(packed_struct::PackedInUnpacked) packedInUnpacked = { a = -1111 b = { x = -2222 y = -3333 z = -4444 } c = -5555 d = { x = -6666 y = -7777 z = -8888 } }
2014-07-09 12:46:09 +00:00
2024-03-15 14:05:57 +00:00
// lldb-command:v unpackedInPacked
2024-03-10 13:55:58 +00:00
// lldbg-check:[...] { a = 987 b = { x = 876 y = 765 z = 654 w = 543 } c = { x = 432 y = 321 z = 210 w = 109 } d = -98 }
2019-05-14 12:50:58 +00:00
// lldbr-check:(packed_struct::UnpackedInPacked) unpackedInPacked = { a = 987 b = { x = 876 y = 765 z = 654 w = 543 } c = { x = 432 y = 321 z = 210 w = 109 } d = -98 }
2014-07-09 12:46:09 +00:00
2024-03-15 20:08:06 +00:00
// lldb-command:expr sizeof(packed)
2024-03-10 13:55:58 +00:00
// lldbg-check:[...] 14
2024-03-15 20:08:06 +00:00
// lldbr-check:(usize) [...] 14
2014-07-09 12:46:09 +00:00
2024-03-15 20:08:06 +00:00
// lldb-command:expr sizeof(packedInPacked)
2024-03-10 13:55:58 +00:00
// lldbg-check:[...] 40
2024-03-15 20:08:06 +00:00
// lldbr-check:(usize) [...] 40
2014-07-09 12:46:09 +00:00
2014-10-27 22:37:07 +00:00
#![ allow(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 ]
2013-08-17 15:37:42 +00:00
2014-05-27 06:56:52 +00:00
#[ repr(packed) ]
2013-07-01 10:11:29 +00:00
struct Packed {
x : i16 ,
y : i32 ,
z : i64
}
2014-05-27 06:56:52 +00:00
#[ repr(packed) ]
2013-07-01 10:11:29 +00:00
struct PackedInPacked {
a : i32 ,
b : Packed ,
c : i64 ,
d : Packed
}
2013-07-20 08:47:24 +00:00
// layout (64 bit): aaaa bbbb bbbb bbbb bb.. .... cccc cccc dddd dddd dddd dd..
2013-07-01 10:11:29 +00:00
struct PackedInUnpacked {
a : i32 ,
b : Packed ,
c : i64 ,
d : Packed
}
2013-07-20 08:47:24 +00:00
// layout (64 bit): xx.. yyyy zz.. .... wwww wwww
2013-07-01 10:11:29 +00:00
struct Unpacked {
x : i16 ,
y : i32 ,
z : i16 ,
w : i64
}
2013-07-20 08:47:24 +00:00
// layout (64 bit): aabb bbbb bbbb bbbb bbbb bbbb bbcc cccc cccc cccc cccc cccc ccdd dddd dd
2014-05-27 06:56:52 +00:00
#[ repr(packed) ]
2013-07-01 10:11:29 +00:00
struct UnpackedInPacked {
a : i16 ,
b : Unpacked ,
c : Unpacked ,
d : i64
}
fn main ( ) {
let packed = Packed { x : 123 , y : 234 , z : 345 } ;
let packedInPacked = PackedInPacked {
a : 1111 ,
b : Packed { x : 2222 , y : 3333 , z : 4444 } ,
c : 5555 ,
d : Packed { x : 6666 , y : 7777 , z : 8888 }
} ;
let packedInUnpacked = PackedInUnpacked {
a : - 1111 ,
b : Packed { x : - 2222 , y : - 3333 , z : - 4444 } ,
c : - 5555 ,
d : Packed { x : - 6666 , y : - 7777 , z : - 8888 }
} ;
let unpackedInPacked = UnpackedInPacked {
a : 987 ,
b : Unpacked { x : 876 , y : 765 , z : 654 , w : 543 } ,
c : Unpacked { x : 432 , y : 321 , z : 210 , w : 109 } ,
d : - 98
} ;
2014-07-09 12:46:09 +00:00
zzz ( ) ; // #break
2013-07-01 10:11:29 +00:00
}
2013-08-17 15:37:42 +00:00
fn zzz ( ) { ( ) }