Classy! IDA script for keeping track of RE info related to C++ classes (specifically, CodeWarrior PPC) and keeping things consistent throughout the database. That's what makes IDA better than objdump anyway, right? :p Started by Treeki: 16th October 2011 Developed using Python 2.6 and IDA 6.1. Supported so far: - Save and reset database - Classes: - Create a class using an IDA struct - Delete a class - Base classes are handled using a struct field named _ - Struct is automatically created if one is not chosen - if this is used, Classy adds the _ field for you - Virtual Tables: - Set a VTable for a class. End is automatically detected - If the auto detection fails (pure virtuals, for example) you can manually override it - CTors/DTors: - Set a ctor and dtor for a class (TODO: Multiple ctors) - Dtors automatically become virtual if a pointer to them is found in the vtable, even if the dtor was registered before the vtable was set - Methods: - Register regular and virtual methods - Mark virtual calls by highlighting the "lwz r12, ..." line, pressing Shift+C and choosing a class - Xrefs to each virtual method are shown at the top of the method body - Set method arguments including pointers, arrays, refs and consts - Arguments are automatically mangled so they are shown in IDA names - Shift+V automatically detects whether a method is a new virtual one or an override - Overrides are shown at the top of the original method body - Renames and argument list changes are propagated from original methods to overrides (Though not vice versa yet) That's all for now, I think... Current Todo: - Only show classes that fit the criteria in the chooser for Shift+C - Support PTMFs, too - Automatically create virtual methods using the vtable. - Named arguments to methods - Return types for methods - Const methods - Improve vtable end detection heuristics - Support pure virtuals. - Handle IDA chooser history/defaults correctly everywhere - Better keybindings - Rename class menu item - Netnodes - Override dtors - Sanity check to see if a virtual method might exist in a base class - Confirm unlinking of methods - Don't let you create more than one method with the same name - choose_class differentiation between "no class" and Cancel - Auto usage of struct if a named one exists - Remove virtual xrefs Caveats: - Multiple inheritance will not be supported in the near future. - Probably won't work as well with non-CodeWarrior stuff. Notes: - When autocreating virtual methods, start with the base class!! Otherwise, you might end up defining an override as a virtual method. And that would be bad.