nologic / idaref

IDA Pro Instruction Reference Plugin
GNU General Public License v2.0
636 stars 108 forks source link

Plugin fails to load under IDA 7.1 because idaapi and idc are not explictly imported #18

Closed xanarin closed 6 years ago

xanarin commented 6 years ago

This issue occurs on IDA 7.1.180227 Linux x86_64 with the following python installation:

Python 2.7.15 (default, May  1 2018, 20:16:04) 
[GCC 7.3.1 20180406] 
IDAPython v1.7.0 final (serial 0) (c) The IDAPython Team <idapython@googlegroups.com>

When IDA is started, the idaref plugin fails to initalize with the following traceback:

/opt/ida-7.1/plugins/idaref.py: name 'idaapi' is not defined
Traceback (most recent call last):
  File "/opt/ida-7.1/python/ida_idaapi.py", line 566, in IDAPython_ExecScript
    execfile(script, g)
  File "/opt/ida-7.1/plugins/idaref.py", line 12, in <module>
    class StopHandler(idaapi.action_handler_t):
NameError: name 'idaapi' is not defined

If the statement import idaapi is added after line 5 of idaref.py, the first issue is resolved, but a new error occurs when starting idaref:

Starting IdaRef
available architectures ['x86-64', 'arm']
Manual loaded for architecture: arm
Traceback (most recent call last):
  File "/opt/ida-7.1/plugins/idaref.py", line 121, in update
    self.update()
  File "/opt/ida-7.1/plugins/idaref.py", line 257, in update
    inst = self.cleanInstruction(GetMnem(ScreenEA()))
NameError: global name 'GetMnem' is not defined

This can be resolved by explicitly importing GetMnem and ScreenEA from the idc package.