|
| 1 | +//@ min-gdb-version: 14.0 |
| 2 | +//@ min-lldb-version: 1800 |
| 3 | + |
| 4 | +//@ compile-flags:-g |
| 5 | + |
| 6 | +// === GDB TESTS =================================================================================== |
| 7 | +// gdb-command:run |
| 8 | + |
| 9 | +// gdb-command:print plain_string |
| 10 | +// gdbr-check:$1 = alloc::string::String {vec: alloc::vec::Vec<u8, alloc::alloc::Global> {buf: alloc::raw_vec::RawVec<u8, alloc::alloc::Global> {ptr: core::ptr::unique::Unique<u8> {pointer: core::ptr::non_null::NonNull<u8> {pointer: 0x55555555ab80}, _marker: core::marker::PhantomData<u8>}, cap: alloc::raw_vec::Cap (5), alloc: alloc::alloc::Global}, len: 5}} |
| 11 | + |
| 12 | +// gdb-command:print plain_str |
| 13 | +// gdbr-check:$2 = "Hello" |
| 14 | + |
| 15 | +// gdb-command:print str_in_struct |
| 16 | +// gdbr-check:$3 = strings_and_strs::Foo {inner: "Hello"} |
| 17 | + |
| 18 | +// gdb-command:print str_in_tuple |
| 19 | +// gdbr-check:$4 = ("Hello", "World") |
| 20 | + |
| 21 | +// gdb-command:print str_in_rc |
| 22 | +// gdbr-check:$5 = alloc::rc::Rc<&str, alloc::alloc::Global> {ptr: core::ptr::non_null::NonNull<alloc::rc::RcBox<&str>> {pointer: 0x55555555aae0}, phantom: core::marker::PhantomData<alloc::rc::RcBox<&str>>, alloc: alloc::alloc::Global} |
| 23 | + |
| 24 | + |
| 25 | +// === LLDB TESTS ================================================================================== |
| 26 | +// lldb-command:run |
| 27 | +// lldb-command:v plain_string |
| 28 | +// lldbg-check:(alloc::string::String) plain_string = "Hello" { vec = size=5 { [0] = 'H' [1] = 'e' [2] = 'l' [3] = 'l' [4] = 'o' } } |
| 29 | + |
| 30 | +// lldb-command:v plain_str |
| 31 | +// lldbg-check:(&str) plain_str = "Hello" { [0] = 'H' [1] = 'e' [2] = 'l' [3] = 'l' [4] = 'o' } |
| 32 | + |
| 33 | +// lldb-command:v str_in_struct |
| 34 | +// 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' } } |
| 35 | + |
| 36 | +// lldb-command:v str_in_tuple |
| 37 | +// 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' } } |
| 38 | + |
| 39 | +// lldb-command:v str_in_rc |
| 40 | +// 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' } } |
| 41 | + |
| 42 | + |
| 43 | +#![allow(unused_variables)] |
| 44 | +#![feature(omit_gdb_pretty_printer_section)] |
| 45 | +#![omit_gdb_pretty_printer_section] |
| 46 | + |
| 47 | +pub struct Foo<'a> { |
| 48 | + inner: &'a str, |
| 49 | +} |
| 50 | + |
| 51 | +fn main() { |
| 52 | + let plain_string = String::from("Hello"); |
| 53 | + let plain_str = "Hello"; |
| 54 | + let str_in_struct = Foo { inner: "Hello" }; |
| 55 | + let str_in_tuple = ("Hello", "World"); |
| 56 | + |
| 57 | + let str_in_rc = std::rc::Rc::new("Hello"); |
| 58 | + zzz(); // #break |
| 59 | +} |
| 60 | + |
| 61 | +fn zzz() { |
| 62 | + () |
| 63 | +} |
0 commit comments