#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "components/zucchini/rel32_finder.h"
#include <stddef.h>
#include <stdint.h>
#include <algorithm>
#include <deque>
#include <iterator>
#include <string>
#include <utility>
#include <vector>
#include "base/check_op.h"
#include "base/format_macros.h"
#include "base/numerics/safe_conversions.h"
#include "base/strings/stringprintf.h"
#include "components/zucchini/arm_utils.h"
#include "components/zucchini/buffer_view.h"
#include "components/zucchini/disassembler_elf.h"
#include "components/zucchini/image_utils.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace zucchini {
TEST(Abs32GapFinderTest, All) { … }
namespace {
class TestRel32Finder : public Rel32Finder { … };
AddressTranslator GetTrivialTranslator(size_t size) { … }
}
TEST(Rel32FinderTest, Scan) { … }
namespace {
constexpr uint8_t kDataX86[] = …;
constexpr offset_t kAbs32X86[] = …;
}
TEST(Rel32FinderX86Test, FindNext) { … }
TEST(Rel32FinderX86Test, Integrated) { … }
TEST(Rel32FinderX86Test, Accept) { … }
namespace {
constexpr uint8_t kDataX64[] = …;
constexpr offset_t kAbs32X64[] = …;
}
TEST(Rel32FinderX64Test, FindNext) { … }
TEST(Rel32FinderX64Test, Integrated) { … }
namespace {
template <class REL32_FINDER>
std::vector<typename REL32_FINDER::Result> ArmExtractRel32(
ConstBufferView image,
const std::deque<offset_t>& abs32_locations,
int abs32_width,
REL32_FINDER&& rel32_finder) { … }
}
namespace {
constexpr uint8_t kDataAarch32ArmMode[] = …;
constexpr offset_t kAbs32Aarch32ArmMode[] = …;
}
TEST(Rel32FinderAArch32Test, IntegratedArmModeWithoutAbs32) { … }
TEST(Rel32FinderAArch32Test, IntegratedArmModeWithAbs32) { … }
namespace {
constexpr uint8_t kDataAarch32Thumb2Mode[] = …;
constexpr offset_t kAbs32Aarch32Thumb2Mode[] = …;
}
TEST(Rel32FinderAArch32Test, IntegratedThumb2ModeWithoutAbs32) { … }
TEST(Rel32FinderAArch32Test, IntegratedThumb2ModeWithAbs32) { … }
namespace {
constexpr uint8_t kDataAarch64[] = …;
constexpr offset_t kAbs32Aarch64[] = …;
}
TEST(Rel32FinderAArch64Test, IntegratedWithoutAbs32) { … }
TEST(Rel32FinderAArch64Test, IntegratedWithAbs32) { … }
}