Ghidra is a software reverse engineering (SRE) framework
GP-280 fixed issue preventing exporting a graph to DOT format.
ghidravore7758c069b7c4
diff --git a/Ghidra/Features/GraphServices/src/main/java/ghidra/graph/export/AbstractGraphExporterFactory.java b/Ghidra/Features/GraphServices/src/main/java/ghidra/graph/export/AbstractGraphExporterFactory.javaindex c6608ec4e2..bd65e9db6c 100644--- a/Ghidra/Features/GraphServices/src/main/java/ghidra/graph/export/AbstractGraphExporterFactory.java+++ b/Ghidra/Features/GraphServices/src/main/java/ghidra/graph/export/AbstractGraphExporterFactory.java@@ -125,8 +125,15 @@ public abstract class AbstractGraphExporterFactory<V, E> {return exporter;}+ String getQuotedId(V vertex) {+ String id = vertexIdProvider.apply(vertex);+ return "\"" + id + "\"";+ }+private GraphExporter<V, E> createDotExporter() {- DOTExporter<V, E> exporter = new DOTExporter<>(vertexIdProvider);+ // DOT format is picky about its identifiers, so pass in a vertex id supplier+ // that wraps the vertex ids in quotes+ DOTExporter<V, E> exporter = new DOTExporter<>(this::getQuotedId);setupExporter(exporter);return exporter;}diff --git a/Ghidra/Features/GraphServices/src/main/java/ghidra/graph/export/GraphExporterDialog.java b/Ghidra/Features/GraphServices/src/main/java/ghidra/graph/export/GraphExporterDialog.javaindex 15c282c8a9..6bc87c1035 100644--- a/Ghidra/Features/GraphServices/src/main/java/ghidra/graph/export/GraphExporterDialog.java+++ b/Ghidra/Features/GraphServices/src/main/java/ghidra/graph/export/GraphExporterDialog.java@@ -276,14 +276,14 @@ public class GraphExporterDialog extends DialogComponentProvider {GraphExportFormat exporterFormat = getSelectedExporter();File outputFile = getSelectedOutputFile();- try {- if (outputFile.exists() &&+ if (outputFile.exists() &&OptionDialog.showOptionDialog(getComponent(), "Overwrite Existing File?","The file " + outputFile + " already exists.\nDo you want to overwrite it?","Overwrite", OptionDialog.QUESTION_MESSAGE) != OptionDialog.OPTION_ONE) {return false;- }- Writer writer = new FileWriter(outputFile);+ }++ try (Writer writer = new FileWriter(outputFile)) {GraphExporter<AttributedVertex, AttributedEdge> exporter =AttributedGraphExporterFactory.getExporter(exporterFormat);