This is the mail archive of the mailing list for the GDB project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] Factor out mi_ui_out instantiation logic

*** TEST RESULTS FOR COMMIT 8e5e5494f8653dd83ce1413d141e26c09dddab7b ***

Author: Simon Marchi <>
Branch: master
Commit: 8e5e5494f8653dd83ce1413d141e26c09dddab7b

Factor out mi_ui_out instantiation logic

When re-reviewing this [1] I noticed that there were two spots encoding
the logic of instantiating an mi_ui_out object based on the interpreter
name ("mi", "mi1", "mi2" or "mi3"):

 - mi_interp::init
 - mi_load_progress

Both encode the logic to choose what the default version is when the
interpreter name is "mi".  I had forgotten the one in mi_load_progress.

Therefore, I propose extracting that logic to a single function.  I
started to add a new overload of mi_out_new, then realized the current
mi_out_new wasn't very useful, being just a thing wrapper around "new
mi_ui_out".  So I ended up with just an mi_out_new function taking the
interp name as parameter.

I ran the gdb.mi tests, and verified manually the behavior (including
the load command).



	* mi/mi-out.h (mi_out_new): Change parameter to const char *.
	* mi/mi-out.c (mi_out_new): Change parameter to const char *,
	instantiate mi_ui_out based on interpreter name.
	* mi/mi-interp.c (mi_interp::init): Use the new mi_out_new.
	* mi/mi-main.c (mi_load_progress): Likewise.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]