From 041ca48e976b9a2a39a9440f7fbc2dffc77ed7c1 Mon Sep 17 00:00:00 2001 From: Andrew Burgess Date: Thu, 22 Apr 2021 18:26:15 +0100 Subject: gdb: extension languages finish_initialization to initialize Now that both Python and Guile are fully initialized from their respective finish_initialization methods, the "finish" in the method name doesn't really make sense; initialization starts _and_ finishes with that method. As such, this commit renames finish_initialization to just initialize. There should be no user visible changes after this commit. gdb/ChangeLog: * extension-priv.h (struct extension_language_ops): Rename 'finish_initialization' to 'initialize'. * extension.c (finish_ext_lang_initialization): Renamed to... (ext_lang_initialization): ...this, update comment, and updated the calls to reflect the change in struct extension_language_ops. * extension.h (finish_ext_lang_initialization): Renamed to... (ext_lang_initialization): ...this. * guile/guile.c (gdbscm_finish_initialization): Renamed to... (gdbscm_initialize): ...this, update comment at definition. (guile_extension_ops): Update. * main.c (captured_main_1): Update call to finish_ext_lang_initialization. * python/python.c (gdbpy_finish_initialization): Rename to... (gdbpy_initialize): ...this, update comment at definition, and update call to do_finish_initialization. (python_extension_ops): Update. (do_finish_initialization): Rename to... (do_initialize): ...this, and update comment. --- gdb/python/python.c | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) (limited to 'gdb/python/python.c') diff --git a/gdb/python/python.c b/gdb/python/python.c index 5205080..1d0d86d 100644 --- a/gdb/python/python.c +++ b/gdb/python/python.c @@ -129,8 +129,7 @@ PyObject *gdbpy_gdb_memory_error; static script_sourcer_func gdbpy_source_script; static objfile_script_sourcer_func gdbpy_source_objfile_script; static objfile_script_executor_func gdbpy_execute_objfile_script; -static void gdbpy_finish_initialization - (const struct extension_language_defn *); +static void gdbpy_initialize (const struct extension_language_defn *); static int gdbpy_initialized (const struct extension_language_defn *); static void gdbpy_eval_from_control_command (const struct extension_language_defn *, struct command_line *cmd); @@ -162,7 +161,7 @@ const struct extension_language_script_ops python_extension_script_ops = const struct extension_language_ops python_extension_ops = { - gdbpy_finish_initialization, + gdbpy_initialize, gdbpy_initialized, gdbpy_eval_from_control_command, @@ -1885,12 +1884,12 @@ message == an error message without a stack will be printed."), #ifdef HAVE_PYTHON -/* Helper function for gdbpy_finish_initialization. This does the - work and then returns false if an error has occurred and must be - displayed, or true on success. */ +/* Helper function for gdbpy_initialize. This does the work and then + returns false if an error has occurred and must be displayed, or true on + success. */ static bool -do_finish_initialization (const struct extension_language_defn *extlang) +do_initialize (const struct extension_language_defn *extlang) { PyObject *m; PyObject *sys_path; @@ -1948,21 +1947,19 @@ do_finish_initialization (const struct extension_language_defn *extlang) return gdb_pymodule_addobject (m, "gdb", gdb_python_module) >= 0; } -/* Perform the remaining python initializations. - These must be done after GDB is at least mostly initialized. - E.g., The "info pretty-printer" command needs the "info" prefix - command installed. - This is the extension_language_ops.finish_initialization "method". */ +/* Perform Python initialization. This will be called after GDB has + performed all of its own initialization. This is the + extension_language_ops.initialize "method". */ static void -gdbpy_finish_initialization (const struct extension_language_defn *extlang) +gdbpy_initialize (const struct extension_language_defn *extlang) { if (!do_start_initialization () && PyErr_Occurred ()) gdbpy_print_stack (); gdbpy_enter enter_py (get_current_arch (), current_language); - if (!do_finish_initialization (extlang)) + if (!do_initialize (extlang)) { gdbpy_print_stack (); warning (_("internal error: Unhandled Python exception")); -- cgit v1.1