Trace Objective-C method calls by class or instance for debugging and profiling iOS/macOS applications.
Xtrace is an Objective-C library that enables runtime tracing of method calls by class or instance. It intercepts and logs method invocations, providing developers with detailed visibility into application behavior for debugging and performance analysis. It solves the problem of understanding complex runtime interactions in Cocoa and iOS apps without requiring extensive code modifications.
Objective-C developers working on iOS or macOS applications who need deep runtime introspection for debugging, profiling, or understanding framework behavior. It's particularly useful for those dealing with complex UI interactions or third-party framework integration.
Developers choose Xtrace for its lightweight, non-intrusive approach to runtime tracing, offering both broad class-level and precise instance-level interception. Its unique aspect-oriented callback system allows method behavior modification, and integration with XcodeColors provides enhanced visual debugging.
Trace Objective-C method calls by class or instance
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Requires only adding Xtrace.h and Xtrace.mm files to the project, with a simple .pch import, making it easy to drop into existing Objective-C codebases without heavy dependencies.
Supports tracing by class, specific instances, or entire bundles, with regex-based method filtering to focus on relevant calls, as shown in the README with examples like [MyClass xtrace] and [Xtrace traceClassPattern:@"^UI"].
Enables before and after callbacks for methods, including the ability to modify return values, providing powerful debugging and behavior injection similar to aspect-oriented programming.
Includes profiling support to dump elapsed time data and integrates with XcodeColors for color-coded output, enhancing debugging with performance insights and visual distinction, as demonstrated in the sample output.
Explicitly does not work on ARM64 and has known issues with 64-bit builds, especially for methods with struct arguments or return types, restricting its use in modern iOS development.
The README states it's superseded by SwiftTrace, indicating reduced active development and potential lack of updates or fixes, making it less future-proof for Objective-C projects.
Requires careful ordering of API calls and has a blacklist of methods causing problems, adding complexity and potential unreliability, as noted with exclusions for varargs and struct types.