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 EmulateInstructionPPC64_h_
10 #define EmulateInstructionPPC64_h_
11 
14 #include "lldb/Utility/Log.h"
15 
16 namespace lldb_private {
17 
19 public:
20  EmulateInstructionPPC64(const ArchSpec &arch);
21 
22  static void Initialize();
23 
24  static void Terminate();
25 
27 
28  static const char *GetPluginDescriptionStatic();
29 
30  static EmulateInstruction *CreateInstance(const ArchSpec &arch,
31  InstructionType inst_type);
32 
33  static bool
35  switch (inst_type) {
38  return true;
39 
42  return false;
43  }
44  return false;
45  }
46 
47  ConstString GetPluginName() override;
48 
49  uint32_t GetPluginVersion() override { return 1; }
50 
51  bool SetTargetTriple(const ArchSpec &arch) override;
52 
55  }
56 
57  bool ReadInstruction() override;
58 
59  bool EvaluateInstruction(uint32_t evaluate_options) override;
60 
61  bool TestEmulation(Stream *out_stream, ArchSpec &arch,
62  OptionValueDictionary *test_data) override {
63  return false;
64  }
65 
66  bool GetRegisterInfo(lldb::RegisterKind reg_kind, uint32_t reg_num,
67  RegisterInfo &reg_info) override;
68 
69  bool CreateFunctionEntryUnwind(UnwindPlan &unwind_plan) override;
70 
71 private:
72  struct Opcode {
73  uint32_t mask;
74  uint32_t value;
75  bool (EmulateInstructionPPC64::*callback)(uint32_t opcode);
76  const char *name;
77  };
78 
80 
81  Opcode *GetOpcodeForInstruction(uint32_t opcode);
82 
83  bool EmulateMFSPR(uint32_t opcode);
84  bool EmulateLD(uint32_t opcode);
85  bool EmulateSTD(uint32_t opcode);
86  bool EmulateOR(uint32_t opcode);
87  bool EmulateADDI(uint32_t opcode);
88 };
89 
90 } // namespace lldb_private
91 
92 #endif // EmulateInstructionPPC64_h_
Enumerations for broadcasting.
Definition: SBLaunchInfo.h:14
A stream class that can stream formatted output to a file.
Definition: Stream.h:28
An architecture specification class.
Definition: ArchSpec.h:32
static bool SupportsEmulatingInstructionsOfTypeStatic(InstructionType inst_type)
"lldb/Core/EmulateInstruction.h" A class that allows emulation of CPU opcodes.
bool CreateFunctionEntryUnwind(UnwindPlan &unwind_plan) override
static EmulateInstruction * CreateInstance(const ArchSpec &arch, InstructionType inst_type)
bool EvaluateInstruction(uint32_t evaluate_options) override
bool SupportsEmulatingInstructionsOfType(InstructionType inst_type) override
bool GetRegisterInfo(lldb::RegisterKind reg_kind, uint32_t reg_num, RegisterInfo &reg_info) override
InstructionType
Instruction types.
bool TestEmulation(Stream *out_stream, ArchSpec &arch, OptionValueDictionary *test_data) override
A uniqued constant string class.
Definition: ConstString.h:38
bool SetTargetTriple(const ArchSpec &arch) override
#define LLDB_INVALID_REGNUM
Definition: lldb-defines.h:90