johnno1962 / SwiftTrace

Trace Swift and Objective-C method invocations
Other
707 stars 52 forks source link

Should not the context register be saved as well? #9

Closed flockoffiles closed 5 years ago

flockoffiles commented 6 years ago

I was wondering whether r13 (the call context register) be saved as well (inside the assembly code)? See: https://reverseengineering.stackexchange.com/questions/15725/calling-swift-4-methods-from-c And: https://github.com/apple/swift/blob/master/docs/ABIStabilityManifesto.md#calling-convention

johnno1962 commented 6 years ago

Thanks for this, you may be right. Looks like this was something added in Swift 4.

flockoffiles commented 6 years ago

By the way, thanks so much for the awesome component! I was trying to understand Swift vtables by just reading their docs, but having a live example is a life saver!

johnno1962 commented 5 years ago

I’ve just pushed an update which should resolve this. %r13 is used for self and %rax used for structs