$ show facebook/chisel
Chisel is a collection of LLDB commands for debugging iOS and macOS applications. It provides a rich set of commands to inspect and manipulate the UI hierarchy, view controllers, accessibility, auto layout, animations, and memory. The project consists of Python scripts that define LLDB commands using a custom base class (FBCommand) and a native C/Objective-C framework (Chisel.framework) that enables heap scanning for Objective-C instances. The Python layer evaluates Objective-C expressions in the debugged process, while the native framework uses malloc zone enumeration to find live objects. The architecture is a plugin for LLDB, with commands loaded dynamically from a directory. Key entry points are the LLDB commands themselves (e.g., pviews, pvc, visualize, border, findinstances). External dependencies include LLDB, the iOS/OS X runtime, UIKit, CoreAnimation, and Foundation. The codebase is well-structured but shows some technical drift (Python 2 usage, deprecated imp module, old Xcode project settings).
The LLM identified 4 files worth highlighting for reuse:
Provides the FBCommand base class and helper functions for evaluating Objective-C expressions in LLDB. This module is the foundation for all Chisel commands and can be reused to create custom LLDB commands in any project. It handles argument parsing, option parsing, and expression evaluation with error handling and UIKit module import.
A C++ STL-compatible allocator that uses malloc zones for memory allocation. It creates a dedicated malloc zone to avoid interfering with heap scanning. This is a self-contained, reusable component for any C++ project that needs isolated memory allocation.
A utility function that extracts variable key paths from an NSPredicate object. It traverses compound and comparison predicates, skipping equality comparisons with constants. This is reusable for any code that needs to analyze NSPredicate expressions, such as logging or debugging tools.
Provides a function to enumerate all live allocations across all malloc zones. It uses the malloc introspection API to iterate over allocated ranges and calls a user-provided callback. This is a reusable component for memory analysis tools, independent of the rest of Chisel.