Skip to content

Instantly share code, notes, and snippets.

@shi-yan
Created November 1, 2018 22:07
Show Gist options
  • Select an option

  • Save shi-yan/3b2225bd267fcd6114de87d4a7e2c063 to your computer and use it in GitHub Desktop.

Select an option

Save shi-yan/3b2225bd267fcd6114de87d4a7e2c063 to your computer and use it in GitHub Desktop.

Revisions

  1. shi-yan created this gist Nov 1, 2018.
    13 changes: 13 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,13 @@
    https://stackoverflow.com/questions/8657648/how-to-have-gdb-exit-if-program-succeeds-break-if-program-crashes

    If you put the following lines in your ~/.gdbinit file, gdb will exit when your program exits with a status code of 0.

    python

    def exit_handler ( event ):
    if event .exit_code == 0:
    gdb .execute ( "quit" )

    gdb .events .exited .connect ( exit_handler )

    end