Function report |
Source Code:kernel\debug\debug_core.c |
Create Date:2022-07-28 11:37:55 |
| Last Modify:2020-03-17 19:04:10 | Copyright©Brick |
| home page | Tree |
| Annotation kernel can get tool activity | Download SCCT | Chinese |
Name:kgdb_cpu_enter
Proto:static int kgdb_cpu_enter(struct kgdb_state *ks, struct pt_regs *regs, int exception_state)
Type:int
Parameter:
| Type | Parameter | Name |
|---|---|---|
| struct kgdb_state * | ks | |
| struct pt_regs * | regs | |
| int | exception_state |
| 560 | sstep_tries = 100 |
| 563 | trace_on = 0 |
| 564 | online_cpus = num_online_cpus() |
| 567 | enter_kgdb++ |
| 568 | exception_state |= exception_state |
| 570 | If exception_state == Waiting to become a master kgdb cpu Then atomic_inc( & We use NR_CPUs not PERCPU, in case kgdb is used to debug early* bootup code (which might not have percpu set up yet):) |
| 572 | Else atomic_inc( & slaves_in_kgdb) |
| 575 | If disable_hw_break Then disable_hw_break(regs) |
| 578 | acquirelock : |
| 583 | local_irq_save(flags) |
| 586 | debuggerinfo = regs |
| 587 | task = current process |
| 588 | ret_state = 0 |
| 589 | irq_depth = hardirq_count() >> HARDIRQ_SHIFT |
| 592 | smp_mb() |
| 594 | If Guard for recursive entry == 1 Then |
| 597 | Go to cpu_master_loop |
| 604 | When 1 cycle |
| 605 | cpu_loop : |
| 606 | If exception_state & Transition from one master cpu to another Then |
| 608 | Go to cpu_master_loop |
| 609 | Else if exception_state & Waiting to become a master kgdb cpu Then |
| 612 | Break |
| 614 | Else if exception_state & Slave cpu should backtrace then clear flag Then |
| 617 | Else if exception_state & Slave cpu enter exception Then |
| 618 | If Not raw_spin_is_locked( & dbg_slave_lock) Then Go to return_normal |
| 620 | Else |
| 621 | return_normal : |
| 625 | If correct_hw_break Then correct_hw_break() |
| 627 | If trace_on Then tracing_on() |
| 629 | debuggerinfo = NULL |
| 630 | task = NULL |
| 633 | enter_kgdb-- |
| 634 | smp_mb__before_atomic() |
| 635 | atomic_dec( & slaves_in_kgdb) |
| 636 | dbg_touch_watchdogs() |
| 637 | local_irq_restore(flags) |
| 638 | Return 0 |
| 640 | cpu_relax() |
| 649 | If atomic_read( & keep track of the CPU which is doing the single stepping) != -1 && task && process id != kgdb_sstep_pid && --sstep_tries Then |
| 652 | atomic_set( & The CPU# of the active CPU, or -1 if none:, - 1) |
| 653 | raw_spin_unlock( & dbg_master_lock) |
| 654 | dbg_touch_watchdogs() |
| 655 | local_irq_restore(flags) |
| 657 | Go to acquirelock |
| 660 | If Not Return true if there is a valid kgdb I/O module Then |
| 661 | ret_state = 1 |
| 662 | Go to kgdb_restore |
| 668 | If kgdb_skipexception - Bail out of KGDB when we've been triggered Then Go to kgdb_restore |
| 672 | If pre_exception Then pre_exception() |
| 679 | If Not kgdb_single_step Then raw_spin_lock( & dbg_slave_lock) |
| 699 | 0x10c7 is 2**32 / 1000000 (rounded up) (1000) |
| 708 | kgdb_single_step = 0 |
| 710 | Guard for recursive entry = 0 |
| 711 | trace_on = tracing_is_on() |
| 712 | If trace_on Then tracing_off() |
| 715 | When 1 cycle |
| 716 | cpu_master_loop : |
| 717 | If Use kdb or gdbserver mode Then |
| 720 | If error == -1 Then Continue |
| 723 | Else |
| 727 | If error == stub return value for switching between the gdbstub and kdb Then |
| 729 | Else if error == Switch from one cpu to another Then |
| 732 | Go to cpu_loop |
| 733 | Else |
| 740 | If post_exception Then post_exception() |
| 743 | If Not kgdb_single_step Then |
| 744 | raw_spin_unlock( & dbg_slave_lock) |
| 747 | cpu_relax() |
| 750 | kgdb_restore : |
| 751 | If atomic_read( & keep track of the CPU which is doing the single stepping) != -1 Then |
| 753 | If task Then kgdb_sstep_pid = process id |
| 755 | Else kgdb_sstep_pid = 0 |
| 758 | If correct_hw_break Then correct_hw_break() |
| 760 | If trace_on Then tracing_on() |
| 763 | debuggerinfo = NULL |
| 764 | task = NULL |
| 767 | enter_kgdb-- |
| 768 | smp_mb__before_atomic() |
| 769 | atomic_dec( & We use NR_CPUs not PERCPU, in case kgdb is used to debug early* bootup code (which might not have percpu set up yet):) |
| 771 | atomic_set( & The CPU# of the active CPU, or -1 if none:, - 1) |
| 772 | raw_spin_unlock( & dbg_master_lock) |
| 773 | dbg_touch_watchdogs() |
| 774 | local_irq_restore(flags) |
| 776 | Return ret_state |
| Name | Describe |
|---|---|
| kgdb_handle_exception | kgdb_handle_exception() - main entry point from a kernel exception* Locking hierarchy:* interface locks, if any (begin_session)* kgdb lock (kgdb_active) |
| Source code conversion tool public plug-in interface | X |
|---|---|
| Support c/c++/esqlc/java Oracle/Informix/Mysql Plug-in can realize: logical Report Code generation and batch code conversion |