Friday, July 11, 2014

Hopper scripting bug : Document.getCurrentDocument().getSegmentAtAddress(addr)

I like using Hopper; however, there do seem to be a few bugs when scripting that require working around. One such bug I encountered recently is the instance where the function `Document.getCurrentDocument().getSegmentAtAddress(addr)` returns None for a perfectly valid address. This behaviour occurs when you have a loop and you call the function repeatedly from within it(yeah I probably shouldn't do that but well...).

The workaround was to do something as follows :-

curseg = Document.getCurrentDocument().getSegmentAtAddress(addr)
while curseg is None:
time.sleep(2)
curseg = Document.getCurrentDocument().getSegmentAtAddress(addr)


Ugly but works!

No comments:

Post a Comment