Skip to content

GDB and LLDB Debugger Snippets

Source: GDB to LLDB command map, Debugging Rust apps with GDB - LogRocket Blog

Note commands/aliases like run (r), step (s), and breakpoint (b) are similar or same with GDB and LLDB

Commands below are confirmed to work with rust-gdb

Terminal window
# Debug specific binary
rust-gdb target/debug/examples/basic
# Help information
help
# Quit
q
# Run
r
# Set breakpoint (break) on a function
b get_chip
# Set breakpoint on file and line number
b main.rs:22
# Breakpoint information
b info
# Breakpoint disable it
disable 1
# Step - next
n
# Step - step into
s
# Step - finish function
finish
# Step - continue execution
c
# Repeat previous command
Enter
# Check incoming arguments
info args
# Print information on variable, function
p variable_name
p code_element
# Frame - check current code execution line
f
# Set - change state of variables
set var_name = my_value
Terminal window
# Layout - See debugging location in source code
layout src
layout split
# Layout - remove layout
Ctrl + x a