segfault only when NOT using debugger

前端 未结 5 1801
隐瞒了意图╮
隐瞒了意图╮ 2020-12-04 09:17

I have a multithreaded C program, which consistently generates a segmentation fault at a specific point in the program. When I run it with gdb, no fault is shown. Can you th

5条回答
  •  被撕碎了的回忆
    2020-12-04 09:48

    Perhaps when using gdb memory is mapped in a location which your over/under flow doesn't trample on memory that causes a crash. Or it could be a race condition that is no longer getting tripped. Although it sounds unintuitive, you should be happy your program was nice enough to crash on you.

    Some suggestions

    1. Try a static code analyzer such as the free cppcheck
    2. Try a malloc() debugger like libefence
    3. Try running it through valgrind

提交回复
热议问题