[5/7] gdb: initialise extension languages after processing early startup files

Message ID d1305d741e5a73c6ef9783a6d5c39230c1b676e3.1619125261.git.andrew.burgess@embecosm.com
State New
Headers show
  • New options to control how Python is initialized
Related show

Commit Message

Andrew Burgess April 22, 2021, 9:02 p.m.
Now (thanks to the last few commits) all extension languages are
fully initialised in their finish_initialization method, this commit
delays the call to this method until after the early initialization
files have been processed.

Right now there's no benefit from doing this, but in a later commit I
plan to add new options for Python that will control how Python is

With this commit in place, my next commits will allow the user to add
options to their early initialization file and alter how Python starts

There should be no user visible changes after this commit.


	* main.c (captured_main_1): Add a call to
	* top.c (gdb_init): Remove call to finish_ext_lang_initialization.
 gdb/ChangeLog | 6 ++++++
 gdb/main.c    | 3 +++
 gdb/top.c     | 6 ------
 3 files changed, 9 insertions(+), 6 deletions(-)



Tom Tromey April 23, 2021, 2:30 p.m. | #1
>>>>> "Andrew" == Andrew Burgess <andrew.burgess@embecosm.com> writes:

Andrew> gdb/ChangeLog:

Andrew> 	* main.c (captured_main_1): Add a call to
Andrew> 	finish_ext_lang_initialization.
Andrew> 	* top.c (gdb_init): Remove call to finish_ext_lang_initialization.

Looks good.  Thanks.



diff --git a/gdb/main.c b/gdb/main.c
index 652e6f76fa0..2a1c3a4866f 100644
--- a/gdb/main.c
+++ b/gdb/main.c
@@ -1053,6 +1053,9 @@  captured_main_1 (struct captured_main_args *context)
   execute_cmdargs (&cmdarg_vec, CMDARG_EARLYINIT_FILE,
+  /* Finish initializing the extension languges.  */
+  finish_ext_lang_initialization ();
   /* Recheck if we're starting up quietly after processing the startup
      scripts and commands.  */
   if (!quiet)
diff --git a/gdb/top.c b/gdb/top.c
index b58cd4facfc..a83d16bed15 100644
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -2408,12 +2408,6 @@  gdb_init ()
   set_language (language_c);
   expected_language = current_language;	/* Don't warn about the change.  */
-  /* Python initialization, for example, can require various commands to be
-     installed.  For example "info pretty-printer" needs the "info"
-     prefix to be installed.  Keep things simple and just do final
-     script initialization here.  */
-  finish_ext_lang_initialization ();
   /* Create $_gdb_major and $_gdb_minor convenience variables.  */
   init_gdb_version_vars ();