Patchwork [PUSHED/OBV] AArch64: Ensure lwp info is created zeroed

login
register
mail settings
Submitter Alan Hayward
Date Jan. 23, 2019, 11:51 a.m.
Message ID <20190123115124.81878-1-alan.hayward@arm.com>
Download mbox | patch
Permalink /patch/31177/
State New
Headers show

Comments

Alan Hayward - Jan. 23, 2019, 11:51 a.m.
The code to not set empty hardware BPs/WPs on new threads will only work
if the newly allocated struct is empty.

Ensure the structure is created zeroed.

This patch removes the remaining racy behaviour on gdb.threads tests
when run on AArch64 Ubuntu.

gdb/ChangeLog:

	* nat/aarch64-linux.c (aarch64_linux_new_thread): Replace XNEW
	with XCNEW.
---
 gdb/nat/aarch64-linux.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch

diff --git a/gdb/nat/aarch64-linux.c b/gdb/nat/aarch64-linux.c
index 2616c8aef5..f9a95bb282 100644
--- a/gdb/nat/aarch64-linux.c
+++ b/gdb/nat/aarch64-linux.c
@@ -76,7 +76,7 @@  aarch64_linux_new_thread (struct lwp_info *lwp)
   ptid_t ptid = ptid_of_lwp (lwp);
   struct aarch64_debug_reg_state *state
     = aarch64_get_debug_reg_state (ptid.pid ());
-  struct arch_lwp_info *info = XNEW (struct arch_lwp_info);
+  struct arch_lwp_info *info = XCNEW (struct arch_lwp_info);
 
   /* If there are hardware breakpoints/watchpoints in the process then mark that
      all the hardware breakpoint/watchpoint register pairs for this thread need