summaryrefslogtreecommitdiff
path: root/binaryview.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'binaryview.cpp')
-rw-r--r--binaryview.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/binaryview.cpp b/binaryview.cpp
index fa3ef646..861c7eb2 100644
--- a/binaryview.cpp
+++ b/binaryview.cpp
@@ -4795,6 +4795,19 @@ bool BinaryView::GetAddressForDataOffset(uint64_t offset, uint64_t& addr)
}
+bool BinaryView::GetDataOffsetForAddress(uint64_t addr, uint64_t& offset)
+{
+ auto segment = GetSegmentAt(addr);
+ if (segment && segment->GetStart() <= addr && addr < segment->GetEnd())
+ {
+ offset = 0;
+ offset = addr - segment->GetStart() + segment->GetDataOffset();
+ return true;
+ }
+ return false;
+}
+
+
void BinaryView::AddAutoSection(const string& name, uint64_t start, uint64_t length, BNSectionSemantics semantics,
const string& type, uint64_t align, uint64_t entrySize, const string& linkedSection, const string& infoSection,
uint64_t infoData)