Skip to content

Commit

Permalink
kgdb: Turn off tracing while in the debugger
Browse files Browse the repository at this point in the history
The kernel debugger should turn off kernel tracing any time the
debugger is active and restore it on resume.

Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
Reviewed-by: Steven Rostedt <rostedt@goodmis.org>
  • Loading branch information
jwessel committed Apr 2, 2010
1 parent ae6bf53 commit 4da75b9
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions kernel/kgdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -1365,6 +1365,7 @@ static int kgdb_cpu_enter(struct kgdb_state *ks, struct pt_regs *regs)
int sstep_tries = 100;
int error = 0;
int i, cpu;
int trace_on = 0;
acquirelock:
/*
* Interrupts will be restored by the 'trap return' code, except when
Expand Down Expand Up @@ -1399,6 +1400,8 @@ static int kgdb_cpu_enter(struct kgdb_state *ks, struct pt_regs *regs)
*/
if (arch_kgdb_ops.correct_hw_break)
arch_kgdb_ops.correct_hw_break();
if (trace_on)
tracing_on();
atomic_dec(&cpu_in_kgdb[cpu]);
touch_softlockup_watchdog_sync();
clocksource_touch_watchdog();
Expand Down Expand Up @@ -1474,6 +1477,9 @@ static int kgdb_cpu_enter(struct kgdb_state *ks, struct pt_regs *regs)
kgdb_single_step = 0;
kgdb_contthread = current;
exception_level = 0;
trace_on = tracing_is_on();
if (trace_on)
tracing_off();

/* Talk to debugger with gdbserial protocol */
error = gdb_serial_stub(ks);
Expand Down Expand Up @@ -1505,6 +1511,8 @@ static int kgdb_cpu_enter(struct kgdb_state *ks, struct pt_regs *regs)
else
kgdb_sstep_pid = 0;
}
if (trace_on)
tracing_on();
/* Free kgdb_active */
atomic_set(&kgdb_active, -1);
touch_softlockup_watchdog_sync();
Expand Down

0 comments on commit 4da75b9

Please sign in to comment.