有没有办法为给定的局部变量获取给定函数中的所有PcodeOps?到目前为止,我可以在给定函数和名称的情况下找到HighSymbol,但我想然后获取该变量的所有用途?
DecompileResults res = decomplib.decompileFunction(f, 200, monitor);
if (res.decompileCompleted())
{
HighFunction highFunc = res.getHighFunction();
LocalSymbolMap localMap = highFunc.getLocalSymbolMap();
Iterator<HighSymbol> localSymbols = localMap.getSymbols();
HighSymbol localSymbol = null;
while (localSymbols.hasNext())
{
HighSymbol current = localSymbols.next();
if (current.getName().equals(theName)) {
localSymbol = current;
break;
}
}
}
如果您从HighSymbol
开始,您首先通过访问HighSymbol. hyVariable
来获取HighVariable
。
然后,您可以通过访问VarnodeAST
类型的HighVariable
的实例
来获取使用该变量的所有PCodeOP,然后获取它们的def
(定义)和后代
hvar = currentLocation.token.highVariable # get the high variable that is currently selected highlighted in the decompiler window
for varnode in hvar.instances:
print(varnode.def) # the PCodeOp that defines this instance of the variable
for dsc in varnode.descendants:
print(dsc) # every PCodeOp that uses this variable