Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* `sys.exit` from Python no longer exits the GDB process
@ 2024-06-20 19:25 Gulshan Singh via Gdb
  2024-06-20 19:37 ` Paul Koning via Gdb
  0 siblings, 1 reply; 4+ messages in thread
From: Gulshan Singh via Gdb @ 2024-06-20 19:25 UTC (permalink / raw)
  To: gdb

I'm using GNU gdb (Ubuntu 15.0.50.20240403-0ubuntu1)
15.0.50.20240403-git on Ubuntu 24.04, and I'm observing different
behavior with `sys.exit` in Python then when I was using GNU gdb
(Ubuntu 12.1-0ubuntu1~22.04.2) 12.1 on Ubuntu 22.04.

In GDB 12.1, `sys.exit(1)` in Python would exit the GDB process with
an exit code of 1. In GDB 15.0, I'm seeing that there's an exception
message instead, and GDB does not exit:
```
Python Exception <class 'SystemExit'>: 1
Error occurred in Python: 1
```

Is this a bug or intentional behavior? I work on an open source Python
GDB plugin that has some unit tests that get run inside GDB. When an
exception occurs, it's caught and we exit with `sys.exit` so we can
check the return code from our test running scripts. But with the
latest GDB this no longer happens, eventually we run the `quit`
command, and the exit code is zero. If this is intended behavior, is
there any alternative we can use to quit GDB with a non-zero exit code
from Python?

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-07-02 19:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-20 19:25 `sys.exit` from Python no longer exits the GDB process Gulshan Singh via Gdb
2024-06-20 19:37 ` Paul Koning via Gdb
2024-06-23 22:07   ` Tom Tromey
2024-07-02 19:09     ` Gulshan Singh via Gdb

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox