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

Method ProcessVFTBaseClassInfo

plugins/rtti/itanium.cpp:414–440  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

412
413
414std::optional<BaseClassInfo> ItaniumRTTIProcessor::ProcessVFTBaseClassInfo(uint64_t vftAddr, ClassInfo &classInfo)
415{
416 BinaryReader reader = BinaryReader(m_view);
417 // Because we have this we _need_ to have the adjustment stuff.
418 // NOTE: We assume two field sized ints with the first being what we want.
419 // Two 0x4 ints and the pointer to the type info.
420 reader.Seek(vftAddr - ((ArchFieldSize(m_view) * 2) + m_view->GetAddressSize()));
421
422 auto adjustmentOffset = static_cast<int32_t>(reader.Read32());
423 [[maybe_unused]]
424 auto baseIdx = static_cast<int32_t>(reader.Read32());
425 uint64_t classOffset = std::abs(adjustmentOffset);
426
427 std::optional<BaseClassInfo> selectedBaseClassInfo = std::nullopt;
428 // Assuming we do not have a baseClassInfo already passed we can deduce it here.
429 for (auto& baseClass : classInfo.baseClasses)
430 {
431 if (baseClass.offset == classOffset)
432 {
433 // Found the appropriate base class for this vtable.
434 selectedBaseClassInfo = baseClass;
435 }
436 }
437
438 // Return the selected base class for use in later processing such as `ProcessVFT`.
439 return selectedBaseClassInfo;
440}
441
442
443std::optional<ClassInfo> ItaniumRTTIProcessor::ProcessRTTI(uint64_t objectAddr)

Callers

nothing calls this directly

Calls 5

ArchFieldSizeFunction · 0.85
BinaryReaderClass · 0.50
SeekMethod · 0.45
GetAddressSizeMethod · 0.45
Read32Method · 0.45

Tested by

no test coverage detected