ghidra.util.exception.InvalidInputException Java Examples

The following examples show how to use ghidra.util.exception.InvalidInputException. 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: ExternalManagerDBTest.java    From ghidra with Apache License 2.0 6 votes vote down vote up
@Test
public void testGetExternalLocationsByLibraryName()
		throws InvalidInputException, DuplicateNameException {

	extMgr.addExtLocation("ext1", "label0", null, SourceType.USER_DEFINED);
	extMgr.addExtLocation("ext1", "label1", addr(1000), SourceType.USER_DEFINED);
	ExternalLocation loc3 =
		extMgr.addExtLocation("ext2", "label1", null, SourceType.USER_DEFINED);
	ExternalLocation loc4 =
		extMgr.addExtLocation("ext2", "label2", null, SourceType.USER_DEFINED);

	ExternalLocation loc5 =
		extMgr.addExtLocation("ext2", null, addr(2000), SourceType.USER_DEFINED);

	ExternalLocationIterator iter = extMgr.getExternalLocations("ext2");
	assertTrue(iter.hasNext());
	assertEquals(loc3, iter.next());
	assertTrue(iter.hasNext());
	assertEquals(loc4, iter.next());
	assertTrue(iter.hasNext());
	assertEquals(loc5, iter.next());
	assertTrue(!iter.hasNext());
	assertNull(iter.next());

}
 
Example #2
Source File: SplitBlockDialog.java    From ghidra with Apache License 2.0 6 votes vote down vote up
private int getLength() throws InvalidInputException {

			Long val = source.getValue();
			if (val == null) {
				throw new InvalidInputException();
			}
			int length = val.intValue();

			long blockSize = block.getSize();
			if (length <= 0 || length >= blockSize) {
				if (length != 0) {
					setStatusText("Length must be less than original block size (0x" +
						Long.toHexString(blockSize) + ")");
				}
				throw new InvalidInputException();
			}
			return length;
		}
 
Example #3
Source File: AddLabelCmd.java    From ghidra with Apache License 2.0 6 votes vote down vote up
/**
 *
 * @see ghidra.framework.cmd.Command#applyTo(ghidra.framework.model.DomainObject)
 */
@Override
public boolean applyTo(DomainObject obj) {
	SymbolTable st = ((Program) obj).getSymbolTable();
	if (namespace == null && useLocalNamespace) {
		namespace = st.getNamespace(addr);
	}
	try {
		symbol = st.createLabel(addr, name, namespace, source);
		return true;
	}
	catch (InvalidInputException e) {
		if ((name == null) || (name.length() == 0)) {
			errorMsg = "You must enter a valid label name";
		}
		else {
			errorMsg = "Invalid name: " + e.getMessage();
		}
	}

	return false;

}
 
Example #4
Source File: StackFrameDataType.java    From ghidra with Apache License 2.0 6 votes vote down vote up
public Variable[] getStackVariables() {
	Variable[] vars = new Variable[components.size()];
	Iterator<DataTypeComponentImpl> iter = components.iterator();
	for (int i = 0; iter.hasNext(); i++) {
		DataTypeComponent dtc = iter.next();
		String fieldName = dtc.getFieldName();
		int offset = dtc.getOffset();
		try {
			vars[i] =
				new LocalVariableImpl(fieldName, dtc.getDataType(), offset,
					function.getProgram());
		}
		catch (InvalidInputException e) {
			try {
				vars[i] = new LocalVariableImpl(fieldName, null, offset, function.getProgram());
			}
			catch (InvalidInputException e1) {
				throw new AssertException(); // Unexpected
			}
		}
		vars[i].setComment(dtc.getComment());
	}
	return vars;
}
 
Example #5
Source File: VariableUtilities.java    From ghidra with Apache License 2.0 6 votes vote down vote up
private static Varnode shrinkVarnode(Varnode varnode, int sizeReduction,
		VariableStorage curStorage, int newSize, DataType dataType, boolean alignStack,
		Function function) throws InvalidInputException {
	Address addr = varnode.getAddress();
	if (addr.isStackAddress()) {
		return resizeStackVarnode(varnode, varnode.getSize() - sizeReduction, curStorage,
			newSize, dataType, alignStack, function);
	}
	boolean isRegister = function.getProgram().getRegister(varnode) != null;
	boolean bigEndian = function.getProgram().getMemory().isBigEndian();
	boolean complexDt = (dataType instanceof Composite) || (dataType instanceof Array);
	if (bigEndian && (isRegister || !complexDt)) {
		return new Varnode(varnode.getAddress().add(sizeReduction),
			varnode.getSize() - sizeReduction);
	}
	return new Varnode(varnode.getAddress(), varnode.getSize() - sizeReduction);
}
 
