Java Code Examples for ghidra.program.model.symbol.Symbol#setPinned()

The following examples show how to use ghidra.program.model.symbol.Symbol#setPinned() . 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: PinSymbolAction.java    From ghidra with Apache License 2.0 6 votes vote down vote up
@Override
protected void actionPerformed(ProgramSymbolActionContext context) {
	Program program = context.getProgram();
	int transactionID = program.startTransaction("Pin Symbol(s)");
	try {
		for (Symbol symbol : context.getSymbols()) {
			if ((symbol instanceof CodeSymbol || symbol instanceof FunctionSymbol) &&
				!symbol.isExternal() && !symbol.isPinned()) {
				symbol.setPinned(true);
			}
		}
	}
	finally {
		program.endTransaction(transactionID, true);
	}
}
 
Example 2
Source File: NXProgramBuilder.java    From Ghidra-Switch-Loader with ISC License 5 votes vote down vote up
public Symbol createSymbol(Address addr, String name, boolean isPrimary, boolean pinAbsolute, Namespace namespace) throws InvalidInputException 
{
    // TODO: At this point, we should be marking as data or code
    SymbolTable symbolTable = program.getSymbolTable();
    Symbol sym = symbolTable.createLabel(addr, name, namespace, SourceType.IMPORTED);
    if (isPrimary) {
        checkPrimary(sym);
    }
    if (pinAbsolute && !sym.isPinned()) {
        sym.setPinned(true);
    }
    return sym;
}
 
Example 3
Source File: ClearPinSymbolAction.java    From ghidra with Apache License 2.0 5 votes vote down vote up
@Override
protected void actionPerformed(ProgramSymbolActionContext context) {
	Program program = context.getProgram();
	int transactionID = program.startTransaction("Clear Pinned");
	try {
		for (Symbol symbol : context.getSymbols()) {
			if (symbol.isPinned()) {
				symbol.setPinned(false);
			}
		}
	}
	finally {
		program.endTransaction(transactionID, true);
	}
}
 
Example 4
Source File: PinSymbolCmd.java    From ghidra with Apache License 2.0 5 votes vote down vote up
@Override
public boolean applyTo(DomainObject obj) {
	SymbolTable symbolTable = ((Program) obj).getSymbolTable();
	Symbol symbol = symbolTable.getGlobalSymbol(name, addr);
	if (symbol == null) {
		message = "Could not find symbol named " + name + " at address " + addr;
		return false;
	}
	symbol.setPinned(pin);
	return true;
}