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:02
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:kdb_defcmd

Proto:static int kdb_defcmd(int argc, const char **argv)

Type:int

Parameter:

TypeParameterName
intargc
const char **argv
709  save_defcmd_set = defcmd_set
710  If defcmd_in_progress Then
711  kdb_printf("kdb: nested defcmd detected, assuming missing endefcmd\n")
713  kdb_defcmd2("endefcmd", "endefcmd")
715  If argc == 0 Then
718  kdb_printf("defcmd %s \"%s\" \"%s\"\n", name, usage, help)
720  When i < count cycle kdb_printf("%s", command[i])
722  kdb_printf("endefcmd\n")
724  Return 0
726  If argc != 3 Then Return KDB_ARGCOUNT
728  If in_dbg_master() Then
729  kdb_printf("Command only available during kdb_init()\n")
730  Return KDB_NOTIMP
732  defcmd_set = kmalloc_array - allocate memory for an array.*@n: number of elements.*@size: element size.*@flags: the type of memory to allocate (see kmalloc).
734  If Not defcmd_set Then Go to fail_defcmd
736  No 3D Now!(defcmd_set, save_defcmd_set, defcmd_set_count * size of defcmd_set )
738  s = defcmd_set + defcmd_set_count
739  memset(s, 0, size of s )
740  usable = true
741  name = kdb_strdup(argv[1], GFP_KDB)
742  If Not name Then Go to fail_name
744  usage = kdb_strdup(argv[2], GFP_KDB)
745  If Not usage Then Go to fail_usage
747  help = kdb_strdup(argv[3], GFP_KDB)
748  If Not help Then Go to fail_help
750  If usage[0] == '"' Then
751  strcpy(usage, argv[2] + 1)
752  usage[strlen - Find the length of a string*@s: The string to be sized - 1] = '\0'
754  If help[0] == '"' Then
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  Return 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  Return KDB_NOTIMP