Example #6
Source File: ExternalManagerDBTest.java    From ghidra with Apache License 2.0 6 votes vote down vote up
@Test
public void testRemoveExternalLocation() throws InvalidInputException, DuplicateNameException {

	extMgr.addExtLocation("ext1", "label0", null, SourceType.USER_DEFINED);
	extMgr.addExtLocation("ext1", "label1", addr(1000), SourceType.USER_DEFINED);
	ExternalLocation loc3 =
		extMgr.addExtLocation("ext2", "label1", null, SourceType.USER_DEFINED);
	ExternalLocation loc4 =
		extMgr.addExtLocation("ext2", "label2", null, SourceType.USER_DEFINED);

	ExternalLocation loc5 =
		extMgr.addExtLocation("ext2", null, addr(2000), SourceType.USER_DEFINED);

	extMgr.removeExternalLocation(loc4.getExternalSpaceAddress());

	ExternalLocationIterator iter = extMgr.getExternalLocations("ext2");
	assertTrue(iter.hasNext());
	assertEquals(loc3, iter.next());
	assertTrue(iter.hasNext());
	assertEquals(loc5, iter.next());
	assertTrue(!iter.hasNext());
	assertNull(iter.next());

}
 
Example #7
Source File: ApplyFunctionSignatureCmd.java    From ghidra with Apache License 2.0 6 votes vote down vote up
private List<Parameter> createParameters(CompilerSpec compilerSpec, String conventionName,
		ParameterDefinition[] args) throws InvalidInputException {

	int firstParamIndex = getIndexOfFirstParameter(conventionName, args);

	List<Parameter> params = new ArrayList<>();
	boolean settleCTypes = compilerSpec.doesCDataTypeConversions();
	DataTypeManager dtm = program.getDataTypeManager();
	for (int i = firstParamIndex; i < args.length; i++) {
		String name = args[i].getName();
		if (Function.RETURN_PTR_PARAM_NAME.equals(name)) {
			continue; // discard what should be an auto-param
		}

		DataType type = args[i].getDataType().clone(dtm);
		if (settleCTypes) {
			type = settleCDataType(type, dtm);
		}
		Parameter param =
			new ParameterImpl(name, type, VariableStorage.UNASSIGNED_STORAGE, program);
		param.setComment(args[i].getComment());
		params.add(param);
	}
	return params;
}
 
Example #8
Source File: ObjectiveC2_Utilities.java    From ghidra with Apache License 2.0 6 votes vote down vote up
/**
 * Creates a symbol with the given name at the specified address.
 * The symbol will be created in a name space with the name of
 * the memory block that contains the address.
 */
public static Symbol createSymbolUsingMemoryBlockAsNamespace(Program program, Address address,
		String name, SourceType sourceType)
		throws DuplicateNameException, InvalidInputException {

	SymbolTable symbolTable = program.getSymbolTable();
	Memory memory = program.getMemory();

	MemoryBlock block = memory.getBlock(address);
	String namespaceName = block.getName();

	Namespace namespace = symbolTable.getNamespace(namespaceName, program.getGlobalNamespace());
	if (namespace == null) {
		namespace = symbolTable.createNameSpace(program.getGlobalNamespace(), namespaceName,
			sourceType);
	}

	return symbolTable.createLabel(address, name, namespace, SourceType.ANALYSIS);
}
 
Example #9
Source File: HighFunction.java    From ghidra with Apache License 2.0 6 votes vote down vote up
public static void deleteSymbol(SymbolTable symtab, Address addr, String name, Namespace space)
		throws InvalidInputException {
	Symbol s = symtab.getSymbol(name, addr, space);
	if (s == null) {
		throw new InvalidInputException("Symbol " + name + " not found!");
	}
	if (s.getSource() == SourceType.DEFAULT) {
		throw new InvalidInputException(
			"Deleting the default symbol \"" + name + "\" @ " + addr + " is not allowed.");
	}

	boolean success = symtab.removeSymbolSpecial(s);
	if (!success) {
		throw new InvalidInputException(
			"Couldn't delete the symbol \"" + name + "\" @ " + addr + ".");
	}
}
 
