函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\debug\debug_core.c Create Date:2022-07-27 12:41:50
Last Modify:2020-03-17 19:04:10 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:kgdb_cpu_enter

函数原型:static int kgdb_cpu_enter(struct kgdb_state *ks, struct pt_regs *regs, int exception_state)

返回类型:int

参数:

类型参数名称
struct kgdb_state *ks
struct pt_regs *regs
intexception_state
560  sstep_tries等于100
563  trace_on等于0
564  online_cpus等于num_online_cpus()
567  enter_kgdb自加
568  exception_state或等于exception_state
570  如果exception_state恒等于Waiting to become a master kgdb cpu 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  否则atomic_inc( & slaves_in_kgdb)
575  如果disable_hw_breakdisable_hw_break(regs)
578  acquirelock :
583  local_irq_save(flags)
585  cpu等于cpu
586  debuggerinfo等于regs
587  task等于当前进程
588  ret_state等于0
589  irq_depth等于hardirq_count()右移HARDIRQ_SHIFT
592  smp_mb()
594  如果Guard for recursive entry 恒等于1则
595  如果Define the various spin_lock methods. Note we define these* regardless of whether CONFIG_SMP or CONFIG_PREEMPTION are set. The* various methods are defined as nops in the case they are not* required.( & dbg_master_lock)则atomic_xchg( & The CPU# of the active CPU, or -1 if none:, cpu)
597  转到:cpu_master_loop
604  当1循环
605  cpu_loop :
608  转到:cpu_master_loop
615  dump_stack()
617  否则如果exception_state按位与Slave cpu enter exception
618  如果非raw_spin_is_locked( & dbg_slave_lock)则转到:return_normal
620  否则
621  return_normal :
627  如果trace_ontracing_on()
629  debuggerinfo = NULL
630  task = NULL
633  enter_kgdb自减
638  返回:0
640  cpu_relax()
649  如果atomic_read( & keep track of the CPU which is doing the single stepping)不等于负1且task进程ID不等于kgdb_sstep_pidsstep_tries先自减则
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  转到:acquirelock
660  如果非Return true if there is a valid kgdb I/O module
661  ret_state等于1
662  转到:kgdb_restore
668  如果kgdb_skipexception - Bail out of KGDB when we've been triggered则转到:kgdb_restore
672  如果pre_exceptionpre_exception()
679  如果非kgdb_single_stepraw_spin_lock( & dbg_slave_lock)
695  time_left等于Parameters used to convert the timespec values:
696 If you are debugging a problem where roundup (the collection of* all other CPUs) is a problem [this should be extremely rare],* then use the nokgdbroundup option to avoid rounduptime_left先自减且atomic_read( & We use NR_CPUs not PERCPU, in case kgdb is used to debug early* bootup code (which might not have percpu set up yet):)加atomic_read( & slaves_in_kgdb)不等于online_cpus循环
699  0x10c7 is 2**32 / 1000000 (rounded up) (1000)
700  如果非time_left打印错误信息("Timed out waiting for secondary CPUs.\n")
707  dbg_deactivate_sw_breakpoints()
708  kgdb_single_step等于0
709  kgdb_contthread等于当前进程
710  Guard for recursive entry 等于0
711  trace_on等于tracing_is_on()
712  如果trace_ontracing_off()
715  当1循环
716  cpu_master_loop :
719  error等于kdb_stub(ks)
720  如果error恒等于负1则继续下一循环
723  否则
729  否则如果error恒等于Switch from one cpu to another
732  转到:cpu_loop
733  否则
734  ret_state等于error
735  退出
740  如果post_exceptionpost_exception()
743  如果非kgdb_single_step
744  raw_spin_unlock( & dbg_slave_lock)
746 If you are debugging a problem where roundup (the collection of* all other CPUs) is a problem [this should be extremely rare],* then use the nokgdbroundup option to avoid roundupatomic_read( & slaves_in_kgdb)循环
747  cpu_relax()
750  kgdb_restore :
751  如果atomic_read( & keep track of the CPU which is doing the single stepping)不等于负1则
752  sstep_cpu等于atomic_read( & keep track of the CPU which is doing the single stepping)
753  如果taskkgdb_sstep_pid等于进程ID
755  否则kgdb_sstep_pid等于0
758  如果correct_hw_breakcorrect_hw_break()
760  如果trace_ontracing_on()
763  debuggerinfo = NULL
764  task = NULL
765  exception_state与等于Waiting to become a master kgdb cpu 按位或Slave cpu enter exception 的值的反
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  返回:ret_state
调用者
名称描述
kgdb_handle_exceptionkgdb_handle_exception() - main entry point from a kernel exception* Locking hierarchy:* interface locks, if any (begin_session)* kgdb lock (kgdb_active)