{"id":23536532,"url":"https://github.com/hgn/machine-code-analyzer","last_synced_at":"2025-08-08T23:13:43.697Z","repository":{"id":16145940,"uuid":"18891516","full_name":"hgn/machine-code-analyzer","owner":"hgn","description":"Machine Code Analyzer for X86(_64) ISA","archived":false,"fork":false,"pushed_at":"2021-03-05T21:41:47.000Z","size":111,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-14T23:08:31.019Z","etag":null,"topics":["assembler","branch","disassembler","instruction-analyzer","jump-analyzer","kernel","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hgn.png","metadata":{"files":{"readme":"README.md","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":"2014-04-17T19:52:43.000Z","updated_at":"2024-01-30T19:26:56.000Z","dependencies_parsed_at":"2022-08-26T21:54:18.866Z","dependency_job_id":null,"html_url":"https://github.com/hgn/machine-code-analyzer","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/hgn/machine-code-analyzer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hgn%2Fmachine-code-analyzer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hgn%2Fmachine-code-analyzer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hgn%2Fmachine-code-analyzer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hgn%2Fmachine-code-analyzer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hgn","download_url":"https://codeload.github.com/hgn/machine-code-analyzer/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hgn%2Fmachine-code-analyzer/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269502567,"owners_count":24427790,"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","status":"online","status_checked_at":"2025-08-08T02:00:09.200Z","response_time":72,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["assembler","branch","disassembler","instruction-analyzer","jump-analyzer","kernel","python"],"created_at":"2024-12-26T02:29:20.615Z","updated_at":"2025-08-08T23:13:43.651Z","avatar_url":"https://github.com/hgn.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Machine Code Analyzer #\n\nA two pass code analyzer for x86 and x86\\_64, requires debug symbols for full\nanalyze capabilities.\n\n## Modules ##\n\n### Function Local Branch and Jump Analyzer ###\n\nAnalyze local jump instructions. \"Local\" refers to jumps within the function\nspace - function calls and long jumps are not analyzed by this module.\n\nFollowing data calcalated:\n\n- Jump analyzer\n  - Number of jumps\n  - Average jump distance in bytes\n  - Minimal jump distance in bytes\n  - Maximal jump distance in bytes\n  - Histogram of jumps\n- Forward jump analyzer\n  - Number of jumps\n  - Average jump distance in bytes\n  - Minimal jump distance in bytes\n  - Maximal jump distance in bytes\n  - Histogram of jumps\n- Number of backward jumps per function\n  - Number of jumps\n  - Average jump distance in bytes\n  - Minimal jump distance in bytes\n  - Maximal jump distance in bytes\n  - Histogram of jumps\n\n\n\n#### Usage ####\n\n```\n# instruction-layout-analyzer --function-branch-jump \u003cbinary\u003e\n```\n\n### Function Anatomy Analyzer ###\n\nStarted as an internal module for other modules this module provides\ninformation about the function start and end addresses, the size of a function\nand the number of functions.\n\n\n#### Usage ####\n\n```\n# instruction-layout-analyzer --function-anatomy \u003cbinary\u003e\n```\n\n\n# FAQ #\n\n## Sometimes instruction analyzer and readelf differs from the code size - why? ##\n\nConsider the following end of an function:\n\n\n```gas\n405021:       5d                      pop    %rbp\n405022:       c3                      retq\n405023:       66 2e 0f 1f 84 00 00    nopw   %cs:0x0(%rax,%rax,1)\n40502a:       00 00 00\n40502d:       0f 1f 00                nopl   (%rax)\n```\n\nWhat you see here are alignmend padding in form of NOP instructions (13 byte).\nThe code actual function end at retq instruction. The subsequent code is now\naligned at 0x405030, better for cachelines, etc.  The question now is: should\nthe instruction analayzer account the padding instructions or not? Feel free\nand verify code with\n\n```\nreadelf -s \u003cbinary\u003e\n```\n\nNOPs are mostly generated and added by GAS (GNU assembler if using GCC). There\nare other ways as well to decode NOPs:  xchg %ax,%ax (two byte), leal\n0(%esi),%esi (three byte).\n\nLast note: the assembler should always pad with as less instruction as possible\nto relax CPU prefetcher and subsequent CPU logic.\n\n\n# JSON to Chart.js Converter #\n\nTo generate charts a helper script comes bundled with instruction-layout-analyzer.\n\n# ToDo #\n\n## Function Gap Analysis ##\n\nSize in bytes from function end to next function start. Function alignment\ncharacteristics and the resulting effect of \"wasted\" memory is of interest.\nEspecially for small and tiny functions\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhgn%2Fmachine-code-analyzer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhgn%2Fmachine-code-analyzer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhgn%2Fmachine-code-analyzer/lists"}