mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-09-28 17:11:11 -09:00
Keep null records out of FID cache
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user