+2015-06-23  Yao Qi  <yao.qi@linaro.org>
+
+       * amd64-linux-nat.c (amd64_linux_fetch_inferior_registers):
+       Check whether have_ptrace_getregset is TRIBOOL_TRUE explicitly.
+       (amd64_linux_store_inferior_registers): Likewise.
+       * arm-linux-nat.c (fetch_fpregister): Likewise.
+       (fetch_fpregs, store_fpregister): Likewise.
+       (store_fpregister, store_fpregs): Likewise.
+       (fetch_register, fetch_regs): Likewise.
+       (store_register, store_regs): Likewise.
+       (fetch_vfp_regs, store_vfp_regs): Likewise.
+       (arm_linux_read_description): Check have_ptrace_getregset is
+       TRIBOOL_UNKNOWN.  Set have_ptrace_getregset to TRIBOOL_TRUE
+       or TRIBOOL_FALSE.
+       * i386-linux-nat.c (fetch_xstateregs): Check
+       have_ptrace_getregset is not TRIBOOL_TRUE.
+       (store_xstateregs): Likewise.
+       * linux-nat.c (have_ptrace_getregset): Change its type to
+       enum tribool.
+       * linux-nat.h (tribool): New enum.
+       * x86-linux-nat.c (x86_linux_read_description): Use enum tribool.
+       Check whether have_ptrace_getregset is TRIBOOL_TRUE.
+
 2015-06-19  Doug Evans  <dje@google.com>
 
        * NEWS: Mention Sun's version of stabs is no longer supported.
 
   tid = GET_THREAD_ID (inferior_ptid);
 
   /* Read the floating point state.  */
