toolchain: add new debugging tool using magenta_debug
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
#include "command.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
extern const struct command cmd_info_kernel;
|
||||
|
||||
static const struct command *commands[] = {
|
||||
&cmd_info_kernel,
|
||||
};
|
||||
static const size_t nr_commands = sizeof commands / sizeof commands[0];
|
||||
|
||||
static int info(
|
||||
const struct command *cmd,
|
||||
struct debug_context *ctx,
|
||||
int argc,
|
||||
const char **argv,
|
||||
void *argp)
|
||||
{
|
||||
if (argc < 1) {
|
||||
printf("query information about the system\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
const struct command *subcmd
|
||||
= command_find(commands, nr_commands, argv[0]);
|
||||
if (!subcmd) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
command_execute(subcmd, ctx, argc - 1, argv + 1, argp);
|
||||
return 0;
|
||||
}
|
||||
|
||||
const struct command cmd_info = {
|
||||
.cmd_name = "info",
|
||||
.cmd_callback = info,
|
||||
};
|
||||
Reference in New Issue
Block a user