main.c
#include <stdio.h>
typedef struct
{
int iW;
int iH;
int iX;
int iY;
}BOX_ST;
int main()
{
BOX_ST stBox;
for (int i = 0; i < 10000; ++i)
{
stBox.iW = i;
stBox.iH = i;
stBox.iX = i;
stBox.iY = i;
}
return 0;
}
gdb脚本(break-if)
功能:当if后面的表达式成立时 执行break打断点命令
示例:
b 20 if i == 66
gdb脚本使用
tom@ubuntu:~/dvp$ gdb ./a.out -x ./gdbcmd_breakif.txt
GNU gdb (Ubuntu 7.11.1-0ubuntu1~16.5) 7.11.1
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".