MCPcopy Create free account
hub / github.com/F-Stack/f-stack / kdb_trap

Function kdb_trap

freebsd/kern/subr_kdb.c:681–751  ·  view source on GitHub ↗

* Enter the debugger due to a trap. */

Source from the content-addressed store, hash-verified

679 * Enter the debugger due to a trap.
680 */
681int
682kdb_trap(int type, int code, struct trapframe *tf)
683{
684#ifdef SMP
685 cpuset_t other_cpus;
686#endif
687 struct kdb_dbbe *be;
688 register_t intr;
689 int handled;
690 int did_stop_cpus;
691
692 be = kdb_dbbe;
693 if (be == NULL || be->dbbe_trap == NULL)
694 return (0);
695
696 /* We reenter the debugger through kdb_reenter(). */
697 if (kdb_active)
698 return (0);
699
700 intr = intr_disable();
701
702 if (!SCHEDULER_STOPPED()) {
703#ifdef SMP
704 other_cpus = all_cpus;
705 CPU_ANDNOT(&other_cpus, &stopped_cpus);
706 CPU_CLR(PCPU_GET(cpuid), &other_cpus);
707 stop_cpus_hard(other_cpus);
708#endif
709 curthread->td_stopsched = 1;
710 did_stop_cpus = 1;
711 } else
712 did_stop_cpus = 0;
713
714 kdb_active++;
715
716 kdb_frame = tf;
717
718 /* Let MD code do its thing first... */
719 kdb_cpu_trap(type, code);
720
721 makectx(tf, &kdb_pcb);
722 kdb_thr_select(curthread);
723
724 cngrab();
725
726 for (;;) {
727 handled = be->dbbe_trap(type, code);
728 if (be == kdb_dbbe)
729 break;
730 be = kdb_dbbe;
731 if (be == NULL || be->dbbe_trap == NULL)
732 break;
733 printf("Switching to %s back-end\n", be->dbbe_name);
734 }
735
736 cnungrab();
737
738 kdb_active--;

Callers 11

trapFunction · 0.85
trap_fatalFunction · 0.85
trapFunction · 0.85
trapFunction · 0.85
trap_fatalFunction · 0.85
data_abortFunction · 0.85
do_el1h_syncFunction · 0.85
abort_debugFunction · 0.85
abort_fatalFunction · 0.85
undefinedinstructionFunction · 0.85
nmi_call_kdbFunction · 0.85

Calls 10

stop_cpus_hardFunction · 0.85
kdb_thr_selectFunction · 0.85
cngrabFunction · 0.85
cnungrabFunction · 0.85
restart_cpusFunction · 0.85
printfFunction · 0.70
intr_disableFunction · 0.50
kdb_cpu_trapFunction · 0.50
makectxFunction · 0.50
intr_restoreFunction · 0.50

Tested by

no test coverage detected