summaryrefslogtreecommitdiffhomepage
path: root/content
diff options
context:
space:
mode:
authorFabricio Voznika <fvoznika@google.com>2019-07-29 18:35:27 -0700
committerIan Lewis <ianlewis@google.com>2019-08-02 10:10:48 +0900
commit6ee109aca465e88b6e00a7b36b865649afb4e809 (patch)
tree6b7961b26180f8dcbd32bdfde8f4a2cf9b60d255 /content
parent46ee8873ffca2468eecf813cb2163f1d31ce390f (diff)
Added section about attaching debugger
Diffstat (limited to 'content')
-rw-r--r--content/docs/user_guide/debugging.md24
1 files changed, 24 insertions, 0 deletions
diff --git a/content/docs/user_guide/debugging.md b/content/docs/user_guide/debugging.md
index 761721bd3..d8fb97184 100644
--- a/content/docs/user_guide/debugging.md
+++ b/content/docs/user_guide/debugging.md
@@ -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