Skip to content

Instantly share code, notes, and snippets.

@iTrooz
Created December 6, 2024 21:39
Show Gist options
  • Save iTrooz/f30ed338b975560ad205623cb3ffa61c to your computer and use it in GitHub Desktop.
Save iTrooz/f30ed338b975560ad205623cb3ffa61c to your computer and use it in GitHub Desktop.
gdb run command with classic syntax and auto exit if ok
#!/bin/sh
# Auto run command (syntax is `gdbcmd <binary> <args>`)
# Auto exit if the program exits with 0
gdb "$1" \
-ex 'python gdb.events.exited.connect(lambda x : gdb.execute("quit") if x.exit_code == 0 else None)' \
-ex "run ${*:2}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment