* `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
* Re: `sys.exit` from Python no longer exits the GDB process
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
0 siblings, 1 reply; 4+ messages in thread
From: Paul Koning via Gdb @ 2024-06-20 19:37 UTC (permalink / raw)
To: Gulshan Singh; +Cc: gdb
> On Jun 20, 2024, at 3:25 PM, Gulshan Singh via Gdb <gdb@sourceware.org> wrote:
>
> 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?
If all else fails, os._exit(1) should work, but I too wonder if this change is intentional, and if so whether there is a way to control its behavior.
paul
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: `sys.exit` from Python no longer exits the GDB process
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
0 siblings, 1 reply; 4+ messages in thread
From: Tom Tromey @ 2024-06-23 22:07 UTC (permalink / raw)
To: Paul Koning via Gdb; +Cc: Gulshan Singh, Paul Koning
> If all else fails, os._exit(1) should work, but I too wonder if this
> change is intentional, and if so whether there is a way to control its
> behavior.
I think it's probably just a bug. I feel like we changed some exception
handling stuff, maybe that change was too aggressive. Please file
something in bugzilla -- no guarantees anyone will fix it but at least
that way we have a spot to discuss, etc.
Tom
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: `sys.exit` from Python no longer exits the GDB process
2024-06-23 22:07 ` Tom Tromey
@ 2024-07-02 19:09 ` Gulshan Singh via Gdb
0 siblings, 0 replies; 4+ messages in thread
From: Gulshan Singh via Gdb @ 2024-07-02 19:09 UTC (permalink / raw)
To: Tom Tromey; +Cc: Paul Koning via Gdb, Paul Koning
Thanks, I've filed a bug here:
https://sourceware.org/bugzilla/show_bug.cgi?id=31946
On Sun, Jun 23, 2024 at 3:07 PM Tom Tromey <tom@tromey.com> wrote:
>
> > If all else fails, os._exit(1) should work, but I too wonder if this
> > change is intentional, and if so whether there is a way to control its
> > behavior.
>
> I think it's probably just a bug. I feel like we changed some exception
> handling stuff, maybe that change was too aggressive. Please file
> something in bugzilla -- no guarantees anyone will fix it but at least
> that way we have a spot to discuss, etc.
>
> Tom
^ 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