• Stars
    star
    251
  • Rank 161,862 (Top 4 %)
  • Language
    Shell
  • License
    BSD 3-Clause "New...
  • Created over 5 years ago
  • Updated over 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A little book which introduces strace.

Strace little book

I like researching debugging techniques, so I decide to write this booklet to introduce strace. The following is the official definition of strace:

strace is a diagnostic, debugging and instructional userspace utility for Linux. It is used to monitor and tamper with interactions between processes and the Linux kernel, which include system calls, signal deliveries, and changes of process state.

System administrators, diagnosticians and trouble-shooters will find it invaluable for solving problems with programs for which the source is not readily available since they do not need to be recompiled in order to trace them.

The operation of strace is made possible by the kernel feature known as ptrace.

In one word, strace helps you know a process's activities between user-space and kernel-space. Let's check a simple example to get first impression of strace:

# strace ls
execve("/usr/bin/ls", ["ls"], 0x7ffe7727eec0 /* 20 vars */) = 0
brk(NULL)                               = 0x560a32cda000
arch_prctl(0x3001 /* ARCH_??? */, 0x7fff167898f0) = -1 EINVAL (Invalid argument)
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=98317, ...}) = 0
mmap(NULL, 98317, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7face703c000
close(3)                                = 0
openat(AT_FDCWD, "/usr/lib/libcap.so.2", O_RDONLY|O_CLOEXEC) = 3
......

strace outputs all the syscalls' names, arguments, and return values. Very cool, isn't it? OK, let's begin our journey now.

More Repositories

1

golang-101-hacks

A rudimentary Go tutorial.
371
star
2

perf-little-book

A small book which introduces Linux perf tool.
183
star
3

tcpdump-little-book

A small book which introduces tcpdump.
HTML
90
star
4

boost-asio-network-programming-little-book

Boost.Asio network programming little book
81
star
5

openbsd-netcat-demystified

A little book which introduces OpenBSD netcat.
78
star
6

lscpu

lscpu for BSDs.
C
68
star
7

umalloc

A tiny Unix dynamic memory allocator library.
C
62
star
8

gnu-linux-proc-pid-intro

GNU/Linuxไธ‹็š„/proc/[pid]็›ฎๅฝ•ไธ‹็š„ๆ–‡ไปถๅˆ†ๆž
55
star
9

read-nmon-code-to-learn-analyzing-linux-performance

Read Nmon Code To Learn Analyzing Linux Performance:
54
star
10

FreeBSD-101-Hacks

A collection of FreeBSD hacks.
41
star
11

free

free command for OpenBSD.
C
25
star
12

ump

A universal thread-safe memory pool.
C++
24
star
13

tcpbench

Porting OpenBSD tcpbench into Linux.
C
23
star
14

using-dtrace-stories

22
star
15

openmp-little-book

A little book which introduces OpenMP C/C++ concurrency programming.
20
star
16

taskset

Bond process with dedicated CPUs on DragonFly BSD
C
9
star
17

getRSS

get the process resident set size (physical memory use).
C
9
star
18

libtlscpp

A C++ encapsulation of libtls
C++
8
star
19

code-for-my-blog

C
8
star
20

stream

STREAM implemented in Rust.
Rust
5
star
21

generic-c-c-plus-plus-makefile

A generic C/C++ Makefile
Makefile
5
star
22

stack

The stack package implemented in golang.
Go
5
star
23

cpu-tips

The small tips of CPU
C
4
star
24

pcap_cpp

C++
4
star
25

The-GO-code-of-wwup

The Go code of Working With UNIX processes.
Go
3
star
26

playstack

Utilize https://github.com/NanXiao/stack package, just a play.
Go
3
star
27

cuda-little-book

CUDA programming little book.
3
star
28

lscuda

A small tool which lists NVIDIA CUDA information.
Cuda
3
star
29

netcat

C
3
star
30

data-race-and-memory-ordering

2
star
31

helloworld

A gRPC example.
Protocol Buffer
1
star
32

RustTCPFramework

A TCP framework implemented in Rust.
Rust
1
star
33

newlisp-examples

Some newlisp examples
NewLisp
1
star
34

elementary-number-theory-with-programming-in-haskell

Haskell
1
star
35

singleton

A simple singleton implemented in C++.
C++
1
star
36

golang-algorithm

Just a simple golang algorithm code repository.
Go
1
star
37

log

A simple log function implemented in C++.
C++
1
star
38

reduce

A simple reduce template implemented in C++.
C++
1
star
39

nb

Shell
1
star
40

gouname

The "uname" command implemented in golang.
Go
1
star
41

aligned_realloc

An implementation of aligned_realloc for C's Dynamic memory management.
C
1
star
42

pcapng_to_pcap

C++
1
star