mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-09-28 17:11:11 -09:00
GP-0 Do not set architecture for golang archives
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -22,8 +22,6 @@ import java.io.IOException;
|
|||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
import javax.help.UnsupportedOperationException;
|
|
||||||
|
|
||||||
import generic.jar.ResourceFile;
|
import generic.jar.ResourceFile;
|
||||||
import ghidra.app.plugin.core.analysis.AutoAnalysisManager;
|
import ghidra.app.plugin.core.analysis.AutoAnalysisManager;
|
||||||
import ghidra.app.plugin.core.analysis.TransientProgramProperties;
|
import ghidra.app.plugin.core.analysis.TransientProgramProperties;
|
||||||
@@ -37,13 +35,13 @@ import ghidra.app.util.bin.format.golang.structmapping.*;
|
|||||||
import ghidra.app.util.importer.MessageLog;
|
import ghidra.app.util.importer.MessageLog;
|
||||||
import ghidra.app.util.opinion.*;
|
import ghidra.app.util.opinion.*;
|
||||||
import ghidra.framework.Platform;
|
import ghidra.framework.Platform;
|
||||||
import ghidra.framework.store.LockException;
|
|
||||||
import ghidra.program.model.address.*;
|
import ghidra.program.model.address.*;
|
||||||
import ghidra.program.model.data.*;
|
import ghidra.program.model.data.*;
|
||||||
import ghidra.program.model.data.DataTypeConflictHandler.ConflictResult;
|
import ghidra.program.model.data.DataTypeConflictHandler.ConflictResult;
|
||||||
import ghidra.program.model.data.StandAloneDataTypeManager.LanguageUpdateOption;
|
import ghidra.program.model.lang.Endian;
|
||||||
import ghidra.program.model.lang.*;
|
import ghidra.program.model.lang.LanguageID;
|
||||||
import ghidra.program.model.listing.*;
|
import ghidra.program.model.listing.Function;
|
||||||
|
import ghidra.program.model.listing.Program;
|
||||||
import ghidra.program.model.mem.MemoryBlock;
|
import ghidra.program.model.mem.MemoryBlock;
|
||||||
import ghidra.program.model.symbol.Symbol;
|
import ghidra.program.model.symbol.Symbol;
|
||||||
import ghidra.program.model.symbol.SymbolType;
|
import ghidra.program.model.symbol.SymbolType;
|
||||||
@@ -811,8 +809,7 @@ public class GoRttiMapper extends DataTypeMapper {
|
|||||||
// to avoid traces of the original program name as a deleted source archive link in the
|
// to avoid traces of the original program name as a deleted source archive link in the
|
||||||
// gdt data base. This method only leaves the target gdt filename + ".step1" in the db.
|
// gdt data base. This method only leaves the target gdt filename + ".step1" in the db.
|
||||||
File tmpGDTFile = new File(gdtFile.getParentFile(), gdtFile.getName() + ".step1.gdt");
|
File tmpGDTFile = new File(gdtFile.getParentFile(), gdtFile.getName() + ".step1.gdt");
|
||||||
FileDataTypeManager tmpFdtm = createFileArchive(tmpGDTFile, program.getLanguage(),
|
FileDataTypeManager tmpFdtm = FileDataTypeManager.createFileArchive(tmpGDTFile);
|
||||||
program.getCompilerSpec().getCompilerSpecID(), monitor);
|
|
||||||
int tx = -1;
|
int tx = -1;
|
||||||
try {
|
try {
|
||||||
tx = tmpFdtm.startTransaction("Import");
|
tx = tmpFdtm.startTransaction("Import");
|
||||||
@@ -857,8 +854,7 @@ public class GoRttiMapper extends DataTypeMapper {
|
|||||||
|
|
||||||
tmpFdtm.save();
|
tmpFdtm.save();
|
||||||
|
|
||||||
FileDataTypeManager fdtm = createFileArchive(gdtFile, program.getLanguage(),
|
FileDataTypeManager fdtm = FileDataTypeManager.createFileArchive(gdtFile);
|
||||||
program.getCompilerSpec().getCompilerSpecID(), monitor);
|
|
||||||
tx = -1;
|
tx = -1;
|
||||||
try {
|
try {
|
||||||
tx = fdtm.startTransaction("Import");
|
tx = fdtm.startTransaction("Import");
|
||||||
@@ -883,19 +879,6 @@ public class GoRttiMapper extends DataTypeMapper {
|
|||||||
tmpGDTFile.delete();
|
tmpGDTFile.delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
private FileDataTypeManager createFileArchive(File gdtFile, Language lang,
|
|
||||||
CompilerSpecID compilerId, TaskMonitor monitor) throws IOException {
|
|
||||||
try {
|
|
||||||
FileDataTypeManager fdtm = FileDataTypeManager.createFileArchive(gdtFile);
|
|
||||||
fdtm.setProgramArchitecture(lang, compilerId, LanguageUpdateOption.CLEAR, monitor);
|
|
||||||
return fdtm;
|
|
||||||
}
|
|
||||||
catch (IOException | CancelledException | LockException | UnsupportedOperationException
|
|
||||||
| IncompatibleLanguageException e) {
|
|
||||||
throw new IOException("Failed to create file data type manager: " + gdtFile, e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private DataType structMappingInfoToDataType(StructureMappingInfo<?> smi) {
|
private DataType structMappingInfoToDataType(StructureMappingInfo<?> smi) {
|
||||||
if (smi.getStructureDataType() == null) {
|
if (smi.getStructureDataType() == null) {
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
Reference in New Issue
Block a user