Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:kdb_parse

Proto:int kdb_parse(const char *cmdstr)

Type:int

Parameter:

TypeParameterName
const char *cmdstr
919  ignore_errors = 0 , check_grep = 0
924  cp = cmdstr
926  If KDB_FLAG(CMD_INTERRUPT) Then
929  KDB_FLAG_CLEAR(CMD_INTERRUPT)
930  KDB_STATE_SET(PAGER)
931  argc = 0
934  If cp != '\n' && cp != '\0' Then
935  argc = 0
936  cpp = cbuf
937  When cp cycle
940  cp++
941  If cp == '\0' || cp == '\n' || cp == '#' && Not defcmd_in_progress Then Break
945  If cp == '|' Then
946  check_grep++
947  Break
950  kdb_printf("kdb_parse: command buffer overflow, command ignored\n%s\n", cmdstr)
956  kdb_printf("kdb_parse: too many arguments, command ignored\n%s\n", cmdstr)
960  argv[argc++] = cpp
961  escaped = 0
962  quoted = '\0'
969  If escaped Then
970  escaped = 0
971  cpp++ = cp++
972  Continue
974  If cp == '\\' Then
975  escaped = 1
976  ++cp
977  Continue
979  If cp == quoted Then quoted = '\0'
981  Else if cp == '\'' || cp == '"' Then quoted = cp
983  cpp = cp++
984  If cpp == '=' && Not quoted Then Break
986  ++cpp
988  cpp++ = '\0'
991  If Not argc Then Return 0
993  If check_grep Then The "str" argument may point to something like | grep xyz
995  If defcmd_in_progress Then
996  result = kdb_defcmd2(cmdstr, argv[0])
997  If Not defcmd_in_progress Then
998  argc = 0
999  *argv[0] = '\0'
1001  Return result
1003  If argv[0][0] == '-' && argv[0][1] && ( argv[0][1] < '0' || argv[0][1] > '9' ) Then
1005  ignore_errors = 1
1006  ++argv[0]
1010  If Command name Then
1021  Break
1025  If strcmp(argv[0], Command name ) == 0 Then Break
1035  If i == kdb_max_commands Then
1037  If Command name Then
1041  Break
1047  If i < kdb_max_commands Then
1050  If Not Check whether the flags of the current command and the permissions* of the kdb console has allow a command to be run. Then Return KDB_NOPERM
1053  KDB_STATE_SET(CMD)
1054  result = ( * Function to execute command )(argc - 1, argv)
1055  If result && ignore_errors && result > Kernel Debugger Command codes. Must not overlap with error codes. Then result = 0
1057  KDB_STATE_CLEAR(CMD)
1059  If Command behaviour flags & Repeat the command with args Then Return result
1062  argc = If Command behaviour flags & Repeat the command w/o arguments Then 1 Else 0
1063  If argv[argc] Then *argv[argc] = '\0'
1065  Return result
1077  char * name = NULL
1079  nextarg = 0
1086  kdb_printf("%s = ", argv[0])
1087  kdb_symbol_print - Standard method for printing a symbol name and offset
1088  kdb_printf("\n")
1089  Return 0
Caller
NameDescribe
kdb_exec_defcmdForward references
kdb_localkdb_local - The main code for kdb
kdb_cmd_initExecute any commands defined in kdb_cmds.
kdb_bt