summaryrefslogtreecommitdiff
path: root/rust/src
diff options
context:
space:
mode:
Diffstat (limited to 'rust/src')
-rw-r--r--rust/src/debuginfo.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/rust/src/debuginfo.rs b/rust/src/debuginfo.rs
index 56786d19..3ed4e3c6 100644
--- a/rust/src/debuginfo.rs
+++ b/rust/src/debuginfo.rs
@@ -131,6 +131,10 @@ impl DebugInfoParser {
unsafe { BNIsDebugInfoParserValidForView(self.handle, view.handle) }
}
+ pub fn is_external(&self) -> bool {
+ unsafe { BNIsDebugInfoParserExternal(self.handle) }
+ }
+
/// Returns a `DebugInfo` object populated with debug info by this debug-info parser. Only provide a `DebugInfo` object if you wish to append to the existing debug info
pub fn parse_debug_info(
&self,
@@ -157,6 +161,17 @@ impl DebugInfoParser {
S: BnStrCompatible,
C: CustomDebugInfoParser,
{
+ extern "C" fn cb_is_external<C>(ctxt: *mut c_void) -> bool
+ where
+ C: CustomDebugInfoParser,
+ {
+ ffi_wrap!("CustomDebugInfoParser::is_external", unsafe {
+ let cmd = &*(ctxt as *const C);
+
+ cmd.is_external()
+ })
+ }
+
extern "C" fn cb_is_valid<C>(ctxt: *mut c_void, view: *mut BNBinaryView) -> bool
where
C: CustomDebugInfoParser,
@@ -192,6 +207,7 @@ impl DebugInfoParser {
unsafe {
DebugInfoParser::from_raw(BNRegisterDebugInfoParser(
name_ptr,
+ Some(cb_is_external::<C>),
Some(cb_is_valid::<C>),
Some(cb_parse_info::<C>),
ctxt as *mut _,
@@ -643,6 +659,7 @@ impl ToOwned for DebugInfo {
/// Implement this trait to implement a debug info parser. See `DebugInfoParser` for more details.
pub trait CustomDebugInfoParser: 'static + Sync {
+ fn is_external(&self) -> bool;
fn is_valid(&self, view: &BinaryView) -> bool;
fn parse_info(&self, debug_info: &mut DebugInfo, view: &BinaryView);
}