Java Code Examples for ghidra.program.model.symbol.SourceType#ANALYSIS
The following examples show how to use
ghidra.program.model.symbol.SourceType#ANALYSIS .
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: RefListFlagsV0.java From ghidra with Apache License 2.0 | 6 votes |
public RefListFlagsV0(boolean isPrimary, boolean isOffsetRef, boolean hasSymbolID, boolean isShiftRef, SourceType source) { flags = 0; if (source == SourceType.USER_DEFINED || source == SourceType.IMPORTED) { flags |= SOURCE_LOBIT; } if (source == SourceType.ANALYSIS || source == SourceType.IMPORTED) { flags |= SOURCE_HIBIT; } if (isPrimary) flags |= IS_PRIMARY; if (isOffsetRef) flags |= IS_OFFSET; if (hasSymbolID) flags |= HAS_SYMBOL_ID; if (isShiftRef) flags |= IS_SHIFT; }
Example 2
Source File: DecompilerParameterIDValidator.java From ghidra with Apache License 2.0 | 6 votes |
private static int checkNumberAnalyzed(Program prog, TaskMonitor monitor) { FunctionIterator funcIter = prog.getFunctionManager().getFunctions(true); int numFuncsWithParameterID = 0; monitor.setIndeterminate(false); monitor.initialize(prog.getFunctionManager().getFunctionCount()); while (funcIter.hasNext() && !monitor.isCancelled()) { monitor.incrementProgress(1); Function func = funcIter.next(); Address address = func.getEntryPoint(); Instruction inst = prog.getListing().getInstructionAt(address); if (inst != null) { final SourceType signatureSource = func.getSignatureSource(); if (signatureSource == SourceType.ANALYSIS) { ++numFuncsWithParameterID; } } } return numFuncsWithParameterID; }
Example 3
Source File: LabelFieldFactoryTest.java From ghidra with Apache License 2.0 | 6 votes |
private void createOffcutFunctionReference(Function function, Address fromAddress) { Address entryPoint = function.getEntryPoint(); Address oneByteOff = entryPoint.add(1); AddMemRefCmd addRefCmd = new AddMemRefCmd(fromAddress, oneByteOff, RefType.UNCONDITIONAL_CALL, SourceType.ANALYSIS, 0); RemoveAllReferencesCmd removeRefsCmd = new RemoveAllReferencesCmd(fromAddress); int ID = program.startTransaction("Test - Create Reference"); try { removeRefsCmd.applyTo(program); addRefCmd.applyTo(program); } finally { program.endTransaction(ID, true); } program.flushEvents(); waitForPostedSwingRunnables(); }
Example 4
Source File: OperandFieldFactoryTest.java From ghidra with Apache License 2.0 | 6 votes |
private void createOffcutFunctionReference(Function function, Address fromAddress) { Address entryPoint = function.getEntryPoint(); Address oneByteOff = entryPoint.add(1); AddMemRefCmd addRefCmd = new AddMemRefCmd(fromAddress, oneByteOff, RefType.UNCONDITIONAL_CALL, SourceType.ANALYSIS, 0); RemoveAllReferencesCmd removeRefsCmd = new RemoveAllReferencesCmd(fromAddress); int ID = program.startTransaction("Test - Create Reference"); try { removeRefsCmd.applyTo(program); addRefCmd.applyTo(program); } finally { program.endTransaction(ID, true); } program.flushEvents(); waitForPostedSwingRunnables(); }
Example 5
Source File: RefListFlagsV0.java From ghidra with Apache License 2.0 | 5 votes |
SourceType getSource() { boolean isLoBit = (flags & SOURCE_LOBIT) != 0; boolean isHiBit = (flags & SOURCE_HIBIT) != 0; if (isHiBit) { return isLoBit ? SourceType.IMPORTED : SourceType.ANALYSIS; } return isLoBit ? SourceType.USER_DEFINED : SourceType.DEFAULT; }
Example 6
Source File: VariableUtilities.java From ghidra with Apache License 2.0 | 5 votes |
/** * Generate a suitable 'this' parameter for the specified function * @param function * @return this parameter or null of calling convention is not a 'thiscall' * or some other error prevents it * @deprecated should rely on auto-param instead - try not to use this method which may be eliminated */ @Deprecated public static ParameterImpl getThisParameter(Function function, PrototypeModel convention) { if (convention != null && convention.getGenericCallingConvention() == GenericCallingConvention.thiscall) { DataType dt = findOrCreateClassStruct(function); if (dt == null) { dt = DataType.VOID; } dt = new PointerDataType(dt); DataType[] arr = new DataType[2]; arr[0] = DataType.VOID; arr[1] = dt; VariableStorage thisStorage = convention.getStorageLocations(function.getProgram(), arr, true)[1]; try { return new ParameterImpl("this", 0, dt, thisStorage, false, function.getProgram(), SourceType.ANALYSIS); } catch (InvalidInputException e) { Msg.error(VariableUtilities.class, "Error while generating 'this' parameter for function at " + function.getEntryPoint() + ": " + e.getMessage()); } } return null; }
Example 7
Source File: AutoParameterImpl.java From ghidra with Apache License 2.0 | 5 votes |
public AutoParameterImpl(DataType dataType, int ordinal, VariableStorage storage, Function function) throws InvalidInputException { super(getAutoName(storage.getAutoParameterType()), ordinal, dataType, storage, false, function.getProgram(), SourceType.ANALYSIS); if (storage.isForcedIndirect() || !storage.isAutoStorage()) { throw new IllegalArgumentException("Improper auto storage specified"); } this.function = function; }