1 //===-- SWIG Interface for SBInstructionList --------------------*- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
14 "Represents a list of machine instructions. SBFunction and SBSymbol have
15 GetInstructions() methods which return SBInstructionList instances.
17 SBInstructionList supports instruction (SBInstruction instance) iteration.
18 For example (see also SBDebugger for a more complete example),
20 def disassemble_instructions (insts):
24 defines a function which takes an SBInstructionList instance and prints out
25 the machine instructions in assembly format."
27 class SBInstructionList
33 SBInstructionList (const SBInstructionList &rhs);
35 ~SBInstructionList ();
40 explicit operator bool() const;
46 GetInstructionAtIndex (uint32_t idx);
48 size_t GetInstructionsCount(const SBAddress &start, const SBAddress &end,
49 bool canSetBreakpoint);
55 AppendInstruction (lldb::SBInstruction inst);
58 Print (lldb::SBFile out);
61 Print (lldb::FileSP BORROWED);
64 GetDescription (lldb::SBStream &description);
67 DumpEmulationForAllInstructions (const char *triple);
69 STRING_EXTENSION(SBInstructionList)
74 '''Iterate over all instructions in a lldb.SBInstructionList
76 return lldb_iter(self, 'GetSize', 'GetInstructionAtIndex')
79 '''Access len of the instruction list.'''
80 return int(self.GetSize())
82 def __getitem__(self, key):
83 '''Access instructions by integer index for array access or by lldb.SBAddress to find an instruction that matches a section offset address object.'''
85 # Find an instruction by index
87 return self.GetInstructionAtIndex(key)
88 elif type(key) is SBAddress:
89 # Find an instruction using a lldb.SBAddress object
90 lookup_file_addr = key.file_addr
92 for idx in range(self.GetSize()):
93 inst = self.GetInstructionAtIndex(idx)
94 inst_file_addr = inst.addr.file_addr
95 if inst_file_addr == lookup_file_addr:
97 elif inst_file_addr > lookup_file_addr: