Thanks for that detailed answer. I did not know 'gdb'. It seems that I need to look into its documentation.
What other things you want to do on this function/code branch you want to execute while the program is being debugged? |
At a breakpoint, I'm not directly interested in the existing variables, but in a result of these variables.
Assuming that I have 2 variables a and b. At the breakpoint, I only want to know the addition of both variables (a+b). If I can see only the 2 variables, then I need to make the addition myself when waiting at a breakpoint (in fact, the calculation is so complex that it takes approx 100ms for calculation. I cannot do it myself at every breakpoint position).
If you wish to branch/call a function only when debugging, you can modify your code to use debugging macros that are defined when building debug mode. |
The problem is, that I need to step through my code. After each step, the calculation (needing 100ms) needs to be re-executed.
That means, that I would need to insert these "#ifdef DEBUG" after every line of code, until I could identify the critical line of code.
In addition, my application is running on a machine (~real time). Introducing several of these "#ifdef DEBUG" would slow down the program so much (if no breaks were active), that the performance would be different.