Hex Rays
Hex Rays Blog —  State of the art code analysis

Igor’s tip of the week #03: Selection in IDA

This week’s post is about selecting items in IDA and what you can do with the selection.

As a small change from the previous posts with mainly keyboard usage, we’ll also use the mouse this time!

Actions and what they are applied to

When an action is performed in IDA, by default it is applied only to the item under the cursor or to the current address (depending on the action). However, sometimes you might want to perform the action on more items or to an address range, for example to:

  • undefine a range of instructions;
  • convert a range of undefined bytes to a string literal if IDA can’t do it automatically (e.g. string is not null-terminated);
  • create a function from a range of instructions with some data in the middle (e.g. when you get the dreaded “The function has undefined instruction/data at the specified address” error);
  • export disassembly or decompilation of only selected functions instead of the whole file;
  • copy to clipboard a selected fragment of the disassembly.

Selecting in IDA

The simplest ways to select something in IDA are the same as in any text editor:

  • click and drag with the mouse (you can also scroll with the wheel while keeping the left button pressed);
  • hold down Shift and use the cursor navigation keys ( ← ↑ → ↓ PgUp PgDn Home End etc.).

However, this can quickly become tiring if you need to select a huge block of the listing (e.g.several screenfuls). In that case, the anchor selection will be of great use.

Using the anchor selection

  1. Move to the start of the intended selection and select Edit > Begin selection (or use the AltL shortcut).
  2. Navigate to the other end of the selection using any means (cursor keys, Jump actions, Functions window, Navigation bar etc.).
  3. Perform the action (via context menu, keyboard shortcut, or global menu). It will be applied to the selection from the anchor point to the current position.

Examples

Some of the actions that use selection:

  • Commands in the  File > Produce file submenu (create .ASM, .LST, HTML or .C file)
  • Edit > Export data (ShiftE)

Export Data dialog screenshot

Some more complicated actions requiring selection will be discussed in the forthcoming posts. Stay tuned and see you next Friday!

Go to top of page