How can I track the propagation of values ​​through function calls with GDB reverse debugging?

I am trying to figure out a way to track the propagation of values ​​through function calls and copy variables in a program using GDB debugging. I have used GDB a lot in the past, but relatively new to reverse debugging.

I think the easiest way to formulate a question is with an example. Take a look at this program.

void FnA(int x) {
  printf("x=%d\n", x)
}

void FnB(int y) {
  int y_copy = y;
  FnA(y_copy);
}

void FnC(int z) {
  FnB(z);
}

int main() {
  int i;
  i = 5;
  FnC(i);
}

, GDB , . printf FnA, , . " , x ?" watch -l x, reverse-continue. FnA, x . i = 5 main, x. , i = 5 , x , : main:i -> FnC:z -> FnB:y -> FnB:y_copy -> FnA:x.

, GDB-fu , . , GDB-fu .

GDB ? GDB ?

PS: , GDB rr. rr - gdb, . /, , , gdb rr.

+4

Source: https://habr.com/ru/post/1654161/


All Articles