static int r_debug_wind_wait (RDebug *dbg, int pid) { # define STATE_EXCEPTION 0x3030 kd_packet_t *pkt; kd_stc_64 *stc; int ret; r_cons_break (wstatic_debug_break, dbg); dbreak = 0; for (;;) { ret = wind_wait_packet (wctx, KD_PACKET_TYPE_STATE_CHANGE, &pkt); if (dbreak) { dbreak = 0; wind_break (wctx); continue; } if (ret != KD_E_OK || !pkt) break; stc = (kd_stc_64 *)pkt->data; // Handle exceptions only if (stc->state == STATE_EXCEPTION) { wind_set_cpu (wctx, stc->cpu); free (pkt); dbg->reason.type = R_DEBUG_REASON_INT; dbg->reason.addr = stc->pc; dbg->reason.tid = stc->kthread; dbg->reason.signum = stc->state; break; } else wind_continue (wctx); free(pkt); } // TODO : Set the faulty process as target return R_TRUE; }
static int r_debug_wind_wait (RDebug *dbg, int pid) { kd_packet_t *pkt; kd_stc_64 *stc; for (;;) { int ret = wind_wait_packet (wctx, KD_PACKET_TYPE_STATE_CHANGE, &pkt); if (ret != KD_E_OK || !pkt) break; stc = (kd_stc_64 *)pkt->data; // Handle exceptions only if (stc->state == 0x3030) { wind_set_cpu (wctx, stc->cpu); free (pkt); dbg->reason = R_DBG_REASON_INT; break; } else wind_continue (wctx); free(pkt); } // TODO : Set the faulty process as target return R_TRUE; }
static int do_io_reply (WindCtx *ctx, kd_packet_t *pkt) { kd_ioc_t ioc = {0}; int ret; ioc.req = 0x3430; ioc.ret = KD_RET_ENOENT; ret = kd_send_data_packet (ctx->io_ptr, KD_PACKET_TYPE_IO, (ctx->seq_id ^= 1), (uint8_t *)&ioc, sizeof (kd_ioc_t), NULL, 0); if (ret != KD_E_OK) return false; WIND_DBG eprintf("Waiting for io_reply ack...\n"); ret = wind_wait_packet(ctx, KD_PACKET_TYPE_ACK, NULL); if (ret != KD_E_OK) return false; WIND_DBG eprintf("Ack received, restore flow\n"); return true; }