Example #10
Source File: FunctionUtility.java    From ghidra with Apache License 2.0 6 votes vote down vote up
private static List<Parameter> determineParameters(Function destinationFunction,
		Function sourceFunction, boolean useCustomStorage) throws InvalidInputException {
	Program destinationProgram = destinationFunction.getProgram();
	List<Parameter> parameters = new ArrayList<>();
	Parameter[] sourceParameters = sourceFunction.getParameters();
	for (Parameter sourceParameter : sourceParameters) {
		String name = sourceParameter.getName();
		DataType dataType = sourceParameter.getDataType();
		VariableStorage storage =
			(useCustomStorage) ? sourceParameter.getVariableStorage().clone(destinationProgram)
					: VariableStorage.UNASSIGNED_STORAGE;
		SourceType source = sourceParameter.getSource();
		Parameter parameter =
			new ParameterImpl(name, dataType, storage, destinationProgram, source);
		String comment = sourceParameter.getComment();
		if (comment != null) {
			parameter.setComment(comment);
		}
		parameters.add(parameter);
	}
	return parameters;
}
 
Example #11
Source File: CliAbstractSig.java    From ghidra with Apache License 2.0 6 votes vote down vote up
private String getRepresentation(CliStreamMetadata stream, boolean shortRep) {
	try {
		if (stream != null) {
			CliAbstractTable table =
				stream.getTable(CliIndexTypeDefOrRef.getTableName(encodedType));
			if (table == null)
				return "[ErrorRetrievingTable]";
			CliAbstractTableRow row = table.getRow(CliIndexTypeDefOrRef.getRowIndex(encodedType));
			if (row == null)
				return "[ErrorRetrievingRow]";
			if (shortRep)
				return row.getShortRepresentation();
			return row.getRepresentation();
		}
		return "[ErrorRepresentingClassReference]";
	}
	catch (InvalidInputException e) {
		e.printStackTrace();
	}
	return "[ErrorRepresentingClassReference]";
}
 
Example #12
Source File: SetReturnDataTypeCmd.java    From ghidra with Apache License 2.0 6 votes vote down vote up
/**
 * 
 * @see ghidra.framework.cmd.Command#applyTo(ghidra.framework.model.DomainObject)
 */
@Override
public boolean applyTo(DomainObject obj) {
	Program program = (Program) obj;
	Function function = program.getListing().getFunctionAt(entry);
	try {
		function.setReturnType(dataType, source);
		if (source == SourceType.DEFAULT) {
			function.setSignatureSource(SourceType.DEFAULT);
		}
	}
	catch (InvalidInputException e) {
		status = e.getMessage();
		return false;
	}
	return true;
}
 
Example #13
Source File: HighCodeSymbol.java    From ghidra with Apache License 2.0 6 votes vote down vote up
/**
 * Construct with just a (global) storage address and size. There will be no backing CodeSymbol.
 * An attempt is made to find a backing Data object.
 * @param id is the id to associate with the new HighSymbol
 * @param addr is the starting Address of the symbol storage
 * @param dataType is the data-type associated with the new symbol
 * @param sz is the size of the symbol storage in bytes
 * @param func is the decompiler function model owning the new symbol
 */
public HighCodeSymbol(long id, Address addr, DataType dataType, int sz, HighFunction func) {
	super(id, SymbolUtilities.getDynamicName(func.getFunction().getProgram(), addr), dataType,
		func);
	symbol = null;
	setNameLock(true);
	setTypeLock(true);
	Program program = func.getFunction().getProgram();
	Data data = program.getListing().getDataAt(addr);
	VariableStorage store;
	try {
		store = new VariableStorage(program, addr, sz);
	}
	catch (InvalidInputException e) {
		store = VariableStorage.UNASSIGNED_STORAGE;
	}
	SymbolEntry entry;
	if (data != null) {
		entry = new MappedDataEntry(this, store, data);
	}
	else {
		entry = new MappedEntry(this, store, null);
	}
	addMapEntry(entry);
}
 
