MCPcopy Create free account
hub / github.com/Vector35/binaryninja-api / get_data_offset_for_address

Method get_data_offset_for_address

python/binaryview.py:9567–9582  ·  view source on GitHub ↗

``get_data_offset_for_address`` returns the file offset that maps to the given virtual address, if possible. If `address` falls within a bss segment or an external segment, for example, no mapping is possible, and `None` will be returned. :param int address: virtual address :return: the f

(self, address: int)

Source from the content-addressed store, hash-verified

9565 return address.value
9566
9567 def get_data_offset_for_address(self, address: int) -> Optional[int]:
9568 """
9569 ``get_data_offset_for_address`` returns the file offset that maps to the given virtual address, if possible.
9570
9571 If `address` falls within a bss segment or an external segment, for example, no mapping is possible, and `None` will be returned.
9572
9573 :param int address: virtual address
9574 :return: the file location that is mapped to the given virtual address, or None if no such mapping is possible
9575 :rtype: Int
9576 """
9577 segment = self.get_segment_at(address)
9578 if segment is not None and segment.start <= address < segment.end:
9579 offset = address - segment.start
9580 if offset < segment.data_length:
9581 return offset + segment.data_offset
9582 return None
9583
9584 def add_auto_section(
9585 self, name: str, start: int, length: int,

Callers 1

_get_current_raw_offsetFunction · 0.80

Calls 1

get_segment_atMethod · 0.95

Tested by

no test coverage detected