diff options
author | Tom de Vries <tdevries@suse.de> | 2024-09-25 19:29:57 +0200 |
---|---|---|
committer | Tom de Vries <tdevries@suse.de> | 2024-09-25 19:29:57 +0200 |
commit | dfba4847f6a22eef700917e2718ea847d9f5cc9d (patch) | |
tree | 4f8d775a0fcf607b4299391b078b942767288e84 /gdb/testsuite/gdb.python/py-missing-debug.c | |
parent | f82fd76c96ce848d77f86b8f1beefcff7656159c (diff) | |
download | binutils-dfba4847f6a22eef700917e2718ea847d9f5cc9d.zip binutils-dfba4847f6a22eef700917e2718ea847d9f5cc9d.tar.gz binutils-dfba4847f6a22eef700917e2718ea847d9f5cc9d.tar.bz2 |
[gdb/python] Make sure python sys.exit makes gdb exit
With gdb 15.1, python sys.exit no longer makes gdb exit:
...
$ gdb -q -batch -ex "python sys.exit(2)" -ex "print 123"; echo $?
Python Exception <class 'SystemExit'>: 2
Error occurred in Python: 2
$1 = 123
0
...
This is a change in behaviour since commit a207f6b3a38 ("Rewrite "python"
command exception handling"), first available in gdb 15.1.
This patch reverts to the old behaviour by handling PyExc_SystemExit in
gdbpy_handle_exception, such what we have instead:
...
$ gdb -q -batch -ex "python sys.exit(2)" -ex "print 123"; echo $?
2
...
Tested on x86_64-linux, with python 3.6 and 3.13.
Tested-By: Guinevere Larsen <blarsen@redhat.com>
Approved-By: Tom Tromey <tom@tromey.com>
PR python/31946
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31946
Diffstat (limited to 'gdb/testsuite/gdb.python/py-missing-debug.c')
0 files changed, 0 insertions, 0 deletions