Java Code Examples for ghidra.program.model.symbol.RefType#COMPUTED_CALL

The following examples show how to use ghidra.program.model.symbol.RefType#COMPUTED_CALL . 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: ConstructorInfo.java    From ghidra with Apache License 2.0 5 votes vote down vote up
FlowType getFlowType() {
	switch (flowFlags) {					// Convert flags to a standard flowtype
		case 0:
		case BRANCH_TO_END:
			return RefType.FALL_THROUGH;
		case CALL:
			return RefType.UNCONDITIONAL_CALL;
		case CALL | BRANCH_TO_END:
			return RefType.CONDITIONAL_CALL;			// This could be wrong but doesn't matter much
		case CALL_INDIRECT:
			return RefType.COMPUTED_CALL;
		case CALL_INDIRECT | BRANCH_TO_END:			// This could be COMPUTED_CONDITIONAL?
			return RefType.COMPUTED_CALL;
		case BRANCH_INDIRECT | NO_FALLTHRU:
			return RefType.COMPUTED_JUMP;
		case BRANCH_INDIRECT | NO_FALLTHRU | BRANCH_TO_END:
			// This should be COMPUTED_CONDITONAL_JUMP but this doesn't exist
			// so we make it a fall thru so the disassembler can continue the flow
			return RefType.FALL_THROUGH;
		case RETURN | NO_FALLTHRU:
			return RefType.TERMINATOR;
		case RETURN | NO_FALLTHRU | BRANCH_TO_END:
			return RefType.CONDITIONAL_TERMINATOR;
		case JUMPOUT:
			return RefType.CONDITIONAL_JUMP;
		case JUMPOUT | NO_FALLTHRU:
			return RefType.UNCONDITIONAL_JUMP;
		case JUMPOUT | NO_FALLTHRU | BRANCH_TO_END:
			return RefType.CONDITIONAL_JUMP;
		case NO_FALLTHRU:
			return RefType.TERMINATOR;
		case BRANCH_TO_END | JUMPOUT:
			return RefType.CONDITIONAL_JUMP;
		case NO_FALLTHRU | BRANCH_TO_END:
			return RefType.FALL_THROUGH;
		default:
			break;
	}
	return RefType.INVALID;
}
 
Example 2
Source File: AbstractFollowFlowTest.java    From ghidra with Apache License 2.0 5 votes vote down vote up
FlowType[] followOnlyConditionalCalls() {
	FlowType[] flowsNotToFollow =
		new FlowType[] { RefType.COMPUTED_CALL, RefType.UNCONDITIONAL_CALL,
			RefType.COMPUTED_JUMP, RefType.CONDITIONAL_JUMP, RefType.UNCONDITIONAL_JUMP,
			RefType.INDIRECTION };
	return flowsNotToFollow;
}
 
Example 3
Source File: AbstractFollowFlowTest.java    From ghidra with Apache License 2.0 5 votes vote down vote up
FlowType[] followOnlyUnconditionalCalls() {
	FlowType[] flowsNotToFollow =
		new FlowType[] { RefType.COMPUTED_CALL, RefType.CONDITIONAL_CALL,
			RefType.COMPUTED_JUMP, RefType.CONDITIONAL_JUMP, RefType.UNCONDITIONAL_JUMP,
			RefType.INDIRECTION };
	return flowsNotToFollow;
}
 
Example 4
Source File: AbstractFollowFlowTest.java    From ghidra with Apache License 2.0 5 votes vote down vote up
FlowType[] followOnlyComputedJumps() {
	FlowType[] flowsNotToFollow =
		new FlowType[] { RefType.COMPUTED_CALL, RefType.CONDITIONAL_CALL,
			RefType.UNCONDITIONAL_CALL, RefType.CONDITIONAL_JUMP, RefType.UNCONDITIONAL_JUMP,
			RefType.INDIRECTION };
	return flowsNotToFollow;
}
 
Example 5
Source File: AbstractFollowFlowTest.java    From ghidra with Apache License 2.0 5 votes vote down vote up
FlowType[] followOnlyConditionalJumps() {
	FlowType[] flowsNotToFollow =
		new FlowType[] { RefType.COMPUTED_CALL, RefType.CONDITIONAL_CALL,
			RefType.UNCONDITIONAL_CALL, RefType.COMPUTED_JUMP, RefType.UNCONDITIONAL_JUMP,
			RefType.INDIRECTION };
	return flowsNotToFollow;
}
 
Example 6
Source File: AbstractFollowFlowTest.java    From ghidra with Apache License 2.0 5 votes vote down vote up
FlowType[] followOnlyUnconditionalJumps() {
	FlowType[] flowsNotToFollow =
		new FlowType[] { RefType.COMPUTED_CALL, RefType.CONDITIONAL_CALL,
			RefType.UNCONDITIONAL_CALL, RefType.COMPUTED_JUMP, RefType.CONDITIONAL_JUMP,
			RefType.INDIRECTION };
	return flowsNotToFollow;
}
 
