2021-03-30 17:43:39 +00:00
|
|
|
// pretty-printers are not loaded
|
2019-05-14 12:50:58 +00:00
|
|
|
// compile-flags:-g
|
|
|
|
|
|
|
|
// min-gdb-version: 8.1
|
2021-03-30 17:43:39 +00:00
|
|
|
// min-cdb-version: 10.0.18317.1001
|
2019-05-14 12:50:58 +00:00
|
|
|
|
|
|
|
// === GDB TESTS ==================================================================================
|
|
|
|
|
|
|
|
// gdb-command:run
|
|
|
|
|
|
|
|
// gdb-command:print r
|
|
|
|
// gdb-check:[...]$1 = Rc(strong=2, weak=1) = {value = 42, strong = 2, weak = 1}
|
|
|
|
// gdb-command:print a
|
|
|
|
// gdb-check:[...]$2 = Arc(strong=2, weak=1) = {value = 42, strong = 2, weak = 1}
|
|
|
|
|
|
|
|
|
|
|
|
// === LLDB TESTS ==================================================================================
|
|
|
|
|
|
|
|
// lldb-command:run
|
|
|
|
|
|
|
|
// lldb-command:print r
|
|
|
|
// lldb-check:[...]$0 = strong=2, weak=1 { value = 42 }
|
|
|
|
// lldb-command:print a
|
|
|
|
// lldb-check:[...]$1 = strong=2, weak=1 { data = 42 }
|
|
|
|
|
2021-03-30 17:43:39 +00:00
|
|
|
// === CDB TESTS ==================================================================================
|
|
|
|
|
|
|
|
// cdb-command:g
|
|
|
|
|
|
|
|
// cdb-command:dx r,d
|
|
|
|
// cdb-check:r,d : 42 [Type: alloc::rc::Rc<i32>]
|
2021-06-30 21:23:44 +00:00
|
|
|
// cdb-check: [<Raw View>] [Type: alloc::rc::Rc<i32>]
|
|
|
|
// cdb-check: [Reference count] : 2 [Type: core::cell::Cell<usize>]
|
2021-07-12 17:26:01 +00:00
|
|
|
// cdb-check: [Weak reference count] : 2 [Type: core::cell::Cell<usize>]
|
2021-03-30 17:43:39 +00:00
|
|
|
|
|
|
|
// cdb-command:dx r1,d
|
|
|
|
// cdb-check:r1,d : 42 [Type: alloc::rc::Rc<i32>]
|
2021-06-30 21:23:44 +00:00
|
|
|
// cdb-check: [<Raw View>] [Type: alloc::rc::Rc<i32>]
|
|
|
|
// cdb-check: [Reference count] : 2 [Type: core::cell::Cell<usize>]
|
2021-07-12 17:26:01 +00:00
|
|
|
// cdb-check: [Weak reference count] : 2 [Type: core::cell::Cell<usize>]
|
2021-03-30 17:43:39 +00:00
|
|
|
|
|
|
|
// cdb-command:dx w1,d
|
2021-06-30 21:23:44 +00:00
|
|
|
// cdb-check:w1,d : 42 [Type: alloc::rc::Weak<i32>]
|
|
|
|
// cdb-check: [<Raw View>] [Type: alloc::rc::Weak<i32>]
|
2021-07-12 17:26:01 +00:00
|
|
|
// cdb-check: [Reference count] : 2 [Type: core::cell::Cell<usize>]
|
|
|
|
// cdb-check: [Weak reference count] : 2 [Type: core::cell::Cell<usize>]
|
2021-03-30 17:43:39 +00:00
|
|
|
|
|
|
|
// cdb-command:dx a,d
|
|
|
|
// cdb-check:a,d : 42 [Type: alloc::sync::Arc<i32>]
|
2021-06-30 21:23:44 +00:00
|
|
|
// cdb-check: [<Raw View>] [Type: alloc::sync::Arc<i32>]
|
|
|
|
// cdb-check: [Reference count] : 2 [Type: core::sync::atomic::AtomicUsize]
|
2021-07-12 17:26:01 +00:00
|
|
|
// cdb-check: [Weak reference count] : 2 [Type: core::sync::atomic::AtomicUsize]
|
2021-03-30 17:43:39 +00:00
|
|
|
|
|
|
|
// cdb-command:dx a1,d
|
|
|
|
// cdb-check:a1,d : 42 [Type: alloc::sync::Arc<i32>]
|
2021-06-30 21:23:44 +00:00
|
|
|
// cdb-check: [<Raw View>] [Type: alloc::sync::Arc<i32>]
|
|
|
|
// cdb-check: [Reference count] : 2 [Type: core::sync::atomic::AtomicUsize]
|
2021-07-12 17:26:01 +00:00
|
|
|
// cdb-check: [Weak reference count] : 2 [Type: core::sync::atomic::AtomicUsize]
|
2021-03-30 17:43:39 +00:00
|
|
|
|
|
|
|
// cdb-command:dx w2,d
|
|
|
|
// cdb-check:w2,d : 42 [Type: alloc::sync::Weak<i32>]
|
2021-06-30 21:23:44 +00:00
|
|
|
// cdb-check: [<Raw View>] [Type: alloc::sync::Weak<i32>]
|
2021-07-12 17:26:01 +00:00
|
|
|
// cdb-check: [Reference count] : 2 [Type: core::sync::atomic::AtomicUsize]
|
|
|
|
// cdb-check: [Weak reference count] : 2 [Type: core::sync::atomic::AtomicUsize]
|
2021-03-30 17:43:39 +00:00
|
|
|
|
2019-05-14 12:50:58 +00:00
|
|
|
use std::rc::Rc;
|
|
|
|
use std::sync::Arc;
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let r = Rc::new(42);
|
|
|
|
let r1 = Rc::clone(&r);
|
|
|
|
let w1 = Rc::downgrade(&r);
|
|
|
|
|
|
|
|
let a = Arc::new(42);
|
|
|
|
let a1 = Arc::clone(&a);
|
|
|
|
let w2 = Arc::downgrade(&a);
|
|
|
|
|
2021-07-03 18:06:51 +00:00
|
|
|
zzz(); // #break
|
2019-05-14 12:50:58 +00:00
|
|
|
}
|
2021-07-03 18:06:51 +00:00
|
|
|
|
|
|
|
fn zzz() { () }
|