GDB: break if variable equal value

前端 未结 4 1820
既然无缘
既然无缘 2020-12-07 10:34

I like to make GDB set a break point when a variable equal some value I set, I tried this example:

#include 
main()
{ 
     int i = 0;
     fo         


        
4条回答
  •  萌比男神i
    2020-12-07 11:02

    You can use a watchpoint for this (A breakpoint on data instead of code).

    You can start by using watch i.
    Then set a condition for it using condition i == 5

    You can get the breakpoint number by using info watch

提交回复
热议问题