Title: Request tutorial on how to enum bits Post by: elRey on January 14, 2015, 09:30:19 PM Also, masterj - how did you name each bit in IDA? To name bits you have to create enum in ida and apply it to selected word or byte Looking to change : bmov word_FD0E.5, USR0 to: bmov word_FD0E.my_var_name_for_bit_5, USR0 And have that name displayed in crossref list Would be much appreciated! Rey Title: Re: Request tutorial on how to enum bits Post by: elRey on August 04, 2015, 04:50:45 PM Please. This would make a world of difference.
Title: Re: Request tutorial on how to enum bits Post by: elRey on August 06, 2015, 03:03:19 PM I'm surprised at the reluctance of the community for sharing this helpful info.
I fumbled thru it and I'm not sure I did it the best way. Example shows word_FDA4.11 being changed to word_FDA4.B_nozwe bit 11 = 0x800 in bitmask part. (http://creativeion.com/rey/vw/help/ida_enum_bitfield.gif) Title: Re: Request tutorial on how to enum bits Post by: automan001 on August 07, 2015, 05:02:46 AM Cool stuff, thanks for the hint!
In damos file by the address xxxx of bits variable you can find all hex masks for these bits with respective names. Then you just need to define them as enum member of the new enum_word_xxxx. It's great! It solves all the issues with bits naming. Name of the bit is shown everywhere in xrefs and in the code. Title: Re: Request tutorial on how to enum bits Post by: nubcake on September 18, 2015, 11:31:38 AM I've been playing with IDA for a while now. Thought I'd share this little autoIT script I hacked together for parsing those "B_", "S_" and "Z_" flag variables generated by ME7info. It's based on one of the scripts posted in this thread (http://nefariousmotorsports.com/forum/index.php?topic=2431.15), originally started by prj. I modded it for my needs and added the function to parse those flag vars, adding them as enums.
Anyways, I made it for IDA 6.4, but it could be easily modded for any other version. The "Parse FLAGS" button is added to the menu. Prereqs: default IDA view ("structures" tab 2 tabs to the right from "ida view" tab), specially pre-parsed .csv file with flags. How to prepare csv: you take the appropriate .ecu file from me7i, leave only flags inside (B_, S_, Z_), sort it by address, remove duplicate names, leave only 3 columns: Code: name;address;offset Separated by semicolon for my locale, fix accordingly for your needs. Abstract of said csv: Code: B_dlahieg;0xFD08;0x8000 Fire IDA up, launch the script, press "Parse FLAGS", feed said .csv in, sit back and enjoy! (Optionally) get a cup of coffee, it will take ~5 mins to finish for average .ecu. P.S. I'm posting this here because the script is generally pretty messed up for anything else. It works for my needs, but the "parse ECU" is broken for example, etc. Title: Re: Request tutorial on how to enum bits Post by: nyet on September 18, 2015, 11:35:11 AM Thanks all, this is great info. Learned all sorts of stuff from this thread!
Title: Re: Request tutorial on how to enum bits Post by: masterj on September 25, 2015, 09:53:59 AM Hm.. doesn't seem to work with ida 6.1. Maybe you could update script so it would save parsed csv data to txt as IDAPython script? For every single enum/member it would create a command to do it in ida.
Something using OpEnum or some other command. https://www.hex-rays.com/products/ida/support/idadoc/704.shtml Title: Re: Request tutorial on how to enum bits Post by: nubcake on September 25, 2015, 10:50:30 AM Hm.. doesn't seem to work with ida 6.1. Maybe you could update script so it would save parsed csv data to txt as IDAPython script? For every single enum/member it would create a command to do it in ida. Something using OpEnum or some other command. https://www.hex-rays.com/products/ida/support/idadoc/704.shtml I tried it with python at first, but enum members didn't seem to "attach" to the enum correctly. I didn't want to waste more time trying to figure out what's going wrong - and just remade it "the GUI" way. At which point does it fail? Does it create the first enum? Does it add enum member? Does it go to the "Ida disassembly view" afterwards and to the RAM/IRAM address? EDIT: I'm not sure I added trimming of the leading zeros for IRAM adresses, so those must be in the "0xFxxx" format. EDIT2: I have noticed that it might bug for the first enum and not attach it correctly. For now doing it by hand istead, but will fix it sometimes probably. ;) |