This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[RFC][PATCH 08/15] gdbserver: Move pointer dereference to after assert checks.
- From: henrik dot wallin at windriver dot com
- To: gdb-patches at sourceware dot org
- Date: Wed, 14 Oct 2015 13:14:26 +0200
- Subject: [RFC][PATCH 08/15] gdbserver: Move pointer dereference to after assert checks.
- Authentication-results: sourceware.org; auth=none
- References: <cover dot 1444820235 dot git dot henrik dot wallin at windriver dot com>
- References: <cover dot 1444820235 dot git dot henrik dot wallin at windriver dot com>
From: Henrik Wallin <henrik.wallin@windriver.com>
gdb/gdbserver/ChangeLog:
* linux-arm-low.c (arm_new_thread): Move pointer dereference
to after assert checks.
Signed-off-by: Henrik Wallin <henrik.wallin@windriver.com>
---
gdb/gdbserver/linux-arm-low.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/gdb/gdbserver/linux-arm-low.c b/gdb/gdbserver/linux-arm-low.c
index a277bb6876fb..81d23d953434 100644
--- a/gdb/gdbserver/linux-arm-low.c
+++ b/gdb/gdbserver/linux-arm-low.c
@@ -686,8 +686,8 @@ arm_new_thread (struct lwp_info *lwp)
static void
arm_new_fork (struct process_info *parent, struct process_info *child)
{
- struct arch_process_info *parent_proc_info = parent->priv->arch_private;
- struct arch_process_info *child_proc_info = child->priv->arch_private;
+ struct arch_process_info *parent_proc_info;
+ struct arch_process_info *child_proc_info;
struct lwp_info *child_lwp;
struct arch_lwp_info *child_lwp_info;
int i;
@@ -698,6 +698,9 @@ arm_new_fork (struct process_info *parent, struct process_info *child)
gdb_assert (child->priv != NULL
&& child->priv->arch_private != NULL);
+ parent_proc_info = parent->priv->arch_private;
+ child_proc_info = child->priv->arch_private;
+
/* Linux kernel before 2.6.33 commit
72f674d203cd230426437cdcf7dd6f681dad8b0d
will inherit hardware debug registers from parent
--
2.1.4