{"id":17297037,"url":"https://github.com/adamniederer/cargo-disassemble","last_synced_at":"2025-10-17T21:14:36.288Z","repository":{"id":57534228,"uuid":"131351653","full_name":"AdamNiederer/cargo-disassemble","owner":"AdamNiederer","description":"Disassemble your Rust project with Cargo","archived":false,"fork":false,"pushed_at":"2018-04-28T18:38:25.000Z","size":20,"stargazers_count":19,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-28T00:44:02.035Z","etag":null,"topics":["cargo-subcommand","command-line","disassembly","optimization"],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AdamNiederer.png","metadata":{"files":{"readme":"README.org","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-04-27T22:51:26.000Z","updated_at":"2024-05-10T10:13:44.000Z","dependencies_parsed_at":"2022-09-26T18:21:30.683Z","dependency_job_id":null,"html_url":"https://github.com/AdamNiederer/cargo-disassemble","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AdamNiederer%2Fcargo-disassemble","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AdamNiederer%2Fcargo-disassemble/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AdamNiederer%2Fcargo-disassemble/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AdamNiederer%2Fcargo-disassemble/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AdamNiederer","download_url":"https://codeload.github.com/AdamNiederer/cargo-disassemble/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248871675,"owners_count":21175270,"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":["cargo-subcommand","command-line","disassembly","optimization"],"created_at":"2024-10-15T11:14:31.974Z","updated_at":"2025-10-17T21:14:36.173Z","avatar_url":"https://github.com/AdamNiederer.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"* cargo-disassemble\nEasily disassemble your Rust project\n\n** Usage\n~cargo-disassemble~ attempts to emulate the command-line interface of other\ncargo subcommands. Notice that the ~function~ argument is optional - not\nincluding it will disassemble all functions in the current crate.\n\n#+BEGIN_SRC text\n  USAGE:\n      cargo-disassemble [FLAGS] [OPTIONS] [function]\n\n  FLAGS:\n          --all-features           Enable all features\n          --everything             Include functions not defined by the current crate\n      -h, --help                   Prints help information\n          --intel                  Emit intel-flavored x86 ASM\n          --no-default-features    Enable no_default features\n          --optimize               Optimize the binary as much as possible\n          --release                Compile in release mode\n      -V, --version                Prints version information\n\n  OPTIONS:\n          --features \u003cfeatures\u003e    Features to enable, if any\n\n  ARGS:\n      \u003cfunction\u003e    The name of the function to be decompiled\n#+END_SRC\n** Example\nGiven the function:\n\n#+BEGIN_SRC rust\n#[inline(never)]\nfn is_branch_label(line: \u0026str) -\u003e bool {\n    line.starts_with(\".LBB\")\n}\n#+END_SRC\n\nwe can disassemble the optimized version of ~is_branch_label~ with the following\ncommand:\n\n#+BEGIN_SRC shell\n$ cargo disassemble is_branch_label --release --optimize --intel\n#+END_SRC\n\nwhich will yield this result:\n\n#+BEGIN_SRC asm\ncargo_disassemble::is_branch_label\n        cmp\trsi, 4\n        je\t.LBB66_4\n        cmp\trsi, 5\n        jb\t.LBB66_3\n        cmp\tbyte ptr [rdi + 4], -65\n        jle\t.LBB66_3\n.LBB66_4:\n        push\trbp\n        mov\trbp, rsp\n        sub\trsp, 16\n        mov\tqword ptr [rbp - 16], rdi\n        mov\tqword ptr [rbp - 8], rsi\n        mov\tal, 1\n        lea\trcx, [rip + .Lbyte_str.1e]\n        cmp\trdi, rcx\n        lea\trsp, [rsp + 16]\n        pop\trbp\n        je\t.LBB66_6\n        cmp\tdword ptr [rdi], 1111641134\n        je\t.LBB66_6\n.LBB66_3:\n        xor\teax, eax\n        ret\n#+END_SRC\n** Caveats\nWhen compiling in release mode, rustc will often aggressively inline smaller\nfunctions. Because inlined functions typically don't have a freestanding copy\nin the final binary, they may not be disassembled. Adding the ~#[inline(never)]~\nattribute to a function will ensure it's included, but may also change the code\nwithin the function.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadamniederer%2Fcargo-disassemble","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadamniederer%2Fcargo-disassemble","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadamniederer%2Fcargo-disassemble/lists"}