Skip to content

Ghidra is a software reverse engineering (SRE) framework

GP-5296 added help links for function graph layout actions

ghidragona9f8fc7c26f7
diff --git a/Ghidra/Features/FunctionGraph/src/main/help/help/topics/FunctionGraphPlugin/Function_Graph_Layouts.html b/Ghidra/Features/FunctionGraph/src/main/help/help/topics/FunctionGraphPlugin/Function_Graph_Layouts.html
index fde3c94abd..4d68e17109 100644
--- a/Ghidra/Features/FunctionGraph/src/main/help/help/topics/FunctionGraphPlugin/Function_Graph_Layouts.html
+++ b/Ghidra/Features/FunctionGraph/src/main/help/help/topics/FunctionGraphPlugin/Function_Graph_Layouts.html
@@ -58,7 +58,19 @@
</BLOCKQUOTE>
</BLOCKQUOTE>
-
+ <H2><A name="Flow_Chart_Layout"></A>Flow Chart Layout</H2>
+ <blockquote>
+ <P>This layout organizes the code blocks into a tree structure with each parent vertex in the
+ tree being centered over its children. Edges are routed orthongally with minimal edge
+ crossings.</P>
+ </blockquote>
+ <H2><A name="Flow_Chart_Layout_Left"></A>Flow Chart Layout (Left)</H2>
+ <blockquote>
+ <P>This layout is the same as the Flow Chart Layout, except parent nodes are place directly
+ above their left most child.</P>
+ </blockquote>
+
+ </BLOCKQUOTE>
<P class="providedbyplugin">Provided by: <I>Function Graph Plugin</I></P>
<BR>
diff --git a/Ghidra/Features/FunctionGraph/src/main/java/ghidra/app/plugin/core/functiongraph/FGActionManager.java b/Ghidra/Features/FunctionGraph/src/main/java/ghidra/app/plugin/core/functiongraph/FGActionManager.java
index 91cb84ee0c..a6ec812c3a 100644
--- a/Ghidra/Features/FunctionGraph/src/main/java/ghidra/app/plugin/core/functiongraph/FGActionManager.java
+++ b/Ghidra/Features/FunctionGraph/src/main/java/ghidra/app/plugin/core/functiongraph/FGActionManager.java
@@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -911,13 +911,11 @@ class FGActionManager {
private List<ActionState<FGLayoutProvider>> createActionStates(
List<FGLayoutProvider> layoutProviders) {
List<ActionState<FGLayoutProvider>> list = new ArrayList<>();
- HelpLocation layoutHelpLocation =
- new HelpLocation("FunctionGraphPlugin", "Function_Graph_Action_Layout");
for (FGLayoutProvider layout : layoutProviders) {
ActionState<FGLayoutProvider> layoutState =
new ActionState<>(layout.getLayoutName(), layout.getActionIcon(), layout);
- layoutState.setHelpLocation(layoutHelpLocation);
+ layoutState.setHelpLocation(layout.getHelpLocation());
list.add(layoutState);
}
diff --git a/Ghidra/Features/FunctionGraph/src/main/java/ghidra/app/plugin/core/functiongraph/graph/layout/FGLayoutProvider.java b/Ghidra/Features/FunctionGraph/src/main/java/ghidra/app/plugin/core/functiongraph/graph/layout/FGLayoutProvider.java
index d239783761..2d0fb76b5d 100644
--- a/Ghidra/Features/FunctionGraph/src/main/java/ghidra/app/plugin/core/functiongraph/graph/layout/FGLayoutProvider.java
+++ b/Ghidra/Features/FunctionGraph/src/main/java/ghidra/app/plugin/core/functiongraph/graph/layout/FGLayoutProvider.java
@@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -20,6 +20,7 @@ import ghidra.app.plugin.core.functiongraph.graph.FunctionGraph;
import ghidra.app.plugin.core.functiongraph.graph.vertex.FGVertex;
import ghidra.framework.options.Options;
import ghidra.graph.viewer.layout.LayoutProvider;
+import ghidra.util.HelpLocation;
import ghidra.util.exception.CancelledException;
import ghidra.util.task.TaskMonitor;
@@ -44,4 +45,13 @@ public abstract class FGLayoutProvider implements LayoutProvider<FGVertex, FGEdg
public FGLayoutOptions createLayoutOptions(Options options) {
return null;
}
+
+ /**
+ * Returns the help location for this layout. Subclasses should override this method to give
+ * specific help for the graph layout performed by this provider.
+ * @return the help location for this layout
+ */
+ public HelpLocation getHelpLocation() {
+ return new HelpLocation("FunctionGraphPlugin", "Function_Graph_Action_Layout");
+ }
}
diff --git a/Ghidra/Features/FunctionGraph/src/main/java/ghidra/app/plugin/core/functiongraph/graph/layout/flowchart/FlowChartLayoutProvider.java b/Ghidra/Features/FunctionGraph/src/main/java/ghidra/app/plugin/core/functiongraph/graph/layout/flowchart/FlowChartLayoutProvider.java
index 162c4caf3d..7680f7736f 100644
--- a/Ghidra/Features/FunctionGraph/src/main/java/ghidra/app/plugin/core/functiongraph/graph/layout/flowchart/FlowChartLayoutProvider.java
+++ b/Ghidra/Features/FunctionGraph/src/main/java/ghidra/app/plugin/core/functiongraph/graph/layout/flowchart/FlowChartLayoutProvider.java
@@ -21,6 +21,7 @@ import generic.theme.GIcon;
import ghidra.app.plugin.core.functiongraph.graph.FunctionGraph;
import ghidra.app.plugin.core.functiongraph.graph.layout.FGLayout;
import ghidra.app.plugin.core.functiongraph.graph.layout.FGLayoutProviderExtensionPoint;
+import ghidra.util.HelpLocation;
import ghidra.util.exception.CancelledException;
import ghidra.util.task.TaskMonitor;
@@ -51,4 +52,9 @@ public class FlowChartLayoutProvider extends FGLayoutProviderExtensionPoint {
return new FGFlowChartLayout(graph, false);
}
+ @Override
+ public HelpLocation getHelpLocation() {
+ return new HelpLocation("FunctionGraphPlugin", "Flow_Chart_Layout");
+ }
+
}
diff --git a/Ghidra/Features/FunctionGraph/src/main/java/ghidra/app/plugin/core/functiongraph/graph/layout/flowchart/LeftAlignedFlowChartLayoutProvider.java b/Ghidra/Features/FunctionGraph/src/main/java/ghidra/app/plugin/core/functiongraph/graph/layout/flowchart/LeftAlignedFlowChartLayoutProvider.java
index c9f253baf3..81c45f6285 100644
--- a/Ghidra/Features/FunctionGraph/src/main/java/ghidra/app/plugin/core/functiongraph/graph/layout/flowchart/LeftAlignedFlowChartLayoutProvider.java
+++ b/Ghidra/Features/FunctionGraph/src/main/java/ghidra/app/plugin/core/functiongraph/graph/layout/flowchart/LeftAlignedFlowChartLayoutProvider.java
@@ -21,6 +21,7 @@ import generic.theme.GIcon;
import ghidra.app.plugin.core.functiongraph.graph.FunctionGraph;
import ghidra.app.plugin.core.functiongraph.graph.layout.FGLayout;
import ghidra.app.plugin.core.functiongraph.graph.layout.FGLayoutProviderExtensionPoint;
+import ghidra.util.HelpLocation;
import ghidra.util.exception.CancelledException;
import ghidra.util.task.TaskMonitor;
@@ -51,4 +52,8 @@ public class LeftAlignedFlowChartLayoutProvider extends FGLayoutProviderExtensio
return new FGFlowChartLayout(graph, true);
}
+ @Override
+ public HelpLocation getHelpLocation() {
+ return new HelpLocation("FunctionGraphPlugin", "Flow_Chart_Layout_Left");
+ }
}
diff --git a/Ghidra/Features/FunctionGraph/src/main/java/ghidra/app/plugin/core/functiongraph/graph/layout/jungrapht/JgtNamedLayoutProvider.java b/Ghidra/Features/FunctionGraph/src/main/java/ghidra/app/plugin/core/functiongraph/graph/layout/jungrapht/JgtNamedLayoutProvider.java
index 6b75f2a6b6..44049a5a41 100644
--- a/Ghidra/Features/FunctionGraph/src/main/java/ghidra/app/plugin/core/functiongraph/graph/layout/jungrapht/JgtNamedLayoutProvider.java
+++ b/Ghidra/Features/FunctionGraph/src/main/java/ghidra/app/plugin/core/functiongraph/graph/layout/jungrapht/JgtNamedLayoutProvider.java
@@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -20,6 +20,7 @@ import javax.swing.Icon;
import ghidra.app.plugin.core.functiongraph.graph.FunctionGraph;
import ghidra.app.plugin.core.functiongraph.graph.layout.FGLayout;
import ghidra.app.plugin.core.functiongraph.graph.layout.FGLayoutProvider;
+import ghidra.util.HelpLocation;
import ghidra.util.exception.CancelledException;
import ghidra.util.task.TaskMonitor;
@@ -27,6 +28,9 @@ import ghidra.util.task.TaskMonitor;
* A layout provider that allows us to specify a Jung layout by name.
*/
public class JgtNamedLayoutProvider extends FGLayoutProvider {
+ // layout algorithm categories
+ static final String MIN_CROSS = "Hierarchical MinCross";
+ static final String VERT_MIN_CROSS = "Vertical Hierarchical MinCross";
private String layoutName;
@@ -62,4 +66,17 @@ public class JgtNamedLayoutProvider extends FGLayoutProvider {
public String toString() {
return layoutName;
}
+
+ @Override
+ public HelpLocation getHelpLocation() {
+ // condense hierarchical action help to the top-level help description
+ String anchor = layoutName;
+ if (layoutName.contains(VERT_MIN_CROSS)) {
+ anchor = VERT_MIN_CROSS;
+ }
+ else if (layoutName.contains(MIN_CROSS)) {
+ anchor = MIN_CROSS;
+ }
+ return new HelpLocation("GraphServices", anchor);
+ }
}
diff --git a/Ghidra/Features/FunctionGraph/src/test.slow/java/ghidra/app/plugin/core/functiongraph/graph/layout/TestFGLayoutProvider.java b/Ghidra/Features/FunctionGraph/src/test.slow/java/ghidra/app/plugin/core/functiongraph/graph/layout/TestFGLayoutProvider.java
index e55f5d3e9d..df369daca4 100644
--- a/Ghidra/Features/FunctionGraph/src/test.slow/java/ghidra/app/plugin/core/functiongraph/graph/layout/TestFGLayoutProvider.java
+++ b/Ghidra/Features/FunctionGraph/src/test.slow/java/ghidra/app/plugin/core/functiongraph/graph/layout/TestFGLayoutProvider.java
@@ -30,6 +30,7 @@ import ghidra.graph.VisualGraph;
import ghidra.graph.viewer.layout.*;
import ghidra.graph.viewer.vertex.VisualGraphVertexShapeTransformer;
import ghidra.program.model.address.Address;
+import ghidra.util.HelpLocation;
import ghidra.util.Msg;
import ghidra.util.exception.CancelledException;
import ghidra.util.task.TaskMonitor;
@@ -374,4 +375,9 @@ public class TestFGLayoutProvider extends FGLayoutProvider {
//@formatter:on
}
}
+
+ @Override
+ public HelpLocation getHelpLocation() {
+ return null;
+ }
}
diff --git a/Ghidra/Features/FunctionGraphDecompilerExtension/src/main/java/ghidra/app/plugin/core/functiongraph/graph/layout/DecompilerNestedLayoutProvider.java b/Ghidra/Features/FunctionGraphDecompilerExtension/src/main/java/ghidra/app/plugin/core/functiongraph/graph/layout/DecompilerNestedLayoutProvider.java
index 90cc1f68f4..38ca2b8028 100644
--- a/Ghidra/Features/FunctionGraphDecompilerExtension/src/main/java/ghidra/app/plugin/core/functiongraph/graph/layout/DecompilerNestedLayoutProvider.java
+++ b/Ghidra/Features/FunctionGraphDecompilerExtension/src/main/java/ghidra/app/plugin/core/functiongraph/graph/layout/DecompilerNestedLayoutProvider.java
@@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -20,6 +20,7 @@ import javax.swing.Icon;
import generic.theme.GIcon;
import ghidra.app.plugin.core.functiongraph.graph.FunctionGraph;
import ghidra.framework.options.Options;
+import ghidra.util.HelpLocation;
import ghidra.util.task.TaskMonitor;
public class DecompilerNestedLayoutProvider extends FGLayoutProviderExtensionPoint {
@@ -56,4 +57,9 @@ public class DecompilerNestedLayoutProvider extends FGLayoutProviderExtensionPoi
return 200; // above the others
}
+ @Override
+ public HelpLocation getHelpLocation() {
+ return new HelpLocation("FunctionGraphPlugin", "Nested_Code_Layout");
+ }
+
}
diff --git a/Ghidra/Features/GraphServices/src/main/help/help/topics/GraphServices/GraphDisplay.htm b/Ghidra/Features/GraphServices/src/main/help/help/topics/GraphServices/GraphDisplay.htm
index e0fb14d101..906f4de711 100644
--- a/Ghidra/Features/GraphServices/src/main/help/help/topics/GraphServices/GraphDisplay.htm
+++ b/Ghidra/Features/GraphServices/src/main/help/help/topics/GraphServices/GraphDisplay.htm
@@ -111,7 +111,7 @@
<BLOCKQUOTE>
<BLOCKQUOTE>
<UL>
- <LI><A name="Compact Hierarchical"/>
+ <LI><A name="Compact_Hierarchical"/>
<B>Compact Hierarchical</B> is the <B>TidierTree Layout Algorithm</B>. It builds a tree
structure and attempts to reduce horizontal space.</LI>