There is a couple of inconsistencies with calling KGDB driver's pre_exception()
and post_exception() methods:
- the pre_exception() method may be called several times in a row because of
'acquirelock' label preceding its call -- the code can go back to this label
in SMP kernel and therefore netpoll's 'trapping' variable can be incremented
more than once but will only be decremented once upon exit;
- if KGDB hits a disabled breakpoint (can only happen on x86), the code will
jump to 'kgdb_restore' label bypassing a call to the post_exception() method.
Fix this by moving pre_exception() method call below kgdb_skipexception() check.
Align the label and comment style, while at it...
Signed-off-by: Sergei Shtylyov <[EMAIL PROTECTED]>
---
This patch is against linux2_6_21_uprev branch.
Duh, sent with wrong subject, ignore the previous message please... :-<
kernel/kgdb.c | 24 +++++++++++++-----------
1 files changed, 13 insertions(+), 11 deletions(-)
Index: linux-2.6/kernel/kgdb.c
===================================================================
--- linux-2.6.orig/kernel/kgdb.c
+++ linux-2.6/kernel/kgdb.c
@@ -825,13 +825,7 @@ int kgdb_handle_exception(int ex_vector,
if (atomic_read(&debugger_active) == smp_processor_id() + 1)
return 0;
- acquirelock:
-
- /* Call the I/O drivers pre_exception routine if the I/O
- * driver defined one
- */
- if (kgdb_io_ops.pre_exception)
- kgdb_io_ops.pre_exception();
+ acquirelock:
/*
* Interrupts will be restored by the 'trap return' code, except when
@@ -872,6 +866,13 @@ int kgdb_handle_exception(int ex_vector,
if (kgdb_skipexception(ex_vector, linux_regs))
goto kgdb_restore;
+ /*
+ * Call the I/O drivers pre_exception routine
+ * if the I/O driver defined one
+ */
+ if (kgdb_io_ops.pre_exception)
+ kgdb_io_ops.pre_exception();
+
kgdb_info[processor].debuggerinfo = linux_regs;
kgdb_info[processor].task = current;
@@ -1317,9 +1318,10 @@ int kgdb_handle_exception(int ex_vector,
put_packet(remcom_out_buffer);
}
- kgdb_exit:
- /* Call the I/O driver's post_exception routine if the I/O
- * driver defined one.
+ kgdb_exit:
+ /*
+ * Call the I/O driver's post_exception routine
+ * if the I/O driver defined one.
*/
if (kgdb_io_ops.post_exception)
kgdb_io_ops.post_exception();
@@ -1357,7 +1359,7 @@ int kgdb_handle_exception(int ex_vector,
if (debugger_step)
mdelay(2);
#endif
-kgdb_restore:
+ kgdb_restore:
/* Free debugger_active */
atomic_set(&debugger_active, 0);
local_irq_restore(flags);
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Kgdb-bugreport mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/kgdb-bugreport