Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\debug\kdb\kdb_debugger.c Create Date:2022-07-28 11:44:31
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:kdb_stub

Proto:int kdb_stub(struct kgdb_state *ks)

Type:int

Parameter:

TypeParameterName
struct kgdb_state *ks
55  error = 0
57  addr = kgdb_arch_pc(ex_vector, linux_regs)
58  reason = Kernel Oops - regs valid
59  db_result = KDB_DB_NOBPT
62  kdb_ks = ks
63  If KDB_STATE(REENTRY) Then
64  reason = CPU switch - regs valid
65  KDB_STATE_CLEAR(REENTRY)
66  addr = instruction_pointer(linux_regs)
68  pass_exception = 0
69  If atomic_read( & kgdb_setting_breakpoint) Then reason = Keyboard entry - regs valid
72  If err_code == In NMI due to SYSTEM cmd; regs valid && signo == SIGTRAP Then reason = In NMI due to SYSTEM cmd; regs valid
75  Else if in_nmi() Then reason = Non-maskable interrupt; regs valid
78  When i < KDB_MAXBPT describes the total number of breakpoints* supported by this architecure. cycle
84  Break
87  If reason == Breakpoint inst. - regs valid || reason == CPU switch - regs valid Then
89  If This entry is available Then Continue
109  If reason != Breakpoint inst. - regs valid && ex_vector == 0 && signo == SIGTRAP Then
111  reason = Single Step trap. - regs valid
112  db_result = Breakpoint
115  KDB_STATE_CLEAR(KGDB_TRANS)
116  kdb_common_init_state(ks)
118  kdb_bp_remove* Remove kdb_breakpoints upon entry to the kernel debugger.* Parameters:* None.* Outputs:* None.* Returns:* None.* Locking:* None.* Remarks:
119  KDB_STATE_CLEAR(DOING_SS)
120  KDB_STATE_SET(PAGER)
121  If err_code == DIE_OOPS || reason == Kernel Oops - regs valid Then
122  pass_exception = 1
123  KDB_FLAG_SET(CATASTROPHIC)
126  for_each_online_cpu(i)
127  If Not enter_kgdb Then KDB_FLAG_SET(CATASTROPHIC)
129  If KDB_STATE(SSBPT) && reason == Single Step trap. - regs valid Then
130  KDB_STATE_CLEAR(SSBPT)
131  KDB_STATE_CLEAR(DOING_SS)
132  Else
134  error = kdb_main_loop - After initial setup and assignment of the* controlling cpu, all cpus are in this loop
141  kdb_common_deinit_state()
142  KDB_STATE_CLEAR(PAGER)
143  kdbnearsym_cleanup()
144  If error == KDB_CMD_KGDB Then
145  If KDB_STATE(DOING_KGDB) Then KDB_STATE_CLEAR(DOING_KGDB)
147  Return stub return value for switching between the gdbstub and kdb
149  kdb_bp_install* Install kdb_breakpoints prior to returning from the* kernel debugger. This allows the kdb_breakpoints to be set* upon functions that are used internally by kdb, such as* printk(). This function is only called once per kdb session.
150  SW breakpoint management:
152  If KDB_STATE(DOING_SS) Then gdbstub_state(ks, "s")
154  Else gdbstub_state(ks, "c")
157  KDB_FLAG_CLEAR(CATASTROPHIC)
160  ret_state = gdbstub_state(ks, "e")
161  If pass_exception Then ret_state = 1
163  If error == KDB_CMD_CPU Then
164  KDB_STATE_SET(REENTRY)
169  kgdb_single_step = 0
170  dbg_deactivate_sw_breakpoints()
171  Return Switch from one cpu to another
173  Return ret_state
Caller
NameDescribe
kgdb_cpu_enter