Example #14
Source File: ParamInfo.java    From ghidra with Apache License 2.0 6 votes vote down vote up
Parameter getParameter(boolean isCustom) {
	if (original != null) {
		return original;
	}

	VariableStorage variableStorage = isCustom ? storage : VariableStorage.UNASSIGNED_STORAGE;
	try {
		if (ordinal == Parameter.RETURN_ORIDINAL) {
			return new ReturnParameterImpl(formalDataType, variableStorage, true,
				model.getProgram());
		}
		// preserve original source type if name unchanged
		SourceType source = SourceType.USER_DEFINED;
		if (original != null && original.getName().equals(name)) {
			source = original.getSource();
		}
		return new MyParameter(name, formalDataType, variableStorage, model.getProgram(),
			source);
	}
	catch (InvalidInputException e) {
		throw new AssertException("Unexpected exception", e);
	}
}
 
Example #15
Source File: StorageEditorModelTest.java    From ghidra with Apache License 2.0 6 votes vote down vote up
protected void createStorageModel(int requiredStorage, int currentStorage,
		boolean unconstrained) throws InvalidInputException {
	Address address = stackSpace.getAddress(4);
	VariableStorage storage = new VariableStorage(program, address, currentStorage);

	model = new StorageAddressModel(program, storage,
		new ModelChangeListener() {

			@Override
			public void dataChanged() {
				dataChangeCalled = true;
			}

			@Override
			public void tableRowsChanged() {
				// nothing here
			}

		});
	model.setRequiredSize(requiredStorage, unconstrained);

}
 
Example #16
Source File: VTMatchApplyFunctionSignatureTest.java    From ghidra with Apache License 2.0 5 votes vote down vote up
private void setParameterName(Function function, int ordinal, String name, SourceType source)
		throws DuplicateNameException, InvalidInputException {
	Program program = function.getProgram();
	int transaction = -1;
	try {
		transaction = program.startTransaction("Test - Set Parameter Name: " + ordinal);
		Parameter parameter = function.getParameter(ordinal);
		parameter.setName(name, source);
	}
	finally {
		program.endTransaction(transaction, true);
	}
}
 
Example #17
Source File: HighParamID.java    From ghidra with Apache License 2.0 5 votes vote down vote up
/**
 * Update any parameters for this Function from parameters defined in this map.
 * 
 * @param srctype function signature source 
 */
public void storeReturnToDatabase(boolean storeDataTypes, SourceType srctype) {
	PcodeDataTypeManager dtManage = getDataTypeManager();
	try {
		//TODO: Currently, only storing one output, so looking for the best to report.  When possible, change this to report all
		int best_index = 0;
		if (getNumOutputs() > 1)
			for (int i = 1; i < getNumOutputs(); i++)
				if (getOutput(i).getRank() < getOutput(best_index).getRank()) {//TODO: create mirror of ranks on high side (instead of using numbers?)
					best_index = i;
				}
		if (getNumOutputs() != 0) {
			ParamMeasure pm = getOutput(best_index);
			pm.getRank(); //TODO (maybe): this value is not used or stored on the java side at this point
			Varnode vn = pm.getVarnode();
			DataType dataType;
			if (storeDataTypes)
				dataType = pm.getDataType();
			else
				dataType = dtManage.findUndefined(vn.getSize());
			//Msg.debug(this, "func: " + func.getName() + " -- type: " + dataType.getName());
			if (!(dataType == null || dataType instanceof VoidDataType))
				func.setReturn(dataType, buildStorage(vn), SourceType.ANALYSIS);
		}
	}
	catch (InvalidInputException e) {
		Msg.error(this, e.getMessage());
	}
}
 
Example #18
Source File: CreateNamespacesCmdTest.java    From ghidra with Apache License 2.0 5 votes vote down vote up
private GhidraClass createClass(SymbolTable symbolTable)
		throws DuplicateNameException, InvalidInputException {

	int txId = program.startTransaction("Transaction");
	try {
		GhidraClass c = symbolTable.createClass(program.getGlobalNamespace(), "class1",
			SourceType.USER_DEFINED);
		assertNotNull(c);
		return c;
	}
	finally {
		program.endTransaction(txId, true);
	}

}
 
Example #19
Source File: VTMatchApplyFunctionSignatureTest.java    From ghidra with Apache License 2.0 5 votes vote down vote up
private void setCallingConvention(Function function, String callingConventionName)
		throws InvalidInputException {
	Program program = function.getProgram();
	int transaction = -1;
	try {
		transaction = program.startTransaction(
			"Test - Setting Calling Convention: " + callingConventionName);
		function.setCallingConvention(callingConventionName);
	}
	finally {
		program.endTransaction(transaction, true);
	}
}
 
