aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/debug
diff options
context:
space:
mode:
authorJonathan Herman <hermanjl@cs.unc.edu>2013-02-18 11:58:44 -0500
committerJonathan Herman <hermanjl@cs.unc.edu>2013-02-18 11:58:44 -0500
commit44f61e6c269e0a85b6cac608c6ee29d3dbbf21ad (patch)
treed816b63f2e22a62d21c09aeacc01e058c69852a8 /kernel/debug
parent7806057274c493d53a214232d4df6f96aadc7547 (diff)
Clean this commitwip-mc
Diffstat (limited to 'kernel/debug')
-rw-r--r--kernel/debug/debug_core.c31
-rw-r--r--kernel/debug/gdbstub.c2
2 files changed, 31 insertions, 2 deletions
diff --git a/kernel/debug/debug_core.c b/kernel/debug/debug_core.c
index 0d7c08784ef..25c2c64f668 100644
--- a/kernel/debug/debug_core.c
+++ b/kernel/debug/debug_core.c
@@ -465,9 +465,13 @@ static int kgdb_cpu_enter(struct kgdb_state *ks, struct pt_regs *regs,
465 int trace_on = 0; 465 int trace_on = 0;
466 int online_cpus = num_online_cpus(); 466 int online_cpus = num_online_cpus();
467 467
468 //printk(KERN_WARNING "Cpu enter\n");
469
468 kgdb_info[ks->cpu].enter_kgdb++; 470 kgdb_info[ks->cpu].enter_kgdb++;
469 kgdb_info[ks->cpu].exception_state |= exception_state; 471 kgdb_info[ks->cpu].exception_state |= exception_state;
470 472
473
474
471 if (exception_state == DCPU_WANT_MASTER) 475 if (exception_state == DCPU_WANT_MASTER)
472 atomic_inc(&masters_in_kgdb); 476 atomic_inc(&masters_in_kgdb);
473 else 477 else
@@ -477,6 +481,7 @@ static int kgdb_cpu_enter(struct kgdb_state *ks, struct pt_regs *regs,
477 arch_kgdb_ops.disable_hw_break(regs); 481 arch_kgdb_ops.disable_hw_break(regs);
478 482
479acquirelock: 483acquirelock:
484 //printk(KERN_WARNING "acquirelock\n");
480 /* 485 /*
481 * Interrupts will be restored by the 'trap return' code, except when 486 * Interrupts will be restored by the 'trap return' code, except when
482 * single stepping. 487 * single stepping.
@@ -495,6 +500,7 @@ acquirelock:
495 if (exception_level == 1) { 500 if (exception_level == 1) {
496 if (raw_spin_trylock(&dbg_master_lock)) 501 if (raw_spin_trylock(&dbg_master_lock))
497 atomic_xchg(&kgdb_active, cpu); 502 atomic_xchg(&kgdb_active, cpu);
503
498 goto cpu_master_loop; 504 goto cpu_master_loop;
499 } 505 }
500 506
@@ -504,6 +510,7 @@ acquirelock:
504 */ 510 */
505 while (1) { 511 while (1) {
506cpu_loop: 512cpu_loop:
513 //printk(KERN_WARNING "cpu loop\n");
507 if (kgdb_info[cpu].exception_state & DCPU_NEXT_MASTER) { 514 if (kgdb_info[cpu].exception_state & DCPU_NEXT_MASTER) {
508 kgdb_info[cpu].exception_state &= ~DCPU_NEXT_MASTER; 515 kgdb_info[cpu].exception_state &= ~DCPU_NEXT_MASTER;
509 goto cpu_master_loop; 516 goto cpu_master_loop;
@@ -517,6 +524,7 @@ cpu_loop:
517 goto return_normal; 524 goto return_normal;
518 } else { 525 } else {
519return_normal: 526return_normal:
527 //printk(KERN_WARNING "return normal\n");
520 /* Return to normal operation by executing any 528 /* Return to normal operation by executing any
521 * hw breakpoint fixup. 529 * hw breakpoint fixup.
522 */ 530 */
@@ -536,6 +544,8 @@ return_normal:
536 cpu_relax(); 544 cpu_relax();
537 } 545 }
538 546
547 //printk(KERN_WARNING "out of 1\n");
548
539 /* 549 /*
540 * For single stepping, try to only enter on the processor 550 * For single stepping, try to only enter on the processor
541 * that was single stepping. To guard against a deadlock, the 551 * that was single stepping. To guard against a deadlock, the
@@ -555,14 +565,17 @@ return_normal:
555 565
556 if (!kgdb_io_ready(1)) { 566 if (!kgdb_io_ready(1)) {
557 kgdb_info[cpu].ret_state = 1; 567 kgdb_info[cpu].ret_state = 1;
568 //printk(KERN_WARNING "io not ready\n");
558 goto kgdb_restore; /* No I/O connection, resume the system */ 569 goto kgdb_restore; /* No I/O connection, resume the system */
559 } 570 }
560 571
561 /* 572 /*
562 * Don't enter if we have hit a removed breakpoint. 573 * Don't enter if we have hit a removed breakpoint.
563 */ 574 */
564 if (kgdb_skipexception(ks->ex_vector, ks->linux_regs)) 575 if (kgdb_skipexception(ks->ex_vector, ks->linux_regs)) {
576 //printk(KERN_WARNING "skipping\n");
565 goto kgdb_restore; 577 goto kgdb_restore;
578 }
566 579
567 /* Call the I/O driver's pre_exception routine */ 580 /* Call the I/O driver's pre_exception routine */
568 if (dbg_io_ops->pre_exception) 581 if (dbg_io_ops->pre_exception)
@@ -577,8 +590,11 @@ return_normal:
577 590
578#ifdef CONFIG_SMP 591#ifdef CONFIG_SMP
579 /* Signal the other CPUs to enter kgdb_wait() */ 592 /* Signal the other CPUs to enter kgdb_wait() */
580 if ((!kgdb_single_step) && kgdb_do_roundup) 593 if ((!kgdb_single_step) && kgdb_do_roundup) {
594 printk(KERN_WARNING "Rounding up cpus...\n");
581 kgdb_roundup_cpus(flags); 595 kgdb_roundup_cpus(flags);
596 printk(KERN_WARNING "Rounded up\n");
597 }
582#endif 598#endif
583 599
584 /* 600 /*
@@ -587,6 +603,7 @@ return_normal:
587 while (kgdb_do_roundup && (atomic_read(&masters_in_kgdb) + 603 while (kgdb_do_roundup && (atomic_read(&masters_in_kgdb) +
588 atomic_read(&slaves_in_kgdb)) != online_cpus) 604 atomic_read(&slaves_in_kgdb)) != online_cpus)
589 cpu_relax(); 605 cpu_relax();
606 //printk(KERN_WARNING "Waited\n");
590 607
591 /* 608 /*
592 * At this point the primary processor is completely 609 * At this point the primary processor is completely
@@ -602,7 +619,9 @@ return_normal:
602 619
603 while (1) { 620 while (1) {
604cpu_master_loop: 621cpu_master_loop:
622 //printk(KERN_WARNING "master loop\n");
605 if (dbg_kdb_mode) { 623 if (dbg_kdb_mode) {
624 //printk(KERN_WARNING "kdb mode\n");
606 kgdb_connected = 1; 625 kgdb_connected = 1;
607 error = kdb_stub(ks); 626 error = kdb_stub(ks);
608 if (error == -1) 627 if (error == -1)
@@ -636,6 +655,7 @@ cpu_master_loop:
636 } 655 }
637 656
638kgdb_restore: 657kgdb_restore:
658 //printk(KERN_WARNING "restore\n");
639 if (atomic_read(&kgdb_cpu_doing_single_step) != -1) { 659 if (atomic_read(&kgdb_cpu_doing_single_step) != -1) {
640 int sstep_cpu = atomic_read(&kgdb_cpu_doing_single_step); 660 int sstep_cpu = atomic_read(&kgdb_cpu_doing_single_step);
641 if (kgdb_info[sstep_cpu].task) 661 if (kgdb_info[sstep_cpu].task)
@@ -675,6 +695,8 @@ kgdb_handle_exception(int evector, int signo, int ecode, struct pt_regs *regs)
675 struct kgdb_state kgdb_var; 695 struct kgdb_state kgdb_var;
676 struct kgdb_state *ks = &kgdb_var; 696 struct kgdb_state *ks = &kgdb_var;
677 697
698 printk(KERN_WARNING "enter exception thing\n");
699
678 ks->cpu = raw_smp_processor_id(); 700 ks->cpu = raw_smp_processor_id();
679 ks->ex_vector = evector; 701 ks->ex_vector = evector;
680 ks->signo = signo; 702 ks->signo = signo;
@@ -954,11 +976,16 @@ int dbg_io_get_char(void)
954 */ 976 */
955void kgdb_breakpoint(void) 977void kgdb_breakpoint(void)
956{ 978{
979 printk(KERN_WARNING "Doin this\n");
957 atomic_inc(&kgdb_setting_breakpoint); 980 atomic_inc(&kgdb_setting_breakpoint);
981 printk(KERN_WARNING "Doin this1\n");
958 wmb(); /* Sync point before breakpoint */ 982 wmb(); /* Sync point before breakpoint */
983 printk(KERN_WARNING "Doin this2\n");
959 arch_kgdb_breakpoint(); 984 arch_kgdb_breakpoint();
960 wmb(); /* Sync point after breakpoint */ 985 wmb(); /* Sync point after breakpoint */
986 printk(KERN_WARNING "Doin this\n");
961 atomic_dec(&kgdb_setting_breakpoint); 987 atomic_dec(&kgdb_setting_breakpoint);
988 printk(KERN_WARNING "Doin this\n");
962} 989}
963EXPORT_SYMBOL_GPL(kgdb_breakpoint); 990EXPORT_SYMBOL_GPL(kgdb_breakpoint);
964 991
diff --git a/kernel/debug/gdbstub.c b/kernel/debug/gdbstub.c
index 34872482315..e0134e3cc5e 100644
--- a/kernel/debug/gdbstub.c
+++ b/kernel/debug/gdbstub.c
@@ -941,6 +941,8 @@ int gdb_serial_stub(struct kgdb_state *ks)
941 int error = 0; 941 int error = 0;
942 int tmp; 942 int tmp;
943 943
944 printk(KERN_WARNING "Serial stub\n");
945
944 /* Initialize comm buffer and globals. */ 946 /* Initialize comm buffer and globals. */
945 memset(remcom_out_buffer, 0, sizeof(remcom_out_buffer)); 947 memset(remcom_out_buffer, 0, sizeof(remcom_out_buffer));
946 kgdb_usethread = kgdb_info[ks->cpu].task; 948 kgdb_usethread = kgdb_info[ks->cpu].task;