Unverified Commit 1d27486b by Enkelmann Committed by GitHub

handle nameless registers in Ghidra (#394)

parent 2487aac1
...@@ -189,8 +189,14 @@ public class TermCreator { ...@@ -189,8 +189,14 @@ public class TermCreator {
public static Variable createVariable(Varnode node) { public static Variable createVariable(Varnode node) {
Variable var = new Variable(); Variable var = new Variable();
if (node.isRegister()) { if (node.isRegister()) {
var.setName(HelperFunctions.context.getRegister(node).getName()); if (HelperFunctions.context.getRegister(node) == null) {
var.setIsVirtual(false); // This is a workaround for nameless registers encountered in some Aarch64 binaries.
var.setName(String.format("$U{}_unnamed", node.getAddress().toString()));
var.setIsVirtual(true);
} else {
var.setName(HelperFunctions.context.getRegister(node).getName());
var.setIsVirtual(false);
}
} else if (node.isUnique()) { } else if (node.isUnique()) {
var.setName(HelperFunctions.renameVirtualRegister(node.getAddress().toString())); var.setName(HelperFunctions.renameVirtualRegister(node.getAddress().toString()));
var.setIsVirtual(true); var.setIsVirtual(true);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment