Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:vkdb_printf

Proto:int vkdb_printf(enum kdb_msgsrc src, const char *fmt, va_list ap)

Type:int

Parameter:

TypeParameterName
enum kdb_msgsrcsrc
const char *fmt
va_listap
550  saved_loglevel = 0
551  retlen = 0
554  cphold = NULL , replaced_byte = ' '
555  moreprompt = "more> "
556  c = console_drivers
557  flags = prefix, newline flags
563  local_irq_save(flags)
564  this_cpu = smp_processor_id()
565  cycle
566  old_cpu = cmpxchg( & kdb_printf_cpu, - 1, this_cpu)
567  If old_cpu == -1 || old_cpu == this_cpu Then Break
570  cpu_relax()
573  diag = kdbgetintenv("LINES", & linecount)
574  If diag || linecount <= 1 Then linecount = 24
577  diag = kdbgetintenv("COLUMNS", & colcount)
578  If diag || colcount <= 1 Then colcount = 80
581  diag = kdbgetintenv("LOGGING", & logging)
582  If diag Then logging = 0
585  If Not Miscellaneous functions and data areas || suspend_grep Then
587  next_avail = A bit too big to go on stack
588  size_avail = size of A bit too big to go on stack
590  vsnprintf - Format a string and place it in a buffer*@buf: The buffer to place the result into*@size: The size of the buffer, including the trailing null space*@fmt: The format string to use*@args: Arguments for the format string* This function generally
601  If Not suspend_grep && Miscellaneous functions and data areas Then
602  cp = strchr - Find the first occurrence of the character c in the string s.*@s: the string to be searched*@c: the character to search for
603  If Not cp Then
640  Go to kdb_print_out
647  cp++
648  replaced_byte = cp
649  cphold = cp
650  cp = '\0'
657  fnd = search arg1 to see if it contains arg2* (kdmain.c provides flags for ^pat and pat$)* return 1 for found, 0 for not found
658  If Not fnd Then
670  Go to kdb_print_out
672  If Miscellaneous functions and data areas >= KDB_GREPPING_FLAG_SEARCH Then Miscellaneous functions and data areas = 0
683  kdb_printit :
688  retlen = strlen - Find the length of a string*@s: The string to be sized
689  cp = printk_skip_headers(A bit too big to go on stack )
690  If Not Use kdb or gdbserver mode && kgdb_connected - Is a host GDB connected to us? Then
691  gdbstub_msg_write(cp, retlen - (cp - A bit too big to go on stack ))
692  Else
693  If dbg_io_ops && Not is_console Then
695  cp2 = cp
696  When len-- cycle
697  write_char( * cp2)
698  cp2++
701  When c cycle
704  c = next
707  If logging Then
708  saved_loglevel = console_loglevel
709  console_loglevel = Mum's the word
710  If printk_get_level(A bit too big to go on stack ) || src == trapped from printk() Then printk - print a kernel message*@fmt: format string* This is printk(). It can be called from any context. We want it to work.* We try to grab the console_lock. If we succeed, it's easy - we log the* output and call the console drivers
712  Else pr_info("%s", A bit too big to go on stack )
716  If KDB_STATE(PAGER) Then
722  got = 0
723  len = retlen
724  When len-- cycle
725  If A bit too big to go on stack [len] == '\n' Then
728  Else if A bit too big to go on stack [len] == '\r' Then
729  got = 0
730  Else
731  got++
734  Current number of lines displayed += got / (colcount + 1)
738  If Current number of lines displayed >= linecount Then
745  Current number of lines displayed = 1
750  moreprompt = kdbgetenv("MOREPROMPT")
751  If (moreprompt == NULL) Then moreprompt = "more> "
754  kdb_input_flush* Get rid of any buffered console input
755  c = console_drivers
757  If dbg_io_ops && Not is_console Then
759  cp = moreprompt
760  When len-- cycle
761  write_char( * cp)
762  cp++
765  When c cycle
768  c = next
771  If logging Then printk - print a kernel message*@fmt: format string* This is printk(). It can be called from any context. We want it to work.* We try to grab the console_lock. If we succeed, it's easy - we log the* output and call the console drivers
774  ch = kdb_getchar() - Read a single character from a kdb console (or consoles)
775  Current number of lines displayed = 1
778  A bit too big to go on stack [0] = '\0'
779  next_avail = A bit too big to go on stack
780  size_avail = size of A bit too big to go on stack
781  If ch == 'q' || ch == 'Q' Then
787  kdb_printf("\n")
788  Else if ch == ' ' Then
789  kdb_printf("\r")
790  suspend_grep = 1
791  Else if ch == '\n' || ch == '\r' Then
793  kdb_printf("\r")
794  suspend_grep = 1
795  Else if ch == '/' && Not Miscellaneous functions and data areas Then
796  kdb_printf("\r")
801  suspend_grep = 1
802  Else if ch Then
804  suspend_grep = 1
805  If ch != '/' Then kdb_printf("\nOnly 'q', 'Q' or '/' are processed at more prompt, input ignored\n")
809  Else kdb_printf("\n'/' cannot be used during | grep filtering, input ignored\n")
814  suspend_grep = 1
815  kdb_printf("\n")
817  kdb_input_flush* Get rid of any buffered console input
826  If Miscellaneous functions and data areas && Not suspend_grep Then
827  cphold = replaced_byte
828  strcpy(A bit too big to go on stack , cphold)
829  len = strlen - Find the length of a string*@s: The string to be sized
830  next_avail = A bit too big to go on stack + len
831  size_avail = size of A bit too big to go on stack - len
834  kdb_print_out :
835  suspend_grep = 0
836  If logging Then console_loglevel = saved_loglevel
839  smp_store_release( & kdb_printf_cpu, old_cpu)
840  local_irq_restore(flags)
841  Return retlen
Caller
NameDescribe
kdb_printf