LLDB mainline
EmulateInstructionPPC64.h
Go to the documentation of this file.
1//===-- EmulateInstructionPPC64.h -------------------------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef LLDB_SOURCE_PLUGINS_INSTRUCTION_PPC64_EMULATEINSTRUCTIONPPC64_H
10#define LLDB_SOURCE_PLUGINS_INSTRUCTION_PPC64_EMULATEINSTRUCTIONPPC64_H
11
14#include "lldb/Utility/Log.h"
15#include <optional>
16
17namespace lldb_private {
18
20public:
22
23 static void Initialize();
24
25 static void Terminate();
26
27 static llvm::StringRef GetPluginNameStatic() { return "ppc64"; }
28
29 static llvm::StringRef GetPluginDescriptionStatic();
30
31 static EmulateInstruction *CreateInstance(const ArchSpec &arch,
32 InstructionType inst_type);
33
34 static bool
36 switch (inst_type) {
39 return true;
40
43 return false;
44 }
45 return false;
46 }
47
48 llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); }
49
50 bool SetTargetTriple(const ArchSpec &arch) override;
51
54 }
55
56 bool ReadInstruction() override;
57
58 bool EvaluateInstruction(uint32_t evaluate_options) override;
59
60 bool TestEmulation(Stream &out_stream, ArchSpec &arch,
61 OptionValueDictionary *test_data) override {
62 return false;
63 }
64
65 std::optional<RegisterInfo> GetRegisterInfo(lldb::RegisterKind reg_kind,
66 uint32_t reg_num) override;
67
68 bool CreateFunctionEntryUnwind(UnwindPlan &unwind_plan) override;
69
70private:
71 struct Opcode {
72 uint32_t mask;
73 uint32_t value;
74 bool (EmulateInstructionPPC64::*callback)(uint32_t opcode);
75 const char *name;
76 };
77
79
80 Opcode *GetOpcodeForInstruction(uint32_t opcode);
81
82 bool EmulateMFSPR(uint32_t opcode);
83 bool EmulateLD(uint32_t opcode);
84 bool EmulateSTD(uint32_t opcode);
85 bool EmulateOR(uint32_t opcode);
86 bool EmulateADDI(uint32_t opcode);
87};
88
89} // namespace lldb_private
90
91#endif // LLDB_SOURCE_PLUGINS_INSTRUCTION_PPC64_EMULATEINSTRUCTIONPPC64_H
An architecture specification class.
Definition: ArchSpec.h:31
bool SetTargetTriple(const ArchSpec &arch) override
bool SupportsEmulatingInstructionsOfType(InstructionType inst_type) override
static EmulateInstruction * CreateInstance(const ArchSpec &arch, InstructionType inst_type)
std::optional< RegisterInfo > GetRegisterInfo(lldb::RegisterKind reg_kind, uint32_t reg_num) override
bool EvaluateInstruction(uint32_t evaluate_options) override
bool CreateFunctionEntryUnwind(UnwindPlan &unwind_plan) override
bool TestEmulation(Stream &out_stream, ArchSpec &arch, OptionValueDictionary *test_data) override
static bool SupportsEmulatingInstructionsOfTypeStatic(InstructionType inst_type)
"lldb/Core/EmulateInstruction.h" A class that allows emulation of CPU opcodes.
A stream class that can stream formatted output to a file.
Definition: Stream.h:28
#define LLDB_INVALID_REGNUM
Definition: lldb-defines.h:87
A class that represents a running process on the host machine.
InstructionType
Instruction types.
RegisterKind
Register numbering types.
bool(EmulateInstructionPPC64::* callback)(uint32_t opcode)