mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-06-01 08:04:56 +08:00
Merge remote-tracking branch 'origin/GP-1876_ghidravore_fixing_importer_to_use_imported_file_for_internal_name--SQUASHED'
This commit is contained in:
+18
-5
@@ -25,6 +25,7 @@ import ghidra.app.util.Option;
|
|||||||
import ghidra.app.util.OptionUtils;
|
import ghidra.app.util.OptionUtils;
|
||||||
import ghidra.app.util.bin.ByteProvider;
|
import ghidra.app.util.bin.ByteProvider;
|
||||||
import ghidra.app.util.importer.MessageLog;
|
import ghidra.app.util.importer.MessageLog;
|
||||||
|
import ghidra.formats.gfilesystem.FSRL;
|
||||||
import ghidra.framework.model.DomainFolder;
|
import ghidra.framework.model.DomainFolder;
|
||||||
import ghidra.framework.model.DomainObject;
|
import ghidra.framework.model.DomainObject;
|
||||||
import ghidra.framework.store.LockException;
|
import ghidra.framework.store.LockException;
|
||||||
@@ -129,7 +130,7 @@ public abstract class AbstractProgramLoader implements Loader {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (createProgramFile(loadedProgram, folder, loadedProgram.getName(), messageLog,
|
if (createProgramFile(loadedProgram, folder, name, messageLog,
|
||||||
monitor)) {
|
monitor)) {
|
||||||
results.add(loadedProgram);
|
results.add(loadedProgram);
|
||||||
programsToFixup.add(loadedProgram);
|
programsToFixup.add(loadedProgram);
|
||||||
@@ -259,7 +260,7 @@ public abstract class AbstractProgramLoader implements Loader {
|
|||||||
* Creates a {@link Program} with the specified attributes.
|
* Creates a {@link Program} with the specified attributes.
|
||||||
*
|
*
|
||||||
* @param provider The bytes that will make up the {@link Program}.
|
* @param provider The bytes that will make up the {@link Program}.
|
||||||
* @param programName The name of the {@link Program}.
|
* @param domainFileName The name for the DomainFile that will store the {@link Program}.
|
||||||
* @param imageBase The image base address of the {@link Program}.
|
* @param imageBase The image base address of the {@link Program}.
|
||||||
* @param executableFormatName The file format name of the {@link Program}. Typically this will
|
* @param executableFormatName The file format name of the {@link Program}. Typically this will
|
||||||
* be the {@link Loader} name.
|
* be the {@link Loader} name.
|
||||||
@@ -269,9 +270,11 @@ public abstract class AbstractProgramLoader implements Loader {
|
|||||||
* @return The newly created {@link Program}.
|
* @return The newly created {@link Program}.
|
||||||
* @throws IOException if there was an IO-related problem with creating the {@link Program}.
|
* @throws IOException if there was an IO-related problem with creating the {@link Program}.
|
||||||
*/
|
*/
|
||||||
protected Program createProgram(ByteProvider provider, String programName, Address imageBase,
|
protected Program createProgram(ByteProvider provider, String domainFileName,
|
||||||
String executableFormatName, Language language, CompilerSpec compilerSpec,
|
Address imageBase, String executableFormatName, Language language,
|
||||||
Object consumer) throws IOException {
|
CompilerSpec compilerSpec, Object consumer) throws IOException {
|
||||||
|
|
||||||
|
String programName = getProgramNameFromSourceData(provider, domainFileName);
|
||||||
Program prog = new ProgramDB(programName, language, compilerSpec, consumer);
|
Program prog = new ProgramDB(programName, language, compilerSpec, consumer);
|
||||||
prog.setEventsEnabled(false);
|
prog.setEventsEnabled(false);
|
||||||
int id = prog.startTransaction("Set program properties");
|
int id = prog.startTransaction("Set program properties");
|
||||||
@@ -303,6 +306,16 @@ public abstract class AbstractProgramLoader implements Loader {
|
|||||||
return prog;
|
return prog;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String getProgramNameFromSourceData(ByteProvider provider, String domainFileName) {
|
||||||
|
FSRL fsrl = provider.getFSRL();
|
||||||
|
if (fsrl != null) {
|
||||||
|
return fsrl.getName();
|
||||||
|
}
|
||||||
|
|
||||||
|
// If the ByteProvider dosn't have have an FSRL, use the given domainFileName
|
||||||
|
return domainFileName;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates default memory blocks for the given {@link Program}.
|
* Creates default memory blocks for the given {@link Program}.
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user