| 82 | } |
| 83 | |
| 84 | std::vector<schema::program::Instruction> codeSectionInstructions(Assembly const& _assembly, LinkerObject const& _linkerObject, unsigned const _sourceID, size_t const _codeSectionIndex) |
| 85 | { |
| 86 | solAssert(_codeSectionIndex < _linkerObject.codeSectionLocations.size()); |
| 87 | solAssert(_codeSectionIndex < _assembly.codeSections().size()); |
| 88 | auto const& locations = _linkerObject.codeSectionLocations[_codeSectionIndex]; |
| 89 | auto const& codeSection = _assembly.codeSections().at(_codeSectionIndex); |
| 90 | |
| 91 | std::vector<schema::program::Instruction> instructions; |
| 92 | instructions.reserve(codeSection.items.size()); |
| 93 | |
| 94 | bool const codeSectionContainsVerbatim = ranges::any_of( |
| 95 | codeSection.items, |
| 96 | [](auto const& _instruction) { return _instruction.type() == VerbatimBytecode; } |
| 97 | ); |
| 98 | solUnimplementedAssert(!codeSectionContainsVerbatim, "Verbatim bytecode is currently not supported by ethdebug."); |
| 99 | |
| 100 | for (auto const& currentInstruction: locations.instructionLocations) |
| 101 | { |
| 102 | size_t const start = currentInstruction.start; |
| 103 | size_t const end = currentInstruction.end; |
| 104 | |
| 105 | // some instructions do not contribute to the bytecode |
| 106 | if (start == end) |
| 107 | continue; |
| 108 | |
| 109 | instructions.emplace_back(schema::program::Instruction{ |
| 110 | .offset = schema::data::Unsigned{start}, |
| 111 | .operation = instructionOperation(_assembly, _linkerObject, start, end), |
| 112 | .context = instructionContext(codeSection, currentInstruction.assemblyItemIndex, _sourceID) |
| 113 | }); |
| 114 | } |
| 115 | |
| 116 | return instructions; |
| 117 | } |
| 118 | |
| 119 | std::vector<schema::program::Instruction> programInstructions(Assembly const& _assembly, LinkerObject const& _linkerObject, unsigned const _sourceID) |
| 120 | { |
no test coverage detected