[PATCH v4] [gdb/python] Make sure python sys.exit makes gdb exit

Tom Tromey tom@tromey.com
Wed Sep 25 16:32:56 GMT 2024


>>>>> "Tom" == Tom de Vries <tdevries@suse.de> writes:

Tom> This is a change in behaviour since commit a207f6b3a38 ("Rewrite "python"
Tom> command exception handling"), first available in gdb 15.1.

Tom> This patch reverts to the old behaviour by handling PyExc_SystemExit in
Tom> gdbpy_handle_exception, such what we have instead:
Tom> ...
Tom> $ gdb -q -batch -ex "python sys.exit(2)" -ex "print 123"; echo $?
Tom> 2
Tom> ...

Thank you.  This looks good.
Approved-By: Tom Tromey <tom@tromey.com>

Tom


More information about the Gdb-patches mailing list