Tom de Vries
372d0a4c96
[gdb/python] Handle failure to initialize without exiting
...
I tried out making python initialization fail by passing an incorrect
PYTHONHOME, and got:
...
$ PYTHONHOME=foo ./gdb.sh -q
Python path configuration:
PYTHONHOME = 'foo'
...
Python initialization failed: \
failed to get the Python codec of the filesystem encoding
Python not initialized
$
...
The relevant part of the code is:
...
static void
gdbpy_initialize (const struct extension_language_defn *extlang)
{
if (!do_start_initialization () && py_isinitialized && PyErr_Occurred ())
gdbpy_print_stack ();
gdbpy_enter enter_py;
...
What happens is:
- gdbpy_enter::gdbpy_enter () is called, where we run into:
'if (!gdb_python_initialized) error (_("Python not initialized"));'
- the error propagates to gdb's toplevel
- gdb print the error and exits.
It seems unnecesssary that we exit gdb. We could continue the
session without python support.
Fix this by:
- bailing out of gdbpy_initialize if !do_start_initialization
- bailing out of finalize_python if !gdb_python_initialized
This gets us instead:
...
$ PYTHONHOME=foo gdb -q
Python path configuration:
PYTHONHOME = 'foo'
...
Python initialization failed: \
failed to get the Python codec of the filesystem encoding
(gdb) python print (1)
Python not initialized
(gdb)
...
Tested on aarch64-linux.
Approved-By: Tom Tromey <tom@tromey.com >
2024-11-22 19:34:24 +01:00
..
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-11-14 19:34:43 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-04-02 11:21:39 -06:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-04-02 11:21:39 -06:00
2024-01-12 15:49:57 +00:00
2024-06-04 10:54:18 -06:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-11-14 19:34:44 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-02-19 10:55:32 +01:00
2024-02-19 10:55:32 +01:00
2024-02-19 14:08:31 +01:00
2024-02-19 10:55:32 +01:00
2024-03-29 22:28:44 +00:00
2024-02-19 14:08:31 +01:00
2024-01-12 15:49:57 +00:00
2024-07-31 15:04:25 +02:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-02-27 09:46:31 -07:00
2024-07-31 13:24:20 +02:00
2024-07-31 13:24:20 +02:00
2024-01-12 15:49:57 +00:00
2024-07-31 13:24:20 +02:00
2024-07-31 13:24:20 +02:00
2024-01-12 15:49:57 +00:00
2024-02-27 09:46:31 -07:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-04-02 11:21:39 -06:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-04-26 21:22:48 +01:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-10-18 11:50:27 -06:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-11-22 19:34:24 +01:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-02-27 09:46:31 -07:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-06-20 16:54:47 +02:00
2024-01-12 15:49:57 +00:00
2024-11-14 19:34:43 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-02-07 19:52:06 +01:00
2024-04-02 11:21:39 -06:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-07-31 15:04:25 +02:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-04-02 11:21:39 -06:00
2024-04-02 11:21:39 -06:00
2024-04-02 11:21:39 -06:00
2024-08-02 09:06:26 -03:00
2024-04-02 11:21:39 -06:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-10-25 06:14:03 +02:00
2024-04-02 11:21:39 -06:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-04-02 11:21:39 -06:00
2024-10-07 10:44:45 +02:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-02-27 09:46:31 -07:00
2024-03-19 11:34:16 +00:00
2024-03-19 11:34:16 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-11-14 19:34:44 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-04-02 11:21:39 -06:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-09-10 14:07:11 +01:00
2024-04-02 11:21:39 -06:00
2024-11-10 10:18:23 +00:00
2024-11-10 10:18:23 +00:00
2024-11-11 16:11:18 +00:00
2024-11-11 07:22:24 -07:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-04-02 11:21:39 -06:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-02-27 09:46:31 -07:00
2024-02-27 09:46:31 -07:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-09-25 10:17:31 -04:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-04-02 11:21:39 -06:00
2024-01-12 15:49:57 +00:00
2024-09-25 11:06:57 +00:00
2024-04-02 11:21:39 -06:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-09-25 10:17:31 -04:00
2024-01-12 15:49:57 +00:00
2024-02-27 09:46:31 -07:00
2024-04-02 11:21:39 -06:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-09-25 10:17:31 -04:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-04-02 11:21:39 -06:00
2024-01-12 15:49:57 +00:00
2024-08-18 20:51:29 +02:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-07-31 15:04:25 +02:00
2024-01-12 15:49:57 +00:00
2024-05-03 15:07:33 +02:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-09-26 11:22:49 +01:00
2024-09-26 11:22:49 +01:00
2024-09-27 13:45:11 -06:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-08-16 11:07:21 +02:00
2024-01-12 15:49:57 +00:00
2024-02-27 09:46:31 -07:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-04-02 11:21:39 -06:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-03-19 16:03:34 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-02-27 09:46:31 -07:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-03-22 17:29:47 -07:00
2024-06-24 18:45:37 +02:00
2024-07-31 15:04:25 +02:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-04-02 11:21:39 -06:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-02-27 09:46:31 -07:00
2024-04-02 11:21:39 -06:00
2024-06-03 17:23:26 +02:00
2024-06-03 17:23:26 +02:00
2024-01-12 15:49:57 +00:00
2024-06-03 17:18:30 +02:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-07-31 15:04:25 +02:00
2024-04-02 11:21:39 -06:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-09-23 13:44:59 -06:00
2024-01-12 15:49:57 +00:00
2024-03-18 07:20:14 -06:00
2024-09-25 19:29:57 +02:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-01-12 15:49:57 +00:00
2024-02-27 09:46:31 -07:00
2024-11-01 11:06:47 -06:00
2024-11-01 11:06:47 -06:00