diff options
| author | Glenn Elliott <gelliott@cs.unc.edu> | 2012-03-04 19:47:13 -0500 |
|---|---|---|
| committer | Glenn Elliott <gelliott@cs.unc.edu> | 2012-03-04 19:47:13 -0500 |
| commit | c71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch) | |
| tree | ecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /kernel/debug | |
| parent | ea53c912f8a86a8567697115b6a0d8152beee5c8 (diff) | |
| parent | 6a00f206debf8a5c8899055726ad127dbeeed098 (diff) | |
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts:
litmus/sched_cedf.c
Diffstat (limited to 'kernel/debug')
| -rw-r--r-- | kernel/debug/debug_core.c | 155 | ||||
| -rw-r--r-- | kernel/debug/debug_core.h | 1 | ||||
| -rw-r--r-- | kernel/debug/gdbstub.c | 30 | ||||
| -rw-r--r-- | kernel/debug/kdb/kdb_debugger.c | 3 | ||||
| -rw-r--r-- | kernel/debug/kdb/kdb_io.c | 2 | ||||
| -rw-r--r-- | kernel/debug/kdb/kdb_main.c | 99 | ||||
| -rw-r--r-- | kernel/debug/kdb/kdb_private.h | 48 | ||||
| -rw-r--r-- | kernel/debug/kdb/kdb_support.c | 2 |
8 files changed, 148 insertions, 192 deletions
diff --git a/kernel/debug/debug_core.c b/kernel/debug/debug_core.c index de407c78178d..bad6786dee88 100644 --- a/kernel/debug/debug_core.c +++ b/kernel/debug/debug_core.c | |||
| @@ -47,6 +47,7 @@ | |||
| 47 | #include <linux/pid.h> | 47 | #include <linux/pid.h> |
| 48 | #include <linux/smp.h> | 48 | #include <linux/smp.h> |
| 49 | #include <linux/mm.h> | 49 | #include <linux/mm.h> |
| 50 | #include <linux/rcupdate.h> | ||
| 50 | 51 | ||
| 51 | #include <asm/cacheflush.h> | 52 | #include <asm/cacheflush.h> |
| 52 | #include <asm/byteorder.h> | 53 | #include <asm/byteorder.h> |
| @@ -109,13 +110,15 @@ static struct kgdb_bkpt kgdb_break[KGDB_MAX_BREAKPOINTS] = { | |||
| 109 | */ | 110 | */ |
| 110 | atomic_t kgdb_active = ATOMIC_INIT(-1); | 111 | atomic_t kgdb_active = ATOMIC_INIT(-1); |
| 111 | EXPORT_SYMBOL_GPL(kgdb_active); | 112 | EXPORT_SYMBOL_GPL(kgdb_active); |
| 113 | static DEFINE_RAW_SPINLOCK(dbg_master_lock); | ||
| 114 | static DEFINE_RAW_SPINLOCK(dbg_slave_lock); | ||
| 112 | 115 | ||
| 113 | /* | 116 | /* |
| 114 | * We use NR_CPUs not PERCPU, in case kgdb is used to debug early | 117 | * We use NR_CPUs not PERCPU, in case kgdb is used to debug early |
| 115 | * bootup code (which might not have percpu set up yet): | 118 | * bootup code (which might not have percpu set up yet): |
| 116 | */ | 119 | */ |
| 117 | static atomic_t passive_cpu_wait[NR_CPUS]; | 120 | static atomic_t masters_in_kgdb; |
| 118 | static atomic_t cpu_in_kgdb[NR_CPUS]; | 121 | static atomic_t slaves_in_kgdb; |
| 119 | static atomic_t kgdb_break_tasklet_var; | 122 | static atomic_t kgdb_break_tasklet_var; |
| 120 | atomic_t kgdb_setting_breakpoint; | 123 | atomic_t kgdb_setting_breakpoint; |
| 121 | 124 | ||
| @@ -206,18 +209,6 @@ int __weak kgdb_skipexception(int exception, struct pt_regs *regs) | |||
| 206 | return 0; | 209 | return 0; |
| 207 | } | 210 | } |
| 208 | 211 | ||
| 209 | /** | ||
| 210 | * kgdb_disable_hw_debug - Disable hardware debugging while we in kgdb. | ||
| 211 | * @regs: Current &struct pt_regs. | ||
| 212 | * | ||
| 213 | * This function will be called if the particular architecture must | ||
| 214 | * disable hardware debugging while it is processing gdb packets or | ||
| 215 | * handling exception. | ||
| 216 | */ | ||
| 217 | void __weak kgdb_disable_hw_debug(struct pt_regs *regs) | ||
| 218 | { | ||
| 219 | } | ||
| 220 | |||
| 221 | /* | 212 | /* |
| 222 | * Some architectures need cache flushes when we set/clear a | 213 | * Some architectures need cache flushes when we set/clear a |
| 223 | * breakpoint: | 214 | * breakpoint: |
| @@ -457,26 +448,34 @@ static int kgdb_reenter_check(struct kgdb_state *ks) | |||
| 457 | return 1; | 448 | return 1; |
| 458 | } | 449 | } |
| 459 | 450 | ||
| 460 | static void dbg_cpu_switch(int cpu, int next_cpu) | 451 | static void dbg_touch_watchdogs(void) |
| 461 | { | 452 | { |
| 462 | /* Mark the cpu we are switching away from as a slave when it | 453 | touch_softlockup_watchdog_sync(); |
| 463 | * holds the kgdb_active token. This must be done so that the | 454 | clocksource_touch_watchdog(); |
| 464 | * that all the cpus wait in for the debug core will not enter | 455 | rcu_cpu_stall_reset(); |
| 465 | * again as the master. */ | ||
| 466 | if (cpu == atomic_read(&kgdb_active)) { | ||
| 467 | kgdb_info[cpu].exception_state |= DCPU_IS_SLAVE; | ||
| 468 | kgdb_info[cpu].exception_state &= ~DCPU_WANT_MASTER; | ||
| 469 | } | ||
| 470 | kgdb_info[next_cpu].exception_state |= DCPU_NEXT_MASTER; | ||
| 471 | } | 456 | } |
| 472 | 457 | ||
| 473 | static int kgdb_cpu_enter(struct kgdb_state *ks, struct pt_regs *regs) | 458 | static int kgdb_cpu_enter(struct kgdb_state *ks, struct pt_regs *regs, |
| 459 | int exception_state) | ||
| 474 | { | 460 | { |
| 475 | unsigned long flags; | 461 | unsigned long flags; |
| 476 | int sstep_tries = 100; | 462 | int sstep_tries = 100; |
| 477 | int error; | 463 | int error; |
| 478 | int i, cpu; | 464 | int cpu; |
| 479 | int trace_on = 0; | 465 | int trace_on = 0; |
| 466 | int online_cpus = num_online_cpus(); | ||
| 467 | |||
| 468 | kgdb_info[ks->cpu].enter_kgdb++; | ||
| 469 | kgdb_info[ks->cpu].exception_state |= exception_state; | ||
| 470 | |||
| 471 | if (exception_state == DCPU_WANT_MASTER) | ||
| 472 | atomic_inc(&masters_in_kgdb); | ||
| 473 | else | ||
| 474 | atomic_inc(&slaves_in_kgdb); | ||
| 475 | |||
| 476 | if (arch_kgdb_ops.disable_hw_break) | ||
| 477 | arch_kgdb_ops.disable_hw_break(regs); | ||
| 478 | |||
| 480 | acquirelock: | 479 | acquirelock: |
| 481 | /* | 480 | /* |
| 482 | * Interrupts will be restored by the 'trap return' code, except when | 481 | * Interrupts will be restored by the 'trap return' code, except when |
| @@ -489,14 +488,15 @@ acquirelock: | |||
| 489 | kgdb_info[cpu].task = current; | 488 | kgdb_info[cpu].task = current; |
| 490 | kgdb_info[cpu].ret_state = 0; | 489 | kgdb_info[cpu].ret_state = 0; |
| 491 | kgdb_info[cpu].irq_depth = hardirq_count() >> HARDIRQ_SHIFT; | 490 | kgdb_info[cpu].irq_depth = hardirq_count() >> HARDIRQ_SHIFT; |
| 492 | /* | ||
| 493 | * Make sure the above info reaches the primary CPU before | ||
| 494 | * our cpu_in_kgdb[] flag setting does: | ||
| 495 | */ | ||
| 496 | atomic_inc(&cpu_in_kgdb[cpu]); | ||
| 497 | 491 | ||
| 498 | if (exception_level == 1) | 492 | /* Make sure the above info reaches the primary CPU */ |
| 493 | smp_mb(); | ||
| 494 | |||
| 495 | if (exception_level == 1) { | ||
| 496 | if (raw_spin_trylock(&dbg_master_lock)) | ||
| 497 | atomic_xchg(&kgdb_active, cpu); | ||
| 499 | goto cpu_master_loop; | 498 | goto cpu_master_loop; |
| 499 | } | ||
| 500 | 500 | ||
| 501 | /* | 501 | /* |
| 502 | * CPU will loop if it is a slave or request to become a kgdb | 502 | * CPU will loop if it is a slave or request to become a kgdb |
| @@ -508,10 +508,12 @@ cpu_loop: | |||
| 508 | kgdb_info[cpu].exception_state &= ~DCPU_NEXT_MASTER; | 508 | kgdb_info[cpu].exception_state &= ~DCPU_NEXT_MASTER; |
| 509 | goto cpu_master_loop; | 509 | goto cpu_master_loop; |
| 510 | } else if (kgdb_info[cpu].exception_state & DCPU_WANT_MASTER) { | 510 | } else if (kgdb_info[cpu].exception_state & DCPU_WANT_MASTER) { |
| 511 | if (atomic_cmpxchg(&kgdb_active, -1, cpu) == cpu) | 511 | if (raw_spin_trylock(&dbg_master_lock)) { |
| 512 | atomic_xchg(&kgdb_active, cpu); | ||
| 512 | break; | 513 | break; |
| 514 | } | ||
| 513 | } else if (kgdb_info[cpu].exception_state & DCPU_IS_SLAVE) { | 515 | } else if (kgdb_info[cpu].exception_state & DCPU_IS_SLAVE) { |
| 514 | if (!atomic_read(&passive_cpu_wait[cpu])) | 516 | if (!raw_spin_is_locked(&dbg_slave_lock)) |
| 515 | goto return_normal; | 517 | goto return_normal; |
| 516 | } else { | 518 | } else { |
| 517 | return_normal: | 519 | return_normal: |
| @@ -522,9 +524,12 @@ return_normal: | |||
| 522 | arch_kgdb_ops.correct_hw_break(); | 524 | arch_kgdb_ops.correct_hw_break(); |
| 523 | if (trace_on) | 525 | if (trace_on) |
| 524 | tracing_on(); | 526 | tracing_on(); |
| 525 | atomic_dec(&cpu_in_kgdb[cpu]); | 527 | kgdb_info[cpu].exception_state &= |
| 526 | touch_softlockup_watchdog_sync(); | 528 | ~(DCPU_WANT_MASTER | DCPU_IS_SLAVE); |
| 527 | clocksource_touch_watchdog(); | 529 | kgdb_info[cpu].enter_kgdb--; |
| 530 | smp_mb__before_atomic_dec(); | ||
| 531 | atomic_dec(&slaves_in_kgdb); | ||
| 532 | dbg_touch_watchdogs(); | ||
| 528 | local_irq_restore(flags); | 533 | local_irq_restore(flags); |
| 529 | return 0; | 534 | return 0; |
| 530 | } | 535 | } |
| @@ -533,7 +538,7 @@ return_normal: | |||
| 533 | 538 | ||
| 534 | /* | 539 | /* |
| 535 | * For single stepping, try to only enter on the processor | 540 | * For single stepping, try to only enter on the processor |
| 536 | * that was single stepping. To gaurd against a deadlock, the | 541 | * that was single stepping. To guard against a deadlock, the |
| 537 | * kernel will only try for the value of sstep_tries before | 542 | * kernel will only try for the value of sstep_tries before |
| 538 | * giving up and continuing on. | 543 | * giving up and continuing on. |
| 539 | */ | 544 | */ |
| @@ -541,8 +546,8 @@ return_normal: | |||
| 541 | (kgdb_info[cpu].task && | 546 | (kgdb_info[cpu].task && |
| 542 | kgdb_info[cpu].task->pid != kgdb_sstep_pid) && --sstep_tries) { | 547 | kgdb_info[cpu].task->pid != kgdb_sstep_pid) && --sstep_tries) { |
| 543 | atomic_set(&kgdb_active, -1); | 548 | atomic_set(&kgdb_active, -1); |
| 544 | touch_softlockup_watchdog_sync(); | 549 | raw_spin_unlock(&dbg_master_lock); |
| 545 | clocksource_touch_watchdog(); | 550 | dbg_touch_watchdogs(); |
| 546 | local_irq_restore(flags); | 551 | local_irq_restore(flags); |
| 547 | 552 | ||
| 548 | goto acquirelock; | 553 | goto acquirelock; |
| @@ -563,16 +568,12 @@ return_normal: | |||
| 563 | if (dbg_io_ops->pre_exception) | 568 | if (dbg_io_ops->pre_exception) |
| 564 | dbg_io_ops->pre_exception(); | 569 | dbg_io_ops->pre_exception(); |
| 565 | 570 | ||
| 566 | kgdb_disable_hw_debug(ks->linux_regs); | ||
| 567 | |||
| 568 | /* | 571 | /* |
| 569 | * Get the passive CPU lock which will hold all the non-primary | 572 | * Get the passive CPU lock which will hold all the non-primary |
| 570 | * CPU in a spin state while the debugger is active | 573 | * CPU in a spin state while the debugger is active |
| 571 | */ | 574 | */ |
| 572 | if (!kgdb_single_step) { | 575 | if (!kgdb_single_step) |
| 573 | for (i = 0; i < NR_CPUS; i++) | 576 | raw_spin_lock(&dbg_slave_lock); |
| 574 | atomic_inc(&passive_cpu_wait[i]); | ||
| 575 | } | ||
| 576 | 577 | ||
| 577 | #ifdef CONFIG_SMP | 578 | #ifdef CONFIG_SMP |
| 578 | /* Signal the other CPUs to enter kgdb_wait() */ | 579 | /* Signal the other CPUs to enter kgdb_wait() */ |
| @@ -583,10 +584,9 @@ return_normal: | |||
| 583 | /* | 584 | /* |
| 584 | * Wait for the other CPUs to be notified and be waiting for us: | 585 | * Wait for the other CPUs to be notified and be waiting for us: |
| 585 | */ | 586 | */ |
| 586 | for_each_online_cpu(i) { | 587 | while (kgdb_do_roundup && (atomic_read(&masters_in_kgdb) + |
| 587 | while (kgdb_do_roundup && !atomic_read(&cpu_in_kgdb[i])) | 588 | atomic_read(&slaves_in_kgdb)) != online_cpus) |
| 588 | cpu_relax(); | 589 | cpu_relax(); |
| 589 | } | ||
| 590 | 590 | ||
| 591 | /* | 591 | /* |
| 592 | * At this point the primary processor is completely | 592 | * At this point the primary processor is completely |
| @@ -615,7 +615,8 @@ cpu_master_loop: | |||
| 615 | if (error == DBG_PASS_EVENT) { | 615 | if (error == DBG_PASS_EVENT) { |
| 616 | dbg_kdb_mode = !dbg_kdb_mode; | 616 | dbg_kdb_mode = !dbg_kdb_mode; |
| 617 | } else if (error == DBG_SWITCH_CPU_EVENT) { | 617 | } else if (error == DBG_SWITCH_CPU_EVENT) { |
| 618 | dbg_cpu_switch(cpu, dbg_switch_cpu); | 618 | kgdb_info[dbg_switch_cpu].exception_state |= |
| 619 | DCPU_NEXT_MASTER; | ||
| 619 | goto cpu_loop; | 620 | goto cpu_loop; |
| 620 | } else { | 621 | } else { |
| 621 | kgdb_info[cpu].ret_state = error; | 622 | kgdb_info[cpu].ret_state = error; |
| @@ -627,24 +628,11 @@ cpu_master_loop: | |||
| 627 | if (dbg_io_ops->post_exception) | 628 | if (dbg_io_ops->post_exception) |
| 628 | dbg_io_ops->post_exception(); | 629 | dbg_io_ops->post_exception(); |
| 629 | 630 | ||
| 630 | atomic_dec(&cpu_in_kgdb[ks->cpu]); | ||
| 631 | |||
| 632 | if (!kgdb_single_step) { | 631 | if (!kgdb_single_step) { |
| 633 | for (i = NR_CPUS-1; i >= 0; i--) | 632 | raw_spin_unlock(&dbg_slave_lock); |
| 634 | atomic_dec(&passive_cpu_wait[i]); | 633 | /* Wait till all the CPUs have quit from the debugger. */ |
| 635 | /* | 634 | while (kgdb_do_roundup && atomic_read(&slaves_in_kgdb)) |
| 636 | * Wait till all the CPUs have quit from the debugger, | 635 | cpu_relax(); |
| 637 | * but allow a CPU that hit an exception and is | ||
| 638 | * waiting to become the master to remain in the debug | ||
| 639 | * core. | ||
| 640 | */ | ||
| 641 | for_each_online_cpu(i) { | ||
| 642 | while (kgdb_do_roundup && | ||
| 643 | atomic_read(&cpu_in_kgdb[i]) && | ||
| 644 | !(kgdb_info[i].exception_state & | ||
| 645 | DCPU_WANT_MASTER)) | ||
| 646 | cpu_relax(); | ||
| 647 | } | ||
| 648 | } | 636 | } |
| 649 | 637 | ||
| 650 | kgdb_restore: | 638 | kgdb_restore: |
| @@ -655,12 +643,20 @@ kgdb_restore: | |||
| 655 | else | 643 | else |
| 656 | kgdb_sstep_pid = 0; | 644 | kgdb_sstep_pid = 0; |
| 657 | } | 645 | } |
| 646 | if (arch_kgdb_ops.correct_hw_break) | ||
| 647 | arch_kgdb_ops.correct_hw_break(); | ||
| 658 | if (trace_on) | 648 | if (trace_on) |
| 659 | tracing_on(); | 649 | tracing_on(); |
| 650 | |||
| 651 | kgdb_info[cpu].exception_state &= | ||
| 652 | ~(DCPU_WANT_MASTER | DCPU_IS_SLAVE); | ||
| 653 | kgdb_info[cpu].enter_kgdb--; | ||
| 654 | smp_mb__before_atomic_dec(); | ||
| 655 | atomic_dec(&masters_in_kgdb); | ||
| 660 | /* Free kgdb_active */ | 656 | /* Free kgdb_active */ |
| 661 | atomic_set(&kgdb_active, -1); | 657 | atomic_set(&kgdb_active, -1); |
| 662 | touch_softlockup_watchdog_sync(); | 658 | raw_spin_unlock(&dbg_master_lock); |
| 663 | clocksource_touch_watchdog(); | 659 | dbg_touch_watchdogs(); |
| 664 | local_irq_restore(flags); | 660 | local_irq_restore(flags); |
| 665 | 661 | ||
| 666 | return kgdb_info[cpu].ret_state; | 662 | return kgdb_info[cpu].ret_state; |
| @@ -678,7 +674,6 @@ kgdb_handle_exception(int evector, int signo, int ecode, struct pt_regs *regs) | |||
| 678 | { | 674 | { |
| 679 | struct kgdb_state kgdb_var; | 675 | struct kgdb_state kgdb_var; |
| 680 | struct kgdb_state *ks = &kgdb_var; | 676 | struct kgdb_state *ks = &kgdb_var; |
| 681 | int ret; | ||
| 682 | 677 | ||
| 683 | ks->cpu = raw_smp_processor_id(); | 678 | ks->cpu = raw_smp_processor_id(); |
| 684 | ks->ex_vector = evector; | 679 | ks->ex_vector = evector; |
| @@ -689,11 +684,10 @@ kgdb_handle_exception(int evector, int signo, int ecode, struct pt_regs *regs) | |||
| 689 | 684 | ||
| 690 | if (kgdb_reenter_check(ks)) | 685 | if (kgdb_reenter_check(ks)) |
| 691 | return 0; /* Ouch, double exception ! */ | 686 | return 0; /* Ouch, double exception ! */ |
| 692 | kgdb_info[ks->cpu].exception_state |= DCPU_WANT_MASTER; | 687 | if (kgdb_info[ks->cpu].enter_kgdb != 0) |
| 693 | ret = kgdb_cpu_enter(ks, regs); | 688 | return 0; |
| 694 | kgdb_info[ks->cpu].exception_state &= ~(DCPU_WANT_MASTER | | 689 | |
| 695 | DCPU_IS_SLAVE); | 690 | return kgdb_cpu_enter(ks, regs, DCPU_WANT_MASTER); |
| 696 | return ret; | ||
| 697 | } | 691 | } |
| 698 | 692 | ||
| 699 | int kgdb_nmicallback(int cpu, void *regs) | 693 | int kgdb_nmicallback(int cpu, void *regs) |
| @@ -706,12 +700,9 @@ int kgdb_nmicallback(int cpu, void *regs) | |||
| 706 | ks->cpu = cpu; | 700 | ks->cpu = cpu; |
| 707 | ks->linux_regs = regs; | 701 | ks->linux_regs = regs; |
| 708 | 702 | ||
| 709 | if (!atomic_read(&cpu_in_kgdb[cpu]) && | 703 | if (kgdb_info[ks->cpu].enter_kgdb == 0 && |
| 710 | atomic_read(&kgdb_active) != -1 && | 704 | raw_spin_is_locked(&dbg_master_lock)) { |
| 711 | atomic_read(&kgdb_active) != cpu) { | 705 | kgdb_cpu_enter(ks, regs, DCPU_IS_SLAVE); |
| 712 | kgdb_info[cpu].exception_state |= DCPU_IS_SLAVE; | ||
| 713 | kgdb_cpu_enter(ks, regs); | ||
| 714 | kgdb_info[cpu].exception_state &= ~DCPU_IS_SLAVE; | ||
| 715 | return 0; | 706 | return 0; |
| 716 | } | 707 | } |
| 717 | #endif | 708 | #endif |
diff --git a/kernel/debug/debug_core.h b/kernel/debug/debug_core.h index c5d753d80f67..3494c28a7e7a 100644 --- a/kernel/debug/debug_core.h +++ b/kernel/debug/debug_core.h | |||
| @@ -40,6 +40,7 @@ struct debuggerinfo_struct { | |||
| 40 | int exception_state; | 40 | int exception_state; |
| 41 | int ret_state; | 41 | int ret_state; |
| 42 | int irq_depth; | 42 | int irq_depth; |
| 43 | int enter_kgdb; | ||
| 43 | }; | 44 | }; |
| 44 | 45 | ||
| 45 | extern struct debuggerinfo_struct kgdb_info[]; | 46 | extern struct debuggerinfo_struct kgdb_info[]; |
diff --git a/kernel/debug/gdbstub.c b/kernel/debug/gdbstub.c index 481a7bd2dfe7..a11db956dd62 100644 --- a/kernel/debug/gdbstub.c +++ b/kernel/debug/gdbstub.c | |||
| @@ -1093,3 +1093,33 @@ int gdbstub_state(struct kgdb_state *ks, char *cmd) | |||
| 1093 | put_packet(remcom_out_buffer); | 1093 | put_packet(remcom_out_buffer); |
| 1094 | return 0; | 1094 | return 0; |
| 1095 | } | 1095 | } |
| 1096 | |||
| 1097 | /** | ||
| 1098 | * gdbstub_exit - Send an exit message to GDB | ||
| 1099 | * @status: The exit code to report. | ||
| 1100 | */ | ||
| 1101 | void gdbstub_exit(int status) | ||
| 1102 | { | ||
| 1103 | unsigned char checksum, ch, buffer[3]; | ||
| 1104 | int loop; | ||
| 1105 | |||
| 1106 | buffer[0] = 'W'; | ||
| 1107 | buffer[1] = hex_asc_hi(status); | ||
| 1108 | buffer[2] = hex_asc_lo(status); | ||
| 1109 | |||
| 1110 | dbg_io_ops->write_char('$'); | ||
| 1111 | checksum = 0; | ||
| 1112 | |||
| 1113 | for (loop = 0; loop < 3; loop++) { | ||
| 1114 | ch = buffer[loop]; | ||
| 1115 | checksum += ch; | ||
| 1116 | dbg_io_ops->write_char(ch); | ||
| 1117 | } | ||
| 1118 | |||
| 1119 | dbg_io_ops->write_char('#'); | ||
| 1120 | dbg_io_ops->write_char(hex_asc_hi(checksum)); | ||
| 1121 | dbg_io_ops->write_char(hex_asc_lo(checksum)); | ||
| 1122 | |||
| 1123 | /* make sure the output is flushed, lest the bootloader clobber it */ | ||
| 1124 | dbg_io_ops->flush(); | ||
| 1125 | } | ||
diff --git a/kernel/debug/kdb/kdb_debugger.c b/kernel/debug/kdb/kdb_debugger.c index bf6e8270e957..dd0b1b7dd02c 100644 --- a/kernel/debug/kdb/kdb_debugger.c +++ b/kernel/debug/kdb/kdb_debugger.c | |||
| @@ -86,7 +86,7 @@ int kdb_stub(struct kgdb_state *ks) | |||
| 86 | } | 86 | } |
| 87 | /* Set initial kdb state variables */ | 87 | /* Set initial kdb state variables */ |
| 88 | KDB_STATE_CLEAR(KGDB_TRANS); | 88 | KDB_STATE_CLEAR(KGDB_TRANS); |
| 89 | kdb_initial_cpu = ks->cpu; | 89 | kdb_initial_cpu = atomic_read(&kgdb_active); |
| 90 | kdb_current_task = kgdb_info[ks->cpu].task; | 90 | kdb_current_task = kgdb_info[ks->cpu].task; |
| 91 | kdb_current_regs = kgdb_info[ks->cpu].debuggerinfo; | 91 | kdb_current_regs = kgdb_info[ks->cpu].debuggerinfo; |
| 92 | /* Remove any breakpoints as needed by kdb and clear single step */ | 92 | /* Remove any breakpoints as needed by kdb and clear single step */ |
| @@ -105,7 +105,6 @@ int kdb_stub(struct kgdb_state *ks) | |||
| 105 | ks->pass_exception = 1; | 105 | ks->pass_exception = 1; |
| 106 | KDB_FLAG_SET(CATASTROPHIC); | 106 | KDB_FLAG_SET(CATASTROPHIC); |
| 107 | } | 107 | } |
| 108 | kdb_initial_cpu = ks->cpu; | ||
| 109 | if (KDB_STATE(SSBPT) && reason == KDB_REASON_SSTEP) { | 108 | if (KDB_STATE(SSBPT) && reason == KDB_REASON_SSTEP) { |
| 110 | KDB_STATE_CLEAR(SSBPT); | 109 | KDB_STATE_CLEAR(SSBPT); |
| 111 | KDB_STATE_CLEAR(DOING_SS); | 110 | KDB_STATE_CLEAR(DOING_SS); |
diff --git a/kernel/debug/kdb/kdb_io.c b/kernel/debug/kdb/kdb_io.c index c9b7f4f90bba..96fdaac46a80 100644 --- a/kernel/debug/kdb/kdb_io.c +++ b/kernel/debug/kdb/kdb_io.c | |||
| @@ -823,4 +823,4 @@ int kdb_printf(const char *fmt, ...) | |||
| 823 | 823 | ||
| 824 | return r; | 824 | return r; |
| 825 | } | 825 | } |
| 826 | 826 | EXPORT_SYMBOL_GPL(kdb_printf); | |
diff --git a/kernel/debug/kdb/kdb_main.c b/kernel/debug/kdb/kdb_main.c index caf057a3de0e..be14779bcef6 100644 --- a/kernel/debug/kdb/kdb_main.c +++ b/kernel/debug/kdb/kdb_main.c | |||
| @@ -78,11 +78,11 @@ static unsigned int kdb_continue_catastrophic; | |||
| 78 | static kdbtab_t *kdb_commands; | 78 | static kdbtab_t *kdb_commands; |
| 79 | #define KDB_BASE_CMD_MAX 50 | 79 | #define KDB_BASE_CMD_MAX 50 |
| 80 | static int kdb_max_commands = KDB_BASE_CMD_MAX; | 80 | static int kdb_max_commands = KDB_BASE_CMD_MAX; |
| 81 | static kdbtab_t kdb_base_commands[50]; | 81 | static kdbtab_t kdb_base_commands[KDB_BASE_CMD_MAX]; |
| 82 | #define for_each_kdbcmd(cmd, num) \ | 82 | #define for_each_kdbcmd(cmd, num) \ |
| 83 | for ((cmd) = kdb_base_commands, (num) = 0; \ | 83 | for ((cmd) = kdb_base_commands, (num) = 0; \ |
| 84 | num < kdb_max_commands; \ | 84 | num < kdb_max_commands; \ |
| 85 | num == KDB_BASE_CMD_MAX ? cmd = kdb_commands : cmd++, num++) | 85 | num++, num == KDB_BASE_CMD_MAX ? cmd = kdb_commands : cmd++) |
| 86 | 86 | ||
| 87 | typedef struct _kdbmsg { | 87 | typedef struct _kdbmsg { |
| 88 | int km_diag; /* kdb diagnostic */ | 88 | int km_diag; /* kdb diagnostic */ |
| @@ -441,9 +441,9 @@ static int kdb_check_regs(void) | |||
| 441 | * symbol name, and offset to the caller. | 441 | * symbol name, and offset to the caller. |
| 442 | * | 442 | * |
| 443 | * The argument may consist of a numeric value (decimal or | 443 | * The argument may consist of a numeric value (decimal or |
| 444 | * hexidecimal), a symbol name, a register name (preceeded by the | 444 | * hexidecimal), a symbol name, a register name (preceded by the |
| 445 | * percent sign), an environment variable with a numeric value | 445 | * percent sign), an environment variable with a numeric value |
| 446 | * (preceeded by a dollar sign) or a simple arithmetic expression | 446 | * (preceded by a dollar sign) or a simple arithmetic expression |
| 447 | * consisting of a symbol name, +/-, and a numeric constant value | 447 | * consisting of a symbol name, +/-, and a numeric constant value |
| 448 | * (offset). | 448 | * (offset). |
| 449 | * Parameters: | 449 | * Parameters: |
| @@ -646,7 +646,7 @@ static int kdb_defcmd2(const char *cmdstr, const char *argv0) | |||
| 646 | } | 646 | } |
| 647 | if (!s->usable) | 647 | if (!s->usable) |
| 648 | return KDB_NOTIMP; | 648 | return KDB_NOTIMP; |
| 649 | s->command = kmalloc((s->count + 1) * sizeof(*(s->command)), GFP_KDB); | 649 | s->command = kzalloc((s->count + 1) * sizeof(*(s->command)), GFP_KDB); |
| 650 | if (!s->command) { | 650 | if (!s->command) { |
| 651 | kdb_printf("Could not allocate new kdb_defcmd table for %s\n", | 651 | kdb_printf("Could not allocate new kdb_defcmd table for %s\n", |
| 652 | cmdstr); | 652 | cmdstr); |
| @@ -1127,7 +1127,7 @@ static int kdb_local(kdb_reason_t reason, int error, struct pt_regs *regs, | |||
| 1127 | /* special case below */ | 1127 | /* special case below */ |
| 1128 | } else { | 1128 | } else { |
| 1129 | kdb_printf("\nEntering kdb (current=0x%p, pid %d) ", | 1129 | kdb_printf("\nEntering kdb (current=0x%p, pid %d) ", |
| 1130 | kdb_current, kdb_current->pid); | 1130 | kdb_current, kdb_current ? kdb_current->pid : 0); |
| 1131 | #if defined(CONFIG_SMP) | 1131 | #if defined(CONFIG_SMP) |
| 1132 | kdb_printf("on processor %d ", raw_smp_processor_id()); | 1132 | kdb_printf("on processor %d ", raw_smp_processor_id()); |
| 1133 | #endif | 1133 | #endif |
| @@ -1335,7 +1335,7 @@ void kdb_print_state(const char *text, int value) | |||
| 1335 | * error The hardware-defined error code | 1335 | * error The hardware-defined error code |
| 1336 | * reason2 kdb's current reason code. | 1336 | * reason2 kdb's current reason code. |
| 1337 | * Initially error but can change | 1337 | * Initially error but can change |
| 1338 | * acording to kdb state. | 1338 | * according to kdb state. |
| 1339 | * db_result Result code from break or debug point. | 1339 | * db_result Result code from break or debug point. |
| 1340 | * regs The exception frame at time of fault/breakpoint. | 1340 | * regs The exception frame at time of fault/breakpoint. |
| 1341 | * should always be valid. | 1341 | * should always be valid. |
| @@ -1749,13 +1749,13 @@ static int kdb_go(int argc, const char **argv) | |||
| 1749 | int nextarg; | 1749 | int nextarg; |
| 1750 | long offset; | 1750 | long offset; |
| 1751 | 1751 | ||
| 1752 | if (raw_smp_processor_id() != kdb_initial_cpu) { | ||
| 1753 | kdb_printf("go must execute on the entry cpu, " | ||
| 1754 | "please use \"cpu %d\" and then execute go\n", | ||
| 1755 | kdb_initial_cpu); | ||
| 1756 | return KDB_BADCPUNUM; | ||
| 1757 | } | ||
| 1752 | if (argc == 1) { | 1758 | if (argc == 1) { |
| 1753 | if (raw_smp_processor_id() != kdb_initial_cpu) { | ||
| 1754 | kdb_printf("go <address> must be issued from the " | ||
| 1755 | "initial cpu, do cpu %d first\n", | ||
| 1756 | kdb_initial_cpu); | ||
| 1757 | return KDB_ARGCOUNT; | ||
| 1758 | } | ||
| 1759 | nextarg = 1; | 1759 | nextarg = 1; |
| 1760 | diag = kdbgetaddrarg(argc, argv, &nextarg, | 1760 | diag = kdbgetaddrarg(argc, argv, &nextarg, |
| 1761 | &addr, &offset, NULL); | 1761 | &addr, &offset, NULL); |
| @@ -2361,7 +2361,7 @@ static int kdb_pid(int argc, const char **argv) | |||
| 2361 | */ | 2361 | */ |
| 2362 | static int kdb_ll(int argc, const char **argv) | 2362 | static int kdb_ll(int argc, const char **argv) |
| 2363 | { | 2363 | { |
| 2364 | int diag; | 2364 | int diag = 0; |
| 2365 | unsigned long addr; | 2365 | unsigned long addr; |
| 2366 | long offset = 0; | 2366 | long offset = 0; |
| 2367 | unsigned long va; | 2367 | unsigned long va; |
| @@ -2400,20 +2400,21 @@ static int kdb_ll(int argc, const char **argv) | |||
| 2400 | char buf[80]; | 2400 | char buf[80]; |
| 2401 | 2401 | ||
| 2402 | if (KDB_FLAG(CMD_INTERRUPT)) | 2402 | if (KDB_FLAG(CMD_INTERRUPT)) |
| 2403 | return 0; | 2403 | goto out; |
| 2404 | 2404 | ||
| 2405 | sprintf(buf, "%s " kdb_machreg_fmt "\n", command, va); | 2405 | sprintf(buf, "%s " kdb_machreg_fmt "\n", command, va); |
| 2406 | diag = kdb_parse(buf); | 2406 | diag = kdb_parse(buf); |
| 2407 | if (diag) | 2407 | if (diag) |
| 2408 | return diag; | 2408 | goto out; |
| 2409 | 2409 | ||
| 2410 | addr = va + linkoffset; | 2410 | addr = va + linkoffset; |
| 2411 | if (kdb_getword(&va, addr, sizeof(va))) | 2411 | if (kdb_getword(&va, addr, sizeof(va))) |
| 2412 | return 0; | 2412 | goto out; |
| 2413 | } | 2413 | } |
| 2414 | kfree(command); | ||
| 2415 | 2414 | ||
| 2416 | return 0; | 2415 | out: |
| 2416 | kfree(command); | ||
| 2417 | return diag; | ||
| 2417 | } | 2418 | } |
| 2418 | 2419 | ||
| 2419 | static int kdb_kgdb(int argc, const char **argv) | 2420 | static int kdb_kgdb(int argc, const char **argv) |
| @@ -2603,20 +2604,17 @@ static int kdb_summary(int argc, const char **argv) | |||
| 2603 | */ | 2604 | */ |
| 2604 | static int kdb_per_cpu(int argc, const char **argv) | 2605 | static int kdb_per_cpu(int argc, const char **argv) |
| 2605 | { | 2606 | { |
| 2606 | char buf[256], fmtstr[64]; | 2607 | char fmtstr[64]; |
| 2607 | kdb_symtab_t symtab; | 2608 | int cpu, diag, nextarg = 1; |
| 2608 | cpumask_t suppress = CPU_MASK_NONE; | 2609 | unsigned long addr, symaddr, val, bytesperword = 0, whichcpu = ~0UL; |
| 2609 | int cpu, diag; | ||
| 2610 | unsigned long addr, val, bytesperword = 0, whichcpu = ~0UL; | ||
| 2611 | 2610 | ||
| 2612 | if (argc < 1 || argc > 3) | 2611 | if (argc < 1 || argc > 3) |
| 2613 | return KDB_ARGCOUNT; | 2612 | return KDB_ARGCOUNT; |
| 2614 | 2613 | ||
| 2615 | snprintf(buf, sizeof(buf), "per_cpu__%s", argv[1]); | 2614 | diag = kdbgetaddrarg(argc, argv, &nextarg, &symaddr, NULL, NULL); |
| 2616 | if (!kdbgetsymval(buf, &symtab)) { | 2615 | if (diag) |
| 2617 | kdb_printf("%s is not a per_cpu variable\n", argv[1]); | 2616 | return diag; |
| 2618 | return KDB_BADADDR; | 2617 | |
| 2619 | } | ||
| 2620 | if (argc >= 2) { | 2618 | if (argc >= 2) { |
| 2621 | diag = kdbgetularg(argv[2], &bytesperword); | 2619 | diag = kdbgetularg(argv[2], &bytesperword); |
| 2622 | if (diag) | 2620 | if (diag) |
| @@ -2649,46 +2647,25 @@ static int kdb_per_cpu(int argc, const char **argv) | |||
| 2649 | #define KDB_PCU(cpu) 0 | 2647 | #define KDB_PCU(cpu) 0 |
| 2650 | #endif | 2648 | #endif |
| 2651 | #endif | 2649 | #endif |
| 2652 | |||
| 2653 | for_each_online_cpu(cpu) { | 2650 | for_each_online_cpu(cpu) { |
| 2651 | if (KDB_FLAG(CMD_INTERRUPT)) | ||
| 2652 | return 0; | ||
| 2653 | |||
| 2654 | if (whichcpu != ~0UL && whichcpu != cpu) | 2654 | if (whichcpu != ~0UL && whichcpu != cpu) |
| 2655 | continue; | 2655 | continue; |
| 2656 | addr = symtab.sym_start + KDB_PCU(cpu); | 2656 | addr = symaddr + KDB_PCU(cpu); |
| 2657 | diag = kdb_getword(&val, addr, bytesperword); | 2657 | diag = kdb_getword(&val, addr, bytesperword); |
| 2658 | if (diag) { | 2658 | if (diag) { |
| 2659 | kdb_printf("%5d " kdb_bfd_vma_fmt0 " - unable to " | 2659 | kdb_printf("%5d " kdb_bfd_vma_fmt0 " - unable to " |
| 2660 | "read, diag=%d\n", cpu, addr, diag); | 2660 | "read, diag=%d\n", cpu, addr, diag); |
| 2661 | continue; | 2661 | continue; |
| 2662 | } | 2662 | } |
| 2663 | #ifdef CONFIG_SMP | ||
| 2664 | if (!val) { | ||
| 2665 | cpu_set(cpu, suppress); | ||
| 2666 | continue; | ||
| 2667 | } | ||
| 2668 | #endif /* CONFIG_SMP */ | ||
| 2669 | kdb_printf("%5d ", cpu); | 2663 | kdb_printf("%5d ", cpu); |
| 2670 | kdb_md_line(fmtstr, addr, | 2664 | kdb_md_line(fmtstr, addr, |
| 2671 | bytesperword == KDB_WORD_SIZE, | 2665 | bytesperword == KDB_WORD_SIZE, |
| 2672 | 1, bytesperword, 1, 1, 0); | 2666 | 1, bytesperword, 1, 1, 0); |
| 2673 | } | 2667 | } |
| 2674 | if (cpus_weight(suppress) == 0) | ||
| 2675 | return 0; | ||
| 2676 | kdb_printf("Zero suppressed cpu(s):"); | ||
| 2677 | for (cpu = first_cpu(suppress); cpu < num_possible_cpus(); | ||
| 2678 | cpu = next_cpu(cpu, suppress)) { | ||
| 2679 | kdb_printf(" %d", cpu); | ||
| 2680 | if (cpu == num_possible_cpus() - 1 || | ||
| 2681 | next_cpu(cpu, suppress) != cpu + 1) | ||
| 2682 | continue; | ||
| 2683 | while (cpu < num_possible_cpus() && | ||
| 2684 | next_cpu(cpu, suppress) == cpu + 1) | ||
| 2685 | ++cpu; | ||
| 2686 | kdb_printf("-%d", cpu); | ||
| 2687 | } | ||
| 2688 | kdb_printf("\n"); | ||
| 2689 | |||
| 2690 | #undef KDB_PCU | 2668 | #undef KDB_PCU |
| 2691 | |||
| 2692 | return 0; | 2669 | return 0; |
| 2693 | } | 2670 | } |
| 2694 | 2671 | ||
| @@ -2763,13 +2740,13 @@ int kdb_register_repeat(char *cmd, | |||
| 2763 | } | 2740 | } |
| 2764 | if (kdb_commands) { | 2741 | if (kdb_commands) { |
| 2765 | memcpy(new, kdb_commands, | 2742 | memcpy(new, kdb_commands, |
| 2766 | kdb_max_commands * sizeof(*new)); | 2743 | (kdb_max_commands - KDB_BASE_CMD_MAX) * sizeof(*new)); |
| 2767 | kfree(kdb_commands); | 2744 | kfree(kdb_commands); |
| 2768 | } | 2745 | } |
| 2769 | memset(new + kdb_max_commands, 0, | 2746 | memset(new + kdb_max_commands, 0, |
| 2770 | kdb_command_extend * sizeof(*new)); | 2747 | kdb_command_extend * sizeof(*new)); |
| 2771 | kdb_commands = new; | 2748 | kdb_commands = new; |
| 2772 | kp = kdb_commands + kdb_max_commands; | 2749 | kp = kdb_commands + kdb_max_commands - KDB_BASE_CMD_MAX; |
| 2773 | kdb_max_commands += kdb_command_extend; | 2750 | kdb_max_commands += kdb_command_extend; |
| 2774 | } | 2751 | } |
| 2775 | 2752 | ||
| @@ -2783,6 +2760,8 @@ int kdb_register_repeat(char *cmd, | |||
| 2783 | 2760 | ||
| 2784 | return 0; | 2761 | return 0; |
| 2785 | } | 2762 | } |
| 2763 | EXPORT_SYMBOL_GPL(kdb_register_repeat); | ||
| 2764 | |||
| 2786 | 2765 | ||
| 2787 | /* | 2766 | /* |
| 2788 | * kdb_register - Compatibility register function for commands that do | 2767 | * kdb_register - Compatibility register function for commands that do |
| @@ -2805,6 +2784,7 @@ int kdb_register(char *cmd, | |||
| 2805 | return kdb_register_repeat(cmd, func, usage, help, minlen, | 2784 | return kdb_register_repeat(cmd, func, usage, help, minlen, |
| 2806 | KDB_REPEAT_NONE); | 2785 | KDB_REPEAT_NONE); |
| 2807 | } | 2786 | } |
| 2787 | EXPORT_SYMBOL_GPL(kdb_register); | ||
| 2808 | 2788 | ||
| 2809 | /* | 2789 | /* |
| 2810 | * kdb_unregister - This function is used to unregister a kernel | 2790 | * kdb_unregister - This function is used to unregister a kernel |
| @@ -2823,7 +2803,7 @@ int kdb_unregister(char *cmd) | |||
| 2823 | /* | 2803 | /* |
| 2824 | * find the command. | 2804 | * find the command. |
| 2825 | */ | 2805 | */ |
| 2826 | for (i = 0, kp = kdb_commands; i < kdb_max_commands; i++, kp++) { | 2806 | for_each_kdbcmd(kp, i) { |
| 2827 | if (kp->cmd_name && (strcmp(kp->cmd_name, cmd) == 0)) { | 2807 | if (kp->cmd_name && (strcmp(kp->cmd_name, cmd) == 0)) { |
| 2828 | kp->cmd_name = NULL; | 2808 | kp->cmd_name = NULL; |
| 2829 | return 0; | 2809 | return 0; |
| @@ -2833,6 +2813,7 @@ int kdb_unregister(char *cmd) | |||
| 2833 | /* Couldn't find it. */ | 2813 | /* Couldn't find it. */ |
| 2834 | return 1; | 2814 | return 1; |
| 2835 | } | 2815 | } |
| 2816 | EXPORT_SYMBOL_GPL(kdb_unregister); | ||
| 2836 | 2817 | ||
| 2837 | /* Initialize the kdb command table. */ | 2818 | /* Initialize the kdb command table. */ |
| 2838 | static void __init kdb_inittab(void) | 2819 | static void __init kdb_inittab(void) |
| @@ -2911,7 +2892,7 @@ static void __init kdb_inittab(void) | |||
| 2911 | "Send a signal to a process", 0, KDB_REPEAT_NONE); | 2892 | "Send a signal to a process", 0, KDB_REPEAT_NONE); |
| 2912 | kdb_register_repeat("summary", kdb_summary, "", | 2893 | kdb_register_repeat("summary", kdb_summary, "", |
| 2913 | "Summarize the system", 4, KDB_REPEAT_NONE); | 2894 | "Summarize the system", 4, KDB_REPEAT_NONE); |
| 2914 | kdb_register_repeat("per_cpu", kdb_per_cpu, "", | 2895 | kdb_register_repeat("per_cpu", kdb_per_cpu, "<sym> [<bytes>] [<cpu>]", |
| 2915 | "Display per_cpu variables", 3, KDB_REPEAT_NONE); | 2896 | "Display per_cpu variables", 3, KDB_REPEAT_NONE); |
| 2916 | kdb_register_repeat("grephelp", kdb_grep_help, "", | 2897 | kdb_register_repeat("grephelp", kdb_grep_help, "", |
| 2917 | "Display help on | grep", 0, KDB_REPEAT_NONE); | 2898 | "Display help on | grep", 0, KDB_REPEAT_NONE); |
| @@ -2933,7 +2914,7 @@ static void __init kdb_cmd_init(void) | |||
| 2933 | } | 2914 | } |
| 2934 | } | 2915 | } |
| 2935 | 2916 | ||
| 2936 | /* Intialize kdb_printf, breakpoint tables and kdb state */ | 2917 | /* Initialize kdb_printf, breakpoint tables and kdb state */ |
| 2937 | void __init kdb_init(int lvl) | 2918 | void __init kdb_init(int lvl) |
| 2938 | { | 2919 | { |
| 2939 | static int kdb_init_lvl = KDB_NOT_INITIALIZED; | 2920 | static int kdb_init_lvl = KDB_NOT_INITIALIZED; |
diff --git a/kernel/debug/kdb/kdb_private.h b/kernel/debug/kdb/kdb_private.h index be775f7e81e0..35d69ed1dfb5 100644 --- a/kernel/debug/kdb/kdb_private.h +++ b/kernel/debug/kdb/kdb_private.h | |||
| @@ -15,29 +15,6 @@ | |||
| 15 | #include <linux/kgdb.h> | 15 | #include <linux/kgdb.h> |
| 16 | #include "../debug_core.h" | 16 | #include "../debug_core.h" |
| 17 | 17 | ||
| 18 | /* Kernel Debugger Error codes. Must not overlap with command codes. */ | ||
| 19 | #define KDB_NOTFOUND (-1) | ||
| 20 | #define KDB_ARGCOUNT (-2) | ||
| 21 | #define KDB_BADWIDTH (-3) | ||
| 22 | #define KDB_BADRADIX (-4) | ||
| 23 | #define KDB_NOTENV (-5) | ||
| 24 | #define KDB_NOENVVALUE (-6) | ||
| 25 | #define KDB_NOTIMP (-7) | ||
| 26 | #define KDB_ENVFULL (-8) | ||
| 27 | #define KDB_ENVBUFFULL (-9) | ||
| 28 | #define KDB_TOOMANYBPT (-10) | ||
| 29 | #define KDB_TOOMANYDBREGS (-11) | ||
| 30 | #define KDB_DUPBPT (-12) | ||
| 31 | #define KDB_BPTNOTFOUND (-13) | ||
| 32 | #define KDB_BADMODE (-14) | ||
| 33 | #define KDB_BADINT (-15) | ||
| 34 | #define KDB_INVADDRFMT (-16) | ||
| 35 | #define KDB_BADREG (-17) | ||
| 36 | #define KDB_BADCPUNUM (-18) | ||
| 37 | #define KDB_BADLENGTH (-19) | ||
| 38 | #define KDB_NOBP (-20) | ||
| 39 | #define KDB_BADADDR (-21) | ||
| 40 | |||
| 41 | /* Kernel Debugger Command codes. Must not overlap with error codes. */ | 18 | /* Kernel Debugger Command codes. Must not overlap with error codes. */ |
| 42 | #define KDB_CMD_GO (-1001) | 19 | #define KDB_CMD_GO (-1001) |
| 43 | #define KDB_CMD_CPU (-1002) | 20 | #define KDB_CMD_CPU (-1002) |
| @@ -93,17 +70,6 @@ | |||
| 93 | */ | 70 | */ |
| 94 | #define KDB_MAXBPT 16 | 71 | #define KDB_MAXBPT 16 |
| 95 | 72 | ||
| 96 | /* Maximum number of arguments to a function */ | ||
| 97 | #define KDB_MAXARGS 16 | ||
| 98 | |||
| 99 | typedef enum { | ||
| 100 | KDB_REPEAT_NONE = 0, /* Do not repeat this command */ | ||
| 101 | KDB_REPEAT_NO_ARGS, /* Repeat the command without arguments */ | ||
| 102 | KDB_REPEAT_WITH_ARGS, /* Repeat the command including its arguments */ | ||
| 103 | } kdb_repeat_t; | ||
| 104 | |||
| 105 | typedef int (*kdb_func_t)(int, const char **); | ||
| 106 | |||
| 107 | /* Symbol table format returned by kallsyms. */ | 73 | /* Symbol table format returned by kallsyms. */ |
| 108 | typedef struct __ksymtab { | 74 | typedef struct __ksymtab { |
| 109 | unsigned long value; /* Address of symbol */ | 75 | unsigned long value; /* Address of symbol */ |
| @@ -123,11 +89,6 @@ extern int kallsyms_symbol_next(char *prefix_name, int flag); | |||
| 123 | extern int kallsyms_symbol_complete(char *prefix_name, int max_len); | 89 | extern int kallsyms_symbol_complete(char *prefix_name, int max_len); |
| 124 | 90 | ||
| 125 | /* Exported Symbols for kernel loadable modules to use. */ | 91 | /* Exported Symbols for kernel loadable modules to use. */ |
| 126 | extern int kdb_register(char *, kdb_func_t, char *, char *, short); | ||
| 127 | extern int kdb_register_repeat(char *, kdb_func_t, char *, char *, | ||
| 128 | short, kdb_repeat_t); | ||
| 129 | extern int kdb_unregister(char *); | ||
| 130 | |||
| 131 | extern int kdb_getarea_size(void *, unsigned long, size_t); | 92 | extern int kdb_getarea_size(void *, unsigned long, size_t); |
| 132 | extern int kdb_putarea_size(unsigned long, void *, size_t); | 93 | extern int kdb_putarea_size(unsigned long, void *, size_t); |
| 133 | 94 | ||
| @@ -144,6 +105,7 @@ extern int kdb_getword(unsigned long *, unsigned long, size_t); | |||
| 144 | extern int kdb_putword(unsigned long, unsigned long, size_t); | 105 | extern int kdb_putword(unsigned long, unsigned long, size_t); |
| 145 | 106 | ||
| 146 | extern int kdbgetularg(const char *, unsigned long *); | 107 | extern int kdbgetularg(const char *, unsigned long *); |
| 108 | extern int kdbgetu64arg(const char *, u64 *); | ||
| 147 | extern char *kdbgetenv(const char *); | 109 | extern char *kdbgetenv(const char *); |
| 148 | extern int kdbgetaddrarg(int, const char **, int*, unsigned long *, | 110 | extern int kdbgetaddrarg(int, const char **, int*, unsigned long *, |
| 149 | long *, char **); | 111 | long *, char **); |
| @@ -255,14 +217,6 @@ extern void kdb_ps1(const struct task_struct *p); | |||
| 255 | extern void kdb_print_nameval(const char *name, unsigned long val); | 217 | extern void kdb_print_nameval(const char *name, unsigned long val); |
| 256 | extern void kdb_send_sig_info(struct task_struct *p, struct siginfo *info); | 218 | extern void kdb_send_sig_info(struct task_struct *p, struct siginfo *info); |
| 257 | extern void kdb_meminfo_proc_show(void); | 219 | extern void kdb_meminfo_proc_show(void); |
| 258 | #ifdef CONFIG_KALLSYMS | ||
| 259 | extern const char *kdb_walk_kallsyms(loff_t *pos); | ||
| 260 | #else /* ! CONFIG_KALLSYMS */ | ||
| 261 | static inline const char *kdb_walk_kallsyms(loff_t *pos) | ||
| 262 | { | ||
| 263 | return NULL; | ||
| 264 | } | ||
| 265 | #endif /* ! CONFIG_KALLSYMS */ | ||
| 266 | extern char *kdb_getstr(char *, size_t, char *); | 220 | extern char *kdb_getstr(char *, size_t, char *); |
| 267 | 221 | ||
| 268 | /* Defines for kdb_symbol_print */ | 222 | /* Defines for kdb_symbol_print */ |
diff --git a/kernel/debug/kdb/kdb_support.c b/kernel/debug/kdb/kdb_support.c index 6b2485dcb050..5532dd37aa86 100644 --- a/kernel/debug/kdb/kdb_support.c +++ b/kernel/debug/kdb/kdb_support.c | |||
| @@ -545,7 +545,7 @@ int kdb_putword(unsigned long addr, unsigned long word, size_t size) | |||
| 545 | * Mask for process state. | 545 | * Mask for process state. |
| 546 | * Notes: | 546 | * Notes: |
| 547 | * The mask folds data from several sources into a single long value, so | 547 | * The mask folds data from several sources into a single long value, so |
| 548 | * be carefull not to overlap the bits. TASK_* bits are in the LSB, | 548 | * be careful not to overlap the bits. TASK_* bits are in the LSB, |
| 549 | * special cases like UNRUNNABLE are in the MSB. As of 2.6.10-rc1 there | 549 | * special cases like UNRUNNABLE are in the MSB. As of 2.6.10-rc1 there |
| 550 | * is no overlap between TASK_* and EXIT_* but that may not always be | 550 | * is no overlap between TASK_* and EXIT_* but that may not always be |
| 551 | * true, so EXIT_* bits are shifted left 16 bits before being stored in | 551 | * true, so EXIT_* bits are shifted left 16 bits before being stored in |
