diff options
| author | rose <47357290+rose4096@users.noreply.github.com> | 2022-06-09 17:06:30 -0400 |
|---|---|---|
| committer | rose <47357290+rose4096@users.noreply.github.com> | 2022-06-09 17:06:30 -0400 |
| commit | 94649dde0d847aa2407d565632f7d2c3cdff32f5 (patch) | |
| tree | 3af9509057f2fea45c6ae11a8e54d2cd57132bda /rust/src | |
| parent | 3556fc9c0cf451739df838ad78b5be52a2d482f3 (diff) | |
Add `IsExternal` callback to debug info API
Diffstat (limited to 'rust/src')
| -rw-r--r-- | rust/src/debuginfo.rs | 17 |
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); } |
