SEGV/SIGILL on breakpoints

From: Andre Johansen (andrej@funcom.com)
Date: Tue Apr 18 2000 - 11:24:47 EST


When debugging with TotalView on Linux/x86, kernel 2.2.12-20smp from
Red Hat Linux v6.1, I sometimes get illegal instruction or
segmentation violation when hitting a breakpoint.

This is from a document coming with TotalView:

[...]
 * If you are using a 2.2 series kernel (at least up through
   2.2.14), triggering a watchpoint causes the process to
   execute a SEGV or an illegal instruction.

   This is a kernel bug--the kernel is not correctly saving the
   value of the debug status register. TotalView uses this
   register to determine that a data breakpoint has occurred.

   You can correct this problem by altering and recompiling the
   2.2.13 kernel. Here is the diff showing the change you must
   make:

    --- traps.c.orig Thu Dec 9 21:39:40 1999
    +++ traps.c Thu Dec 9 21:49:13 1999
    @@ -354,10 +354,11 @@
            unsigned int condition;
            struct task_struct *tsk = current;

    + __asm__ __volatile__("movl %%db6,%0" : "=r" (condition));
    + tsk->tss.debugreg[6] = condition;
    +
            if (regs->eflags & VM_MASK)
                    goto debug_vm86;
    -
    - __asm__ __volatile__("movl %%db6,%0" : "=r" (condition));

            /* Mask out spurious TF errors due to lazy TF clearing */
            if (condition & DR_STEP) {
[...]

I haven't tested the patch yet, as I only have TotalView running on a
production system.
Any comments? Is the patch (and diagnose) correct?

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sun Apr 23 2000 - 21:00:13 EST