From 328d42d87e97c75d6e52800bfd4bc1bfdfb745d2 Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Wed, 24 Mar 2021 18:08:12 -0400 Subject: gdb: remove current_top_target function The current_top_target function is a hidden dependency on the current inferior. Since I'd like to slowly move towards reducing our dependency on the global current state, remove this function and make callers use current_inferior ()->top_target () There is no expected change in behavior, but this one step towards making those callers use the inferior from their context, rather than refer to the global current inferior. gdb/ChangeLog: * target.h (current_top_target): Remove, make callers use the current inferior instead. * target.c (current_top_target): Remove. Change-Id: Iccd457036f84466cdaa3865aa3f9339a24ea001d --- gdb/infcmd.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'gdb/infcmd.c') diff --git a/gdb/infcmd.c b/gdb/infcmd.c index 80e6ad3..a6e9572 100644 --- a/gdb/infcmd.c +++ b/gdb/infcmd.c @@ -759,7 +759,7 @@ continue_command (const char *args, int from_tty) ensure_not_running (); } - prepare_execution_command (current_top_target (), async_exec); + prepare_execution_command (current_inferior ()->top_target (), async_exec); if (from_tty) printf_filtered (_("Continuing.\n")); @@ -877,7 +877,7 @@ step_1 (int skip_subroutines, int single_inst, const char *count_string) = strip_bg_char (count_string, &async_exec); count_string = stripped.get (); - prepare_execution_command (current_top_target (), async_exec); + prepare_execution_command (current_inferior ()->top_target (), async_exec); count = count_string ? parse_and_eval_long (count_string) : 1; @@ -1075,7 +1075,7 @@ jump_command (const char *arg, int from_tty) gdb::unique_xmalloc_ptr stripped = strip_bg_char (arg, &async_exec); arg = stripped.get (); - prepare_execution_command (current_top_target (), async_exec); + prepare_execution_command (current_inferior ()->top_target (), async_exec); if (!arg) error_no_arg (_("starting address")); @@ -1155,7 +1155,7 @@ signal_command (const char *signum_exp, int from_tty) = strip_bg_char (signum_exp, &async_exec); signum_exp = stripped.get (); - prepare_execution_command (current_top_target (), async_exec); + prepare_execution_command (current_inferior ()->top_target (), async_exec); if (!signum_exp) error_no_arg (_("signal number")); @@ -1400,7 +1400,7 @@ until_command (const char *arg, int from_tty) gdb::unique_xmalloc_ptr stripped = strip_bg_char (arg, &async_exec); arg = stripped.get (); - prepare_execution_command (current_top_target (), async_exec); + prepare_execution_command (current_inferior ()->top_target (), async_exec); if (arg) until_break_command (arg, from_tty, 0); @@ -1425,7 +1425,7 @@ advance_command (const char *arg, int from_tty) gdb::unique_xmalloc_ptr stripped = strip_bg_char (arg, &async_exec); arg = stripped.get (); - prepare_execution_command (current_top_target (), async_exec); + prepare_execution_command (current_inferior ()->top_target (), async_exec); until_break_command (arg, from_tty, 1); } @@ -1772,7 +1772,7 @@ finish_command (const char *arg, int from_tty) gdb::unique_xmalloc_ptr stripped = strip_bg_char (arg, &async_exec); arg = stripped.get (); - prepare_execution_command (current_top_target (), async_exec); + prepare_execution_command (current_inferior ()->top_target (), async_exec); if (arg) error (_("The \"finish\" command does not take any arguments.")); -- cgit v1.1