函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:kdb_read* This function reads a string of characters, terminated by* a newline, or by reaching the end of the supplied buffer,* from the current kernel debugger console device.* Parameters:* Returns:* Returns a pointer to the buffer containing the received

函数原型:static char *kdb_read(char *buffer, size_t bufsize)

返回类型:char

参数:

类型参数名称
char *buffer Address of character buffer to receive input characters.
size_tbufsize size, in bytes, of the character buffer
198  cp等于 Address of character buffer to receive input characters.
200  bufend等于 Address of character buffer to receive input characters. size, in bytes, of the character buffer减2
205  len等于strlen - Find the length of a string*@s: The string to be sized
207  tab等于0
214  diag等于kdbgetintenv("DTABCOUNT", & dtab_count)
215  如果diagdtab_count等于30
218  如果len大于0则
219  cp加等于len
220  如果* Address of character buffer to receive input characters.len减1的差恒等于'\n'则cp自减
224  lastchar等于cp
225  cp等于'\0'
226  kdb_printf("%s", Address of character buffer to receive input characters.)
227  poll_again :
228  key等于kdb_getchar() - Read a single character from a kdb console (or consoles)
229  如果key不等于9则tab等于0
232  :key恒等于8
234  如果cp小于lastchar
238  *lastchar先自减等于'\0'
239  cp先自减
240  kdb_printf("\b%s \r", cp)
241  tmp等于cp
242  cp等于'\0'
245  cp等于tmp
247  退出
248  :key恒等于13
249  lastchar自加等于'\n'
250  lastchar自加等于'\0'
251  如果非KDB_STATE(KGDB_TRANS)则
255  kdb_printf("\n")
256  返回: Address of character buffer to receive input characters.
257  :key恒等于4
258  如果cp小于lastchar
259  内存复制(tmpbuffer, cp + 1, lastchar - cp - 1)
261  *lastchar先自减等于'\0'
262  kdb_printf("%s \r", cp)
263  tmp等于cp
264  cp等于'\0'
267  cp等于tmp
269  退出
270  :key恒等于1
272  kdb_printf("\r")
276  退出
277  :key恒等于5
278  如果cp小于lastchar
279  kdb_printf("%s", cp)
280  cp等于lastchar
282  退出
283  :key恒等于2
285  kdb_printf("\b")
286  cp先自减
288  退出
289  :key恒等于14
290  memset(tmpbuffer, ' ', strlen - Find the length of a string*@s: The string to be sized + (lastchar - Address of character buffer to receive input characters.))
292  *tmpbufferstrlen - Find the length of a string*@s: The string to be sizedlastchar Address of character buffer to receive input characters.的和等于'\0'
294  kdb_printf("\r%s\r", tmpbuffer)
295  lastchar等于key
296  *lastchar加1的和等于'\0'
297  返回:lastchar
298  :key恒等于6
299  如果cp小于lastchar
300  kdb_printf("%c", * cp)
301  cp先自加
303  退出
304  :key恒等于16
305  memset(tmpbuffer, ' ', strlen - Find the length of a string*@s: The string to be sized + (lastchar - Address of character buffer to receive input characters.))
307  *tmpbufferstrlen - Find the length of a string*@s: The string to be sizedlastchar Address of character buffer to receive input characters.的和等于'\0'
309  kdb_printf("\r%s\r", tmpbuffer)
310  lastchar等于key
311  *lastchar加1的和等于'\0'
312  返回:lastchar
313  :key恒等于9
314  如果tab小于2则tab先自加
316  p_tmp等于 Address of character buffer to receive input characters.
317 p_tmp恒等于' '循环
318  p_tmp自加
319  如果p_tmp大于cp退出
321  内存复制(tmpbuffer, p_tmp, cp - p_tmp)
322  *tmpbuffercpp_tmp的和等于'\0'
323  p_tmp等于strrchr - Find the last occurrence of a character in a string*@s: The string to be searched*@c: The character to search for
324  如果p_tmpp_tmp先自加
326  否则p_tmp等于tmpbuffer
328  len等于strlen - Find the length of a string*@s: The string to be sized
329  buf_size等于tmpbuffer的长度减p_tmptmpbuffer
330  count等于kallsyms_symbol_complete* Parameters:* prefix_name prefix of a symbol name to lookup* max_len maximum length that can be returned* Returns:* Number of symbols which match the given prefix
331  如果tab恒等于2且count大于0则
332  kdb_printf("\n%d symbols are found.", count)
333  如果count大于dtab_count
334  count等于dtab_count
335  kdb_printf(" But only first %d symbols will be printed.\nYou can change the environment variable DTABCOUNT.", count)
340  kdb_printf("\n")
341 i小于count循环
351  如果i大于等于dtab_countkdb_printf("...")
353  kdb_printf("\n")
356  否则如果tab不等于2且count大于0则
358  strncpy(p_tmp + len_tmp, cp, lastchar - cp + 1)
360  strncpy(cp, p_tmp + len, len_tmp - len + 1)
361  len等于len_tmplen
362  kdb_printf("%s", cp)
363  cp加等于len
364  lastchar加等于len
366  Current number of lines displayed 等于1
367  退出
368  默认
369  如果key大于等于32且lastchar小于bufend
370  如果cp小于lastchar
373  *lastchar先自加等于'\0'
374  cp等于key
375  kdb_printf("%s\r", cp)
376  cp先自加
377  tmp等于cp
378  cp等于'\0'
381  cp等于tmp
382  否则
383  *lastchar先自加等于'\0'
384  cp自加等于key
389  如果非KDB_STATE(KGDB_TRANS)则
392  否则
393  kdb_printf("%c", key)
412  退出
414  转到:poll_again
调用者
名称描述
kdb_getstrkdb_getstr* Print the prompt string and read a command from the* input device.* Parameters:* buffer Address of buffer to receive command* bufsize Size of buffer in bytes* prompt Pointer to string to use as prompt string* Returns: