反向执行常用命令:
- record
- rn(reverse-next)
- rc(reverse-continue)
- reverse-finish
- record stop
测试代码:
#include <iostream> #include <cstring> using namespace std; int g1=0; int g2=0; void test1() { g1=5; g2=6; int a=0; int b=0; int c=0; g1=10; g2=20; a++; b++; c++; } void test2() { FILE* file = fopen("test.txt","a"); if(file) { char buffer[]="this is a test\n"; fwrite(buffer,sizeof(buffer),1,file); fclose(file); } } int main(int argc,char** argv) { cout << "call test1 " << endl; test1(); test2(); return 0; }
反向执行命令rn的使用:
reverse-finish命令的使用:
反向执行命令不影响文件操作:
标签:GBD,reverse,g1,int,反向,file,调试,g2 From: https://www.cnblogs.com/TechNomad/p/17969756