Example 7
Source File: AbstractFollowFlowTest.java    From ghidra with Apache License 2.0 5 votes vote down vote up
FlowType[] followOnlyPointers() {
	FlowType[] flowsNotToFollow =
		new FlowType[] { RefType.COMPUTED_CALL, RefType.CONDITIONAL_CALL,
			RefType.UNCONDITIONAL_CALL, RefType.COMPUTED_JUMP, RefType.CONDITIONAL_JUMP,
			RefType.UNCONDITIONAL_JUMP };
	return flowsNotToFollow;
}
 
Example 8
Source File: AbstractFollowFlowTest.java    From ghidra with Apache License 2.0 5 votes vote down vote up
FlowType[] followNoFlows() {
	FlowType[] flowsNotToFollow =
		new FlowType[] { RefType.COMPUTED_CALL, RefType.CONDITIONAL_CALL,
			RefType.UNCONDITIONAL_CALL, RefType.COMPUTED_JUMP, RefType.CONDITIONAL_JUMP,
			RefType.UNCONDITIONAL_JUMP, RefType.INDIRECTION };
	return flowsNotToFollow;
}
 
Example 9
Source File: SleighInstructionPrototype.java    From ghidra with Apache License 2.0 4 votes vote down vote up
private static FlowType convertFlowFlags(int flowFlags) {

		if ((flowFlags & LABEL) != 0)
			flowFlags |= BRANCH_TO_END;
		flowFlags &= ~(CROSSBUILD | LABEL);
		// NOTE: If prototype has cross-build, flow must be determined dynamically
		switch (flowFlags) { // Convert flags to a standard flowtype
			case 0:
			case BRANCH_TO_END:
				return RefType.FALL_THROUGH;
			case CALL:
				return RefType.UNCONDITIONAL_CALL;
			case CALL | NO_FALLTHRU | RETURN:
				return RefType.CALL_TERMINATOR;
			case CALL_INDIRECT | NO_FALLTHRU | RETURN:
				return RefType.COMPUTED_CALL_TERMINATOR;
			case CALL | BRANCH_TO_END:
				return RefType.CONDITIONAL_CALL; // This could be wrong but doesn't matter much
			case CALL | NO_FALLTHRU | JUMPOUT:
				return RefType.COMPUTED_JUMP;
			case CALL | NO_FALLTHRU | BRANCH_TO_END | RETURN:
				return RefType.UNCONDITIONAL_CALL;
			case CALL_INDIRECT:
				return RefType.COMPUTED_CALL;
			case BRANCH_INDIRECT | NO_FALLTHRU:
				return RefType.COMPUTED_JUMP;
			case BRANCH_INDIRECT | BRANCH_TO_END:
			case BRANCH_INDIRECT | NO_FALLTHRU | BRANCH_TO_END:
			case BRANCH_INDIRECT | JUMPOUT | NO_FALLTHRU | BRANCH_TO_END:
				return RefType.CONDITIONAL_COMPUTED_JUMP;
			case CALL_INDIRECT | BRANCH_TO_END:
			case CALL_INDIRECT | NO_FALLTHRU | BRANCH_TO_END:
				return RefType.CONDITIONAL_COMPUTED_CALL;
			case RETURN | NO_FALLTHRU:
				return RefType.TERMINATOR;
			case RETURN | BRANCH_TO_END:
			case RETURN | NO_FALLTHRU | BRANCH_TO_END:
				return RefType.CONDITIONAL_TERMINATOR;
			case JUMPOUT:
				return RefType.CONDITIONAL_JUMP;
			case JUMPOUT | NO_FALLTHRU:
				return RefType.UNCONDITIONAL_JUMP;
			case JUMPOUT | NO_FALLTHRU | BRANCH_TO_END:
				return RefType.CONDITIONAL_JUMP;
			case JUMPOUT | NO_FALLTHRU | RETURN:
				return RefType.JUMP_TERMINATOR;
			case JUMPOUT | NO_FALLTHRU | BRANCH_INDIRECT:
				return RefType.COMPUTED_JUMP; //added for tableswitch in jvm
			case BRANCH_INDIRECT | NO_FALLTHRU | RETURN:
				return RefType.JUMP_TERMINATOR;
			case NO_FALLTHRU:
				return RefType.TERMINATOR;
			case BRANCH_TO_END | JUMPOUT:
				return RefType.CONDITIONAL_JUMP;
			case NO_FALLTHRU | BRANCH_TO_END:
				return RefType.FALL_THROUGH;
			default:
				break;
		}
		return RefType.INVALID;
	}
 
Example 10
Source File: AbstractFollowFlowTest.java    From ghidra with Apache License 2.0 4 votes vote down vote up
FlowType[] followConditionalAndUnconditionalJumps() {
	FlowType[] flowsNotToFollow =
		new FlowType[] { RefType.COMPUTED_CALL, RefType.CONDITIONAL_CALL,
			RefType.UNCONDITIONAL_CALL, RefType.COMPUTED_JUMP, RefType.INDIRECTION };
	return flowsNotToFollow;
}
 
Example 11
Source File: AbstractFollowFlowTest.java    From ghidra with Apache License 2.0 4 votes vote down vote up
FlowType[] followAllJumps() {
	FlowType[] flowsNotToFollow =
		new FlowType[] { RefType.COMPUTED_CALL, RefType.CONDITIONAL_CALL,
			RefType.UNCONDITIONAL_CALL, RefType.INDIRECTION };
	return flowsNotToFollow;
}