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

Igor’s tip of the week #09: Reanalysis

While working in IDA, sometimes you may need to reanalyze some parts of your database, for example:

  • after changing a prototype of an external function (especially calling convention, number of purged bytes, or “Does not return” flag);
  • after fixing up incorrectly detected ARM/Thumb or MIPS32/MIPS16 regions;
  • after changing global processor options (e.g. setting $gp value in MIPS or TOC in PPC);
  • other situations (analyzing switches, etc.)

Reanalyzing individual instructions

To reanalyze an instruction, position the cursor in it and press C (convert to code). Even if the instruction is already code, this action is not a no-op: it asks the IDA kernel to:

  1. delete cross-references from the current address;
  2. have the processor module reanalyze the instruction; normally this should result in (re-)creation of cross-references, including the flow cross-reference to the following instruction (unless the current instruction stops the code flow).

Reanalyzing a function

All of the function’s instructions are reanalyzed when any of the function’s parameters are changed (e.g.. in case stack variables need to be recreated). So, the following key sequence causes the whole function to be reanalyzed: Alt-P (Edit function), Enter (confirm dialog).

Reanalyzing a bigger range of instructions

For this we can use the trick covered in the post on selection.

  1. go to start of  the range;
  2. press Alt-L (start selection);
  3. go to the end of selection;
  4. press C (convert to code). Pick “Analyze” in the first prompt and “No” in the second.

    Analyze 1

    Analyze 2

Reanalyzing whole database

If you need to reanalyze everything but don’t want to go through the hassle of selecting all the code, there is a dedicated command which can be invoked in two ways:

  1. Menu Options >  General…, Analysis Tab, Reanalyze program button;

    manu reanalyze

  2. Right-click the status bar at the bottom of IDA’s window, Reanalyze program

    Status bar reanalyze

Go to top of page