aboutsummaryrefslogtreecommitdiff
path: root/gdb/gdbserver
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@ericsson.com>2017-10-12 16:49:27 -0400
committerSimon Marchi <simon.marchi@ericsson.com>2017-10-12 16:49:27 -0400
commit04ec7890fccfa5ddd9cc92961a4df58957ca181b (patch)
tree5175f2957d311493133797a271d4e171465cef03 /gdb/gdbserver
parent466eeceef409597388dd2b4e8b907cf080bedcf1 (diff)
downloadfsf-binutils-gdb-04ec7890fccfa5ddd9cc92961a4df58957ca181b.zip
fsf-binutils-gdb-04ec7890fccfa5ddd9cc92961a4df58957ca181b.tar.gz
fsf-binutils-gdb-04ec7890fccfa5ddd9cc92961a4df58957ca181b.tar.bz2
linux low: Make the arch code free arch_process_info
For the same reason as the previous patch, we need to make the arch-specific code free the arch_process_info structure it allocates. gdb/gdbserver/ChangeLog: * linux-low.h (struct linux_target_ops) <delete_process>: New field. * linux-low.c (linux_mourn): Call the_low_target.delete_process. * linux-aarch64-low.c (aarch64_linux_delete_process): New. (struct linux_target_ops): Add delete_process callback. * linux-arm-low.c (arm_delete_process): New. (struct linux_target_ops): Add delete_process callback. * linux-bfin-low.c (struct linux_target_ops): Likewise. * linux-crisv32-low.c (struct linux_target_ops): Likewise. * linux-m32r-low.c (struct linux_target_ops): Likewise. * linux-mips-low.c (mips_linux_delete_process): New. (struct linux_target_ops): Add delete_process callback. * linux-ppc-low.c (struct linux_target_ops): Likewise. * linux-s390-low.c (struct linux_target_ops): Likewise. * linux-sh-low.c (struct linux_target_ops): Likewise. * linux-tic6x-low.c (struct linux_target_ops): Likewise. * linux-tile-low.c (struct linux_target_ops): Likewise. * linux-x86-low.c (x86_linux_delete_process): New. (struct linux_target_ops): Add delete_process callback. * linux-xtensa-low.c (struct linux_target_ops): Likewise.
Diffstat (limited to 'gdb/gdbserver')
-rw-r--r--gdb/gdbserver/ChangeLog23
-rw-r--r--gdb/gdbserver/linux-aarch64-low.c11
-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.c5
-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.c10
-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.c9
-rw-r--r--gdb/gdbserver/linux-xtensa-low.c1
16 files changed, 78 insertions, 2 deletions
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
index 1edb849..3902e91 100644
--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -1,5 +1,28 @@
2017-10-12 Simon Marchi <simon.marchi@ericsson.com>
+ * linux-low.h (struct linux_target_ops) <delete_process>: New
+ field.
+ * linux-low.c (linux_mourn): Call the_low_target.delete_process.
+ * linux-aarch64-low.c (aarch64_linux_delete_process): New.
+ (struct linux_target_ops): Add delete_process callback.
+ * linux-arm-low.c (arm_delete_process): New.
+ (struct linux_target_ops): Add delete_process callback.
+ * linux-bfin-low.c (struct linux_target_ops): Likewise.
+ * linux-crisv32-low.c (struct linux_target_ops): Likewise.
+ * linux-m32r-low.c (struct linux_target_ops): Likewise.
+ * linux-mips-low.c (mips_linux_delete_process): New.
+ (struct linux_target_ops): Add delete_process callback.
+ * linux-ppc-low.c (struct linux_target_ops): Likewise.
+ * linux-s390-low.c (struct linux_target_ops): Likewise.
+ * linux-sh-low.c (struct linux_target_ops): Likewise.
+ * linux-tic6x-low.c (struct linux_target_ops): Likewise.
+ * linux-tile-low.c (struct linux_target_ops): Likewise.
+ * linux-x86-low.c (x86_linux_delete_process): New.
+ (struct linux_target_ops): Add delete_process callback.
+ * linux-xtensa-low.c (struct linux_target_ops): Likewise.
+
+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.
diff --git a/gdb/gdbserver/linux-aarch64-low.c b/gdb/gdbserver/linux-aarch64-low.c
index ed6a993..6d5c4e5 100644
--- a/gdb/gdbserver/linux-aarch64-low.c
+++ b/gdb/gdbserver/linux-aarch64-low.c
@@ -429,7 +429,7 @@ aarch64_linux_siginfo_fixup (siginfo_t *native, gdb_byte *inf, int direction)
return 0;
}
-/* Implementation of linux_target_ops method "linux_new_process". */
+/* Implementation of linux_target_ops method "new_process". */
static struct arch_process_info *
aarch64_linux_new_process (void)
@@ -441,6 +441,14 @@ aarch64_linux_new_process (void)
return info;
}
+/* Implementation of linux_target_ops method "delete_process". */
+
+static void
+aarch64_linux_delete_process (struct arch_process_info *info)
+{
+ xfree (info);
+}
+
/* Implementation of linux_target_ops method "linux_new_fork". */
static void
@@ -2990,6 +2998,7 @@ struct linux_target_ops the_low_target =
NULL, /* supply_ptrace_register */
aarch64_linux_siginfo_fixup,
aarch64_linux_new_process,
+ aarch64_linux_delete_process,
aarch64_linux_new_thread,
aarch64_linux_delete_thread,
aarch64_linux_new_fork,
diff --git a/gdb/gdbserver/linux-arm-low.c b/gdb/gdbserver/linux-arm-low.c
index b27c47e..e12e3d2 100644
--- a/gdb/gdbserver/linux-arm-low.c
+++ b/gdb/gdbserver/linux-arm-low.c
@@ -640,6 +640,14 @@ arm_new_process (void)
return info;
}
+/* Called when a process is being deleted. */
+
+static void
+arm_delete_process (struct arch_process_info *info)
+{
+ xfree (info);
+}
+
/* Called when a new thread is detected. */
static void
arm_new_thread (struct lwp_info *lwp)
@@ -1060,6 +1068,7 @@ struct linux_target_ops the_low_target = {
NULL, /* supply_ptrace_register */
NULL, /* siginfo_fixup */
arm_new_process,
+ arm_delete_process,
arm_new_thread,
arm_delete_thread,
arm_new_fork,
diff --git a/gdb/gdbserver/linux-bfin-low.c b/gdb/gdbserver/linux-bfin-low.c
index 175152c..7241946 100644
--- a/gdb/gdbserver/linux-bfin-low.c
+++ b/gdb/gdbserver/linux-bfin-low.c
@@ -135,6 +135,7 @@ struct linux_target_ops the_low_target = {
NULL, /* supply_ptrace_register */
NULL, /* siginfo_fixup */
NULL, /* new_process */
+ NULL, /* delete_process */
NULL, /* new_thread */
NULL, /* delete_thread */
NULL, /* new_fork */
diff --git a/gdb/gdbserver/linux-crisv32-low.c b/gdb/gdbserver/linux-crisv32-low.c
index 7911104..d6081d4 100644
--- a/gdb/gdbserver/linux-crisv32-low.c
+++ b/gdb/gdbserver/linux-crisv32-low.c
@@ -415,6 +415,7 @@ struct linux_target_ops the_low_target = {
NULL, /* supply_ptrace_register */
NULL, /* siginfo_fixup */
NULL, /* new_process */
+ NULL, /* delete_process */
NULL, /* new_thread */
NULL, /* delete_thread */
NULL, /* new_fork */
diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c
index a762b8f..f32c629 100644
--- a/gdb/gdbserver/linux-low.c
+++ b/gdb/gdbserver/linux-low.c
@@ -1687,7 +1687,10 @@ linux_mourn (struct process_info *process)
/* Freeing all private data. */
priv = process->priv;
- free (priv->arch_private);
+ if (the_low_target.delete_process != NULL)
+ the_low_target.delete_process (priv->arch_private);
+ else
+ gdb_assert (priv->arch_private == NULL);
free (priv);
process->priv = NULL;
diff --git a/gdb/gdbserver/linux-low.h b/gdb/gdbserver/linux-low.h
index 9c69dec..eda452f 100644
--- a/gdb/gdbserver/linux-low.h
+++ b/gdb/gdbserver/linux-low.h
@@ -189,6 +189,10 @@ struct linux_target_ops
allocate it here. */
struct arch_process_info * (*new_process) (void);
+ /* Hook to call when a process is being deleted. If extra per-process
+ architecture-specific data is needed, delete it here. */
+ void (*delete_process) (struct arch_process_info *info);
+
/* Hook to call when a new thread is detected.
If extra per-thread architecture-specific data is needed,
allocate it here. */
diff --git a/gdb/gdbserver/linux-m32r-low.c b/gdb/gdbserver/linux-m32r-low.c
index b947fa0..af42ab4 100644
--- a/gdb/gdbserver/linux-m32r-low.c
+++ b/gdb/gdbserver/linux-m32r-low.c
@@ -134,6 +134,7 @@ struct linux_target_ops the_low_target = {
NULL, /* supply_ptrace_register */
NULL, /* siginfo_fixup */
NULL, /* new_process */
+ NULL, /* delete_process */
NULL, /* new_thread */
NULL, /* delete_thread */
NULL, /* new_fork */
diff --git a/gdb/gdbserver/linux-mips-low.c b/gdb/gdbserver/linux-mips-low.c
index ec26c2a..b30fbba 100644
--- a/gdb/gdbserver/linux-mips-low.c
+++ b/gdb/gdbserver/linux-mips-low.c
@@ -327,6 +327,15 @@ mips_linux_new_process (void)
return info;
}
+/* This is the implementation of linux_target_ops method
+ delete_process. */
+
+static void
+mips_linux_delete_process (struct arch_process_info *info)
+{
+ xfree (info);
+}
+
/* This is the implementation of linux_target_ops method new_thread.
Mark the watch registers as changed, so the threads' copies will
be updated. */
@@ -900,6 +909,7 @@ struct linux_target_ops the_low_target = {
NULL,
NULL, /* siginfo_fixup */
mips_linux_new_process,
+ mips_linux_delete_process,
mips_linux_new_thread,
mips_linux_delete_thread,
mips_linux_new_fork,
diff --git a/gdb/gdbserver/linux-ppc-low.c b/gdb/gdbserver/linux-ppc-low.c
index f31a47b..a2c6cc4 100644
--- a/gdb/gdbserver/linux-ppc-low.c
+++ b/gdb/gdbserver/linux-ppc-low.c
@@ -3124,6 +3124,7 @@ struct linux_target_ops the_low_target = {
ppc_supply_ptrace_register,
NULL, /* siginfo_fixup */
NULL, /* new_process */
+ NULL, /* delete_process */
NULL, /* new_thread */
NULL, /* delete_thread */
NULL, /* new_fork */
diff --git a/gdb/gdbserver/linux-s390-low.c b/gdb/gdbserver/linux-s390-low.c
index 1a4c340..0cf75ac 100644
--- a/gdb/gdbserver/linux-s390-low.c
+++ b/gdb/gdbserver/linux-s390-low.c
@@ -2829,6 +2829,7 @@ struct linux_target_ops the_low_target = {
s390_supply_ptrace_register,
NULL, /* siginfo_fixup */
NULL, /* new_process */
+ NULL, /* delete_process */
NULL, /* new_thread */
NULL, /* delete_thread */
NULL, /* new_fork */
diff --git a/gdb/gdbserver/linux-sh-low.c b/gdb/gdbserver/linux-sh-low.c
index 273062f..3c612b3 100644
--- a/gdb/gdbserver/linux-sh-low.c
+++ b/gdb/gdbserver/linux-sh-low.c
@@ -164,6 +164,7 @@ struct linux_target_ops the_low_target = {
NULL, /* supply_ptrace_register */
NULL, /* siginfo_fixup */
NULL, /* new_process */
+ NULL, /* delete_process */
NULL, /* new_thread */
NULL, /* delete_thread */
NULL, /* new_fork */
diff --git a/gdb/gdbserver/linux-tic6x-low.c b/gdb/gdbserver/linux-tic6x-low.c
index 8b2a6f3..7a32f7e 100644
--- a/gdb/gdbserver/linux-tic6x-low.c
+++ b/gdb/gdbserver/linux-tic6x-low.c
@@ -397,6 +397,7 @@ struct linux_target_ops the_low_target = {
NULL, /* supply_ptrace_register */
NULL, /* siginfo_fixup */
NULL, /* new_process */
+ NULL, /* delete_process */
NULL, /* new_thread */
NULL, /* delete_thread */
NULL, /* new_fork */
diff --git a/gdb/gdbserver/linux-tile-low.c b/gdb/gdbserver/linux-tile-low.c
index c5b344b..0069748 100644
--- a/gdb/gdbserver/linux-tile-low.c
+++ b/gdb/gdbserver/linux-tile-low.c
@@ -196,6 +196,7 @@ struct linux_target_ops the_low_target =
NULL, /* supply_ptrace_register */
NULL, /* siginfo_fixup */
NULL, /* new_process */
+ NULL, /* delete_process */
NULL, /* new_thread */
NULL, /* delete_thread */
NULL, /* new_fork */
diff --git a/gdb/gdbserver/linux-x86-low.c b/gdb/gdbserver/linux-x86-low.c
index 9597502..153858c 100644
--- a/gdb/gdbserver/linux-x86-low.c
+++ b/gdb/gdbserver/linux-x86-low.c
@@ -617,6 +617,14 @@ x86_linux_new_process (void)
return info;
}
+/* Called when a process is being deleted. */
+
+static void
+x86_linux_delete_process (struct arch_process_info *info)
+{
+ xfree (info);
+}
+
/* Target routine for linux_new_fork. */
static void
@@ -2866,6 +2874,7 @@ struct linux_target_ops the_low_target =
/* need to fix up i386 siginfo if host is amd64 */
x86_siginfo_fixup,
x86_linux_new_process,
+ x86_linux_delete_process,
x86_linux_new_thread,
x86_linux_delete_thread,
x86_linux_new_fork,
diff --git a/gdb/gdbserver/linux-xtensa-low.c b/gdb/gdbserver/linux-xtensa-low.c
index 5f2566c..beda116 100644
--- a/gdb/gdbserver/linux-xtensa-low.c
+++ b/gdb/gdbserver/linux-xtensa-low.c
@@ -288,6 +288,7 @@ struct linux_target_ops the_low_target = {
NULL, /* supply_ptrace_register */
NULL, /* siginfo_fixup */
NULL, /* new_process */
+ NULL, /* delete_process */
NULL, /* new_thread */
NULL, /* delete_thread */
NULL, /* new_fork */