debuggingsegmentation-faultgdb

Running a program with segmentation fault works well with gdb


I implemented the program that uses mmap() system call, but Segmentation Fault occurs during process runtime.

So, I ran this program with gdb, but when I did it, it worked well without segment fault.

I wonder if it is possible that running with gdb can affect segment fault. Could you tell me about it?


Solution

  • if it is possible that running with gdb can affect segment fault.

    One possibility: GDB disables address randomization (so as to make reproducing the bug easier). You can re-enable it with:

    (gdb) set disable-randomization off
    

    GDB may also affect timing of threads, but you didn't mention threads, so that's less likely.