xref: /freebsd/contrib/llvm-project/lldb/include/lldb/API/SBInstructionList.h (revision 06c3fb2749bda94cb5201f81ffdb8fa6c3161b2e)
1 //===-- SBInstructionList.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_API_SBINSTRUCTIONLIST_H
10 #define LLDB_API_SBINSTRUCTIONLIST_H
11 
12 #include "lldb/API/SBDefines.h"
13 
14 #include <cstdio>
15 
16 namespace lldb {
17 
18 class LLDB_API SBInstructionList {
19 public:
20   SBInstructionList();
21 
22   SBInstructionList(const SBInstructionList &rhs);
23 
24   const SBInstructionList &operator=(const SBInstructionList &rhs);
25 
26   ~SBInstructionList();
27 
28   explicit operator bool() const;
29 
30   bool IsValid() const;
31 
32   size_t GetSize();
33 
34   lldb::SBInstruction GetInstructionAtIndex(uint32_t idx);
35 
36   // Returns the number of instructions between the start and end address. If
37   // canSetBreakpoint is true then the count will be the number of
38   // instructions on which a breakpoint can be set.
39   size_t GetInstructionsCount(const SBAddress &start,
40                               const SBAddress &end,
41                               bool canSetBreakpoint = false);
42 
43   void Clear();
44 
45   void AppendInstruction(lldb::SBInstruction inst);
46 
47 #ifndef SWIG
48   void Print(FILE *out);
49 #endif
50 
51   void Print(SBFile out);
52 
53   void Print(FileSP BORROWED);
54 
55   bool GetDescription(lldb::SBStream &description);
56 
57   bool DumpEmulationForAllInstructions(const char *triple);
58 
59 protected:
60   friend class SBFunction;
61   friend class SBSymbol;
62   friend class SBTarget;
63 
64   void SetDisassembler(const lldb::DisassemblerSP &opaque_sp);
65   bool GetDescription(lldb_private::Stream &description);
66 
67 
68 private:
69   lldb::DisassemblerSP m_opaque_sp;
70 };
71 
72 } // namespace lldb
73 
74 #endif // LLDB_API_SBINSTRUCTIONLIST_H
75