How to have gdb exit if program succeeds, break if program crashes?

前端 未结 7 1989
挽巷
挽巷 2020-12-10 02:23

I seem to have some kind of multithreading bug in my code that makes it crash once every 30 runs of its test suite. The test suite is non-interactive. I want to run my test

7条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-10 02:37

    Make it dump core when it crashes. If you're on linux, read the man core man page and also the ulimit builtin if you're running bash.

    This way when it crashes you'll find a nice corefile that you can feed to gdb:

    $ ulimit -c unlimited
    $ ... run program ..., gopher coffee (or reddit ;)
    $ gdb progname corefile
    

提交回复
热议问题