#include "context.h" #include "packet.h" #include "repl.h" #include 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(); }