mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-03 09:49:23 +02:00
GT-3341_emteere_RTTIPerformance Code Review changes
This commit is contained in:
parent
b51a9d7ff4
commit
edfff3a267
5 changed files with 15 additions and 56 deletions
|
@ -716,43 +716,13 @@ public class FunctionStartAnalyzer extends AbstractAnalyzer implements PatternFa
|
|||
*/
|
||||
private boolean checkForExecuteBlock(Program program) {
|
||||
MemoryBlock[] blocks = program.getMemory().getBlocks();
|
||||
boolean hasExecutable = false;
|
||||
|
||||
for (MemoryBlock block : blocks) {
|
||||
if (block.isExecute()) {
|
||||
hasExecutable = true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return hasExecutable;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get rid of any blocks from the address set that shouldn't be searched.
|
||||
* Non-executable and non-initialized.
|
||||
*
|
||||
* @param program program
|
||||
* @param bset current set of restricted address ranges
|
||||
* @return return new set with blocks not to be searched removed
|
||||
*/
|
||||
private AddressSet removeNotSearchedAddresses(Program program, AddressSetView bset) {
|
||||
AddressSet restrictedSet = new AddressSet(bset);
|
||||
MemoryBlock[] blocks = program.getMemory().getBlocks();
|
||||
boolean hasExecutable = checkForExecuteBlock(program);
|
||||
|
||||
for (MemoryBlock block : blocks) {
|
||||
if (!block.isInitialized()) {
|
||||
restrictedSet.deleteRange(block.getStart(), block.getEnd());
|
||||
continue;
|
||||
}
|
||||
// if
|
||||
if (executableBlocksOnly && hasExecutable) {
|
||||
if (!block.isExecute()) {
|
||||
restrictedSet.deleteRange(block.getStart(), block.getEnd());
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
return restrictedSet;
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue