mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-05 19:42:36 +02:00
Keep null records out of FID cache
This commit is contained in:
parent
69dd762e4b
commit
2671c5d22d
3 changed files with 11 additions and 10 deletions
|
@ -19,12 +19,7 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
import ghidra.program.model.address.AddressSetView;
|
||||
import ghidra.program.model.listing.CodeUnit;
|
||||
import ghidra.program.model.listing.Function;
|
||||
import ghidra.program.model.listing.Instruction;
|
||||
import ghidra.program.model.listing.InstructionIterator;
|
||||
import ghidra.program.model.listing.Listing;
|
||||
import ghidra.program.model.listing.Program;
|
||||
import ghidra.program.model.listing.*;
|
||||
|
||||
/**
|
||||
* Calculates the function extent by the function body; i.e. what's saved
|
||||
|
@ -35,9 +30,15 @@ import ghidra.program.model.listing.Program;
|
|||
public class FunctionBodyFunctionExtentGenerator implements FunctionExtentGenerator {
|
||||
@Override
|
||||
public List<CodeUnit> calculateExtent(Function func) {
|
||||
if (func == null) {
|
||||
return List.of();
|
||||
}
|
||||
final AddressSetView body = func.getBody();
|
||||
if (body.isEmpty()) {
|
||||
return List.of();
|
||||
}
|
||||
ArrayList<CodeUnit> units = new ArrayList<CodeUnit>();
|
||||
|
||||
final AddressSetView body = func.getBody();
|
||||
final Program program = func.getProgram();
|
||||
final Listing listing = program.getListing();
|
||||
|
||||
|
|
|
@ -49,6 +49,9 @@ public class FIDFixedSizeMRUCachingFactory implements Factory<Function, FidHashQ
|
|||
}
|
||||
|
||||
value = delegate.get(func);
|
||||
if (value == null) {
|
||||
return null;
|
||||
}
|
||||
cache.put(entryPoint, value);
|
||||
return value;
|
||||
}
|
||||
|
|
|
@ -35,9 +35,6 @@ class FidHasherFactory implements Factory<Function, FidHashQuad> {
|
|||
@Override
|
||||
public FidHashQuad get(Function function) {
|
||||
try {
|
||||
if (function == null) {
|
||||
return null;
|
||||
}
|
||||
return hasher.hash(function);
|
||||
}
|
||||
catch (MemoryAccessException e) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue