I am trying to debug a code in C++, compiling -O0 -g flag.
Function is like
void abc(){
//stuff
for(int i=0; i<n; i++){
//stuff
}
}
I want to put a conditional gdb breakpoint at the end of the function. I can put a statement like int a=1 before the function ends and put a breakpoint there, but is there any other way to do it without making changes to the code?
How to set a breakpoint in GDB where the function returns?
The question above has lot of return statements, so it is easier to put a break point there. This one does not have any RETURN statement and placing breakpoint to see the local variables is the thing I want to know.