mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-04 02:09:44 +02:00
GP-1073 updating uses of getSymbols(address) to be more efficient where possible
This commit is contained in:
parent
e2ea7320e1
commit
a8da2b761a
33 changed files with 530 additions and 550 deletions
|
@ -57,6 +57,7 @@ public class BlockGraphTask extends Task {
|
|||
private ColorizingService colorizingService;
|
||||
|
||||
private final static String ENTRY_NEXUS_NAME = "Entry Points";
|
||||
private static final int MAX_SYMBOLS = 10;
|
||||
private CodeBlockModel blockModel;
|
||||
private AddressSetView selection;
|
||||
private ProgramLocation location;
|
||||
|
@ -417,14 +418,20 @@ public class BlockGraphTask extends Task {
|
|||
}
|
||||
|
||||
private void addSymbolAttribute(AttributedVertex vertex, CodeBlock bb) {
|
||||
Symbol[] symbols = program.getSymbolTable().getSymbols(bb.getMinAddress());
|
||||
if (symbols.length != 0) {
|
||||
SymbolIterator it = program.getSymbolTable().getSymbolsAsIterator(bb.getMinAddress());
|
||||
int count = 0;
|
||||
if (it.hasNext()) {
|
||||
StringBuffer buf = new StringBuffer();
|
||||
for (int i = 0; i < symbols.length; i++) {
|
||||
if (i != 0) {
|
||||
for (Symbol symbol : it) {
|
||||
if (count != 0) {
|
||||
buf.append('\n');
|
||||
}
|
||||
buf.append(symbols[i].getName());
|
||||
// limit the number of symbols to include (there can be a ridiculous # of symbols)
|
||||
if (count++ > MAX_SYMBOLS) {
|
||||
buf.append("...");
|
||||
break;
|
||||
}
|
||||
buf.append(symbol.getName());
|
||||
}
|
||||
vertex.setAttribute(SYMBOLS_ATTRIBUTE, buf.toString());
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue