I have a structure like this :
    struct A 
    {
        int a; 
        char b; 
    };
this structure is referenced at various places in a large code. The pointer to this struct is passed on to different functions and accordingly the variables in this structure are updated. i want to set a watchpoint on variable a in this struct as it travels across many functions. to see how a changes. How do I set this watch point ?
 
                        
First set a breakpoint where you create an instance of your struct using break, like
Then just use watch to set a watchpoint, like
for variable a or
for a memory address. The memory address can be obtained easily by using print, like
Now every time variable a or the given memory address gets modified gdb will break.