go tool objdump -S myapp | xdumpgo annotate
Adds goroutine creation stack traces next to go func() calls.
The plugin system lets you interpret bytes as semantic values.
type IPv4Plugin struct{}func (p IPv4Plugin) Name() string return "ipv4"
func (p IPv4Plugin) Decode(data []byte) (interface{}, error) if len(data) < 4 return nil, fmt.Errorf("need 4 bytes") return net.IPv4(data[0], data[1], data[2], data[3]), nil
func init() { xdumpgo.RegisterPlugin(IPv4Plugin{}) }
Now the CLI can decode on the fly:
xdumpgo --plugin ipv4 -g 4 dump.bin
xdumpgo file.bin
Default output:
Example:
00000000 48 65 6c 6c 6f 20 57 6f 72 6c 64 0a 00 00 00 01 |Hello World.....|
00000010 00 00 00 02 |....|
Option A — runtime-triggered heap/profile dump (recommended for running processes):
go tool pprof http://localhost:6060/debug/pprof/heap
# within pprof: (pprof) top
# or save pprof: go tool pprof -png http://localhost:6060/debug/pprof/heap > heap.png
Option B — OS core dump (for post-mortem analysis): xdumpgo tutorial
ulimit -c unlimited
gcore <PID> # requires gdb installed; writes core.<PID>
Option C — use xdumpgo's live attach (if supported):
xdumpgo dump --pid <PID> --out dump.xd
(Replace command with xdumpgo's actual CLI flags.)
To get started, you need to install the package. Open your terminal and run:
go get -u github.com/example/xdumpgo
(Note: Replace the URL with the actual repository path you are using).
Assume you have a data.bin containing:
type Point struct
X int32
Y int32
Run:
xdumpgo -type "main.Point" -offset 0 data.bin
Output:
Offset 0: PointX=100, Y=200
You can even export a Go struct definition file:
xdumpgo -define Point data.bin
xdumpgo stack -g 1 ./crash core.12345
(Commands above are representative — check binary’s help for exact flags.)