Search code examples
reverse-engineeringida

IDA Pro jumping to offset from base


I use CheatEngine as a debugger (and get a lot of crap for it). When I find addresses, I always write them down based on the offset from where the start of the instructions are (e.g. program.exe+402C0). It would be nice to be able to use the goto function with this method of referencing a location; is there a way to do this?


Solution

  • According to IDA Pro's documentation:

    If the entered [goto] string can not be recognized as a hexadecimal or location name, IDA will try to interpreet it as an expression using the current script interpreter. The default interpreter is IDC.

    So what you can do is define a global variable in the IDC interpreter (using the bar at the bottom of your IDA view) that identifies the base address of your module as such:

    extern ModuleBaseAddress;
    ModuleBaseAddress = 0x400000; // Example base address
    

    Then whenever you want to go to the base address + offset you would simply open the Jump window (using the g-key) and type in:

    ModuleBaseAddress + 0x1000 // 0x1000 is your offset