-
Notifications
You must be signed in to change notification settings - Fork 17
Add support for pseuducode comment #14
Copy link
Copy link
Open
Description
I wrote this extra function and it fetch all pseuducode comments successfully.
def populate_with_decompiler_comments(self, item_index):
if not ida_hexrays.init_hexrays_plugin():
return item_index
for addr in idautils.Functions():
if ida_segment.is_spec_ea(addr): # Skip special segments
continue
function_name = idaapi.get_func_name(addr)
try:
# Get all user comments for this function
ccmts = ida_hexrays.restore_user_cmts(addr)
if ccmts is None:
continue
# Iterate through comments
p = ida_hexrays.user_cmts_begin(ccmts)
while p != ida_hexrays.user_cmts_end(ccmts):
cmk = ida_hexrays.user_cmts_first(p) # Comment key (address, type)
cmv = ida_hexrays.user_cmts_second(p) # Comment value (text)
# Determine comment type
if cmk.itp < (ida_hexrays.ITP_COLON + 1):
comment_type = "Pseudocode (EOL)"
else:
comment_type = "Pseudocode (Block)"
# Add to table
comment_text = cmv.c_str() # Get C string
item_index = self.add_row(item_index, cmk.ea, comment_text,
comment_type, function_name)
p = ida_hexrays.user_cmts_next(p)
ida_hexrays.user_cmts_free(ccmts)
except Exception:
continue
return item_index
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels