Java Code Examples for ghidra.framework.options.Options#getBoolean()
The following examples show how to use
ghidra.framework.options.Options#getBoolean() .
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: RegisterFieldFactory.java From ghidra with Apache License 2.0 | 6 votes |
private RegisterFieldFactory(FieldFormatModel model, HighlightProvider highlightProvider, Options displayOptions, Options fieldOptions) { super(FIELD_NAME, model, highlightProvider, displayOptions, fieldOptions); regComp = new RegComparator(); initDisplayOptions(); fieldOptions.registerOption(DISPLAY_HIDDEN_REGISTERS_OPTION_NAME, false, null, "Shows/hides context registers"); fieldOptions.registerOption(DISPLAY_DEFAULT_REGISTER_VALUES_OPTION_NAME, false, null, "Shows/hides default register values"); regColor = displayOptions.getColor(OptionsGui.REGISTERS.getColorOptionName(), getDefaultColor()); showHiddenRegisters = fieldOptions.getBoolean(DISPLAY_HIDDEN_REGISTERS_OPTION_NAME, false); showDefaultValues = fieldOptions.getBoolean(DISPLAY_DEFAULT_REGISTER_VALUES_OPTION_NAME, false); }
Example 2
Source File: ConstantPropagationAnalyzer.java From ghidra with Apache License 2.0 | 6 votes |
@Override public void optionsChanged(Options options, Program program) { checkParamRefsOption = options.getBoolean(OPTION_NAME, checkParamRefsOption); checkStoredRefsOption = options.getBoolean(STORED_OPTION_NAME, checkStoredRefsOption); trustWriteMemOption = options.getBoolean(TRUSTWRITEMEM_OPTION_NAME, trustWriteMemOption); maxThreadCount = options.getInt(MAXTHREADCOUNT_OPTION_NAME, maxThreadCount); // TODO: there should be a getAddress on option that validates and allows entry of addresses minStoreLoadRefAddress = options.getLong(MINKNOWNREFADDRESS_OPTION_NAME, minStoreLoadRefAddress); minSpeculativeRefAddress = options.getLong(MINSPECULATIVEREFADDRESS_OPTION_NAME, minSpeculativeRefAddress); maxSpeculativeRefAddress = options.getLong(MAXSPECULATIVEREFADDRESS_OPTION_NAME, maxSpeculativeRefAddress); }
Example 3
Source File: PythonCodeCompletionFactory.java From ghidra with Apache License 2.0 | 6 votes |
/** * Sets up Python code completion Options. * @param plugin python plugin as options owner * @param options an Options handle */ public static void setupOptions(PythonPlugin plugin, Options options) { includeTypes = options.getBoolean(INCLUDE_TYPES_LABEL, INCLUDE_TYPES_DEFAULT); options.registerOption(INCLUDE_TYPES_LABEL, INCLUDE_TYPES_DEFAULT, null, INCLUDE_TYPES_DESCRIPTION); Iterator<?> iter = classes.iterator(); while (iter.hasNext()) { Class<?> currentClass = (Class<?>) iter.next(); options.registerOption( COMPLETION_LABEL + Options.DELIMITER + getSimpleName(currentClass), classToColorMap.get(currentClass), null, "Color to use for " + classDescription.get(currentClass) + "."); classToColorMap.put(currentClass, options.getColor(COMPLETION_LABEL + Options.DELIMITER + getSimpleName(currentClass), classToColorMap.get(currentClass))); } }
Example 4
Source File: PreCommentFieldFactory.java From ghidra with Apache License 2.0 | 6 votes |
/** * Constructor * @param model the model that the field belongs to. * @param hlProvider the HightLightStringProvider. * @param displayOptions the Options for display properties. * @param fieldOptions the Options for field specific properties. */ private PreCommentFieldFactory(FieldFormatModel model, HighlightProvider hlProvider, Options displayOptions, Options fieldOptions) { super(FIELD_NAME, model, hlProvider, displayOptions, fieldOptions); fieldOptions.registerOption(FLAG_FUNCTION_ENTRY_OPTION, false, null, "Toggles the display of a pre-comment for a function entry"); fieldOptions.registerOption(FLAG_SUBROUTINE_ENTRY_OPTION, false, null, "Toggles the display of a pre-comment for a sub-routine entry"); flagFunctionEntry = fieldOptions.getBoolean(FLAG_FUNCTION_ENTRY_OPTION, false); flagSubroutineEntry = fieldOptions.getBoolean(FLAG_SUBROUTINE_ENTRY_OPTION, false); automaticCommentColor = displayOptions.getColor(OptionsGui.COMMENT_AUTO.getColorOptionName(), OptionsGui.COMMENT_AUTO.getDefaultColor()); automaticCommentStyle = displayOptions.getInt(OptionsGui.COMMENT_AUTO.getStyleOptionName(), -1); init(fieldOptions); }
Example 5
Source File: MipsR5900AddressAnalyzer.java From ghidra-emotionengine with Apache License 2.0 | 5 votes |
@Override public void optionsChanged(Options options, Program program) { super.optionsChanged(options, program); options.registerOption(OPTION_NAME_SWITCH_TABLE, OPTION_DEFAULT_SWITCH_TABLE, null, OPTION_DESCRIPTION_SWITCH_TABLE); options.registerOption(OPTION_NAME_MARK_DUAL_INSTRUCTION, OPTION_DEFAULT_MARK_DUAL_INSTRUCTION, null, OPTION_DESCRIPTION_MARK_DUAL_INSTRUCTION); options.registerOption(OPTION_NAME_ASSUME_T9_ENTRY, OPTION_DEFAULT_ASSUME_T9_ENTRY, null, OPTION_DESCRIPTION_ASSUME_T9_ENTRY); options.registerOption(OPTION_NAME_RECOVER_GP, OPTION_DEFAULT_RECOVER_GP, null, OPTION_DESCRIPTION_RECOVER_GP); trySwitchTables = options.getBoolean(OPTION_NAME_SWITCH_TABLE, OPTION_DEFAULT_SWITCH_TABLE); markupDualInstructionOption = options.getBoolean(OPTION_NAME_MARK_DUAL_INSTRUCTION, OPTION_DEFAULT_MARK_DUAL_INSTRUCTION); assumeT9EntryAddress = options.getBoolean(OPTION_NAME_ASSUME_T9_ENTRY, OPTION_DEFAULT_ASSUME_T9_ENTRY); discoverGlobalGPSetting = options.getBoolean(OPTION_NAME_RECOVER_GP, OPTION_DEFAULT_RECOVER_GP); }
Example 6
Source File: FunctionStartAnalyzer.java From ghidra with Apache License 2.0 | 5 votes |
@Override public void optionsChanged(Options options, Program program) { boolean datablocks = options.getBoolean(OPTION_NAME_DATABLOCKS, OPTION_DEFAULT_DATABLOCKS); executableBlocksOnly = !datablocks; setbookmark = options.getBoolean(OPTION_NAME_BOOKMARKS, setbookmark); }
Example 7
Source File: PowerPCAddressAnalyzer.java From ghidra with Apache License 2.0 | 5 votes |
@Override public void optionsChanged(Options options, Program program) { super.optionsChanged(options, program); checkHighNibbleOption = options.getBoolean(OPTION_NAME_CHECK_NIBBLE, checkHighNibbleOption); markupDualInstructionOption = options.getBoolean(OPTION_NAME_MARK_DUAL_INSTRUCTION, markupDualInstructionOption); recoverSwitchTables = options.getBoolean(SWITCH_OPTION_NAME, recoverSwitchTables); propagateR2value = options.getBoolean(OPTION_NAME_PROPAGATE_R2, propagateR2value); propagateR30value = options.getBoolean(OPTION_NAME_PROPAGATE_R30, propagateR30value); }
Example 8
Source File: RelocationManager.java From ghidra with Apache License 2.0 | 5 votes |
@Override public boolean isRelocatable() { if (isRelocatable == null) { Options propList = program.getOptions(Program.PROGRAM_INFO); if (propList.contains(RELOCATABLE_PROP_NAME)) { isRelocatable = propList.getBoolean(RELOCATABLE_PROP_NAME, false); } else { isRelocatable = (getSize() > 0); } } return isRelocatable.booleanValue(); }
Example 9
Source File: StackVariableAnalyzer.java From ghidra with Apache License 2.0 | 5 votes |
public void optionsChanged(Options options, Program program) { doNewStackAnalysis = options.getBoolean(GhidraLanguagePropertyKeys.USE_NEW_FUNCTION_STACK_ANALYSIS, !useOldStackAnalysisByDefault(program)); doLocalAnalysis = options.getBoolean("Create Local Variables", doLocalAnalysis); doParameterAnalysis = options.getBoolean("Create Param Variables", doParameterAnalysis); }
Example 10
Source File: DecompilerFunctionAnalyzer.java From ghidra with Apache License 2.0 | 5 votes |
@Override public void optionsChanged(Options options, Program program) { sourceTypeClearLevelOption = options.getEnum(OPTION_NAME_CLEAR_LEVEL, SourceType.ANALYSIS); decompilerTimeoutSecondsOption = options.getInt(OPTION_NAME_DECOMPILER_TIMEOUT_SECS, decompilerTimeoutSecondsOption); commitDataTypesOption = options.getBoolean(OPTION_NAME_COMMIT_DATA_TYPES, commitDataTypesOption); commitVoidReturnOption = options.getBoolean(OPTION_NAME_COMMIT_VOID_RETURN, commitVoidReturnOption); }
Example 11
Source File: FunctionSignatureFieldFactory.java From ghidra with Apache License 2.0 | 5 votes |
/** * Constructor * @param model the model that the field belongs to. * @param hlProvider the HightLightProvider. * @param displayOptions the Options for display properties. * @param fieldOptions the Options for field specific properties. */ public FunctionSignatureFieldFactory(FieldFormatModel model, HighlightProvider hlProvider, Options displayOptions, Options fieldOptions) { super(FIELD_NAME, model, hlProvider, displayOptions, fieldOptions); fieldOptions.registerOption(DISPLAY_NAMESPACE, false, null, "Prepends namespaces to labels that are not in the global namespace."); displayFunctionScope = fieldOptions.getBoolean(DISPLAY_NAMESPACE, false); funRetColor = displayOptions.getColor(OptionsGui.FUN_RET_TYPE.getColorOptionName(), OptionsGui.FUN_RET_TYPE.getDefaultColor()); funNameColor = displayOptions.getColor(OptionsGui.FUN_NAME.getColorOptionName(), OptionsGui.FUN_NAME.getDefaultColor()); unresolvedThunkRefColor = displayOptions.getColor(OptionsGui.BAD_REF_ADDR.getColorOptionName(), OptionsGui.BAD_REF_ADDR.getDefaultColor()); resolvedThunkRefColor = displayOptions.getColor(OptionsGui.EXT_REF_RESOLVED.getColorOptionName(), OptionsGui.EXT_REF_RESOLVED.getDefaultColor()); funParamsColor = displayOptions.getColor(OptionsGui.FUN_PARAMS.getColorOptionName(), OptionsGui.FUN_PARAMS.getDefaultColor()); autoParamColor = displayOptions.getColor(OptionsGui.FUN_AUTO_PARAMS.getColorOptionName(), OptionsGui.FUN_PARAMS.getDefaultColor()); literalColor = displayOptions.getColor(OptionsGui.SEPARATOR.getColorOptionName(), OptionsGui.SEPARATOR.getDefaultColor()); }
Example 12
Source File: GccExceptionAnalyzer.java From ghidra with Apache License 2.0 | 4 votes |
@Override public void optionsChanged(Options options, Program program) { createTryCatchCommentsEnabled = options.getBoolean(OPTION_NAME_CREATE_TRY_CATCH_COMMENTS, createTryCatchCommentsEnabled); }
Example 13
Source File: AnalyzeStackRefsAction.java From ghidra with Apache License 2.0 | 4 votes |
@Override protected void actionPerformed(ListingActionContext context) { // get the entry points for all the functions in the current selection/location Iterator<Function> iter = funcPlugin.getFunctions(context); if (iter.hasNext() == false) { String message = "No function at current location"; ProgramSelection selection = context.getSelection(); if (selection != null) { message = "No functions within current selection"; } funcPlugin.getTool().setStatusInfo("Analyze Stack: " + message); return; } AddressSet funcSet = new AddressSet(); while (iter.hasNext()) { Function func = iter.next(); funcSet.addRange(func.getEntryPoint(), func.getEntryPoint()); } boolean doNewStackAnalysis = true; boolean doLocalAnalysis = true; boolean doParameterAnalysis = true; Program program = context.getProgram(); // TODO: THIS MAY NOT BE THE BEST WAY TO get the options to agree with the analysis options! Advise. Options options = program.getOptions(Program.ANALYSIS_PROPERTIES).getOptions("Stack"); options.registerOption(GhidraLanguagePropertyKeys.USE_NEW_FUNCTION_STACK_ANALYSIS, doNewStackAnalysis, null, "Use General Stack Reference Propogator (This works best on most processors)"); options.registerOption("Create Local Variables", doLocalAnalysis, null, "Create Function Local stack variables and references"); options.registerOption("Create Param Variables", doParameterAnalysis, null, "Create Function Parameter stack variables and references"); doNewStackAnalysis = options.getBoolean( GhidraLanguagePropertyKeys.USE_NEW_FUNCTION_STACK_ANALYSIS, doNewStackAnalysis); doLocalAnalysis = options.getBoolean("Create Local Variables", doLocalAnalysis); doParameterAnalysis = options.getBoolean("Create Param Variables", doParameterAnalysis); BackgroundCommand cmd = null; if (doNewStackAnalysis) { cmd = new NewFunctionStackAnalysisCmd(funcSet, doParameterAnalysis, doLocalAnalysis, true); } else { cmd = new FunctionStackAnalysisCmd(funcSet, doParameterAnalysis, doLocalAnalysis, true); } funcPlugin.execute(program, cmd); }
Example 14
Source File: UnionEditorProviderTest.java From ghidra with Apache License 2.0 | 4 votes |
@Test public void testChangeHexNumbersOption() throws Exception { init(complexUnion, pgmTestCat, false); DataType oldDt = model.viewComposite.clone(null); Options options = tool.getOptions("Editors"); String hexNumbersName = "Union Editor" + Options.DELIMITER + "Show Numbers In Hex"; // Get the hex length option value boolean hexLength = options.getBoolean(hexNumbersName, false); assertEquals(false, hexLength); // Check the length value is in decimal assertEquals(false, model.isShowingNumbersInHex()); assertEquals("29", model.getValueAt(15, model.getLengthColumn())); assertEquals("87", model.getLengthAsString()); // Set the hex length option value to Hex options.setBoolean(hexNumbersName, true); // Get the hex length option value hexLength = options.getBoolean(hexNumbersName, false); assertEquals(true, hexLength); // Check the value (length should still be decimal in editor) assertEquals(false, model.isShowingNumbersInHex()); assertEquals("29", model.getValueAt(15, model.getLengthColumn())); assertEquals("87", model.getLengthAsString()); // Close the editor Swing.runLater(() -> provider.closeComponent()); waitForSwing(); // Editor should be closed. assertFalse(tool.isVisible(provider)); assertTrue(complexUnion.isEquivalent(oldDt)); // Re-open the editor init(complexUnion, pgmTestCat, true); // Get the hex option value (length should now be hexadecimal in editor) hexLength = options.getBoolean(hexNumbersName, false); assertEquals(true, hexLength); // Check the value is in hexadecimal assertEquals(true, model.isShowingNumbersInHex()); assertEquals("0x1d", model.getValueAt(15, model.getLengthColumn())); assertEquals("0x57", model.getLengthAsString()); // Set the hex length option value to decimal options.setBoolean(hexNumbersName, false); // Get the hex option value hexLength = options.getBoolean(hexNumbersName, false); assertEquals(false, hexLength); // Check the value (length should still be hexadecimal in editor) assertEquals(true, model.isShowingNumbersInHex()); assertEquals("0x1d", model.getValueAt(15, model.getLengthColumn())); assertEquals("0x57", model.getLengthAsString()); // Close the editor Swing.runLater(() -> provider.closeComponent()); waitForSwing(); // Editor should be closed. assertFalse(tool.isVisible(provider)); assertTrue(complexUnion.isEquivalent(oldDt)); // Re-open the editor init(complexUnion, pgmTestCat, false); // Get the hex option value (length should now be decimal in editor) hexLength = options.getBoolean(hexNumbersName, false); assertEquals(false, hexLength); // Check the value is in hexadecimal assertEquals(false, model.isShowingNumbersInHex()); assertEquals("29", model.getValueAt(15, model.getLengthColumn())); assertEquals("87", model.getLengthAsString()); }
Example 15
Source File: RegisterTransitionFieldFactory.java From ghidra with Apache License 2.0 | 4 votes |
private void initOptions(Options displayOptions, Options fieldOptions) { regColor = displayOptions.getColor(OptionsGui.REGISTERS.getColorOptionName(), getDefaultColor()); showContextRegisters = fieldOptions.getBoolean(DISPLAY_HIDDEN_REGISTERS_OPTION_NAME, false); }
Example 16
Source File: EntryPointAnalyzer.java From ghidra with Apache License 2.0 | 4 votes |
@Override public void optionsChanged(Options options, Program program) { respectExecuteFlags = options.getBoolean(OPTION_NAME_RESPECT_EXECUTE_FLAG, respectExecuteFlags); }
Example 17
Source File: ImpliedMatchAssociationHook.java From ghidra with Apache License 2.0 | 4 votes |
@Override public void optionsChanged(Options options) { autoCreateImpliedMatches = options.getBoolean(VTOptionDefines.AUTO_CREATE_IMPLIED_MATCH, false); }
Example 18
Source File: TruncatedTextListingHover.java From ghidra with Apache License 2.0 | 4 votes |
@Override public void setOptions(Options options, String name) { enabled = options.getBoolean(NAME, true); }
Example 19
Source File: DataTypeListingHover.java From ghidra with Apache License 2.0 | 4 votes |
@Override public void setOptions(Options options, String name) { enabled = options.getBoolean(NAME, true); }
Example 20
Source File: AggressiveInstructionFinderAnalyzer.java From ghidra with Apache License 2.0 | 4 votes |
@Override public void optionsChanged(Options options, Program program) { createBookmarksEnabled = options.getBoolean(OPTION_NAME_CREATE_BOOKMARKS, createBookmarksEnabled); }