0

New to de-compiling, want to set up Ida to give best reading experience with ELF files from android phone.

I run in following issues:

  1. Even though i set Edit > PlugIns > Hex-Rays Decompiler > Options > Default Radix = 10, still getting mixed HEX and decimal values for below function.
  2. indent after = is not there in local IDA i want to align values vertically.

Output from https://dogbolt.org/ using Hex-Rays.

__int64 __fastcall GetSensorLibraryAPIs(__int64 result, double a2)
{
  *(double *)(result + 4) = a2;
  *(_QWORD *)(result + 16) = CalculateExposure;
  *(_QWORD *)(result + 24) = FillExposureSettings;
  *(_QWORD *)(result + 32) = FillPDAFSettings;
  *(_QWORD *)(result + 40) = FillAutoWhiteBalanceSettings;
  *(_QWORD *)(result + 72) = StatsParse;
  *(_QWORD *)(result + 80) = SetMinMaxAnalogRegisterGain;
  *(_QWORD *)(result + 48) = FillToneControlSettings;
  return result;

parsed with Ida on my PC

__int64 __fastcall GetSensorLibraryAPIs(__int64 inputVar, double a2)
{
  *(double *)(inputVar + 4) = a2;
  *(_QWORD *)(inputVar + 0x10) = CalculateExposure;
  *(_QWORD *)(inputVar + 24) = FillExposureSettings;
  *(_QWORD *)(inputVar + 0x20) = FillPDAFSettings;
  *(_QWORD *)(inputVar + 40) = FillAutoWhiteBalanceSettings;
  *(_QWORD *)(inputVar + 0x48) = StatsParse;
  *(_QWORD *)(inputVar + 80) = SetMinMaxAnalogRegisterGain;
  *(_QWORD *)(inputVar + 48) = FillToneControlSettings;
  return inputVar;
}

Source code from similar file

VOID GetSensorLibraryAPIs(
    SensorLibraryAPI* pSensorLibraryAPI)
{
    pSensorLibraryAPI->majorVersion                  = 1;
    pSensorLibraryAPI->minorVersion                  = 0;
    pSensorLibraryAPI->pCalculateExposure            = CalculateExposure;
    pSensorLibraryAPI->pFillExposureSettings         = FillExposureSettings;
    pSensorLibraryAPI->pStatsParse                   = StatsParse;
    pSensorLibraryAPI->pFillAutoWhiteBalanceSettings = FillAutoWhiteBalanceSettings;
    pSensorLibraryAPI->pUpdateMaxAnalogGain          = UpdateMaxAnalogGain;
}
  1. is there way to set up ida to have more readable output similar to original source code?

  2. Please suggest overall best suitable Ida settings for this file.

I upload source code and file here: https://www.upload.ee/files/16662735/ELF_and_Source_Code.zip.html

1 Answer 1

0

IDA doesn't know the type of the argument being passed to the function.

You can press Shift+F1 to go to Local Types. There you can insert a new type as struct and then Press Y to retype the function signature. A combination of Y and N can then be used to change types and names until you get as close to source as possible.

See Type Recovery for more details

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.