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

前端 未结 7 1963
挽巷
挽巷 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条回答
  •  粉色の甜心
    2020-12-10 02:32

    You can also trigger a backtrace when the program crashes and let gdb exit with the return code of the child process:

    gdb -return-child-result -ex run -ex "thread apply all bt" -ex "quit" --args myProgram -myProgramArg
    

提交回复
热议问题