Example #20
Source File: AbstractEquatePluginTest.java    From ghidra with Apache License 2.0 5 votes vote down vote up
protected void createSameValueDifferentNameEquates()
		throws DuplicateNameException, InvalidInputException {
	EquateTable eqTable = program.getEquateTable();

	int transactionID =
		program.startTransaction("Test - Create Equate - Same Value/Different Name");
	for (int i = 0; i < 5; i++) {
		eqTable.createEquate("MY_EQUATE_" + i, 5);
	}
	program.endTransaction(transactionID, true);

	flushProgramEvents();
}
 
Example #21
Source File: PcodeSyntaxTree.java    From ghidra with Apache License 2.0 5 votes vote down vote up
@Override
public VariableStorage buildStorage(Varnode vn) throws InvalidInputException {
	Address addr = vn.getAddress();
	if (addr.getAddressSpace().getType() == AddressSpace.TYPE_VARIABLE) {
		return findJoinStorage(addr.getOffset());
	}
	return new VariableStorage(datatypeManager.getProgram(),vn);
}
 
Example #22
Source File: ObjectiveC2_Utilities.java    From ghidra with Apache License 2.0 5 votes vote down vote up
/**
 * Returns the class inside the given parent name space.
 * If it does not exist, then create it and return it.
 */
static Namespace getClassNamespace(Program program, Namespace parentNamespace,
		String namespaceName) throws DuplicateNameException, InvalidInputException {
	SymbolTable symbolTable = program.getSymbolTable();
	Symbol symbol = symbolTable.getClassSymbol(namespaceName, parentNamespace);
	if (symbol instanceof ClassSymbol) {
		if (symbol.getName().equals(namespaceName)) {
			return (GhidraClass) symbol.getObject();
		}
	}
	return symbolTable.createClass(parentNamespace, namespaceName, SourceType.IMPORTED);
}
 
Example #23
Source File: FunctionDBTest.java    From ghidra with Apache License 2.0 5 votes vote down vote up
private Function createFunction(String name, Address entryPt, AddressSetView body)
		throws DuplicateNameException, InvalidInputException, OverlappingFunctionException {

	functionManager.createFunction(name, entryPt, body, SourceType.USER_DEFINED);
	Function f = functionManager.getFunctionAt(entryPt);
	assertEquals(entryPt, f.getEntryPoint());
	assertEquals(body, f.getBody());
	return f;
}
 
Example #24
Source File: HighFunction.java    From ghidra with Apache License 2.0 5 votes vote down vote up
public static void createLabelSymbol(SymbolTable symtab, Address addr, String name,
		Namespace namespace, SourceType source, boolean useLocalNamespace)
				throws InvalidInputException {
	if (namespace == null && useLocalNamespace) {
		namespace = symtab.getNamespace(addr);
	}
	symtab.createLabel(addr, name, namespace, source);
}
 
Example #25
Source File: HighFunctionShellSymbol.java    From ghidra with Apache License 2.0 5 votes vote down vote up
/**
 * Construct the function shell given a name and address
 * @param id is an id to associate with the new symbol
 * @param nm is the given name
 * @param addr is the given address
 * @param manage is PcodeDataTypeManager to facilitate XML marshaling
 */
public HighFunctionShellSymbol(long id, String nm, Address addr, PcodeDataTypeManager manage) {
	super(id, nm, DataType.DEFAULT, true, true, manage);
	VariableStorage store;
	try {
		store = new VariableStorage(getProgram(), addr, 1);
	}
	catch (InvalidInputException e) {
		store = VariableStorage.UNASSIGNED_STORAGE;
	}
	MappedEntry entry = new MappedEntry(this, store, null);
	addMapEntry(entry);
}
 
