summaryrefslogtreecommitdiff
path: root/gdb/gdbserver
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/gdbserver')
-rw-r--r--gdb/gdbserver/ChangeLog23
-rw-r--r--gdb/gdbserver/linux-aarch64-low.c1
-rw-r--r--gdb/gdbserver/linux-arm-low.c9
-rw-r--r--gdb/gdbserver/linux-bfin-low.c1
-rw-r--r--gdb/gdbserver/linux-crisv32-low.c1
-rw-r--r--gdb/gdbserver/linux-low.c7
-rw-r--r--gdb/gdbserver/linux-low.h4
-rw-r--r--gdb/gdbserver/linux-m32r-low.c1
-rw-r--r--gdb/gdbserver/linux-mips-low.c9
-rw-r--r--gdb/gdbserver/linux-ppc-low.c1
-rw-r--r--gdb/gdbserver/linux-s390-low.c1
-rw-r--r--gdb/gdbserver/linux-sh-low.c1
-rw-r--r--gdb/gdbserver/linux-tic6x-low.c1
-rw-r--r--gdb/gdbserver/linux-tile-low.c1
-rw-r--r--gdb/gdbserver/linux-x86-low.c1
-rw-r--r--gdb/gdbserver/linux-xtensa-low.c1
16 files changed, 62 insertions, 1 deletions
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
index 5bcd717afe7..1edb8495fd5 100644
--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -1,3 +1,26 @@
+2017-10-12 Simon Marchi <simon.marchi@ericsson.com>
+
+ * linux-aarch64-low.c (the_low_target): Add thread delete
+ callback.
+ * linux-arm-low.c (arm_delete_thread): New function.
+ (the_low_target): Add thread delete callback.
+ * linux-bfin-low.c (the_low_target): Likewise.
+ * linux-crisv32-low.c (the_low_target): Likewise.
+ * linux-low.c (delete_lwp): Invoke delete_thread callback if
+ set.
+ * linux-low.h (struct linux_target_ops) <delete_thread>: New
+ field.
+ * linux-m32r-low.c (the_low_target): Add thread delete callback.
+ * linux-mips-low.c (mips_linux_delete_thread): New function.
+ (the_low_target): Add thread delete callback.
+ * linux-ppc-low.c (the_low_target): Likewise.
+ * linux-s390-low.c (the_low_target): Likewise.
+ * linux-sh-low.c (the_low_target): Likewise.
+ * linux-tic6x-low.c (the_low_target): Likewise.
+ * linux-tile-low.c (the_low_target): Likewise.
+ * linux-x86-low.c (the_low_target): Likewise.
+ * linux-xtensa-low.c (the_low_target): Likewise.
+
2017-10-06 Yuanhui Zhang <asmwarrior@gmail.com>
* win32-low.c: Include "common-inferior.h".
diff --git a/gdb/gdbserver/linux-aarch64-low.c b/gdb/gdbserver/linux-aarch64-low.c
index 334310be579..ed6a9931d2e 100644
--- a/gdb/gdbserver/linux-aarch64-low.c
+++ b/gdb/gdbserver/linux-aarch64-low.c
@@ -2991,6 +2991,7 @@ struct linux_target_ops the_low_target =
aarch64_linux_siginfo_fixup,
aarch64_linux_new_process,
aarch64_linux_new_thread,
+ aarch64_linux_delete_thread,
aarch64_linux_new_fork,
aarch64_linux_prepare_to_resume,
NULL, /* process_qsupported */
diff --git a/gdb/gdbserver/linux-arm-low.c b/gdb/gdbserver/linux-arm-low.c
index 5a3f465dee1..b27c47e84c4 100644
--- a/gdb/gdbserver/linux-arm-low.c
+++ b/gdb/gdbserver/linux-arm-low.c
@@ -655,6 +655,14 @@ arm_new_thread (struct lwp_info *lwp)
lwp->arch_private = info;
}
+/* Function to call when a thread is being deleted. */
+
+static void
+arm_delete_thread (struct arch_lwp_info *arch_lwp)
+{
+ xfree (arch_lwp);
+}
+
static void
arm_new_fork (struct process_info *parent, struct process_info *child)
{
@@ -1053,6 +1061,7 @@ struct linux_target_ops the_low_target = {
NULL, /* siginfo_fixup */
arm_new_process,
arm_new_thread,
+ arm_delete_thread,
arm_new_fork,
arm_prepare_to_resume,
NULL, /* process_qsupported */
diff --git a/gdb/gdbserver/linux-bfin-low.c b/gdb/gdbserver/linux-bfin-low.c
index d43b05dd37e..175152c4598 100644
--- a/gdb/gdbserver/linux-bfin-low.c
+++ b/gdb/gdbserver/linux-bfin-low.c
@@ -136,6 +136,7 @@ struct linux_target_ops the_low_target = {
NULL, /* siginfo_fixup */
NULL, /* new_process */
NULL, /* new_thread */
+ NULL, /* delete_thread */
NULL, /* new_fork */
NULL, /* prepare_to_resume */
NULL, /* process_qsupported */
diff --git a/gdb/gdbserver/linux-crisv32-low.c b/gdb/gdbserver/linux-crisv32-low.c
index 5b3888ea364..79111048fae 100644
--- a/gdb/gdbserver/linux-crisv32-low.c
+++ b/gdb/gdbserver/linux-crisv32-low.c
@@ -416,6 +416,7 @@ struct linux_target_ops the_low_target = {
NULL, /* siginfo_fixup */
NULL, /* new_process */
NULL, /* new_thread */
+ NULL, /* delete_thread */
NULL, /* new_fork */
NULL, /* prepare_to_resume */
NULL, /* process_qsupported */
diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c
index 54005c1f1d4..a762b8f0818 100644
--- a/gdb/gdbserver/linux-low.c
+++ b/gdb/gdbserver/linux-low.c
@@ -414,7 +414,12 @@ delete_lwp (struct lwp_info *lwp)
debug_printf ("deleting %ld\n", lwpid_of (thr));
remove_thread (thr);
- free (lwp->arch_private);
+
+ if (the_low_target.delete_thread != NULL)
+ the_low_target.delete_thread (lwp->arch_private);
+ else
+ gdb_assert (lwp->arch_private == NULL);
+
free (lwp);
}
diff --git a/gdb/gdbserver/linux-low.h b/gdb/gdbserver/linux-low.h
index 0ece7bc25bf..9c69dece96d 100644
--- a/gdb/gdbserver/linux-low.h
+++ b/gdb/gdbserver/linux-low.h
@@ -194,6 +194,10 @@ struct linux_target_ops
allocate it here. */
void (*new_thread) (struct lwp_info *);
+ /* Hook to call when a thread is being deleted. If extra per-thread
+ architecture-specific data is needed, delete it here. */
+ void (*delete_thread) (struct arch_lwp_info *);
+
/* Hook to call, if any, when a new fork is attached. */
void (*new_fork) (struct process_info *parent, struct process_info *child);
diff --git a/gdb/gdbserver/linux-m32r-low.c b/gdb/gdbserver/linux-m32r-low.c
index b3ee11ac109..b947fa06585 100644
--- a/gdb/gdbserver/linux-m32r-low.c
+++ b/gdb/gdbserver/linux-m32r-low.c
@@ -135,6 +135,7 @@ struct linux_target_ops the_low_target = {
NULL, /* siginfo_fixup */
NULL, /* new_process */
NULL, /* new_thread */
+ NULL, /* delete_thread */
NULL, /* new_fork */
NULL, /* prepare_to_resume */
NULL, /* process_qsupported */
diff --git a/gdb/gdbserver/linux-mips-low.c b/gdb/gdbserver/linux-mips-low.c
index b4a83b0e21e..ec26c2a8c56 100644
--- a/gdb/gdbserver/linux-mips-low.c
+++ b/gdb/gdbserver/linux-mips-low.c
@@ -341,6 +341,14 @@ mips_linux_new_thread (struct lwp_info *lwp)
lwp->arch_private = info;
}
+/* Function to call when a thread is being deleted. */
+
+static void
+mips_linux_delete_thread (struct arch_lwp_info *arch_lwp)
+{
+ xfree (arch_lwp);
+}
+
/* Create a new mips_watchpoint and add it to the list. */
static void
@@ -893,6 +901,7 @@ struct linux_target_ops the_low_target = {
NULL, /* siginfo_fixup */
mips_linux_new_process,
mips_linux_new_thread,
+ mips_linux_delete_thread,
mips_linux_new_fork,
mips_linux_prepare_to_resume
};
diff --git a/gdb/gdbserver/linux-ppc-low.c b/gdb/gdbserver/linux-ppc-low.c
index 33a9feb12c6..f31a47b5f19 100644
--- a/gdb/gdbserver/linux-ppc-low.c
+++ b/gdb/gdbserver/linux-ppc-low.c
@@ -3125,6 +3125,7 @@ struct linux_target_ops the_low_target = {
NULL, /* siginfo_fixup */
NULL, /* new_process */
NULL, /* new_thread */
+ NULL, /* delete_thread */
NULL, /* new_fork */
NULL, /* prepare_to_resume */
NULL, /* process_qsupported */
diff --git a/gdb/gdbserver/linux-s390-low.c b/gdb/gdbserver/linux-s390-low.c
index d7aa31c319a..1a4c3407fbc 100644
--- a/gdb/gdbserver/linux-s390-low.c
+++ b/gdb/gdbserver/linux-s390-low.c
@@ -2830,6 +2830,7 @@ struct linux_target_ops the_low_target = {
NULL, /* siginfo_fixup */
NULL, /* new_process */
NULL, /* new_thread */
+ NULL, /* delete_thread */
NULL, /* new_fork */
NULL, /* prepare_to_resume */
NULL, /* process_qsupported */
diff --git a/gdb/gdbserver/linux-sh-low.c b/gdb/gdbserver/linux-sh-low.c
index ac084c994fa..273062faa08 100644
--- a/gdb/gdbserver/linux-sh-low.c
+++ b/gdb/gdbserver/linux-sh-low.c
@@ -165,6 +165,7 @@ struct linux_target_ops the_low_target = {
NULL, /* siginfo_fixup */
NULL, /* new_process */
NULL, /* new_thread */
+ NULL, /* delete_thread */
NULL, /* new_fork */
NULL, /* prepare_to_resume */
NULL, /* process_qsupported */
diff --git a/gdb/gdbserver/linux-tic6x-low.c b/gdb/gdbserver/linux-tic6x-low.c
index 8931d699a04..8b2a6f35ca8 100644
--- a/gdb/gdbserver/linux-tic6x-low.c
+++ b/gdb/gdbserver/linux-tic6x-low.c
@@ -398,6 +398,7 @@ struct linux_target_ops the_low_target = {
NULL, /* siginfo_fixup */
NULL, /* new_process */
NULL, /* new_thread */
+ NULL, /* delete_thread */
NULL, /* new_fork */
NULL, /* prepare_to_resume */
NULL, /* process_qsupported */
diff --git a/gdb/gdbserver/linux-tile-low.c b/gdb/gdbserver/linux-tile-low.c
index ee1f1968364..c5b344bd631 100644
--- a/gdb/gdbserver/linux-tile-low.c
+++ b/gdb/gdbserver/linux-tile-low.c
@@ -197,6 +197,7 @@ struct linux_target_ops the_low_target =
NULL, /* siginfo_fixup */
NULL, /* new_process */
NULL, /* new_thread */
+ NULL, /* delete_thread */
NULL, /* new_fork */
NULL, /* prepare_to_resume */
NULL, /* process_qsupported */
diff --git a/gdb/gdbserver/linux-x86-low.c b/gdb/gdbserver/linux-x86-low.c
index 49f6b2d4892..9597502dfca 100644
--- a/gdb/gdbserver/linux-x86-low.c
+++ b/gdb/gdbserver/linux-x86-low.c
@@ -2867,6 +2867,7 @@ struct linux_target_ops the_low_target =
x86_siginfo_fixup,
x86_linux_new_process,
x86_linux_new_thread,
+ x86_linux_delete_thread,
x86_linux_new_fork,
x86_linux_prepare_to_resume,
x86_linux_process_qsupported,
diff --git a/gdb/gdbserver/linux-xtensa-low.c b/gdb/gdbserver/linux-xtensa-low.c
index 214abdc938b..5f2566cc0b0 100644
--- a/gdb/gdbserver/linux-xtensa-low.c
+++ b/gdb/gdbserver/linux-xtensa-low.c
@@ -289,6 +289,7 @@ struct linux_target_ops the_low_target = {
NULL, /* siginfo_fixup */
NULL, /* new_process */
NULL, /* new_thread */
+ NULL, /* delete_thread */
NULL, /* new_fork */
NULL, /* prepare_to_resume */
NULL, /* process_qsupported */