@@ -269,7 +269,6 @@ static int linux_wait_for_event_filtered (ptid_t wait_ptid, ptid_t filter_ptid,
int *wstat, int options);
static int linux_wait_for_event (ptid_t ptid, int *wstat, int options);
static struct lwp_info *add_lwp (ptid_t ptid);
-static int linux_stopped_by_watchpoint (void);
static void mark_lwp_dead (struct lwp_info *lwp, int wstat);
static int lwp_is_marked_dead (struct lwp_info *lwp);
static void proceed_all_lwps (void);
@@ -6044,16 +6043,16 @@ linux_supports_software_single_step (void)
return can_software_single_step ();
}
-static int
-linux_stopped_by_watchpoint (void)
+bool
+linux_process_target::stopped_by_watchpoint ()
{
struct lwp_info *lwp = get_thread_lwp (current_thread);
return lwp->stop_reason == TARGET_STOPPED_BY_WATCHPOINT;
}
-static CORE_ADDR
-linux_stopped_data_address (void)
+CORE_ADDR
+linux_process_target::stopped_data_address ()
{
struct lwp_info *lwp = get_thread_lwp (current_thread);
@@ -7376,8 +7375,6 @@ linux_get_hwcap2 (int wordsize)
static linux_process_target the_linux_target;
static process_stratum_target linux_target_ops = {
- linux_stopped_by_watchpoint,
- linux_stopped_data_address,
#if defined(__UCLIBC__) && defined(HAS_NOMMU) \
&& defined(PT_TEXT_ADDR) && defined(PT_DATA_ADDR) \
&& defined(PT_TEXT_END_ADDR)
@@ -332,6 +332,10 @@ public:
bool supports_stopped_by_hw_breakpoint () override;
bool supports_hardware_single_step () override;
+
+ bool stopped_by_watchpoint () override;
+
+ CORE_ADDR stopped_data_address () override;
};
#define get_thread_lwp(thr) ((struct lwp_info *) (thread_target_data (thr)))
@@ -735,8 +735,6 @@ static lynx_process_target the_lynx_target;
/* The LynxOS target_ops vector. */
static process_stratum_target lynx_target_ops = {
- NULL, /* stopped_by_watchpoint */
- NULL, /* stopped_data_address */
NULL, /* read_offsets */
NULL, /* get_tls_address */
NULL, /* hostio_last_error */
@@ -878,12 +878,12 @@ nto_process_target::supports_hardware_single_step ()
/* Check if the reason of stop for current thread (CURRENT_INFERIOR) is
a watchpoint.
- Return 1 if stopped by watchpoint, 0 otherwise. */
+ Return true if stopped by watchpoint, false otherwise. */
-static int
-nto_stopped_by_watchpoint (void)
+bool
+nto_process_target::stopped_by_watchpoint ()
{
- int ret = 0;
+ bool ret = false;
TRACE ("%s\n", __func__);
if (nto_inferior.ctl_fd != -1 && current_thread != NULL)
@@ -899,7 +899,7 @@ nto_stopped_by_watchpoint (void)
err = devctl (nto_inferior.ctl_fd, DCMD_PROC_STATUS, &status,
sizeof (status), 0);
if (err == EOK && (status.flags & watchmask))
- ret = 1;
+ ret = true;
}
}
TRACE ("%s: %s\n", __func__, ret ? "yes" : "no");
@@ -910,8 +910,8 @@ nto_stopped_by_watchpoint (void)
Return inferior's instruction pointer value, or 0 on error. */
-static CORE_ADDR
-nto_stopped_data_address (void)
+CORE_ADDR
+nto_process_target::stopped_data_address ()
{
CORE_ADDR ret = (CORE_ADDR)0;
@@ -956,8 +956,6 @@ nto_sw_breakpoint_from_kind (int kind, int *size)
static nto_process_target the_nto_target;
static process_stratum_target nto_target_ops = {
- nto_stopped_by_watchpoint,
- nto_stopped_data_address,
NULL, /* nto_read_offsets */
NULL, /* thread_db_set_tls_address */
hostio_last_error_from_errno,
@@ -94,6 +94,10 @@ public:
int size, raw_breakpoint *bp) override;
bool supports_hardware_single_step () override;
+
+ bool stopped_by_watchpoint () override;
+
+ CORE_ADDR stopped_data_address () override;
};
/* The inferior's target description. This is a global because the
@@ -1214,8 +1214,7 @@ prepare_resume_reply (char *buf, ptid_t ptid,
regcache = get_thread_regcache (current_thread, 1);
- if (the_target->stopped_by_watchpoint != NULL
- && (*the_target->stopped_by_watchpoint) ())
+ if (the_target->pt->stopped_by_watchpoint ())
{
CORE_ADDR addr;
int i;
@@ -1223,7 +1222,7 @@ prepare_resume_reply (char *buf, ptid_t ptid,
memcpy (buf, "watch:", 6);
buf += 6;
- addr = (*the_target->stopped_data_address) ();
+ addr = the_target->pt->stopped_data_address ();
/* Convert each byte of the address into two hexadecimal
chars. Note that we take sizeof (void *) instead of
@@ -469,3 +469,15 @@ process_target::supports_hardware_single_step ()
{
return false;
}
+
+bool
+process_target::stopped_by_watchpoint ()
+{
+ return false;
+}
+
+CORE_ADDR
+process_target::stopped_data_address ()
+{
+ return 0;
+}
@@ -70,15 +70,6 @@ class process_target;
shared code. */
struct process_stratum_target
{
- /* Returns 1 if target was stopped due to a watchpoint hit, 0 otherwise. */
-
- int (*stopped_by_watchpoint) (void);
-
- /* Returns the address associated with the watchpoint that hit, if any;
- returns 0 otherwise. */
-
- CORE_ADDR (*stopped_data_address) (void);
-
/* Reports the text, data offsets of the executable. This is
needed for uclinux where the executable is relocated during load
time. */
@@ -476,6 +467,14 @@ public:
/* Returns true if the target can do hardware single step. */
virtual bool supports_hardware_single_step ();
+
+ /* Returns true if target was stopped due to a watchpoint hit, false
+ otherwise. */
+ virtual bool stopped_by_watchpoint ();
+
+ /* Returns the address associated with the watchpoint that hit, if any;
+ returns 0 otherwise. */
+ virtual CORE_ADDR stopped_data_address ();
};
extern process_stratum_target *the_target;
@@ -283,17 +283,17 @@ win32_process_target::remove_point (enum raw_bkpt_type type, CORE_ADDR addr,
return 1;
}
-static int
-win32_stopped_by_watchpoint (void)
+bool
+win32_process_target::stopped_by_watchpoint ()
{
if (the_low_target.stopped_by_watchpoint != NULL)
return the_low_target.stopped_by_watchpoint ();
else
- return 0;
+ return false;
}
-static CORE_ADDR
-win32_stopped_data_address (void)
+CORE_ADDR
+win32_process_target::stopped_data_address ()
{
if (the_low_target.stopped_data_address != NULL)
return the_low_target.stopped_data_address ();
@@ -1844,8 +1844,6 @@ win32_sw_breakpoint_from_kind (int kind, int *size)
static win32_process_target the_win32_target;
static process_stratum_target win32_target_ops = {
- win32_stopped_by_watchpoint,
- win32_stopped_data_address,
NULL, /* read_offsets */
NULL, /* get_tls_address */
#ifdef _WIN32_WCE
@@ -148,6 +148,10 @@ public:
int size, raw_breakpoint *bp) override;
bool supports_hardware_single_step () override;
+
+ bool stopped_by_watchpoint () override;
+
+ CORE_ADDR stopped_data_address () override;
};
/* Retrieve the context for this thread, if not already retrieved. */