SBInstruction.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. //===-- SBInstruction.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. #ifndef LLDB_API_SBINSTRUCTION_H
  9. #define LLDB_API_SBINSTRUCTION_H
  10. #include "lldb/API/SBData.h"
  11. #include "lldb/API/SBDefines.h"
  12. #include <cstdio>
  13. // There's a lot to be fixed here, but need to wait for underlying insn
  14. // implementation to be revised & settle down first.
  15. class InstructionImpl;
  16. namespace lldb {
  17. class LLDB_API SBInstruction {
  18. public:
  19. SBInstruction();
  20. SBInstruction(const SBInstruction &rhs);
  21. const SBInstruction &operator=(const SBInstruction &rhs);
  22. ~SBInstruction();
  23. explicit operator bool() const;
  24. bool IsValid();
  25. SBAddress GetAddress();
  26. const char *GetMnemonic(lldb::SBTarget target);
  27. const char *GetOperands(lldb::SBTarget target);
  28. const char *GetComment(lldb::SBTarget target);
  29. lldb::SBData GetData(lldb::SBTarget target);
  30. size_t GetByteSize();
  31. bool DoesBranch();
  32. bool HasDelaySlot();
  33. bool CanSetBreakpoint();
  34. void Print(FILE *out);
  35. void Print(SBFile out);
  36. void Print(FileSP out);
  37. bool GetDescription(lldb::SBStream &description);
  38. bool EmulateWithFrame(lldb::SBFrame &frame, uint32_t evaluate_options);
  39. bool DumpEmulation(const char *triple); // triple is to specify the
  40. // architecture, e.g. 'armv6' or
  41. // 'armv7-apple-ios'
  42. bool TestEmulation(lldb::SBStream &output_stream, const char *test_file);
  43. protected:
  44. friend class SBInstructionList;
  45. SBInstruction(const lldb::DisassemblerSP &disasm_sp,
  46. const lldb::InstructionSP &inst_sp);
  47. void SetOpaque(const lldb::DisassemblerSP &disasm_sp,
  48. const lldb::InstructionSP &inst_sp);
  49. lldb::InstructionSP GetOpaque();
  50. private:
  51. std::shared_ptr<InstructionImpl> m_opaque_sp;
  52. };
  53. } // namespace lldb
  54. #endif // LLDB_API_SBINSTRUCTION_H