State-of-the-art binary code analysis tools

The “I” in IDA stands for interactive, and one of the most common interactive actions you can perform is adding comments to the disassembly listing (or decompiler pseudocode). There are different types of comments you can add or see in IDA.

Regular comments

These comments are placed at the end of the disassembly line, delimited by an assembler-specific comment character (semicolon, hash, at-sign etc.). A multi-line comment shifts the following listing lines down and is printed aligned with the first line which is why they can also be called indented comments.

Shortcut: : (colon) 

Repeatable comments

Basically equivalent to regular comments with one small distinction: they are repeated in any location which refers to the original comment location. For example, if you add a repeatable comment to a global variable, it will be printed at any place the variable is referenced.

Shortcut: ; (semicolon)

Function comments

A repeatable comment added at the first instruction of a function is considered a function comment. It is printed before the function header and — since it’s a repeatable comment — at any place the function is called from. They’re good for describing what the function does in more detail than can be inferred from the function’s name.

Shortcut: ; (semicolon)

Anterior and posterior comments

These are printed before (anterior) or after (posterior) the current address as separate lines of text, shifting all other listing lines. They are suitable for extended explanations, ASCII art and other freestanding text. Unlike regular comments, no assembler comment characters are added automatically.

Shortcuts: Ins, ShiftIns (I and ShiftI on Mac)

Trivia: the comment with file details that is usually added at the beginning of the listing is an anterior comment so you can use Ins to edit it.

Pseudocode comments

In the decompiler pseudocode you can also add indented comments using the shortcut / (slash) and block comments using Ins (I on Mac). They are stored separately from the disassembly comments, however function comments are shared with those in disassembly.

Automatic comments

In some situations IDA itself can add comments to disassembly. A few examples:

“Auto comments” in Option > General.., Disassembly tab enables instruction comments.

Demangled names are shown as auto comments by default. Use the Options > Demangled names… dialog if you prefer to replace the mangled symbol directly in the listing.

String literals work similarly to repeatable comments: the string contents shows up as a comment in the place it’s referenced from.