static int _kdb_bp_remove(kdb_bp_t *bp) { int ret = 1; if (!bp->bp_installed) return ret; if (!bp->bp_type) ret = dbg_remove_sw_break(bp->bp_addr); else ret = arch_kgdb_ops.remove_hw_breakpoint(bp->bp_addr, bp->bph_length, bp->bp_type); if (ret == 0) bp->bp_installed = 0; return ret; }
static int kgdb_reenter_check(struct kgdb_state *ks) { unsigned long addr; if (atomic_read(&kgdb_active) != raw_smp_processor_id()) return 0; /* Panic on recursive debugger calls: */ exception_level++; addr = kgdb_arch_pc(ks->ex_vector, ks->linux_regs); dbg_deactivate_sw_breakpoints(); /* * If the break point removed ok at the place exception * occurred, try to recover and print a warning to the end * user because the user planted a breakpoint in a place that * KGDB needs in order to function. */ if (dbg_remove_sw_break(addr) == 0) { exception_level = 0; kgdb_skipexception(ks->ex_vector, ks->linux_regs); dbg_activate_sw_breakpoints(); printk(KERN_CRIT "KGDB: re-enter error: breakpoint removed %lx\n", addr); WARN_ON_ONCE(1); return 1; } dbg_remove_all_break(); kgdb_skipexception(ks->ex_vector, ks->linux_regs); if (exception_level > 1) { dump_stack(); panic("Recursive entry to debugger"); } printk(KERN_CRIT "KGDB: re-enter exception: ALL breakpoints killed\n"); #ifdef CONFIG_KGDB_KDB /* Allow kdb to debug itself one level */ return 0; #endif dump_stack(); panic("Recursive entry to debugger"); return 1; }