{"id":13453916,"url":"https://github.com/automation-stack/ctrace","last_synced_at":"2025-04-28T02:31:28.328Z","repository":{"id":66169305,"uuid":"60268854","full_name":"automation-stack/ctrace","owner":"automation-stack","description":"Well-formatted and improved trace system calls and signals (when the debugger does not help)","archived":false,"fork":false,"pushed_at":"2019-11-18T14:59:28.000Z","size":2227,"stargazers_count":120,"open_issues_count":0,"forks_count":9,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-05T05:11:43.767Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/automation-stack.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,"governance":null}},"created_at":"2016-06-02T14:02:30.000Z","updated_at":"2025-03-19T13:43:54.000Z","dependencies_parsed_at":"2023-10-20T18:08:12.990Z","dependency_job_id":null,"html_url":"https://github.com/automation-stack/ctrace","commit_stats":{"total_commits":25,"total_committers":2,"mean_commits":12.5,"dds":"0.040000000000000036","last_synced_commit":"be380f921e4f0aa366eacfcbebadf49d6578ea0b"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/automation-stack%2Fctrace","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/automation-stack%2Fctrace/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/automation-stack%2Fctrace/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/automation-stack%2Fctrace/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/automation-stack","download_url":"https://codeload.github.com/automation-stack/ctrace/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251238044,"owners_count":21557388,"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-07-31T08:00:49.257Z","updated_at":"2025-04-28T02:31:28.079Z","avatar_url":"https://github.com/automation-stack.png","language":"JavaScript","readme":"# ctrace\nWell-formatted and improved trace system calls and signals (when the debugger does not help).\n\n\u003cimg src=\"http://g.recordit.co/AKdHxKdzqy.gif\" width=\"45%\"/\u003e\n\u003cimg src=\"http://g.recordit.co/66Xzz2TGHS.gif\" width=\"45%\"/\u003e\n\n## Why?\nAwesome tools ```strace``` and ```dtruss``` have only one drawback: too much information which is hard to understand without additional sources of information and various configuration options. ```ctrace``` resolves it.\n\n```ctrace``` are indispensable in the following cases\n   - Debugging complex performance issues or not identified unhandled errors and exceptions in own code or someone else's code\n   - Learning OS kernel\n\n## Let's try it!\n\nWhat do you think how difficult it is to display a hint for using CLI utility, let us say NPM?\n\n```\n\u003e ctrace -c \"npm --help\"\n```\nWhat we see?! What NPM does to simply display help?\n- over 6800 system calls elapsed over 650 msec!\n- 7 child processes :open_mouth:\n- aims to open over 400 files\n\n**Сlearly there is something to improve!** :muscle:\n\n\u003cimg width=\"70%\" src=\"data/npm.png\" /\u003e\n\n## Features\n\n- Supported platforms: OSx (dtruss), Linux (strace)\n- Trace command or attach to process (with forks following)\n- Syscall details in output (number, description, synonyms, is it platform specific syscall) \u003cbr\u003e ``` pread (preadv), 534 -- read or write data into multiple ```\n- Resolving errno in syscall result \u003cbr\u003e ```Err#22 -\u003e EINVAL : Invalid argument``` (only OSx)\n- Prints by default only syscall with errors, with ```-v``` prints all output\n- Filter output with syscall list ``` -f \"lstat,open\" ```\n\n## Installation\n```sh\n$\u003e npm install -g ctrace\n```\n\n```\n$\u003e ctrace --help\n\nUsage: ctrace [options]\n\n ctrace - well-formatted and improved trace system calls and signals\n\n Options:\n\n   -h, --help               output usage information\n   -V, --version            output the version number\n   -p, --pid [pid]          process id to trace\n   -c, --cmd [cmd]          command to trace\n   -f, --filter [syscall,]  trace syscall only from list\n   -v, --verbose            print all syscalls (by default only with errors)\n\n Examples:\n\n   $ ctrace -p 2312 -v\n   $ ctrace -c \"ping google.com\"\n```\n\n## Troubleshooting\n\n### OSx : Dtrace cannot control executables signed with restricted entitlements\n\nAs you may know Apple released their new OS X revision 10.11 this year with a great security feature built-in: System Integrity Protection. In a nutshell, this mechanism protects any system data and important filesystem components (like /System or /usr) from being modified by user; even if they are root. SIP also disables any use of code-injection and debugging techniques for third-party software, so some of your favorite hacks may not work anymore.\n...\n\n#### Completely disable SIP\n\nAlthough not recommended by Apple, you can entirely disable System Integrity Protection on you Mac. Here's how:\n\nBoot your Mac into Recovery Mode: reboot it and hold cmd+R until a progress bar appears.\nChoose the language and go to Utilities menu. Choose Terminal there.\nEnter this command to disable System Integrity Protection:\n```\n$\u003e csrutil disable\n```\nIt will ask you to reboot — do so and you're free from SIP!\n\nhttp://internals.exposed/blog/dtrace-vs-sip.html#fnref1\n","funding_links":[],"categories":["Packages","Repository","JavaScript","包","Debugging / Profiling","目录"],"sub_categories":["Debugging / Profiling","Debugging","调试 / 分析","调试/分析","调试"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fautomation-stack%2Fctrace","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fautomation-stack%2Fctrace","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fautomation-stack%2Fctrace/lists"}