summaryrefslogtreecommitdiff
path: root/gdbserver
diff options
context:
space:
mode:
authorTankut Baris Aktemur <tankut.baris.aktemur@intel.com>2020-04-02 15:11:29 +0200
committerTankut Baris Aktemur <tankut.baris.aktemur@intel.com>2020-04-02 15:11:29 +0200
commitd7599cc0826fd7052d3ab52f3a4350d6769c03b5 (patch)
tree70dad53e121c98034f4eedbc22c0800f5e532386 /gdbserver
parentfd000fb3dfd9c93e332246bf89b700ab9aac7339 (diff)
gdbserver/linux-low: turn 'prepare_to_resume' into a method
gdbserver/ChangeLog: 2020-04-02 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> Turn the 'prepare_to_resume' linux target op into a method of linux_process_target. * linux-low.h (struct linux_target_ops): Remove the op. (class linux_process_target) <low_prepare_to_resume>: Declare. * linux-low.cc (linux_process_target::low_prepare_to_resume): Define. Update the callers below: (linux_process_target::resume_one_lwp_throw) (linux_process_target::low_prepare_to_resume) * linux-x86-low.cc (class x86_target) <low_prepare_to_resume>: Declare. (x86_target::low_prepare_to_resume): Define. (the_low_target): Remove the op field. * linux-aarch64-low.cc (class aarch64_target) <low_prepare_to_resume>: Declare. (aarch64_target::low_prepare_to_resume): Define. (the_low_target): Remove the op field. * linux-arm-low.cc (class arm_target) <low_prepare_to_resume>: Declare. (arm_prepare_to_resume): Turn into... (arm_target::low_prepare_to_resume): ...this. (the_low_target): Remove the op field. * linux-mips-low.cc (class mips_target) <low_prepare_to_resume>: Declare. (mips_linux_prepare_to_resume): Turn into... (mips_target::low_prepare_to_resume): ...this. (the_low_target): Remove the op field. * linux-bfin-low.cc (the_low_target): Remove the op field. * linux-crisv32-low.cc (the_low_target): Ditto. * linux-m32r-low.cc (the_low_target): Ditto. * linux-m68k-low.cc (the_low_target): Ditto. * linux-ppc-low.cc (the_low_target): Ditto. * linux-s390-low.cc (the_low_target): Ditto. * linux-sh-low.cc (the_low_target): Ditto. * linux-tic6x-low.cc (the_low_target): Ditto. * linux-tile-low.cc (the_low_target): Ditto. * linux-xtensa-low.cc (the_low_target): Ditto.
Diffstat (limited to 'gdbserver')
-rw-r--r--gdbserver/ChangeLog44
-rw-r--r--gdbserver/linux-aarch64-low.cc9
-rw-r--r--gdbserver/linux-arm-low.cc7
-rw-r--r--gdbserver/linux-bfin-low.cc1
-rw-r--r--gdbserver/linux-crisv32-low.cc1
-rw-r--r--gdbserver/linux-low.cc12
-rw-r--r--gdbserver/linux-low.h6
-rw-r--r--gdbserver/linux-m32r-low.cc1
-rw-r--r--gdbserver/linux-m68k-low.cc1
-rw-r--r--gdbserver/linux-mips-low.cc11
-rw-r--r--gdbserver/linux-ppc-low.cc1
-rw-r--r--gdbserver/linux-s390-low.cc1
-rw-r--r--gdbserver/linux-sh-low.cc1
-rw-r--r--gdbserver/linux-tic6x-low.cc1
-rw-r--r--gdbserver/linux-tile-low.cc1
-rw-r--r--gdbserver/linux-x86-low.cc10
-rw-r--r--gdbserver/linux-xtensa-low.cc1
17 files changed, 82 insertions, 27 deletions
diff --git a/gdbserver/ChangeLog b/gdbserver/ChangeLog
index bb17a062c7..8c5ca79f15 100644
--- a/gdbserver/ChangeLog
+++ b/gdbserver/ChangeLog
@@ -1,5 +1,49 @@
2020-04-02 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
+ Turn the 'prepare_to_resume' linux target op into a method of
+ linux_process_target.
+
+ * linux-low.h (struct linux_target_ops): Remove the op.
+ (class linux_process_target) <low_prepare_to_resume>: Declare.
+ * linux-low.cc (linux_process_target::low_prepare_to_resume):
+ Define.
+
+ Update the callers below:
+
+ (linux_process_target::resume_one_lwp_throw)
+ (linux_process_target::low_prepare_to_resume)
+
+ * linux-x86-low.cc (class x86_target) <low_prepare_to_resume>:
+ Declare.
+ (x86_target::low_prepare_to_resume): Define.
+ (the_low_target): Remove the op field.
+ * linux-aarch64-low.cc (class aarch64_target)
+ <low_prepare_to_resume>: Declare.
+ (aarch64_target::low_prepare_to_resume): Define.
+ (the_low_target): Remove the op field.
+ * linux-arm-low.cc (class arm_target) <low_prepare_to_resume>:
+ Declare.
+ (arm_prepare_to_resume): Turn into...
+ (arm_target::low_prepare_to_resume): ...this.
+ (the_low_target): Remove the op field.
+ * linux-mips-low.cc (class mips_target) <low_prepare_to_resume>:
+ Declare.
+ (mips_linux_prepare_to_resume): Turn into...
+ (mips_target::low_prepare_to_resume): ...this.
+ (the_low_target): Remove the op field.
+ * linux-bfin-low.cc (the_low_target): Remove the op field.
+ * linux-crisv32-low.cc (the_low_target): Ditto.
+ * linux-m32r-low.cc (the_low_target): Ditto.
+ * linux-m68k-low.cc (the_low_target): Ditto.
+ * linux-ppc-low.cc (the_low_target): Ditto.
+ * linux-s390-low.cc (the_low_target): Ditto.
+ * linux-sh-low.cc (the_low_target): Ditto.
+ * linux-tic6x-low.cc (the_low_target): Ditto.
+ * linux-tile-low.cc (the_low_target): Ditto.
+ * linux-xtensa-low.cc (the_low_target): Ditto.
+
+2020-04-02 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
+
Turn the 'new_process', 'delete_process', 'new_thread',
'delete_thread', and 'new_fork' linux target ops into methods
of linux_process_target.
diff --git a/gdbserver/linux-aarch64-low.cc b/gdbserver/linux-aarch64-low.cc
index 3769e81521..a99b97929c 100644
--- a/gdbserver/linux-aarch64-low.cc
+++ b/gdbserver/linux-aarch64-low.cc
@@ -103,6 +103,8 @@ protected:
void low_delete_thread (arch_lwp_info *) override;
void low_new_fork (process_info *parent, process_info *child) override;
+
+ void low_prepare_to_resume (lwp_info *lwp) override;
};
/* The singleton target ops object. */
@@ -123,6 +125,12 @@ aarch64_target::low_cannot_store_register (int regno)
"is not implemented by the target");
}
+void
+aarch64_target::low_prepare_to_resume (lwp_info *lwp)
+{
+ aarch64_linux_prepare_to_resume (lwp);
+}
+
/* Per-process arch-specific data we want to keep. */
struct arch_process_info
@@ -3139,7 +3147,6 @@ aarch64_supports_hardware_single_step (void)
struct linux_target_ops the_low_target =
{
- aarch64_linux_prepare_to_resume,
NULL, /* process_qsupported */
aarch64_supports_tracepoints,
aarch64_get_thread_area,
diff --git a/gdbserver/linux-arm-low.cc b/gdbserver/linux-arm-low.cc
index 8ec5bc156f..f6429f0475 100644
--- a/gdbserver/linux-arm-low.cc
+++ b/gdbserver/linux-arm-low.cc
@@ -109,6 +109,8 @@ protected:
void low_delete_thread (arch_lwp_info *) override;
void low_new_fork (process_info *parent, process_info *child) override;
+
+ void low_prepare_to_resume (lwp_info *lwp) override;
};
/* The singleton target ops object. */
@@ -813,8 +815,8 @@ arm_target::low_new_fork (process_info *parent, process_info *child)
/* Called when resuming a thread.
If the debug regs have changed, update the thread's copies. */
-static void
-arm_prepare_to_resume (struct lwp_info *lwp)
+void
+arm_target::low_prepare_to_resume (lwp_info *lwp)
{
struct thread_info *thread = get_lwp_thread (lwp);
int pid = lwpid_of (thread);
@@ -1115,7 +1117,6 @@ arm_target::get_regs_info ()
}
struct linux_target_ops the_low_target = {
- arm_prepare_to_resume,
NULL, /* process_qsupported */
NULL, /* supports_tracepoints */
NULL, /* get_thread_area */
diff --git a/gdbserver/linux-bfin-low.cc b/gdbserver/linux-bfin-low.cc
index c8e9d33f17..3e3f39a1ba 100644
--- a/gdbserver/linux-bfin-low.cc
+++ b/gdbserver/linux-bfin-low.cc
@@ -171,7 +171,6 @@ bfin_target::get_regs_info ()
}
struct linux_target_ops the_low_target = {
- NULL, /* prepare_to_resume */
NULL, /* process_qsupported */
NULL, /* supports_tracepoints */
NULL, /* get_thread_area */
diff --git a/gdbserver/linux-crisv32-low.cc b/gdbserver/linux-crisv32-low.cc
index e87873e8b2..d262fae9a9 100644
--- a/gdbserver/linux-crisv32-low.cc
+++ b/gdbserver/linux-crisv32-low.cc
@@ -468,7 +468,6 @@ crisv32_target::get_regs_info ()
}
struct linux_target_ops the_low_target = {
- NULL, /* prepare_to_resume */
NULL, /* process_qsupported */
NULL, /* supports_tracepoints */
NULL, /* get_thread_area */
diff --git a/gdbserver/linux-low.cc b/gdbserver/linux-low.cc
index 019b123103..3105db6d01 100644
--- a/gdbserver/linux-low.cc
+++ b/gdbserver/linux-low.cc
@@ -1530,8 +1530,7 @@ linux_process_target::detach_one_lwp (lwp_info *lwp)
regcache_invalidate_thread (thread);
/* Finally, let it resume. */
- if (the_low_target.prepare_to_resume != NULL)
- the_low_target.prepare_to_resume (lwp);
+ low_prepare_to_resume (lwp);
}
catch (const gdb_exception_error &ex)
{
@@ -4322,8 +4321,7 @@ linux_process_target::resume_one_lwp_throw (lwp_info *lwp, int step,
lwpid_of (thread), step ? "step" : "continue", signal,
lwp->stop_expected ? "expected" : "not expected");
- if (the_low_target.prepare_to_resume != NULL)
- the_low_target.prepare_to_resume (lwp);
+ low_prepare_to_resume (lwp);
regcache_invalidate_thread (thread);
errno = 0;
@@ -4355,6 +4353,12 @@ linux_process_target::resume_one_lwp_throw (lwp_info *lwp, int step,
lwp->stop_reason = TARGET_STOPPED_BY_NO_REASON;
}
+void
+linux_process_target::low_prepare_to_resume (lwp_info *lwp)
+{
+ /* Nop. */
+}
+
/* Called when we try to resume a stopped LWP and that errors out. If
the LWP is no longer in ptrace-stopped state (meaning it's zombie,
or about to become), discard the error, clear any pending status
diff --git a/gdbserver/linux-low.h b/gdbserver/linux-low.h
index f111945cf9..49fbc5edce 100644
--- a/gdbserver/linux-low.h
+++ b/gdbserver/linux-low.h
@@ -131,9 +131,6 @@ struct lwp_info;
struct linux_target_ops
{
- /* Hook to call prior to resuming a thread. */
- void (*prepare_to_resume) (struct lwp_info *);
-
/* Hook to support target specific qSupported. */
void (*process_qsupported) (char **, int count);
@@ -720,6 +717,9 @@ protected:
/* Hook to call, if any, when a new fork is attached. */
virtual void low_new_fork (process_info *parent, process_info *child);
+ /* Hook to call prior to resuming a thread. */
+ virtual void low_prepare_to_resume (lwp_info *lwp);
+
/* How many bytes the PC should be decremented after a break. */
virtual int low_decr_pc_after_break ();
};
diff --git a/gdbserver/linux-m32r-low.cc b/gdbserver/linux-m32r-low.cc
index 4d335c70ed..bae0f25e18 100644
--- a/gdbserver/linux-m32r-low.cc
+++ b/gdbserver/linux-m32r-low.cc
@@ -161,7 +161,6 @@ m32r_target::get_regs_info ()
}
struct linux_target_ops the_low_target = {
- NULL, /* prepare_to_resume */
NULL, /* process_qsupported */
NULL, /* supports_tracepoints */
NULL, /* get_thread_area */
diff --git a/gdbserver/linux-m68k-low.cc b/gdbserver/linux-m68k-low.cc
index 2076f0dc8b..cfb0a0ac2b 100644
--- a/gdbserver/linux-m68k-low.cc
+++ b/gdbserver/linux-m68k-low.cc
@@ -265,7 +265,6 @@ m68k_supports_hardware_single_step (void)
}
struct linux_target_ops the_low_target = {
- NULL, /* prepare_to_resume */
NULL, /* process_qsupported */
NULL, /* supports_tracepoints */
NULL, /* get_thread_area */
diff --git a/gdbserver/linux-mips-low.cc b/gdbserver/linux-mips-low.cc
index c77834ebc9..6c3bc1cc5f 100644
--- a/gdbserver/linux-mips-low.cc
+++ b/gdbserver/linux-mips-low.cc
@@ -80,6 +80,8 @@ protected:
void low_delete_thread (arch_lwp_info *) override;
void low_new_fork (process_info *parent, process_info *child) override;
+
+ void low_prepare_to_resume (lwp_info *lwp) override;
};
/* The singleton target ops object. */
@@ -491,12 +493,12 @@ mips_target::low_new_fork (process_info *parent,
child_private->watch_mirror = parent_private->watch_mirror;
}
-/* This is the implementation of linux_target_ops method
- prepare_to_resume. If the watch regs have changed, update the
+/* This is the implementation of linux target ops method
+ low_prepare_to_resume. If the watch regs have changed, update the
thread's copies. */
-static void
-mips_linux_prepare_to_resume (struct lwp_info *lwp)
+void
+mips_target::low_prepare_to_resume (lwp_info *lwp)
{
ptid_t ptid = ptid_of (get_lwp_thread (lwp));
struct process_info *proc = find_process_pid (ptid.pid ());
@@ -996,7 +998,6 @@ mips_target::get_regs_info ()
}
struct linux_target_ops the_low_target = {
- mips_linux_prepare_to_resume
};
/* The linux target ops object. */
diff --git a/gdbserver/linux-ppc-low.cc b/gdbserver/linux-ppc-low.cc
index 4f3a643f18..22fda3306f 100644
--- a/gdbserver/linux-ppc-low.cc
+++ b/gdbserver/linux-ppc-low.cc
@@ -3428,7 +3428,6 @@ ppc_get_ipa_tdesc_idx (void)
}
struct linux_target_ops the_low_target = {
- NULL, /* prepare_to_resume */
NULL, /* process_qsupported */
ppc_supports_tracepoints,
ppc_get_thread_area,
diff --git a/gdbserver/linux-s390-low.cc b/gdbserver/linux-s390-low.cc
index be99c26c58..e46375f59c 100644
--- a/gdbserver/linux-s390-low.cc
+++ b/gdbserver/linux-s390-low.cc
@@ -2845,7 +2845,6 @@ s390_emit_ops (void)
}
struct linux_target_ops the_low_target = {
- NULL, /* prepare_to_resume */
NULL, /* process_qsupported */
s390_supports_tracepoints,
s390_get_thread_area,
diff --git a/gdbserver/linux-sh-low.cc b/gdbserver/linux-sh-low.cc
index 8b69521f10..d2d0f0b095 100644
--- a/gdbserver/linux-sh-low.cc
+++ b/gdbserver/linux-sh-low.cc
@@ -192,7 +192,6 @@ sh_target::low_arch_setup ()
}
struct linux_target_ops the_low_target = {
- NULL, /* prepare_to_resume */
NULL, /* process_qsupported */
NULL, /* supports_tracepoints */
NULL, /* get_thread_area */
diff --git a/gdbserver/linux-tic6x-low.cc b/gdbserver/linux-tic6x-low.cc
index 9f62899eaf..ddb84e7517 100644
--- a/gdbserver/linux-tic6x-low.cc
+++ b/gdbserver/linux-tic6x-low.cc
@@ -423,7 +423,6 @@ tic6x_target::get_regs_info ()
}
struct linux_target_ops the_low_target = {
- NULL, /* prepare_to_resume */
NULL, /* process_qsupported */
NULL, /* supports_tracepoints */
NULL, /* get_thread_area */
diff --git a/gdbserver/linux-tile-low.cc b/gdbserver/linux-tile-low.cc
index 21650c846a..5268f40ccf 100644
--- a/gdbserver/linux-tile-low.cc
+++ b/gdbserver/linux-tile-low.cc
@@ -224,7 +224,6 @@ tile_supports_hardware_single_step (void)
struct linux_target_ops the_low_target =
{
- NULL, /* prepare_to_resume */
NULL, /* process_qsupported */
NULL, /* supports_tracepoints */
NULL, /* get_thread_area */
diff --git a/gdbserver/linux-x86-low.cc b/gdbserver/linux-x86-low.cc
index be68e005f0..f9459dc18c 100644
--- a/gdbserver/linux-x86-low.cc
+++ b/gdbserver/linux-x86-low.cc
@@ -155,6 +155,8 @@ protected:
void low_delete_thread (arch_lwp_info *) override;
void low_new_fork (process_info *parent, process_info *child) override;
+
+ void low_prepare_to_resume (lwp_info *lwp) override;
};
/* The singleton target ops object. */
@@ -763,6 +765,13 @@ x86_target::low_new_fork (process_info *parent, process_info *child)
*child->priv->arch_private = *parent->priv->arch_private;
}
+void
+x86_target::low_prepare_to_resume (lwp_info *lwp)
+{
+ /* This comes from nat/. */
+ x86_linux_prepare_to_resume (lwp);
+}
+
/* See nat/x86-dregs.h. */
struct x86_debug_reg_state *
@@ -2954,7 +2963,6 @@ x86_get_ipa_tdesc_idx (void)
struct linux_target_ops the_low_target =
{
- x86_linux_prepare_to_resume,
x86_linux_process_qsupported,
x86_supports_tracepoints,
x86_get_thread_area,
diff --git a/gdbserver/linux-xtensa-low.cc b/gdbserver/linux-xtensa-low.cc
index dbb87a5997..a58a74b98d 100644
--- a/gdbserver/linux-xtensa-low.cc
+++ b/gdbserver/linux-xtensa-low.cc
@@ -329,7 +329,6 @@ xtensa_target::get_regs_info ()
}
struct linux_target_ops the_low_target = {
- NULL, /* prepare_to_resume */
NULL, /* process_qsupported */
NULL, /* supports_tracepoints */
NULL, /* get_thread_area */