Skip to content

Commit

Permalink
Added section about attaching debugger
Browse files Browse the repository at this point in the history
  • Loading branch information
fvoznika authored and ianlewis committed Aug 2, 2019
1 parent 46ee887 commit 6ee109a
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions content/docs/user_guide/debugging.md
Expand Up @@ -56,6 +56,30 @@ sudo runsc --root /var/run/docker/runtime-runsc/moby debug --stacks 63254c6ab3a6
> `/var/run/docker/runtime-[runtime-name]/moby`. If in doubt, `--root` is logged to
> `runsc` logs.
## Debugger

You can debug gVisor like any other Golang program. If you're running with Docker,
you'll need to find the sandbox PID and attach the debugger as root. Other than
that, it's business as usual.

```bash
# Start the container you want to debug.
docker run --runtime=runsc --rm --name=test -d alpine sleep 1000

# Find the sandbox PID.
docker inspect test | grep Pid | head -n 1

# Attach your favorite debugger.
sudo dlv attach <PID>

# Set a breakpoint and resume.
break mm.MemoryManager.MMap
continue
```

> Note: if the debugger cannot find symbols, rebuild runsc in debug mode:
> `bazel build -c dbg //runsc:runsc`
## Profiling

`runsc` integrates with Go profiling tools and gives you easy commands to profile
Expand Down

0 comments on commit 6ee109a

Please sign in to comment.