-  if (have_ptrace_getregset)
+  if (have_ptrace_getregset == TRIBOOL_TRUE)
     {
       struct iovec iov;
 
   tid = GET_THREAD_ID (inferior_ptid);
 
   /* Read the floating point state.  */
-  if (have_ptrace_getregset)
+  if (have_ptrace_getregset == TRIBOOL_TRUE)
     {
       struct iovec iov;
 
   tid = GET_THREAD_ID (inferior_ptid);
 
   /* Read the floating point state.  */
-  if (have_ptrace_getregset)
+  if (have_ptrace_getregset == TRIBOOL_TRUE)
     {
       struct iovec iov;
 
   if (regno >= ARM_F0_REGNUM && regno <= ARM_F7_REGNUM)
     collect_nwfpe_register (regcache, regno, fp);
 
-  if (have_ptrace_getregset)
+  if (have_ptrace_getregset == TRIBOOL_TRUE)
     {
       struct iovec iov;
 
   tid = GET_THREAD_ID (inferior_ptid);
 
   /* Read the floating point state.  */
-  if (have_ptrace_getregset)
+  if (have_ptrace_getregset == TRIBOOL_TRUE)
     {
       elf_fpregset_t fpregs;
       struct iovec iov;
     if (REG_VALID == regcache_register_status (regcache, regno))
       collect_nwfpe_register (regcache, regno, fp);
 
-  if (have_ptrace_getregset)
+  if (have_ptrace_getregset == TRIBOOL_TRUE)
     {
       struct iovec iov;
 
   /* Get the thread id for the ptrace call.  */
   tid = GET_THREAD_ID (inferior_ptid);
 
-  if (have_ptrace_getregset)
+  if (have_ptrace_getregset == TRIBOOL_TRUE)
     {
       struct iovec iov;
 
   /* Get the thread id for the ptrace call.  */
   tid = GET_THREAD_ID (inferior_ptid);
 
-  if (have_ptrace_getregset)
+  if (have_ptrace_getregset == TRIBOOL_TRUE)
     {
       struct iovec iov;
 
   tid = GET_THREAD_ID (inferior_ptid);
 
   /* Get the general registers from the process.  */
-  if (have_ptrace_getregset)
+  if (have_ptrace_getregset == TRIBOOL_TRUE)
     {
       struct iovec iov;
 
     regcache_raw_collect (regcache, ARM_PC_REGNUM,
                         (char *) ®s[ARM_PC_REGNUM]);
 
-  if (have_ptrace_getregset)
+  if (have_ptrace_getregset == TRIBOOL_TRUE)
     {
       struct iovec iov;
 
   tid = GET_THREAD_ID (inferior_ptid);
 
   /* Fetch the general registers.  */
-  if (have_ptrace_getregset)
+  if (have_ptrace_getregset == TRIBOOL_TRUE)
     {
       struct iovec iov;
 
     regcache_raw_collect (regcache, ARM_PS_REGNUM,
                         (char *) ®s[ARM_CPSR_GREGNUM]);
 
-  if (have_ptrace_getregset)
+  if (have_ptrace_getregset == TRIBOOL_TRUE)
     {
       struct iovec iov;
 
   /* Get the thread id for the ptrace call.  */
   tid = GET_THREAD_ID (inferior_ptid);
 
-  if (have_ptrace_getregset)
+  if (have_ptrace_getregset == TRIBOOL_TRUE)
     {
       struct iovec iov;
 
   /* Get the thread id for the ptrace call.  */
   tid = GET_THREAD_ID (inferior_ptid);
 
-  if (have_ptrace_getregset)
+  if (have_ptrace_getregset == TRIBOOL_TRUE)
     {
       struct iovec iov;
 
   regcache_raw_collect (regcache, ARM_FPSCR_REGNUM,
                        (char *) regbuf + 32 * 8);
 
-  if (have_ptrace_getregset)
+  if (have_ptrace_getregset == TRIBOOL_TRUE)
     {
       struct iovec iov;
 
 {
   CORE_ADDR arm_hwcap = 0;
 
-  if (have_ptrace_getregset == -1)
+  if (have_ptrace_getregset == TRIBOOL_UNKNOWN)
     {
       elf_gregset_t gpregs;
       struct iovec iov;
 
       /* Check if PTRACE_GETREGSET works.  */
       if (ptrace (PTRACE_GETREGSET, tid, NT_PRSTATUS, &iov) < 0)
-       have_ptrace_getregset = 0;
+       have_ptrace_getregset = TRIBOOL_FALSE;
       else
-       have_ptrace_getregset = 1;
+       have_ptrace_getregset = TRIBOOL_TRUE;
     }
 
   if (target_auxv_search (ops, AT_HWCAP, &arm_hwcap) != 1)
 
       if (ptrace (PTRACE_GETFPXREGS, tid, 0, (int) &fpxregs) < 0)
        {
          have_ptrace_getfpxregs = 0;
-         have_ptrace_getregset = 0;
+         have_ptrace_getregset = TRIBOOL_FALSE;
          return tdesc_i386_mmx_linux;
        }
     }
 #endif
 
-  if (have_ptrace_getregset == -1)
+  if (have_ptrace_getregset == TRIBOOL_UNKNOWN)
     {
       uint64_t xstateregs[(X86_XSTATE_SSE_SIZE / sizeof (uint64_t))];
       struct iovec iov;
       /* Check if PTRACE_GETREGSET works.  */
       if (ptrace (PTRACE_GETREGSET, tid,
                  (unsigned int) NT_X86_XSTATE, &iov) < 0)
-       have_ptrace_getregset = 0;
+       have_ptrace_getregset = TRIBOOL_FALSE;
       else
        {
-         have_ptrace_getregset = 1;
+         have_ptrace_getregset = TRIBOOL_TRUE;
 
          /* Get XCR0 from XSAVE extended state.  */
          xcr0 = xstateregs[(I386_LINUX_XSAVE_XCR0_OFFSET
      PTRACE_GETREGSET is not available then set xcr0_features_bits to
      zero so that the "no-features" descriptions are returned by the
      switches below.  */
-  if (have_ptrace_getregset)
+  if (have_ptrace_getregset == TRIBOOL_TRUE)
     xcr0_features_bits = xcr0 & X86_XSTATE_ALL_MASK;
   else
     xcr0_features_bits = 0;