llvm/lldb/unittests/UnwindAssembly/x86/Testx86AssemblyInspectionEngine.cpp

//===-- Testx86AssemblyInspectionEngine.cpp -------------------------------===//

//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#include "gtest/gtest.h"

#include <memory>
#include <vector>

#include "Plugins/UnwindAssembly/x86/x86AssemblyInspectionEngine.h"
#include "lldb/Core/Address.h"
#include "lldb/Core/AddressRange.h"
#include "lldb/Symbol/UnwindPlan.h"
#include "lldb/Utility/ArchSpec.h"
#include "lldb/Utility/StreamString.h"

#include "llvm/Support/TargetSelect.h"

usingnamespacelldb;
usingnamespacelldb_private;

class Testx86AssemblyInspectionEngine : public testing::Test {};

void Testx86AssemblyInspectionEngine::SetUpTestCase() {}

// only defining the register names / numbers that the unwinder is actually
// using today

// names should match the constants below.  These will be the eRegisterKindLLDB
// register numbers.

const char *x86_64_reg_names[] =;

enum x86_64_regs {};

// names should match the constants below.  These will be the eRegisterKindLLDB
// register numbers.

const char *i386_reg_names[] =;

enum i386_regs {};

std::unique_ptr<x86AssemblyInspectionEngine> Getx86_64Inspector() {}

std::unique_ptr<x86AssemblyInspectionEngine> Geti386Inspector() {}

namespace lldb_private {
static std::ostream &operator<<(std::ostream &OS,
                                const UnwindPlan::Row::FAValue &CFA) {}
} // namespace lldb_private

TEST_F(Testx86AssemblyInspectionEngine, TestSimple64bitFrameFunction) {}

TEST_F(Testx86AssemblyInspectionEngine, TestSimple32bitFrameFunction) {}

TEST_F(Testx86AssemblyInspectionEngine, Test64bitFramelessBigStackFrame) {}

TEST_F(Testx86AssemblyInspectionEngine, Test32bitFramelessBigStackFrame) {}

TEST_F(Testx86AssemblyInspectionEngine, Test64bitFramelessSmallStackFrame) {}

TEST_F(Testx86AssemblyInspectionEngine, Test32bitFramelessSmallStackFrame) {}

TEST_F(Testx86AssemblyInspectionEngine, TestPushRBP) {}

TEST_F(Testx86AssemblyInspectionEngine, TestPushImm) {}

// We treat 'pushq $0' / 'pushl $0' specially - this shows up
// in the first function called in a new thread and it needs to
// put a 0 as the saved pc.  We pretend it didn't change the CFA.
TEST_F(Testx86AssemblyInspectionEngine, TestPush0) {}

TEST_F(Testx86AssemblyInspectionEngine, TestPushExtended) {}

TEST_F(Testx86AssemblyInspectionEngine, TestPushR15) {}

TEST_F(Testx86AssemblyInspectionEngine, TestPushR14) {}

TEST_F(Testx86AssemblyInspectionEngine, TestPushR13) {}

TEST_F(Testx86AssemblyInspectionEngine, TestPushR12) {}

TEST_F(Testx86AssemblyInspectionEngine, TestPushRBX) {}

// The ABI is hardcoded in x86AssemblyInspectionEngine such that
// eax, ecx, edx are all considered volatile and push/pops of them are
// not tracked (except to keep track of stack pointer movement)
TEST_F(Testx86AssemblyInspectionEngine, TestPushEAX) {}

// The ABI is hardcoded in x86AssemblyInspectionEngine such that
// eax, ecx, edx are all considered volatile and push/pops of them are
// not tracked (except to keep track of stack pointer movement)
TEST_F(Testx86AssemblyInspectionEngine, TestPushECX) {}

// The ABI is hardcoded in x86AssemblyInspectionEngine such that
// eax, ecx, edx are all considered volatile and push/pops of them are
// not tracked (except to keep track of stack pointer movement)
TEST_F(Testx86AssemblyInspectionEngine, TestPushEDX) {}

TEST_F(Testx86AssemblyInspectionEngine, TestPushEBX) {}

