toolchain: add new debugging tool using magenta_debug
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
#include "../command.h"
|
||||
#include "../packet.h"
|
||||
|
||||
#include <magenta/debug/packet.h>
|
||||
#include <stdio.h>
|
||||
|
||||
static int info_kernel(
|
||||
const struct command *cmd,
|
||||
struct debug_context *ctx,
|
||||
int argc,
|
||||
const char **argv,
|
||||
void *argp)
|
||||
{
|
||||
struct mxdbg_packet req;
|
||||
mxdbg_packet_init(&req, sizeof req, MXDBG_PACKET_IDENTIFY_KERNEL, 0);
|
||||
size_t r, w;
|
||||
debug_context_send_packet(ctx, &req);
|
||||
|
||||
struct packet *response
|
||||
= debug_context_await_packet(ctx, MXDBG_PACKET_IDENTIFY_KERNEL);
|
||||
|
||||
struct mxdbg_packet_identify_kernel *id
|
||||
= (struct mxdbg_packet_identify_kernel *)&response->p_packet;
|
||||
|
||||
printf("kernel identity: %s %s (%s)\n",
|
||||
id->id_kernel_name,
|
||||
id->id_kernel_version,
|
||||
id->id_kernel_arch);
|
||||
|
||||
packet_destroy(response);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
const struct command cmd_info_kernel = {
|
||||
.cmd_name = "kernel",
|
||||
.cmd_callback = info_kernel,
|
||||
};
|
||||
Reference in New Issue
Block a user