use crate::{lldb_addr_t, sys, DescriptionLevel, SBAddress, SBBreakpoint, SBStream};
use std::fmt;
pub struct SBBreakpointLocation {
pub raw: sys::SBBreakpointLocationRef,
}
impl SBBreakpointLocation {
pub(crate) fn maybe_wrap(raw: sys::SBBreakpointLocationRef) -> Option<SBBreakpointLocation> {
if unsafe { sys::SBBreakpointLocationIsValid(raw) } {
Some(SBBreakpointLocation { raw })
} else {
None
}
}
pub fn is_valid(&self) -> bool {
unsafe { sys::SBBreakpointLocationIsValid(self.raw) }
}
#[allow(missing_docs)]
pub fn id(&self) -> i32 {
unsafe { sys::SBBreakpointLocationGetID(self.raw) }
}
#[allow(missing_docs)]
pub fn address(&self) -> Option<SBAddress> {
SBAddress::maybe_wrap(unsafe { sys::SBBreakpointLocationGetAddress(self.raw) })
}
#[allow(missing_docs)]
pub fn load_address(&self) -> lldb_addr_t {
unsafe { sys::SBBreakpointLocationGetLoadAddress(self.raw) }
}
#[allow(missing_docs)]
pub fn is_enabled(&self) -> bool {
unsafe { sys::SBBreakpointLocationIsEnabled(self.raw) }
}
#[allow(missing_docs)]
pub fn set_enabled(&self, enabled: bool) {
unsafe { sys::SBBreakpointLocationSetEnabled(self.raw, enabled) }
}
#[allow(missing_docs)]
pub fn hit_count(&self) -> u32 {
unsafe { sys::SBBreakpointLocationGetHitCount(self.raw) }
}
#[allow(missing_docs)]
pub fn ignore_count(&self) -> u32 {
unsafe { sys::SBBreakpointLocationGetIgnoreCount(self.raw) }
}
#[allow(missing_docs)]
pub fn set_ignore_count(&self, count: u32) {
unsafe { sys::SBBreakpointLocationSetIgnoreCount(self.raw, count) }
}
#[allow(missing_docs)]
pub fn is_resolved(&self) -> bool {
unsafe { sys::SBBreakpointLocationIsResolved(self.raw) }
}
#[allow(missing_docs)]
pub fn breakpoint(&self) -> SBBreakpoint {
SBBreakpoint::wrap(unsafe { sys::SBBreakpointLocationGetBreakpoint(self.raw) })
}
}
impl Clone for SBBreakpointLocation {
fn clone(&self) -> SBBreakpointLocation {
SBBreakpointLocation {
raw: unsafe { sys::CloneSBBreakpointLocation(self.raw) },
}
}
}
impl fmt::Debug for SBBreakpointLocation {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
let stream = SBStream::new();
unsafe {
sys::SBBreakpointLocationGetDescription(self.raw, stream.raw, DescriptionLevel::Brief)
};
write!(fmt, "SBBreakpointLocation {{ {} }}", stream.data())
}
}
impl Drop for SBBreakpointLocation {
fn drop(&mut self) {
unsafe { sys::DisposeSBBreakpointLocation(self.raw) };
}
}
unsafe impl Send for SBBreakpointLocation {}
unsafe impl Sync for SBBreakpointLocation {}
#[cfg(feature = "graphql")]
#[juniper::graphql_object]
impl SBBreakpointLocation {
fn id() -> i32 {
self.id()
}
fn address() -> Option<SBAddress> {
self.address()
}
fn load_address() -> i32 {
self.load_address() as i32
}
fn is_enabled() -> bool {
self.is_enabled()
}
fn ignore_count() -> i32 {
self.ignore_count() as i32
}
fn is_resolved() -> bool {
self.is_resolved()
}
fn breakpoint() -> SBBreakpoint {
self.breakpoint()
}
}