kgdb: fix several kgdb regressions

kgdb core fixes:
- Check to see that mm->mmap_cache is not null before calling
  flush_cache_range(), else on arch=ARM it will cause a fatal
  fault.

- Breakpoints should only be restored if they are in the BP_ACTIVE
  state.

- Fix a typo in comments to "kgdb_register_io_module"

x86 kgdb fixes:
- Fix the x86 arch handler such that on a kill or detach that the
  appropriate cleanup on the single stepping flags gets run.

- Add in the DIE_NMIWATCHDOG call for x86_64

- Touch the nmi watchdog before returning the system to normal
  operation after performing any kind of kgdb operation, else
  the possibility exists to trigger the watchdog.

Signed-off-by: Jason Wessel <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
This commit is contained in:
Jason Wessel 2008-03-07 16:34:16 -06:00 • committed by Ingo Molnar
commit 737a460f21
3 changed files with 18 additions and 7 deletions

View file

@ -600,7 +600,7 @@ static void kgdb_flush_swbreak_addr(unsigned long addr)
if (!CACHE_FLUSH_IS_SAFE)
return;
if (current->mm) {
if (current->mm && current->mm->mmap_cache) {
flush_cache_range(current->mm->mmap_cache,
addr, addr + BREAK_INSTR_SIZE);
} else {
@ -729,14 +729,16 @@ int remove_all_break(void)
/* Clear memory breakpoints. */
for (i = 0; i < KGDB_MAX_BREAKPOINTS; i++) {
if (kgdb_break[i].state != BP_SET)
continue;
if (kgdb_break[i].state != BP_ACTIVE)
goto setundefined;
addr = kgdb_break[i].bpt_addr;
error = kgdb_arch_remove_breakpoint(addr,
kgdb_break[i].saved_instr);
if (error)
return error;
kgdb_break[i].state = BP_REMOVED;
printk(KERN_ERR "KGDB: breakpoint remove failed: %lx\n",
addr);
setundefined:
kgdb_break[i].state = BP_UNDEFINED;
}
/* Clear hardware breakpoints. */
@ -1605,7 +1607,7 @@ static void kgdb_initial_breakpoint(void)
}
/**
* kkgdb_register_io_module - register KGDB IO module
* kgdb_register_io_module - register KGDB IO module
* @new_kgdb_io_ops: the io ops vector
*
* Register it with the KGDB core.