This method is required. */
int (*initialized) (const struct extension_language_defn *);
+ /* Called just before GDB exits. This shuts down the extension
+ language. This can be NULL. */
+ void (*shutdown) (const struct extension_language_defn *);
+
/* Process a sequence of commands embedded in GDB's own scripting language.
E.g.,
python
}
}
+/* See extension.h. */
+
+void
+ext_lang_shutdown ()
+{
+ for (const struct extension_language_defn *extlang : extension_languages)
+ {
+ if (extlang->ops != nullptr && extlang->ops->shutdown != nullptr)
+ extlang->ops->shutdown (extlang);
+ }
+}
+
/* Invoke the appropriate extension_language_ops.eval_from_control_command
method to perform CMD, which is a list of commands in an extension language.
extern void ext_lang_initialization (void);
+/* Shut down all extension languages. */
+extern void ext_lang_shutdown ();
+
extern void eval_ext_lang_from_control_command (struct command_line *cmd);
extern void auto_load_ext_lang_scripts_for_objfile (struct objfile *);
{
gdbscm_initialize,
gdbscm_initialized,
+ nullptr,
gdbscm_eval_from_control_command,
static objfile_script_executor_func gdbpy_execute_objfile_script;
static void gdbpy_initialize (const struct extension_language_defn *);
static int gdbpy_initialized (const struct extension_language_defn *);
+static void finalize_python (const struct extension_language_defn *);
static void gdbpy_eval_from_control_command
(const struct extension_language_defn *, struct command_line *cmd);
static void gdbpy_start_type_printers (const struct extension_language_defn *,
{
gdbpy_initialize,
gdbpy_initialized,
+ finalize_python,
gdbpy_eval_from_control_command,
interpreter. This lets Python's 'atexit' work. */
static void
-finalize_python ()
+finalize_python (const struct extension_language_defn *ignore)
{
struct active_ext_lang_state *previous_active;
/* Release the GIL while gdb runs. */
PyEval_SaveThread ();
- add_final_cleanup (finalize_python);
-
/* Only set this when initialization has succeeded. */
gdb_python_initialized = 1;
return true;
exception_print (gdb_stderr, ex);
}
+ ext_lang_shutdown ();
+
exit (exit_code);
}