aboutsummaryrefslogtreecommitdiff
path: root/gdb/infrun.c
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@polymtl.ca>2021-03-24 18:08:12 -0400
committerSimon Marchi <simon.marchi@polymtl.ca>2021-03-24 18:08:24 -0400
commit328d42d87e97c75d6e52800bfd4bc1bfdfb745d2 (patch)
tree4dee500fe0bf6acd7dcb8153aabebaa27936c564 /gdb/infrun.c
parentd777bf0df22f1048fd24999ae563e30abcbcfbe7 (diff)
downloadbinutils-328d42d87e97c75d6e52800bfd4bc1bfdfb745d2.zip
binutils-328d42d87e97c75d6e52800bfd4bc1bfdfb745d2.tar.gz
binutils-328d42d87e97c75d6e52800bfd4bc1bfdfb745d2.tar.bz2
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
Diffstat (limited to 'gdb/infrun.c')
-rw-r--r--gdb/infrun.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/gdb/infrun.c b/gdb/infrun.c
index b6f399d..20035a0 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -1777,7 +1777,7 @@ displaced_step_finish (thread_info *event_thread, enum gdb_signal signal)
/* Fixup may need to read memory/registers. Switch to the thread
that we're fixing up. Also, target_stopped_by_watchpoint checks
the current thread, and displaced_step_restore performs ptid-dependent
- memory accesses using current_inferior() and current_top_target(). */
+ memory accesses using current_inferior(). */
switch_to_thread (event_thread);
displaced_step_reset_cleanup cleanup (displaced);
@@ -5813,7 +5813,8 @@ handle_signal_stop (struct execution_control_state *ecs)
infrun_debug_printf ("stopped by watchpoint");
- if (target_stopped_data_address (current_top_target (), &addr))
+ if (target_stopped_data_address (current_inferior ()->top_target (),
+ &addr))
infrun_debug_printf ("stopped data address=%s",
paddress (reg_gdbarch, addr));
else
@@ -8835,7 +8836,8 @@ siginfo_value_read (struct value *v)
validate_registers_access ();
transferred =
- target_read (current_top_target (), TARGET_OBJECT_SIGNAL_INFO,
+ target_read (current_inferior ()->top_target (),
+ TARGET_OBJECT_SIGNAL_INFO,
NULL,
value_contents_all_raw (v),
value_offset (v),
@@ -8857,7 +8859,7 @@ siginfo_value_write (struct value *v, struct value *fromval)
vice versa. */
validate_registers_access ();
- transferred = target_write (current_top_target (),
+ transferred = target_write (current_inferior ()->top_target (),
TARGET_OBJECT_SIGNAL_INFO,
NULL,
value_contents_all_raw (fromval),
@@ -8921,7 +8923,8 @@ public:
siginfo_data.reset ((gdb_byte *) xmalloc (len));
- if (target_read (current_top_target (), TARGET_OBJECT_SIGNAL_INFO, NULL,
+ if (target_read (current_inferior ()->top_target (),
+ TARGET_OBJECT_SIGNAL_INFO, NULL,
siginfo_data.get (), 0, len) != len)
{
/* Errors ignored. */
@@ -8956,7 +8959,8 @@ public:
struct type *type = gdbarch_get_siginfo_type (gdbarch);
/* Errors ignored. */
- target_write (current_top_target (), TARGET_OBJECT_SIGNAL_INFO, NULL,
+ target_write (current_inferior ()->top_target (),
+ TARGET_OBJECT_SIGNAL_INFO, NULL,
m_siginfo_data.get (), 0, TYPE_LENGTH (type));
}