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 linebreak <function_name>
(alias:b <function_name>
) - set a breakpoint at the start of the specified functionbreak <instruction_address>
(alias:b <instruction address>
) - set a breakpoint at the specified instructionbreak remove <number>
(alias:b r <number>
) - remove a breakpoint by its numberbreak remove <file>:<line>
(alias:b r <file>:<line>
) - remove a breakpoint at the specified linebreak remove <instruction_address>
(alias:b r <function name>
) - remove a breakpoint at the start of the specified functionbreak 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!");
):