AArch64: Ensure lwp info is created zeroed
authorAlan Hayward <alan.hayward@arm.com>
Wed, 23 Jan 2019 11:31:40 +0000 (11:31 +0000)
committerAlan Hayward <alan.hayward@arm.com>
Wed, 23 Jan 2019 11:51:34 +0000 (11:51 +0000)
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/ChangeLog
gdb/nat/aarch64-linux.c

index 36a97bdf04be92df23cf698a0a9c5defe82e64c8..f342acd8fb81412ba861c9ab887babee565f8398 100644 (file)
@@ -1,3 +1,8 @@
+2019-01-23  Alan Hayward  <alan.hayward@arm.com>
+
+       * nat/aarch64-linux.c (aarch64_linux_new_thread): Replace XNEW
+       with XCNEW.
+
 2019-01-22  Tom Tromey  <tom@tromey.com>
 
        * corelow.c: Do not include sys/file.h.
index 2616c8aef58ea0c8fc6f27a925fe4bb96c9faa23..f9a95bb2824b3adc7b2e9eae819c892c58edf0a8 100644 (file)
@@ -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