I will never understand why source forge eats nearly all attachments...
Jason Wessel wrote:
> There were several problems with KGDB when no I/O module was
> attached. When no I/O module is attached it should correctly exit
> from the notifier chain. This patch addresses the problem.
>
>
> ------------------------------------------------------------------------
>
> Signed-off-by: Jason Wessel <[EMAIL PROTECTED]>
>
> ---
> arch/i386/kernel/kgdb.c | 71
> ++++++++++++++++++++++++++++------------------
> arch/x86_64/kernel/kgdb.c | 68 ++++++++++++++++++++++++++++----------------
> 2 files changed, 88 insertions(+), 51 deletions(-)
>
> Index: linux-2.6.21-standard/arch/i386/kernel/kgdb.c
> ===================================================================
> --- linux-2.6.21-standard.orig/arch/i386/kernel/kgdb.c
> +++ linux-2.6.21-standard/arch/i386/kernel/kgdb.c
> @@ -303,41 +303,58 @@ int kgdb_arch_handle_exception(int e_vec
> return -1;
> }
>
> -/* Register KGDB with the i386die_chain so that we hook into all of the right
> - * spots. */
> +static inline int single_step_cont(struct pt_regs *regs,
> + struct die_args *args)
> +{
> + /* single step exception from kernel space to user space so
> + * eat the exception and continue the process
> + */
> + printk(KERN_ERR "KGDB: trap/step from kernel to user space,"
> + " resuming...\n");
> + kgdb_arch_handle_exception(args->trapnr, args->signr,
> + args->err, "c", "", regs);
> +
> + return NOTIFY_STOP;
> +}
> +
> static int kgdb_notify(struct notifier_block *self, unsigned long cmd,
> void *ptr)
> {
> struct die_args *args = ptr;
> struct pt_regs *regs = args->regs;
>
> - /* Bad memory access? */
> - if (cmd == DIE_PAGE_FAULT_NO_CONTEXT && atomic_read(&debugger_active)
> - && kgdb_may_fault) {
> - kgdb_fault_longjmp(kgdb_fault_jmp_regs);
> - return NOTIFY_STOP;
> - } else if (cmd == DIE_PAGE_FAULT)
> - /* A normal page fault, ignore. */
> + switch (cmd) {
> + case DIE_NMI:
> + case DIE_NMI_IPI:
> + if (atomic_read(&debugger_active)) {
> + /* KGDB CPU roundup */
> + kgdb_nmihook(raw_smp_processor_id(), regs);
> + return NOTIFY_STOP;
> + }
> return NOTIFY_DONE;
> - else if ((cmd == DIE_NMI || cmd == DIE_NMI_IPI ||
> - cmd == DIE_NMIWATCHDOG) &&
> atomic_read(&debugger_active)) {
> - /* CPU roundup */
> - kgdb_nmihook(raw_smp_processor_id(), regs);
> - return NOTIFY_STOP;
> - } else if (cmd == DIE_DEBUG
> - && atomic_read(&cpu_doing_single_step) ==
> raw_smp_processor_id()
> - && user_mode(regs)) {
> - /* single step exception from kernel space to user space so
> - * eat the exception and continue the process
> - */
> - printk(KERN_ERR "KGDB: trap/step from kernel to user space,
> resuming...\n");
> - kgdb_arch_handle_exception(args->trapnr, args->signr,
> args->err, "c","",regs);
> + case DIE_NMIWATCHDOG:
> + if (atomic_read(&debugger_active)) {
> + /* KGDB CPU roundup */
> + kgdb_nmihook(raw_smp_processor_id(), regs);
> + return NOTIFY_STOP;
> + }
> + /* Enter debugger */
> + break;
> + case DIE_DEBUG:
> + if (atomic_read(&cpu_doing_single_step) ==
> + raw_smp_processor_id() &&
> + user_mode(regs))
> + return single_step_cont(regs, args);
> + /* fall through */
> + default:
> + if (user_mode(regs))
> + return NOTIFY_DONE;
> + }
> +
> + if (kgdb_may_fault) {
> + kgdb_fault_longjmp(kgdb_fault_jmp_regs);
> return NOTIFY_STOP;
> - } else if (cmd == DIE_NMI_IPI || cmd == DIE_NMI || user_mode(regs) ||
> - (cmd == DIE_DEBUG && atomic_read(&debugger_active)))
> - /* Normal watchdog event or userspace debugging, or spurious
> - * debug exception, ignore. */
> - return NOTIFY_DONE;
> + }
>
> if (kgdb_handle_exception(args->trapnr, args->signr,
> args->err, regs))
> Index: linux-2.6.21-standard/arch/x86_64/kernel/kgdb.c
> ===================================================================
> --- linux-2.6.21-standard.orig/arch/x86_64/kernel/kgdb.c
> +++ linux-2.6.21-standard/arch/x86_64/kernel/kgdb.c
> @@ -379,38 +379,58 @@ struct pt_regs *kgdb_shadow_regs(struct
> return NULL;
> }
>
> -/* Register KGDB with the die_chain so that we hook into all of the right
> - * spots. */
> +static inline int single_step_cont(struct pt_regs *regs,
> + struct die_args *args)
> +{
> + /* single step exception from kernel space to user space so
> + * eat the exception and continue the process
> + */
> + printk(KERN_ERR "KGDB: trap/step from kernel to user space,"
> + " resuming...\n");
> + kgdb_arch_handle_exception(args->trapnr, args->signr,
> + args->err, "c", "", regs);
> +
> + return NOTIFY_STOP;
> +}
> +
> static int kgdb_notify(struct notifier_block *self, unsigned long cmd,
> void *ptr)
> {
> struct die_args *args = ptr;
> struct pt_regs *regs = args->regs;
>
> - if (cmd == DIE_PAGE_FAULT_NO_CONTEXT && atomic_read(&debugger_active)
> - && kgdb_may_fault) {
> + switch (cmd) {
> + case DIE_NMI:
> + case DIE_NMI_IPI:
> + if (atomic_read(&debugger_active)) {
> + /* KGDB CPU roundup */
> + kgdb_nmihook(raw_smp_processor_id(), regs);
> + return NOTIFY_STOP;
> + }
> + return NOTIFY_DONE;
> + case DIE_NMIWATCHDOG:
> + if (atomic_read(&debugger_active)) {
> + /* KGDB CPU roundup */
> + kgdb_nmihook(raw_smp_processor_id(), regs);
> + return NOTIFY_STOP;
> + }
> + /* Enter debugger */
> + break;
> + case DIE_DEBUG:
> + if (atomic_read(&cpu_doing_single_step) ==
> + raw_smp_processor_id() &&
> + user_mode(regs))
> + return single_step_cont(regs, args);
> + /* fall through */
> + default:
> + if (user_mode(regs))
> + return NOTIFY_DONE;
> + }
> +
> + if (kgdb_may_fault) {
> kgdb_fault_longjmp(kgdb_fault_jmp_regs);
> return NOTIFY_STOP;
> - /* CPU roundup? */
> - } else if (atomic_read(&debugger_active) && cmd == DIE_NMI_IPI) {
> - kgdb_nmihook(raw_smp_processor_id(), regs);
> - return NOTIFY_STOP;
> - /* See if KGDB is interested. */
> - } else if (cmd == DIE_DEBUG
> - && atomic_read(&cpu_doing_single_step) ==
> raw_smp_processor_id()
> - && user_mode(regs)) {
> - /* single step exception from kernel space to user space so
> - * eat the exception and continue the process
> - */
> - printk(KERN_ERR "KGDB: trap/step from kernel to user space,
> resuming...\n");
> - kgdb_arch_handle_exception(args->trapnr, args->signr,
> args->err, "c","",regs);
> - return NOTIFY_STOP;
> - } else if (cmd == DIE_PAGE_FAULT || user_mode(regs) ||
> - cmd == DIE_NMI_IPI || (cmd == DIE_DEBUG &&
> - atomic_read(&debugger_active)))
> - /* Userpace events, normal watchdog event, or spurious
> - * debug exception. Ignore. */
> - return NOTIFY_DONE;
> + }
>
> if (kgdb_handle_exception(args->trapnr, args->signr,
> args->err, regs))
>
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Kgdb-bugreport mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/kgdb-bugreport