Refer the code below with line numbers with it.
1 void f(string& s){
...
//some code
...
12 for(unsigned int i = 0; i <= end; i++){
13 unsigned int a = s[i] - 'a' + 1;
14 unsigned int b = s[end-i] - 'a' + 1;
15 }
16 }
In gdb, I have to check the value of variable b. How do I set breakpoints here correctly. I know that breakpoint has to be after line 14. But, whenever I type line 15, b 15, it adds breakpoint at line 16.
Can somebody please help ?
I'm not entirely sure on the reason, but a similar thing happens in Visual Studio when setting breakpoints, which makes me think it's a commonplace thing.
My cheap way of getting past this would be adding a line after your equation that says something like:
b = b;
Then setting a breakpoint there
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With