Magic Lantern Firmware Wiki
Advertisement

Parent: http://magiclantern.wikia.com/wiki/2.0.4_AJ


===Your camera needs you #1 (and so do I!) ===


Would someone like to hack together an IDA script?


What I am looking for is simple script to AUTO name them if there is a comment in the subroutine.
There are about 15,000 unnamed ones ... this will save me a Huge amount of time.


Details below. If you need incentive ... I'll post you a Beer! (or one of the random alcoholic bevages hiding in my drinks cabinet)


'Script 1:  Naming of 'sub_' routines' using debug comments

Most of the names that I populating are found by looking at the comments in IDA.
I find a undefined subroutine name, I scroll down the subroutine, and I used the first string - and use it:

-------------------------------------
FF98D7BC sub_FF987DBC
........
FF98D7E8      ADR R2, aH264rapperPout ; "[H264Rapper] pOutputAddress=0x%08X"
-------------------------------------

Would become:

-------------------------------------
FF98D7BC AUTO_'H264Rapper_pOutputAddress'
........
FF98D7E8      ADR R2, aH264rapperPout ; "[H264Rapper] pOutputAddress=0x%08X"
-------------------------------------

If there are No comments in the subroutine - then do nothing.

Thanks :)

Antony

#include<idc.idc>

/* before
 ROM:FF41C334 DCD aFa_getfiledata ; "FA_GetFileData"
 ROM:FF41C338 DCD sub_FF1E2AE8
 ROM:FF41C33C DCD aFa_getfilesize ; "FA_GetFileSize"
 ROM:FF41C340 DCD sub_FF1E2924
 ROM:FF41C344 DCD aFa_deletefile ; "FA_DeleteFile"
 ROM:FF41C348 DCD sub_FF1E2BE0
after
 ROM:FF41C334 DCD aFa_getfiledata ; "FA_GetFileData"
 ROM:FF41C338 DCD FA_GetFileData
 ROM:FF41C33C DCD aFa_getfilesize ; "FA_GetFileSize"
 ROM:FF41C340 DCD FA_GetFileSize
 ROM:FF41C344 DCD aFa_deletefile ; "FA_DeleteFile"
 ROM:FF41C348 DCD FA_DeleteFile

*/

// http://www.hex-rays.com/idapro/idadoc/index.shtml
static main()
{ 
  auto start, end, i;

  start = 0xFF41C12C;
  end = 0xFF41C348;
  Message("%x -> %x\n", start, end);

  for ( i=start; i < end; i=i+8 ) {
    MakeDword(i);
    MakeDword(i+4);
    Message("%x %s\n", Dword(i+4), GetString(Dword(i), -1, ASCSTR_C) );
    MakeName(Dword(i+4), GetString(Dword(i), -1, ASCSTR_C));
  }
}

a first step for your script

Arm.Indy

[AJ] Thanks for taking a shot at that AI ... maybe I could send you 'shot of something :)

Advertisement