logger.info("Writing assembly CFG to " + gwriter.getFilename());
try {
for (Location node : nodes) {
AbsoluteAddress nodeAddr = node.getAddress();
Instruction instr = program.getInstruction(nodeAddr);
String nodeName = nodeAddr.toString();
String nodeLabel = program.getSymbolFor(nodeAddr);
if (instr != null) {
String instrString = instr.toString(nodeAddr.getValue(), program.getModule(nodeAddr).getSymbolFinder());
instrString = instrString.replace("\t", " ");
gwriter.writeNode(nodeName, nodeLabel + "\\n" + instrString, getNodeProperties(node));
} else {
gwriter.writeNode(nodeName, nodeLabel, getNodeProperties(node));
}
}
for (CFAEdge e : edges) {
if (e.getKind() == null) logger.error("Null kind? " + e);
AbsoluteAddress sourceAddr = e.getSource().getAddress();
AbsoluteAddress targetAddr = e.getTarget().getAddress();
String label = null;
Instruction instr = program.getInstruction(sourceAddr);
if (instr instanceof BranchInstruction) {
BranchInstruction bi = (BranchInstruction)instr;
if (bi.isConditional()) {
// Get the original goto from the program (not the converted assume)