From: Paul Koning via Gdb <gdb@sourceware.org>
To: Gulshan Singh <gsingh2011@gmail.com>
Cc: gdb@sourceware.org
Subject: Re: `sys.exit` from Python no longer exits the GDB process
Date: Thu, 20 Jun 2024 15:37:00 -0400 [thread overview]
Message-ID: <AED7B9A9-E2A4-4814-AD61-747A6833FA34@comcast.net> (raw)
In-Reply-To: <CANEZYrcsr4cANwOHSyV3k1n9cPn6XBvYh-heDqy++=gEpVGnLQ@mail.gmail.com>
> 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
next prev parent reply other threads:[~2024-06-20 19:38 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-20 19:25 Gulshan Singh via Gdb
2024-06-20 19:37 ` Paul Koning via Gdb [this message]
2024-06-23 22:07 ` Tom Tromey
2024-07-02 19:09 ` Gulshan Singh via Gdb
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=AED7B9A9-E2A4-4814-AD61-747A6833FA34@comcast.net \
--to=gdb@sourceware.org \
--cc=gsingh2011@gmail.com \
--cc=paulkoning@comcast.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox