diff options
author | Tom Tromey <tromey@adacore.com> | 2023-11-15 06:48:55 -0700 |
---|---|---|
committer | Tom Tromey <tromey@adacore.com> | 2023-11-15 09:43:38 -0700 |
commit | 7d21600b31fe959b758ed475a2211d6805047df9 (patch) | |
tree | b4fb6a0c1195f25a6b321c4868075157ca469037 /gdb/python | |
parent | e1ccbfffb5e0121c084898ac63f042187621d4ec (diff) | |
download | gdb-7d21600b31fe959b758ed475a2211d6805047df9.zip gdb-7d21600b31fe959b758ed475a2211d6805047df9.tar.gz gdb-7d21600b31fe959b758ed475a2211d6805047df9.tar.bz2 |
Check gdb_python_module in gdbpy_handle_missing_debuginfo
If you run gdb in the build tree without --data-directory, on a
program that does not have debug info, it will crash, because
gdbpy_handle_missing_debuginfo unconditionally uses gdb_python_module.
Other code in gdb using gdb_python_module checks it first and it
seemes harmless to do the same thing here. (gdb_python_initialized
does not cover this case so that python can be partially initialized
and still somewhat work.)
Diffstat (limited to 'gdb/python')
-rw-r--r-- | gdb/python/python.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/gdb/python/python.c b/gdb/python/python.c index 4523e30..7e48165 100644 --- a/gdb/python/python.c +++ b/gdb/python/python.c @@ -1703,7 +1703,7 @@ gdbpy_handle_missing_debuginfo (const struct extension_language_defn *extlang, struct objfile *objfile) { /* Early exit if Python is not initialised. */ - if (!gdb_python_initialized) + if (!gdb_python_initialized || gdb_python_module == nullptr) return {}; struct gdbarch *gdbarch = objfile->arch (); |