use crate::{dbgeng::WinResult, dbgmodel::*, *};
use windows::Win32::System::Diagnostics::Debug::Extensions::IDebugHostSymbol;
use windy::WStr;
impl_debug_interface!(DebugHostSymbol, DebugHostSymbolRef, IDebugHostSymbol);
impl DebugHostSymbol {
pub fn get_context(&self) -> WinResult<DebugHostContext> {
unsafe { Ok(self.0.GetContext()?.into()) }
}
pub fn enumerate_children(
&self,
kind: impl Into<DbgModelSymbolKind>,
name: impl AsRef<WStr>,
) -> WinResult<DebugHostSymbolEnumerator> {
unsafe {
Ok(self
.0
.EnumerateChildren(kind.into().into(), pcw!(name))?
.into())
}
}
pub fn get_symbol_kind(&self) -> WinResult<DbgModelSymbolKind> {
unsafe { Ok(self.0.GetSymbolKind()?.into()) }
}
pub fn get_name(&self) -> WinResult<WString> {
unsafe {
Ok(WString::from_vec_with_nul_unchecked(
self.0.GetName()?.as_ref(),
))
}
}
pub fn get_type(&self) -> WinResult<DebugHostType> {
unsafe { Ok(self.0.GetType()?.into()) }
}
pub fn get_containing_module(&self) -> WinResult<DebugHostModule> {
unsafe { Ok(self.0.GetContainingModule()?.into()) }
}
pub fn compare_against(
&self,
comparison_symbol: &DebugHostSymbol,
) -> WinResult<bool> {
unsafe { self.0.CompareAgainst(comparison_symbol.as_raw(), 0) }
}
}