diff options
author | Tom Tromey <tromey@adacore.com> | 2023-04-14 13:18:05 -0600 |
---|---|---|
committer | Tom Tromey <tromey@adacore.com> | 2023-05-01 11:10:25 -0600 |
commit | 7d3b43a15bd4267b5782ca40c0bb1dec1fa3f476 (patch) | |
tree | e94035503264118fb287dc67f3afa7af55208ccc | |
parent | ba71385e7f8824849f5a1f3d77bd5f03928138eb (diff) | |
download | gdb-7d3b43a15bd4267b5782ca40c0bb1dec1fa3f476.zip gdb-7d3b43a15bd4267b5782ca40c0bb1dec1fa3f476.tar.gz gdb-7d3b43a15bd4267b5782ca40c0bb1dec1fa3f476.tar.bz2 |
Turn set_inferior_args_vector into method of inferior
This patch turns set_inferior_args_vector into an overload of
inferior::set_args.
Regression tested on x86-64 Fedora 36.
-rw-r--r-- | gdb/infcmd.c | 8 | ||||
-rw-r--r-- | gdb/inferior.c | 8 | ||||
-rw-r--r-- | gdb/inferior.h | 5 | ||||
-rw-r--r-- | gdb/main.c | 3 |
4 files changed, 13 insertions, 11 deletions
diff --git a/gdb/infcmd.c b/gdb/infcmd.c index 1ed7ced..dd3675e 100644 --- a/gdb/infcmd.c +++ b/gdb/infcmd.c @@ -120,14 +120,6 @@ show_inferior_tty_command (struct ui_file *file, int from_tty, "is \"%s\".\n"), inferior_tty.c_str ()); } -void -set_inferior_args_vector (int argc, char **argv) -{ - gdb::array_view<char * const> args (argv, argc); - std::string n = construct_inferior_arguments (args); - current_inferior ()->set_args (std::move (n)); -} - /* Store the new value passed to 'set args'. */ static void diff --git a/gdb/inferior.c b/gdb/inferior.c index 9e37029..fd451c8 100644 --- a/gdb/inferior.c +++ b/gdb/inferior.c @@ -164,6 +164,14 @@ inferior::tty () return m_terminal; } +/* See inferior.h. */ + +void +inferior::set_args (gdb::array_view<char * const> args) +{ + set_args (construct_inferior_arguments (args)); +} + void inferior::add_continuation (std::function<void ()> &&cont) { diff --git a/gdb/inferior.h b/gdb/inferior.h index 613ef28..caa8e4d 100644 --- a/gdb/inferior.h +++ b/gdb/inferior.h @@ -225,8 +225,6 @@ extern void post_create_inferior (int from_tty); extern void attach_command (const char *, int); -extern void set_inferior_args_vector (int, char **); - extern void registers_info (const char *, int); extern void continue_1 (int all_threads); @@ -530,6 +528,9 @@ public: m_args = std::move (args); }; + /* Set the argument string from some strings. */ + void set_args (gdb::array_view<char * const> args); + /* Get the argument string to use when running this inferior. No arguments is represented by an empty string. */ @@ -1064,7 +1064,8 @@ captured_main_1 (struct captured_main_args *context) symarg = argv[optind]; execarg = argv[optind]; ++optind; - set_inferior_args_vector (argc - optind, &argv[optind]); + current_inferior ()->set_args + (gdb::array_view<char * const> (&argv[optind], argc - optind)); } else { |