MCPcopy Create free account
hub / github.com/Vector35/binaryninja-api / ApplyToLinearViewObject

Method ApplyToLinearViewObject

renderlayer.cpp:180–289  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

178
179
180void RenderLayer::ApplyToLinearViewObject(
181 Ref<LinearViewObject> obj,
182 Ref<LinearViewObject> prev,
183 Ref<LinearViewObject> next,
184 std::vector<LinearDisassemblyLine>& lines
185)
186{
187 // Hack: HLIL bodies don't have basic blocks
188 if (!lines.empty() &&
189 (obj->GetIdentifier().name == "HLIL Function Body"
190 || obj->GetIdentifier().name == "HLIL SSA Function Body"
191 || obj->GetIdentifier().name == "Language Representation Function Body"))
192 {
193 ApplyToHighLevelILBody(lines[0].function, lines);
194 return;
195 }
196
197 std::vector<LinearDisassemblyLine> blockLines;
198 std::vector<LinearDisassemblyLine> finalLines;
199 Ref<BasicBlock> lastBlock;
200
201 auto finishBlock = [&]()
202 {
203 if (!blockLines.empty())
204 {
205 if (lastBlock)
206 {
207 // Convert linear lines to disassembly lines for the apply()
208 // and then convert back for linear view
209 std::vector<LinearDisassemblyLine> newBlockLines;
210 std::vector<DisassemblyTextLine> disasmLines;
211 std::vector<LinearDisassemblyLine> miscLines;
212
213 auto processDisasm = [&]()
214 {
215 if (!disasmLines.empty())
216 {
217 ApplyToBlock(lastBlock, disasmLines);
218 Ref<Function> func = blockLines[0].function;
219 Ref<BasicBlock> block = blockLines[0].block;
220 for (auto& blockLine: disasmLines)
221 {
222 LinearDisassemblyLine newLine;
223 newLine.type = CodeDisassemblyLineType;
224 newLine.function = func;
225 newLine.block = block;
226 newLine.contents = blockLine;
227 newBlockLines.push_back(newLine);
228 }
229 disasmLines.clear();
230 }
231 };
232
233 auto processMisc = [&]()
234 {
235 if (!miscLines.empty())
236 {
237 ApplyToMiscLinearLines(obj, prev, next, miscLines);

Callers 1

Calls 7

GetIdentifierMethod · 0.80
push_backMethod · 0.80
emptyMethod · 0.45
clearMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
GetObjectMethod · 0.45

Tested by

no test coverage detected