1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
use std::ffi::CString;
use super::address::SBAddress;
use super::thread::SBThread;
use sys;
pub struct SBQueueItem {
pub raw: sys::SBQueueItemRef,
}
impl SBQueueItem {
pub fn wrap(raw: sys::SBQueueItemRef) -> SBQueueItem {
SBQueueItem { raw: raw }
}
pub fn maybe_wrap(raw: sys::SBQueueItemRef) -> Option<SBQueueItem> {
if unsafe { sys::SBQueueItemIsValid(raw) != 0 } {
Some(SBQueueItem { raw: raw })
} else {
None
}
}
pub fn is_valid(&self) -> bool {
unsafe { sys::SBQueueItemIsValid(self.raw) != 0 }
}
pub fn kind(&self) -> sys::QueueItemKind {
unsafe { sys::SBQueueItemGetKind(self.raw) }
}
pub fn address(&self) -> Option<SBAddress> {
SBAddress::maybe_wrap(unsafe { sys::SBQueueItemGetAddress(self.raw) })
}
pub fn extended_backtrace_thread(&self, thread_type: &str) -> Option<SBThread> {
let thread_type = CString::new(thread_type).unwrap();
SBThread::maybe_wrap(unsafe {
sys::SBQueueItemGetExtendedBacktraceThread(self.raw, thread_type.as_ptr())
})
}
}
impl Drop for SBQueueItem {
fn drop(&mut self) {
unsafe { sys::DisposeSBQueueItem(self.raw) };
}
}
#[cfg(feature = "graphql")]
graphql_object!(SBQueueItem: super::debugger::SBDebugger | &self | {
field is_valid() -> bool {
self.is_valid()
}
});