{
if (current_inferior ()->argc != 0)
{
- char *n;
-
- n = construct_inferior_arguments (current_inferior ()->argc,
- current_inferior ()->argv);
- set_inferior_args (n);
- xfree (n);
+ gdb::array_view<char * const> args (current_inferior ()->argv,
+ current_inferior ()->argc);
+ std::string n = construct_inferior_arguments (args);
+ set_inferior_args (n.c_str ());
}
if (current_inferior ()->args == NULL)
"when starting the inferior is \"%s\".\n"), cwd);
}
-\f
-/* Compute command-line string given argument vector. This does the
- same shell processing as fork_inferior. */
-
-char *
-construct_inferior_arguments (int argc, char **argv)
-{
- char *result;
-
- /* ARGC should always be at least 1, but we double check this
- here. This is also needed to silence -Werror-stringop
- warnings. */
- gdb_assert (argc > 0);
-
- if (startup_with_shell)
- {
-#ifdef __MINGW32__
- /* This holds all the characters considered special to the
- Windows shells. */
- static const char special[] = "\"!&*|[]{}<>?`~^=;, \t\n";
- static const char quote = '"';
-#else
- /* This holds all the characters considered special to the
- typical Unix shells. We include `^' because the SunOS
- /bin/sh treats it as a synonym for `|'. */
- static const char special[] = "\"!#$&*()\\|[]{}<>?'`~^; \t\n";
- static const char quote = '\'';
-#endif
- int i;
- int length = 0;
- char *out, *cp;
-
- /* We over-compute the size. It shouldn't matter. */
- for (i = 0; i < argc; ++i)
- length += 3 * strlen (argv[i]) + 1 + 2 * (argv[i][0] == '\0');
-
- result = (char *) xmalloc (length);
- out = result;
-
- for (i = 0; i < argc; ++i)
- {
- if (i > 0)
- *out++ = ' ';
-
- /* Need to handle empty arguments specially. */
- if (argv[i][0] == '\0')
- {
- *out++ = quote;
- *out++ = quote;
- }
- else
- {
-#ifdef __MINGW32__
- int quoted = 0;
-
- if (strpbrk (argv[i], special))
- {
- quoted = 1;
- *out++ = quote;
- }
-#endif
- for (cp = argv[i]; *cp; ++cp)
- {
- if (*cp == '\n')
- {
- /* A newline cannot be quoted with a backslash (it
- just disappears), only by putting it inside
- quotes. */
- *out++ = quote;
- *out++ = '\n';
- *out++ = quote;
- }
- else
- {
-#ifdef __MINGW32__
- if (*cp == quote)
-#else
- if (strchr (special, *cp) != NULL)
-#endif
- *out++ = '\\';
- *out++ = *cp;
- }
- }
-#ifdef __MINGW32__
- if (quoted)
- *out++ = quote;
-#endif
- }
- }
- *out = '\0';
- }
- else
- {
- /* In this case we can't handle arguments that contain spaces,
- tabs, or newlines -- see breakup_args(). */
- int i;
- int length = 0;
-
- for (i = 0; i < argc; ++i)
- {
- char *cp = strchr (argv[i], ' ');
- if (cp == NULL)
- cp = strchr (argv[i], '\t');
- if (cp == NULL)
- cp = strchr (argv[i], '\n');
- if (cp != NULL)
- error (_("can't handle command-line "
- "argument containing whitespace"));
- length += strlen (argv[i]) + 1;
- }
-
- result = (char *) xmalloc (length);
- result[0] = '\0';
- for (i = 0; i < argc; ++i)
- {
- if (i > 0)
- strcat (result, " ");
- strcat (result, argv[i]);
- }
- }
-
- return result;
-}
-\f
/* This function strips the '&' character (indicating background
execution) that is added as *the last* of the arguments ARGS of a
struct value *value;
value_type = check_typedef (value_type);
- gdb_assert (TYPE_CODE (value_type) != TYPE_CODE_VOID);
+ gdb_assert (value_type->code () != TYPE_CODE_VOID);
/* FIXME: 2003-09-27: When returning from a nested inferior function
call, it's possible (with no help from the architecture vector)
print_return_value (struct ui_out *uiout, struct return_value_info *rv)
{
if (rv->type == NULL
- || TYPE_CODE (check_typedef (rv->type)) == TYPE_CODE_VOID)
+ || check_typedef (rv->type)->code () == TYPE_CODE_VOID)
return;
try
internal_error (__FILE__, __LINE__,
_("finish_command: function has no target type"));
- if (TYPE_CODE (check_typedef (rv->type)) != TYPE_CODE_VOID)
+ if (check_typedef (rv->type)->code () != TYPE_CODE_VOID)
{
struct value *func;
/* If virtual format is floating, print it that way, and in raw
hex. */
- if (TYPE_CODE (regtype) == TYPE_CODE_FLT
- || TYPE_CODE (regtype) == TYPE_CODE_DECFLOAT)
+ if (regtype->code () == TYPE_CODE_FLT
+ || regtype->code () == TYPE_CODE_DECFLOAT)
{
struct value_print_options opts;
const gdb_byte *valaddr = value_contents_for_printing (val);
get_user_print_options (&opts);
opts.deref_ref = 1;
- val_print (regtype,
- value_embedded_offset (val), 0,
- &format_stream, 0, val, &opts, current_language);
+ common_val_print (val, &format_stream, 0, &opts, current_language);
if (print_raw_format)
{
/* Print the register in hex. */
get_formatted_print_options (&opts, 'x');
opts.deref_ref = 1;
- val_print (regtype,
- value_embedded_offset (val), 0,
- &format_stream, 0, val, &opts, current_language);
+ common_val_print (val, &format_stream, 0, &opts, current_language);
/* If not a vector register, print it also according to its
natural format. */
if (print_raw_format && TYPE_VECTOR (regtype) == 0)
pad_to_column (format_stream, value_column_2);
get_user_print_options (&opts);
opts.deref_ref = 1;
- val_print (regtype,
- value_embedded_offset (val), 0,
- &format_stream, 0, val, &opts, current_language);
+ common_val_print (val, &format_stream, 0, &opts, current_language);
}
}
gdbarch_print_float_info (get_frame_arch (frame), gdb_stdout, frame, args);
}
\f
-static void
-unset_command (const char *args, int from_tty)
-{
- printf_filtered (_("\"unset\" must be followed by the "
- "name of an unset subcommand.\n"));
- help_list (unsetlist, "unset ", all_commands, gdb_stdout);
-}
-
/* Implement `info proc' family of commands. */
static void
cmd_name = "inferior-tty";
c = lookup_cmd (&cmd_name, setlist, "", -1, 1);
gdb_assert (c != NULL);
- add_alias_cmd ("tty", c, class_alias, 0, &cmdlist);
+ add_alias_cmd ("tty", c, class_run, 0, &cmdlist);
cmd_name = "args";
add_setshow_string_noescape_cmd (cmd_name, class_run,
environment to be given to the program."), &showlist);
set_cmd_completer (c, noop_completer);
- add_prefix_cmd ("unset", no_class, unset_command,
- _("Complement to certain \"set\" commands."),
- &unsetlist, "unset ", 0, &cmdlist);
+ add_basic_prefix_cmd ("unset", no_class,
+ _("Complement to certain \"set\" commands."),
+ &unsetlist, "unset ", 0, &cmdlist);
c = add_cmd ("environment", class_run, unset_environment_command, _("\
Cancel environment variable VAR for the program.\n\
Usage: stepi [N]\n\
Argument N means step N times (or till program stops for another \
reason)."));
- add_com_alias ("si", "stepi", class_alias, 0);
+ add_com_alias ("si", "stepi", class_run, 0);
add_com ("nexti", class_run, nexti_command, _("\
Step one instruction, but proceed through subroutine calls.\n\
Usage: nexti [N]\n\
Argument N means step N times (or till program stops for another \
reason)."));
- add_com_alias ("ni", "nexti", class_alias, 0);
+ add_com_alias ("ni", "nexti", class_run, 0);
add_com ("finish", class_run, finish_command, _("\
Execute until selected stack frame returns.\n\