I have a long C code which gets segmentation fault because a pointer variable x is pointed to NULL somewhere in the code (there are many writes to this variable and I did not write the code myself), and later an attempt has been made to read it's value resulting in a segmentation fault.
Now I can get the line where the variable x was accessed which resulted the segfault using gdb, but I'm interested to know when it (x) was assigned to the value NULL. There are many writes to this variable in the code and checking this manually soon becomes tedious. Is there an automated way to find when some variable x is assigned to a specific value? Maybe using gdb or some value analysis tool?
