Projects STRLCPY IDAGolangHelper Commits 82aedab0
🤬
  • Allow GO_Utils to be used in batch mode

    The GO_Utils initialization relied on idc.here(), which when
    run in batch mode would result in the following error:
    
    Z:\vm\IDAGolangHelper-master\auto_go_rename.py: could not find segment at 0xffffffffffffffff
    Traceback (most recent call last):
      File "C:\Program Files\IDA 7.0\python\ida_idaapi.py", line 553, in IDAPython_ExecScript
        execfile(script, g)
      File "Z:/vm/IDAGolangHelper-master/auto_go_rename.py", line 29, in <module>
        GO_SETTINGS = GO_Utils.GoSettings()
      File "Z:/vm/IDAGolangHelper-master\GO_Utils\__init__.py", line 15, in __init__
        self.bt_obj = Utils.get_bitness(idc.here())
      File "Z:/vm/IDAGolangHelper-master\GO_Utils\Utils.py", line 35, in get_bitness
        if idc.GetSegmentAttr(addr, idc.SEGATTR_BITNESS) == 2:
      File "C:\Program Files\IDA 7.0\python\idc_bc695.py", line 152, in GetSegmentAttr
        def GetSegmentAttr(segea, attr): return get_segm_attr(segea, attr)
      File "C:\Program Files\IDA 7.0\python\idc.py", line 3508, in get_segm_attr
        assert seg, "could not find segment at 0x%x" % segea
    AssertionError: could not find segment at 0xffffffffffffffff
    
    Even having the script Jump(BeginEA()) before initializing the library
    would trigger this error occasionally.  Replacing idc.here() with
    idc.BeginEA() resolved the issue.
  • Loading...
  • Andrew committed 6 years ago
    82aedab0
    1 parent ba2439ed
  • ■ ■ ■ ■ ■
    GO_Utils/__init__.py
    skipped 10 lines
    11 11   
    12 12   def __init__(self):
    13 13   self.storage = {}
    14  - #TODO: maybe here() not best option
    15  - self.bt_obj = Utils.get_bitness(idc.here())
     14 + self.bt_obj = Utils.get_bitness(idc.BeginEA())
    16 15   self.structCreator = Utils.StructCreator(self.bt_obj)
    17 16   self.processor = None
    18 17   self.typer = None
    skipped 95 lines
Please wait...
Page is in error, reload to recover