This commit is contained in:
Simon Gellis 2024-10-10 18:05:25 -04:00
parent 431377f92e
commit 57403690ff
1 changed files with 15 additions and 4 deletions

19
main.c
View File

@ -46,14 +46,23 @@ int server(int connfd, VB *sim) {
return 0; return 0;
} else if (read_result == read_result_pending) { } else if (read_result == read_result_pending) {
if (running) { if (running) {
/*
cycles = MAX_STEP_CYCLES; cycles = MAX_STEP_CYCLES;
brk = vbEmulate(sim, &cycles); brk = vbEmulate(sim, &cycles);
*/
cycles = 0;
brk = 0;
if (brk) { if (brk) {
/* We hit a breakpoint */ /* We hit a breakpoint */
if (brk == -1) {
/* actually, not implemented */
running = false;
rdb_response_begin_packet(&res);
rdb_response_write_str(&res, "T05:thread:p1.t1;threads:p1.t1;");
result = rdb_response_send_packet(&res);
if (result != 0) {
return result;
}
} else {
fprintf(stderr, "surprising response %d from vbEmulate\n", brk);
return -1;
}
} else { } else {
sleep_nanos((MAX_STEP_CYCLES - cycles) * 50); sleep_nanos((MAX_STEP_CYCLES - cycles) * 50);
} }
@ -137,9 +146,11 @@ int main(int argc, char** argv) {
return 1; return 1;
} }
/* relevant state at the start of the physics sim's main */ /* relevant state at the start of the physics sim's main */
/*
vbSetProgramCounter(sim, 0x070002ba); vbSetProgramCounter(sim, 0x070002ba);
vbSetProgramRegister(sim, 3, 0x0500ffc0); vbSetProgramRegister(sim, 3, 0x0500ffc0);
vbSetProgramRegister(sim, 4, 0x05008000); vbSetProgramRegister(sim, 4, 0x05008000);
*/
if (argc > 2) { if (argc > 2) {
char *end; char *end;