FakePDB icon indicating copy to clipboard operation
FakePDB copied to clipboard

fix dumpinfo.py for IDA 9.0

Open Abbas-MG opened this issue 1 year ago • 3 comments

now the PDB generation works for IDA 9.0 too.

could import the generated PDB to visual studio and functions/globals were mapped fine.

"find signature" still needs updating to be synced with new IDA types.

Abbas-MG avatar Oct 10 '24 09:10 Abbas-MG

now the PDB generation works for IDA 9.0 too.

could import the generated PDB to visual studio and functions/globals were mapped fine.

"find signature" still needs updating to be synced with new IDA types.

Can you share your compiled files? Building requires pretty bulky compilation including LLVM :/

dezmen3 avatar Oct 10 '24 13:10 dezmen3

now the PDB generation ...

Can you share your compiled files? Building requires pretty bulky compilation including LLVM :/

its a tiny fix to python file. the ida python internals were changed so plugin couldn't communicate with IDA. i just changed few lines. just replace the dumpinfo.py; at least for my target, i faced no problems when generating the PDB file.

Abbas-MG avatar Oct 10 '24 19:10 Abbas-MG

now the PDB generation ...

Can you share your compiled files? Building requires pretty bulky compilation including LLVM :/

its a tiny fix to python file. the ida python internals were changed so plugin couldn't communicate with IDA. i just changed few lines. just replace the dumpinfo.py; at least for my target, i faced no problems when generating the PDB file.

Yeah, but executables in release section are very old still, 2021 0.3 ver :/

dezmen3 avatar Oct 11 '24 04:10 dezmen3

@Abbas-MG This does not fix the errors from ida_struct (and ida_enum though not used here) being removed from the API. There is not a 1:1 replacement of all the functions needed so additional work beyond just replacing names is required.

Porting 8.X to 9.0 API documentation: https://docs.hex-rays.com/developer-guide/idapython/idapython-porting-guide-ida-9#ida_struct

For dumpinfo.py the following instances need to be upgraded to the new API: __describe_struct_type

  • ida_struct.SF_GHOST
  • ida_struct.SF_VAR
  • ida_struct.SF_FRAME
  • ida_struct.SF_UNION

__process_struct_members

  • ida_struct.get_member_name
  • ida_struct.get_member_tinfo

__process_structs

  • ida_struct.get_first_struc_idx
  • ida_struct.get_struc_by_idx
  • ida_struct.get_struc
  • ida_struct.get_struc_name
  • ida_struct.get_struc_size
  • ida_struct.get_next_struc_idx

ThiconZ avatar Oct 19 '24 21:10 ThiconZ

@ThiconZ as i said, i tested it on my target only. do you have an .i64 file for which this fix doesn't work? i need it to test if my future changes will work.

Abbas-MG avatar Oct 20 '24 19:10 Abbas-MG

@Abbas-MG I'm surprised your script ran at all under IDA 9.0 since it has an import to ida_struct still which at least on my end instantly causes an error just loading the plugin.

Traceback (most recent call last):
  File "C:\Program Files\IDA Professional 9.0\python\ida_idaapi.py", line 574, in IDAPython_ExecScript
    exec(code, g)
  File "C:/Program Files/IDA Professional 9.0/plugins/fakepdb.py", line 21, in <module>
    import fakepdb.command_dumpinfo
  File "C:\Program Files/IDA Professional 9.0/plugins\fakepdb\command_dumpinfo.py", line 24, in <module>
    from .dumpinfo import DumpInfo
  File "C:\Program Files/IDA Professional 9.0/plugins\fakepdb\dumpinfo.py", line 32, in <module>
    import ida_struct
ModuleNotFoundError: No module named 'ida_struct'

I've been working on a shim for ida_struct to try and get it up and running on my end at least but as I'm not too familiar with the IDA API it has not been the smoothest of times.

Here's an i64 that should contain everything you'd need to test against: https://file.io/pXMxjhcXLCrt

ThiconZ avatar Oct 20 '24 22:10 ThiconZ

@ThiconZ thanks for the sample. when ran FakePDB on it i only got the json file while for my own target i still get both pdb and json files; FakePDB is not throwing anything to inform what's wrong when it doesn't generate the pdb file for your sample.

regarding the error you mentioned, i think i have some left over files from previous IDA (or a plugin) or some extra links in PATH. is there any way to fully log idapython's procedures?

Abbas-MG avatar Oct 21 '24 05:10 Abbas-MG

"find signature" still needs updating to be synced with new IDA types.

fixed in 9bbf05b88ee0ff9923b2911413514edb87207776

Mixaill avatar Oct 23 '24 00:10 Mixaill

This does not fix the errors from ida_struct

https://github.com/Mixaill/FakePDB/issues/46

Mixaill avatar Oct 23 '24 00:10 Mixaill