A drop-in Go package to trace your program automatically.
Caution
Examine is still in very early development
- When working on a project I would like to trace execution especially for network requests (incoming and outgoing)
- The way to do it is either change the code to log these requests or add breakpoints and attach a debugger
- I would like to Do 1 without doing 2. I would like to just import a package that traces the program network requests
- Import Examine to your program with
import _ "github.com/emad-elsaid/examine"
- Build and run your program
go build ./cmd/path/to/cmd && ./cmd-name
- Examine prints traces of your network requests (this can change during development)
- As Examine pauses programs it will affect performance. and shouldn't be used in production for any case
- Examine forks your program
- Attaches Delve debugger to your program
- Adds breakpoints to Go standard library
- Whenever a breakpoint is hit. it'll store relevant information and print them and continue
Turns out go run
doesn't include DWARF debugging information. so you have to go build
then run the program
If you get this message:
ERROR Could not attach to pid 10042: this could be caused by a kernel security setting, try writing "0" to /proc/sys/kernel/yama/ptrace_scope
You need to turn on ptrace_scope
in your kernel by
sudo su
echo "0" > /proc/sys/kernel/yama/ptrace_scope