Java Code Examples for ghidra.program.model.listing.Data#getPrimitiveAt()

The following examples show how to use ghidra.program.model.listing.Data#getPrimitiveAt() . 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: DataDB.java    From ghidra with Apache License 2.0 6 votes vote down vote up
/**
 * @see ghidra.program.model.listing.Data#getPrimitiveAt(int)
 */
@Override
public Data getPrimitiveAt(int offset) {
	lock.acquire();
	try {
		checkIsValid();
		if (offset < 0 || offset >= length) {
			return null;
		}
		Data dc = getComponentAt(offset);
		if (dc == null || dc == this) {
			return this;
		}
		return dc.getPrimitiveAt(offset - dc.getParentOffset());
	}
	finally {
		lock.release();
	}
}
 
Example 2
Source File: PseudoData.java    From ghidra with Apache License 2.0 5 votes vote down vote up
@Override
public Data getPrimitiveAt(int offset) {
	if (offset < 0 || offset >= length) {
		return null;
	}
	Data dc = getComponentAt(offset);
	if (dc == null || dc == this) {
		return this;
	}
	return dc.getPrimitiveAt(offset - dc.getParentOffset());
}
 
Example 3
Source File: CodeSymbol.java    From ghidra with Apache License 2.0 5 votes vote down vote up
/**
 * @see ghidra.program.model.symbol.Symbol#getObject()
 */
@Override
public Object getObject() {
	lock.acquire();
	try {
		if (!checkIsValid()) {
			return null;
		}
		if (isExternal()) {
			return symbolMgr.getExternalManager().getExternalLocation(this);
		}
		CodeUnit cu = symbolMgr.getCodeManager().getCodeUnitContaining(address);
		if (cu != null) {
			if (address.equals(cu.getMinAddress())) {
				return cu;
			}
			if (cu instanceof Data) {
				Data data = (Data) cu;
				data = data.getPrimitiveAt((int) address.subtract(data.getMinAddress()));
				return data != null ? data : cu;
			}
		}
	}
	finally {
		lock.release();
	}
	return null;
}