函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\debug\kdb\kdb_main.c Create Date:2022-07-27 12:45:12
Last Modify:2020-03-12 14:18:49 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:kdb_defcmd

函数原型:static int kdb_defcmd(int argc, const char **argv)

返回类型:int

参数:

类型参数名称
intargc
const char **argv
709  save_defcmd_set等于defcmd_set
710  如果defcmd_in_progress
711  kdb_printf("kdb: nested defcmd detected, assuming missing endefcmd\n")
713  kdb_defcmd2("endefcmd", "endefcmd")
715  如果argc恒等于0则
718  kdb_printf("defcmd %s \"%s\" \"%s\"\n", name, usage, help)
720 i小于count循环kdb_printf("%s", command[i])
722  kdb_printf("endefcmd\n")
724  返回:0
726  如果argc不等于3则返回:KDB_ARGCOUNT
728  如果in_dbg_master()则
729  kdb_printf("Command only available during kdb_init()\n")
730  返回:KDB_NOTIMP
732  defcmd_set = 分配数组内存
734  如果非defcmd_set则转到:fail_defcmd
736  内存复制(defcmd_set, save_defcmd_set, defcmd_set_count * defcmd_set的长度)
738  s等于defcmd_setdefcmd_set_count
739  memset(s, 0, s的长度)
740  usable = true
741  name等于kdb_strdup(argv[1], GFP_KDB)
742  如果非name则转到:fail_name
744  usage等于kdb_strdup(argv[2], GFP_KDB)
745  如果非usage则转到:fail_usage
747  help等于kdb_strdup(argv[3], GFP_KDB)
748  如果非help则转到:fail_help
750  如果usage[0]恒等于'"'则
751  strcpy(usage, argv[2] + 1)
752  usage[strlen - Find the length of a string*@s: The string to be sized - 1]等于'\0'
754  如果help[0]恒等于'"'则
755  strcpy(help, argv[3] + 1)
756  help[strlen - Find the length of a string*@s: The string to be sized - 1]等于'\0'
758  defcmd_set_count先自加
759  defcmd_in_progress = true
760  kfree(save_defcmd_set)
761  返回:0
762  fail_help :
763  kfree(usage)
764  fail_usage :
765  kfree(name)
766  fail_name :
767  kfree(defcmd_set)
768  fail_defcmd :
769  kdb_printf("Could not allocate new defcmd_set entry for %s\n", argv[1])
770  defcmd_set = save_defcmd_set
771  返回:KDB_NOTIMP