Ghidra is a software reverse engineering (SRE) framework
fixed a few minor issues with AST graphs
ghidravore269ca50d334c
diff --git a/Ghidra/Features/Decompiler/ghidra_scripts/GraphAST.java b/Ghidra/Features/Decompiler/ghidra_scripts/GraphAST.javaindex 6ede310cb3..fd865dee4a 100644--- a/Ghidra/Features/Decompiler/ghidra_scripts/GraphAST.java+++ b/Ghidra/Features/Decompiler/ghidra_scripts/GraphAST.java@@ -43,8 +43,8 @@ public class GraphAST extends GhidraScript {protected static final String ADDRESS_TIED = "Address Tied";protected static final String OP = "Op";- protected static final String TYPE_OUTPUT = "Output";- protected static final String TYPE_INPUT = "Input";+ protected static final String WITHIN_BLOCK = "Within Block";+ protected static final String BETWEEN_BLOCK = "Between Block";private Function func;private AttributedGraph graph;protected HighFunction high;@@ -80,8 +80,8 @@ public class GraphAST extends GhidraScript {.vertexType(ADDRESS_TIED).vertexType(OP).edgeType(DEFAULT)- .edgeType(TYPE_OUTPUT)- .edgeType(TYPE_INPUT)+ .edgeType(WITHIN_BLOCK)+ .edgeType(BETWEEN_BLOCK).build();GraphDisplayOptions displayOptions = new GraphDisplayOptionsBuilder(graphType)@@ -92,6 +92,7 @@ public class GraphAST extends GhidraScript {.defaultVertexShape(VertexShape.ELLIPSE).defaultLayoutAlgorithm("Hierarchical MinCross Coffman Graham").useIcons(false)+ .arrowLength(15).labelPosition(GraphLabelPosition.SOUTH).shapeOverrideAttribute(SHAPE_ATTRIBUTE).vertex(DEFAULT, VertexShape.ELLIPSE, WebColors.RED)@@ -102,8 +103,8 @@ public class GraphAST extends GhidraScript {.vertex(ADDRESS_TIED, VertexShape.ELLIPSE, WebColors.ORANGE).vertex(OP, VertexShape.RECTANGLE, WebColors.RED).edge(DEFAULT, WebColors.BLUE)- .edge(TYPE_OUTPUT, WebColors.BLACK)- .edge(TYPE_INPUT, WebColors.RED)+ .edge(WITHIN_BLOCK, WebColors.BLACK)+ .edge(BETWEEN_BLOCK, WebColors.RED).build();graph = new AttributedGraph("AST Graph", graphType);diff --git a/Ghidra/Features/Decompiler/ghidra_scripts/GraphASTAndFlow.java b/Ghidra/Features/Decompiler/ghidra_scripts/GraphASTAndFlow.javaindex 6d96408040..ca1eeeb2e3 100644--- a/Ghidra/Features/Decompiler/ghidra_scripts/GraphASTAndFlow.java+++ b/Ghidra/Features/Decompiler/ghidra_scripts/GraphASTAndFlow.java@@ -77,7 +77,7 @@ public class GraphASTAndFlow extends GraphAST {}if (prev != null && map.containsKey(prev) && map.containsKey(next)) {AttributedEdge edge = createEdge(map.get(prev), map.get(next));- edge.setEdgeType(TYPE_OUTPUT);+ edge.setEdgeType(WITHIN_BLOCK);}prev = next;}@@ -92,7 +92,7 @@ public class GraphASTAndFlow extends GraphAST {PcodeBlock in = block.getIn(i);if (last.containsKey(in)) {AttributedEdge edge = createEdge(last.get(in), first.get(block));- edge.setEdgeType(TYPE_INPUT);+ edge.setEdgeType(BETWEEN_BLOCK);}}}diff --git a/Ghidra/Framework/Graph/src/main/java/ghidra/service/graph/VertexShape.java b/Ghidra/Framework/Graph/src/main/java/ghidra/service/graph/VertexShape.javaindex 31ad5bfd25..ebf57de13b 100644--- a/Ghidra/Framework/Graph/src/main/java/ghidra/service/graph/VertexShape.java+++ b/Ghidra/Framework/Graph/src/main/java/ghidra/service/graph/VertexShape.java@@ -37,7 +37,6 @@ public abstract class VertexShape {public static VertexShape HEXAGON = new HexagonVertexShape(SIZE);public static VertexShape OCTAGON = new OctagonVertexShape(SIZE);-private Shape cachedShape;private String name;private int size;@@ -169,7 +168,7 @@ public abstract class VertexShape {}protected Shape createShape() {- return new Ellipse2D.Double(-1.0, 1.0, 2.0, 2.0);+ return new Ellipse2D.Double(-1.0, -1.0, 2.0, 2.0);}@Override