GP-5501 improved rtti script gcc typeinfo creation

This commit is contained in:
ghidra007 2025-03-18 19:03:54 +00:00
parent 227497e0fa
commit e9e127da89

View file

@ -2285,7 +2285,13 @@ public class RTTIGccClassRecoverer extends RTTIClassRecoverer {
monitor.checkCancelled(); monitor.checkCancelled();
if (specialTypeinfo.isInProgramMemory()) { if (specialTypeinfo.isInProgramMemory()) {
applyTypeinfoStructure(siClassTypeInfoStructure, specialTypeinfo.getAddress()); Data struct =
applyTypeinfoStructure(siClassTypeInfoStructure, specialTypeinfo.getAddress());
if (struct == null) {
Msg.error(this,
specialTypeinfo.getNamespace().getName() + ": cannot apply structure");
continue;
}
typeinfoToStructuretypeMap.put(specialTypeinfo.getAddress(), typeinfoToStructuretypeMap.put(specialTypeinfo.getAddress(),
SI_CLASS_TYPE_INFO_STRUCTURE); SI_CLASS_TYPE_INFO_STRUCTURE);
} }
@ -2725,13 +2731,19 @@ public class RTTIGccClassRecoverer extends RTTIClassRecoverer {
} }
private Data applyTypeinfoStructure(Structure typeInfoStructure, Address typeinfoAddress) private Data applyTypeinfoStructure(Structure typeInfoStructure, Address typeinfoAddress) {
throws CancelledException, AddressOutOfBoundsException, Exception {
api.clearListing(typeinfoAddress, typeinfoAddress.add(typeInfoStructure.getLength() - 1)); try {
Data newStructure = api.createData(typeinfoAddress, typeInfoStructure); api.clearListing(typeinfoAddress,
typeinfoAddress.add(typeInfoStructure.getLength() - 1));
Data newStructure = api.createData(typeinfoAddress, typeInfoStructure);
return newStructure;
}
catch (CodeUnitInsertionException | CancelledException e) {
Msg.warn(this, "Could not apply typeinfo struct at " + typeinfoAddress.toString());
return null;
}
return newStructure;
} }
private Structure getOrCreateVmiTypeinfoStructure(Address typeinfoAddress, private Structure getOrCreateVmiTypeinfoStructure(Address typeinfoAddress,