summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--binaryninjaapi.h1
-rw-r--r--binaryninjacore.h2
-rw-r--r--binaryview.cpp9
3 files changed, 11 insertions, 1 deletions
diff --git a/binaryninjaapi.h b/binaryninjaapi.h
index 510b392a..d8c3d468 100644
--- a/binaryninjaapi.h
+++ b/binaryninjaapi.h
@@ -1394,6 +1394,7 @@ namespace BinaryNinja
Architecture* GetArchitecture() const;
uint64_t GetTarget() const;
uint64_t GetReloc() const;
+ Ref<Symbol> GetSymbol() const;
};
diff --git a/binaryninjacore.h b/binaryninjacore.h
index df378dc4..4eb6d3f7 100644
--- a/binaryninjacore.h
+++ b/binaryninjacore.h
@@ -3525,7 +3525,7 @@ extern "C"
BINARYNINJACOREAPI BNArchitecture* BNRelocationGetArchitecture(BNRelocation* reloc);
BINARYNINJACOREAPI uint64_t BNRelocationGetTarget(BNRelocation* reloc);
BINARYNINJACOREAPI uint64_t BNRelocationGetReloc(BNRelocation* reloc);
-
+ BINARYNINJACOREAPI BNSymbol* BNRelocationGetSymbol(BNRelocation* reloc);
// Segment object methods
BINARYNINJACOREAPI BNSegment* BNCreateSegment(uint64_t start, uint64_t length, uint64_t dataOffset, uint64_t dataLength, uint32_t flags,
bool autoDefined);
diff --git a/binaryview.cpp b/binaryview.cpp
index 7aa2118f..6e5c3b14 100644
--- a/binaryview.cpp
+++ b/binaryview.cpp
@@ -2230,6 +2230,15 @@ uint64_t Relocation::GetReloc() const
}
+Ref<Symbol> Relocation::GetSymbol() const
+{
+ BNSymbol* sym = BNRelocationGetSymbol(m_object);
+ if (!sym)
+ return nullptr;
+ return new Symbol(sym);
+}
+
+
BinaryData::BinaryData(FileMetadata* file): BinaryView(BNCreateBinaryDataView(file->GetObject()))
{
}