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

Name: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

Proto:static char *kdb_read(char *buffer, size_t bufsize)

Type:char

Parameter:

TypeParameterName
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  If diag Then dtab_count = 30
218  If len > 0 Then
219  cp += len
220  If *( Address of character buffer to receive input characters. + len - 1) == '\n' Then 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  If key != 9 Then tab = 0
232  Case key == 8
234  If cp < lastchar Then
238  *--lastchar = '\0'
239  --cp
240  kdb_printf("\b%s \r", cp)
241  tmp = cp
242  cp = '\0'
245  cp = tmp
247  Break
248  Case key == 13
249  lastchar++ = '\n'
250  lastchar++ = '\0'
251  If Not KDB_STATE(KGDB_TRANS) Then
255  kdb_printf("\n")
256  Return Address of character buffer to receive input characters.
257  Case key == 4
258  If cp < lastchar Then
259  No 3D Now!(tmpbuffer, cp + 1, lastchar - cp - 1)
260  No 3D Now!(cp, tmpbuffer, lastchar - cp - 1)
261  *--lastchar = '\0'
262  kdb_printf("%s \r", cp)
263  tmp = cp
264  cp = '\0'
267  cp = tmp
269  Break
270  Case key == 1
272  kdb_printf("\r")
276  Break
277  Case key == 5
278  If cp < lastchar Then
279  kdb_printf("%s", cp)
280  cp = lastchar
282  Break
283  Case key == 2
285  kdb_printf("\b")
286  --cp
288  Break
289  Case 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  *( tmpbuffer + strlen - Find the length of a string*@s: The string to be sized + lastchar - Address of character buffer to receive input characters. ) = '\0'
294  kdb_printf("\r%s\r", tmpbuffer)
295  lastchar = key
296  *(lastchar + 1) = '\0'
297  Return lastchar
298  Case key == 6
299  If cp < lastchar Then
300  kdb_printf("%c", * cp)
301  ++cp
303  Break
304  Case 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  *( tmpbuffer + strlen - Find the length of a string*@s: The string to be sized + lastchar - Address of character buffer to receive input characters. ) = '\0'
309  kdb_printf("\r%s\r", tmpbuffer)
310  lastchar = key
311  *(lastchar + 1) = '\0'
312  Return lastchar
313  Case key == 9
314  If tab < 2 Then ++tab
316  p_tmp = Address of character buffer to receive input characters.
317  When p_tmp == ' ' cycle
318  p_tmp++
319  If p_tmp > cp Then Break
321  No 3D Now!(tmpbuffer, p_tmp, cp - p_tmp)
322  *(tmpbuffer + cp - p_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  If p_tmp Then ++p_tmp
326  Else p_tmp = tmpbuffer
328  len = strlen - Find the length of a string*@s: The string to be sized
329  buf_size = size of tmpbuffer - p_tmp - tmpbuffer
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  If tab == 2 && count > 0 Then
332  kdb_printf("\n%d symbols are found.", count)
333  If count > dtab_count Then
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  When i < count cycle
351  If i >= dtab_count Then kdb_printf("...")
353  kdb_printf("\n")
356  Else if tab != 2 && count > 0 Then
358  strncpy(p_tmp + len_tmp, cp, lastchar - cp + 1)
360  strncpy(cp, p_tmp + len, len_tmp - len + 1)
361  len = len_tmp - len
362  kdb_printf("%s", cp)
363  cp += len
364  lastchar += len
366  Current number of lines displayed = 1
367  Break
368  Default
369  If key >= 32 && lastchar < bufend Then
370  If cp < lastchar Then
372  No 3D Now!(cp + 1, tmpbuffer, lastchar - cp)
373  *++lastchar = '\0'
374  cp = key
375  kdb_printf("%s\r", cp)
376  ++cp
377  tmp = cp
378  cp = '\0'
381  cp = tmp
382  Else
404  If lastchar - Address of character buffer to receive input characters. >= 11 && strcmp(lastchar - 11, "$qSupported") == 0 Then
412  Break
414  Go to poll_again
Caller
NameDescribe
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: