How do you set a breakpoint on multiple lines at once?
7 views (last 30 days)
Show older comments
Alessandro Maria Laspina on 15 Mar 2021
Answered: Steven Lord on 15 Mar 2021
I have a long code, and the error handling options are not respected most likely because the code I am using is part of a software package. Breakpoints are respected but the code is around 700 lines long and I don't want to have to set a breakpoint manually for each line everytime I restart matlab.
Yes I know its not efficient, but the code is a black box, I have no control over the inner workings, and this is the only way I can debug the process.
Steven Lord on 15 Mar 2021
Breakpoints are respected but the code is around 700 lines long and I don't want to have to set a breakpoint manually for each line everytime I restart matlab.
Why do you need to set a breakpoint manually for each line? I would set a breakpoint on the first line then step through the code from there.
If you need to restore the breakpoints, call dbstatus to create a struct array with information about the location of the breakpoints and pass that struct array into dbstop to restore those breakpoints.
If somewhere in the "black box" code you're running or in your code, if you're calling clear all then that would clear the debugging state. Try removing that and see if the error breakpoints functionality does what you need.
Find more on Use Prebuilt MATLAB Interface to C++ Library in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!