This is a reduced example of the structure of my code:
void increment(int j);
int main()
{
int i = 0;
while(1) {
i = increment(i);
}
return 0;
}
int increment(int j)
{
return j + 1;
}
And here is the corresponding GDB script:
b increment
command 1
finish
print i
continue
end
The problem is that the finish
command prevents the commands that come after it (namely print i
and continue
) to not be called.
Is there a way to tell GDB to print i
right after any increment
call?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…