| 91 | } |
| 92 | |
| 93 | std::map<u32,DisassemblyEntry*>::iterator findDisassemblyEntry(std::map<u32,DisassemblyEntry*>& entries, u32 address, bool exact) |
| 94 | { |
| 95 | if (exact) |
| 96 | return entries.find(address); |
| 97 | |
| 98 | if (entries.empty()) |
| 99 | return entries.end(); |
| 100 | |
| 101 | // find first elem that's >= address |
| 102 | auto it = entries.lower_bound(address); |
| 103 | if (it != entries.end()) |
| 104 | { |
| 105 | // it may be an exact match |
| 106 | if (isInInterval(it->second->getLineAddress(0),it->second->getTotalSize(),address)) |
| 107 | return it; |
| 108 | |
| 109 | // otherwise it may point to the next |
| 110 | if (it != entries.begin()) |
| 111 | { |
| 112 | it--; |
| 113 | if (isInInterval(it->second->getLineAddress(0),it->second->getTotalSize(),address)) |
| 114 | return it; |
| 115 | } |
| 116 | } |
| 117 | |
| 118 | // check last entry manually |
| 119 | auto rit = entries.rbegin(); |
| 120 | if (isInInterval(rit->second->getLineAddress(0),rit->second->getTotalSize(),address)) |
| 121 | { |
| 122 | return (++rit).base(); |
| 123 | } |
| 124 | |
| 125 | // no match otherwise |
| 126 | return entries.end(); |
| 127 | } |
| 128 | |
| 129 | void DisassemblyManager::analyze(u32 address, u32 size = 1024) |
| 130 | { |
no test coverage detected