{"id":1074,"url":"https://github.com/facebook/chisel","last_synced_at":"2025-05-14T11:02:38.761Z","repository":{"id":14355853,"uuid":"17065530","full_name":"facebook/chisel","owner":"facebook","description":"Chisel is a collection of LLDB commands to assist debugging iOS apps.","archived":false,"fork":false,"pushed_at":"2025-05-05T17:05:01.000Z","size":3552,"stargazers_count":9159,"open_issues_count":50,"forks_count":806,"subscribers_count":277,"default_branch":"main","last_synced_at":"2025-05-07T10:52:35.585Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/facebook.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2014-02-21T18:24:17.000Z","updated_at":"2025-05-07T03:32:07.000Z","dependencies_parsed_at":"2025-05-06T21:32:20.539Z","dependency_job_id":"1799b2e7-dc92-4a99-afc2-2048cd87e946","html_url":"https://github.com/facebook/chisel","commit_stats":{"total_commits":332,"total_committers":82,"mean_commits":4.048780487804878,"dds":0.8674698795180723,"last_synced_commit":"e9a3904ef35404dbfcdbedeace1ddef5391ce7a6"},"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/facebook%2Fchisel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/facebook%2Fchisel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/facebook%2Fchisel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/facebook%2Fchisel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/facebook","download_url":"https://codeload.github.com/facebook/chisel/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254129467,"owners_count":22019628,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-01-05T20:15:38.361Z","updated_at":"2025-05-14T11:02:38.699Z","avatar_url":"https://github.com/facebook.png","language":"Python","funding_links":[],"categories":["Debugging","\u003ca id=\"004d0b9e325af207df8e1ca61af7b721\"\u003e\u003c/a\u003eLLDB","awesome-ios ##","Python","调试","HarmonyOS","Code Quality","Tools","Python (1887)","\u003ca id=\"8c5a692b5d26527ef346687e047c5c21\"\u003e\u003c/a\u003e收集"],"sub_categories":["Getting Started","\u003ca id=\"c20772abc204dfe23f3e946f8c73dfda\"\u003e\u003c/a\u003e工具","Other free courses","Windows Manager","Linter"],"readme":"\u003ca href=\"https://opensource.facebook.com/support-ukraine\"\u003e\n  \u003cimg src=\"https://img.shields.io/badge/Support-Ukraine-FFD500?style=flat\u0026labelColor=005BBB\" alt=\"Support Ukraine - Help Provide Humanitarian Aid to Ukraine.\" /\u003e\n\u003c/a\u003e\n\n# Chisel\n`Chisel` is a collection of `LLDB` commands to assist in the debugging of iOS apps.\n\n[[Installation](#installation) \u0026bull; [Commands](#commands) \u0026bull; [Custom Commands](#custom-commands) \u0026bull; [Development Workflow](#development-workflow) [Contributing](#contributing) \u0026bull; [License](#license)]\n\nFor a comprehensive overview of LLDB, and how Chisel complements it, read Ari Grant's [Dancing in the Debugger — A Waltz with LLDB](http://www.objc.io/issue-19/lldb-debugging.html) in issue 19 of [objc.io](http://www.objc.io/).\n\n## Installation\n\n```shell\nbrew update\nbrew install chisel\n```\n\nif `.lldbinit` file doesn't exist you can create it \u0026 open it by tapping on the terminal\n\n ```shell\n touch .lldbinit\n open .lldbinit\n```\n\nThen add the following line to your `~/.lldbinit` file.\n\n```Python\n# ~/.lldbinit\n...\ncommand script import /usr/local/opt/chisel/libexec/fbchisellldb.py\n```\n\n* Note that if you are installing on an M1 Mac, the path above should be `/opt/homebrew/opt/chisel/libexec/fbchisellldb.py` instead.\n\nAlternatively, download chisel and add the following line to your _~/.lldbinit_ file.\n\n```Python\n# ~/.lldbinit\n...\ncommand script import /path/to/fbchisellldb.py\n\n```\n\nThe commands will be available the next time `Xcode` starts.\n\n## Commands\nThere are many commands; here's a few:\n*(Compatibility with iOS/Mac indicated at right)*\n\n|Command          |Description     |iOS    |OS X   |\n|-----------------|----------------|-------|-------|\n|pviews           |Print the recursive view description for the key window.|Yes|Yes|\n|pvc              |Print the recursive view controller description for the key window.|Yes|No|\n|visualize        |Open a `UIImage`, `CGImageRef`, `UIView`, `CALayer`, `NSData` (of an image), `UIColor`, `CIColor`, `CIImage`, `CGColorRef` or `CVPixelBuffer` in Preview.app on your Mac.|Yes|No|\n|fv               |Find a view in the hierarchy whose class name matches the provided regex.|Yes|No|\n|fvc              |Find a view controller in the hierarchy whose class name matches the provided regex.|Yes|No|\n|show/hide        |Show or hide the given view or layer. You don't even have to continue the process to see the changes!|Yes|Yes|\n|mask/unmask      |Overlay a view or layer with a transparent rectangle to visualize where it is.|Yes|No|\n|border/unborder  |Add a border to a view or layer to visualize where it is.|Yes|Yes|\n|caflush          |Flush the render server (equivalent to a \"repaint\" if no animations are in-flight).|Yes|Yes|\n|bmessage         |Set a symbolic breakpoint on the method of a class or the method of an instance without worrying which class in the hierarchy actually implements the method.|Yes|Yes|\n|wivar            |Set a watchpoint on an instance variable of an object.|Yes|Yes|\n|presponder       |Print the responder chain starting from the given object.|Yes|Yes|\n|...              |... and many more!|\n\nTo see the list of **all** of the commands execute the help command in `LLDB` or go to the [Wiki](https://github.com/facebook/chisel/wiki).\n\n```Python\n(lldb) help\nThe following is a list of built-in, permanent debugger commands:\n...\n\nThe following is a list of your current user-defined commands:\n...\n```\n\nThe bottom list contains all the commands sourced from `Chisel`.\n\nYou can also inspect a specific command by passing its name as an argument to the help command (as with all other `LLDB` commands).\n\n```\n(lldb) help border\nDraws a border around \u003cviewOrLayer\u003e. Color and width can be optionally provided.\n\nArguments:\n  \u003cviewOrLayer\u003e; Type: UIView*; The view to border.\n\nOptions:\n  --color/-c \u003ccolor\u003e; Type: string; A color name such as 'red', 'green', 'magenta', etc.\n  --width/-w \u003cwidth\u003e; Type: CGFloat; Desired width of border.\n\nSyntax: border [--color=color] [--width=width] \u003cviewOrLayer\u003e\n```\n\nAll of the commands provided by `Chisel` come with verbose help. Be sure to read it when in doubt!\n\n## Custom Commands\nYou can add local, custom commands. Here's a contrived example.\n\n```python\n#!/usr/bin/python\n# Example file with custom commands, located at /magical/commands/example.py\n\nimport lldb\nimport fbchisellldbbase as fb\n\ndef lldbcommands():\n  return [ PrintKeyWindowLevel() ]\n\nclass PrintKeyWindowLevel(fb.FBCommand):\n  def name(self):\n    return 'pkeywinlevel'\n\n  def description(self):\n    return 'An incredibly contrived command that prints the window level of the key window.'\n\n  def run(self, arguments, options):\n    # It's a good habit to explicitly cast the type of all return\n    # values and arguments. LLDB can't always find them on its own.\n    lldb.debugger.HandleCommand('p (CGFloat)[(id)[(id)[UIApplication sharedApplication] keyWindow] windowLevel]')\n```\n\nThen all that's left is to source the commands in lldbinit. `Chisel` has a python function just for this, _loadCommandsInDirectory_ in the _fbobjclldb.py_ module.\n\n```Python\n# ~/.lldbinit\n...\ncommand script import /path/to/fbobjclldb.py\nscript fbobjclldb.loadCommandsInDirectory('/magical/commands/')\n\n```\n\nThere's also builtin support to make it super easy to specify the arguments and options that a command takes. See the _border_ and _pinvocation_ commands for example use.\n\n## Development Workflow\nDeveloping commands, whether for local use or contributing to `Chisel` directly, both follow the same workflow. Create a command as described in the [Custom Commands](#custom-commands) section and then\n\n1. Start `LLDB`\n2. Reach a breakpoint (or simply pause execution via the pause button in `Xcode`'s debug bar or `process interrupt` if attached directly)\n3. Execute `command source ~/.lldbinit` in LLDB to source the commands\n4. Run the command you are working on\n5. Modify the command\n6. Optionally run `script reload(modulename)`\n7. Repeat steps 3-6 until the command becomes a source of happiness\n\n## Contributing\nPlease contribute any generic commands that you make. If it helps you then it will likely help many others! :D See `CONTRIBUTING.md` to learn how to contribute.\n\n## License\n`Chisel` is MIT-licensed. See `LICENSE`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffacebook%2Fchisel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffacebook%2Fchisel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffacebook%2Fchisel/lists"}