Skip to content

Fix crash and print source file name instead of compiland name #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: latest-ida
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions annotate_lineinfo/annotate_lineinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def __init__(self,binary,msdia_ver=None,sympaths=None):
else:
self.dataSource.loadDataForExe(binary,';'.join(sympaths), None)
except _ctypes.COMError as e:
hr = ctypes.c_uint(e[0]).value
hr = ctypes.c_uint(e.args[0]).value
if hr == 0x806D0005: # E_PDB_NOT_FOUND
msg = "Unable to locate PDB"
elif hr == 0x806D0012: # E_PDB_FORMAT
Expand Down Expand Up @@ -94,7 +94,7 @@ def iter_function_lineinfo(self):
for line in self.iter_lineinfo_by_rva(func.relativeVirtualAddress, func.length):
self.logger.debug("[{:08X}-{:08X}] {}:{}:{}".format(
line.relativeVirtualAddress, line.relativeVirtualAddress+line.length,
compiland_name(line.compiland), func.name, line.lineNumber))
line.sourceFile.fileName, func.name, line.lineNumber))
yield func,line

def main(argv):
Expand Down Expand Up @@ -171,7 +171,7 @@ def ida_get_sympath():

def ida_add_lineinfo_comment(line, func=None):
ea = idaapi.get_imagebase()+line.relativeVirtualAddress
cmt = "{}".format(compiland_name(line.compiland))
cmt = "{}".format(line.sourceFile.fileName)
if func is not None:
cmt += ":{}".format(func.name)
cmt += ":{}".format(line.lineNumber)
Expand Down