Java Code Examples for ghidra.program.model.symbol.Reference#getReferenceType()

The following examples show how to use ghidra.program.model.symbol.Reference#getReferenceType() . 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: InstructionPcodeOverride.java    From ghidra with Apache License 2.0 6 votes vote down vote up
/**
 * This constructor caches the primary and overriding "from" references of {@code instr}.  
 * This cache is never updated; the assumption is that this object is short-lived 
 * (duration of {@link PcodeEmit})  
 * @param instr the instruction
 */
public InstructionPcodeOverride(Instruction instr) {
	this.instr = instr;

	primaryOverridingReferences = new ArrayList<>();
	for (Reference ref : instr.getReferencesFrom()) {
		if (!ref.isPrimary() || !ref.getToAddress().isMemoryAddress()) {
			continue;
		}
		RefType type = ref.getReferenceType();
		if (type.isOverride()) {
			primaryOverridingReferences.add(ref);
		}
		else if (type.isCall() && primaryCallAddress == null) {
			primaryCallAddress = ref.getToAddress();
		}
	}
}
 
Example 2
Source File: CodeUnitDetails.java    From ghidra with Apache License 2.0 6 votes vote down vote up
private static String getRefInfo(Program pgm, Reference ref) {
	String typeStr = "Type: " + ref.getReferenceType();
	String fromStr = "  From: " + ref.getFromAddress();
	String operandStr =
		((ref.isMnemonicReference()) ? "  Mnemonic" : ("  Operand: " + ref.getOperandIndex()));
	String toStr = "  To: " + DiffUtility.getUserToAddressString(pgm, ref);
	String sourceStr = "  " + ref.getSource().toString();
	String primaryStr = ((ref.isPrimary()) ? "  Primary" : "");
	String symbolStr = "";
	long symbolID = ref.getSymbolID();
	if (symbolID != -1) {
		Symbol sym = pgm.getSymbolTable().getSymbol(symbolID);
		if (sym != null) {
			symbolStr = "  Symbol: " + sym.getName(true);
		}
	}
	return typeStr + fromStr + operandStr + toStr + sourceStr + primaryStr + symbolStr;
}
 
Example 3
Source File: ReferenceTypeTableColumn.java    From ghidra with Apache License 2.0 4 votes vote down vote up
@Override
public RefType getValue(Reference rowObject, Settings settings, Program program,
		ServiceProvider serviceProvider) throws IllegalArgumentException {
	return rowObject.getReferenceType();
}
 
Example 4
Source File: IncomingReferenceEndpoint.java    From ghidra with Apache License 2.0 4 votes vote down vote up
public IncomingReferenceEndpoint(Reference r, boolean isOffcut) {
	super(r, r.getFromAddress(), r.getReferenceType(), isOffcut, r.getSource());
}
 
Example 5
Source File: OutgoingReferenceEndpoint.java    From ghidra with Apache License 2.0 4 votes vote down vote up
public OutgoingReferenceEndpoint(Reference r, boolean isOffcut) {
	super(r, r.getToAddress(), r.getReferenceType(), isOffcut, r.getSource());
}
 
Example 6
Source File: DataReferenceProgramCorrelator.java    From ghidra with Apache License 2.0 4 votes vote down vote up
@Override
protected boolean isExpectedRefType(Reference myRef) {
	RefType refType = myRef.getReferenceType();
	return ((refType.isData() && myRef.isMemoryReference()));
}
 
Example 7
Source File: CombinedFunctionAndDataReferenceProgramCorrelator.java    From ghidra with Apache License 2.0 4 votes vote down vote up
@Override
protected boolean isExpectedRefType(Reference myRef) {
	RefType refType = myRef.getReferenceType();
	return ((refType.isData() && myRef.isMemoryReference()) || refType.isCall());
}
 
Example 8
Source File: OutgoingReferenceEndpoint.java    From ghidra with Apache License 2.0 2 votes vote down vote up
/**
 * A special constructor that allows clients to override the 'toAddress' of the reference.
 * 
 * @param r the reference 
 * @param toAddress the desired 'toAddress'
 * @param isOffcut false if the given reference points to the min address of a code unit
 */
public OutgoingReferenceEndpoint(Reference r, Address toAddress, boolean isOffcut) {
	super(r, toAddress, r.getReferenceType(), isOffcut, r.getSource());
}