TEST_F(Testx86AssemblyInspectionEngine, TestPushEBP) {}

TEST_F(Testx86AssemblyInspectionEngine, TestPushRBPWithREX) {}

TEST_F(Testx86AssemblyInspectionEngine, TestPushESI) {}

TEST_F(Testx86AssemblyInspectionEngine, TestPushEDI) {}

TEST_F(Testx86AssemblyInspectionEngine, TestMovRSPtoRBP) {}

TEST_F(Testx86AssemblyInspectionEngine, TestSubRSP) {}

TEST_F(Testx86AssemblyInspectionEngine, TestSubESP) {}

TEST_F(Testx86AssemblyInspectionEngine, TestAddRSP) {}

TEST_F(Testx86AssemblyInspectionEngine, TestAddESP) {}

TEST_F(Testx86AssemblyInspectionEngine, TestLEA_RSP_Pattern) {}

TEST_F(Testx86AssemblyInspectionEngine, TestPopRBX) {}

TEST_F(Testx86AssemblyInspectionEngine, TestPopRBP) {}

TEST_F(Testx86AssemblyInspectionEngine, TestPopR12) {}

TEST_F(Testx86AssemblyInspectionEngine, TestPopR13) {}

TEST_F(Testx86AssemblyInspectionEngine, TestPopR14) {}

TEST_F(Testx86AssemblyInspectionEngine, TestPopR15) {}

TEST_F(Testx86AssemblyInspectionEngine, TestPopEBX) {}

TEST_F(Testx86AssemblyInspectionEngine, TestPopEBP) {}

TEST_F(Testx86AssemblyInspectionEngine, TestPopRBPWithREX) {}

TEST_F(Testx86AssemblyInspectionEngine, TestPopESI) {}

TEST_F(Testx86AssemblyInspectionEngine, TestPopEDI) {}

// We don't track these registers, but make sure the CFA address is updated
// if we're defining the CFA in term of esp.
TEST_F(Testx86AssemblyInspectionEngine, Testi386IgnoredRegisters) {}

TEST_F(Testx86AssemblyInspectionEngine, TestLEAVE) {}

// In i386, which lacks pc-relative addressing, a common code sequence
// is to call the next instruction (i.e. call imm32, value of 0) which
// pushes the addr of the next insn on the stack, and then pop that value
// into a register (the "pic base" register).
TEST_F(Testx86AssemblyInspectionEngine, TestCALLNextInsn) {}

TEST_F(Testx86AssemblyInspectionEngine, TestSpillRegToStackViaMOVx86_64) {}

TEST_F(Testx86AssemblyInspectionEngine, TestSpillRegToStackViaMOVi386) {}

TEST_F(Testx86AssemblyInspectionEngine, TestSpArithx86_64Augmented) {}

TEST_F(Testx86AssemblyInspectionEngine, TestSimplex86_64Augmented) {}

TEST_F(Testx86AssemblyInspectionEngine, TestSimplei386ugmented) {}

// Check that the i386 disassembler disassembles past an opcode that
// is only valid in 32-bit mode (non-long mode), and the x86_64 disassembler
// stops
// disassembling at that point (long-mode).
TEST_F(Testx86AssemblyInspectionEngine, Test32BitOnlyInstruction) {}

TEST_F(Testx86AssemblyInspectionEngine, TestStackRealign8BitDisp_i386) {}

TEST_F(Testx86AssemblyInspectionEngine, TestStackRealign32BitDisp_x86_64) {}

TEST_F(Testx86AssemblyInspectionEngine, TestStackRealignMSVC_i386) {}

// Give the disassembler random bytes to test that it doesn't exceed
// the bounds of the array when run under clang's address sanitizer.
TEST_F(Testx86AssemblyInspectionEngine, TestDisassemblyJunkBytes) {}

TEST_F(Testx86AssemblyInspectionEngine, TestReturnDetect) {}


// Test mid-function epilogues - the unwind state post-prologue
// should be re-instated.

TEST_F(Testx86AssemblyInspectionEngine, TestDisassemblyMidFunctionEpilogues) {}