Package ghidra.app.util.opinion
Class IntelHexLoader
- java.lang.Object
-
- ghidra.app.util.opinion.AbstractProgramLoader
-
- ghidra.app.util.opinion.IntelHexLoader
-
- All Implemented Interfaces:
Loader
,ExtensionPoint
,java.lang.Comparable<Loader>
public class IntelHexLoader extends AbstractProgramLoader
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface ghidra.util.classfinder.ExtensionPoint
ExtensionPoint.Exclude, ExtensionPoint.Util
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
INTEL_HEX_NAME
-
Fields inherited from class ghidra.app.util.opinion.AbstractProgramLoader
ANCHOR_LABELS_OPTION_NAME, APPLY_LABELS_OPTION_NAME
-
Fields inherited from interface ghidra.app.util.opinion.Loader
COMMAND_LINE_ARG_PREFIX
-
-
Constructor Summary
Constructors Constructor Description IntelHexLoader()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Collection<LoadSpec>
findSupportedLoadSpecs(ByteProvider provider)
If thisLoader
supports loading the givenByteProvider
, this methods returns aCollection
of all supportedLoadSpec
s that contain discovered load specification information that thisLoader
will need to load.java.util.List<Option>
getDefaultOptions(ByteProvider provider, LoadSpec loadSpec, DomainObject domainObject, boolean loadIntoProgram)
Gets the defaultLoader
options.java.lang.String
getName()
LoaderTier
getTier()
For ordering purposes; lower tier numbers are more important (and listed first).int
getTierPriority()
For ordering purposes; lower numbers are more important (and listed first, within its tier).protected java.util.List<Program>
loadProgram(ByteProvider provider, java.lang.String programName, DomainFolder programFolder, LoadSpec loadSpec, java.util.List<Option> options, MessageLog log, java.lang.Object consumer, TaskMonitor monitor)
Loads program bytes in a particular format as a newProgram
.protected boolean
loadProgramInto(ByteProvider provider, LoadSpec loadSpec, java.util.List<Option> options, MessageLog log, Program prog, TaskMonitor monitor)
Loads program bytes into the specifiedProgram
.boolean
supportsLoadIntoProgram()
java.lang.String
validateOptions(ByteProvider provider, LoadSpec loadSpec, java.util.List<Option> options, Program program)
Validates theLoader
's options and returns null if all options are valid; otherwise, an error message describing the problem is returned.-
Methods inherited from class ghidra.app.util.opinion.AbstractProgramLoader
createDefaultMemoryBlocks, createProgram, generateBlockName, getLanguageService, load, loadInto, postLoadProgramFixups, release, shouldApplyProcessorLabelsByDefault
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface ghidra.app.util.opinion.Loader
compareTo, getPreferredFileName
-
-
-
-
Field Detail
-
INTEL_HEX_NAME
public static final java.lang.String INTEL_HEX_NAME
- See Also:
- Constant Field Values
-
-
Method Detail
-
getTier
public LoaderTier getTier()
Description copied from interface:Loader
For ordering purposes; lower tier numbers are more important (and listed first).- Returns:
- the tier of the loader
-
getTierPriority
public int getTierPriority()
Description copied from interface:Loader
For ordering purposes; lower numbers are more important (and listed first, within its tier).- Returns:
- the ordering of the loader within its tier
-
supportsLoadIntoProgram
public boolean supportsLoadIntoProgram()
Description copied from interface:Loader
-
findSupportedLoadSpecs
public java.util.Collection<LoadSpec> findSupportedLoadSpecs(ByteProvider provider) throws java.io.IOException
Description copied from interface:Loader
If thisLoader
supports loading the givenByteProvider
, this methods returns aCollection
of all supportedLoadSpec
s that contain discovered load specification information that thisLoader
will need to load. If thisLoader
cannot support loading the givenByteProvider
, an emptyCollection
is returned.- Parameters:
provider
- The bytes being loaded.- Returns:
- A
Collection
ofLoadSpec
s that thisLoader
supports loading, or an emptyCollection
if thisLoader
doesn't support loading the givenByteProvider
. - Throws:
java.io.IOException
- if there was an IO-related issue finding theLoadSpec
s.
-
validateOptions
public java.lang.String validateOptions(ByteProvider provider, LoadSpec loadSpec, java.util.List<Option> options, Program program)
Description copied from interface:Loader
Validates theLoader
's options and returns null if all options are valid; otherwise, an error message describing the problem is returned.- Specified by:
validateOptions
in interfaceLoader
- Overrides:
validateOptions
in classAbstractProgramLoader
- Parameters:
provider
- The bytes of the thing being loaded.loadSpec
- The proposedLoadSpec
.options
- The list ofOption
s to validate.program
- existing program if the loader is adding to an existing program. If it is a fresh import, then this will be null.- Returns:
- null if all
Option
s are valid; otherwise, an error message describing the problem is returned.
-
loadProgram
protected java.util.List<Program> loadProgram(ByteProvider provider, java.lang.String programName, DomainFolder programFolder, LoadSpec loadSpec, java.util.List<Option> options, MessageLog log, java.lang.Object consumer, TaskMonitor monitor) throws java.io.IOException, CancelledException
Description copied from class:AbstractProgramLoader
Loads program bytes in a particular format as a newProgram
. MultipleProgram
s may end up getting created, depending on the nature of the format.- Specified by:
loadProgram
in classAbstractProgramLoader
- Parameters:
provider
- The bytes to load.programName
- The name of theProgram
that's being loaded.programFolder
- TheDomainFolder
where the loaded thing should be saved. Could be null if the thing should not be pre-saved.loadSpec
- TheLoadSpec
to use during load.options
- The load options.log
- The message log.consumer
- A consumer object forProgram
s generated.monitor
- A cancelable task monitor.- Returns:
- A list of loaded
Program
s (element 0 corresponds to primary loadedProgram
). - Throws:
java.io.IOException
- if there was an IO-related problem loading.CancelledException
- if the user cancelled the load.
-
loadProgramInto
protected boolean loadProgramInto(ByteProvider provider, LoadSpec loadSpec, java.util.List<Option> options, MessageLog log, Program prog, TaskMonitor monitor) throws java.io.IOException, CancelledException
Description copied from class:AbstractProgramLoader
Loads program bytes into the specifiedProgram
. This method will not create any newProgram
s. It is only for adding to an existingProgram
.NOTE: The loading that occurs in this method will automatically be done in a transaction.
- Specified by:
loadProgramInto
in classAbstractProgramLoader
- Parameters:
provider
- The bytes to load into theProgram
.loadSpec
- TheLoadSpec
to use during load.options
- The load options.log
- The message log.prog
- TheProgram
to load into.monitor
- A cancelable task monitor.- Returns:
- True if the file was successfully loaded; otherwise, false.
- Throws:
java.io.IOException
- if there was an IO-related problem loading.CancelledException
- if the user cancelled the load.
-
getDefaultOptions
public java.util.List<Option> getDefaultOptions(ByteProvider provider, LoadSpec loadSpec, DomainObject domainObject, boolean loadIntoProgram)
Description copied from interface:Loader
Gets the defaultLoader
options.- Specified by:
getDefaultOptions
in interfaceLoader
- Overrides:
getDefaultOptions
in classAbstractProgramLoader
- Parameters:
provider
- The bytes of the thing being loaded.loadSpec
- TheLoadSpec
.domainObject
- TheDomainObject
being loaded.loadIntoProgram
- True if the load is adding to an existingDomainObject
; otherwise, false.- Returns:
- A list of the
Loader
's default options.
-
-