mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-06 03:50:02 +02:00
GT-2849 Remove demangler and type laying from PeLoader.processExports
This commit is contained in:
parent
67198eb40f
commit
661a38d7b4
1 changed files with 4 additions and 53 deletions
|
@ -23,20 +23,21 @@ import generic.continues.GenericFactory;
|
||||||
import generic.continues.RethrowContinuesFactory;
|
import generic.continues.RethrowContinuesFactory;
|
||||||
import ghidra.app.util.MemoryBlockUtil;
|
import ghidra.app.util.MemoryBlockUtil;
|
||||||
import ghidra.app.util.Option;
|
import ghidra.app.util.Option;
|
||||||
import ghidra.app.util.bin.*;
|
import ghidra.app.util.bin.BinaryReader;
|
||||||
|
import ghidra.app.util.bin.ByteProvider;
|
||||||
import ghidra.app.util.bin.format.mz.DOSHeader;
|
import ghidra.app.util.bin.format.mz.DOSHeader;
|
||||||
import ghidra.app.util.bin.format.pe.*;
|
import ghidra.app.util.bin.format.pe.*;
|
||||||
import ghidra.app.util.bin.format.pe.PortableExecutable.SectionLayout;
|
import ghidra.app.util.bin.format.pe.PortableExecutable.SectionLayout;
|
||||||
import ghidra.app.util.bin.format.pe.debug.DebugCOFFSymbol;
|
import ghidra.app.util.bin.format.pe.debug.DebugCOFFSymbol;
|
||||||
import ghidra.app.util.bin.format.pe.debug.DebugDirectoryParser;
|
import ghidra.app.util.bin.format.pe.debug.DebugDirectoryParser;
|
||||||
import ghidra.app.util.demangler.*;
|
|
||||||
import ghidra.app.util.importer.*;
|
import ghidra.app.util.importer.*;
|
||||||
import ghidra.framework.model.DomainObject;
|
import ghidra.framework.model.DomainObject;
|
||||||
import ghidra.framework.options.Options;
|
import ghidra.framework.options.Options;
|
||||||
import ghidra.program.model.address.*;
|
import ghidra.program.model.address.*;
|
||||||
import ghidra.program.model.data.*;
|
import ghidra.program.model.data.*;
|
||||||
import ghidra.program.model.listing.*;
|
import ghidra.program.model.listing.*;
|
||||||
import ghidra.program.model.mem.*;
|
import ghidra.program.model.mem.Memory;
|
||||||
|
import ghidra.program.model.mem.MemoryAccessException;
|
||||||
import ghidra.program.model.reloc.RelocationTable;
|
import ghidra.program.model.reloc.RelocationTable;
|
||||||
import ghidra.program.model.symbol.*;
|
import ghidra.program.model.symbol.*;
|
||||||
import ghidra.program.model.util.AddressSetPropertyMap;
|
import ghidra.program.model.util.AddressSetPropertyMap;
|
||||||
|
@ -508,21 +509,6 @@ public class PeLoader extends AbstractPeDebugLoader {
|
||||||
// Don't create invalid symbol
|
// Don't create invalid symbol
|
||||||
}
|
}
|
||||||
|
|
||||||
DemangledObject demangledObj = null;
|
|
||||||
try {
|
|
||||||
demangledObj = DemanglerUtil.demangle(program, name);
|
|
||||||
}
|
|
||||||
catch (Exception e) {
|
|
||||||
//log.appendMsg("Unable to demangle: "+name);
|
|
||||||
}
|
|
||||||
if (demangledObj != null) {
|
|
||||||
String comment = demangledObj.getSignature(true);
|
|
||||||
if (hasComment(CodeUnit.PLATE_COMMENT, address)) {
|
|
||||||
comment = "\n" + comment;
|
|
||||||
}
|
|
||||||
setComment(CodeUnit.PLATE_COMMENT, address, comment);
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
symTable.createLabel(address, SymbolUtilities.ORDINAL_PREFIX + export.getOrdinal(),
|
symTable.createLabel(address, SymbolUtilities.ORDINAL_PREFIX + export.getOrdinal(),
|
||||||
SourceType.IMPORTED);
|
SourceType.IMPORTED);
|
||||||
|
@ -574,41 +560,6 @@ public class PeLoader extends AbstractPeDebugLoader {
|
||||||
// Nothing to do...just continue on
|
// Nothing to do...just continue on
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//if this export is not in an executable section,
|
|
||||||
//then it is a DATA export.
|
|
||||||
//see if it is a pointer, otherwise make it an undefined1
|
|
||||||
MemoryBlock block = memory.getBlock(address);
|
|
||||||
if (block != null && !block.isExecute()) {
|
|
||||||
try {
|
|
||||||
if (demangledObj instanceof DemangledVariable) {
|
|
||||||
DemangledVariable demangledVar = (DemangledVariable) demangledObj;
|
|
||||||
DemangledDataType ddt = demangledVar.getDataType();
|
|
||||||
DataType dt =
|
|
||||||
ddt == null ? null : ddt.getDataType(program.getDataTypeManager());
|
|
||||||
if (dt != null && dt.getLength() > 0) {
|
|
||||||
listing.createData(address, dt);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
listing.createData(address, new Undefined1DataType());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
listing.createData(address, StructConverter.POINTER,
|
|
||||||
address.getPointerSize());
|
|
||||||
Data data = listing.getDataAt(address);
|
|
||||||
Address ptr = data.getAddress(0);
|
|
||||||
if (ptr == null || !memory.contains(ptr)) {
|
|
||||||
listing.clearCodeUnits(data.getMinAddress(), data.getMaxAddress(),
|
|
||||||
false);
|
|
||||||
listing.createData(address, new Undefined1DataType());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (DataTypeConflictException | CodeUnitInsertionException e) {
|
|
||||||
// Nothing to do...just continue on
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue