/* Top level stuff for GDB, the GNU debugger.
- Copyright (C) 1986-2021 Free Software Foundation, Inc.
+ Copyright (C) 1986-2022 Free Software Foundation, Inc.
This file is part of GDB.
do_setshow_command will free it. */
char *interpreter_p;
-/* Whether dbx commands will be handled. */
-int dbx_commands = 0;
-
/* System root path, used to find libraries etc. */
-char *gdb_sysroot = 0;
+std::string gdb_sysroot;
/* GDB datadir, used to store data files. */
std::string gdb_datadir;
{
int save_errno = errno;
- fprintf_unfiltered (gdb_stderr, "Warning: ");
+ gdb_printf (gdb_stderr, "Warning: ");
print_sys_errmsg (new_datadir, save_errno);
}
else if (!S_ISDIR (st.st_mode))
"../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
/* Option type -ix. */
CMDARG_INIT_FILE,
-
+
/* Option type -iex. */
CMDARG_INIT_COMMAND,
- /* Option type -sx. */
+ /* Option type -eix. */
CMDARG_EARLYINIT_FILE,
- /* Option type -sex. */
+ /* Option type -eiex. */
CMDARG_EARLYINIT_COMMAND
};
/* Prefix warning messages with the command name. */
gdb::unique_xmalloc_ptr<char> tmp_warn_preprint
- (xstrprintf ("%s: warning: ", gdb_program_name));
+ = xstrprintf ("%s: warning: ", gdb_program_name);
warning_pre_print = tmp_warn_preprint.get ();
current_directory = getcwd (NULL, 0);
perror_warning_with_name (_("error finding working directory"));
/* Set the sysroot path. */
- gdb_sysroot
- = xstrdup (relocate_gdb_directory (TARGET_SYSTEM_ROOT,
- TARGET_SYSTEM_ROOT_RELOCATABLE).c_str ());
+ gdb_sysroot = relocate_gdb_directory (TARGET_SYSTEM_ROOT,
+ TARGET_SYSTEM_ROOT_RELOCATABLE);
- if (*gdb_sysroot == '\0')
- {
- xfree (gdb_sysroot);
- gdb_sysroot = xstrdup (TARGET_SYSROOT_PREFIX);
- }
+ if (gdb_sysroot.empty ())
+ gdb_sysroot = TARGET_SYSROOT_PREFIX;
debug_file_directory
- = xstrdup (relocate_gdb_directory (DEBUGDIR,
- DEBUGDIR_RELOCATABLE).c_str ());
+ = relocate_gdb_directory (DEBUGDIR, DEBUGDIR_RELOCATABLE);
gdb_datadir = relocate_gdb_directory (GDB_DATADIR,
GDB_DATADIR_RELOCATABLE);
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},
execute_cmdargs (&cmdarg_vec, CMDARG_EARLYINIT_FILE,
CMDARG_EARLYINIT_COMMAND, &ret);
- /* Finish initializing the extension languges. */
- finish_ext_lang_initialization ();
+ /* Initialize the extension languages. */
+ ext_lang_initialization ();
/* Recheck if we're starting up quietly after processing the startup
scripts and commands. */
/* Any argument left on the command line is unexpected and
will be ignored. Inform the user. */
if (optind < argc)
- fprintf_unfiltered (gdb_stderr,
- _("Excess command line "
- "arguments ignored. (%s%s)\n"),
- argv[optind],
- (optind == argc - 1) ? "" : " ...");
+ gdb_printf (gdb_stderr,
+ _("Excess command line "
+ "arguments ignored. (%s%s)\n"),
+ argv[optind],
+ (optind == argc - 1) ? "" : " ...");
}
/* Lookup gdbinit files. Note that the gdbinit file name may be
if (print_version)
{
print_gdb_version (gdb_stdout, false);
- wrap_here ("");
- printf_filtered ("\n");
+ gdb_printf ("\n");
exit (0);
}
if (print_configuration)
{
print_gdb_configuration (gdb_stdout);
- wrap_here ("");
- printf_filtered ("\n");
+ gdb_printf ("\n");
exit (0);
}
about to read a symbol file (possibly slowly). */
print_gdb_version (gdb_stdout, true);
if (symarg)
- printf_filtered ("..");
- wrap_here ("");
- printf_filtered ("\n");
+ gdb_printf ("..");
+ gdb_printf ("\n");
gdb_flush (gdb_stdout); /* Force to screen during slow
operations. */
}
about to read a symbol file (possibly slowly). */
print_gdb_version (gdb_stdout, true);
if (symarg)
- printf_filtered ("..");
- wrap_here ("");
- printf_filtered ("\n");
+ gdb_printf ("..");
+ gdb_printf ("\n");
gdb_flush (gdb_stdout); /* Force to screen during slow
operations. */
}
/* Note: The options in the list below are only approximately sorted
in the alphabetical order, so as to group closely related options
together. */
- fputs_unfiltered (_("\
+ gdb_puts (_("\
This is the GNU debugger. Usage:\n\n\
gdb [options] [executable-file [core-file or process-id]]\n\
gdb [options] --args executable-file [inferior-arguments ...]\n\n\
"), stream);
- fputs_unfiltered (_("\
+ gdb_puts (_("\
Selection of debuggee and its files:\n\n\
--args Arguments after executable-file are passed to inferior.\n\
--core=COREFILE Analyze the core dump COREFILE.\n\
--readnever Do not read symbol files.\n\
--write Set writing into executable and core files.\n\n\
"), stream);
- fputs_unfiltered (_("\
+ gdb_puts (_("\
Initial commands and command files:\n\n\
--command=FILE, -x Execute GDB commands from FILE.\n\
--init-command=FILE, -ix\n\
--nh Do not read ~/.gdbinit.\n\
--nx Do not read any .gdbinit files in any directory.\n\n\
"), stream);
- fputs_unfiltered (_("\
+ gdb_puts (_("\
Output and user interface control:\n\n\
--fullname Output information used by emacs-GDB interface.\n\
--interpreter=INTERP\n\
--nw Do not use the GUI interface.\n\
"), stream);
#if defined(TUI)
- fputs_unfiltered (_("\
+ gdb_puts (_("\
--tui Use a terminal user interface.\n\
"), stream);
#endif
- fputs_unfiltered (_("\
- --dbx DBX compatibility mode.\n\
+ gdb_puts (_("\
-q, --quiet, --silent\n\
Do not print version number on startup.\n\n\
"), stream);
- fputs_unfiltered (_("\
+ gdb_puts (_("\
Operating modes:\n\n\
--batch Exit after processing options.\n\
--batch-silent Like --batch, but suppress all gdb stdout output.\n\
--data-directory=DIR, -D\n\
Set GDB's data-directory to DIR.\n\
"), stream);
- fputs_unfiltered (_("\n\
+ gdb_puts (_("\n\
At startup, GDB reads the following early init files and executes their\n\
commands:\n\
"), stream);
if (!home_gdbearlyinit.empty ())
- fprintf_unfiltered (stream, _("\
+ gdb_printf (stream, _("\
* user-specific early init file: %s\n\
"), home_gdbearlyinit.c_str ());
if (home_gdbearlyinit.empty ())
- fprintf_unfiltered (stream, _("\
+ gdb_printf (stream, _("\
None found.\n"));
- fputs_unfiltered (_("\n\
+ gdb_puts (_("\n\
At startup, GDB reads the following init files and executes their commands:\n\
"), stream);
if (!system_gdbinit.empty ())
if (idx < system_gdbinit.size () - 1)
output += ", ";
}
- fprintf_unfiltered (stream, _("\
+ gdb_printf (stream, _("\
* system-wide init files: %s\n\
"), output.c_str ());
}
if (!home_gdbinit.empty ())
- fprintf_unfiltered (stream, _("\
+ gdb_printf (stream, _("\
* user-specific init file: %s\n\
"), home_gdbinit.c_str ());
if (!local_gdbinit.empty ())
- fprintf_unfiltered (stream, _("\
+ gdb_printf (stream, _("\
* local init file (see also 'set auto-load local-gdbinit'): ./%s\n\
"), local_gdbinit.c_str ());
if (system_gdbinit.empty () && home_gdbinit.empty ()
&& local_gdbinit.empty ())
- fprintf_unfiltered (stream, _("\
+ gdb_printf (stream, _("\
None found.\n"));
- fputs_unfiltered (_("\n\
+ gdb_puts (_("\n\
For more information, type \"help\" from within GDB, or consult the\n\
GDB manual (available as on-line info or a printed manual).\n\
"), stream);
if (REPORT_BUGS_TO[0] && stream == gdb_stdout)
- fprintf_unfiltered (stream, _("\n\
-Report bugs to %s.\n\
-"), REPORT_BUGS_TO);
+ gdb_printf (stream, _("\n\
+Report bugs to %ps.\n\
+"), styled_string (file_name_style.style (), REPORT_BUGS_TO));
if (stream == gdb_stdout)
- fprintf_unfiltered (stream, _("\n\
+ gdb_printf (stream, _("\n\
You can ask GDB-related questions on the GDB users mailing list\n\
(gdb@sourceware.org) or on GDB's IRC channel (#gdb on Freenode).\n"));
}