Example #26
Source File: AbstractExternalMergerTest.java    From ghidra with Apache License 2.0 5 votes vote down vote up
ExternalLocation createExternalLabel(final Program program, final String[] path,
		final Address memoryAddress, final SourceType sourceType)
		throws DuplicateNameException, InvalidInputException {

	SymbolTable symbolTable = program.getSymbolTable();
	ExternalManager externalManager = program.getExternalManager();
	int nameIndex = path.length - 1;

	Library externalLibrary;
	Symbol librarySymbol = getUniqueSymbol(program, path[0], program.getGlobalNamespace());
	if (librarySymbol != null) {
		externalLibrary = (Library) librarySymbol.getObject();
	}
	else {
		externalLibrary = symbolTable.createExternalLibrary(path[0], sourceType);
	}

	Namespace currentNamespace = externalLibrary;
	for (int i = 1; i < nameIndex; i++) {
		Symbol nextNamespaceSymbol = getUniqueSymbol(program, path[i], currentNamespace);
		if (nextNamespaceSymbol != null) {
			currentNamespace = (Namespace) nextNamespaceSymbol.getObject();
		}
		else {
			currentNamespace =
				symbolTable.createNameSpace(currentNamespace, path[i], sourceType);
		}
	}

	ExternalLocation externalLocation = externalManager.addExtLocation(currentNamespace,
		path[nameIndex], memoryAddress, sourceType);

	return externalLocation;
}
 
Example #27
Source File: PackSizeDataTypeAction.java    From ghidra with Apache License 2.0 5 votes vote down vote up
@Override
public void actionPerformed(ActionContext context) {
	GTree gTree = (GTree) context.getContextObject();
	TreePath[] selectionPaths = gTree.getSelectionPaths();
	TreePath treePath = selectionPaths[0];
	final DataTypeNode dataTypeNode = (DataTypeNode) treePath.getLastPathComponent();
	DataType dataType = dataTypeNode.getDataType();
	DataTypeManager dataTypeManager = dataType.getDataTypeManager();
	if (dataTypeManager == null) {
		Msg.error(this,
			"Can't pack data type " + dataType.getName() + " without a data type manager.");
		return;
	}

	NumberInputDialog numberInputDialog = new NumberInputDialog("pack alignment", 0, 0, 16);
	if (!numberInputDialog.show()) {
		return;
	}
	int packSize = numberInputDialog.getValue();

	int transactionID = -1;
	boolean commit = false;
	try {
		// start a transaction
		transactionID =
			dataTypeManager.startTransaction("pack(" + packSize + ") of " + dataType.getName());
		packDataType(dataType, packSize);
		commit = true;
	}
	catch (InvalidInputException iie) {
		// TODO Auto-generated catch block
		iie.printStackTrace();
	}
	finally {
		// commit the changes
		dataTypeManager.endTransaction(transactionID, commit);
	}
}
 
Example #28
Source File: MappedEntry.java    From ghidra with Apache License 2.0 5 votes vote down vote up
@Override
public void restoreXML(XmlPullParser parser) throws PcodeXMLException {
	HighFunction function = symbol.function;
	Program program = function.getFunction().getProgram();
	AddressFactory addrFactory = function.getAddressFactory();

	XmlElement addrel = parser.start("addr");
	int sz = symbol.type.getLength();
	if (sz == 0) {
		throw new PcodeXMLException(
			"Invalid symbol 0-sized data-type: " + symbol.type.getName());
	}
	try {
		Address varAddr = Varnode.readXMLAddress(addrel, addrFactory);
		AddressSpace spc = varAddr.getAddressSpace();
		if ((spc == null) || (spc.getType() != AddressSpace.TYPE_VARIABLE)) {
			storage = new VariableStorage(program, varAddr, sz);
		}
		else {
			storage = function.readXMLVarnodePieces(addrel, varAddr);
		}
	}
	catch (InvalidInputException e) {
		throw new PcodeXMLException("Invalid storage: " + e.getMessage());
	}
	parser.end(addrel);

	parseRangeList(parser);
}
 
Example #29
Source File: PackSizeDataTypeAction.java    From ghidra with Apache License 2.0 5 votes vote down vote up
private void packDataType(DataType dataType, int packSize) throws InvalidInputException {
	if (!(dataType instanceof Structure)) {
		Msg.error(this,
			"Can't pack data type " + dataType.getName() + ". It's not a structure.");
		return;
	}
	((Structure) dataType).pack(packSize);
}
 
Example #30
Source File: CliTableConstant.java    From ghidra with Apache License 2.0 5 votes vote down vote up
@Override
public String getRepresentation() {
	String parentRep;
	try {
		parentRep =
			getRowRepresentationSafe(CliIndexHasConstant.getTableName(parentIndex),
				CliIndexHasConstant.getRowIndex(parentIndex));
	}
	catch (InvalidInputException e) {
		parentRep = Integer.toHexString(parentIndex);
	}
	return String.format("Type %d Parent %s Value %x", type, parentRep, valueIndex);
}