GP-3250 changed default call graph action to always use "Isolated Entry"

block model
This commit is contained in:
ghidragon 2023-03-23 15:35:00 -04:00
parent acb07dd535
commit a48d7f8b50
2 changed files with 81 additions and 79 deletions

View file

@ -231,7 +231,8 @@ public class BlockGraphTask extends Task {
AddressSet set = new AddressSet();
set.add(function.getBody());
try {
CodeBlock block = blockModel.getCodeBlockAt(function.getEntryPoint(), taskMonitor);
for (CodeBlock block : blockModel.getCodeBlocksContaining(function.getEntryPoint(),
taskMonitor)) {
CodeBlockReferenceIterator it = blockModel.getDestinations(block, taskMonitor);
while (it.hasNext()) {
CodeBlockReference next = it.next();
@ -243,6 +244,7 @@ public class BlockGraphTask extends Task {
set.add(next.getSourceBlock());
}
}
}
catch (CancelledException e) {
// just return, the task is being cancelled.
}

View file

@ -73,7 +73,7 @@ public class ProgramGraphPlugin extends ProgramPlugin
implements OptionsChangeListener, BlockModelServiceListener, GraphDisplayBrokerListener {
private static final String PLUGIN_NAME = "Program Graph";
private static final String DEFAULT_BLOCK_MODEL_FOR_CALL_GRAPH = "Isolated Entry";
private static final String OPTIONS_PREFIX = PLUGIN_NAME + Options.DELIMITER;
private static final String MAX_CODE_LINES_DISPLAYED =
OPTIONS_PREFIX + "Max Code Lines Displayed";
@ -205,7 +205,7 @@ public class ProgramGraphPlugin extends ProgramPlugin
new ActionBuilder("Graph Calls Using Default Model", getName())
.menuPath(MENU_GRAPH, "&Calls")
.menuGroup(MENU_GRAPH, "C")
.onAction(c -> graphSubroutines())
.onAction(c -> createDefaultCallGraph())
.enabledWhen(this::canGraph)
.buildAndInstall(tool);
@ -312,7 +312,7 @@ public class ProgramGraphPlugin extends ProgramPlugin
.menuPath(MENU_GRAPH, "Calls Using Model", blockModelName)
.menuGroup(MENU_GRAPH, "C")
.helpLocation(helpLoc)
.onAction(c -> graphSubroutinesUsing(blockModelName))
.onAction(c -> createCallGraphUsing(blockModelName))
.enabledWhen(this::canGraph)
.buildAndInstall(tool);
}
@ -325,11 +325,11 @@ public class ProgramGraphPlugin extends ProgramPlugin
graph(new CodeFlowGraphType(), blockModelService.getActiveBlockModelName());
}
private void graphSubroutines() {
graph(new CallGraphType(), blockModelService.getActiveSubroutineModelName());
private void createDefaultCallGraph() {
createCallGraphUsing(DEFAULT_BLOCK_MODEL_FOR_CALL_GRAPH);
}
private void graphSubroutinesUsing(String modelName) {
private void createCallGraphUsing(String modelName) {
graph(new CallGraphType(), modelName);
}