Debug information, whether present in the binary or loaded separately, can contain not only symbols such as function or variable names, but also mapping of binary’s instructions to the original source files. It can be used by IDA’s debugger for source-level debugging, but what if you want to see this mapping during static analysis?
Enabling source line number display
Assuming the line number info was available and has been imported, it can be enabled in the Options > General… dialog, Disassembly tab:
Once enabled, IDA will add automatic comments with the file name and line number in the disassembly listing:
To enable this for all new databases by default, change SHOW_SOURCE_LINNUM
setting in ida.cfg
.
Importing line numbers from DWARF
DWARF debug format can also include line number information, but by default it’s skipped because it’s rarely needed in the database itself and can take a long time to load for big files. If you do need it, you should enable the corresponding option when prompted by IDA:
To always import line numbers from DWARF debug info, enable DWARF_IMPORT_LNNUMS
in cfg/dwarf.cfg
.
See also: