I wrote a program that solves some kind of optimization problem. I run it with ever lower thresholds and I think I hit some kind of barrier since my program cannot get better results. It works for about 5 days ...
However, I have code in the program that saves its data if it is better than the threshold. Since I am not interested in starting it in 5 days, I want to do this while the program is running, but unfortunately I did not compile it with -g (I use gcc). I am trying to change the threshold value to a higher value.
I managed to connect to it using gdb and see the stack frame. I am now inside the method and I want to access the "this" pointer to change the threshold parameter. I tried to check the values at the function address, but nothing makes sense ... How do I know what "this" points to?
Thank.
Firstly, you do not need to restart the program to debug it.
, , , -g. , , () . nm a.out nm a.out.debug ( , , , , , ). gdb a.out.debug <pid>, .
-g
nm a.out
nm a.out.debug
gdb a.out.debug <pid>
, , , : . a.out.debug ( ) GDB disas , . , . , , GDB.
a.out.debug
disas