|
| 1 | +// Require a gdb or lldb that can read DW_TAG_variant_part. |
| 2 | +//@ min-gdb-version: 8.2 |
| 3 | +//@ min-lldb-version: 1800 |
| 4 | + |
| 5 | +//@ compile-flags:-g |
| 6 | + |
| 7 | +// === GDB TESTS =================================================================================== |
| 8 | +// gdb-command:run |
| 9 | + |
| 10 | +// gdb-command:print plain_string |
| 11 | +// gdbr-check:$1 = "Hello" |
| 12 | + |
| 13 | +// gdb-command:print plain_str |
| 14 | +// gdbr-check:$2 = "Hello" |
| 15 | + |
| 16 | +// gdb-command:print str_in_struct |
| 17 | +// gdbr-check:$3 = strings_and_strs::Foo {inner: "Hello"} |
| 18 | + |
| 19 | +// gdb-command:print str_in_tuple |
| 20 | +// gdbr-check:$4 = ("Hello", "World") |
| 21 | + |
| 22 | +// gdb-command:print str_in_rc |
| 23 | +// gdbr-check:$5 = Rc(strong=1, weak=0) = {value = "Hello", strong = 1, weak = 0} |
| 24 | + |
| 25 | + |
| 26 | +// === LLDB TESTS ================================================================================== |
| 27 | +// lldb-command:run |
| 28 | +// lldb-command:v plain_string |
| 29 | +// lldbg-check:(alloc::string::String) plain_string = "Hello" { vec = size=5 { [0] = 'H' [1] = 'e' [2] = 'l' [3] = 'l' [4] = 'o' } } |
| 30 | + |
| 31 | +// lldb-command:v plain_str |
| 32 | +// lldbg-check:(&str) plain_str = "Hello" { [0] = 'H' [1] = 'e' [2] = 'l' [3] = 'l' [4] = 'o' } |
| 33 | + |
| 34 | +// lldb-command:v str_in_struct |
| 35 | +// lldbg-check:((&str, &str)) str_in_tuple = { 0 = "Hello" { [0] = 'H' [1] = 'e' [2] = 'l' [3] = 'l' [4] = 'o' } 1 = "World" { [0] = 'W' [1] = 'o' [2] = 'r' [3] = 'l' [4] = 'd' } } |
| 36 | + |
| 37 | +// lldb-command:v str_in_tuple |
| 38 | +// lldbg-check:((&str, &str)) str_in_tuple = { 0 = "Hello" { [0] = 'H' [1] = 'e' [2] = 'l' [3] = 'l' [4] = 'o' } 1 = "World" { [0] = 'W' [1] = 'o' [2] = 'r' [3] = 'l' [4] = 'd' } } |
| 39 | + |
| 40 | +// lldb-command:v str_in_rc |
| 41 | +// lldbg-check:(alloc::rc::Rc<&str, alloc::alloc::Global>) str_in_rc = strong=1, weak=0 { value = "Hello" { [0] = 'H' [1] = 'e' [2] = 'l' [3] = 'l' [4] = 'o' } } |
| 42 | + |
| 43 | + |
| 44 | +#![allow(unused_variables)] |
| 45 | + |
| 46 | +pub struct Foo<'a> { |
| 47 | + inner: &'a str, |
| 48 | +} |
| 49 | + |
| 50 | +fn main() { |
| 51 | + let plain_string = String::from("Hello"); |
| 52 | + let plain_str = "Hello"; |
| 53 | + let str_in_struct = Foo { inner: "Hello" }; |
| 54 | + let str_in_tuple = ("Hello", "World"); |
| 55 | + |
| 56 | + let str_in_rc = std::rc::Rc::new("Hello"); |
| 57 | + zzz(); // #break |
| 58 | +} |
| 59 | + |
| 60 | +fn zzz() { |
| 61 | + () |
| 62 | +} |
0 commit comments