Function report |
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 activity | Download SCCT | Chinese |
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:
| Type | Parameter | Name |
|---|---|---|
| char * | buffer | Address of character buffer to receive input characters. |
| size_t | bufsize | size, in bytes, of the character buffer |
| 200 | bufend = Address of character buffer to receive input characters. + size, in bytes, of the character buffer - 2 |
| 207 | tab = 0 |
| 214 | diag = kdbgetintenv("DTABCOUNT", & dtab_count) |
| 215 | If diag Then dtab_count = 30 |
| 218 | If len > 0 Then |
| 220 | If *( Address of character buffer to receive input characters. + len - 1) == '\n' Then cp-- |
| 225 | cp = '\0' |
| 227 | poll_again : |
| 232 | Case key == 8 |
| 233 | If cp > Address of character buffer to receive input characters. Then |
| 235 | No 3D Now!(tmpbuffer, cp, lastchar - cp) |
| 236 | No 3D Now!(cp - 1, tmpbuffer, lastchar - cp) |
| 238 | *--lastchar = '\0' |
| 239 | --cp |
| 240 | kdb_printf("\b%s \r", cp) |
| 242 | cp = '\0' |
| 243 | kdb_printf(kdb_prompt_str) |
| 247 | Break |
| 248 | Case key == 13 |
| 249 | lastchar++ = '\n' |
| 250 | lastchar++ = '\0' |
| 251 | If Not KDB_STATE(KGDB_TRANS) Then |
| 252 | KDB_STATE_SET(KGDB_TRANS) |
| 255 | kdb_printf("\n") |
| 257 | Case key == 4 |
| 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) |
| 264 | cp = '\0' |
| 265 | kdb_printf(kdb_prompt_str) |
| 269 | Break |
| 270 | Case key == 1 |
| 271 | If cp > Address of character buffer to receive input characters. Then |
| 272 | kdb_printf("\r") |
| 273 | kdb_printf(kdb_prompt_str) |
| 276 | Break |
| 277 | Case key == 5 |
| 283 | Case key == 2 |
| 284 | If cp > Address of character buffer to receive input characters. Then |
| 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) |
| 296 | *(lastchar + 1) = '\0' |
| 297 | Return lastchar |
| 298 | Case key == 6 |
| 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) |
| 311 | *(lastchar + 1) = '\0' |
| 312 | Return lastchar |
| 313 | Case key == 9 |
| 318 | p_tmp++ |
| 321 | No 3D Now!(tmpbuffer, p_tmp, cp - p_tmp) |
| 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 |
| 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 |
| 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") |
| 345 | If ret != -E2BIG Then kdb_printf("%s ", p_tmp) |
| 347 | Else kdb_printf("%s... ", p_tmp) |
| 351 | If i >= dtab_count Then kdb_printf("...") |
| 353 | kdb_printf("\n") |
| 354 | kdb_printf(kdb_prompt_str) |
| 362 | kdb_printf("%s", cp) |
| 367 | Break |
| 368 | Default |
| 371 | No 3D Now!(tmpbuffer, cp, lastchar - cp) |
| 372 | No 3D Now!(cp + 1, tmpbuffer, lastchar - cp) |
| 373 | *++lastchar = '\0' |
| 375 | kdb_printf("%s\r", cp) |
| 376 | ++cp |
| 378 | cp = '\0' |
| 379 | kdb_printf(kdb_prompt_str) |
| 382 | Else |
| 397 | If lastchar - Address of character buffer to receive input characters. >= 5 && strcmp(lastchar - 5, "$?#3f") == 0 Then |
| 399 | kdb_gdb_state_pass(lastchar - 5) |
| 401 | KDB_STATE_SET(DOING_KGDB) |
| 404 | If lastchar - Address of character buffer to receive input characters. >= 11 && strcmp(lastchar - 11, "$qSupported") == 0 Then |
| 406 | kdb_gdb_state_pass(lastchar - 11) |
| 408 | KDB_STATE_SET(DOING_KGDB) |
| 412 | Break |
| 414 | Go to poll_again |
| Name | Describe |
|---|---|
| kdb_getstr | kdb_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: |
| Source code conversion tool public plug-in interface | X |
|---|---|
| Support c/c++/esqlc/java Oracle/Informix/Mysql Plug-in can realize: logical Report Code generation and batch code conversion |