MCPcopy Create free account
hub / github.com/F-Stack/f-stack / db_command

Function db_command

freebsd/ddb/db_command.c:353–506  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

351}
352
353static void
354db_command(struct command **last_cmdp, struct command_table *cmd_table,
355 int dopager)
356{
357 struct command *cmd = NULL;
358 int t;
359 char modif[TOK_STRING_SIZE];
360 db_expr_t addr, count;
361 bool have_addr = false;
362 int result;
363
364 t = db_read_token();
365 if (t == tEOL) {
366 /* empty line repeats last command, at 'next' */
367 cmd = *last_cmdp;
368 addr = (db_expr_t)db_next;
369 have_addr = false;
370 count = 1;
371 modif[0] = '\0';
372 }
373 else if (t == tEXCL) {
374 db_fncall((db_expr_t)0, (bool)false, (db_expr_t)0, (char *)0);
375 return;
376 }
377 else if (t != tIDENT) {
378 db_printf("Unrecognized input; use \"help\" "
379 "to list available commands\n");
380 db_flush_lex();
381 return;
382 }
383 else {
384 /*
385 * Search for command
386 */
387 while (cmd_table) {
388 result = db_cmd_search(db_tok_string,
389 cmd_table,
390 &cmd);
391 switch (result) {
392 case CMD_NONE:
393 db_printf("No such command; use \"help\" "
394 "to list available commands\n");
395 db_flush_lex();
396 return;
397 case CMD_AMBIGUOUS:
398 db_printf("Ambiguous\n");
399 db_flush_lex();
400 return;
401 case CMD_HELP:
402 if (cmd_table == &db_cmd_table) {
403 db_printf("This is ddb(4), the kernel debugger; "
404 "see https://man.FreeBSD.org/ddb/4 for help.\n");
405 db_printf("Use \"bt\" for backtrace, \"dump\" for "
406 "kernel core dump, \"reset\" to reboot.\n");
407 db_printf("Available commands:\n");
408 }
409 db_cmd_list(cmd_table);
410 db_flush_lex();

Callers 2

db_command_loopFunction · 0.85
db_command_scriptFunction · 0.85

Calls 11

db_read_tokenFunction · 0.85
db_fncallFunction · 0.85
db_printfFunction · 0.85
db_flush_lexFunction · 0.85
db_cmd_searchFunction · 0.85
db_cmd_listFunction · 0.85
db_unread_tokenFunction · 0.85
db_expressionFunction · 0.85
db_skip_to_eolFunction · 0.85
db_enable_pagerFunction · 0.85
db_disable_pagerFunction · 0.85

Tested by

no test coverage detected