Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 196349
b: refs/heads/master
c: 5dd11d5
h: refs/heads/master
i:
  196347: 5b1c0c3
v: v3
  • Loading branch information
Jason Wessel committed May 21, 2010
1 parent 079c27a commit 8676dd2
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ba797b28131b1f1367b662936ea370239d603cff
refs/heads/master: 5dd11d5d47d248850c58292513f0e164ba98b01e
2 changes: 2 additions & 0 deletions trunk/arch/mips/include/asm/kgdb.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ extern int kgdb_early_setup;
extern void *saved_vectors[32];
extern void handle_exception(struct pt_regs *regs);
extern void breakinst(void);
extern int kgdb_ll_trap(int cmd, const char *str,
struct pt_regs *regs, long err, int trap, int sig);

#endif /* __KERNEL__ */

Expand Down
22 changes: 21 additions & 1 deletion trunk/arch/mips/kernel/kgdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ static int kgdb_mips_notify(struct notifier_block *self, unsigned long cmd,
if (atomic_read(&kgdb_active) != -1)
kgdb_nmicallback(smp_processor_id(), regs);

if (kgdb_handle_exception(trap, compute_signal(trap), 0, regs))
if (kgdb_handle_exception(trap, compute_signal(trap), cmd, regs))
return NOTIFY_DONE;

if (atomic_read(&kgdb_setting_breakpoint))
Expand All @@ -217,6 +217,26 @@ static int kgdb_mips_notify(struct notifier_block *self, unsigned long cmd,
return NOTIFY_STOP;
}

#ifdef CONFIG_KGDB_LOW_LEVEL_TRAP
int kgdb_ll_trap(int cmd, const char *str,
struct pt_regs *regs, long err, int trap, int sig)
{
struct die_args args = {
.regs = regs,
.str = str,
.err = err,
.trapnr = trap,
.signr = sig,

};

if (!kgdb_io_module_registered)
return NOTIFY_DONE;

return kgdb_mips_notify(NULL, cmd, &args);
}
#endif /* CONFIG_KGDB_LOW_LEVEL_TRAP */

static struct notifier_block kgdb_notifier = {
.notifier_call = kgdb_mips_notify,
};
Expand Down
13 changes: 13 additions & 0 deletions trunk/arch/mips/kernel/traps.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include <linux/kgdb.h>
#include <linux/kdebug.h>
#include <linux/notifier.h>
#include <linux/kdb.h>

#include <asm/bootinfo.h>
#include <asm/branch.h>
Expand Down Expand Up @@ -185,6 +186,11 @@ void show_stack(struct task_struct *task, unsigned long *sp)
regs.regs[29] = task->thread.reg29;
regs.regs[31] = 0;
regs.cp0_epc = task->thread.reg31;
#ifdef CONFIG_KGDB_KDB
} else if (atomic_read(&kgdb_active) != -1 &&
kdb_current_regs) {
memcpy(&regs, kdb_current_regs, sizeof(regs));
#endif /* CONFIG_KGDB_KDB */
} else {
prepare_frametrace(&regs);
}
Expand Down Expand Up @@ -360,6 +366,8 @@ void __noreturn die(const char * str, struct pt_regs * regs)
unsigned long dvpret = dvpe();
#endif /* CONFIG_MIPS_MT_SMTC */

notify_die(DIE_OOPS, str, (struct pt_regs *)regs, SIGSEGV, 0, 0);

console_verbose();
spin_lock_irq(&die_lock);
bust_spinlocks(1);
Expand Down Expand Up @@ -704,6 +712,11 @@ static void do_trap_or_bp(struct pt_regs *regs, unsigned int code,
siginfo_t info;
char b[40];

#ifdef CONFIG_KGDB_LOW_LEVEL_TRAP
if (kgdb_ll_trap(DIE_TRAP, str, regs, code, 0, 0) == NOTIFY_STOP)
return;
#endif /* CONFIG_KGDB_LOW_LEVEL_TRAP */

if (notify_die(DIE_TRAP, str, regs, code, 0, 0) == NOTIFY_STOP)
return;

Expand Down
2 changes: 1 addition & 1 deletion trunk/lib/Kconfig.kgdb
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ config KGDB_TESTS_BOOT_STRING

config KGDB_LOW_LEVEL_TRAP
bool "KGDB: Allow debugging with traps in notifiers"
depends on X86
depends on X86 || MIPS
default n
help
This will add an extra call back to kgdb for the breakpoint
Expand Down

0 comments on commit 8676dd2

Please sign in to comment.