{"id":16842660,"url":"https://github.com/rofl0r/debuglib","last_synced_at":"2025-04-11T05:52:32.836Z","repository":{"id":6173734,"uuid":"7403683","full_name":"rofl0r/debuglib","owner":"rofl0r","description":"wrapper library for the functionality offered by ptrace. features facilities to enter breakpoint, debug and hook syscalls, etc.","archived":false,"fork":false,"pushed_at":"2022-04-06T22:09:34.000Z","size":101,"stargazers_count":21,"open_issues_count":0,"forks_count":7,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-11T05:52:27.885Z","etag":null,"topics":["c","debugger","debugging","library","ptrace","strace","tracer"],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rofl0r.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-01-02T07:48:23.000Z","updated_at":"2024-10-08T23:35:55.000Z","dependencies_parsed_at":"2022-07-07T00:32:46.094Z","dependency_job_id":null,"html_url":"https://github.com/rofl0r/debuglib","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rofl0r%2Fdebuglib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rofl0r%2Fdebuglib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rofl0r%2Fdebuglib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rofl0r%2Fdebuglib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rofl0r","download_url":"https://codeload.github.com/rofl0r/debuglib/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248351409,"owners_count":21089271,"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":["c","debugger","debugging","library","ptrace","strace","tracer"],"created_at":"2024-10-13T12:47:47.239Z","updated_at":"2025-04-11T05:52:32.816Z","avatar_url":"https://github.com/rofl0r.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"debuglib - a convenience wrapper around ptrace\n==============================================\n\nthis library tries to abstract away arch-specific differences for ptrace(),\nand provide a neater, consistent high-level interface.\n\n- provides facilities to set breakpoints,\n- execute till breakpoint,\n- single-step processes,\n- read and write from process memory,\n- hook syscalls and read and modify syscall arguments\n\nit was written with the idea of writing a custom ncurses debugger without\nhaving to remote-control gdb. using the provided primitives it is quite\neasy to write an asm-level debugger like ollydbg, but for a source-\nbased debugger like gdb it is required to deal with the different DWARF\nformats, which are quite complicated.\n\nthe API is unstable at this moment.\nthere are working examples for a debugger and syscall hooks in the\ntests/ directory.\n\ndebuglib was designed for use with the\n[RcB2](https://github.com/rofl0r/rcb2) build tool, and depends on my\nmulti-purpose C library [libulz](https://github.com/rofl0r/libulz),\nwhich provides some data structures such as hashmaps and lists.\n\nHow to build the filetracer example program\n-------------------------------------------\n\n\tcd /tmp\n\tmkdir debuglib-0000\n\tcd debuglib-0000/\n\tgit clone https://github.com/rofl0r/debuglib\n\tgit clone https://github.com/rofl0r/libulz lib\n\tgit clone https://github.com/rofl0r/rcb2\n\texport PATH=$PATH:/tmp/debuglib-0000/rcb2\n\tln -s /tmp/debuglib-0000/rcb2/rcb2.py /tmp/debuglib-0000/rcb2/rcb2\n\tcd debuglib/tests\n\trcb2 filetrace.c\n\nKnown bugs:\n-----------\nthere are 2 ways to use the ptrace(2) api: the old method is using\n`PTRACE_ATTACH`, this is what the library currently uses.\nit has one major problem, which is the inability to properly deal with\n`SIGSTOP`/`SIGTSTP` received by a child when tracing.\ntherefore a new API was designed that uses `PTRACE_SEIZE` instead.\ni was unaware of the issue when designing this library and using the new\nseize API instead would require a major rewrite, and more costly, re-test\nof all the functionality.\nfortunately processes sending SIGSTOP to subprocesses occur quite rarely,\nso the issue is encountered only in rare cases.\nthe issue can be reproduced by creating a shell script with the content\n\n    msgmerge --update -q /dev/null /dev/null\n\non debian sid i386 at the time of this writing, and then executing\n\n    DEBUG=1 idfake sh foo.sh\n\nusing the supplied idfake example program.\nThis result in the program hanging forever.\nthe rather well-known program `proot` is victim to the same design issue.\nrecent versions of `strace` otoh use the new seize API when available.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frofl0r%2Fdebuglib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frofl0r%2Fdebuglib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frofl0r%2Fdebuglib/lists"}