if (top_level)
ui_interp->top_level_interpreter = interp;
- /* We use interpreter_p for the "set interpreter" variable, so we need
- to make sure we have a malloc'ed copy for the set command to free. */
- if (interpreter_p != NULL
- && strcmp (interp->name (), interpreter_p) != 0)
- {
- xfree (interpreter_p);
-
- interpreter_p = xstrdup (interp->name ());
- }
+ if (interpreter_p != interp->name ())
+ interpreter_p = interp->name ();
/* Run the init proc. */
if (!interp->inited)
#include "observable.h"
#include "serial.h"
-/* The selected interpreter. This will be used as a set command
- variable, so it should always be malloc'ed - since
- do_setshow_command will free it. */
-char *interpreter_p;
+/* The selected interpreter. */
+std::string interpreter_p;
/* System root path, used to find libraries etc. */
std::string gdb_sysroot;
this captured main, or one specified by the user at start up, or
the console. Initialize the interpreter to the one requested by
the application. */
- interpreter_p = xstrdup (context->interpreter_p);
+ interpreter_p = context->interpreter_p;
/* Parse arguments and options. */
{
case OPT_TUI:
/* --tui is equivalent to -i=tui. */
#ifdef TUI
- xfree (interpreter_p);
- interpreter_p = xstrdup (INTERP_TUI);
+ interpreter_p = INTERP_TUI;
#else
error (_("%s: TUI mode is not supported"), gdb_program_name);
#endif
actually useful, and if it is, what it should do. */
#ifdef GDBTK
/* --windows is equivalent to -i=insight. */
- xfree (interpreter_p);
- interpreter_p = xstrdup (INTERP_INSIGHT);
+ interpreter_p = INTERP_INSIGHT;
#endif
break;
case OPT_NOWINDOWS:
/* -nw is equivalent to -i=console. */
- xfree (interpreter_p);
- interpreter_p = xstrdup (INTERP_CONSOLE);
+ interpreter_p = INTERP_CONSOLE;
break;
case 'f':
annotation_level = 1;
}
#endif /* GDBTK */
case 'i':
- xfree (interpreter_p);
- interpreter_p = xstrdup (optarg);
+ interpreter_p = optarg;
break;
case 'd':
dirarg.push_back (optarg);
GDB retain the old MI1 interpreter startup behavior. Output the
copyright message before the interpreter is installed. That way
it isn't encapsulated in MI output. */
- if (!quiet && strcmp (interpreter_p, INTERP_MI1) == 0)
+ if (!quiet && interpreter_p == INTERP_MI1)
{
/* Print all the junk at the top, with trailing "..." if we are
about to read a symbol file (possibly slowly). */
/* Install the default UI. All the interpreters should have had a
look at things by now. Initialize the default interpreter. */
- set_top_level_interpreter (interpreter_p);
+ set_top_level_interpreter (interpreter_p.c_str ());
/* FIXME: cagney/2003-02-03: The big hack (part 2 of 2) that lets
GDB retain the old MI1 interpreter startup behavior. Output the
{
interp_factory_register (INTERP_TUI, tui_interp_factory);
- if (interpreter_p && strcmp (interpreter_p, INTERP_TUI) == 0)
+ if (interpreter_p == INTERP_TUI)
tui_start_enabled = true;
- if (interpreter_p && strcmp (interpreter_p, INTERP_CONSOLE) == 0)
- {
- xfree (interpreter_p);
- interpreter_p = xstrdup (INTERP_TUI);
- }
+ if (interpreter_p == INTERP_CONSOLE)
+ interpreter_p = INTERP_TUI;
/* If changing this, remember to update cli-interp.c as well. */
gdb::observers::normal_stop.attach (tui_on_normal_stop, "tui-interp");