/strace-ltrace
strace and ltrace skill for system call and library call tracing. Use when a binary behaves incorrectly without crashing, diagnosing file-not-found errors, permission failures, network issues, or unexpected library calls by tracing syscalls and library function calls. Activates
$ npx -y skills add mohitmishra786/low-level-dev-skills --skill strace-ltrace --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
- Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
- You can call itInvoke it directly when you want it.
- Slash command
/strace-ltrace
Context preview
The summary Claude sees to decide when to auto-load this skill.
strace and ltrace skill for system call and library call tracing. Use when a binary behaves incorrectly without crashing, diagnosing file-not-found errors, permission failures, network issues, or unexpected library calls by tracing syscalls and library function calls. Activates
SKILL.md
strace-ltrace.SKILL.mdname: strace-ltrace
description: strace and ltrace skill for system call and library call tracing. Use when a binary behaves incorrectly without crashing, diagnosing file-not-found errors, permission failures, network issues, or unexpected library calls by tracing syscalls and library function calls. Activates on queries about strace, ltrace, syscall tracing, library interception, ENOENT, EPERM, strace -e, or diagnosing binary behaviour without a debugger.
strace / ltrace
Purpose
Guide agents through tracing system calls with `strace` and library calls with `ltrace` — the most effective tools for diagnosing incorrect binary behaviour without a crash or debugger.
Triggers
- "My program behaves incorrectly — how do I trace what it's doing?"
- "How do I find what files a binary is opening?"
- "strace shows ENOENT — how do I interpret it?"
- "How do I trace network calls with strace?"
- "What is ltrace and how does it differ from strace?"
- "How do I trace a running process?"
Workflow
1. Basic strace usage
# Trace all syscalls of a command
strace ./myapp arg1 arg2
# Attach to running process
strace -p 12345
# Trace child processes too (-f = follow fork)
strace -f ./myapp
# Save to file (raw output — not stdout)
strace ./myapp 2> trace.txt
# Most useful: timestamps + summary
strace -t -f ./myapp 2>&1 | head -100
2. Filter by syscall category
# Trace file operations only
strace -e trace=file ./myapp
# Trace network syscalls
strace -e trace=network ./myapp
# Trace specific syscalls
strace -e trace=open,openat,read,write ./myapp
# Trace process management
strace -e trace=process ./myapp
# Trace memory operations
strace -e trace=memory ./myapp
# Trace signals
strace -e trace=signal ./myapp
# Multiple categories
strace -e trace=file,network ./myapp
| Category | Syscalls included | |----------|------------------| | `file` | open, openat, stat, access, unlink, rename, ... | | `network` | socket, connect, bind, accept, send, recv, ... | | `process` | fork, exec, wait, clone, exit, ... | | `memory` | mmap, munmap, mprotect, brk, ... | | `signal` | kill, sigaction, sigprocmask, ... | | `ipc` | pipe, socket pair, shmget, ... | | `desc` | close, dup, poll, select, epoll, ... |
3. Interpreting common errors
# See return values and errors
strace -e trace=file ./myapp 2>&1 | grep -E "ENOENT|EPERM|EACCES|ENOTSUP"
| Error | Meaning | Common cause | |-------|---------|-------------| | `ENOENT` | No such file or directory | Config file missing, wrong path | | `EACCES` | Permission denied | File permissions, SELinux | | `EPERM` | Operation not permitted | Missing capability, suid needed | | `EADDRINUSE` | Address already in use | Port already bound | | `ETIMEDOUT` | Connection timed out | Network unreachable, firewall | | `ECONNREFUSED` | Connection refused | Server not listening | | `EAGAIN` | Resource temporarily unavailable | Non-blocking I/O, try again | | `ENOMEM` | Out of memory | Allocation failed | | `EBADF` | Bad file descriptor | Using closed/invalid fd | | `ENOEXEC` | Exec format error | Wrong binary format for arch |
# Find what file is not found
strace ./myapp 2>&1 | grep 'ENOENT'
# Example output:
# openat(AT_FDCWD, "/etc/myapp.conf", O_RDONLY) = -1 ENOENT (No such file or directory)
# → Config file expected at /etc/myapp.conf
4. Useful strace flags
# Show strings fully (default truncates at 32 chars)
strace -s 256 ./myapp
# Timestamps
strace -t ./myapp # wall clock time
strace -T ./myapp # time spent in each syscall
strace -r ./myapp # relative timestamps
# System call count summary
strace -c ./myapp
# Shows count, time, errors per syscall — great for profiling
# Trace with PIDs in output (for -f)
strace -f -p ./myapp
# Output: [pid 12346] open("/etc/passwd", O_RDONLY) = 3
# Decode numerical arguments
strace -e verbose=all ./myapp
# Print instruction pointer at each syscall
strace -i ./myapp5. ltrace — library call tracing
# Trace all library calls
ltrace ./myapp
# Trace specific library function
ltrace -e malloc,free,fopen ./myapp
# Trace nested calls (lib → lib)
ltrace -n 2 ./myapp # indent nested calls
# Trace with syscalls too
ltrace -S ./myapp
# Attach to running process
ltrace -p 12345
# Summary statistics
ltrace -c ./myapp
Typical ltrace output:
malloc(1024) = 0x55a1b2c3d000
fopen("/etc/myapp.conf", "r") = 0
free(0x55a1b2c3d000) = <void>strace vs ltrace:
| | strace | ltrace | |--|--------|--------| | Traces | Kernel syscalls | User-space library calls | | Overhead | Lower | Higher (PLT hooking) | | Shows | `open()`, `read()`, `write()` | `fopen()`, `malloc()`, `printf()` | | Use when | Binary interacts with OS/files/network | Binary calls library functions you can't see |
6. Practical diagnosis workflows
# Find missing config file
strace -e trace=openat,open ./myapp 2>&1 | grep ENOENT
# Find what network connections are made
strace -e trace=network -f ./myapp 2>&1 | grep connect
# Debug dynamic library loading failures
strace -e trace=openat ./myapp 2>&1 | grep "\.so"
# Find permission issues
strace -e trace=file ./myapp 2>&1 | grep -E "EACCES|EPERM"
# Debug slow startup (find where time is spent)
strace -c ./myapp 2>&1
# Look for high % time in unexpected syscalls
# Watch IPC/shared memory
strace -e trace=ipc,shm ./myapp
# Find what the binary exec's
strace -e trace=execve -f ./myapp
7. seccomp filter debugging
If a program is killed by a seccomp policy, strace reveals which syscall triggered it:
strace -e trace=all ./myapp 2>&1 | tail -5
# Often shows the last syscall before SIGSYS
For strace output patterns and ltrace filtering examples, see [references/strace-patterns.md](references/strace-patterns.md).
Related skills
- Use `skills/debuggers/gdb` when strace shows the failing location and you need to inspect internals
- Use `skills/binaries/elf-inspection` to
Read more
name: strace-ltrace description: strace and ltrace skill for system call and library call tracing. Use when a binary behaves incorrectly without crashing, diagnosing file-not-found errors, permission failures, network issues, or unexpected library calls by tracing syscalls and library function calls. Activates on queries about strace, ltrace, syscall tracing, library interception, ENOENT, EPERM, strace -e, or diagnosing binary behaviour without a debugger.
strace / ltrace
Purpose
Guide agents through tracing system calls with `strace` and library calls with `ltrace` — the most effective tools for diagnosing incorrect binary behaviour without a crash or debugger.
Triggers
- "My program behaves incorrectly — how do I trace what it's doing?"
- "How do I find what files a binary is opening?"
- "strace shows ENOENT — how do I interpret it?"
- "How do I trace network calls with strace?"
- "What is ltrace and how does it differ from strace?"
- "How do I trace a running process?"
Workflow
1. Basic strace usage
# Trace all syscalls of a command strace ./myapp arg1 arg2 # Attach to running process strace -p 12345 # Trace child processes too (-f = follow fork) strace -f ./myapp # Save to file (raw output — not stdout) strace ./myapp 2> trace.txt # Most useful: timestamps + summary strace -t -f ./myapp 2>&1 | head -100
2. Filter by syscall category
# Trace file operations only strace -e trace=file ./myapp # Trace network syscalls strace -e trace=network ./myapp # Trace specific syscalls strace -e trace=open,openat,read,write ./myapp # Trace process management strace -e trace=process ./myapp # Trace memory operations strace -e trace=memory ./myapp # Trace signals strace -e trace=signal ./myapp # Multiple categories strace -e trace=file,network ./myapp
| Category | Syscalls included | |----------|------------------| | `file` | open, openat, stat, access, unlink, rename, ... | | `network` | socket, connect, bind, accept, send, recv, ... | | `process` | fork, exec, wait, clone, exit, ... | | `memory` | mmap, munmap, mprotect, brk, ... | | `signal` | kill, sigaction, sigprocmask, ... | | `ipc` | pipe, socket pair, shmget, ... | | `desc` | close, dup, poll, select, epoll, ... |
3. Interpreting common errors
# See return values and errors strace -e trace=file ./myapp 2>&1 | grep -E "ENOENT|EPERM|EACCES|ENOTSUP"
| Error | Meaning | Common cause | |-------|---------|-------------| | `ENOENT` | No such file or directory | Config file missing, wrong path | | `EACCES` | Permission denied | File permissions, SELinux | | `EPERM` | Operation not permitted | Missing capability, suid needed | | `EADDRINUSE` | Address already in use | Port already bound | | `ETIMEDOUT` | Connection timed out | Network unreachable, firewall | | `ECONNREFUSED` | Connection refused | Server not listening | | `EAGAIN` | Resource temporarily unavailable | Non-blocking I/O, try again | | `ENOMEM` | Out of memory | Allocation failed | | `EBADF` | Bad file descriptor | Using closed/invalid fd | | `ENOEXEC` | Exec format error | Wrong binary format for arch |
# Find what file is not found strace ./myapp 2>&1 | grep 'ENOENT' # Example output: # openat(AT_FDCWD, "/etc/myapp.conf", O_RDONLY) = -1 ENOENT (No such file or directory) # → Config file expected at /etc/myapp.conf
4. Useful strace flags
# Show strings fully (default truncates at 32 chars)
strace -s 256 ./myapp
# Timestamps
strace -t ./myapp # wall clock time
strace -T ./myapp # time spent in each syscall
strace -r ./myapp # relative timestamps
# System call count summary
strace -c ./myapp
# Shows count, time, errors per syscall — great for profiling
# Trace with PIDs in output (for -f)
strace -f -p ./myapp
# Output: [pid 12346] open("/etc/passwd", O_RDONLY) = 3
# Decode numerical arguments
strace -e verbose=all ./myapp
# Print instruction pointer at each syscall
strace -i ./myapp5. ltrace — library call tracing
# Trace all library calls ltrace ./myapp # Trace specific library function ltrace -e malloc,free,fopen ./myapp # Trace nested calls (lib → lib) ltrace -n 2 ./myapp # indent nested calls # Trace with syscalls too ltrace -S ./myapp # Attach to running process ltrace -p 12345 # Summary statistics ltrace -c ./myapp
Typical ltrace output:
malloc(1024) = 0x55a1b2c3d000
fopen("/etc/myapp.conf", "r") = 0
free(0x55a1b2c3d000) = <void>strace vs ltrace:
| | strace | ltrace | |--|--------|--------| | Traces | Kernel syscalls | User-space library calls | | Overhead | Lower | Higher (PLT hooking) | | Shows | `open()`, `read()`, `write()` | `fopen()`, `malloc()`, `printf()` | | Use when | Binary interacts with OS/files/network | Binary calls library functions you can't see |
6. Practical diagnosis workflows
# Find missing config file strace -e trace=openat,open ./myapp 2>&1 | grep ENOENT # Find what network connections are made strace -e trace=network -f ./myapp 2>&1 | grep connect # Debug dynamic library loading failures strace -e trace=openat ./myapp 2>&1 | grep "\.so" # Find permission issues strace -e trace=file ./myapp 2>&1 | grep -E "EACCES|EPERM" # Debug slow startup (find where time is spent) strace -c ./myapp 2>&1 # Look for high % time in unexpected syscalls # Watch IPC/shared memory strace -e trace=ipc,shm ./myapp # Find what the binary exec's strace -e trace=execve -f ./myapp
7. seccomp filter debugging
If a program is killed by a seccomp policy, strace reveals which syscall triggered it:
strace -e trace=all ./myapp 2>&1 | tail -5 # Often shows the last syscall before SIGSYS
For strace output patterns and ltrace filtering examples, see [references/strace-patterns.md](references/strace-patterns.md).
Related skills
- Use `skills/debuggers/gdb` when strace shows the failing location and you need to inspect internals
- Use `skills/binaries/elf-inspection` to
A curated suite of AI agent skills for systems and low-level programming — C/C++, Rust, Zig, GPU, bare-metal firmware, Linux kernel/driver development, computer architecture, compiler internals, HPC, and more.
Repo: mohitmishra786/low-level-dev-skills
Other skills on low-level-dev-skills.
- /custom-allocators
Custom allocator skill for memory allocation strategies. Use when implementing pool/slab/arena allocators, tuning jemalloc/mimalloc, writing Rust GlobalAlloc, or benchmarking allocator performance. Activates on queries about jemalloc, mimalloc, tcmalloc, arena allocator,
Open skill - /numa-programming
NUMA programming skill for multi-socket memory locality. Use when detecting NUMA topology, binding processes with numactl, using libnuma API, building NUMA-aware data structures, or measuring remote access penalties. Activates on queries about numactl, libnuma, NUMA topology,
Open skill - /af-xdp
AF_XDP skill for high-performance XDP sockets. Use when creating AF_XDP sockets, configuring UMEM and XSK rings, XDP_REDIRECT programs, copy vs zero-copy mode, or comparing with DPDK. Activates on queries about AF_XDP, xsk_umem, XDP_REDIRECT, libbpf xsk, or zero-copy XDP.
Open skill - /dpdk
DPDK skill for userspace packet I/O. Use when initializing EAL, configuring PMD drivers, using mbuf pools and rte_ring, setting up huge pages, RSS, or testpmd validation. Activates on queries about DPDK, EAL, rte_eth_rx_burst, hugepages, PMD, or testpmd.
Open skill - /io-uring
io_uring skill for Linux async I/O. Use when building high-performance servers with liburing, multi-shot operations, provided buffers, fixed files, zero-copy send, or tokio-uring. Activates on queries about io_uring, SQE/CQE, liburing, IORING_OP_PROVIDE_BUFFERS, or io_uring vs
Open skill - /adc-dac-baremetal
Bare-metal ADC and DAC skill. Use when configuring analog sampling, DMA-driven ADC, calibration, or DAC output on MCUs. Activates on queries about ADC bare-metal, sampling time, DMA ADC, or DAC channel setup.
Open skill

