/* Top level stuff for GDB, the GNU debugger.
- Copyright (C) 1986-2022 Free Software Foundation, Inc.
+ Copyright (C) 1986-2023 Free Software Foundation, Inc.
This file is part of GDB.
#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;
-
-/* Whether dbx commands will be handled. */
-int dbx_commands = 0;
+/* The selected interpreter. */
+std::string interpreter_p;
/* System root path, used to find libraries etc. */
std::string gdb_sysroot;
"../foo" and "../foo" doesn't exist then we'll record $(pwd)/../foo which
isn't canonical, but that's ok. */
if (!IS_ABSOLUTE_PATH (gdb_datadir.c_str ()))
- {
- gdb::unique_xmalloc_ptr<char> abs_datadir
- = gdb_abspath (gdb_datadir.c_str ());
-
- gdb_datadir = abs_datadir.get ();
- }
+ gdb_datadir = gdb_abspath (gdb_datadir.c_str ());
}
/* Relocate a file or directory. PROGNAME is the name by which gdb
main_ui = new ui (stdin, stdout, stderr);
current_ui = main_ui;
- gdb_stdtargerr = gdb_stderr; /* for moment */
- gdb_stdtargin = gdb_stdin; /* for moment */
+ gdb_stdtarg = gdb_stderr;
+ gdb_stdtargerr = gdb_stderr;
+ gdb_stdtargin = gdb_stdin;
if (bfd_init () != BFD_INIT_MAGIC)
error (_("fatal error: libbfd ABI mismatch"));
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. */
{
static struct option long_options[] =
{
{"tui", no_argument, 0, OPT_TUI},
- {"dbx", no_argument, &dbx_commands, 1},
{"readnow", no_argument, NULL, OPT_READNOW},
{"readnever", no_argument, NULL, OPT_READNEVER},
{"r", no_argument, NULL, OPT_READNOW},
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);
}
}
- if (dbx_commands)
- warning (_("--dbx mode is deprecated and will be removed"));
-
save_original_signals_state (quiet);
/* Try to set up an alternate signal stack for SIGSEGV handlers. */
exit (0);
}
- /* FIXME: cagney/2003-02-03: The big hack (part 1 of 2) that lets
- 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)
- {
- /* Print all the junk at the top, with trailing "..." if we are
- about to read a symbol file (possibly slowly). */
- print_gdb_version (gdb_stdout, true);
- if (symarg)
- gdb_printf ("..");
- gdb_printf ("\n");
- gdb_flush (gdb_stdout); /* Force to screen during slow
- operations. */
- }
-
/* 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
- copyright message after the interpreter is installed when it is
- any sane interpreter. */
- if (!quiet && !current_interp_named_p (INTERP_MI1))
+ if (!quiet)
{
/* Print all the junk at the top, with trailing "..." if we are
about to read a symbol file (possibly slowly). */
"), stream);
#endif
gdb_puts (_("\
- --dbx DBX compatibility mode.\n\
-q, --quiet, --silent\n\
Do not print version number on startup.\n\n\
"), stream);
"), stream);
if (REPORT_BUGS_TO[0] && stream == gdb_stdout)
gdb_printf (stream, _("\n\
-Report bugs to %s.\n\
-"), REPORT_BUGS_TO);
+Report bugs to %ps.\n\
+"), styled_string (file_name_style.style (), REPORT_BUGS_TO));
if (stream == gdb_stdout)
gdb_printf (stream, _("\n\
You can ask GDB-related questions on the GDB users mailing list\n\