]> nv-tegra.nvidia Code Review - linux-3.10.git/blobdiff - arch/x86_64/kernel/traps.c
[PATCH] x86_64: Some fixes for single step handling
[linux-3.10.git] / arch / x86_64 / kernel / traps.c
index 2707a27b81cd5efa4bf1b2ea5de729b440c05b2b..09e4a6460e74d09b9bc7e5562a0aba1eae57b55b 100644 (file)
@@ -688,8 +688,14 @@ asmlinkage void *do_debug(struct pt_regs * regs, unsigned long error_code)
                 */
                 if ((regs->cs & 3) == 0)
                        goto clear_TF_reenable;
-               if ((tsk->ptrace & (PT_DTRACE|PT_PTRACED)) == PT_DTRACE)
-                       goto clear_TF;
+               /*
+                * Was the TF flag set by a debugger? If so, clear it now,
+                * so that register information is correct.
+                */
+               if (tsk->ptrace & PT_DTRACE) {
+                       regs->eflags &= ~TF_MASK;
+                       tsk->ptrace &= ~PT_DTRACE;
+               }
        }
 
        /* Ok, finally something we can handle */