Skip to contentSkip to conversation

Trap flag handling change in 2.6.10-bk5 broke Kylix debugger

DISCUSSION Chuck Ebbert 2 participants 2 messages Feb 15, 2006

lore
Share & tools
lore
#0 lore raw

In-Reply-To: <[email protected]>

Quoted 18 lines · Paulo Marques

Going even further, a 2.6.10-bk5 kernel without this single change runs the debugger just fine:

Quoted 5 lines
(quoted diff) +0 -1
@@ -718,23 +717,21 @@
             */
            if ((regs->xcs & 3) == 0)
                    goto clear_TF_reenable;
-           if ((tsk->ptrace & (PT_DTRACE|PT_PTRACED)) == PT_DTRACE)

Review line 728

Quoted 10 lines
(quoted diff) +9 -1
-                   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;
+                   if (!tsk->ptrace & PT_DTRACE)
                            ^^^^^^^^^^^^^^^^^^^^^^^^
  Looks like this is always true because that bit was cleared one line above.
Maybe it should be testing PT_DTRACED instead?  And it's missing parens too,
so try:
                        if (!(tsk->ptrace & PT_DTRACED))
Quoted 5 lines
Quoted 5 lines
(quoted diff) +2 -0
+                           goto clear_TF;
+           }
    }
 
    /* Ok, finally something we can handle */
Signature · 2 lines
Chuck
"Equations are the Devil's sentences."  --Stephen Colbert
#1 lore raw
Quoted 11 lines · Chuck Ebbert
Quoted 3 lines · Paulo Marques

Review

Quoted 3 lines
(quoted diff) +3 -0
+                   regs->eflags &= ~TF_MASK;
+                   tsk->ptrace &= ~PT_DTRACE;
+                   if (!tsk->ptrace & PT_DTRACE)
                            ^^^^^^^^^^^^^^^^^^^^^^^^
  Looks like this is always true because that bit was cleared one line above.
Maybe it should be testing PT_DTRACED instead?  And it's missing parens too,
so try:
                        if (!(tsk->ptrace & PT_DTRACED))

Yes, this does look funny :P

However, this is the piece of code that I don't put in in order to make the debugger work, and it doesn't exist on the vanilla 2.6.16-rc kernel anymore.

What I did try to do was to add the:

- if ((tsk->ptrace & (PT_DTRACE|PT_PTRACED)) == PT_DTRACE)
- goto clear_TF;

condition to the 2.6.16-rc kernel, but that didn't work anyway :(

Signature · 4 lines
Paulo Marques - www.grupopie.com

Pointy-Haired Boss: I don't see anything that could stand in our way.
           Dilbert: Sanity? Reality? The laws of physics?