From 8b88a78e63526b84d540b9c7d5f459593a248d5e Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Thu, 7 Jun 2018 17:27:46 +0100 Subject: target_stack -> current_top_target() throughout The recent C++ification of target_ops replaced references to the old "current_target" squashed target throughout with references to a "target_stack" pointer. I had picked the "target_stack" name very early in the multi-target work, and managed to stick with it, even though it's a bit of a misnomer, since it isn't really a "target stack" object, but a pointer into the current top target in the stack. As I'm splitting more pieces off of the multi-target branch, I've come to think that it's better to rename it now. A following patch will introduce a new class to represent a target stack, and "target_stack" would be _its_ ideal name. (In the branch, the class is called a_target_stack to work around the clash.) Thus this commit renames target_stack to current_top_target and replaces all references throughout. Also, while at it, current_top_target is made a function instead of a pointer, to make it possible to change its internal implementation without leaking implementation details out. In a couple patches, the implementation of the function will change to refer to a target stack object, and then further down the multi-target work, it'll change again to find the right target stack for the current inferior. gdb/ChangeLog: 2018-06-07 Pedro Alves * target.h (target_stack): Delete. (current_top_target): Declare function. * target.c (target_stack): Delete. (g_current_top_target): New. (current_top_target): New function. * auxv.c: Use current_top_target instead of target_stack throughout. * avr-tdep.c: Likewise. * breakpoint.c: Likewise. * corefile.c: Likewise. * elfread.c: Likewise. * eval.c: Likewise. * exceptions.c: Likewise. * frame.c: Likewise. * gdbarch-selftests.c: Likewise. * gnu-v3-abi.c: Likewise. * ia64-tdep.c: Likewise. * ia64-vms-tdep.c: Likewise. * infcall.c: Likewise. * infcmd.c: Likewise. * infrun.c: Likewise. * linespec.c: Likewise. * linux-tdep.c: Likewise. * minsyms.c: Likewise. * ppc-linux-nat.c: Likewise. * ppc-linux-tdep.c: Likewise. * procfs.c: Likewise. * regcache.c: Likewise. * remote.c: Likewise. * rs6000-tdep.c: Likewise. * s390-linux-nat.c: Likewise. * s390-tdep.c: Likewise. * solib-aix.c: Likewise. * solib-darwin.c: Likewise. * solib-dsbt.c: Likewise. * solib-spu.c: Likewise. * solib-svr4.c: Likewise. * solib-target.c: Likewise. * sparc-tdep.c: Likewise. * sparc64-tdep.c: Likewise. * spu-tdep.c: Likewise. * symfile.c: Likewise. * symtab.c: Likewise. * target-descriptions.c: Likewise. * target-memory.c: Likewise. * target.c: Likewise. * target.h: Likewise. * tracefile-tfile.c: Likewise. * tracepoint.c: Likewise. * valops.c: Likewise. * valprint.c: Likewise. * value.c: Likewise. * windows-tdep.c: Likewise. * mi/mi-main.c: Likewise. --- gdb/infcmd.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'gdb/infcmd.c') diff --git a/gdb/infcmd.c b/gdb/infcmd.c index af3fa5f..b3f0238 100644 --- a/gdb/infcmd.c +++ b/gdb/infcmd.c @@ -660,7 +660,7 @@ run_command_1 (const char *args, int from_tty, enum run_how run_how) /* Pass zero for FROM_TTY, because at this point the "run" command has done its thing; now we are setting up the running program. */ - post_create_inferior (target_stack, 0); + post_create_inferior (current_top_target (), 0); /* Queue a pending event so that the program stops immediately. */ if (run_how == RUN_STOP_AT_FIRST_INSN) @@ -896,7 +896,7 @@ continue_command (const char *args, int from_tty) ensure_not_running (); } - prepare_execution_command (target_stack, async_exec); + prepare_execution_command (current_top_target (), async_exec); if (from_tty) printf_filtered (_("Continuing.\n")); @@ -1043,7 +1043,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 (target_stack, async_exec); + prepare_execution_command (current_top_target (), async_exec); count = count_string ? parse_and_eval_long (count_string) : 1; @@ -1232,7 +1232,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 (target_stack, async_exec); + prepare_execution_command (current_top_target (), async_exec); if (!arg) error_no_arg (_("starting address")); @@ -1312,7 +1312,7 @@ signal_command (const char *signum_exp, int from_tty) = strip_bg_char (signum_exp, &async_exec); signum_exp = stripped.get (); - prepare_execution_command (target_stack, async_exec); + prepare_execution_command (current_top_target (), async_exec); if (!signum_exp) error_no_arg (_("signal number")); @@ -1585,7 +1585,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 (target_stack, async_exec); + prepare_execution_command (current_top_target (), async_exec); if (arg) until_break_command (arg, from_tty, 0); @@ -1610,7 +1610,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 (target_stack, async_exec); + prepare_execution_command (current_top_target (), async_exec); until_break_command (arg, from_tty, 1); } @@ -1990,7 +1990,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 (target_stack, async_exec); + prepare_execution_command (current_top_target (), async_exec); if (arg) error (_("The \"finish\" command does not take any arguments.")); @@ -2686,7 +2686,7 @@ setup_inferior (int from_tty) /* Take any necessary post-attaching actions for this platform. */ target_post_attach (ptid_get_pid (inferior_ptid)); - post_create_inferior (target_stack, from_tty); + post_create_inferior (current_top_target (), from_tty); } /* What to do after the first program stops after attaching. */ -- cgit v1.1