summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyleMiles <krm504@nyu.edu>2022-07-07 19:39:18 -0400
committerKyleMiles <krm504@nyu.edu>2022-07-07 19:39:18 -0400
commitb9c6552982ab353c57259a577b91cff986646566 (patch)
tree9e144372e7b6064f0a32917ad600f67d7b9b4545
parentc7854604f7610fbde01a981d85c0cad3df29ceae (diff)
Revert 94649dde0d847aa2407d565632f7d2c3cdff32f5: "Add IsExternal callback to debug info API"
-rw-r--r--binaryninjaapi.h3
-rw-r--r--binaryninjacore.h4
-rw-r--r--debuginfo.cpp14
-rw-r--r--rust/src/debuginfo.rs17
4 files changed, 2 insertions, 36 deletions
diff --git a/binaryninjaapi.h b/binaryninjaapi.h
index 8c3c8a1a..eb605e8a 100644
--- a/binaryninjaapi.h
+++ b/binaryninjaapi.h
@@ -6964,13 +6964,11 @@ namespace BinaryNinja {
std::string GetName() const;
Ref<DebugInfo> Parse(Ref<BinaryView> view, Ref<DebugInfo> existingDebugInfo = nullptr) const;
- bool IsExternal() const;
bool IsValidForView(const Ref<BinaryView> view) const;
};
class CustomDebugInfoParser : public DebugInfoParser
{
- static bool IsExternalCallback(void* ctxt);
static bool IsValidCallback(void* ctxt, BNBinaryView* view);
static void ParseCallback(void* ctxt, BNDebugInfo* debugInfo, BNBinaryView* view);
BNDebugInfoParser* Register(const std::string& name);
@@ -6979,7 +6977,6 @@ namespace BinaryNinja {
CustomDebugInfoParser(const std::string& name);
virtual ~CustomDebugInfoParser() {}
- virtual bool IsExternal() = 0;
virtual bool IsValid(Ref<BinaryView>) = 0;
virtual void ParseInfo(Ref<DebugInfo>, Ref<BinaryView>) = 0;
};
diff --git a/binaryninjacore.h b/binaryninjacore.h
index acbcb0e3..707c32df 100644
--- a/binaryninjacore.h
+++ b/binaryninjacore.h
@@ -6154,15 +6154,13 @@ extern "C"
BINARYNINJACOREAPI char* BNRustSimplifyStrToStr(const char* const);
BINARYNINJACOREAPI BNDebugInfoParser* BNRegisterDebugInfoParser(const char* name,
- bool(*IsExternal)(void*), bool (*isValid)(void*, BNBinaryView*),
- void (*parseInfo)(void*, BNDebugInfo*, BNBinaryView*), void* context);
+ bool (*isValid)(void*, BNBinaryView*), void (*parseInfo)(void*, BNDebugInfo*, BNBinaryView*), void* context);
BINARYNINJACOREAPI void BNUnregisterDebugInfoParser(const char* rawName);
BINARYNINJACOREAPI BNDebugInfoParser* BNGetDebugInfoParserByName(const char* name);
BINARYNINJACOREAPI BNDebugInfoParser** BNGetDebugInfoParsers(size_t* count);
BINARYNINJACOREAPI BNDebugInfoParser** BNGetDebugInfoParsersForView(BNBinaryView* view, size_t* count);
BINARYNINJACOREAPI char* BNGetDebugInfoParserName(BNDebugInfoParser* parser);
BINARYNINJACOREAPI bool BNIsDebugInfoParserValidForView(BNDebugInfoParser* parser, BNBinaryView* view);
- BINARYNINJACOREAPI bool BNIsDebugInfoParserExternal(BNDebugInfoParser* parser);
BINARYNINJACOREAPI BNDebugInfo* BNParseDebugInfo(
BNDebugInfoParser* parser, BNBinaryView* view, BNDebugInfo* existingDebugInfo);
BINARYNINJACOREAPI BNDebugInfoParser* BNNewDebugInfoParserReference(BNDebugInfoParser* parser);
diff --git a/debuginfo.cpp b/debuginfo.cpp
index 59636d4a..e8450399 100644
--- a/debuginfo.cpp
+++ b/debuginfo.cpp
@@ -222,12 +222,6 @@ Ref<DebugInfo> DebugInfoParser::Parse(Ref<BinaryView> view, Ref<DebugInfo> exist
}
-bool DebugInfoParser::IsExternal() const
-{
- return BNIsDebugInfoParserExternal(m_object);
-}
-
-
bool DebugInfoParser::IsValidForView(const Ref<BinaryView> view) const
{
return BNIsDebugInfoParserValidForView(m_object, view->GetObject());
@@ -238,12 +232,6 @@ bool DebugInfoParser::IsValidForView(const Ref<BinaryView> view) const
// Plugin registration APIs //
//////////////////////////////
-bool CustomDebugInfoParser::IsExternalCallback(void* ctxt)
-{
- CustomDebugInfoParser* parser = (CustomDebugInfoParser*)ctxt;
- return parser->IsExternal();
-}
-
bool CustomDebugInfoParser::IsValidCallback(void* ctxt, BNBinaryView* view)
{
@@ -261,5 +249,5 @@ void CustomDebugInfoParser::ParseCallback(void* ctxt, BNDebugInfo* debugInfo, BN
CustomDebugInfoParser::CustomDebugInfoParser(const string& name) :
DebugInfoParser(
- BNNewDebugInfoParserReference(BNRegisterDebugInfoParser(name.c_str(), IsExternalCallback, IsValidCallback, ParseCallback, this)))
+ BNNewDebugInfoParserReference(BNRegisterDebugInfoParser(name.c_str(), IsValidCallback, ParseCallback, this)))
{}
diff --git a/rust/src/debuginfo.rs b/rust/src/debuginfo.rs
index 3ed4e3c6..56786d19 100644
--- a/rust/src/debuginfo.rs
+++ b/rust/src/debuginfo.rs
@@ -131,10 +131,6 @@ 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,
@@ -161,17 +157,6 @@ 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,
@@ -207,7 +192,6 @@ 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 _,
@@ -659,7 +643,6 @@ 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);
}