I have a program which produces a fatal error with a testcase, and I can locate the problem by reading the log and the stack trace of the fatal. It turns out that there is a read operation upon a null pointer.
But when I try to attach GDB to it and set a breakpoint around the suspicious code, the null pointer just cannot be observed! The program works smoothly without any error.
This is a single-process, single-thread program, and I didn't experience this kind of thing before. Why is it?
Appended: I also tried to call the pause() system call before the fatal-trigger code, and expected to make the program sleep before the fatal point and then attach GDB on it on-the-fly, sadly, no fatal error occurred.