Let’s start with the simplest use case: dumping a file.
xdumpgo myfile.bin
Output (example):
00000000 48 65 6c 6c 6f 20 57 6f 72 6c 64 21 |Hello World!|
xdumpgo is a lightweight Go-based tool for extracting, viewing, and analyzing memory dump data (heap, stack, goroutine state) from running Go programs or core dump files. This tutorial walks through installing xdumpgo, creating a sample program, capturing a dump, and using xdumpgo to inspect goroutines, heap objects, and allocations. xdumpgo tutorial
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 |....|
xdumpgo hex example.bin
Output:
00000000 7F 45 4C 46 02 01 01 00 00 00 00 00 00 00 00 00 |.ELF............|
00000010 02 00 3E 00 01 00 00 00 C0 0F 40 00 00 00 00 00 |..>.......@.....|
xdumpgo heap --top 5 ./crash core.12345
Output:
5 objects, 1024 bytes: chan struct{}
2 objects, 512 bytes: runtime.g
xdumpgo is a lightweight, zero-dependency Go library designed to format and display variables in a colorful, readable, and structured way. It acts as an enhanced alternative to the standard fmt.Printf("%#v", var) or standard JSON marshaling, specifically tailored for debugging directly in your terminal.
If you are tired of scrolling through unindented JSON logs or struggling to read the output of deeply nested structs, xdumpgo is the tool for you. Let’s start with the simplest use case: dumping a file
saveData, _ := os.ReadFile("game.sav")
cfg := xdumpgo.DefaultConfig()
cfg.GroupSize = 4
cfg.Endian = xdumpgo.LittleEndian
xdumpgo.NewDumper(cfg).Write(os.Stdout, saveData)
Spot checksum fields and embedded strings instantly.