Java Code Examples for ghidra.app.util.Option#getName()
The following examples show how to use
ghidra.app.util.Option#getName() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractLibrarySupportLoader.java From ghidra with Apache License 2.0 | 6 votes |
@Override public String validateOptions(ByteProvider provider, LoadSpec loadSpec, List<Option> options, Program program) { if (options != null) { for (Option option : options) { String name = option.getName(); if (name.equals(SYM_OPTION_NAME) || name.equals(LIB_OPTION_NAME)) { if (!Boolean.class.isAssignableFrom(option.getValueClass())) { return "Invalid type for option: " + name + " - " + option.getValueClass(); } } } } return super.validateOptions(provider, loadSpec, options, program); }
Example 2
Source File: PeLoader.java From ghidra with Apache License 2.0 | 5 votes |
@Override public String validateOptions(ByteProvider provider, LoadSpec loadSpec, List<Option> options, Program program) { if (options != null) { for (Option option : options) { String name = option.getName(); if (name.equals(PARSE_CLI_HEADERS_OPTION_NAME)) { if (!Boolean.class.isAssignableFrom(option.getValueClass())) { return "Invalid type for option: " + name + " - " + option.getValueClass(); } } } } return super.validateOptions(provider, loadSpec, options, program); }
Example 3
Source File: PeLoader.java From ghidra with Apache License 2.0 | 5 votes |
private boolean shouldParseCliHeaders(List<Option> options) { if (options != null) { for (Option option : options) { String optName = option.getName(); if (optName.equals(PARSE_CLI_HEADERS_OPTION_NAME)) { return (Boolean) option.getValue(); } } } return PARSE_CLI_HEADERS_OPTION_DEFAULT; }
Example 4
Source File: CoffLoader.java From ghidra with Apache License 2.0 | 5 votes |
@Override public String validateOptions(ByteProvider provider, LoadSpec loadSpec, List<Option> options, Program program) { if (options != null) { for (Option option : options) { String name = option.getName(); if (name.equals(FAKE_LINK_OPTION_NAME)) { if (!Boolean.class.isAssignableFrom(option.getValueClass())) { return "Invalid type for option: " + name + " - " + option.getValueClass(); } } } } return super.validateOptions(provider, loadSpec, options, program); }
Example 5
Source File: ElfLoaderOptionsFactory.java From ghidra with Apache License 2.0 | 5 votes |
static String validateOptions(LoadSpec loadSpec, List<Option> options) { Language language; try { language = loadSpec.getLanguageCompilerSpec().getLanguage(); } catch (LanguageNotFoundException e) { throw new RuntimeException(e); } for (Option option : options) { String name = option.getName(); if (name.equals(PERFORM_RELOCATIONS_NAME)) { if (!Boolean.class.isAssignableFrom(option.getValueClass())) { return "Invalid type for option: " + name + " - " + option.getValueClass(); } } else if (name.equals(INCLUDE_OTHER_BLOCKS)) { if (!Boolean.class.isAssignableFrom(option.getValueClass())) { return "Invalid type for option: " + name + " - " + option.getValueClass(); } } else if (name.equals(IMAGE_BASE_OPTION_NAME)) { return validateAddressSpaceOffsetOption(option, language.getDefaultSpace()); } else if (name.equals(IMAGE_DATA_IMAGE_BASE_OPTION_NAME)) { return validateAddressSpaceOffsetOption(option, language.getDefaultDataSpace()); } } return null; }
Example 6
Source File: AbstractProgramLoader.java From ghidra with Apache License 2.0 | 5 votes |
@Override public String validateOptions(ByteProvider provider, LoadSpec loadSpec, List<Option> options, Program program) { if (options != null) { for (Option option : options) { String name = option.getName(); if (name.equals(APPLY_LABELS_OPTION_NAME) || name.equals(ANCHOR_LABELS_OPTION_NAME)) { if (!Boolean.class.isAssignableFrom(option.getValueClass())) { return "Invalid type for option: " + name + " - " + option.getValueClass(); } } } } return null; }
Example 7
Source File: IntelHexLoader.java From ghidra with Apache License 2.0 | 5 votes |
@Override public String validateOptions(ByteProvider provider, LoadSpec loadSpec, List<Option> options, Program program) { Address baseAddr = null; for (Option option : options) { String optName = option.getName(); try { if (optName.equals(OPTION_NAME_BASE_ADDRESS)) { baseAddr = (Address) option.getValue(); if (baseAddr == null) { return "Invalid base address"; } } else if (optName.equals(OPTION_NAME_BLOCK_NAME)) { if (!String.class.isAssignableFrom(option.getValueClass())) { return OPTION_NAME_BLOCK_NAME + " must be a String"; } } else if (optName.equals(OPTION_NAME_IS_OVERLAY)) { if (!Boolean.class.isAssignableFrom(option.getValueClass())) { return OPTION_NAME_IS_OVERLAY + " must be a boolean"; } } else { return "Unknown option: " + optName; } } catch (ClassCastException e) { return "Invalid type for option: " + optName + " - " + e.getMessage(); } } return null; }
Example 8
Source File: IntelHexLoader.java From ghidra with Apache License 2.0 | 5 votes |
private Address getBaseAddr(List<Option> options) { Address baseAddr = null; for (Option option : options) { String optName = option.getName(); if (optName.equals(OPTION_NAME_BASE_ADDRESS)) { baseAddr = (Address) option.getValue(); } } return baseAddr; }
Example 9
Source File: IntelHexLoader.java From ghidra with Apache License 2.0 | 5 votes |
private String getBlockName(List<Option> options) { String blockName = ""; for (Option option : options) { String optName = option.getName(); if (optName.equals(OPTION_NAME_BLOCK_NAME)) { blockName = (String) option.getValue(); } } return blockName; }
Example 10
Source File: MotorolaHexLoader.java From ghidra with Apache License 2.0 | 5 votes |
@Override public String validateOptions(ByteProvider provider, LoadSpec loadSpec, List<Option> options, Program program) { Address baseAddr = null; for (Option option : options) { String optName = option.getName(); try { if (optName.equals(OPTION_NAME_BASE_ADDRESS)) { baseAddr = (Address) option.getValue(); if (baseAddr == null) { return "Invalid base address"; } } else if (optName.equals(OPTION_NAME_BLOCK_NAME)) { if (!String.class.isAssignableFrom(option.getValueClass())) { return OPTION_NAME_BLOCK_NAME + " must be a String"; } } else if (optName.equals(OPTION_NAME_IS_OVERLAY)) { if (!Boolean.class.isAssignableFrom(option.getValueClass())) { return OPTION_NAME_IS_OVERLAY + " must be a boolean"; } } else { return "Unknown option: " + optName; } } catch (ClassCastException e) { return "Invalid type for option: " + optName + " - " + e.getMessage(); } } return null; }
Example 11
Source File: MotorolaHexLoader.java From ghidra with Apache License 2.0 | 5 votes |
private Address getBaseAddr(List<Option> options) { Address baseAddr = null; for (Option option : options) { String optName = option.getName(); if (optName.equals(OPTION_NAME_BASE_ADDRESS)) { baseAddr = (Address) option.getValue(); } } return baseAddr; }
Example 12
Source File: MotorolaHexLoader.java From ghidra with Apache License 2.0 | 5 votes |
private String getBlockName(List<Option> options) { String blockName = ""; for (Option option : options) { String optName = option.getName(); if (optName.equals(OPTION_NAME_BLOCK_NAME)) { blockName = (String) option.getValue(); } } return blockName; }
Example 13
Source File: XmlProgramOptions.java From ghidra with Apache License 2.0 | 4 votes |
/** * Sets the options. This method is not for defining the options, but * rather for setting the values of options. If invalid options * are passed in, then OptionException should be thrown. * @param options the option values for XML * @throws OptionException if invalid options are passed in */ public void setOptions(List<Option> options) throws OptionException { for (Option option : options) { String optName = option.getName(); Object optValue = option.getValue(); if (!(optValue instanceof Boolean)) { throw new OptionException("Invalid type for option: " + optName); } boolean val = ((Boolean) optValue).booleanValue(); if (optName.equals("Memory Blocks")) { setMemoryBlocks(val); } else if (optName.equals("Memory Contents")) { setMemoryContents(val); } else if (optName.equals("Overwrite Memory Conflicts")) { setOverwriteMemoryConflicts(val); } else if (optName.equals("Instructions")) { setInstructions(val); } else if (optName.equals("Data")) { setData(val); } else if (optName.equals("Overwrite Data Conflicts")) { setOverwriteDataConflicts(val); } else if (optName.equals("Symbols")) { setSymbols(val); } else if (optName.equals("Overwrite Symbol Conflicts")) { setOverwriteSymbolConflicts(val); } else if (optName.equals("Equates")) { setEquates(val); } else if (optName.equals("Comments")) { setComments(val); } else if (optName.equals("Properties")) { setProperties(val); } else if (optName.equals("Overwrite Property Conflicts")) { setOverwritePropertyConflicts(val); } else if (optName.equals("Bookmarks")) { setBookmarks(val); } else if (optName.equals("Overwrite Bookmark Conflicts")) { setOverwriteBookmarkConflicts(val); } else if (optName.equals("Trees")) { setTrees(val); } else if (optName.equals("References")) { setReferences(val); } else if (optName.equals("Overwrite Reference Conflicts")) { setOverwriteReferenceConflicts(val); } else if (optName.equals("Functions")) { setFunctions(val); } else if (optName.equals("Registers")) { setRegisters(val); } else if (optName.equals("Relocation Table")) { setRelocationTable(val); } else if (optName.equals("Entry Points")) { setEntryPoints(val); } else if (optName.equals("External Libraries")) { setExternalLibraries(val); } else { throw new OptionException("Unknown option: " + optName); } } }