How do I call the user_cmts_*
functions from the IDAPython API? I am quite new to the SDK and IDAPython, so I'm kind of lost as to what I'm supposed to pass to these functions, as it's not the user-friendliest docs imo. I tried passing a map as such for user_cmts_begin
:
import idaapi
def print_cmt(cmt):
print cmt
cumap = map(print_cmt, [some address here to test])
idaapi.user_cmts_begin(cumap)
But it throws a type error, so obviously I must be doing something wrong...
For now I've had to resort to doing this:
import idaapi
import re
addr = 0x80000000
while addr < 0x80200000:
cmt = idaapi.get_cmt(addr, 0) # get non-repeatable comment at current address/line
if cmt is not None: # skip if the line has no comment
if re.search("insert regex for non-auto-generated comments here", cmt) is not None:
print "%08X: %s" % (addr, cmt)
addr = idaapi.next_not_tail(addr)
The IDAPython docs can be found here:
https://www.hex-rays.com/products/ida/support/idapython_docs/
Could someone show an example?