Add relocation in the Abstract layer

The abstracted attributes are:
  * Address: virtual address where the relocation occurs
  * Size: size in bits of the relocation

See: LIEF::Relocation / lief.Relocation and abstract_reader

Resolve: #53
This commit is contained in:
Romain Thomas
2017-09-05 22:00:31 +02:00
parent 58bf7a2987
commit 9503f2fc7b
42 changed files with 785 additions and 214 deletions
+11 -4
View File
@@ -28,20 +28,27 @@ template<class T>
using setter_t = void (RelocationEntry::*)(T);
void init_PE_RelocationEntry_class(py::module& m) {
py::class_<RelocationEntry>(m, "RelocationEntry")
py::class_<RelocationEntry, LIEF::Relocation>(m, "RelocationEntry")
.def(py::init<>())
.def_property("data",
static_cast<getter_t<uint16_t>>(&RelocationEntry::data),
static_cast<setter_t<uint16_t>>(&RelocationEntry::data))
static_cast<setter_t<uint16_t>>(&RelocationEntry::data),
"Raw data of the relocation:\n\n"
"\t\t * The **high** 4 bits store the relocation :attr:`~lief.PE.RelocationEntry.type`\n\n"
"\t\t * The **low** 12 bits store the relocation offset (:attr:`~lief.PE.RelocationEntry.position`)\n\n"
)
.def_property("position",
static_cast<getter_t<uint16_t>>(&RelocationEntry::position),
static_cast<setter_t<uint16_t>>(&RelocationEntry::position))
static_cast<setter_t<uint16_t>>(&RelocationEntry::position),
"Offset - relative to :attr:`~lief.PE.Relocation.virtual_address` - where the relocation occurs")
.def_property("type",
static_cast<getter_t<RELOCATIONS_BASE_TYPES>>(&RelocationEntry::type),
static_cast<setter_t<RELOCATIONS_BASE_TYPES>>(&RelocationEntry::type))
static_cast<setter_t<RELOCATIONS_BASE_TYPES>>(&RelocationEntry::type),
"Type of the relocation")
.def("__eq__", &RelocationEntry::operator==)