Function report |
Source Code:kernel\debug\kdb\kdb_main.c |
Create Date:2022-07-28 11:41:27 |
Last Modify:2020-03-12 14:18:49 | Copyright©Brick |
home page | Tree |
Annotation kernel can get tool activity | Download SCCT | Chinese |
Name:kdb_local - The main code for kdb
Proto:static int kdb_local(kdb_reason_t reason, int error, struct pt_regs *regs, kdb_dbtrap_t db_result)
Type:int
Parameter:
Type | Parameter | Name |
---|---|---|
kdb_reason_t | reason | |
int | error | |
struct pt_regs * | regs | |
kdb_dbtrap_t | db_result |
1187 | kdb_current = kdb_curr_task(These macros fold the SMP functionality into a single CPU system()) |
1191 | kdb_go_count = 0 |
1192 | If reason == Debug Fault - regs valid Then Else |
1195 | kdb_printf("\nEntering kdb (current=0x%px, pid %d) ", kdb_current, kdb_current ? process id : 0) |
1203 | Case reason == Debug Fault - regs valid |
1210 | Case db_result == Breakpoint |
1211 | kdb_printf("\nEntering kdb (0x%px, pid %d) ", kdb_current, process id) |
1216 | kdb_printf("due to Debug @ "kdb_machreg_fmt"\n", instruction_pointer(regs)) |
1218 | Break |
1219 | Case db_result == Single-step trap |
1220 | Break |
1221 | Case db_result == Single step over breakpoint |
1223 | Return 1 |
1224 | Default |
1225 | kdb_printf("kdb: Bad result from kdba_db_trap: %d\n", db_result) |
1227 | Break |
1231 | Break |
1232 | Case reason == KDB_ENTER() trap/fault - regs valid |
1233 | If KDB_STATE(KEYBOARD) Then kdb_printf("due to Keyboard Entry\n") |
1235 | Else kdb_printf("due to KDB_ENTER()\n") |
1237 | Break |
1238 | Case reason == Keyboard entry - regs valid |
1242 | Case reason == KDB_ENTER_SLAVE() trap/fault - regs valid |
1244 | Case reason == CPU switch - regs valid |
1245 | kdb_printf("due to cpu switch\n") |
1246 | Break |
1247 | Case reason == Kernel Oops - regs valid |
1248 | kdb_printf("Oops: %s\n", kdb_diemsg) |
1249 | kdb_printf("due to oops @ "kdb_machreg_fmt"\n", instruction_pointer(regs)) |
1251 | kdb_dumpregs(regs) |
1252 | Break |
1253 | Case reason == In NMI due to SYSTEM cmd; regs valid |
1254 | kdb_printf("due to System NonMaskable Interrupt\n") |
1255 | Break |
1256 | Case reason == Non-maskable interrupt; regs valid |
1257 | kdb_printf("due to NonMaskable Interrupt @ "kdb_machreg_fmt"\n", instruction_pointer(regs)) |
1260 | Break |
1261 | Case reason == Single Step trap. - regs valid |
1262 | Case reason == Breakpoint inst. - regs valid |
1263 | kdb_printf("due to %s @ "kdb_machreg_fmt"\n", reason == Breakpoint inst. - regs valid ? "Breakpoint" : "SS trap", instruction_pointer(regs)) |
1270 | If db_result != Breakpoint Then |
1271 | kdb_printf("kdb: error return from kdba_bp_trap: %d\n", db_result) |
1274 | Return 0 |
1276 | Break |
1277 | Case reason == Recursive entry to kdb;* regs probably valid |
1278 | kdb_printf("due to Recursion @ "kdb_machreg_fmt"\n", instruction_pointer(regs)) |
1280 | Break |
1281 | Default |
1282 | kdb_printf("kdb: unexpected reason code: %d\n", reason) |
1284 | Return 0 |
1287 | When 1 cycle |
1291 | kdb_nextline = 1 |
1292 | KDB_STATE_CLEAR(SUPPRESS) |
1293 | kdb_grepping_flag = 0 |
1295 | kdb_grep_string[0] = '\0' |
1298 | cmdbuf = '\0' |
1301 | do_full_getstr : |
1308 | If defcmd_in_progress Then strncat(kdb_prompt_str, "[defcmd]", kdb_printf: max printline* size == 256 ) |
1315 | If cmdbuf != '\n' Then |
1316 | If cmdbuf < 32 Then |
1320 | *( cmd_hist[cmd_head] + strlen - Find the length of a string*@s: The string to be sized - 1) = '\0' |
1323 | If Not handle_ctrl_cmd(cmdbuf) Then *( cmd_cur + strlen - Find the length of a string*@s: The string to be sized - 1) = '\0' |
1326 | Go to do_full_getstr |
1327 | Else |
1332 | cmd_head = (cmd_head + 1) % Command history |
1333 | If cmd_head == cmd_tail Then cmd_tail = (cmd_tail + 1) % Command history |
1339 | If diag == KDB return codes from a command or internal kdb function Then |
1344 | If diag == Kernel Debugger Command codes. Must not overlap with error codes. || diag == KDB_CMD_CPU || diag == KDB_CMD_SS || diag == KDB_CMD_KGDB Then Break |
1350 | If diag Then kdb_cmderror(diag) |
1354 | Return diag |
Name | Describe |
---|---|
kdb_main_loop | kdb_main_loop - After initial setup and assignment of the* controlling cpu, all cpus are in this loop |
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 |