0

有没有办法为给定的局部变量获取给定函数中的所有 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;
      }
  }
}
4

1 回答 1

0

如果您从 a 开始HighSymbol,您首先HighVariable通过访问highSymbol.highVariable.

然后,您可以通过访问类型instances为 的 a ,然后获取它们的(定义)和HighVariableVarnodeASTdefdescendants

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
于 2021-06-30T13:12:08.557 回答