gdb: make string-like set show commands use std::string variable
String-like settings (var_string, var_filename, var_optional_filename, var_string_noescape) currently take a pointer to a `char *` storage variable (typically global) that holds the setting's value. I'd like to "mordernize" this by changing them to use an std::string for storage. An obvious reason is that string operations on std::string are often easier to write than with C strings. And they avoid having to do any manual memory management. Another interesting reason is that, with `char *`, nullptr and an empty string often both have the same meaning of "no value". String settings are initially nullptr (unless initialized otherwise). But when doing "set foo" (where `foo` is a string setting), the setting now points to an empty string. For example, solib_search_path is nullptr at startup, but points to an empty string after doing "set solib-search-path". This leads to some code that needs to check for both to check for "no value". Or some code that converts back and forth between NULL and "" when getting or setting the value. I find this very error-prone, because it is very easy to forget one or the other. With std::string, we at least know that the variable is not "NULL". There is only one way of representing an empty string setting, that is with an empty string. I was wondering whether the distinction between NULL and "" would be important for some setting, but it doesn't seem so. If that ever happens, it would be more C++-y and self-descriptive to use optional<string> anyway. Actually, there's one spot where this distinction mattered, it's in init_history, for the test gdb.base/gdbinit-history.exp. init_history sets the history filename to the default ".gdb_history" if it sees that the setting was never set - if history_filename is nullptr. If history_filename is an empty string, it means the setting was explicitly cleared, so it leaves it as-is. With the change to std::string, this distinction doesn't exist anymore. This can be fixed by moving the code that chooses a good default value for history_filename to _initialize_top. This is ran before -ex commands are processed, so an -ex command can then clear that value if needed (what gdb.base/gdbinit-history.exp tests). Another small improvement, in my opinion is that we can now easily give string parameters initial values, by simply initializing the global variables, instead of xstrdup-ing it in the _initialize function. In Python and Guile, when registering a string-like parameter, we allocate (with new) an std::string that is owned by the param_smob (in Guile) and the parmpy_object (in Python) objects. This patch started by changing all relevant add_setshow_* commands to take an `std::string *` instead of a `char **` and fixing everything that failed to build. That includes of course all string setting variable and their uses. string_option_def now uses an std::string also, because there's a connection between options and settings (see add_setshow_cmds_for_options). The add_path function in source.c is really complex and twisted, I'd rather not try to change it to work on an std::string right now. Instead, I added an overload that copies the std:string to a `char *` and back. This means more copying, but this is not used in a hot path at all, so I think it is acceptable. Change-Id: I92c50a1bdd8307141cdbacb388248e4e4fc08c93 Co-authored-by: Lancelot SIX <lsix@lancelotsix.com>
This commit is contained in:
parent
1d7fe7f01b
commit
e0700ba44c
44 changed files with 476 additions and 509 deletions
|
@ -137,7 +137,7 @@ show_auto_load_local_gdbinit (struct ui_file *file, int from_tty,
|
||||||
/* Directory list from which to load auto-loaded scripts. It is not checked
|
/* Directory list from which to load auto-loaded scripts. It is not checked
|
||||||
for absolute paths but they are strongly recommended. It is initialized by
|
for absolute paths but they are strongly recommended. It is initialized by
|
||||||
_initialize_auto_load. */
|
_initialize_auto_load. */
|
||||||
static char *auto_load_dir;
|
static std::string auto_load_dir = AUTO_LOAD_DIR;
|
||||||
|
|
||||||
/* "set" command for the auto_load_dir configuration variable. */
|
/* "set" command for the auto_load_dir configuration variable. */
|
||||||
|
|
||||||
|
@ -145,11 +145,8 @@ static void
|
||||||
set_auto_load_dir (const char *args, int from_tty, struct cmd_list_element *c)
|
set_auto_load_dir (const char *args, int from_tty, struct cmd_list_element *c)
|
||||||
{
|
{
|
||||||
/* Setting the variable to "" resets it to the compile time defaults. */
|
/* Setting the variable to "" resets it to the compile time defaults. */
|
||||||
if (auto_load_dir[0] == '\0')
|
if (auto_load_dir.empty ())
|
||||||
{
|
auto_load_dir = AUTO_LOAD_DIR;
|
||||||
xfree (auto_load_dir);
|
|
||||||
auto_load_dir = xstrdup (AUTO_LOAD_DIR);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* "show" command for the auto_load_dir configuration variable. */
|
/* "show" command for the auto_load_dir configuration variable. */
|
||||||
|
@ -166,7 +163,7 @@ show_auto_load_dir (struct ui_file *file, int from_tty,
|
||||||
/* Directory list safe to hold auto-loaded files. It is not checked for
|
/* Directory list safe to hold auto-loaded files. It is not checked for
|
||||||
absolute paths but they are strongly recommended. It is initialized by
|
absolute paths but they are strongly recommended. It is initialized by
|
||||||
_initialize_auto_load. */
|
_initialize_auto_load. */
|
||||||
static char *auto_load_safe_path;
|
static std::string auto_load_safe_path = AUTO_LOAD_SAFE_PATH;
|
||||||
|
|
||||||
/* Vector of directory elements of AUTO_LOAD_SAFE_PATH with each one normalized
|
/* Vector of directory elements of AUTO_LOAD_SAFE_PATH with each one normalized
|
||||||
by tilde_expand and possibly each entries has added its gdb_realpath
|
by tilde_expand and possibly each entries has added its gdb_realpath
|
||||||
|
@ -181,7 +178,7 @@ auto_load_expand_dir_vars (const char *string)
|
||||||
{
|
{
|
||||||
char *s = xstrdup (string);
|
char *s = xstrdup (string);
|
||||||
substitute_path_component (&s, "$datadir", gdb_datadir.c_str ());
|
substitute_path_component (&s, "$datadir", gdb_datadir.c_str ());
|
||||||
substitute_path_component (&s, "$debugdir", debug_file_directory);
|
substitute_path_component (&s, "$debugdir", debug_file_directory.c_str ());
|
||||||
|
|
||||||
if (debug_auto_load && strcmp (s, string) != 0)
|
if (debug_auto_load && strcmp (s, string) != 0)
|
||||||
auto_load_debug_printf ("Expanded $-variables to \"%s\".", s);
|
auto_load_debug_printf ("Expanded $-variables to \"%s\".", s);
|
||||||
|
@ -199,9 +196,10 @@ static void
|
||||||
auto_load_safe_path_vec_update (void)
|
auto_load_safe_path_vec_update (void)
|
||||||
{
|
{
|
||||||
auto_load_debug_printf ("Updating directories of \"%s\".",
|
auto_load_debug_printf ("Updating directories of \"%s\".",
|
||||||
auto_load_safe_path);
|
auto_load_safe_path.c_str ());
|
||||||
|
|
||||||
auto_load_safe_path_vec = auto_load_expand_dir_vars (auto_load_safe_path);
|
auto_load_safe_path_vec
|
||||||
|
= auto_load_expand_dir_vars (auto_load_safe_path.c_str ());
|
||||||
size_t len = auto_load_safe_path_vec.size ();
|
size_t len = auto_load_safe_path_vec.size ();
|
||||||
|
|
||||||
/* Apply tilde_expand and gdb_realpath to each AUTO_LOAD_SAFE_PATH_VEC
|
/* Apply tilde_expand and gdb_realpath to each AUTO_LOAD_SAFE_PATH_VEC
|
||||||
|
@ -253,11 +251,8 @@ set_auto_load_safe_path (const char *args,
|
||||||
int from_tty, struct cmd_list_element *c)
|
int from_tty, struct cmd_list_element *c)
|
||||||
{
|
{
|
||||||
/* Setting the variable to "" resets it to the compile time defaults. */
|
/* Setting the variable to "" resets it to the compile time defaults. */
|
||||||
if (auto_load_safe_path[0] == '\0')
|
if (auto_load_safe_path.empty ())
|
||||||
{
|
auto_load_safe_path = AUTO_LOAD_SAFE_PATH;
|
||||||
xfree (auto_load_safe_path);
|
|
||||||
auto_load_safe_path = xstrdup (AUTO_LOAD_SAFE_PATH);
|
|
||||||
}
|
|
||||||
|
|
||||||
auto_load_safe_path_vec_update ();
|
auto_load_safe_path_vec_update ();
|
||||||
}
|
}
|
||||||
|
@ -291,17 +286,14 @@ show_auto_load_safe_path (struct ui_file *file, int from_tty,
|
||||||
static void
|
static void
|
||||||
add_auto_load_safe_path (const char *args, int from_tty)
|
add_auto_load_safe_path (const char *args, int from_tty)
|
||||||
{
|
{
|
||||||
char *s;
|
|
||||||
|
|
||||||
if (args == NULL || *args == 0)
|
if (args == NULL || *args == 0)
|
||||||
error (_("\
|
error (_("\
|
||||||
Directory argument required.\n\
|
Directory argument required.\n\
|
||||||
Use 'set auto-load safe-path /' for disabling the auto-load safe-path security.\
|
Use 'set auto-load safe-path /' for disabling the auto-load safe-path security.\
|
||||||
"));
|
"));
|
||||||
|
|
||||||
s = xstrprintf ("%s%c%s", auto_load_safe_path, DIRNAME_SEPARATOR, args);
|
auto_load_safe_path = string_printf ("%s%c%s", auto_load_safe_path.c_str (),
|
||||||
xfree (auto_load_safe_path);
|
DIRNAME_SEPARATOR, args);
|
||||||
auto_load_safe_path = s;
|
|
||||||
|
|
||||||
auto_load_safe_path_vec_update ();
|
auto_load_safe_path_vec_update ();
|
||||||
}
|
}
|
||||||
|
@ -312,14 +304,11 @@ Use 'set auto-load safe-path /' for disabling the auto-load safe-path security.\
|
||||||
static void
|
static void
|
||||||
add_auto_load_dir (const char *args, int from_tty)
|
add_auto_load_dir (const char *args, int from_tty)
|
||||||
{
|
{
|
||||||
char *s;
|
|
||||||
|
|
||||||
if (args == NULL || *args == 0)
|
if (args == NULL || *args == 0)
|
||||||
error (_("Directory argument required."));
|
error (_("Directory argument required."));
|
||||||
|
|
||||||
s = xstrprintf ("%s%c%s", auto_load_dir, DIRNAME_SEPARATOR, args);
|
auto_load_dir = string_printf ("%s%c%s", auto_load_dir.c_str (),
|
||||||
xfree (auto_load_dir);
|
DIRNAME_SEPARATOR, args);
|
||||||
auto_load_dir = s;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Implementation for filename_is_in_pattern overwriting the caller's FILENAME
|
/* Implementation for filename_is_in_pattern overwriting the caller's FILENAME
|
||||||
|
@ -459,7 +448,7 @@ file_is_auto_load_safe (const char *filename)
|
||||||
warning (_("File \"%ps\" auto-loading has been declined by your "
|
warning (_("File \"%ps\" auto-loading has been declined by your "
|
||||||
"`auto-load safe-path' set to \"%s\"."),
|
"`auto-load safe-path' set to \"%s\"."),
|
||||||
styled_string (file_name_style.style (), filename_real.get ()),
|
styled_string (file_name_style.style (), filename_real.get ()),
|
||||||
auto_load_safe_path);
|
auto_load_safe_path.c_str ());
|
||||||
|
|
||||||
if (!advice_printed)
|
if (!advice_printed)
|
||||||
{
|
{
|
||||||
|
@ -749,11 +738,11 @@ auto_load_objfile_script_1 (struct objfile *objfile, const char *realname,
|
||||||
directory. */
|
directory. */
|
||||||
|
|
||||||
std::vector<gdb::unique_xmalloc_ptr<char>> vec
|
std::vector<gdb::unique_xmalloc_ptr<char>> vec
|
||||||
= auto_load_expand_dir_vars (auto_load_dir);
|
= auto_load_expand_dir_vars (auto_load_dir.c_str ());
|
||||||
|
|
||||||
auto_load_debug_printf
|
auto_load_debug_printf
|
||||||
("Searching 'set auto-load scripts-directory' path \"%s\".",
|
("Searching 'set auto-load scripts-directory' path \"%s\".",
|
||||||
auto_load_dir);
|
auto_load_dir.c_str ());
|
||||||
|
|
||||||
/* Convert Windows file name from c:/dir/file to /c/dir/file. */
|
/* Convert Windows file name from c:/dir/file to /c/dir/file. */
|
||||||
if (HAS_DRIVE_SPEC (debugfile))
|
if (HAS_DRIVE_SPEC (debugfile))
|
||||||
|
@ -1542,8 +1531,6 @@ This option has security implications for untrusted inferiors."),
|
||||||
Usage: info auto-load local-gdbinit"),
|
Usage: info auto-load local-gdbinit"),
|
||||||
auto_load_info_cmdlist_get ());
|
auto_load_info_cmdlist_get ());
|
||||||
|
|
||||||
auto_load_dir = xstrdup (AUTO_LOAD_DIR);
|
|
||||||
|
|
||||||
suffix = ext_lang_auto_load_suffix (get_ext_lang_defn (EXT_LANG_GDB));
|
suffix = ext_lang_auto_load_suffix (get_ext_lang_defn (EXT_LANG_GDB));
|
||||||
gdb_name_help
|
gdb_name_help
|
||||||
= xstrprintf (_("\
|
= xstrprintf (_("\
|
||||||
|
@ -1595,7 +1582,6 @@ Show the list of directories from which to load auto-loaded scripts."),
|
||||||
xfree (gdb_name_help);
|
xfree (gdb_name_help);
|
||||||
xfree (guile_name_help);
|
xfree (guile_name_help);
|
||||||
|
|
||||||
auto_load_safe_path = xstrdup (AUTO_LOAD_SAFE_PATH);
|
|
||||||
auto_load_safe_path_vec_update ();
|
auto_load_safe_path_vec_update ();
|
||||||
add_setshow_optional_filename_cmd ("safe-path", class_support,
|
add_setshow_optional_filename_cmd ("safe-path", class_support,
|
||||||
&auto_load_safe_path, _("\
|
&auto_load_safe_path, _("\
|
||||||
|
|
|
@ -276,7 +276,7 @@ static const char *dprintf_style = dprintf_style_gdb;
|
||||||
copied into the command, so it can be anything that GDB can
|
copied into the command, so it can be anything that GDB can
|
||||||
evaluate to a callable address, not necessarily a function name. */
|
evaluate to a callable address, not necessarily a function name. */
|
||||||
|
|
||||||
static char *dprintf_function;
|
static std::string dprintf_function = "printf";
|
||||||
|
|
||||||
/* The channel to use for dynamic printf if the preferred style is to
|
/* The channel to use for dynamic printf if the preferred style is to
|
||||||
call into the inferior; if a nonempty string, it will be passed to
|
call into the inferior; if a nonempty string, it will be passed to
|
||||||
|
@ -286,7 +286,7 @@ static char *dprintf_function;
|
||||||
"stderr", this could be an app-specific expression like
|
"stderr", this could be an app-specific expression like
|
||||||
"mystreams[curlogger]". */
|
"mystreams[curlogger]". */
|
||||||
|
|
||||||
static char *dprintf_channel;
|
static std::string dprintf_channel;
|
||||||
|
|
||||||
/* True if dprintf commands should continue to operate even if GDB
|
/* True if dprintf commands should continue to operate even if GDB
|
||||||
has disconnected. */
|
has disconnected. */
|
||||||
|
@ -6658,7 +6658,7 @@ default_collect_info (void)
|
||||||
/* If it has no value (which is frequently the case), say nothing; a
|
/* If it has no value (which is frequently the case), say nothing; a
|
||||||
message like "No default-collect." gets in user's face when it's
|
message like "No default-collect." gets in user's face when it's
|
||||||
not wanted. */
|
not wanted. */
|
||||||
if (!*default_collect)
|
if (default_collect.empty ())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* The following phrase lines up nicely with per-tracepoint collect
|
/* The following phrase lines up nicely with per-tracepoint collect
|
||||||
|
@ -8759,17 +8759,17 @@ update_dprintf_command_list (struct breakpoint *b)
|
||||||
printf_line = xstrprintf ("printf %s", dprintf_args);
|
printf_line = xstrprintf ("printf %s", dprintf_args);
|
||||||
else if (strcmp (dprintf_style, dprintf_style_call) == 0)
|
else if (strcmp (dprintf_style, dprintf_style_call) == 0)
|
||||||
{
|
{
|
||||||
if (!dprintf_function)
|
if (dprintf_function.empty ())
|
||||||
error (_("No function supplied for dprintf call"));
|
error (_("No function supplied for dprintf call"));
|
||||||
|
|
||||||
if (dprintf_channel && strlen (dprintf_channel) > 0)
|
if (!dprintf_channel.empty ())
|
||||||
printf_line = xstrprintf ("call (void) %s (%s,%s)",
|
printf_line = xstrprintf ("call (void) %s (%s,%s)",
|
||||||
dprintf_function,
|
dprintf_function.c_str (),
|
||||||
dprintf_channel,
|
dprintf_channel.c_str (),
|
||||||
dprintf_args);
|
dprintf_args);
|
||||||
else
|
else
|
||||||
printf_line = xstrprintf ("call (void) %s (%s)",
|
printf_line = xstrprintf ("call (void) %s (%s)",
|
||||||
dprintf_function,
|
dprintf_function.c_str (),
|
||||||
dprintf_args);
|
dprintf_args);
|
||||||
}
|
}
|
||||||
else if (strcmp (dprintf_style, dprintf_style_agent) == 0)
|
else if (strcmp (dprintf_style, dprintf_style_agent) == 0)
|
||||||
|
@ -15102,8 +15102,8 @@ save_breakpoints (const char *filename, int from_tty,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (extra_trace_bits && *default_collect)
|
if (extra_trace_bits && !default_collect.empty ())
|
||||||
fp.printf ("set default-collect %s\n", default_collect);
|
fp.printf ("set default-collect %s\n", default_collect.c_str ());
|
||||||
|
|
||||||
if (from_tty)
|
if (from_tty)
|
||||||
printf_filtered (_("Saved to file '%s'.\n"), expanded_filename.get ());
|
printf_filtered (_("Saved to file '%s'.\n"), expanded_filename.get ());
|
||||||
|
@ -16014,7 +16014,6 @@ output stream by setting dprintf-function and dprintf-channel."),
|
||||||
update_dprintf_commands, NULL,
|
update_dprintf_commands, NULL,
|
||||||
&setlist, &showlist);
|
&setlist, &showlist);
|
||||||
|
|
||||||
dprintf_function = xstrdup ("printf");
|
|
||||||
add_setshow_string_cmd ("dprintf-function", class_support,
|
add_setshow_string_cmd ("dprintf-function", class_support,
|
||||||
&dprintf_function, _("\
|
&dprintf_function, _("\
|
||||||
Set the function to use for dynamic printf."), _("\
|
Set the function to use for dynamic printf."), _("\
|
||||||
|
@ -16022,7 +16021,6 @@ Show the function to use for dynamic printf."), NULL,
|
||||||
update_dprintf_commands, NULL,
|
update_dprintf_commands, NULL,
|
||||||
&setlist, &showlist);
|
&setlist, &showlist);
|
||||||
|
|
||||||
dprintf_channel = xstrdup ("");
|
|
||||||
add_setshow_string_cmd ("dprintf-channel", class_support,
|
add_setshow_string_cmd ("dprintf-channel", class_support,
|
||||||
&dprintf_channel, _("\
|
&dprintf_channel, _("\
|
||||||
Set the channel to use for dynamic printf."), _("\
|
Set the channel to use for dynamic printf."), _("\
|
||||||
|
|
|
@ -130,7 +130,7 @@ build_id_to_bfd_suffix (size_t build_id_len, const bfd_byte *build_id,
|
||||||
cause "/.build-id/..." lookups. */
|
cause "/.build-id/..." lookups. */
|
||||||
|
|
||||||
std::vector<gdb::unique_xmalloc_ptr<char>> debugdir_vec
|
std::vector<gdb::unique_xmalloc_ptr<char>> debugdir_vec
|
||||||
= dirnames_to_char_ptr_vec (debug_file_directory);
|
= dirnames_to_char_ptr_vec (debug_file_directory.c_str ());
|
||||||
|
|
||||||
for (const gdb::unique_xmalloc_ptr<char> &debugdir : debugdir_vec)
|
for (const gdb::unique_xmalloc_ptr<char> &debugdir : debugdir_vec)
|
||||||
{
|
{
|
||||||
|
@ -167,7 +167,7 @@ build_id_to_bfd_suffix (size_t build_id_len, const bfd_byte *build_id,
|
||||||
Don't do it if the sysroot is the target system ("target:"). It
|
Don't do it if the sysroot is the target system ("target:"). It
|
||||||
could work in theory, but the lrealpath in build_id_to_debug_bfd_1
|
could work in theory, but the lrealpath in build_id_to_debug_bfd_1
|
||||||
only works with local paths. */
|
only works with local paths. */
|
||||||
if (strcmp (gdb_sysroot, TARGET_SYSROOT_PREFIX) != 0)
|
if (gdb_sysroot != TARGET_SYSROOT_PREFIX)
|
||||||
{
|
{
|
||||||
link = gdb_sysroot + link;
|
link = gdb_sysroot + link;
|
||||||
debug_bfd = build_id_to_debug_bfd_1 (link, build_id_len, build_id);
|
debug_bfd = build_id_to_debug_bfd_1 (link, build_id_len, build_id);
|
||||||
|
|
|
@ -650,7 +650,7 @@ find_and_open_script (const char *script_file, int search_path)
|
||||||
/* Search for and open 'file' on the search path used for source
|
/* Search for and open 'file' on the search path used for source
|
||||||
files. Put the full location in *FULL_PATHP. */
|
files. Put the full location in *FULL_PATHP. */
|
||||||
gdb::unique_xmalloc_ptr<char> full_path;
|
gdb::unique_xmalloc_ptr<char> full_path;
|
||||||
fd = openp (source_path, search_flags,
|
fd = openp (source_path.c_str (), search_flags,
|
||||||
file.get (), O_RDONLY, &full_path);
|
file.get (), O_RDONLY, &full_path);
|
||||||
|
|
||||||
if (fd == -1)
|
if (fd == -1)
|
||||||
|
@ -1042,12 +1042,7 @@ edit_command (const char *arg, int from_tty)
|
||||||
struct pipe_cmd_opts
|
struct pipe_cmd_opts
|
||||||
{
|
{
|
||||||
/* For "-d". */
|
/* For "-d". */
|
||||||
char *delimiter = nullptr;
|
std::string delimiter;
|
||||||
|
|
||||||
~pipe_cmd_opts ()
|
|
||||||
{
|
|
||||||
xfree (delimiter);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static const gdb::option::option_def pipe_cmd_option_defs[] = {
|
static const gdb::option::option_def pipe_cmd_option_defs[] = {
|
||||||
|
@ -1084,8 +1079,8 @@ pipe_command (const char *arg, int from_tty)
|
||||||
(&arg, gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_OPERAND, grp);
|
(&arg, gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_OPERAND, grp);
|
||||||
|
|
||||||
const char *delim = "|";
|
const char *delim = "|";
|
||||||
if (opts.delimiter != nullptr)
|
if (!opts.delimiter.empty ())
|
||||||
delim = opts.delimiter;
|
delim = opts.delimiter.c_str ();
|
||||||
|
|
||||||
const char *command = arg;
|
const char *command = arg;
|
||||||
if (command == nullptr)
|
if (command == nullptr)
|
||||||
|
@ -1148,8 +1143,8 @@ pipe_command_completer (struct cmd_list_element *ignore,
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const char *delimiter = "|";
|
const char *delimiter = "|";
|
||||||
if (opts.delimiter != nullptr)
|
if (!opts.delimiter.empty ())
|
||||||
delimiter = opts.delimiter;
|
delimiter = opts.delimiter.c_str ();
|
||||||
|
|
||||||
/* Check if we're past option values already. */
|
/* Check if we're past option values already. */
|
||||||
if (text > org_text && !isspace (text[-1]))
|
if (text > org_text && !isspace (text[-1]))
|
||||||
|
@ -2152,13 +2147,21 @@ value_from_setting (const setting &var, struct gdbarch *gdbarch)
|
||||||
case var_enum:
|
case var_enum:
|
||||||
{
|
{
|
||||||
const char *value;
|
const char *value;
|
||||||
|
size_t len;
|
||||||
if (var.type () == var_enum)
|
if (var.type () == var_enum)
|
||||||
|
{
|
||||||
value = var.get<const char *> ();
|
value = var.get<const char *> ();
|
||||||
|
len = strlen (value);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
value = var.get<char *> ();
|
{
|
||||||
|
const std::string &st = var.get<std::string> ();
|
||||||
|
value = st.c_str ();
|
||||||
|
len = st.length ();
|
||||||
|
}
|
||||||
|
|
||||||
if (value != nullptr)
|
if (len > 0)
|
||||||
return value_cstring (value, strlen (value),
|
return value_cstring (value, len,
|
||||||
builtin_type (gdbarch)->builtin_char);
|
builtin_type (gdbarch)->builtin_char);
|
||||||
else
|
else
|
||||||
return value_cstring ("", 1,
|
return value_cstring ("", 1,
|
||||||
|
@ -2231,13 +2234,21 @@ str_value_from_setting (const setting &var, struct gdbarch *gdbarch)
|
||||||
similarly to the value_from_setting code for these casevar. */
|
similarly to the value_from_setting code for these casevar. */
|
||||||
{
|
{
|
||||||
const char *value;
|
const char *value;
|
||||||
|
size_t len;
|
||||||
if (var.type () == var_enum)
|
if (var.type () == var_enum)
|
||||||
|
{
|
||||||
value = var.get<const char *> ();
|
value = var.get<const char *> ();
|
||||||
|
len = strlen (value);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
value = var.get<char *> ();
|
{
|
||||||
|
const std::string &st = var.get<std::string> ();
|
||||||
|
value = st.c_str ();
|
||||||
|
len = st.length ();
|
||||||
|
}
|
||||||
|
|
||||||
if (value != nullptr)
|
if (len > 0)
|
||||||
return value_cstring (value, strlen (value),
|
return value_cstring (value, len,
|
||||||
builtin_type (gdbarch)->builtin_char);
|
builtin_type (gdbarch)->builtin_char);
|
||||||
else
|
else
|
||||||
return value_cstring ("", 1,
|
return value_cstring ("", 1,
|
||||||
|
|
|
@ -655,7 +655,7 @@ add_setshow_boolean_cmd (const char *name, enum command_class theclass, bool *va
|
||||||
|
|
||||||
set_show_commands
|
set_show_commands
|
||||||
add_setshow_filename_cmd (const char *name, enum command_class theclass,
|
add_setshow_filename_cmd (const char *name, enum command_class theclass,
|
||||||
char **var,
|
std::string *var,
|
||||||
const char *set_doc, const char *show_doc,
|
const char *set_doc, const char *show_doc,
|
||||||
const char *help_doc,
|
const char *help_doc,
|
||||||
cmd_func_ftype *set_func,
|
cmd_func_ftype *set_func,
|
||||||
|
@ -664,7 +664,7 @@ add_setshow_filename_cmd (const char *name, enum command_class theclass,
|
||||||
struct cmd_list_element **show_list)
|
struct cmd_list_element **show_list)
|
||||||
{
|
{
|
||||||
set_show_commands commands
|
set_show_commands commands
|
||||||
= add_setshow_cmd_full<char *> (name, theclass, var_filename, var,
|
= add_setshow_cmd_full<std::string> (name, theclass, var_filename, var,
|
||||||
set_doc, show_doc, help_doc,
|
set_doc, show_doc, help_doc,
|
||||||
set_func, show_func,
|
set_func, show_func,
|
||||||
set_list, show_list);
|
set_list, show_list);
|
||||||
|
@ -679,7 +679,7 @@ add_setshow_filename_cmd (const char *name, enum command_class theclass,
|
||||||
|
|
||||||
set_show_commands
|
set_show_commands
|
||||||
add_setshow_string_cmd (const char *name, enum command_class theclass,
|
add_setshow_string_cmd (const char *name, enum command_class theclass,
|
||||||
char **var,
|
std::string *var,
|
||||||
const char *set_doc, const char *show_doc,
|
const char *set_doc, const char *show_doc,
|
||||||
const char *help_doc,
|
const char *help_doc,
|
||||||
cmd_func_ftype *set_func,
|
cmd_func_ftype *set_func,
|
||||||
|
@ -688,7 +688,7 @@ add_setshow_string_cmd (const char *name, enum command_class theclass,
|
||||||
struct cmd_list_element **show_list)
|
struct cmd_list_element **show_list)
|
||||||
{
|
{
|
||||||
set_show_commands commands
|
set_show_commands commands
|
||||||
= add_setshow_cmd_full<char *> (name, theclass, var_string, var,
|
= add_setshow_cmd_full<std::string> (name, theclass, var_string, var,
|
||||||
set_doc, show_doc, help_doc,
|
set_doc, show_doc, help_doc,
|
||||||
set_func, show_func,
|
set_func, show_func,
|
||||||
set_list, show_list);
|
set_list, show_list);
|
||||||
|
@ -704,7 +704,7 @@ add_setshow_string_cmd (const char *name, enum command_class theclass,
|
||||||
|
|
||||||
set_show_commands
|
set_show_commands
|
||||||
add_setshow_string_noescape_cmd (const char *name, enum command_class theclass,
|
add_setshow_string_noescape_cmd (const char *name, enum command_class theclass,
|
||||||
char **var,
|
std::string *var,
|
||||||
const char *set_doc, const char *show_doc,
|
const char *set_doc, const char *show_doc,
|
||||||
const char *help_doc,
|
const char *help_doc,
|
||||||
cmd_func_ftype *set_func,
|
cmd_func_ftype *set_func,
|
||||||
|
@ -713,9 +713,10 @@ add_setshow_string_noescape_cmd (const char *name, enum command_class theclass,
|
||||||
struct cmd_list_element **show_list)
|
struct cmd_list_element **show_list)
|
||||||
{
|
{
|
||||||
set_show_commands commands
|
set_show_commands commands
|
||||||
= add_setshow_cmd_full<char *> (name, theclass, var_string_noescape, var,
|
= add_setshow_cmd_full<std::string> (name, theclass, var_string_noescape,
|
||||||
set_doc, show_doc, help_doc, set_func,
|
var, set_doc, show_doc, help_doc,
|
||||||
show_func, set_list, show_list);
|
set_func, show_func, set_list,
|
||||||
|
show_list);
|
||||||
|
|
||||||
/* Disable the default symbol completer. */
|
/* Disable the default symbol completer. */
|
||||||
set_cmd_completer (commands.set, nullptr);
|
set_cmd_completer (commands.set, nullptr);
|
||||||
|
@ -728,7 +729,7 @@ add_setshow_string_noescape_cmd (const char *name, enum command_class theclass,
|
||||||
|
|
||||||
set_show_commands
|
set_show_commands
|
||||||
add_setshow_optional_filename_cmd (const char *name, enum command_class theclass,
|
add_setshow_optional_filename_cmd (const char *name, enum command_class theclass,
|
||||||
char **var,
|
std::string *var,
|
||||||
const char *set_doc, const char *show_doc,
|
const char *set_doc, const char *show_doc,
|
||||||
const char *help_doc,
|
const char *help_doc,
|
||||||
cmd_func_ftype *set_func,
|
cmd_func_ftype *set_func,
|
||||||
|
@ -737,9 +738,10 @@ add_setshow_optional_filename_cmd (const char *name, enum command_class theclass
|
||||||
struct cmd_list_element **show_list)
|
struct cmd_list_element **show_list)
|
||||||
{
|
{
|
||||||
set_show_commands commands
|
set_show_commands commands
|
||||||
= add_setshow_cmd_full<char *> (name, theclass, var_optional_filename,
|
= add_setshow_cmd_full<std::string> (name, theclass, var_optional_filename,
|
||||||
var, set_doc, show_doc, help_doc,
|
var, set_doc, show_doc, help_doc,
|
||||||
set_func, show_func, set_list, show_list);
|
set_func, show_func, set_list,
|
||||||
|
show_list);
|
||||||
|
|
||||||
set_cmd_completer (commands.set, filename_completer);
|
set_cmd_completer (commands.set, filename_completer);
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
|
|
||||||
static char *saved_filename;
|
static char *saved_filename;
|
||||||
|
|
||||||
static char *logging_filename;
|
static std::string logging_filename = "gdb.txt";
|
||||||
static void
|
static void
|
||||||
show_logging_filename (struct ui_file *file, int from_tty,
|
show_logging_filename (struct ui_file *file, int from_tty,
|
||||||
struct cmd_list_element *c, const char *value)
|
struct cmd_list_element *c, const char *value)
|
||||||
|
@ -102,7 +102,7 @@ handle_redirections (int from_tty)
|
||||||
}
|
}
|
||||||
|
|
||||||
stdio_file_up log (new no_terminal_escape_file ());
|
stdio_file_up log (new no_terminal_escape_file ());
|
||||||
if (!log->open (logging_filename, logging_overwrite ? "w" : "a"))
|
if (!log->open (logging_filename.c_str (), logging_overwrite ? "w" : "a"))
|
||||||
perror_with_name (_("set logging"));
|
perror_with_name (_("set logging"));
|
||||||
|
|
||||||
/* Redirects everything to gdb_stdout while this is running. */
|
/* Redirects everything to gdb_stdout while this is running. */
|
||||||
|
@ -110,20 +110,20 @@ handle_redirections (int from_tty)
|
||||||
{
|
{
|
||||||
if (!logging_redirect)
|
if (!logging_redirect)
|
||||||
fprintf_unfiltered (gdb_stdout, "Copying output to %s.\n",
|
fprintf_unfiltered (gdb_stdout, "Copying output to %s.\n",
|
||||||
logging_filename);
|
logging_filename.c_str ());
|
||||||
else
|
else
|
||||||
fprintf_unfiltered (gdb_stdout, "Redirecting output to %s.\n",
|
fprintf_unfiltered (gdb_stdout, "Redirecting output to %s.\n",
|
||||||
logging_filename);
|
logging_filename.c_str ());
|
||||||
|
|
||||||
if (!debug_redirect)
|
if (!debug_redirect)
|
||||||
fprintf_unfiltered (gdb_stdout, "Copying debug output to %s.\n",
|
fprintf_unfiltered (gdb_stdout, "Copying debug output to %s.\n",
|
||||||
logging_filename);
|
logging_filename.c_str ());
|
||||||
else
|
else
|
||||||
fprintf_unfiltered (gdb_stdout, "Redirecting debug output to %s.\n",
|
fprintf_unfiltered (gdb_stdout, "Redirecting debug output to %s.\n",
|
||||||
logging_filename);
|
logging_filename.c_str ());
|
||||||
}
|
}
|
||||||
|
|
||||||
saved_filename = xstrdup (logging_filename);
|
saved_filename = xstrdup (logging_filename.c_str ());
|
||||||
|
|
||||||
/* Let the interpreter do anything it needs. */
|
/* Let the interpreter do anything it needs. */
|
||||||
current_interp_set_logging (std::move (log), logging_redirect,
|
current_interp_set_logging (std::move (log), logging_redirect,
|
||||||
|
@ -145,10 +145,8 @@ set_logging_on (const char *args, int from_tty)
|
||||||
const char *rest = args;
|
const char *rest = args;
|
||||||
|
|
||||||
if (rest && *rest)
|
if (rest && *rest)
|
||||||
{
|
logging_filename = rest;
|
||||||
xfree (logging_filename);
|
|
||||||
logging_filename = xstrdup (rest);
|
|
||||||
}
|
|
||||||
handle_redirections (from_tty);
|
handle_redirections (from_tty);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -201,6 +199,7 @@ If debug redirect is on, debug will go only to the log file."),
|
||||||
set_logging_redirect,
|
set_logging_redirect,
|
||||||
show_logging_redirect,
|
show_logging_redirect,
|
||||||
&set_logging_cmdlist, &show_logging_cmdlist);
|
&set_logging_cmdlist, &show_logging_cmdlist);
|
||||||
|
|
||||||
add_setshow_filename_cmd ("file", class_support, &logging_filename, _("\
|
add_setshow_filename_cmd ("file", class_support, &logging_filename, _("\
|
||||||
Set the current logfile."), _("\
|
Set the current logfile."), _("\
|
||||||
Show the current logfile."), _("\
|
Show the current logfile."), _("\
|
||||||
|
@ -212,6 +211,4 @@ The logfile is used when directing GDB's output."),
|
||||||
_("Enable logging."), &set_logging_cmdlist);
|
_("Enable logging."), &set_logging_cmdlist);
|
||||||
add_cmd ("off", class_support, set_logging_off,
|
add_cmd ("off", class_support, set_logging_off,
|
||||||
_("Disable logging."), &set_logging_cmdlist);
|
_("Disable logging."), &set_logging_cmdlist);
|
||||||
|
|
||||||
logging_filename = xstrdup ("gdb.txt");
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,7 @@ union option_value
|
||||||
const char *enumeration;
|
const char *enumeration;
|
||||||
|
|
||||||
/* For var_string options. This is malloc-allocated. */
|
/* For var_string options. This is malloc-allocated. */
|
||||||
char *string;
|
std::string *string;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Holds an options definition and its value. */
|
/* Holds an options definition and its value. */
|
||||||
|
@ -87,7 +87,7 @@ struct option_def_and_value
|
||||||
if (value.has_value ())
|
if (value.has_value ())
|
||||||
{
|
{
|
||||||
if (option.type == var_string)
|
if (option.type == var_string)
|
||||||
xfree (value->string);
|
delete value->string;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -439,7 +439,7 @@ parse_option (gdb::array_view<const option_def_group> options_group,
|
||||||
error (_("-%s requires an argument"), match->name);
|
error (_("-%s requires an argument"), match->name);
|
||||||
|
|
||||||
option_value val;
|
option_value val;
|
||||||
val.string = xstrdup (str.c_str ());
|
val.string = new std::string (std::move (str));
|
||||||
return option_def_and_value {*match, match_ctx, val};
|
return option_def_and_value {*match, match_ctx, val};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -603,8 +603,7 @@ save_option_value_in_ctx (gdb::optional<option_def_and_value> &ov)
|
||||||
break;
|
break;
|
||||||
case var_string:
|
case var_string:
|
||||||
*ov->option.var_address.string (ov->option, ov->ctx)
|
*ov->option.var_address.string (ov->option, ov->ctx)
|
||||||
= ov->value->string;
|
= std::move (*ov->value->string);
|
||||||
ov->value->string = nullptr;
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
gdb_assert_not_reached ("unhandled option type");
|
gdb_assert_not_reached ("unhandled option type");
|
||||||
|
|
|
@ -86,7 +86,7 @@ public:
|
||||||
unsigned int *(*uinteger) (const option_def &, void *ctx);
|
unsigned int *(*uinteger) (const option_def &, void *ctx);
|
||||||
int *(*integer) (const option_def &, void *ctx);
|
int *(*integer) (const option_def &, void *ctx);
|
||||||
const char **(*enumeration) (const option_def &, void *ctx);
|
const char **(*enumeration) (const option_def &, void *ctx);
|
||||||
char **(*string) (const option_def &, void *ctx);
|
std::string *(*string) (const option_def &, void *ctx);
|
||||||
}
|
}
|
||||||
var_address;
|
var_address;
|
||||||
|
|
||||||
|
@ -268,7 +268,7 @@ template<typename Context>
|
||||||
struct string_option_def : option_def
|
struct string_option_def : option_def
|
||||||
{
|
{
|
||||||
string_option_def (const char *long_option_,
|
string_option_def (const char *long_option_,
|
||||||
char **(*get_var_address_cb_) (Context *),
|
std::string *(*get_var_address_cb_) (Context *),
|
||||||
show_value_ftype *show_cmd_cb_,
|
show_value_ftype *show_cmd_cb_,
|
||||||
const char *set_doc_,
|
const char *set_doc_,
|
||||||
const char *show_doc_ = nullptr,
|
const char *show_doc_ = nullptr,
|
||||||
|
|
|
@ -360,27 +360,22 @@ do_set_command (const char *arg, int from_tty, struct cmd_list_element *c)
|
||||||
*q++ = '\0';
|
*q++ = '\0';
|
||||||
newobj = (char *) xrealloc (newobj, q - newobj);
|
newobj = (char *) xrealloc (newobj, q - newobj);
|
||||||
|
|
||||||
char * const var = c->var->get<char *> ();
|
const std::string &cur_val = c->var->get<std::string> ();
|
||||||
if (var == nullptr
|
if (strcmp (cur_val.c_str(), newobj) != 0)
|
||||||
|| strcmp (var, newobj) != 0)
|
|
||||||
{
|
{
|
||||||
xfree (var);
|
c->var->set<std::string> (std::string (newobj));
|
||||||
c->var->set<char *> (newobj);
|
|
||||||
|
|
||||||
option_changed = true;
|
option_changed = true;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
xfree (newobj);
|
xfree (newobj);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case var_string_noescape:
|
case var_string_noescape:
|
||||||
{
|
{
|
||||||
char * const var = c->var->get<char *> ();
|
const std::string &cur_val = c->var->get<std::string> ();
|
||||||
if (var == nullptr
|
if (strcmp (cur_val.c_str (), arg) != 0)
|
||||||
|| strcmp (var, arg) != 0)
|
|
||||||
{
|
{
|
||||||
xfree (var);
|
c->var->set<std::string> (std::string (arg));
|
||||||
c->var->set<char *> (xstrdup (arg));
|
|
||||||
|
|
||||||
option_changed = true;
|
option_changed = true;
|
||||||
}
|
}
|
||||||
|
@ -410,16 +405,13 @@ do_set_command (const char *arg, int from_tty, struct cmd_list_element *c)
|
||||||
else
|
else
|
||||||
val = xstrdup ("");
|
val = xstrdup ("");
|
||||||
|
|
||||||
char * const var = c->var->get<char *> ();
|
const std::string &cur_val = c->var->get<std::string> ();
|
||||||
if (var == nullptr
|
if (strcmp (cur_val.c_str (), val) != 0)
|
||||||
|| strcmp (var, val) != 0)
|
|
||||||
{
|
{
|
||||||
xfree (var);
|
c->var->set<std::string> (std::string (val));
|
||||||
c->var->set<char *> (val);
|
|
||||||
|
|
||||||
option_changed = true;
|
option_changed = true;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
xfree (val);
|
xfree (val);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -598,15 +590,12 @@ do_set_command (const char *arg, int from_tty, struct cmd_list_element *c)
|
||||||
case var_string_noescape:
|
case var_string_noescape:
|
||||||
case var_filename:
|
case var_filename:
|
||||||
case var_optional_filename:
|
case var_optional_filename:
|
||||||
|
gdb::observers::command_param_changed.notify
|
||||||
|
(name, c->var->get<std::string> ().c_str ());
|
||||||
|
break;
|
||||||
case var_enum:
|
case var_enum:
|
||||||
{
|
gdb::observers::command_param_changed.notify
|
||||||
const char *var;
|
(name, c->var->get<const char *> ());
|
||||||
if (c->var->type () == var_enum)
|
|
||||||
var = c->var->get<const char *> ();
|
|
||||||
else
|
|
||||||
var = c->var->get<char *> ();
|
|
||||||
gdb::observers::command_param_changed.notify (name, var);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case var_boolean:
|
case var_boolean:
|
||||||
{
|
{
|
||||||
|
@ -658,23 +647,19 @@ get_setshow_command_value_string (const setting &var)
|
||||||
{
|
{
|
||||||
case var_string:
|
case var_string:
|
||||||
{
|
{
|
||||||
char *value = var.get<char *> ();
|
std::string value = var.get<std::string> ();
|
||||||
|
if (!value.empty ())
|
||||||
if (value != nullptr)
|
stb.putstr (value.c_str (), '"');
|
||||||
stb.putstr (value, '"');
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case var_string_noescape:
|
case var_string_noescape:
|
||||||
case var_optional_filename:
|
case var_optional_filename:
|
||||||
case var_filename:
|
case var_filename:
|
||||||
|
stb.puts (var.get<std::string> ().c_str ());
|
||||||
|
break;
|
||||||
case var_enum:
|
case var_enum:
|
||||||
{
|
{
|
||||||
const char *value;
|
const char *value = var.get<const char *> ();
|
||||||
if (var.type () == var_enum)
|
|
||||||
value = var.get<const char *> ();
|
|
||||||
else
|
|
||||||
value = var.get<char *> ();
|
|
||||||
|
|
||||||
if (value != nullptr)
|
if (value != nullptr)
|
||||||
stb.puts (value);
|
stb.puts (value);
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,16 +97,15 @@ typedef enum var_types
|
||||||
|
|
||||||
/* String which the user enters with escapes (e.g. the user types
|
/* String which the user enters with escapes (e.g. the user types
|
||||||
\n and it is a real newline in the stored string).
|
\n and it is a real newline in the stored string).
|
||||||
*VAR is a malloc'd string, or NULL if the string is empty. */
|
*VAR is a std::string, "" if the string is empty. */
|
||||||
var_string,
|
var_string,
|
||||||
/* String which stores what the user types verbatim.
|
/* String which stores what the user types verbatim.
|
||||||
*VAR is a malloc'd string, or NULL if the string is empty. */
|
*VAR is std::string, "" if the string is empty. */
|
||||||
var_string_noescape,
|
var_string_noescape,
|
||||||
/* String which stores a filename. (*VAR) is a malloc'd string,
|
/* String which stores a filename. (*VAR) is a std::string,
|
||||||
or "" if the string was empty. */
|
"" if the string was empty. */
|
||||||
var_optional_filename,
|
var_optional_filename,
|
||||||
/* String which stores a filename. (*VAR) is a malloc'd
|
/* String which stores a filename. (*VAR) is a std::string. */
|
||||||
string. */
|
|
||||||
var_filename,
|
var_filename,
|
||||||
/* ZeroableInteger. *VAR is an int. Like var_integer except
|
/* ZeroableInteger. *VAR is an int. Like var_integer except
|
||||||
that zero really means zero. */
|
that zero really means zero. */
|
||||||
|
@ -166,9 +165,9 @@ inline bool var_type_uses<int> (var_types t)
|
||||||
|| t == var_zuinteger_unlimited);
|
|| t == var_zuinteger_unlimited);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return true if a setting of type T is backed by a char * variable. */
|
/* Return true if a setting of type T is backed by a std::string variable. */
|
||||||
template<>
|
template<>
|
||||||
inline bool var_type_uses<char *> (var_types t)
|
inline bool var_type_uses<std::string> (var_types t)
|
||||||
{
|
{
|
||||||
return (t == var_string || t == var_string_noescape
|
return (t == var_string || t == var_string_noescape
|
||||||
|| t == var_optional_filename || t == var_filename);
|
|| t == var_optional_filename || t == var_filename);
|
||||||
|
@ -562,25 +561,25 @@ extern set_show_commands add_setshow_boolean_cmd
|
||||||
cmd_list_element **show_list);
|
cmd_list_element **show_list);
|
||||||
|
|
||||||
extern set_show_commands add_setshow_filename_cmd
|
extern set_show_commands add_setshow_filename_cmd
|
||||||
(const char *name, command_class theclass, char **var, const char *set_doc,
|
(const char *name, command_class theclass, std::string *var, const char *set_doc,
|
||||||
const char *show_doc, const char *help_doc, cmd_func_ftype *set_func,
|
const char *show_doc, const char *help_doc, cmd_func_ftype *set_func,
|
||||||
show_value_ftype *show_func, cmd_list_element **set_list,
|
show_value_ftype *show_func, cmd_list_element **set_list,
|
||||||
cmd_list_element **show_list);
|
cmd_list_element **show_list);
|
||||||
|
|
||||||
extern set_show_commands add_setshow_string_cmd
|
extern set_show_commands add_setshow_string_cmd
|
||||||
(const char *name, command_class theclass, char **var, const char *set_doc,
|
(const char *name, command_class theclass, std::string *var, const char *set_doc,
|
||||||
const char *show_doc, const char *help_doc, cmd_func_ftype *set_func,
|
const char *show_doc, const char *help_doc, cmd_func_ftype *set_func,
|
||||||
show_value_ftype *show_func, cmd_list_element **set_list,
|
show_value_ftype *show_func, cmd_list_element **set_list,
|
||||||
cmd_list_element **show_list);
|
cmd_list_element **show_list);
|
||||||
|
|
||||||
extern set_show_commands add_setshow_string_noescape_cmd
|
extern set_show_commands add_setshow_string_noescape_cmd
|
||||||
(const char *name, command_class theclass, char **var, const char *set_doc,
|
(const char *name, command_class theclass, std::string *var, const char *set_doc,
|
||||||
const char *show_doc, const char *help_doc, cmd_func_ftype *set_func,
|
const char *show_doc, const char *help_doc, cmd_func_ftype *set_func,
|
||||||
show_value_ftype *show_func, cmd_list_element **set_list,
|
show_value_ftype *show_func, cmd_list_element **set_list,
|
||||||
cmd_list_element **show_list);
|
cmd_list_element **show_list);
|
||||||
|
|
||||||
extern set_show_commands add_setshow_optional_filename_cmd
|
extern set_show_commands add_setshow_optional_filename_cmd
|
||||||
(const char *name, command_class theclass, char **var, const char *set_doc,
|
(const char *name, command_class theclass, std::string *var, const char *set_doc,
|
||||||
const char *show_doc, const char *help_doc, cmd_func_ftype *set_func,
|
const char *show_doc, const char *help_doc, cmd_func_ftype *set_func,
|
||||||
show_value_ftype *show_func, cmd_list_element **set_list,
|
show_value_ftype *show_func, cmd_list_element **set_list,
|
||||||
cmd_list_element **show_list);
|
cmd_list_element **show_list);
|
||||||
|
|
|
@ -495,7 +495,22 @@ get_expr_block_and_pc (CORE_ADDR *pc)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* String for 'set compile-args' and 'show compile-args'. */
|
/* String for 'set compile-args' and 'show compile-args'. */
|
||||||
static char *compile_args;
|
static std::string compile_args =
|
||||||
|
/* Override flags possibly coming from DW_AT_producer. */
|
||||||
|
"-O0 -gdwarf-4"
|
||||||
|
/* We use -fPIE Otherwise GDB would need to reserve space large enough for
|
||||||
|
any object file in the inferior in advance to get the final address when
|
||||||
|
to link the object file to and additionally the default system linker
|
||||||
|
script would need to be modified so that one can specify there the
|
||||||
|
absolute target address.
|
||||||
|
-fPIC is not used at is would require from GDB to generate .got. */
|
||||||
|
" -fPIE"
|
||||||
|
/* We want warnings, except for some commonly happening for GDB commands. */
|
||||||
|
" -Wall "
|
||||||
|
" -Wno-unused-but-set-variable"
|
||||||
|
" -Wno-unused-variable"
|
||||||
|
/* Override CU's possible -fstack-protector-strong. */
|
||||||
|
" -fno-stack-protector";
|
||||||
|
|
||||||
/* Parsed form of COMPILE_ARGS. */
|
/* Parsed form of COMPILE_ARGS. */
|
||||||
static gdb_argv compile_args_argv;
|
static gdb_argv compile_args_argv;
|
||||||
|
@ -505,7 +520,7 @@ static gdb_argv compile_args_argv;
|
||||||
static void
|
static void
|
||||||
set_compile_args (const char *args, int from_tty, struct cmd_list_element *c)
|
set_compile_args (const char *args, int from_tty, struct cmd_list_element *c)
|
||||||
{
|
{
|
||||||
compile_args_argv = gdb_argv (compile_args);
|
compile_args_argv = gdb_argv (compile_args.c_str ());
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Implement 'show compile-args'. */
|
/* Implement 'show compile-args'. */
|
||||||
|
@ -520,7 +535,7 @@ show_compile_args (struct ui_file *file, int from_tty,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* String for 'set compile-gcc' and 'show compile-gcc'. */
|
/* String for 'set compile-gcc' and 'show compile-gcc'. */
|
||||||
static char *compile_gcc;
|
static std::string compile_gcc;
|
||||||
|
|
||||||
/* Implement 'show compile-gcc'. */
|
/* Implement 'show compile-gcc'. */
|
||||||
|
|
||||||
|
@ -696,13 +711,13 @@ compile_to_object (struct command_line *cmd, const char *cmd_string,
|
||||||
|
|
||||||
compiler->set_verbose (compile_debug);
|
compiler->set_verbose (compile_debug);
|
||||||
|
|
||||||
if (compile_gcc[0] != 0)
|
if (!compile_gcc.empty ())
|
||||||
{
|
{
|
||||||
if (compiler->version () < GCC_FE_VERSION_1)
|
if (compiler->version () < GCC_FE_VERSION_1)
|
||||||
error (_("Command 'set compile-gcc' requires GCC version 6 or higher "
|
error (_("Command 'set compile-gcc' requires GCC version 6 or higher "
|
||||||
"(libcc1 interface version 1 or higher)"));
|
"(libcc1 interface version 1 or higher)"));
|
||||||
|
|
||||||
compiler->set_driver_filename (compile_gcc);
|
compiler->set_driver_filename (compile_gcc.c_str ());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1029,23 +1044,9 @@ String quoting is parsed like in shell, for example:\n\
|
||||||
-mno-align-double \"-I/dir with a space/include\""),
|
-mno-align-double \"-I/dir with a space/include\""),
|
||||||
set_compile_args, show_compile_args, &setlist, &showlist);
|
set_compile_args, show_compile_args, &setlist, &showlist);
|
||||||
|
|
||||||
/* Override flags possibly coming from DW_AT_producer. */
|
|
||||||
compile_args = xstrdup ("-O0 -gdwarf-4"
|
/* Initialize compile_args_argv. */
|
||||||
/* We use -fPIE Otherwise GDB would need to reserve space large enough for
|
set_compile_args (compile_args.c_str (), 0, NULL);
|
||||||
any object file in the inferior in advance to get the final address when
|
|
||||||
to link the object file to and additionally the default system linker
|
|
||||||
script would need to be modified so that one can specify there the
|
|
||||||
absolute target address.
|
|
||||||
-fPIC is not used at is would require from GDB to generate .got. */
|
|
||||||
" -fPIE"
|
|
||||||
/* We want warnings, except for some commonly happening for GDB commands. */
|
|
||||||
" -Wall "
|
|
||||||
" -Wno-unused-but-set-variable"
|
|
||||||
" -Wno-unused-variable"
|
|
||||||
/* Override CU's possible -fstack-protector-strong. */
|
|
||||||
" -fno-stack-protector"
|
|
||||||
);
|
|
||||||
set_compile_args (compile_args, 0, NULL);
|
|
||||||
|
|
||||||
add_setshow_optional_filename_cmd ("compile-gcc", class_support,
|
add_setshow_optional_filename_cmd ("compile-gcc", class_support,
|
||||||
&compile_gcc,
|
&compile_gcc,
|
||||||
|
@ -1058,5 +1059,4 @@ It should be absolute filename of the gcc executable.\n\
|
||||||
If empty the default target triplet will be searched in $PATH."),
|
If empty the default target triplet will be searched in $PATH."),
|
||||||
NULL, show_compile_gcc, &setlist,
|
NULL, show_compile_gcc, &setlist,
|
||||||
&showlist);
|
&showlist);
|
||||||
compile_gcc = xstrdup ("");
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -395,7 +395,7 @@ write_memory_signed_integer (CORE_ADDR addr, int len,
|
||||||
const char *gnutarget;
|
const char *gnutarget;
|
||||||
|
|
||||||
/* Same thing, except it is "auto" not NULL for the default case. */
|
/* Same thing, except it is "auto" not NULL for the default case. */
|
||||||
static char *gnutarget_string;
|
static std::string gnutarget_string;
|
||||||
static void
|
static void
|
||||||
show_gnutarget_string (struct ui_file *file, int from_tty,
|
show_gnutarget_string (struct ui_file *file, int from_tty,
|
||||||
struct cmd_list_element *c,
|
struct cmd_list_element *c,
|
||||||
|
@ -409,15 +409,15 @@ static void
|
||||||
set_gnutarget_command (const char *ignore, int from_tty,
|
set_gnutarget_command (const char *ignore, int from_tty,
|
||||||
struct cmd_list_element *c)
|
struct cmd_list_element *c)
|
||||||
{
|
{
|
||||||
char *gend = gnutarget_string + strlen (gnutarget_string);
|
const char *gend = gnutarget_string.c_str () + gnutarget_string.size ();
|
||||||
|
gend = remove_trailing_whitespace (gnutarget_string.c_str (), gend);
|
||||||
|
gnutarget_string
|
||||||
|
= gnutarget_string.substr (0, gend - gnutarget_string.data ());
|
||||||
|
|
||||||
gend = remove_trailing_whitespace (gnutarget_string, gend);
|
if (gnutarget_string == "auto")
|
||||||
*gend = '\0';
|
|
||||||
|
|
||||||
if (strcmp (gnutarget_string, "auto") == 0)
|
|
||||||
gnutarget = NULL;
|
gnutarget = NULL;
|
||||||
else
|
else
|
||||||
gnutarget = gnutarget_string;
|
gnutarget = gnutarget_string.c_str ();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* A completion function for "set gnutarget". */
|
/* A completion function for "set gnutarget". */
|
||||||
|
@ -449,8 +449,7 @@ complete_set_gnutarget (struct cmd_list_element *cmd,
|
||||||
void
|
void
|
||||||
set_gnutarget (const char *newtarget)
|
set_gnutarget (const char *newtarget)
|
||||||
{
|
{
|
||||||
xfree (gnutarget_string);
|
gnutarget_string = newtarget;
|
||||||
gnutarget_string = xstrdup (newtarget);
|
|
||||||
set_gnutarget_command (NULL, 0, NULL);
|
set_gnutarget_command (NULL, 0, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -121,7 +121,7 @@ using RequireLongest = gdb::Requires<gdb::Or<std::is_same<T, LONGEST>,
|
||||||
extern int dbx_commands;
|
extern int dbx_commands;
|
||||||
|
|
||||||
/* * System root path, used to find libraries etc. */
|
/* * System root path, used to find libraries etc. */
|
||||||
extern char *gdb_sysroot;
|
extern std::string gdb_sysroot;
|
||||||
|
|
||||||
/* * GDB datadir, used to store data files. */
|
/* * GDB datadir, used to store data files. */
|
||||||
extern std::string gdb_datadir;
|
extern std::string gdb_datadir;
|
||||||
|
@ -131,7 +131,7 @@ extern std::string gdb_datadir;
|
||||||
extern std::string python_libdir;
|
extern std::string python_libdir;
|
||||||
|
|
||||||
/* * Search path for separate debug files. */
|
/* * Search path for separate debug files. */
|
||||||
extern char *debug_file_directory;
|
extern std::string debug_file_directory;
|
||||||
|
|
||||||
/* GDB's SIGINT handler basically sets a flag; code that might take a
|
/* GDB's SIGINT handler basically sets a flag; code that might take a
|
||||||
long time before it gets back to the event loop, and which ought to
|
long time before it gets back to the event loop, and which ought to
|
||||||
|
|
11
gdb/disasm.c
11
gdb/disasm.c
|
@ -39,7 +39,7 @@
|
||||||
|
|
||||||
/* This variable is used to hold the prospective disassembler_options value
|
/* This variable is used to hold the prospective disassembler_options value
|
||||||
which is set by the "set disassembler_options" command. */
|
which is set by the "set disassembler_options" command. */
|
||||||
static char *prospective_options = NULL;
|
static std::string prospective_options;
|
||||||
|
|
||||||
/* This structure is used to store line number information for the
|
/* This structure is used to store line number information for the
|
||||||
deprecated /m option.
|
deprecated /m option.
|
||||||
|
@ -928,13 +928,16 @@ get_disassembler_options (struct gdbarch *gdbarch)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
set_disassembler_options (char *prospective_options)
|
set_disassembler_options (const char *prospective_options)
|
||||||
{
|
{
|
||||||
struct gdbarch *gdbarch = get_current_arch ();
|
struct gdbarch *gdbarch = get_current_arch ();
|
||||||
char **disassembler_options = gdbarch_disassembler_options (gdbarch);
|
char **disassembler_options = gdbarch_disassembler_options (gdbarch);
|
||||||
const disasm_options_and_args_t *valid_options_and_args;
|
const disasm_options_and_args_t *valid_options_and_args;
|
||||||
const disasm_options_t *valid_options;
|
const disasm_options_t *valid_options;
|
||||||
char *options = remove_whitespace_and_extra_commas (prospective_options);
|
gdb::unique_xmalloc_ptr<char> prospective_options_local
|
||||||
|
= make_unique_xstrdup (prospective_options);
|
||||||
|
char *options = remove_whitespace_and_extra_commas
|
||||||
|
(prospective_options_local.get ());
|
||||||
const char *opt;
|
const char *opt;
|
||||||
|
|
||||||
/* Allow all architectures, even ones that do not support 'set disassembler',
|
/* Allow all architectures, even ones that do not support 'set disassembler',
|
||||||
|
@ -1003,7 +1006,7 @@ static void
|
||||||
set_disassembler_options_sfunc (const char *args, int from_tty,
|
set_disassembler_options_sfunc (const char *args, int from_tty,
|
||||||
struct cmd_list_element *c)
|
struct cmd_list_element *c)
|
||||||
{
|
{
|
||||||
set_disassembler_options (prospective_options);
|
set_disassembler_options (prospective_options.c_str ());
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -164,6 +164,6 @@ extern char *get_disassembler_options (struct gdbarch *gdbarch);
|
||||||
|
|
||||||
/* Sets the active gdbarch's disassembler options to OPTIONS. */
|
/* Sets the active gdbarch's disassembler options to OPTIONS. */
|
||||||
|
|
||||||
extern void set_disassembler_options (char *options);
|
extern void set_disassembler_options (const char *options);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -118,7 +118,7 @@ dwz_search_other_debugdirs (std::string &filename, bfd_byte *buildid,
|
||||||
|
|
||||||
gdb_bfd_ref_ptr dwz_bfd;
|
gdb_bfd_ref_ptr dwz_bfd;
|
||||||
std::vector<gdb::unique_xmalloc_ptr<char>> debugdir_vec
|
std::vector<gdb::unique_xmalloc_ptr<char>> debugdir_vec
|
||||||
= dirnames_to_char_ptr_vec (debug_file_directory);
|
= dirnames_to_char_ptr_vec (debug_file_directory.c_str ());
|
||||||
|
|
||||||
for (const gdb::unique_xmalloc_ptr<char> &debugdir : debugdir_vec)
|
for (const gdb::unique_xmalloc_ptr<char> &debugdir : debugdir_vec)
|
||||||
{
|
{
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
static bool debug_index_cache = false;
|
static bool debug_index_cache = false;
|
||||||
|
|
||||||
/* The index cache directory, used for "set/show index-cache directory". */
|
/* The index cache directory, used for "set/show index-cache directory". */
|
||||||
static char *index_cache_directory = NULL;
|
static std::string index_cache_directory;
|
||||||
|
|
||||||
/* See dwarf-index.cache.h. */
|
/* See dwarf-index.cache.h. */
|
||||||
index_cache global_index_cache;
|
index_cache global_index_cache;
|
||||||
|
@ -290,9 +290,9 @@ set_index_cache_directory_command (const char *arg, int from_tty,
|
||||||
cmd_list_element *element)
|
cmd_list_element *element)
|
||||||
{
|
{
|
||||||
/* Make sure the index cache directory is absolute and tilde-expanded. */
|
/* Make sure the index cache directory is absolute and tilde-expanded. */
|
||||||
gdb::unique_xmalloc_ptr<char> abs (gdb_abspath (index_cache_directory));
|
gdb::unique_xmalloc_ptr<char> abs
|
||||||
xfree (index_cache_directory);
|
= gdb_abspath (index_cache_directory.c_str ());
|
||||||
index_cache_directory = abs.release ();
|
index_cache_directory = abs.get ();
|
||||||
global_index_cache.set_directory (index_cache_directory);
|
global_index_cache.set_directory (index_cache_directory);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -325,7 +325,7 @@ _initialize_index_cache ()
|
||||||
std::string cache_dir = get_standard_cache_dir ();
|
std::string cache_dir = get_standard_cache_dir ();
|
||||||
if (!cache_dir.empty ())
|
if (!cache_dir.empty ())
|
||||||
{
|
{
|
||||||
index_cache_directory = xstrdup (cache_dir.c_str ());
|
index_cache_directory = cache_dir;
|
||||||
global_index_cache.set_directory (std::move (cache_dir));
|
global_index_cache.set_directory (std::move (cache_dir));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -12134,10 +12134,10 @@ try_open_dwop_file (dwarf2_per_objfile *per_objfile,
|
||||||
gdb::unique_xmalloc_ptr<char> search_path_holder;
|
gdb::unique_xmalloc_ptr<char> search_path_holder;
|
||||||
if (search_cwd)
|
if (search_cwd)
|
||||||
{
|
{
|
||||||
if (*debug_file_directory != '\0')
|
if (!debug_file_directory.empty ())
|
||||||
{
|
{
|
||||||
search_path_holder.reset (concat (".", dirname_separator_string,
|
search_path_holder.reset (concat (".", dirname_separator_string,
|
||||||
debug_file_directory,
|
debug_file_directory.c_str (),
|
||||||
(char *) NULL));
|
(char *) NULL));
|
||||||
search_path = search_path_holder.get ();
|
search_path = search_path_holder.get ();
|
||||||
}
|
}
|
||||||
|
@ -12145,7 +12145,7 @@ try_open_dwop_file (dwarf2_per_objfile *per_objfile,
|
||||||
search_path = ".";
|
search_path = ".";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
search_path = debug_file_directory;
|
search_path = debug_file_directory.c_str ();
|
||||||
|
|
||||||
/* Add the path for the executable binary to the list of search paths. */
|
/* Add the path for the executable binary to the list of search paths. */
|
||||||
std::string objfile_dir = ldirname (objfile_name (per_objfile->objfile));
|
std::string objfile_dir = ldirname (objfile_name (per_objfile->objfile));
|
||||||
|
@ -12216,7 +12216,7 @@ open_dwo_file (dwarf2_per_objfile *per_objfile,
|
||||||
/* That didn't work, try debug-file-directory, which, despite its name,
|
/* That didn't work, try debug-file-directory, which, despite its name,
|
||||||
is a list of paths. */
|
is a list of paths. */
|
||||||
|
|
||||||
if (*debug_file_directory == '\0')
|
if (debug_file_directory.empty ())
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
return try_open_dwop_file (per_objfile, file_name,
|
return try_open_dwop_file (per_objfile, file_name,
|
||||||
|
@ -12545,7 +12545,7 @@ open_dwp_file (dwarf2_per_objfile *per_objfile, const char *file_name)
|
||||||
[IWBN if the dwp file name was recorded in the executable, akin to
|
[IWBN if the dwp file name was recorded in the executable, akin to
|
||||||
.gnu_debuglink, but that doesn't exist yet.]
|
.gnu_debuglink, but that doesn't exist yet.]
|
||||||
Strip the directory from FILE_NAME and search again. */
|
Strip the directory from FILE_NAME and search again. */
|
||||||
if (*debug_file_directory != '\0')
|
if (!debug_file_directory.empty ())
|
||||||
{
|
{
|
||||||
/* Don't implicitly search the current directory here.
|
/* Don't implicitly search the current directory here.
|
||||||
If the user wants to search "." to handle this case,
|
If the user wants to search "." to handle this case,
|
||||||
|
|
|
@ -439,13 +439,11 @@ display_gdb_prompt (const char *new_prompt)
|
||||||
static std::string
|
static std::string
|
||||||
top_level_prompt (void)
|
top_level_prompt (void)
|
||||||
{
|
{
|
||||||
char *prompt;
|
|
||||||
|
|
||||||
/* Give observers a chance of changing the prompt. E.g., the python
|
/* Give observers a chance of changing the prompt. E.g., the python
|
||||||
`gdb.prompt_hook' is installed as an observer. */
|
`gdb.prompt_hook' is installed as an observer. */
|
||||||
gdb::observers::before_prompt.notify (get_prompt ());
|
gdb::observers::before_prompt.notify (get_prompt ().c_str ());
|
||||||
|
|
||||||
prompt = get_prompt ();
|
const std::string &prompt = get_prompt ();
|
||||||
|
|
||||||
if (annotation_level >= 2)
|
if (annotation_level >= 2)
|
||||||
{
|
{
|
||||||
|
@ -456,7 +454,7 @@ top_level_prompt (void)
|
||||||
beginning. */
|
beginning. */
|
||||||
const char suffix[] = "\n\032\032prompt\n";
|
const char suffix[] = "\n\032\032prompt\n";
|
||||||
|
|
||||||
return std::string (prefix) + prompt + suffix;
|
return std::string (prefix) + prompt.c_str () + suffix;
|
||||||
}
|
}
|
||||||
|
|
||||||
return prompt;
|
return prompt;
|
||||||
|
@ -1253,13 +1251,13 @@ handle_sigtstp (int sig)
|
||||||
static void
|
static void
|
||||||
async_sigtstp_handler (gdb_client_data arg)
|
async_sigtstp_handler (gdb_client_data arg)
|
||||||
{
|
{
|
||||||
char *prompt = get_prompt ();
|
const std::string &prompt = get_prompt ();
|
||||||
|
|
||||||
signal (SIGTSTP, SIG_DFL);
|
signal (SIGTSTP, SIG_DFL);
|
||||||
unblock_signal (SIGTSTP);
|
unblock_signal (SIGTSTP);
|
||||||
raise (SIGTSTP);
|
raise (SIGTSTP);
|
||||||
signal (SIGTSTP, handle_sigtstp);
|
signal (SIGTSTP, handle_sigtstp);
|
||||||
printf_unfiltered ("%s", prompt);
|
printf_unfiltered ("%s", prompt.c_str ());
|
||||||
gdb_flush (gdb_stdout);
|
gdb_flush (gdb_stdout);
|
||||||
|
|
||||||
/* Forget about any previous command -- null line now will do
|
/* Forget about any previous command -- null line now will do
|
||||||
|
|
|
@ -33,14 +33,14 @@
|
||||||
/* The exec-wrapper, if any, that will be used when starting the
|
/* The exec-wrapper, if any, that will be used when starting the
|
||||||
inferior. */
|
inferior. */
|
||||||
|
|
||||||
static char *exec_wrapper = NULL;
|
static std::string exec_wrapper;
|
||||||
|
|
||||||
/* See gdbsupport/common-inferior.h. */
|
/* See gdbsupport/common-inferior.h. */
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
get_exec_wrapper ()
|
get_exec_wrapper ()
|
||||||
{
|
{
|
||||||
return exec_wrapper;
|
return !exec_wrapper.empty () ? exec_wrapper.c_str () : nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* See nat/fork-inferior.h. */
|
/* See nat/fork-inferior.h. */
|
||||||
|
@ -139,8 +139,7 @@ gdb_startup_inferior (pid_t pid, int num_traps)
|
||||||
static void
|
static void
|
||||||
unset_exec_wrapper_command (const char *args, int from_tty)
|
unset_exec_wrapper_command (const char *args, int from_tty)
|
||||||
{
|
{
|
||||||
xfree (exec_wrapper);
|
exec_wrapper.clear ();
|
||||||
exec_wrapper = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -44,7 +44,7 @@ union pascm_variable
|
||||||
unsigned int uintval;
|
unsigned int uintval;
|
||||||
|
|
||||||
/* Hold a string, for the various string types. */
|
/* Hold a string, for the various string types. */
|
||||||
char *stringval;
|
std::string *stringval;
|
||||||
|
|
||||||
/* Hold a string, for enums. */
|
/* Hold a string, for enums. */
|
||||||
const char *cstringval;
|
const char *cstringval;
|
||||||
|
@ -57,10 +57,7 @@ union pascm_variable
|
||||||
2) Call register-parameter! to add the parameter to gdb.
|
2) Call register-parameter! to add the parameter to gdb.
|
||||||
It is done this way so that the constructor, make-parameter, doesn't have
|
It is done this way so that the constructor, make-parameter, doesn't have
|
||||||
any side-effects. This means that the smob needs to store everything
|
any side-effects. This means that the smob needs to store everything
|
||||||
that was passed to make-parameter.
|
that was passed to make-parameter. */
|
||||||
|
|
||||||
N.B. There is no free function for this smob.
|
|
||||||
All objects pointed to by this smob must live in GC space. */
|
|
||||||
|
|
||||||
struct param_smob
|
struct param_smob
|
||||||
{
|
{
|
||||||
|
@ -120,7 +117,6 @@ struct param_smob
|
||||||
static setting
|
static setting
|
||||||
make_setting (param_smob *s)
|
make_setting (param_smob *s)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (var_type_uses<bool> (s->type))
|
if (var_type_uses<bool> (s->type))
|
||||||
return setting (s->type, &s->value.boolval);
|
return setting (s->type, &s->value.boolval);
|
||||||
else if (var_type_uses<int> (s->type))
|
else if (var_type_uses<int> (s->type))
|
||||||
|
@ -129,8 +125,8 @@ make_setting (param_smob *s)
|
||||||
return setting (s->type, &s->value.autoboolval);
|
return setting (s->type, &s->value.autoboolval);
|
||||||
else if (var_type_uses<unsigned int> (s->type))
|
else if (var_type_uses<unsigned int> (s->type))
|
||||||
return setting (s->type, &s->value.uintval);
|
return setting (s->type, &s->value.uintval);
|
||||||
else if (var_type_uses<char *> (s->type))
|
else if (var_type_uses<std::string> (s->type))
|
||||||
return setting (s->type, &s->value.stringval);
|
return setting (s->type, s->value.stringval);
|
||||||
else if (var_type_uses<const char *> (s->type))
|
else if (var_type_uses<const char *> (s->type))
|
||||||
return setting (s->type, &s->value.cstringval);
|
return setting (s->type, &s->value.cstringval);
|
||||||
else
|
else
|
||||||
|
@ -432,14 +428,14 @@ add_setshow_generic (enum var_types param_type, enum command_class cmd_class,
|
||||||
|
|
||||||
case var_string:
|
case var_string:
|
||||||
commands = add_setshow_string_cmd (cmd_name, cmd_class,
|
commands = add_setshow_string_cmd (cmd_name, cmd_class,
|
||||||
&self->value.stringval, set_doc,
|
self->value.stringval, set_doc,
|
||||||
show_doc, help_doc, set_func,
|
show_doc, help_doc, set_func,
|
||||||
show_func, set_list, show_list);
|
show_func, set_list, show_list);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case var_string_noescape:
|
case var_string_noescape:
|
||||||
commands = add_setshow_string_noescape_cmd (cmd_name, cmd_class,
|
commands = add_setshow_string_noescape_cmd (cmd_name, cmd_class,
|
||||||
&self->value.stringval,
|
self->value.stringval,
|
||||||
set_doc, show_doc, help_doc,
|
set_doc, show_doc, help_doc,
|
||||||
set_func, show_func, set_list,
|
set_func, show_func, set_list,
|
||||||
show_list);
|
show_list);
|
||||||
|
@ -448,7 +444,7 @@ add_setshow_generic (enum var_types param_type, enum command_class cmd_class,
|
||||||
|
|
||||||
case var_optional_filename:
|
case var_optional_filename:
|
||||||
commands = add_setshow_optional_filename_cmd (cmd_name, cmd_class,
|
commands = add_setshow_optional_filename_cmd (cmd_name, cmd_class,
|
||||||
&self->value.stringval,
|
self->value.stringval,
|
||||||
set_doc, show_doc, help_doc,
|
set_doc, show_doc, help_doc,
|
||||||
set_func, show_func,
|
set_func, show_func,
|
||||||
set_list, show_list);
|
set_list, show_list);
|
||||||
|
@ -456,7 +452,7 @@ add_setshow_generic (enum var_types param_type, enum command_class cmd_class,
|
||||||
|
|
||||||
case var_filename:
|
case var_filename:
|
||||||
commands = add_setshow_filename_cmd (cmd_name, cmd_class,
|
commands = add_setshow_filename_cmd (cmd_name, cmd_class,
|
||||||
&self->value.stringval, set_doc,
|
self->value.stringval, set_doc,
|
||||||
show_doc, help_doc, set_func,
|
show_doc, help_doc, set_func,
|
||||||
show_func, set_list, show_list);
|
show_func, set_list, show_list);
|
||||||
break;
|
break;
|
||||||
|
@ -602,14 +598,14 @@ pascm_param_value (const setting &var, int arg_pos, const char *func_name)
|
||||||
case var_string_noescape:
|
case var_string_noescape:
|
||||||
case var_optional_filename:
|
case var_optional_filename:
|
||||||
case var_filename:
|
case var_filename:
|
||||||
|
{
|
||||||
|
const std::string &str = var.get<std::string> ();
|
||||||
|
return gdbscm_scm_from_host_string (str.c_str (), str.length ());
|
||||||
|
}
|
||||||
|
|
||||||
case var_enum:
|
case var_enum:
|
||||||
{
|
{
|
||||||
const char *str;
|
const char *str = var.get<const char *> ();
|
||||||
if (var.type () == var_enum)
|
|
||||||
str = var.get<const char *> ();
|
|
||||||
else
|
|
||||||
str = var.get<char *> ();
|
|
||||||
|
|
||||||
if (str == nullptr)
|
if (str == nullptr)
|
||||||
str = "";
|
str = "";
|
||||||
return gdbscm_scm_from_host_string (str, strlen (str));
|
return gdbscm_scm_from_host_string (str, strlen (str));
|
||||||
|
@ -682,13 +678,7 @@ pascm_set_param_value_x (param_smob *p_smob,
|
||||||
value, arg_pos, func_name,
|
value, arg_pos, func_name,
|
||||||
_("string or #f for non-PARAM_FILENAME parameters"));
|
_("string or #f for non-PARAM_FILENAME parameters"));
|
||||||
if (gdbscm_is_false (value))
|
if (gdbscm_is_false (value))
|
||||||
{
|
var.set<std::string> ("");
|
||||||
xfree (var.get<char *> ());
|
|
||||||
if (var.type () == var_optional_filename)
|
|
||||||
var.set<char *> (xstrdup (""));
|
|
||||||
else
|
|
||||||
var.set<char *> (nullptr);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SCM exception;
|
SCM exception;
|
||||||
|
@ -697,8 +687,7 @@ pascm_set_param_value_x (param_smob *p_smob,
|
||||||
= gdbscm_scm_to_host_string (value, nullptr, &exception);
|
= gdbscm_scm_to_host_string (value, nullptr, &exception);
|
||||||
if (string == nullptr)
|
if (string == nullptr)
|
||||||
gdbscm_throw (exception);
|
gdbscm_throw (exception);
|
||||||
xfree (var.get<char *> ());
|
var.set<std::string> (string.release ());
|
||||||
var.set<char *> (string.release ());
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -798,6 +787,21 @@ pascm_set_param_value_x (param_smob *p_smob,
|
||||||
gdb_assert_not_reached ("bad parameter type");
|
gdb_assert_not_reached ("bad parameter type");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Free function for a param_smob. */
|
||||||
|
static size_t
|
||||||
|
pascm_free_parameter_smob (SCM self)
|
||||||
|
{
|
||||||
|
param_smob *p_smob = (param_smob *) SCM_SMOB_DATA (self);
|
||||||
|
|
||||||
|
if (var_type_uses<std::string> (p_smob->type))
|
||||||
|
{
|
||||||
|
delete p_smob->value.stringval;
|
||||||
|
p_smob->value.stringval = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* Parameter Scheme functions. */
|
/* Parameter Scheme functions. */
|
||||||
|
|
||||||
|
@ -954,6 +958,10 @@ gdbscm_make_parameter (SCM name_scm, SCM rest)
|
||||||
p_smob->set_func = set_func;
|
p_smob->set_func = set_func;
|
||||||
p_smob->show_func = show_func;
|
p_smob->show_func = show_func;
|
||||||
|
|
||||||
|
scm_set_smob_free (parameter_smob_tag, pascm_free_parameter_smob);
|
||||||
|
if (var_type_uses<std::string> (p_smob->type))
|
||||||
|
p_smob->value.stringval = new std::string;
|
||||||
|
|
||||||
if (initial_value_arg_pos > 0)
|
if (initial_value_arg_pos > 0)
|
||||||
{
|
{
|
||||||
if (gdbscm_is_procedure (initial_value_scm))
|
if (gdbscm_is_procedure (initial_value_scm))
|
||||||
|
|
14
gdb/infcmd.c
14
gdb/infcmd.c
|
@ -71,16 +71,16 @@ static void step_1 (int, int, const char *);
|
||||||
Arguments are separated by spaces. Empty string (pointer to '\0')
|
Arguments are separated by spaces. Empty string (pointer to '\0')
|
||||||
means no args. */
|
means no args. */
|
||||||
|
|
||||||
static char *inferior_args_scratch;
|
static std::string inferior_args_scratch;
|
||||||
|
|
||||||
/* Scratch area where the new cwd will be stored by 'set cwd'. */
|
/* Scratch area where the new cwd will be stored by 'set cwd'. */
|
||||||
|
|
||||||
static char *inferior_cwd_scratch;
|
static std::string inferior_cwd_scratch;
|
||||||
|
|
||||||
/* Scratch area where 'set inferior-tty' will store user-provided value.
|
/* Scratch area where 'set inferior-tty' will store user-provided value.
|
||||||
We'll immediate copy it into per-inferior storage. */
|
We'll immediate copy it into per-inferior storage. */
|
||||||
|
|
||||||
static char *inferior_io_terminal_scratch;
|
static std::string inferior_io_terminal_scratch;
|
||||||
|
|
||||||
/* Pid of our debugged inferior, or 0 if no inferior now.
|
/* Pid of our debugged inferior, or 0 if no inferior now.
|
||||||
Since various parts of infrun.c test this to see whether there is a program
|
Since various parts of infrun.c test this to see whether there is a program
|
||||||
|
@ -2021,7 +2021,6 @@ path_info (const char *args, int from_tty)
|
||||||
static void
|
static void
|
||||||
path_command (const char *dirname, int from_tty)
|
path_command (const char *dirname, int from_tty)
|
||||||
{
|
{
|
||||||
char *exec_path;
|
|
||||||
const char *env;
|
const char *env;
|
||||||
|
|
||||||
dont_repeat ();
|
dont_repeat ();
|
||||||
|
@ -2029,10 +2028,9 @@ path_command (const char *dirname, int from_tty)
|
||||||
/* Can be null if path is not set. */
|
/* Can be null if path is not set. */
|
||||||
if (!env)
|
if (!env)
|
||||||
env = "";
|
env = "";
|
||||||
exec_path = xstrdup (env);
|
std::string exec_path = env;
|
||||||
mod_path (dirname, &exec_path);
|
mod_path (dirname, exec_path);
|
||||||
current_inferior ()->environment.set (path_var_name, exec_path);
|
current_inferior ()->environment.set (path_var_name, exec_path.c_str ());
|
||||||
xfree (exec_path);
|
|
||||||
if (from_tty)
|
if (from_tty)
|
||||||
path_info (NULL, from_tty);
|
path_info (NULL, from_tty);
|
||||||
}
|
}
|
||||||
|
|
|
@ -110,7 +110,7 @@ public:
|
||||||
gdb::byte_vector thread_info_to_thread_handle (struct thread_info *) override;
|
gdb::byte_vector thread_info_to_thread_handle (struct thread_info *) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
static char *libthread_db_search_path;
|
static std::string libthread_db_search_path = LIBTHREAD_DB_SEARCH_PATH;
|
||||||
|
|
||||||
/* Set to true if thread_db auto-loading is enabled
|
/* Set to true if thread_db auto-loading is enabled
|
||||||
by the "set auto-load libthread-db" command. */
|
by the "set auto-load libthread-db" command. */
|
||||||
|
@ -135,11 +135,8 @@ static void
|
||||||
set_libthread_db_search_path (const char *ignored, int from_tty,
|
set_libthread_db_search_path (const char *ignored, int from_tty,
|
||||||
struct cmd_list_element *c)
|
struct cmd_list_element *c)
|
||||||
{
|
{
|
||||||
if (*libthread_db_search_path == '\0')
|
if (libthread_db_search_path.empty ())
|
||||||
{
|
libthread_db_search_path = LIBTHREAD_DB_SEARCH_PATH;
|
||||||
xfree (libthread_db_search_path);
|
|
||||||
libthread_db_search_path = xstrdup (LIBTHREAD_DB_SEARCH_PATH);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If non-zero, print details of libthread_db processing. */
|
/* If non-zero, print details of libthread_db processing. */
|
||||||
|
@ -941,7 +938,7 @@ try_thread_db_load_1 (struct thread_db_info *info)
|
||||||
|
|
||||||
printf_unfiltered (_("[Thread debugging using libthread_db enabled]\n"));
|
printf_unfiltered (_("[Thread debugging using libthread_db enabled]\n"));
|
||||||
|
|
||||||
if (*libthread_db_search_path || libthread_db_debug)
|
if (!libthread_db_search_path.empty () || libthread_db_debug)
|
||||||
{
|
{
|
||||||
struct ui_file *file;
|
struct ui_file *file;
|
||||||
const char *library;
|
const char *library;
|
||||||
|
@ -954,7 +951,7 @@ try_thread_db_load_1 (struct thread_db_info *info)
|
||||||
disabled, still print it to gdb_stdout if debug output is
|
disabled, still print it to gdb_stdout if debug output is
|
||||||
enabled. User visible output should not depend on debug
|
enabled. User visible output should not depend on debug
|
||||||
settings. */
|
settings. */
|
||||||
file = *libthread_db_search_path != '\0' ? gdb_stdout : gdb_stdlog;
|
file = !libthread_db_search_path.empty () ? gdb_stdout : gdb_stdlog;
|
||||||
fprintf_unfiltered (file,
|
fprintf_unfiltered (file,
|
||||||
_("Using host libthread_db library \"%ps\".\n"),
|
_("Using host libthread_db library \"%ps\".\n"),
|
||||||
styled_string (file_name_style.style (), library));
|
styled_string (file_name_style.style (), library));
|
||||||
|
@ -1142,7 +1139,7 @@ thread_db_load_search (void)
|
||||||
bool rc = false;
|
bool rc = false;
|
||||||
|
|
||||||
std::vector<gdb::unique_xmalloc_ptr<char>> dir_vec
|
std::vector<gdb::unique_xmalloc_ptr<char>> dir_vec
|
||||||
= dirnames_to_char_ptr_vec (libthread_db_search_path);
|
= dirnames_to_char_ptr_vec (libthread_db_search_path.c_str ());
|
||||||
|
|
||||||
for (const gdb::unique_xmalloc_ptr<char> &this_dir_up : dir_vec)
|
for (const gdb::unique_xmalloc_ptr<char> &this_dir_up : dir_vec)
|
||||||
{
|
{
|
||||||
|
@ -2005,8 +2002,6 @@ _initialize_thread_db ()
|
||||||
and until there is a running inferior, we can't tell which
|
and until there is a running inferior, we can't tell which
|
||||||
libthread_db is the correct one to load. */
|
libthread_db is the correct one to load. */
|
||||||
|
|
||||||
libthread_db_search_path = xstrdup (LIBTHREAD_DB_SEARCH_PATH);
|
|
||||||
|
|
||||||
add_setshow_optional_filename_cmd ("libthread-db-search-path",
|
add_setshow_optional_filename_cmd ("libthread-db-search-path",
|
||||||
class_support,
|
class_support,
|
||||||
&libthread_db_search_path, _("\
|
&libthread_db_search_path, _("\
|
||||||
|
|
17
gdb/main.c
17
gdb/main.c
|
@ -65,7 +65,7 @@ char *interpreter_p;
|
||||||
int dbx_commands = 0;
|
int dbx_commands = 0;
|
||||||
|
|
||||||
/* System root path, used to find libraries etc. */
|
/* System root path, used to find libraries etc. */
|
||||||
char *gdb_sysroot = 0;
|
std::string gdb_sysroot;
|
||||||
|
|
||||||
/* GDB datadir, used to store data files. */
|
/* GDB datadir, used to store data files. */
|
||||||
std::string gdb_datadir;
|
std::string gdb_datadir;
|
||||||
|
@ -710,19 +710,14 @@ captured_main_1 (struct captured_main_args *context)
|
||||||
perror_warning_with_name (_("error finding working directory"));
|
perror_warning_with_name (_("error finding working directory"));
|
||||||
|
|
||||||
/* Set the sysroot path. */
|
/* Set the sysroot path. */
|
||||||
gdb_sysroot
|
gdb_sysroot = relocate_gdb_directory (TARGET_SYSTEM_ROOT,
|
||||||
= xstrdup (relocate_gdb_directory (TARGET_SYSTEM_ROOT,
|
TARGET_SYSTEM_ROOT_RELOCATABLE);
|
||||||
TARGET_SYSTEM_ROOT_RELOCATABLE).c_str ());
|
|
||||||
|
|
||||||
if (*gdb_sysroot == '\0')
|
if (gdb_sysroot.empty ())
|
||||||
{
|
gdb_sysroot = TARGET_SYSROOT_PREFIX;
|
||||||
xfree (gdb_sysroot);
|
|
||||||
gdb_sysroot = xstrdup (TARGET_SYSROOT_PREFIX);
|
|
||||||
}
|
|
||||||
|
|
||||||
debug_file_directory
|
debug_file_directory
|
||||||
= xstrdup (relocate_gdb_directory (DEBUGDIR,
|
= relocate_gdb_directory (DEBUGDIR, DEBUGDIR_RELOCATABLE);
|
||||||
DEBUGDIR_RELOCATABLE).c_str ());
|
|
||||||
|
|
||||||
gdb_datadir = relocate_gdb_directory (GDB_DATADIR,
|
gdb_datadir = relocate_gdb_directory (GDB_DATADIR,
|
||||||
GDB_DATADIR_RELOCATABLE);
|
GDB_DATADIR_RELOCATABLE);
|
||||||
|
|
|
@ -133,17 +133,12 @@ struct test_options_opts
|
||||||
const char *enum_opt = test_options_enum_values_xxx;
|
const char *enum_opt = test_options_enum_values_xxx;
|
||||||
unsigned int uint_opt = 0;
|
unsigned int uint_opt = 0;
|
||||||
int zuint_unl_opt = 0;
|
int zuint_unl_opt = 0;
|
||||||
char *string_opt = nullptr;
|
std::string string_opt;
|
||||||
|
|
||||||
test_options_opts () = default;
|
test_options_opts () = default;
|
||||||
|
|
||||||
DISABLE_COPY_AND_ASSIGN (test_options_opts);
|
DISABLE_COPY_AND_ASSIGN (test_options_opts);
|
||||||
|
|
||||||
~test_options_opts ()
|
|
||||||
{
|
|
||||||
xfree (string_opt);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Dump the options to FILE. ARGS is the remainder unprocessed
|
/* Dump the options to FILE. ARGS is the remainder unprocessed
|
||||||
arguments. */
|
arguments. */
|
||||||
void dump (ui_file *file, const char *args) const
|
void dump (ui_file *file, const char *args) const
|
||||||
|
@ -162,9 +157,7 @@ struct test_options_opts
|
||||||
(zuint_unl_opt == -1
|
(zuint_unl_opt == -1
|
||||||
? "unlimited"
|
? "unlimited"
|
||||||
: plongest (zuint_unl_opt)),
|
: plongest (zuint_unl_opt)),
|
||||||
(string_opt != nullptr
|
string_opt.c_str (),
|
||||||
? string_opt
|
|
||||||
: ""),
|
|
||||||
args);
|
args);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -44,13 +44,13 @@ static unsigned int maintenance_test_settings_zuinteger;
|
||||||
|
|
||||||
static int maintenance_test_settings_zuinteger_unlimited;
|
static int maintenance_test_settings_zuinteger_unlimited;
|
||||||
|
|
||||||
static char *maintenance_test_settings_string;
|
static std::string maintenance_test_settings_string;
|
||||||
|
|
||||||
static char *maintenance_test_settings_string_noescape;
|
static std::string maintenance_test_settings_string_noescape;
|
||||||
|
|
||||||
static char *maintenance_test_settings_optional_filename;
|
static std::string maintenance_test_settings_optional_filename;
|
||||||
|
|
||||||
static char *maintenance_test_settings_filename;
|
static std::string maintenance_test_settings_filename;
|
||||||
|
|
||||||
/* Enum values for the "maintenance set/show test-settings boolean"
|
/* Enum values for the "maintenance set/show test-settings boolean"
|
||||||
commands. */
|
commands. */
|
||||||
|
|
|
@ -93,7 +93,7 @@ mi_cmd_env_cd (const char *command, char **argv, int argc)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
env_mod_path (const char *dirname, char **which_path)
|
env_mod_path (const char *dirname, std::string &which_path)
|
||||||
{
|
{
|
||||||
if (dirname == 0 || dirname[0] == '\0')
|
if (dirname == 0 || dirname[0] == '\0')
|
||||||
return;
|
return;
|
||||||
|
@ -109,7 +109,6 @@ void
|
||||||
mi_cmd_env_path (const char *command, char **argv, int argc)
|
mi_cmd_env_path (const char *command, char **argv, int argc)
|
||||||
{
|
{
|
||||||
struct ui_out *uiout = current_uiout;
|
struct ui_out *uiout = current_uiout;
|
||||||
char *exec_path;
|
|
||||||
const char *env;
|
const char *env;
|
||||||
int reset = 0;
|
int reset = 0;
|
||||||
int oind = 0;
|
int oind = 0;
|
||||||
|
@ -152,11 +151,11 @@ mi_cmd_env_path (const char *command, char **argv, int argc)
|
||||||
argv += oind;
|
argv += oind;
|
||||||
argc -= oind;
|
argc -= oind;
|
||||||
|
|
||||||
|
std::string exec_path;
|
||||||
if (reset)
|
if (reset)
|
||||||
{
|
{
|
||||||
/* Reset implies resetting to original path first. */
|
/* Reset implies resetting to original path first. */
|
||||||
exec_path = xstrdup (orig_path);
|
exec_path = orig_path;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -166,14 +165,14 @@ mi_cmd_env_path (const char *command, char **argv, int argc)
|
||||||
/* Can be null if path is not set. */
|
/* Can be null if path is not set. */
|
||||||
if (!env)
|
if (!env)
|
||||||
env = "";
|
env = "";
|
||||||
exec_path = xstrdup (env);
|
|
||||||
|
exec_path = env;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = argc - 1; i >= 0; --i)
|
for (i = argc - 1; i >= 0; --i)
|
||||||
env_mod_path (argv[i], &exec_path);
|
env_mod_path (argv[i], exec_path);
|
||||||
|
|
||||||
current_inferior ()->environment.set (path_var_name, exec_path);
|
current_inferior ()->environment.set (path_var_name, exec_path.c_str ());
|
||||||
xfree (exec_path);
|
|
||||||
env = current_inferior ()->environment.get (path_var_name);
|
env = current_inferior ()->environment.get (path_var_name);
|
||||||
uiout->field_string ("path", env);
|
uiout->field_string ("path", env);
|
||||||
}
|
}
|
||||||
|
@ -228,12 +227,11 @@ mi_cmd_env_dir (const char *command, char **argv, int argc)
|
||||||
if (reset)
|
if (reset)
|
||||||
{
|
{
|
||||||
/* Reset means setting to default path first. */
|
/* Reset means setting to default path first. */
|
||||||
xfree (source_path);
|
|
||||||
init_source_path ();
|
init_source_path ();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = argc - 1; i >= 0; --i)
|
for (i = argc - 1; i >= 0; --i)
|
||||||
env_mod_path (argv[i], &source_path);
|
env_mod_path (argv[i], source_path);
|
||||||
|
|
||||||
uiout->field_string ("source-path", source_path);
|
uiout->field_string ("source-path", source_path);
|
||||||
forget_cached_source_info ();
|
forget_cached_source_info ();
|
||||||
|
|
|
@ -50,14 +50,14 @@ struct trans {
|
||||||
|
|
||||||
static bool procfs_trace = false;
|
static bool procfs_trace = false;
|
||||||
static FILE *procfs_file = NULL;
|
static FILE *procfs_file = NULL;
|
||||||
static char *procfs_filename;
|
static std::string procfs_filename = "procfs_trace";
|
||||||
|
|
||||||
static void
|
static void
|
||||||
prepare_to_trace (void)
|
prepare_to_trace (void)
|
||||||
{
|
{
|
||||||
if (procfs_trace) /* if procfs tracing turned on */
|
if (procfs_trace) /* if procfs tracing turned on */
|
||||||
if (procfs_file == NULL) /* if output file not yet open */
|
if (procfs_file == NULL) /* if output file not yet open */
|
||||||
procfs_file = fopen (procfs_filename, "a"); /* open output file */
|
procfs_file = fopen (procfs_filename.c_str (), "a"); /* open output file */
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -425,7 +425,6 @@ Show tracing for /proc api calls."), NULL,
|
||||||
NULL, /* FIXME: i18n: */
|
NULL, /* FIXME: i18n: */
|
||||||
&setlist, &showlist);
|
&setlist, &showlist);
|
||||||
|
|
||||||
procfs_filename = xstrdup ("procfs_trace");
|
|
||||||
add_setshow_filename_cmd ("procfs-file", no_class, &procfs_filename, _("\
|
add_setshow_filename_cmd ("procfs-file", no_class, &procfs_filename, _("\
|
||||||
Set filename for /proc tracefile."), _("\
|
Set filename for /proc tracefile."), _("\
|
||||||
Show filename for /proc tracefile."), NULL,
|
Show filename for /proc tracefile."), NULL,
|
||||||
|
|
|
@ -64,8 +64,9 @@ union parmpy_variable
|
||||||
/* Hold an unsigned integer value, for uinteger. */
|
/* Hold an unsigned integer value, for uinteger. */
|
||||||
unsigned int uintval;
|
unsigned int uintval;
|
||||||
|
|
||||||
/* Hold a string, for the various string types. */
|
/* Hold a string, for the various string types. The std::string is
|
||||||
char *stringval;
|
new-ed. */
|
||||||
|
std::string *stringval;
|
||||||
|
|
||||||
/* Hold a string, for enums. */
|
/* Hold a string, for enums. */
|
||||||
const char *cstringval;
|
const char *cstringval;
|
||||||
|
@ -95,7 +96,6 @@ struct parmpy_object
|
||||||
static setting
|
static setting
|
||||||
make_setting (parmpy_object *s)
|
make_setting (parmpy_object *s)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (var_type_uses<bool> (s->type))
|
if (var_type_uses<bool> (s->type))
|
||||||
return setting (s->type, &s->value.boolval);
|
return setting (s->type, &s->value.boolval);
|
||||||
else if (var_type_uses<int> (s->type))
|
else if (var_type_uses<int> (s->type))
|
||||||
|
@ -104,8 +104,8 @@ make_setting (parmpy_object *s)
|
||||||
return setting (s->type, &s->value.autoboolval);
|
return setting (s->type, &s->value.autoboolval);
|
||||||
else if (var_type_uses<unsigned int> (s->type))
|
else if (var_type_uses<unsigned int> (s->type))
|
||||||
return setting (s->type, &s->value.uintval);
|
return setting (s->type, &s->value.uintval);
|
||||||
else if (var_type_uses<char *> (s->type))
|
else if (var_type_uses<std::string> (s->type))
|
||||||
return setting (s->type, &s->value.stringval);
|
return setting (s->type, s->value.stringval);
|
||||||
else if (var_type_uses<const char *> (s->type))
|
else if (var_type_uses<const char *> (s->type))
|
||||||
return setting (s->type, &s->value.cstringval);
|
return setting (s->type, &s->value.cstringval);
|
||||||
else
|
else
|
||||||
|
@ -163,13 +163,7 @@ set_parameter_value (parmpy_object *self, PyObject *value)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (value == Py_None)
|
if (value == Py_None)
|
||||||
{
|
self->value.stringval->clear ();
|
||||||
xfree (self->value.stringval);
|
|
||||||
if (self->type == var_optional_filename)
|
|
||||||
self->value.stringval = xstrdup ("");
|
|
||||||
else
|
|
||||||
self->value.stringval = NULL;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gdb::unique_xmalloc_ptr<char>
|
gdb::unique_xmalloc_ptr<char>
|
||||||
|
@ -177,8 +171,7 @@ set_parameter_value (parmpy_object *self, PyObject *value)
|
||||||
if (string == NULL)
|
if (string == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
xfree (self->value.stringval);
|
*self->value.stringval = string.get ();
|
||||||
self->value.stringval = string.release ();
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -525,14 +518,14 @@ add_setshow_generic (int parmclass, enum command_class cmdclass,
|
||||||
|
|
||||||
case var_string:
|
case var_string:
|
||||||
commands = add_setshow_string_cmd (cmd_name.get (), cmdclass,
|
commands = add_setshow_string_cmd (cmd_name.get (), cmdclass,
|
||||||
&self->value.stringval, set_doc,
|
self->value.stringval, set_doc,
|
||||||
show_doc, help_doc, get_set_value,
|
show_doc, help_doc, get_set_value,
|
||||||
get_show_value, set_list, show_list);
|
get_show_value, set_list, show_list);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case var_string_noescape:
|
case var_string_noescape:
|
||||||
commands = add_setshow_string_noescape_cmd (cmd_name.get (), cmdclass,
|
commands = add_setshow_string_noescape_cmd (cmd_name.get (), cmdclass,
|
||||||
&self->value.stringval,
|
self->value.stringval,
|
||||||
set_doc, show_doc, help_doc,
|
set_doc, show_doc, help_doc,
|
||||||
get_set_value, get_show_value,
|
get_set_value, get_show_value,
|
||||||
set_list, show_list);
|
set_list, show_list);
|
||||||
|
@ -540,7 +533,7 @@ add_setshow_generic (int parmclass, enum command_class cmdclass,
|
||||||
|
|
||||||
case var_optional_filename:
|
case var_optional_filename:
|
||||||
commands = add_setshow_optional_filename_cmd (cmd_name.get (), cmdclass,
|
commands = add_setshow_optional_filename_cmd (cmd_name.get (), cmdclass,
|
||||||
&self->value.stringval,
|
self->value.stringval,
|
||||||
set_doc, show_doc, help_doc,
|
set_doc, show_doc, help_doc,
|
||||||
get_set_value,
|
get_set_value,
|
||||||
get_show_value, set_list,
|
get_show_value, set_list,
|
||||||
|
@ -549,7 +542,7 @@ add_setshow_generic (int parmclass, enum command_class cmdclass,
|
||||||
|
|
||||||
case var_filename:
|
case var_filename:
|
||||||
commands = add_setshow_filename_cmd (cmd_name.get (), cmdclass,
|
commands = add_setshow_filename_cmd (cmd_name.get (), cmdclass,
|
||||||
&self->value.stringval, set_doc,
|
self->value.stringval, set_doc,
|
||||||
show_doc, help_doc, get_set_value,
|
show_doc, help_doc, get_set_value,
|
||||||
get_show_value, set_list, show_list);
|
get_show_value, set_list, show_list);
|
||||||
break;
|
break;
|
||||||
|
@ -732,6 +725,9 @@ parmpy_init (PyObject *self, PyObject *args, PyObject *kwds)
|
||||||
obj->type = (enum var_types) parmclass;
|
obj->type = (enum var_types) parmclass;
|
||||||
memset (&obj->value, 0, sizeof (obj->value));
|
memset (&obj->value, 0, sizeof (obj->value));
|
||||||
|
|
||||||
|
if (var_type_uses<std::string> (obj->type))
|
||||||
|
obj->value.stringval = new std::string;
|
||||||
|
|
||||||
gdb::unique_xmalloc_ptr<char> cmd_name
|
gdb::unique_xmalloc_ptr<char> cmd_name
|
||||||
= gdbpy_parse_command_name (name, &set_list, &setlist);
|
= gdbpy_parse_command_name (name, &set_list, &setlist);
|
||||||
if (cmd_name == nullptr)
|
if (cmd_name == nullptr)
|
||||||
|
@ -764,7 +760,16 @@ parmpy_init (PyObject *self, PyObject *args, PyObject *kwds)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Deallocate function for a gdb.Parameter. */
|
||||||
|
|
||||||
|
static void
|
||||||
|
parmpy_dealloc (PyObject *obj)
|
||||||
|
{
|
||||||
|
parmpy_object *parm_obj = (parmpy_object *) obj;
|
||||||
|
|
||||||
|
if (var_type_uses<std::string> (parm_obj->type))
|
||||||
|
delete parm_obj->value.stringval;
|
||||||
|
}
|
||||||
|
|
||||||
/* Initialize the 'parameters' module. */
|
/* Initialize the 'parameters' module. */
|
||||||
int
|
int
|
||||||
|
@ -803,7 +808,7 @@ PyTypeObject parmpy_object_type =
|
||||||
"gdb.Parameter", /*tp_name*/
|
"gdb.Parameter", /*tp_name*/
|
||||||
sizeof (parmpy_object), /*tp_basicsize*/
|
sizeof (parmpy_object), /*tp_basicsize*/
|
||||||
0, /*tp_itemsize*/
|
0, /*tp_itemsize*/
|
||||||
0, /*tp_dealloc*/
|
parmpy_dealloc, /*tp_dealloc*/
|
||||||
0, /*tp_print*/
|
0, /*tp_print*/
|
||||||
0, /*tp_getattr*/
|
0, /*tp_getattr*/
|
||||||
0, /*tp_setattr*/
|
0, /*tp_setattr*/
|
||||||
|
|
|
@ -463,10 +463,8 @@ gdbpy_parameter_value (const setting &var)
|
||||||
if (var.type () == var_enum)
|
if (var.type () == var_enum)
|
||||||
str = var.get<const char *> ();
|
str = var.get<const char *> ();
|
||||||
else
|
else
|
||||||
str = var.get<char *> ();
|
str = var.get<std::string> ().c_str ();
|
||||||
|
|
||||||
if (str == nullptr)
|
|
||||||
str = "";
|
|
||||||
return host_string_to_python_string (str).release ();
|
return host_string_to_python_string (str).release ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -680,10 +680,9 @@ gdbsim_target_open (const char *args, int from_tty)
|
||||||
int len;
|
int len;
|
||||||
char *arg_buf;
|
char *arg_buf;
|
||||||
struct sim_inferior_data *sim_data;
|
struct sim_inferior_data *sim_data;
|
||||||
const char *sysroot;
|
|
||||||
SIM_DESC gdbsim_desc;
|
SIM_DESC gdbsim_desc;
|
||||||
|
|
||||||
sysroot = gdb_sysroot;
|
const std::string &sysroot = gdb_sysroot;
|
||||||
if (is_target_filename (sysroot))
|
if (is_target_filename (sysroot))
|
||||||
sysroot += strlen (TARGET_SYSROOT_PREFIX);
|
sysroot += strlen (TARGET_SYSROOT_PREFIX);
|
||||||
|
|
||||||
|
@ -704,7 +703,7 @@ gdbsim_target_open (const char *args, int from_tty)
|
||||||
len = (7 + 1 /* gdbsim */
|
len = (7 + 1 /* gdbsim */
|
||||||
+ strlen (" -E little")
|
+ strlen (" -E little")
|
||||||
+ strlen (" --architecture=xxxxxxxxxx")
|
+ strlen (" --architecture=xxxxxxxxxx")
|
||||||
+ strlen (" --sysroot=") + strlen (sysroot) +
|
+ strlen (" --sysroot=") + sysroot.length () +
|
||||||
+ (args ? strlen (args) : 0)
|
+ (args ? strlen (args) : 0)
|
||||||
+ 50) /* slack */ ;
|
+ 50) /* slack */ ;
|
||||||
arg_buf = (char *) alloca (len);
|
arg_buf = (char *) alloca (len);
|
||||||
|
@ -731,7 +730,7 @@ gdbsim_target_open (const char *args, int from_tty)
|
||||||
}
|
}
|
||||||
/* Pass along gdb's concept of the sysroot. */
|
/* Pass along gdb's concept of the sysroot. */
|
||||||
strcat (arg_buf, " --sysroot=");
|
strcat (arg_buf, " --sysroot=");
|
||||||
strcat (arg_buf, sysroot);
|
strcat (arg_buf, sysroot.c_str ());
|
||||||
/* finally, any explicit args */
|
/* finally, any explicit args */
|
||||||
if (args)
|
if (args)
|
||||||
{
|
{
|
||||||
|
|
10
gdb/remote.c
10
gdb/remote.c
|
@ -1004,7 +1004,7 @@ static const struct program_space_key<char, gdb::xfree_deleter<char>>
|
||||||
remote exec-file commands. While the remote exec-file setting is
|
remote exec-file commands. While the remote exec-file setting is
|
||||||
per-program-space, the set/show machinery uses this as the
|
per-program-space, the set/show machinery uses this as the
|
||||||
location of the remote exec-file value. */
|
location of the remote exec-file value. */
|
||||||
static char *remote_exec_file_var;
|
static std::string remote_exec_file_var;
|
||||||
|
|
||||||
/* The size to align memory write packets, when practical. The protocol
|
/* The size to align memory write packets, when practical. The protocol
|
||||||
does not guarantee any alignment, and gdb will generate short
|
does not guarantee any alignment, and gdb will generate short
|
||||||
|
@ -1355,8 +1355,8 @@ static void
|
||||||
set_remote_exec_file (const char *ignored, int from_tty,
|
set_remote_exec_file (const char *ignored, int from_tty,
|
||||||
struct cmd_list_element *c)
|
struct cmd_list_element *c)
|
||||||
{
|
{
|
||||||
gdb_assert (remote_exec_file_var != NULL);
|
set_pspace_remote_exec_file (current_program_space,
|
||||||
set_pspace_remote_exec_file (current_program_space, remote_exec_file_var);
|
remote_exec_file_var.c_str ());
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The "set/show remote exec-file" show command hook. */
|
/* The "set/show remote exec-file" show command hook. */
|
||||||
|
@ -12628,7 +12628,7 @@ remote_target::filesystem_is_local ()
|
||||||
this case we treat the remote filesystem as local if the
|
this case we treat the remote filesystem as local if the
|
||||||
sysroot is exactly TARGET_SYSROOT_PREFIX and if the stub
|
sysroot is exactly TARGET_SYSROOT_PREFIX and if the stub
|
||||||
does not support vFile:open. */
|
does not support vFile:open. */
|
||||||
if (strcmp (gdb_sysroot, TARGET_SYSROOT_PREFIX) == 0)
|
if (gdb_sysroot == TARGET_SYSROOT_PREFIX)
|
||||||
{
|
{
|
||||||
enum packet_support ps = packet_support (PACKET_vFile_open);
|
enum packet_support ps = packet_support (PACKET_vFile_open);
|
||||||
|
|
||||||
|
@ -13256,7 +13256,7 @@ remote_target::download_tracepoint (struct bp_location *loc)
|
||||||
"ignoring tp %d cond"), b->number);
|
"ignoring tp %d cond"), b->number);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (b->commands || *default_collect)
|
if (b->commands || !default_collect.empty ())
|
||||||
{
|
{
|
||||||
size_left = buf.size () - strlen (buf.data ());
|
size_left = buf.size () - strlen (buf.data ());
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ static struct serial *scb_base;
|
||||||
/* Non-NULL gives filename which contains a recording of the remote session,
|
/* Non-NULL gives filename which contains a recording of the remote session,
|
||||||
suitable for playback by gdbserver. */
|
suitable for playback by gdbserver. */
|
||||||
|
|
||||||
static char *serial_logfile = NULL;
|
static std::string serial_logfile;
|
||||||
static struct ui_file *serial_logfp = NULL;
|
static struct ui_file *serial_logfp = NULL;
|
||||||
|
|
||||||
static const struct serial_ops *serial_interface_lookup (const char *);
|
static const struct serial_ops *serial_interface_lookup (const char *);
|
||||||
|
@ -251,12 +251,12 @@ serial_open_ops_1 (const struct serial_ops *ops, const char *open_name)
|
||||||
scb->next = scb_base;
|
scb->next = scb_base;
|
||||||
scb_base = scb;
|
scb_base = scb;
|
||||||
|
|
||||||
if (serial_logfile != NULL)
|
if (!serial_logfile.empty ())
|
||||||
{
|
{
|
||||||
stdio_file_up file (new stdio_file ());
|
stdio_file_up file (new stdio_file ());
|
||||||
|
|
||||||
if (!file->open (serial_logfile, "w"))
|
if (!file->open (serial_logfile.c_str (), "w"))
|
||||||
perror_with_name (serial_logfile);
|
perror_with_name (serial_logfile.c_str ());
|
||||||
|
|
||||||
serial_logfp = file.release ();
|
serial_logfp = file.release ();
|
||||||
}
|
}
|
||||||
|
|
20
gdb/solib.c
20
gdb/solib.c
|
@ -98,7 +98,7 @@ struct target_so_ops *current_target_so_ops;
|
||||||
/* If non-empty, this is a search path for loading non-absolute shared library
|
/* If non-empty, this is a search path for loading non-absolute shared library
|
||||||
symbol files. This takes precedence over the environment variables PATH
|
symbol files. This takes precedence over the environment variables PATH
|
||||||
and LD_LIBRARY_PATH. */
|
and LD_LIBRARY_PATH. */
|
||||||
static char *solib_search_path = NULL;
|
static std::string solib_search_path;
|
||||||
static void
|
static void
|
||||||
show_solib_search_path (struct ui_file *file, int from_tty,
|
show_solib_search_path (struct ui_file *file, int from_tty,
|
||||||
struct cmd_list_element *c, const char *value)
|
struct cmd_list_element *c, const char *value)
|
||||||
|
@ -157,7 +157,7 @@ solib_find_1 (const char *in_pathname, int *fd, bool is_solib)
|
||||||
int found_file = -1;
|
int found_file = -1;
|
||||||
gdb::unique_xmalloc_ptr<char> temp_pathname;
|
gdb::unique_xmalloc_ptr<char> temp_pathname;
|
||||||
const char *fskind = effective_target_file_system_kind ();
|
const char *fskind = effective_target_file_system_kind ();
|
||||||
const char *sysroot = gdb_sysroot;
|
const char *sysroot = gdb_sysroot.c_str ();
|
||||||
int prefix_len, orig_prefix_len;
|
int prefix_len, orig_prefix_len;
|
||||||
|
|
||||||
/* If the absolute prefix starts with "target:" but the filesystem
|
/* If the absolute prefix starts with "target:" but the filesystem
|
||||||
|
@ -322,8 +322,8 @@ solib_find_1 (const char *in_pathname, int *fd, bool is_solib)
|
||||||
|
|
||||||
/* If not found, and we're looking for a solib, search the
|
/* If not found, and we're looking for a solib, search the
|
||||||
solib_search_path (if any). */
|
solib_search_path (if any). */
|
||||||
if (is_solib && found_file < 0 && solib_search_path != NULL)
|
if (is_solib && found_file < 0 && !solib_search_path.empty ())
|
||||||
found_file = openp (solib_search_path,
|
found_file = openp (solib_search_path.c_str (),
|
||||||
OPF_TRY_CWD_FIRST | OPF_RETURN_REALPATH,
|
OPF_TRY_CWD_FIRST | OPF_RETURN_REALPATH,
|
||||||
in_pathname, O_RDONLY | O_BINARY, &temp_pathname);
|
in_pathname, O_RDONLY | O_BINARY, &temp_pathname);
|
||||||
|
|
||||||
|
@ -331,8 +331,8 @@ solib_find_1 (const char *in_pathname, int *fd, bool is_solib)
|
||||||
solib_search_path (if any) for the basename only (ignoring the
|
solib_search_path (if any) for the basename only (ignoring the
|
||||||
path). This is to allow reading solibs from a path that differs
|
path). This is to allow reading solibs from a path that differs
|
||||||
from the opened path. */
|
from the opened path. */
|
||||||
if (is_solib && found_file < 0 && solib_search_path != NULL)
|
if (is_solib && found_file < 0 && !solib_search_path.empty ())
|
||||||
found_file = openp (solib_search_path,
|
found_file = openp (solib_search_path.c_str (),
|
||||||
OPF_TRY_CWD_FIRST | OPF_RETURN_REALPATH,
|
OPF_TRY_CWD_FIRST | OPF_RETURN_REALPATH,
|
||||||
target_lbasename (fskind, in_pathname),
|
target_lbasename (fskind, in_pathname),
|
||||||
O_RDONLY | O_BINARY, &temp_pathname);
|
O_RDONLY | O_BINARY, &temp_pathname);
|
||||||
|
@ -381,7 +381,7 @@ exec_file_find (const char *in_pathname, int *fd)
|
||||||
if (in_pathname == NULL)
|
if (in_pathname == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (*gdb_sysroot != '\0' && IS_TARGET_ABSOLUTE_PATH (fskind, in_pathname))
|
if (!gdb_sysroot.empty () && IS_TARGET_ABSOLUTE_PATH (fskind, in_pathname))
|
||||||
{
|
{
|
||||||
result = solib_find_1 (in_pathname, fd, false);
|
result = solib_find_1 (in_pathname, fd, false);
|
||||||
|
|
||||||
|
@ -1397,18 +1397,18 @@ gdb_sysroot_changed (const char *ignored, int from_tty,
|
||||||
const char *old_prefix = "remote:";
|
const char *old_prefix = "remote:";
|
||||||
const char *new_prefix = TARGET_SYSROOT_PREFIX;
|
const char *new_prefix = TARGET_SYSROOT_PREFIX;
|
||||||
|
|
||||||
if (startswith (gdb_sysroot, old_prefix))
|
if (startswith (gdb_sysroot.c_str (), old_prefix))
|
||||||
{
|
{
|
||||||
static bool warning_issued = false;
|
static bool warning_issued = false;
|
||||||
|
|
||||||
gdb_assert (strlen (old_prefix) == strlen (new_prefix));
|
gdb_assert (strlen (old_prefix) == strlen (new_prefix));
|
||||||
memcpy (gdb_sysroot, new_prefix, strlen (new_prefix));
|
gdb_sysroot = new_prefix + gdb_sysroot.substr (strlen (old_prefix));
|
||||||
|
|
||||||
if (!warning_issued)
|
if (!warning_issued)
|
||||||
{
|
{
|
||||||
warning (_("\"%s\" is deprecated, use \"%s\" instead."),
|
warning (_("\"%s\" is deprecated, use \"%s\" instead."),
|
||||||
old_prefix, new_prefix);
|
old_prefix, new_prefix);
|
||||||
warning (_("sysroot set to \"%s\"."), gdb_sysroot);
|
warning (_("sysroot set to \"%s\"."), gdb_sysroot.c_str ());
|
||||||
|
|
||||||
warning_issued = true;
|
warning_issued = true;
|
||||||
}
|
}
|
||||||
|
|
64
gdb/source.c
64
gdb/source.c
|
@ -57,7 +57,7 @@
|
||||||
/* Path of directories to search for source files.
|
/* Path of directories to search for source files.
|
||||||
Same format as the PATH environment variable's value. */
|
Same format as the PATH environment variable's value. */
|
||||||
|
|
||||||
char *source_path;
|
std::string source_path;
|
||||||
|
|
||||||
/* Support for source path substitution commands. */
|
/* Support for source path substitution commands. */
|
||||||
|
|
||||||
|
@ -379,17 +379,15 @@ set_directories_command (const char *args,
|
||||||
{
|
{
|
||||||
/* This is the value that was set.
|
/* This is the value that was set.
|
||||||
It needs to be processed to maintain $cdir:$cwd and remove dups. */
|
It needs to be processed to maintain $cdir:$cwd and remove dups. */
|
||||||
char *set_path = source_path;
|
std::string set_path = source_path;
|
||||||
|
|
||||||
/* We preserve the invariant that $cdir:$cwd begins life at the end of
|
/* We preserve the invariant that $cdir:$cwd begins life at the end of
|
||||||
the list by calling init_source_path. If they appear earlier in
|
the list by calling init_source_path. If they appear earlier in
|
||||||
SET_PATH then mod_path will move them appropriately.
|
SET_PATH then mod_path will move them appropriately.
|
||||||
mod_path will also remove duplicates. */
|
mod_path will also remove duplicates. */
|
||||||
init_source_path ();
|
init_source_path ();
|
||||||
if (*set_path != '\0')
|
if (!set_path.empty ())
|
||||||
mod_path (set_path, &source_path);
|
mod_path (set_path.c_str (), source_path);
|
||||||
|
|
||||||
xfree (set_path);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Print the list of source directories.
|
/* Print the list of source directories.
|
||||||
|
@ -400,7 +398,7 @@ static void
|
||||||
show_directories_1 (char *ignore, int from_tty)
|
show_directories_1 (char *ignore, int from_tty)
|
||||||
{
|
{
|
||||||
puts_filtered ("Source directories searched: ");
|
puts_filtered ("Source directories searched: ");
|
||||||
puts_filtered (source_path);
|
puts_filtered (source_path.c_str ());
|
||||||
puts_filtered ("\n");
|
puts_filtered ("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -451,10 +449,7 @@ forget_cached_source_info (void)
|
||||||
void
|
void
|
||||||
init_source_path (void)
|
init_source_path (void)
|
||||||
{
|
{
|
||||||
char buf[20];
|
source_path = string_printf ("$cdir%c$cwd", DIRNAME_SEPARATOR);
|
||||||
|
|
||||||
xsnprintf (buf, sizeof (buf), "$cdir%c$cwd", DIRNAME_SEPARATOR);
|
|
||||||
source_path = xstrdup (buf);
|
|
||||||
forget_cached_source_info ();
|
forget_cached_source_info ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -470,20 +465,20 @@ directory_command (const char *dirname, int from_tty)
|
||||||
{
|
{
|
||||||
if (!from_tty || query (_("Reinitialize source path to empty? ")))
|
if (!from_tty || query (_("Reinitialize source path to empty? ")))
|
||||||
{
|
{
|
||||||
xfree (source_path);
|
|
||||||
init_source_path ();
|
init_source_path ();
|
||||||
value_changed = true;
|
value_changed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mod_path (dirname, &source_path);
|
mod_path (dirname, source_path);
|
||||||
forget_cached_source_info ();
|
forget_cached_source_info ();
|
||||||
value_changed = true;
|
value_changed = true;
|
||||||
}
|
}
|
||||||
if (value_changed)
|
if (value_changed)
|
||||||
{
|
{
|
||||||
gdb::observers::command_param_changed.notify ("directories", source_path);
|
gdb::observers::command_param_changed.notify ("directories",
|
||||||
|
source_path.c_str ());
|
||||||
if (from_tty)
|
if (from_tty)
|
||||||
show_directories_1 ((char *) 0, from_tty);
|
show_directories_1 ((char *) 0, from_tty);
|
||||||
}
|
}
|
||||||
|
@ -495,13 +490,13 @@ directory_command (const char *dirname, int from_tty)
|
||||||
void
|
void
|
||||||
directory_switch (const char *dirname, int from_tty)
|
directory_switch (const char *dirname, int from_tty)
|
||||||
{
|
{
|
||||||
add_path (dirname, &source_path, 0);
|
add_path (dirname, source_path, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Add zero or more directories to the front of an arbitrary path. */
|
/* Add zero or more directories to the front of an arbitrary path. */
|
||||||
|
|
||||||
void
|
void
|
||||||
mod_path (const char *dirname, char **which_path)
|
mod_path (const char *dirname, std::string &which_path)
|
||||||
{
|
{
|
||||||
add_path (dirname, which_path, 1);
|
add_path (dirname, which_path, 1);
|
||||||
}
|
}
|
||||||
|
@ -689,6 +684,17 @@ add_path (const char *dirname, char **which_path, int parse_separators)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* add_path would need to be re-written to work on an std::string, but this is
|
||||||
|
not trivial. Hence this overload which copies to a `char *` and back. */
|
||||||
|
|
||||||
|
void
|
||||||
|
add_path (const char *dirname, std::string &which_path, int parse_separators)
|
||||||
|
{
|
||||||
|
char *which_path_copy = xstrdup (which_path.data ());
|
||||||
|
add_path (dirname, &which_path_copy, parse_separators);
|
||||||
|
which_path = which_path_copy;
|
||||||
|
xfree (which_path_copy);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
info_source_command (const char *ignore, int from_tty)
|
info_source_command (const char *ignore, int from_tty)
|
||||||
|
@ -967,7 +973,7 @@ source_full_path_of (const char *filename,
|
||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
fd = openp (source_path,
|
fd = openp (source_path.c_str (),
|
||||||
OPF_TRY_CWD_FIRST | OPF_SEARCH_IN_PATH | OPF_RETURN_REALPATH,
|
OPF_TRY_CWD_FIRST | OPF_SEARCH_IN_PATH | OPF_RETURN_REALPATH,
|
||||||
filename, O_RDONLY, full_pathname);
|
filename, O_RDONLY, full_pathname);
|
||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
|
@ -1058,7 +1064,8 @@ find_and_open_source (const char *filename,
|
||||||
const char *dirname,
|
const char *dirname,
|
||||||
gdb::unique_xmalloc_ptr<char> *fullname)
|
gdb::unique_xmalloc_ptr<char> *fullname)
|
||||||
{
|
{
|
||||||
char *path = source_path;
|
const char *path = source_path.c_str ();
|
||||||
|
std::string expanded_path_holder;
|
||||||
const char *p;
|
const char *p;
|
||||||
|
|
||||||
/* If reading of source files is disabled then return a result indicating
|
/* If reading of source files is disabled then return a result indicating
|
||||||
|
@ -1104,19 +1111,22 @@ find_and_open_source (const char *filename,
|
||||||
/* Replace a path entry of $cdir with the compilation directory
|
/* Replace a path entry of $cdir with the compilation directory
|
||||||
name. */
|
name. */
|
||||||
#define cdir_len 5
|
#define cdir_len 5
|
||||||
p = strstr (source_path, "$cdir");
|
p = strstr (source_path.c_str (), "$cdir");
|
||||||
if (p && (p == path || p[-1] == DIRNAME_SEPARATOR)
|
if (p && (p == path || p[-1] == DIRNAME_SEPARATOR)
|
||||||
&& (p[cdir_len] == DIRNAME_SEPARATOR || p[cdir_len] == '\0'))
|
&& (p[cdir_len] == DIRNAME_SEPARATOR || p[cdir_len] == '\0'))
|
||||||
{
|
{
|
||||||
int len;
|
int len = p - source_path.c_str ();
|
||||||
|
|
||||||
path = (char *)
|
/* Before $cdir */
|
||||||
alloca (strlen (source_path) + 1 + strlen (dirname) + 1);
|
expanded_path_holder = source_path.substr (0, len);
|
||||||
len = p - source_path;
|
|
||||||
strncpy (path, source_path, len); /* Before $cdir */
|
/* new stuff */
|
||||||
strcpy (path + len, dirname); /* new stuff */
|
expanded_path_holder += dirname;
|
||||||
strcat (path + len, source_path + len + cdir_len); /* After
|
|
||||||
$cdir */
|
/* After $cdir */
|
||||||
|
expanded_path_holder += source_path.c_str () + len + cdir_len;
|
||||||
|
|
||||||
|
path = expanded_path_holder.c_str ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,13 +39,14 @@ extern int openp (const char *, openp_flags, const char *, int,
|
||||||
|
|
||||||
extern int source_full_path_of (const char *, gdb::unique_xmalloc_ptr<char> *);
|
extern int source_full_path_of (const char *, gdb::unique_xmalloc_ptr<char> *);
|
||||||
|
|
||||||
extern void mod_path (const char *, char **);
|
extern void mod_path (const char *, std::string &);
|
||||||
|
|
||||||
extern void add_path (const char *, char **, int);
|
extern void add_path (const char *, char **, int);
|
||||||
|
extern void add_path (const char *, std::string &, int);
|
||||||
|
|
||||||
extern void directory_switch (const char *, int);
|
extern void directory_switch (const char *, int);
|
||||||
|
|
||||||
extern char *source_path;
|
extern std::string source_path;
|
||||||
|
|
||||||
extern void init_source_path (void);
|
extern void init_source_path (void);
|
||||||
|
|
||||||
|
|
20
gdb/stack.c
20
gdb/stack.c
|
@ -2426,12 +2426,7 @@ print_frame_local_vars (struct frame_info *frame,
|
||||||
struct info_print_options
|
struct info_print_options
|
||||||
{
|
{
|
||||||
bool quiet = false;
|
bool quiet = false;
|
||||||
char *type_regexp = nullptr;
|
std::string type_regexp;
|
||||||
|
|
||||||
~info_print_options ()
|
|
||||||
{
|
|
||||||
xfree (type_regexp);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* The options used by the 'info locals' and 'info args' commands. */
|
/* The options used by the 'info locals' and 'info args' commands. */
|
||||||
|
@ -2490,8 +2485,10 @@ info_locals_command (const char *args, int from_tty)
|
||||||
if (args != nullptr && *args == '\0')
|
if (args != nullptr && *args == '\0')
|
||||||
args = nullptr;
|
args = nullptr;
|
||||||
|
|
||||||
print_frame_local_vars (get_selected_frame (_("No frame selected.")),
|
print_frame_local_vars
|
||||||
opts.quiet, args, opts.type_regexp,
|
(get_selected_frame (_("No frame selected.")),
|
||||||
|
opts.quiet, args,
|
||||||
|
opts.type_regexp.empty () ? nullptr : opts.type_regexp.c_str (),
|
||||||
0, gdb_stdout);
|
0, gdb_stdout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2601,8 +2598,11 @@ info_args_command (const char *args, int from_tty)
|
||||||
if (args != nullptr && *args == '\0')
|
if (args != nullptr && *args == '\0')
|
||||||
args = nullptr;
|
args = nullptr;
|
||||||
|
|
||||||
print_frame_arg_vars (get_selected_frame (_("No frame selected.")),
|
print_frame_arg_vars
|
||||||
opts.quiet, args, opts.type_regexp, gdb_stdout);
|
(get_selected_frame (_("No frame selected.")),
|
||||||
|
opts.quiet, args,
|
||||||
|
opts.type_regexp.empty () ? nullptr : opts.type_regexp.c_str (),
|
||||||
|
gdb_stdout);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return the symbol-block in which the selected frame is executing.
|
/* Return the symbol-block in which the selected frame is executing.
|
||||||
|
|
|
@ -1349,7 +1349,7 @@ separate_debug_file_exists (const std::string &name, unsigned long crc,
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *debug_file_directory = NULL;
|
std::string debug_file_directory;
|
||||||
static void
|
static void
|
||||||
show_debug_file_directory (struct ui_file *file, int from_tty,
|
show_debug_file_directory (struct ui_file *file, int from_tty,
|
||||||
struct cmd_list_element *c, const char *value)
|
struct cmd_list_element *c, const char *value)
|
||||||
|
@ -1406,8 +1406,9 @@ find_separate_debug_file (const char *dir,
|
||||||
bool target_prefix = startswith (dir, "target:");
|
bool target_prefix = startswith (dir, "target:");
|
||||||
const char *dir_notarget = target_prefix ? dir + strlen ("target:") : dir;
|
const char *dir_notarget = target_prefix ? dir + strlen ("target:") : dir;
|
||||||
std::vector<gdb::unique_xmalloc_ptr<char>> debugdir_vec
|
std::vector<gdb::unique_xmalloc_ptr<char>> debugdir_vec
|
||||||
= dirnames_to_char_ptr_vec (debug_file_directory);
|
= dirnames_to_char_ptr_vec (debug_file_directory.c_str ());
|
||||||
gdb::unique_xmalloc_ptr<char> canon_sysroot = gdb_realpath (gdb_sysroot);
|
gdb::unique_xmalloc_ptr<char> canon_sysroot
|
||||||
|
= gdb_realpath (gdb_sysroot.c_str ());
|
||||||
|
|
||||||
/* MS-Windows/MS-DOS don't allow colons in file names; we must
|
/* MS-Windows/MS-DOS don't allow colons in file names; we must
|
||||||
convert the drive letter into a one-letter directory, so that the
|
convert the drive letter into a one-letter directory, so that the
|
||||||
|
@ -1448,7 +1449,7 @@ find_separate_debug_file (const char *dir,
|
||||||
if (canon_sysroot.get () != NULL)
|
if (canon_sysroot.get () != NULL)
|
||||||
base_path = child_path (canon_sysroot.get (), canon_dir);
|
base_path = child_path (canon_sysroot.get (), canon_dir);
|
||||||
else
|
else
|
||||||
base_path = child_path (gdb_sysroot, canon_dir);
|
base_path = child_path (gdb_sysroot.c_str (), canon_dir);
|
||||||
}
|
}
|
||||||
if (base_path != NULL)
|
if (base_path != NULL)
|
||||||
{
|
{
|
||||||
|
@ -2654,7 +2655,7 @@ add_filename_language (const char *ext, enum language lang)
|
||||||
filename_language_table.emplace_back (ext, lang);
|
filename_language_table.emplace_back (ext, lang);
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *ext_args;
|
static std::string ext_args;
|
||||||
static void
|
static void
|
||||||
show_ext_args (struct ui_file *file, int from_tty,
|
show_ext_args (struct ui_file *file, int from_tty,
|
||||||
struct cmd_list_element *c, const char *value)
|
struct cmd_list_element *c, const char *value)
|
||||||
|
@ -2669,48 +2670,48 @@ static void
|
||||||
set_ext_lang_command (const char *args,
|
set_ext_lang_command (const char *args,
|
||||||
int from_tty, struct cmd_list_element *e)
|
int from_tty, struct cmd_list_element *e)
|
||||||
{
|
{
|
||||||
char *cp = ext_args;
|
const char *begin = ext_args.c_str ();
|
||||||
enum language lang;
|
const char *end = ext_args.c_str ();
|
||||||
|
|
||||||
/* First arg is filename extension, starting with '.' */
|
/* First arg is filename extension, starting with '.' */
|
||||||
if (*cp != '.')
|
if (*end != '.')
|
||||||
error (_("'%s': Filename extension must begin with '.'"), ext_args);
|
error (_("'%s': Filename extension must begin with '.'"), ext_args.c_str ());
|
||||||
|
|
||||||
/* Find end of first arg. */
|
/* Find end of first arg. */
|
||||||
while (*cp && !isspace (*cp))
|
while (*end != '\0' && !isspace (*end))
|
||||||
cp++;
|
end++;
|
||||||
|
|
||||||
if (*cp == '\0')
|
if (*end == '\0')
|
||||||
error (_("'%s': two arguments required -- "
|
error (_("'%s': two arguments required -- "
|
||||||
"filename extension and language"),
|
"filename extension and language"),
|
||||||
ext_args);
|
ext_args.c_str ());
|
||||||
|
|
||||||
/* Null-terminate first arg. */
|
/* Extract first arg, the extension. */
|
||||||
*cp++ = '\0';
|
std::string extension = ext_args.substr (0, end - begin);
|
||||||
|
|
||||||
/* Find beginning of second arg, which should be a source language. */
|
/* Find beginning of second arg, which should be a source language. */
|
||||||
cp = skip_spaces (cp);
|
begin = skip_spaces (end);
|
||||||
|
|
||||||
if (*cp == '\0')
|
if (*begin == '\0')
|
||||||
error (_("'%s': two arguments required -- "
|
error (_("'%s': two arguments required -- "
|
||||||
"filename extension and language"),
|
"filename extension and language"),
|
||||||
ext_args);
|
ext_args.c_str ());
|
||||||
|
|
||||||
/* Lookup the language from among those we know. */
|
/* Lookup the language from among those we know. */
|
||||||
lang = language_enum (cp);
|
language lang = language_enum (begin);
|
||||||
|
|
||||||
auto it = filename_language_table.begin ();
|
auto it = filename_language_table.begin ();
|
||||||
/* Now lookup the filename extension: do we already know it? */
|
/* Now lookup the filename extension: do we already know it? */
|
||||||
for (; it != filename_language_table.end (); it++)
|
for (; it != filename_language_table.end (); it++)
|
||||||
{
|
{
|
||||||
if (it->ext == ext_args)
|
if (it->ext == extension)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (it == filename_language_table.end ())
|
if (it == filename_language_table.end ())
|
||||||
{
|
{
|
||||||
/* New file extension. */
|
/* New file extension. */
|
||||||
add_filename_language (ext_args, lang);
|
add_filename_language (extension.data (), lang);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -3784,8 +3785,7 @@ test_set_ext_lang_command ()
|
||||||
SELF_CHECK (lang == language_unknown);
|
SELF_CHECK (lang == language_unknown);
|
||||||
|
|
||||||
/* Test adding a new extension using the CLI command. */
|
/* Test adding a new extension using the CLI command. */
|
||||||
auto args_holder = make_unique_xstrdup (".hello rust");
|
ext_args = ".hello rust";
|
||||||
ext_args = args_holder.get ();
|
|
||||||
set_ext_lang_command (NULL, 1, NULL);
|
set_ext_lang_command (NULL, 1, NULL);
|
||||||
|
|
||||||
lang = deduce_language_from_filename ("cake.hello");
|
lang = deduce_language_from_filename ("cake.hello");
|
||||||
|
@ -3793,8 +3793,7 @@ test_set_ext_lang_command ()
|
||||||
|
|
||||||
/* Test overriding an existing extension using the CLI command. */
|
/* Test overriding an existing extension using the CLI command. */
|
||||||
int size_before = filename_language_table.size ();
|
int size_before = filename_language_table.size ();
|
||||||
args_holder.reset (xstrdup (".hello pascal"));
|
ext_args = ".hello pascal";
|
||||||
ext_args = args_holder.get ();
|
|
||||||
set_ext_lang_command (NULL, 1, NULL);
|
set_ext_lang_command (NULL, 1, NULL);
|
||||||
int size_after = filename_language_table.size ();
|
int size_after = filename_language_table.size ();
|
||||||
|
|
||||||
|
|
46
gdb/symtab.c
46
gdb/symtab.c
|
@ -5170,12 +5170,7 @@ struct info_vars_funcs_options
|
||||||
{
|
{
|
||||||
bool quiet = false;
|
bool quiet = false;
|
||||||
bool exclude_minsyms = false;
|
bool exclude_minsyms = false;
|
||||||
char *type_regexp = nullptr;
|
std::string type_regexp;
|
||||||
|
|
||||||
~info_vars_funcs_options ()
|
|
||||||
{
|
|
||||||
xfree (type_regexp);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* The options used by the 'info variables' and 'info functions'
|
/* The options used by the 'info variables' and 'info functions'
|
||||||
|
@ -5198,8 +5193,7 @@ static const gdb::option::option_def info_vars_funcs_options_defs[] = {
|
||||||
|
|
||||||
gdb::option::string_option_def<info_vars_funcs_options> {
|
gdb::option::string_option_def<info_vars_funcs_options> {
|
||||||
"t",
|
"t",
|
||||||
[] (info_vars_funcs_options *opt) { return &opt->type_regexp;
|
[] (info_vars_funcs_options *opt) { return &opt->type_regexp; },
|
||||||
},
|
|
||||||
nullptr, /* show_cmd_cb */
|
nullptr, /* show_cmd_cb */
|
||||||
nullptr /* set_doc */
|
nullptr /* set_doc */
|
||||||
}
|
}
|
||||||
|
@ -5243,8 +5237,10 @@ info_variables_command (const char *args, int from_tty)
|
||||||
if (args != nullptr && *args == '\0')
|
if (args != nullptr && *args == '\0')
|
||||||
args = nullptr;
|
args = nullptr;
|
||||||
|
|
||||||
symtab_symbol_info (opts.quiet, opts.exclude_minsyms, args, VARIABLES_DOMAIN,
|
symtab_symbol_info
|
||||||
opts.type_regexp, from_tty);
|
(opts.quiet, opts.exclude_minsyms, args, VARIABLES_DOMAIN,
|
||||||
|
opts.type_regexp.empty () ? nullptr : opts.type_regexp.c_str (),
|
||||||
|
from_tty);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Implement the 'info functions' command. */
|
/* Implement the 'info functions' command. */
|
||||||
|
@ -5260,8 +5256,10 @@ info_functions_command (const char *args, int from_tty)
|
||||||
if (args != nullptr && *args == '\0')
|
if (args != nullptr && *args == '\0')
|
||||||
args = nullptr;
|
args = nullptr;
|
||||||
|
|
||||||
symtab_symbol_info (opts.quiet, opts.exclude_minsyms, args,
|
symtab_symbol_info
|
||||||
FUNCTIONS_DOMAIN, opts.type_regexp, from_tty);
|
(opts.quiet, opts.exclude_minsyms, args, FUNCTIONS_DOMAIN,
|
||||||
|
opts.type_regexp.empty () ? nullptr : opts.type_regexp.c_str (),
|
||||||
|
from_tty);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Holds the -q option for the 'info types' command. */
|
/* Holds the -q option for the 'info types' command. */
|
||||||
|
@ -6773,14 +6771,8 @@ info_module_subcommand (bool quiet, const char *module_regexp,
|
||||||
struct info_modules_var_func_options
|
struct info_modules_var_func_options
|
||||||
{
|
{
|
||||||
bool quiet = false;
|
bool quiet = false;
|
||||||
char *type_regexp = nullptr;
|
std::string type_regexp;
|
||||||
char *module_regexp = nullptr;
|
std::string module_regexp;
|
||||||
|
|
||||||
~info_modules_var_func_options ()
|
|
||||||
{
|
|
||||||
xfree (type_regexp);
|
|
||||||
xfree (module_regexp);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* The options used by 'info module variables' and 'info module functions'
|
/* The options used by 'info module variables' and 'info module functions'
|
||||||
|
@ -6830,8 +6822,11 @@ info_module_functions_command (const char *args, int from_tty)
|
||||||
if (args != nullptr && *args == '\0')
|
if (args != nullptr && *args == '\0')
|
||||||
args = nullptr;
|
args = nullptr;
|
||||||
|
|
||||||
info_module_subcommand (opts.quiet, opts.module_regexp, args,
|
info_module_subcommand
|
||||||
opts.type_regexp, FUNCTIONS_DOMAIN);
|
(opts.quiet,
|
||||||
|
opts.module_regexp.empty () ? nullptr : opts.module_regexp.c_str (), args,
|
||||||
|
opts.type_regexp.empty () ? nullptr : opts.type_regexp.c_str (),
|
||||||
|
FUNCTIONS_DOMAIN);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Implements the 'info module variables' command. */
|
/* Implements the 'info module variables' command. */
|
||||||
|
@ -6846,8 +6841,11 @@ info_module_variables_command (const char *args, int from_tty)
|
||||||
if (args != nullptr && *args == '\0')
|
if (args != nullptr && *args == '\0')
|
||||||
args = nullptr;
|
args = nullptr;
|
||||||
|
|
||||||
info_module_subcommand (opts.quiet, opts.module_regexp, args,
|
info_module_subcommand
|
||||||
opts.type_regexp, VARIABLES_DOMAIN);
|
(opts.quiet,
|
||||||
|
opts.module_regexp.empty () ? nullptr : opts.module_regexp.c_str (), args,
|
||||||
|
opts.type_regexp.empty () ? nullptr : opts.type_regexp.c_str (),
|
||||||
|
VARIABLES_DOMAIN);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Command completer for 'info module ...' sub-commands. */
|
/* Command completer for 'info module ...' sub-commands. */
|
||||||
|
|
|
@ -510,7 +510,7 @@ target_desc_info_free (struct target_desc_info *tdesc_info)
|
||||||
|
|
||||||
/* The string manipulated by the "set tdesc filename ..." command. */
|
/* The string manipulated by the "set tdesc filename ..." command. */
|
||||||
|
|
||||||
static char *tdesc_filename_cmd_string;
|
static std::string tdesc_filename_cmd_string;
|
||||||
|
|
||||||
/* Fetch the current target's description, and switch the current
|
/* Fetch the current target's description, and switch the current
|
||||||
architecture to one which incorporates that description. */
|
architecture to one which incorporates that description. */
|
||||||
|
|
112
gdb/top.c
112
gdb/top.c
|
@ -84,8 +84,6 @@
|
||||||
|
|
||||||
extern void initialize_all_files (void);
|
extern void initialize_all_files (void);
|
||||||
|
|
||||||
static bool history_filename_empty (void);
|
|
||||||
|
|
||||||
#define PROMPT(X) the_prompts.prompt_stack[the_prompts.top + X].prompt
|
#define PROMPT(X) the_prompts.prompt_stack[the_prompts.top + X].prompt
|
||||||
#define PREFIX(X) the_prompts.prompt_stack[the_prompts.top + X].prefix
|
#define PREFIX(X) the_prompts.prompt_stack[the_prompts.top + X].prefix
|
||||||
#define SUFFIX(X) the_prompts.prompt_stack[the_prompts.top + X].suffix
|
#define SUFFIX(X) the_prompts.prompt_stack[the_prompts.top + X].suffix
|
||||||
|
@ -921,12 +919,16 @@ static bool command_editing_p;
|
||||||
variable must be set to something sensible. */
|
variable must be set to something sensible. */
|
||||||
static bool write_history_p;
|
static bool write_history_p;
|
||||||
|
|
||||||
|
/* The name of the file in which GDB history will be written. If this is
|
||||||
|
set to NULL, of the empty string then history will not be written. */
|
||||||
|
static std::string history_filename;
|
||||||
|
|
||||||
/* Implement 'show history save'. */
|
/* Implement 'show history save'. */
|
||||||
static void
|
static void
|
||||||
show_write_history_p (struct ui_file *file, int from_tty,
|
show_write_history_p (struct ui_file *file, int from_tty,
|
||||||
struct cmd_list_element *c, const char *value)
|
struct cmd_list_element *c, const char *value)
|
||||||
{
|
{
|
||||||
if (!write_history_p || !history_filename_empty ())
|
if (!write_history_p || !history_filename.empty ())
|
||||||
fprintf_filtered (file, _("Saving of the history record on exit is %s.\n"),
|
fprintf_filtered (file, _("Saving of the history record on exit is %s.\n"),
|
||||||
value);
|
value);
|
||||||
else
|
else
|
||||||
|
@ -960,24 +962,12 @@ show_history_remove_duplicates (struct ui_file *file, int from_tty,
|
||||||
value);
|
value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The name of the file in which GDB history will be written. If this is
|
|
||||||
set to NULL, of the empty string then history will not be written. */
|
|
||||||
static char *history_filename;
|
|
||||||
|
|
||||||
/* Return true if the history_filename is either NULL or the empty string,
|
|
||||||
indicating that we should not try to read, nor write out the history. */
|
|
||||||
static bool
|
|
||||||
history_filename_empty (void)
|
|
||||||
{
|
|
||||||
return (history_filename == nullptr || *history_filename == '\0');
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Implement 'show history filename'. */
|
/* Implement 'show history filename'. */
|
||||||
static void
|
static void
|
||||||
show_history_filename (struct ui_file *file, int from_tty,
|
show_history_filename (struct ui_file *file, int from_tty,
|
||||||
struct cmd_list_element *c, const char *value)
|
struct cmd_list_element *c, const char *value)
|
||||||
{
|
{
|
||||||
if (!history_filename_empty ())
|
if (!history_filename.empty ())
|
||||||
fprintf_filtered (file, _("The filename in which to record "
|
fprintf_filtered (file, _("The filename in which to record "
|
||||||
"the command history is \"%ps\".\n"),
|
"the command history is \"%ps\".\n"),
|
||||||
styled_string (file_name_style.style (), value));
|
styled_string (file_name_style.style (), value));
|
||||||
|
@ -1244,14 +1234,15 @@ gdb_safe_append_history (void)
|
||||||
int ret, saved_errno;
|
int ret, saved_errno;
|
||||||
|
|
||||||
std::string local_history_filename
|
std::string local_history_filename
|
||||||
= string_printf ("%s-gdb%ld~", history_filename, (long) getpid ());
|
= string_printf ("%s-gdb%ld~", history_filename.c_str (), (long) getpid ());
|
||||||
|
|
||||||
ret = rename (history_filename, local_history_filename.c_str ());
|
ret = rename (history_filename.c_str (), local_history_filename.c_str ());
|
||||||
saved_errno = errno;
|
saved_errno = errno;
|
||||||
if (ret < 0 && saved_errno != ENOENT)
|
if (ret < 0 && saved_errno != ENOENT)
|
||||||
{
|
{
|
||||||
warning (_("Could not rename %ps to %ps: %s"),
|
warning (_("Could not rename %ps to %ps: %s"),
|
||||||
styled_string (file_name_style.style (), history_filename),
|
styled_string (file_name_style.style (),
|
||||||
|
history_filename.c_str ()),
|
||||||
styled_string (file_name_style.style (),
|
styled_string (file_name_style.style (),
|
||||||
local_history_filename.c_str ()),
|
local_history_filename.c_str ()),
|
||||||
safe_strerror (saved_errno));
|
safe_strerror (saved_errno));
|
||||||
|
@ -1279,11 +1270,11 @@ gdb_safe_append_history (void)
|
||||||
history_max_entries);
|
history_max_entries);
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = rename (local_history_filename.c_str (), history_filename);
|
ret = rename (local_history_filename.c_str (), history_filename.c_str ());
|
||||||
saved_errno = errno;
|
saved_errno = errno;
|
||||||
if (ret < 0 && saved_errno != EEXIST)
|
if (ret < 0 && saved_errno != EEXIST)
|
||||||
warning (_("Could not rename %s to %s: %s"),
|
warning (_("Could not rename %s to %s: %s"),
|
||||||
local_history_filename.c_str (), history_filename,
|
local_history_filename.c_str (), history_filename.c_str (),
|
||||||
safe_strerror (saved_errno));
|
safe_strerror (saved_errno));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1656,12 +1647,12 @@ tree, and GDB will still find it.)\n\
|
||||||
|
|
||||||
/* The current top level prompt, settable with "set prompt", and/or
|
/* The current top level prompt, settable with "set prompt", and/or
|
||||||
with the python `gdb.prompt_hook' hook. */
|
with the python `gdb.prompt_hook' hook. */
|
||||||
static char *top_prompt;
|
static std::string top_prompt;
|
||||||
|
|
||||||
/* Access method for the GDB prompt string. */
|
/* Access method for the GDB prompt string. */
|
||||||
|
|
||||||
char *
|
const std::string &
|
||||||
get_prompt (void)
|
get_prompt ()
|
||||||
{
|
{
|
||||||
return top_prompt;
|
return top_prompt;
|
||||||
}
|
}
|
||||||
|
@ -1671,10 +1662,7 @@ get_prompt (void)
|
||||||
void
|
void
|
||||||
set_prompt (const char *s)
|
set_prompt (const char *s)
|
||||||
{
|
{
|
||||||
char *p = xstrdup (s);
|
top_prompt = s;
|
||||||
|
|
||||||
xfree (top_prompt);
|
|
||||||
top_prompt = p;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1814,7 +1802,7 @@ quit_force (int *exit_arg, int from_tty)
|
||||||
/* Save the history information if it is appropriate to do so. */
|
/* Save the history information if it is appropriate to do so. */
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (write_history_p && history_filename)
|
if (write_history_p && !history_filename.empty ())
|
||||||
{
|
{
|
||||||
int save = 0;
|
int save = 0;
|
||||||
|
|
||||||
|
@ -2062,27 +2050,8 @@ init_history (void)
|
||||||
|
|
||||||
set_readline_history_size (history_size_setshow_var);
|
set_readline_history_size (history_size_setshow_var);
|
||||||
|
|
||||||
tmpenv = getenv ("GDBHISTFILE");
|
if (!history_filename.empty ())
|
||||||
if (tmpenv != nullptr)
|
read_history (history_filename.c_str ());
|
||||||
history_filename = xstrdup (tmpenv);
|
|
||||||
else if (history_filename == nullptr)
|
|
||||||
{
|
|
||||||
/* We include the current directory so that if the user changes
|
|
||||||
directories the file written will be the same as the one
|
|
||||||
that was read. */
|
|
||||||
#ifdef __MSDOS__
|
|
||||||
/* No leading dots in file names are allowed on MSDOS. */
|
|
||||||
const char *fname = "_gdb_history";
|
|
||||||
#else
|
|
||||||
const char *fname = ".gdb_history";
|
|
||||||
#endif
|
|
||||||
|
|
||||||
gdb::unique_xmalloc_ptr<char> temp (gdb_abspath (fname));
|
|
||||||
history_filename = temp.release ();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!history_filename_empty ())
|
|
||||||
read_history (history_filename);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -2132,21 +2101,20 @@ show_exec_done_display_p (struct ui_file *file, int from_tty,
|
||||||
Extension languages, for example Python's gdb.parameter API, will read
|
Extension languages, for example Python's gdb.parameter API, will read
|
||||||
the value directory from this variable, so we must ensure that this
|
the value directory from this variable, so we must ensure that this
|
||||||
always contains the correct value. */
|
always contains the correct value. */
|
||||||
static char *staged_gdb_datadir;
|
static std::string staged_gdb_datadir;
|
||||||
|
|
||||||
/* "set" command for the gdb_datadir configuration variable. */
|
/* "set" command for the gdb_datadir configuration variable. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_gdb_datadir (const char *args, int from_tty, struct cmd_list_element *c)
|
set_gdb_datadir (const char *args, int from_tty, struct cmd_list_element *c)
|
||||||
{
|
{
|
||||||
set_gdb_data_directory (staged_gdb_datadir);
|
set_gdb_data_directory (staged_gdb_datadir.c_str ());
|
||||||
|
|
||||||
/* SET_GDB_DATA_DIRECTORY will resolve relative paths in
|
/* SET_GDB_DATA_DIRECTORY will resolve relative paths in
|
||||||
STAGED_GDB_DATADIR, so we now copy the value from GDB_DATADIR
|
STAGED_GDB_DATADIR, so we now copy the value from GDB_DATADIR
|
||||||
back into STAGED_GDB_DATADIR so the extension languages can read the
|
back into STAGED_GDB_DATADIR so the extension languages can read the
|
||||||
correct value. */
|
correct value. */
|
||||||
free (staged_gdb_datadir);
|
staged_gdb_datadir = gdb_datadir;
|
||||||
staged_gdb_datadir = strdup (gdb_datadir.c_str ());
|
|
||||||
|
|
||||||
gdb::observers::gdb_datadir_changed.notify ();
|
gdb::observers::gdb_datadir_changed.notify ();
|
||||||
}
|
}
|
||||||
|
@ -2171,12 +2139,13 @@ set_history_filename (const char *args,
|
||||||
/* We include the current directory so that if the user changes
|
/* We include the current directory so that if the user changes
|
||||||
directories the file written will be the same as the one
|
directories the file written will be the same as the one
|
||||||
that was read. */
|
that was read. */
|
||||||
if (!history_filename_empty () && !IS_ABSOLUTE_PATH (history_filename))
|
if (!history_filename.empty ()
|
||||||
|
&& !IS_ABSOLUTE_PATH (history_filename.c_str ()))
|
||||||
{
|
{
|
||||||
gdb::unique_xmalloc_ptr<char> temp (gdb_abspath (history_filename));
|
gdb::unique_xmalloc_ptr<char> temp
|
||||||
|
(gdb_abspath (history_filename.c_str ()));
|
||||||
|
|
||||||
xfree (history_filename);
|
history_filename = temp.get ();
|
||||||
history_filename = temp.release ();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2342,7 +2311,7 @@ When set, GDB uses the specified path to search for data files."),
|
||||||
&setlist,
|
&setlist,
|
||||||
&showlist);
|
&showlist);
|
||||||
/* Prime the initial value for data-directory. */
|
/* Prime the initial value for data-directory. */
|
||||||
staged_gdb_datadir = strdup (gdb_datadir.c_str ());
|
staged_gdb_datadir = gdb_datadir;
|
||||||
|
|
||||||
add_setshow_auto_boolean_cmd ("interactive-mode", class_support,
|
add_setshow_auto_boolean_cmd ("interactive-mode", class_support,
|
||||||
&interactive_mode, _("\
|
&interactive_mode, _("\
|
||||||
|
@ -2428,3 +2397,28 @@ gdb_init ()
|
||||||
/* Create $_gdb_major and $_gdb_minor convenience variables. */
|
/* Create $_gdb_major and $_gdb_minor convenience variables. */
|
||||||
init_gdb_version_vars ();
|
init_gdb_version_vars ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _initialize_top ();
|
||||||
|
void
|
||||||
|
_initialize_top ()
|
||||||
|
{
|
||||||
|
/* Determine a default value for the history filename. */
|
||||||
|
const char *tmpenv = getenv ("GDBHISTFILE");
|
||||||
|
if (tmpenv != nullptr)
|
||||||
|
history_filename = tmpenv;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* We include the current directory so that if the user changes
|
||||||
|
directories the file written will be the same as the one
|
||||||
|
that was read. */
|
||||||
|
#ifdef __MSDOS__
|
||||||
|
/* No leading dots in file names are allowed on MSDOS. */
|
||||||
|
const char *fname = "_gdb_history";
|
||||||
|
#else
|
||||||
|
const char *fname = ".gdb_history";
|
||||||
|
#endif
|
||||||
|
|
||||||
|
gdb::unique_xmalloc_ptr<char> temp (gdb_abspath (fname));
|
||||||
|
history_filename = temp.get ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -261,7 +261,7 @@ extern scoped_value_mark prepare_execute_command (void);
|
||||||
|
|
||||||
/* This function returns a pointer to the string that is used
|
/* This function returns a pointer to the string that is used
|
||||||
by gdb for its command prompt. */
|
by gdb for its command prompt. */
|
||||||
extern char *get_prompt (void);
|
extern const std::string &get_prompt ();
|
||||||
|
|
||||||
/* This function returns a pointer to the string that is used
|
/* This function returns a pointer to the string that is used
|
||||||
by gdb for its command prompt. */
|
by gdb for its command prompt. */
|
||||||
|
|
|
@ -130,7 +130,7 @@ static traceframe_info_up current_traceframe_info;
|
||||||
static struct cmd_list_element *tfindlist;
|
static struct cmd_list_element *tfindlist;
|
||||||
|
|
||||||
/* List of expressions to collect by default at each tracepoint hit. */
|
/* List of expressions to collect by default at each tracepoint hit. */
|
||||||
char *default_collect;
|
std::string default_collect;
|
||||||
|
|
||||||
static bool disconnected_tracing;
|
static bool disconnected_tracing;
|
||||||
|
|
||||||
|
@ -146,15 +146,15 @@ static int trace_buffer_size = -1;
|
||||||
|
|
||||||
/* Textual notes applying to the current and/or future trace runs. */
|
/* Textual notes applying to the current and/or future trace runs. */
|
||||||
|
|
||||||
static char *trace_user = NULL;
|
static std::string trace_user;
|
||||||
|
|
||||||
/* Textual notes applying to the current and/or future trace runs. */
|
/* Textual notes applying to the current and/or future trace runs. */
|
||||||
|
|
||||||
static char *trace_notes = NULL;
|
static std::string trace_notes;
|
||||||
|
|
||||||
/* Textual notes applying to the stopping of a trace. */
|
/* Textual notes applying to the stopping of a trace. */
|
||||||
|
|
||||||
static char *trace_stop_notes = NULL;
|
static std::string trace_stop_notes;
|
||||||
|
|
||||||
/* support routines */
|
/* support routines */
|
||||||
|
|
||||||
|
@ -1688,10 +1688,11 @@ start_tracing (const char *notes)
|
||||||
target_set_trace_buffer_size (trace_buffer_size);
|
target_set_trace_buffer_size (trace_buffer_size);
|
||||||
|
|
||||||
if (!notes)
|
if (!notes)
|
||||||
notes = trace_notes;
|
notes = trace_notes.c_str ();
|
||||||
ret = target_set_trace_notes (trace_user, notes, NULL);
|
|
||||||
|
|
||||||
if (!ret && (trace_user || notes))
|
ret = target_set_trace_notes (trace_user.c_str (), notes, NULL);
|
||||||
|
|
||||||
|
if (!ret && (!trace_user.empty () || notes))
|
||||||
warning (_("Target does not support trace user/notes, info ignored"));
|
warning (_("Target does not support trace user/notes, info ignored"));
|
||||||
|
|
||||||
/* Now insert traps and begin collecting data. */
|
/* Now insert traps and begin collecting data. */
|
||||||
|
@ -1764,7 +1765,8 @@ stop_tracing (const char *note)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!note)
|
if (!note)
|
||||||
note = trace_stop_notes;
|
note = trace_stop_notes.c_str ();
|
||||||
|
|
||||||
ret = target_set_trace_notes (NULL, NULL, note);
|
ret = target_set_trace_notes (NULL, NULL, note);
|
||||||
|
|
||||||
if (!ret && note)
|
if (!ret && note)
|
||||||
|
@ -2804,10 +2806,10 @@ all_tracepoint_actions (struct breakpoint *t)
|
||||||
validation is per-tracepoint (local var "xyz" might be valid for
|
validation is per-tracepoint (local var "xyz" might be valid for
|
||||||
one tracepoint and not another, etc), we make up the action on
|
one tracepoint and not another, etc), we make up the action on
|
||||||
the fly, and don't cache it. */
|
the fly, and don't cache it. */
|
||||||
if (*default_collect)
|
if (!default_collect.empty ())
|
||||||
{
|
{
|
||||||
gdb::unique_xmalloc_ptr<char> default_collect_line
|
gdb::unique_xmalloc_ptr<char> default_collect_line
|
||||||
(xstrprintf ("collect %s", default_collect));
|
(xstrprintf ("collect %s", default_collect.c_str ()));
|
||||||
|
|
||||||
validate_actionline (default_collect_line.get (), t);
|
validate_actionline (default_collect_line.get (), t);
|
||||||
actions.reset (new struct command_line (simple_control,
|
actions.reset (new struct command_line (simple_control,
|
||||||
|
@ -2896,7 +2898,7 @@ set_trace_user (const char *args, int from_tty,
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = target_set_trace_notes (trace_user, NULL, NULL);
|
ret = target_set_trace_notes (trace_user.c_str (), NULL, NULL);
|
||||||
|
|
||||||
if (!ret)
|
if (!ret)
|
||||||
warning (_("Target does not support trace notes, user ignored"));
|
warning (_("Target does not support trace notes, user ignored"));
|
||||||
|
@ -2908,7 +2910,7 @@ set_trace_notes (const char *args, int from_tty,
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = target_set_trace_notes (NULL, trace_notes, NULL);
|
ret = target_set_trace_notes (NULL, trace_notes.c_str (), NULL);
|
||||||
|
|
||||||
if (!ret)
|
if (!ret)
|
||||||
warning (_("Target does not support trace notes, note ignored"));
|
warning (_("Target does not support trace notes, note ignored"));
|
||||||
|
@ -2920,7 +2922,7 @@ set_trace_stop_notes (const char *args, int from_tty,
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = target_set_trace_notes (NULL, NULL, trace_stop_notes);
|
ret = target_set_trace_notes (NULL, NULL, trace_stop_notes.c_str ());
|
||||||
|
|
||||||
if (!ret)
|
if (!ret)
|
||||||
warning (_("Target does not support trace notes, stop note ignored"));
|
warning (_("Target does not support trace notes, stop note ignored"));
|
||||||
|
@ -4137,7 +4139,6 @@ Tracepoint actions may include collecting of specified data,\n\
|
||||||
single-stepping, or enabling/disabling other tracepoints,\n\
|
single-stepping, or enabling/disabling other tracepoints,\n\
|
||||||
depending on target's capabilities."));
|
depending on target's capabilities."));
|
||||||
|
|
||||||
default_collect = xstrdup ("");
|
|
||||||
add_setshow_string_cmd ("default-collect", class_trace,
|
add_setshow_string_cmd ("default-collect", class_trace,
|
||||||
&default_collect, _("\
|
&default_collect, _("\
|
||||||
Set the list of expressions to collect by default."), _("\
|
Set the list of expressions to collect by default."), _("\
|
||||||
|
|
|
@ -159,7 +159,7 @@ struct trace_status
|
||||||
|
|
||||||
struct trace_status *current_trace_status (void);
|
struct trace_status *current_trace_status (void);
|
||||||
|
|
||||||
extern char *default_collect;
|
extern std::string default_collect;
|
||||||
|
|
||||||
extern int trace_regblock_size;
|
extern int trace_regblock_size;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue