- Make sure you build the binary with debug symbols. For example:
RUSTFLAGS=-g cargo build --release
- Use rust-gdb to start the binary and load the script:
rust-gdb rust_binary -x memlayout-rust.py
- Break anywhere you like, and use the command
mem-layout VARIABLE_NAME
to print the layout of that variable:
- Custom structures are also supported: