| 246 | } |
| 247 | |
| 248 | void |
| 249 | analyseCode(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 |
no test coverage detected