emesare / binja-msvc

Parses and symbolizes MSVC RTTI information in Binary Ninja.
MIT License
25 stars 6 forks source link

Support C++ exceptions #17

Open emesare opened 11 months ago

emesare commented 11 months ago

Using our RTTI information we can identify and symbolize both the throw metadata and the attached catch routine. This should be done in two passes. First pass should symbolize the throw metadata and the second pass should rewrite callsite to illustrate the branching, possibly with an xref to the catch routine and for the non-catch routine we should just be able to make the throw function returnable.

The end result should look something like this, the throw is highlighted orange to illustrate it could jump to the catch routine instead of continuing. Not sure how "correct" this is.

image

emesare commented 11 months ago

We could also inline the non-exceptional path like so: image

ExecuteProtect commented 9 months ago

I recommend taking into consideration whether or not there's debug data for the non-exceptional path's function before you inline anything. If there's debug data or a symbol that wasn't just auto-generated then you don't want to get rid of that.