discovery icon indicating copy to clipboard operation
discovery copied to clipboard

Change breakpoint cmd

Open David-OConnor opened this issue 5 years ago • 3 comments

Page

Instructions say break main from gdb. This sets the break at line 7, the #[entry] line. I've found to get it to work (Windows), the command should be break main.rs:10

David-OConnor avatar Mar 30 '20 23:03 David-OConnor

Was there any problem with break main? The #[entry] line should still end up being the start of your main function, so debugging would hopefully work OK. It's generally possible to add breakpoints with either the name of a function or a specific line number; if possible it's better for the tutorial to use the function name in case the line numbering changes (e.g. due to an extra comment or import or whatever).

adamgreig avatar Mar 31 '20 10:03 adamgreig

It works, if you use a second continue. (Presumably to jump into the function, then the main loop, while in the example, the break main puts you in the fn instead of just outside it?) I agree that the line number approach is fragile / not general enough.

David-OConnor avatar Mar 31 '20 15:03 David-OConnor

in gdb the continue is the command that can run the program at the end of the fn where there is infinite loop so the program is stuck in infinite loop and runs infinite times

bahrozjaved avatar Apr 30 '20 11:04 bahrozjaved