{"id":38135498,"url":"https://github.com/bieganski/trace-no-bcc","last_synced_at":"2026-01-16T22:41:11.684Z","repository":{"id":272988312,"uuid":"918376472","full_name":"bieganski/trace-no-bcc","owner":"bieganski","description":"[eBPF] trace any user or kernel space function in pure Python","archived":false,"fork":false,"pushed_at":"2025-06-05T09:52:38.000Z","size":1195,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-05T10:19:14.289Z","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":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bieganski.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-01-17T19:59:57.000Z","updated_at":"2025-05-06T14:14:48.000Z","dependencies_parsed_at":"2025-06-05T10:19:11.297Z","dependency_job_id":"4b46e4f6-5a4a-4405-b5ec-348cf4c5324a","html_url":"https://github.com/bieganski/trace-no-bcc","commit_stats":null,"previous_names":["bieganski/trace-no-bcc"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/bieganski/trace-no-bcc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bieganski%2Ftrace-no-bcc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bieganski%2Ftrace-no-bcc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bieganski%2Ftrace-no-bcc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bieganski%2Ftrace-no-bcc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bieganski","download_url":"https://codeload.github.com/bieganski/trace-no-bcc/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bieganski%2Ftrace-no-bcc/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28485617,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-16T11:59:17.896Z","status":"ssl_error","status_checked_at":"2026-01-16T11:55:55.838Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":[],"created_at":"2026-01-16T22:41:11.482Z","updated_at":"2026-01-16T22:41:11.616Z","avatar_url":"https://github.com/bieganski.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Use cases\n\n* debugging without recompilation\n* low-overhead execution profiling\n\n# Example\n\n```bash\ngit clone https://github.com/bieganski/trace-no-bcc \u0026\u0026 cd trace-no-bcc\n\n# Trace all PIDs calling function `malloc` from standard C library\nsudo ./ftrace.py user /lib/x86_64-linux-gnu/libc.so.6 malloc\n```\n\n```\n[PID,TID]        [library:symbol]   info\n[2757970,2757970][libc.so.6:malloc] REENTRY after 0.0003231 seconds di=0x18, si=0x578612b12010, dx=0xa, cx=0x578619310e38, r8=0x5786193473d0, r9=0x7434841cd3e0, r10=0x578618e959a0\n[2757970,2757970][libc.so.6:malloc] RET (ax=0x5786193473d0) exec_time_ns: 0.0000015 seconds\n[3212955,3212955][libc.so.6:malloc] REENTRY after 0.0000060 seconds di=0x18, si=0x18, dx=0x18, cx=0x7717283147e2, r8=0x7717283d1460, r9=0x7ffc2beda170, r10=0x0\n[3212955,3212955][libc.so.6:malloc] RET (ax=0x5a0fd5ad36e0) exec_time_ns: 0.0000017 seconds\n[3212955,3212955][libc.so.6:malloc] REENTRY after 0.0000145 seconds di=0x271, si=0xa, dx=0x34, cx=0x22062041, r8=0x1999999999999999, r9=0x26f, r10=0x271\n[3212955,3212955][libc.so.6:malloc] RET (ax=0x5a0fd5ad7e10) exec_time_ns: 0.0000017 seconds\n[3212955,3212955][libc.so.6:malloc] REENTRY after 0.0000061 seconds di=0x23, si=0x23, dx=0x23, cx=0x7717283147e2, r8=0x7717283d1460, r9=0x7ffc2beda170, r10=0x0\n...\n```\n\n\n```bash\n# Trace all invocations of kernel function __x64_sys_mount (see /proc/kallsyms)\n sudo ./ftrace.py kernel __x64_sys_mount\n```\n\n```\n[1715601,1715601][\u003ckernel\u003e:__x64_sys_mount] FIRST ENTRY di=0xffffb851470dff58, si=0xa5, dx=0x0, cx=0x0, r8=0x0, r9=0x0, r10=0x0\n[1715601,1715601][\u003ckernel\u003e:__x64_sys_mount] RET (ax=0xfffffffffffffffe) exec_time_ns: 0.0000153 seconds\n[1715604,1715604][\u003ckernel\u003e:__x64_sys_mount] FIRST ENTRY di=0xffffb85147117f58, si=0xa5, dx=0x0, cx=0x0, r8=0x0, r9=0x0, r10=0x0\n[1715604,1715604][\u003ckernel\u003e:__x64_sys_mount] RET (ax=0xfffffffffffffffe) exec_time_ns: 0.0000164 seconds\n```\n\n# Features\n\n* **userspace code tracing** (either by symbol name or file offset)\n* **kernel code tracing** (either by symbol name or kernel virtual memory address)\n* [userspace] tracing either shared library code or executable directly\n* [userspace] filtering userspace tracee by PID or tracing all PIDs system-wide\n* multi-arch, easily extensible\n\n\n\n# But.. What if the code that I need to trace is not a global symbol, or is in the middle of a function?\n\nIn that case instead of specifying symbol name as an argument, you can pass file offset in hex. In my case, configuration `/lib/x86_64-linux-gnu/libc.so.6 malloc` is equivalent to `/lib/x86_64-linux-gnu/libc.so.6 0xa50a0`, as `0xa50a0` is the file offset (inside an ELF) to the first instruction of `malloc` function:\n\n```bash\nm.bieganski@hostname:~$ nm -D  /lib/x86_64-linux-gnu/libc.so.6  | grep \"T malloc\"\n00000000000a50a0 T malloc@@GLIBC_2.2.5\n```\n\nHow can you get detailed information of function-file offset mapping? Either use `objdump -Fd`, or better try [dwarfseeker](https://github.com/bieganski/dwarfseeker/) (the latter will tell you even inline expansions! Just keep in mind that it requires debug symbols present).\n\n\n# Runtime requirements\n* Linux kernel compiled with CONFIG_BPF_SYSCALL=y (almost certainly true)\n* CPython (almost certainly you have it)\n* libbpf, v1.4.0 or higher. Either install via `apt-get`-like, or use one ([shipped by us](./libbpf/x86_64/libbpf.so.1)) (latter is default, we download it from `rpmfind.net` using [dload_libbpf.sh](./dload_libbpf.sh))\n\n# Runtime non-requirements :)\n* No `requirements.txt` - only Python standard libraries\n* No BCC, no libbcc\n* No LLVM, no Clang*\n* No `CO-RE` nor `vmlinux` required from kernel\n\n`*` - actually optionally it can be used, see [Blob paranoid](#blob-paranoid) section.\n\n# Supported CPU architectures\n* x86_64 (64 bit)\n* armv7l (32 bit)\n* RISC-V (64 bit)\n\n# Distribution\n* we are bound by `libbpf`'s license, so it's `LGPL-2.1 OR BSD-2-Clause`.\n\n# Complementary tools\n* [lib_get_pub_funcs.sh](./lib_get_pub_funcs.sh) - prints all function names that given shared library exposes. sample use case: `sudo ./ftrace.py user path/to/lib.so $(./lib_get_pub_funcs.sh path/to/lib.so)`\n\n# Blob paranoid?\n\nUnder the hood `sudo ftrace.py` loads `uprobe.bpf.o` into your kernel. For full transparency, use [build_bpf.sh](./build_bpf.sh) in order to build `uprobe.bpf.o` from [uprobe.bpf.c](./uprobe.bpf.c). Requires `clang` and `llvm` packages.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbieganski%2Ftrace-no-bcc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbieganski%2Ftrace-no-bcc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbieganski%2Ftrace-no-bcc/lists"}