Skip to main content

Breakpoints

Overview of the break command.

Setting breakpoints

Breakpoints are set with the break (or just b) command:

  • break <file>:<line> (alias: b <file>:<line>) - set a breakpoint at the specified line
  • break <function_name> (alias: b <function_name>) - set a breakpoint at the start of the specified function
  • break <instruction_address> (alias: b <instruction address>) - set a breakpoint at the specified instruction
  • break remove <number> (alias: b r <number>) - remove a breakpoint by its number
  • break remove <file>:<line> (alias: b r <file>:<line>) - remove a breakpoint at the specified line
  • break remove <instruction_address> (alias: b r <function name>) - remove a breakpoint at the start of the specified function
  • break info - print all breakpoints

Usage example

Consider this Rust program:

fn print_hello(print_num: u32) {
for _ in 0..print_num {
println!("Hello, world!");
}
}

fn main() {
let print_num = 3;
print_hello(print_num);
}

And try to break at the start of the main function and at line 3 (println!("Hello, world!");):