aboutsummaryrefslogtreecommitdiff
path: root/gdb/target.c
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2018-06-07 17:27:46 +0100
committerPedro Alves <palves@redhat.com>2018-06-07 17:27:46 +0100
commit8b88a78e63526b84d540b9c7d5f459593a248d5e (patch)
tree3d1a43354d8b4cb169f2f9cff422531daee350b2 /gdb/target.c
parentc7110220be62590222e35525dda499902ee49a89 (diff)
downloadgdb-8b88a78e63526b84d540b9c7d5f459593a248d5e.zip
gdb-8b88a78e63526b84d540b9c7d5f459593a248d5e.tar.gz
gdb-8b88a78e63526b84d540b9c7d5f459593a248d5e.tar.bz2
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 <palves@redhat.com> * 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.
Diffstat (limited to 'gdb/target.c')
-rw-r--r--gdb/target.c214
1 files changed, 110 insertions, 104 deletions
diff --git a/gdb/target.c b/gdb/target.c
index d96cdec..13f7e68 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -123,7 +123,13 @@ static struct target_ops *the_debug_target;
/* The target structure we are currently using to talk to a process
or file or whatever "inferior" we have. */
-struct target_ops *target_stack;
+static target_ops *g_current_top_target;
+
+target_ops *
+current_top_target ()
+{
+ return g_current_top_target;
+}
/* Command list for target. */
@@ -264,7 +270,7 @@ target_has_all_memory_1 (void)
{
struct target_ops *t;
- for (t = target_stack; t != NULL; t = t->beneath)
+ for (t = current_top_target (); t != NULL; t = t->beneath)
if (t->has_all_memory ())
return 1;
@@ -276,7 +282,7 @@ target_has_memory_1 (void)
{
struct target_ops *t;
- for (t = target_stack; t != NULL; t = t->beneath)
+ for (t = current_top_target (); t != NULL; t = t->beneath)
if (t->has_memory ())
return 1;
@@ -288,7 +294,7 @@ target_has_stack_1 (void)
{
struct target_ops *t;
- for (t = target_stack; t != NULL; t = t->beneath)
+ for (t = current_top_target (); t != NULL; t = t->beneath)
if (t->has_stack ())
return 1;
@@ -300,7 +306,7 @@ target_has_registers_1 (void)
{
struct target_ops *t;
- for (t = target_stack; t != NULL; t = t->beneath)
+ for (t = current_top_target (); t != NULL; t = t->beneath)
if (t->has_registers ())
return 1;
@@ -312,7 +318,7 @@ target_has_execution_1 (ptid_t the_ptid)
{
struct target_ops *t;
- for (t = target_stack; t != NULL; t = t->beneath)
+ for (t = current_top_target (); t != NULL; t = t->beneath)
if (t->has_execution (the_ptid))
return 1;
@@ -395,14 +401,14 @@ add_deprecated_target_alias (const target_info &tinfo, const char *alias)
void
target_kill (void)
{
- target_stack->kill ();
+ current_top_target ()->kill ();
}
void
target_load (const char *arg, int from_tty)
{
target_dcache_invalidate ();
- target_stack->load (arg, from_tty);
+ current_top_target ()->load (arg, from_tty);
}
/* Define it. */
@@ -415,7 +421,7 @@ target_terminal_state target_terminal::m_terminal_state
void
target_terminal::init (void)
{
- target_stack->terminal_init ();
+ current_top_target ()->terminal_init ();
m_terminal_state = target_terminal_state::is_ours;
}
@@ -446,7 +452,7 @@ target_terminal::inferior (void)
if (inf->terminal_state != target_terminal_state::is_inferior)
{
- target_stack->terminal_inferior ();
+ current_top_target ()->terminal_inferior ();
inf->terminal_state = target_terminal_state::is_inferior;
}
@@ -482,7 +488,7 @@ target_terminal::restore_inferior (void)
if (inf->terminal_state == target_terminal_state::is_ours_for_output)
{
set_current_inferior (inf);
- target_stack->terminal_inferior ();
+ current_top_target ()->terminal_inferior ();
inf->terminal_state = target_terminal_state::is_inferior;
}
}
@@ -515,7 +521,7 @@ target_terminal_is_ours_kind (target_terminal_state desired_state)
if (inf->terminal_state == target_terminal_state::is_inferior)
{
set_current_inferior (inf);
- target_stack->terminal_save_inferior ();
+ current_top_target ()->terminal_save_inferior ();
}
}
@@ -530,9 +536,9 @@ target_terminal_is_ours_kind (target_terminal_state desired_state)
{
set_current_inferior (inf);
if (desired_state == target_terminal_state::is_ours)
- target_stack->terminal_ours ();
+ current_top_target ()->terminal_ours ();
else if (desired_state == target_terminal_state::is_ours_for_output)
- target_stack->terminal_ours_for_output ();
+ current_top_target ()->terminal_ours_for_output ();
else
gdb_assert_not_reached ("unhandled desired state");
inf->terminal_state = desired_state;
@@ -581,7 +587,7 @@ target_terminal::ours_for_output ()
void
target_terminal::info (const char *arg, int from_tty)
{
- target_stack->terminal_info (arg, from_tty);
+ current_top_target ()->terminal_info (arg, from_tty);
}
/* See target.h. */
@@ -589,14 +595,14 @@ target_terminal::info (const char *arg, int from_tty)
int
target_supports_terminal_ours (void)
{
- return target_stack->supports_terminal_ours ();
+ return current_top_target ()->supports_terminal_ours ();
}
static void
tcomplain (void)
{
error (_("You can't do that when your target is `%s'"),
- target_stack->shortname ());
+ current_top_target ()->shortname ());
}
void
@@ -648,7 +654,7 @@ push_target (struct target_ops *t)
struct target_ops **cur;
/* Find the proper stratum to install this target in. */
- for (cur = &target_stack; (*cur) != NULL; cur = &(*cur)->beneath)
+ for (cur = &g_current_top_target; (*cur) != NULL; cur = &(*cur)->beneath)
{
if ((int) (t->to_stratum) >= (int) (*cur)->to_stratum)
break;
@@ -689,7 +695,7 @@ unpush_target (struct target_ops *t)
/* Look for the specified target. Note that we assume that a target
can only occur once in the target stack. */
- for (cur = &target_stack; (*cur) != NULL; cur = &(*cur)->beneath)
+ for (cur = &g_current_top_target; (*cur) != NULL; cur = &(*cur)->beneath)
{
if ((*cur) == t)
break;
@@ -731,8 +737,8 @@ unpush_target_and_assert (struct target_ops *target)
void
pop_all_targets_above (enum strata above_stratum)
{
- while ((int) (target_stack->to_stratum) > (int) above_stratum)
- unpush_target_and_assert (target_stack);
+ while ((int) (current_top_target ()->to_stratum) > (int) above_stratum)
+ unpush_target_and_assert (current_top_target ());
}
/* See target.h. */
@@ -740,8 +746,8 @@ pop_all_targets_above (enum strata above_stratum)
void
pop_all_targets_at_and_above (enum strata stratum)
{
- while ((int) (target_stack->to_stratum) >= (int) stratum)
- unpush_target_and_assert (target_stack);
+ while ((int) (current_top_target ()->to_stratum) >= (int) stratum)
+ unpush_target_and_assert (current_top_target ());
}
void
@@ -757,7 +763,7 @@ target_is_pushed (struct target_ops *t)
{
struct target_ops *cur;
- for (cur = target_stack; cur != NULL; cur = cur->beneath)
+ for (cur = current_top_target (); cur != NULL; cur = cur->beneath)
if (cur == t)
return 1;
@@ -779,7 +785,7 @@ CORE_ADDR
target_translate_tls_address (struct objfile *objfile, CORE_ADDR offset)
{
volatile CORE_ADDR addr = 0;
- struct target_ops *target = target_stack;
+ struct target_ops *target = current_top_target ();
if (gdbarch_fetch_tls_load_module_address_p (target_gdbarch ()))
{
@@ -1345,7 +1351,7 @@ target_xfer_partial (struct target_ops *ops,
int
target_read_memory (CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len)
{
- if (target_read (target_stack, TARGET_OBJECT_MEMORY, NULL,
+ if (target_read (current_top_target (), TARGET_OBJECT_MEMORY, NULL,
myaddr, memaddr, len) == len)
return 0;
else
@@ -1375,7 +1381,7 @@ target_read_uint32 (CORE_ADDR memaddr, uint32_t *result)
int
target_read_raw_memory (CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len)
{
- if (target_read (target_stack, TARGET_OBJECT_RAW_MEMORY, NULL,
+ if (target_read (current_top_target (), TARGET_OBJECT_RAW_MEMORY, NULL,
myaddr, memaddr, len) == len)
return 0;
else
@@ -1388,7 +1394,7 @@ target_read_raw_memory (CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len)
int
target_read_stack (CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len)
{
- if (target_read (target_stack, TARGET_OBJECT_STACK_MEMORY, NULL,
+ if (target_read (current_top_target (), TARGET_OBJECT_STACK_MEMORY, NULL,
myaddr, memaddr, len) == len)
return 0;
else
@@ -1401,7 +1407,7 @@ target_read_stack (CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len)
int
target_read_code (CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len)
{
- if (target_read (target_stack, TARGET_OBJECT_CODE_MEMORY, NULL,
+ if (target_read (current_top_target (), TARGET_OBJECT_CODE_MEMORY, NULL,
myaddr, memaddr, len) == len)
return 0;
else
@@ -1417,7 +1423,7 @@ target_read_code (CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len)
int
target_write_memory (CORE_ADDR memaddr, const gdb_byte *myaddr, ssize_t len)
{
- if (target_write (target_stack, TARGET_OBJECT_MEMORY, NULL,
+ if (target_write (current_top_target (), TARGET_OBJECT_MEMORY, NULL,
myaddr, memaddr, len) == len)
return 0;
else
@@ -1433,7 +1439,7 @@ target_write_memory (CORE_ADDR memaddr, const gdb_byte *myaddr, ssize_t len)
int
target_write_raw_memory (CORE_ADDR memaddr, const gdb_byte *myaddr, ssize_t len)
{
- if (target_write (target_stack, TARGET_OBJECT_RAW_MEMORY, NULL,
+ if (target_write (current_top_target (), TARGET_OBJECT_RAW_MEMORY, NULL,
myaddr, memaddr, len) == len)
return 0;
else
@@ -1445,7 +1451,7 @@ target_write_raw_memory (CORE_ADDR memaddr, const gdb_byte *myaddr, ssize_t len)
std::vector<mem_region>
target_memory_map (void)
{
- std::vector<mem_region> result = target_stack->memory_map ();
+ std::vector<mem_region> result = current_top_target ()->memory_map ();
if (result.empty ())
return result;
@@ -1475,13 +1481,13 @@ target_memory_map (void)
void
target_flash_erase (ULONGEST address, LONGEST length)
{
- target_stack->flash_erase (address, length);
+ current_top_target ()->flash_erase (address, length);
}
void
target_flash_done (void)
{
- target_stack->flash_done ();
+ current_top_target ()->flash_done ();
}
static void
@@ -1936,7 +1942,7 @@ target_insert_breakpoint (struct gdbarch *gdbarch,
return 1;
}
- return target_stack->insert_breakpoint (gdbarch, bp_tgt);
+ return current_top_target ()->insert_breakpoint (gdbarch, bp_tgt);
}
/* See target.h. */
@@ -1956,7 +1962,7 @@ target_remove_breakpoint (struct gdbarch *gdbarch,
return 1;
}
- return target_stack->remove_breakpoint (gdbarch, bp_tgt, reason);
+ return current_top_target ()->remove_breakpoint (gdbarch, bp_tgt, reason);
}
static void
@@ -1969,7 +1975,7 @@ info_target_command (const char *args, int from_tty)
printf_unfiltered (_("Symbols from \"%s\".\n"),
objfile_name (symfile_objfile));
- for (t = target_stack; t != NULL; t = t->beneath)
+ for (t = current_top_target (); t != NULL; t = t->beneath)
{
if (!t->has_memory ())
continue;
@@ -2105,7 +2111,7 @@ target_detach (inferior *inf, int from_tty)
prepare_for_detach ();
- target_stack->detach (inf, from_tty);
+ current_top_target ()->detach (inf, from_tty);
}
void
@@ -2116,7 +2122,7 @@ target_disconnect (const char *args, int from_tty)
disconnecting. */
remove_breakpoints ();
- target_stack->disconnect (args, from_tty);
+ current_top_target ()->disconnect (args, from_tty);
}
/* See target/target.h. */
@@ -2124,7 +2130,7 @@ target_disconnect (const char *args, int from_tty)
ptid_t
target_wait (ptid_t ptid, struct target_waitstatus *status, int options)
{
- return target_stack->wait (ptid, status, options);
+ return current_top_target ()->wait (ptid, status, options);
}
/* See target.h. */
@@ -2141,13 +2147,13 @@ default_target_wait (struct target_ops *ops,
const char *
target_pid_to_str (ptid_t ptid)
{
- return target_stack->pid_to_str (ptid);
+ return current_top_target ()->pid_to_str (ptid);
}
const char *
target_thread_name (struct thread_info *info)
{
- return target_stack->thread_name (info);
+ return current_top_target ()->thread_name (info);
}
struct thread_info *
@@ -2155,7 +2161,7 @@ target_thread_handle_to_thread_info (const gdb_byte *thread_handle,
int handle_len,
struct inferior *inf)
{
- return target_stack->thread_handle_to_thread_info (thread_handle,
+ return current_top_target ()->thread_handle_to_thread_info (thread_handle,
handle_len, inf);
}
@@ -2164,7 +2170,7 @@ target_resume (ptid_t ptid, int step, enum gdb_signal signal)
{
target_dcache_invalidate ();
- target_stack->resume (ptid, step, signal);
+ current_top_target ()->resume (ptid, step, signal);
registers_changed_ptid (ptid);
/* We only set the internal executing state here. The user/frontend
@@ -2184,7 +2190,7 @@ target_commit_resume (void)
if (defer_target_commit_resume)
return;
- target_stack->commit_resume ();
+ current_top_target ()->commit_resume ();
}
/* See target.h. */
@@ -2198,13 +2204,13 @@ make_scoped_defer_target_commit_resume ()
void
target_pass_signals (int numsigs, unsigned char *pass_signals)
{
- target_stack->pass_signals (numsigs, pass_signals);
+ current_top_target ()->pass_signals (numsigs, pass_signals);
}
void
target_program_signals (int numsigs, unsigned char *program_signals)
{
- target_stack->program_signals (numsigs, program_signals);
+ current_top_target ()->program_signals (numsigs, program_signals);
}
static int
@@ -2222,7 +2228,7 @@ default_follow_fork (struct target_ops *self, int follow_child,
int
target_follow_fork (int follow_child, int detach_fork)
{
- return target_stack->follow_fork (follow_child, detach_fork);
+ return current_top_target ()->follow_fork (follow_child, detach_fork);
}
/* Target wrapper for follow exec hook. */
@@ -2230,7 +2236,7 @@ target_follow_fork (int follow_child, int detach_fork)
void
target_follow_exec (struct inferior *inf, char *execd_pathname)
{
- target_stack->follow_exec (inf, execd_pathname);
+ current_top_target ()->follow_exec (inf, execd_pathname);
}
static void
@@ -2244,7 +2250,7 @@ void
target_mourn_inferior (ptid_t ptid)
{
gdb_assert (ptid_equal (ptid, inferior_ptid));
- target_stack->mourn_inferior ();
+ current_top_target ()->mourn_inferior ();
/* We no longer need to keep handles on any of the object files.
Make sure to release them to avoid unnecessarily locking any
@@ -2371,7 +2377,7 @@ default_search_memory (struct target_ops *self,
CORE_ADDR *found_addrp)
{
/* Start over from the top of the target stack. */
- return simple_search_memory (target_stack,
+ return simple_search_memory (current_top_target (),
start_addr, search_space_len,
pattern, pattern_len, found_addrp);
}
@@ -2388,7 +2394,7 @@ target_search_memory (CORE_ADDR start_addr, ULONGEST search_space_len,
const gdb_byte *pattern, ULONGEST pattern_len,
CORE_ADDR *found_addrp)
{
- return target_stack->search_memory (start_addr, search_space_len,
+ return current_top_target ()->search_memory (start_addr, search_space_len,
pattern, pattern_len, found_addrp);
}
@@ -2401,7 +2407,7 @@ target_require_runnable (void)
{
struct target_ops *t;
- for (t = target_stack; t != NULL; t = t->beneath)
+ for (t = current_top_target (); t != NULL; t = t->beneath)
{
/* If this target knows how to create a new program, then
assume we will still be able to after killing the current
@@ -2491,7 +2497,7 @@ struct target_ops *
find_attach_target (void)
{
/* If a target on the current stack can attach, use it. */
- for (target_ops *t = target_stack; t != NULL; t = t->beneath)
+ for (target_ops *t = current_top_target (); t != NULL; t = t->beneath)
{
if (t->can_attach ())
return t;
@@ -2507,7 +2513,7 @@ struct target_ops *
find_run_target (void)
{
/* If a target on the current stack can run, use it. */
- for (target_ops *t = target_stack; t != NULL; t = t->beneath)
+ for (target_ops *t = current_top_target (); t != NULL; t = t->beneath)
{
if (t->can_create_inferior ())
return t;
@@ -2566,7 +2572,7 @@ find_default_supports_disable_randomization (struct target_ops *self)
int
target_supports_disable_randomization (void)
{
- return target_stack->supports_disable_randomization ();
+ return current_top_target ()->supports_disable_randomization ();
}
/* See target/target.h. */
@@ -2574,7 +2580,7 @@ target_supports_disable_randomization (void)
int
target_supports_multi_process (void)
{
- return target_stack->supports_multi_process ();
+ return current_top_target ()->supports_multi_process ();
}
/* See target.h. */
@@ -2621,7 +2627,7 @@ target_thread_address_space (ptid_t ptid)
{
struct address_space *aspace;
- aspace = target_stack->thread_address_space (ptid);
+ aspace = current_top_target ()->thread_address_space (ptid);
gdb_assert (aspace != NULL);
return aspace;
@@ -2668,7 +2674,7 @@ target_can_run ()
{
struct target_ops *t;
- for (t = target_stack; t != NULL; t = t->beneath)
+ for (t = current_top_target (); t != NULL; t = t->beneath)
{
if (t->can_run ())
return 1;
@@ -3235,7 +3241,7 @@ find_target_at (enum strata stratum)
{
struct target_ops *t;
- for (t = target_stack; t != NULL; t = t->beneath)
+ for (t = current_top_target (); t != NULL; t = t->beneath)
if (t->to_stratum == stratum)
return t;
@@ -3385,13 +3391,13 @@ target_close (struct target_ops *targ)
int
target_thread_alive (ptid_t ptid)
{
- return target_stack->thread_alive (ptid);
+ return current_top_target ()->thread_alive (ptid);
}
void
target_update_thread_list (void)
{
- target_stack->update_thread_list ();
+ current_top_target ()->update_thread_list ();
}
void
@@ -3403,7 +3409,7 @@ target_stop (ptid_t ptid)
return;
}
- target_stack->stop (ptid);
+ current_top_target ()->stop (ptid);
}
void
@@ -3415,7 +3421,7 @@ target_interrupt ()
return;
}
- target_stack->interrupt ();
+ current_top_target ()->interrupt ();
}
/* See target.h. */
@@ -3423,7 +3429,7 @@ target_interrupt ()
void
target_pass_ctrlc (void)
{
- target_stack->pass_ctrlc ();
+ current_top_target ()->pass_ctrlc ();
}
/* See target.h. */
@@ -3518,7 +3524,7 @@ target_options_to_string (int target_options)
void
target_fetch_registers (struct regcache *regcache, int regno)
{
- target_stack->fetch_registers (regcache, regno);
+ current_top_target ()->fetch_registers (regcache, regno);
if (targetdebug)
regcache->debug_print_register ("target_fetch_registers", regno);
}
@@ -3529,7 +3535,7 @@ target_store_registers (struct regcache *regcache, int regno)
if (!may_write_registers)
error (_("Writing to registers is not allowed (regno %d)"), regno);
- target_stack->store_registers (regcache, regno);
+ current_top_target ()->store_registers (regcache, regno);
if (targetdebug)
{
regcache->debug_print_register ("target_store_registers", regno);
@@ -3539,7 +3545,7 @@ target_store_registers (struct regcache *regcache, int regno)
int
target_core_of_thread (ptid_t ptid)
{
- return target_stack->core_of_thread (ptid);
+ return current_top_target ()->core_of_thread (ptid);
}
int
@@ -3577,14 +3583,14 @@ default_verify_memory (struct target_ops *self,
const gdb_byte *data, CORE_ADDR memaddr, ULONGEST size)
{
/* Start over from the top of the target stack. */
- return simple_verify_memory (target_stack,
+ return simple_verify_memory (current_top_target (),
data, memaddr, size);
}
int
target_verify_memory (const gdb_byte *data, CORE_ADDR memaddr, ULONGEST size)
{
- return target_stack->verify_memory (data, memaddr, size);
+ return current_top_target ()->verify_memory (data, memaddr, size);
}
/* The documentation for this function is in its prototype declaration in
@@ -3594,7 +3600,7 @@ int
target_insert_mask_watchpoint (CORE_ADDR addr, CORE_ADDR mask,
enum target_hw_bp_type rw)
{
- return target_stack->insert_mask_watchpoint (addr, mask, rw);
+ return current_top_target ()->insert_mask_watchpoint (addr, mask, rw);
}
/* The documentation for this function is in its prototype declaration in
@@ -3604,7 +3610,7 @@ int
target_remove_mask_watchpoint (CORE_ADDR addr, CORE_ADDR mask,
enum target_hw_bp_type rw)
{
- return target_stack->remove_mask_watchpoint (addr, mask, rw);
+ return current_top_target ()->remove_mask_watchpoint (addr, mask, rw);
}
/* The documentation for this function is in its prototype declaration
@@ -3613,7 +3619,7 @@ target_remove_mask_watchpoint (CORE_ADDR addr, CORE_ADDR mask,
int
target_masked_watch_num_registers (CORE_ADDR addr, CORE_ADDR mask)
{
- return target_stack->masked_watch_num_registers (addr, mask);
+ return current_top_target ()->masked_watch_num_registers (addr, mask);
}
/* The documentation for this function is in its prototype declaration
@@ -3622,7 +3628,7 @@ target_masked_watch_num_registers (CORE_ADDR addr, CORE_ADDR mask)
int
target_ranged_break_num_registers (void)
{
- return target_stack->ranged_break_num_registers ();
+ return current_top_target ()->ranged_break_num_registers ();
}
/* See target.h. */
@@ -3630,7 +3636,7 @@ target_ranged_break_num_registers (void)
struct btrace_target_info *
target_enable_btrace (ptid_t ptid, const struct btrace_config *conf)
{
- return target_stack->enable_btrace (ptid, conf);
+ return current_top_target ()->enable_btrace (ptid, conf);
}
/* See target.h. */
@@ -3638,7 +3644,7 @@ target_enable_btrace (ptid_t ptid, const struct btrace_config *conf)
void
target_disable_btrace (struct btrace_target_info *btinfo)
{
- target_stack->disable_btrace (btinfo);
+ current_top_target ()->disable_btrace (btinfo);
}
/* See target.h. */
@@ -3646,7 +3652,7 @@ target_disable_btrace (struct btrace_target_info *btinfo)
void
target_teardown_btrace (struct btrace_target_info *btinfo)
{
- target_stack->teardown_btrace (btinfo);
+ current_top_target ()->teardown_btrace (btinfo);
}
/* See target.h. */
@@ -3656,7 +3662,7 @@ target_read_btrace (struct btrace_data *btrace,
struct btrace_target_info *btinfo,
enum btrace_read_type type)
{
- return target_stack->read_btrace (btrace, btinfo, type);
+ return current_top_target ()->read_btrace (btrace, btinfo, type);
}
/* See target.h. */
@@ -3664,7 +3670,7 @@ target_read_btrace (struct btrace_data *btrace,
const struct btrace_config *
target_btrace_conf (const struct btrace_target_info *btinfo)
{
- return target_stack->btrace_conf (btinfo);
+ return current_top_target ()->btrace_conf (btinfo);
}
/* See target.h. */
@@ -3672,7 +3678,7 @@ target_btrace_conf (const struct btrace_target_info *btinfo)
void
target_stop_recording (void)
{
- target_stack->stop_recording ();
+ current_top_target ()->stop_recording ();
}
/* See target.h. */
@@ -3680,7 +3686,7 @@ target_stop_recording (void)
void
target_save_record (const char *filename)
{
- target_stack->save_record (filename);
+ current_top_target ()->save_record (filename);
}
/* See target.h. */
@@ -3688,7 +3694,7 @@ target_save_record (const char *filename)
int
target_supports_delete_record ()
{
- return target_stack->supports_delete_record ();
+ return current_top_target ()->supports_delete_record ();
}
/* See target.h. */
@@ -3696,7 +3702,7 @@ target_supports_delete_record ()
void
target_delete_record (void)
{
- target_stack->delete_record ();
+ current_top_target ()->delete_record ();
}
/* See target.h. */
@@ -3704,7 +3710,7 @@ target_delete_record (void)
enum record_method
target_record_method (ptid_t ptid)
{
- return target_stack->record_method (ptid);
+ return current_top_target ()->record_method (ptid);
}
/* See target.h. */
@@ -3712,7 +3718,7 @@ target_record_method (ptid_t ptid)
int
target_record_is_replaying (ptid_t ptid)
{
- return target_stack->record_is_replaying (ptid);
+ return current_top_target ()->record_is_replaying (ptid);
}
/* See target.h. */
@@ -3720,7 +3726,7 @@ target_record_is_replaying (ptid_t ptid)
int
target_record_will_replay (ptid_t ptid, int dir)
{
- return target_stack->record_will_replay (ptid, dir);
+ return current_top_target ()->record_will_replay (ptid, dir);
}
/* See target.h. */
@@ -3728,7 +3734,7 @@ target_record_will_replay (ptid_t ptid, int dir)
void
target_record_stop_replaying (void)
{
- target_stack->record_stop_replaying ();
+ current_top_target ()->record_stop_replaying ();
}
/* See target.h. */
@@ -3736,7 +3742,7 @@ target_record_stop_replaying (void)
void
target_goto_record_begin (void)
{
- target_stack->goto_record_begin ();
+ current_top_target ()->goto_record_begin ();
}
/* See target.h. */
@@ -3744,7 +3750,7 @@ target_goto_record_begin (void)
void
target_goto_record_end (void)
{
- target_stack->goto_record_end ();
+ current_top_target ()->goto_record_end ();
}
/* See target.h. */
@@ -3752,7 +3758,7 @@ target_goto_record_end (void)
void
target_goto_record (ULONGEST insn)
{
- target_stack->goto_record (insn);
+ current_top_target ()->goto_record (insn);
}
/* See target.h. */
@@ -3760,7 +3766,7 @@ target_goto_record (ULONGEST insn)
void
target_insn_history (int size, gdb_disassembly_flags flags)
{
- target_stack->insn_history (size, flags);
+ current_top_target ()->insn_history (size, flags);
}
/* See target.h. */
@@ -3769,7 +3775,7 @@ void
target_insn_history_from (ULONGEST from, int size,
gdb_disassembly_flags flags)
{
- target_stack->insn_history_from (from, size, flags);
+ current_top_target ()->insn_history_from (from, size, flags);
}
/* See target.h. */
@@ -3778,7 +3784,7 @@ void
target_insn_history_range (ULONGEST begin, ULONGEST end,
gdb_disassembly_flags flags)
{
- target_stack->insn_history_range (begin, end, flags);
+ current_top_target ()->insn_history_range (begin, end, flags);
}
/* See target.h. */
@@ -3786,7 +3792,7 @@ target_insn_history_range (ULONGEST begin, ULONGEST end,
void
target_call_history (int size, record_print_flags flags)
{
- target_stack->call_history (size, flags);
+ current_top_target ()->call_history (size, flags);
}
/* See target.h. */
@@ -3794,7 +3800,7 @@ target_call_history (int size, record_print_flags flags)
void
target_call_history_from (ULONGEST begin, int size, record_print_flags flags)
{
- target_stack->call_history_from (begin, size, flags);
+ current_top_target ()->call_history_from (begin, size, flags);
}
/* See target.h. */
@@ -3802,7 +3808,7 @@ target_call_history_from (ULONGEST begin, int size, record_print_flags flags)
void
target_call_history_range (ULONGEST begin, ULONGEST end, record_print_flags flags)
{
- target_stack->call_history_range (begin, end, flags);
+ current_top_target ()->call_history_range (begin, end, flags);
}
/* See target.h. */
@@ -3810,7 +3816,7 @@ target_call_history_range (ULONGEST begin, ULONGEST end, record_print_flags flag
const struct frame_unwind *
target_get_unwinder (void)
{
- return target_stack->get_unwinder ();
+ return current_top_target ()->get_unwinder ();
}
/* See target.h. */
@@ -3818,7 +3824,7 @@ target_get_unwinder (void)
const struct frame_unwind *
target_get_tailcall_unwinder (void)
{
- return target_stack->get_tailcall_unwinder ();
+ return current_top_target ()->get_tailcall_unwinder ();
}
/* See target.h. */
@@ -3826,7 +3832,7 @@ target_get_tailcall_unwinder (void)
void
target_prepare_to_generate_core (void)
{
- target_stack->prepare_to_generate_core ();
+ current_top_target ()->prepare_to_generate_core ();
}
/* See target.h. */
@@ -3834,7 +3840,7 @@ target_prepare_to_generate_core (void)
void
target_done_generating_core (void)
{
- target_stack->done_generating_core ();
+ current_top_target ()->done_generating_core ();
}
@@ -3904,7 +3910,7 @@ maintenance_print_target_stack (const char *cmd, int from_tty)
printf_filtered (_("The current target stack is:\n"));
- for (t = target_stack; t != NULL; t = t->beneath)
+ for (t = current_top_target (); t != NULL; t = t->beneath)
{
if (t->to_stratum == debug_stratum)
continue;
@@ -3918,7 +3924,7 @@ void
target_async (int enable)
{
infrun_async (enable);
- target_stack->async (enable);
+ current_top_target ()->async (enable);
}
/* See target.h. */
@@ -3926,7 +3932,7 @@ target_async (int enable)
void
target_thread_events (int enable)
{
- target_stack->thread_events (enable);
+ current_top_target ()->thread_events (enable);
}
/* Controls if targets can report that they can/are async. This is
@@ -3966,7 +3972,7 @@ maint_show_target_async_command (struct ui_file *file, int from_tty,
static int
target_always_non_stop_p (void)
{
- return target_stack->always_non_stop_p ();
+ return current_top_target ()->always_non_stop_p ();
}
/* See target.h. */