toolchain: add new debugging tool using magenta_debug

This commit is contained in:
2026-06-06 17:54:20 +01:00
parent 5bb36a916c
commit a6bdcc6c49
40 changed files with 2211 additions and 1 deletions
+42
View File
@@ -0,0 +1,42 @@
#include "context.h"
#include "packet.h"
#include "repl.h"
#include <stdio.h>
void event_handle(struct debug_context *ctx, struct packet *event_packet)
{
const struct mxdbg_packet_event *event
= (const struct mxdbg_packet_event *)&event_packet->p_packet;
repl_suspend();
printf("EVENT: %s", mxdbg_event_type_get_description(event->ev_type));
size_t w;
struct packet *p = NULL;
switch (event->ev_type) {
case MXDBG_EVENT_TASK_CREATED: {
struct mxdbg_packet_identify_task id = {0};
mxdbg_packet_init(
&id.id_base,
sizeof id,
MXDBG_PACKET_IDENTIFY_TASK,
0);
id.id_task = event->ev_task;
printf(" %d", id.id_task);
debug_context_send_packet(ctx, &id.id_base);
p = debug_context_await_packet(ctx, MXDBG_PACKET_IDENTIFY_TASK);
struct mxdbg_packet_identify_task *resp
= (struct mxdbg_packet_identify_task *)&p->p_packet;
printf(" (%s)", resp->id_task_name);
packet_destroy(p);
break;
}
default:
break;
}
printf("\n");
repl_resume();
}