MCPcopy Create free account
hub / github.com/decaf-emu/decaf-emu / analyseCode

Function analyseCode

src/libdecaf/src/debug_api/debug_api_analyse.cpp:248–276  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

246}
247
248void
249analyseCode(AnalyseDatabase &db,
250 VirtualAddress start,
251 VirtualAddress end)
252{
253 for (auto addr = start; addr < end; addr += 4) {
254 auto instr = mem::read<espresso::Instruction>(addr);
255 auto data = espresso::decodeInstruction(instr);
256
257 if (!data) {
258 continue;
259 }
260
261 if (espresso::isBranchInstruction(data->id)) {
262 auto branchInfo =
263 espresso::disassembleBranchInfo(data->id, instr, addr, 0, 0, 0);
264
265 if (!branchInfo.isCall && !branchInfo.isVariable) {
266 db.instructions[branchInfo.target].sourceBranches.push_back(addr);
267 }
268
269 // If this is a call, and its not variable, we should mark
270 // the target as a function, since it likely is...
271 if (branchInfo.isCall && !branchInfo.isVariable) {
272 markAsFunction(db, branchInfo.target);
273 }
274 }
275 }
276}
277
278} // namespace decaf::debug

Callers 1

updateMethod · 0.85

Calls 5

decodeInstructionFunction · 0.85
isBranchInstructionFunction · 0.85
disassembleBranchInfoFunction · 0.85
markAsFunctionFunction · 0.85
push_backMethod · 0.45

Tested by

no test coverage detected