GP-1073 updating uses of getSymbols(address) to be more efficient where possible

This commit is contained in:
ghidravore 2021-10-06 16:59:58 -04:00
parent e2ea7320e1
commit a8da2b761a
33 changed files with 530 additions and 550 deletions

View file

@ -15,8 +15,7 @@
*/
package ghidra.feature.vt.api.markuptype;
import static ghidra.feature.vt.gui.util.VTOptionDefines.DEFAULT_OPTION_FOR_LABELS;
import static ghidra.feature.vt.gui.util.VTOptionDefines.LABELS;
import static ghidra.feature.vt.gui.util.VTOptionDefines.*;
import java.util.*;
@ -232,10 +231,6 @@ public class LabelMarkupType extends VTMarkupType {
LabelMarkupUtils.removeAllLabels(getDestinationProgram(association),
destinationAddress);
}
else if (replaceDefault) {
LabelMarkupUtils.removeDefaultLabels(getDestinationProgram(association),
destinationAddress);
}
Program destinationProgram = getDestinationProgram(association);
try {

View file

@ -1,6 +1,5 @@
/* ###
* IP: GHIDRA
* REVIEWED: YES
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -24,31 +23,15 @@ import ghidra.program.model.symbol.SymbolTable;
public class LabelMarkupUtils {
public static void removeDefaultLabels( Program destinationProgram, Address address ) {
SymbolTable symbolTable = destinationProgram.getSymbolTable();
Symbol[] symbols = symbolTable.getSymbols( address );
for ( Symbol symbol : symbols ) {
if ( symbol instanceof FunctionSymbol ) {
continue;
}
if ( !symbol.isDynamic() ) {
continue;
}
symbolTable.removeSymbolSpecial( symbol );
}
}
public static void removeAllLabels( Program destinationProgram, Address address ) {
SymbolTable symbolTable = destinationProgram.getSymbolTable();
Symbol[] symbols = symbolTable.getSymbols( address );
for ( Symbol symbol : symbols ) {
if ( symbol instanceof FunctionSymbol ) {
continue;
}
symbolTable.removeSymbolSpecial( symbol );
}
}
public static void removeAllLabels(Program destinationProgram, Address address) {
SymbolTable symbolTable = destinationProgram.getSymbolTable();
Symbol[] symbols = symbolTable.getSymbols(address);
for (Symbol symbol : symbols) {
if (symbol instanceof FunctionSymbol) {
continue;
}
symbolTable.removeSymbolSpecial(symbol);
}
}
}