Skip to content

Commit

Permalink
Merge pull request buserror#499 from gatk555/gdb_burst
Browse files Browse the repository at this point in the history
Speed execution with GDB
  • Loading branch information
buserror authored Jul 18, 2022
2 parents 403392a + 78b6508 commit 7003af0
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions simavr/sim/sim_gdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,17 @@ typedef struct {
} points[WATCH_LIMIT];
} avr_gdb_watchpoints_t;

/* How many AVR instructions to execute before looking for gdb input. */

#define GDB_BURST 256

typedef struct avr_gdb_t {
avr_t * avr;
int listen; // listen socket
int s; // current gdb connection
int burst_count; // Current instruction burst size
int listen; // listen socket
int s; // current gdb connection

avr_gdb_watchpoints_t breakpoints;
avr_gdb_watchpoints_t breakpoints;
avr_gdb_watchpoints_t watchpoints;

// These are used by gdb's "info io_registers" command.
Expand Down Expand Up @@ -789,6 +794,7 @@ gdb_network_handler(
int max;
FD_ZERO(&read_set);

g->burst_count = 0; // Reset burst count
if (g->s != -1) {
FD_SET(g->s, &read_set);
max = g->s + 1;
Expand Down Expand Up @@ -934,8 +940,12 @@ avr_gdb_processor(
} else if (avr->state == cpu_StepDone) {
gdb_send_quick_status(g, 0);
avr->state = cpu_Stopped;
} else {
/* Look for gdb input every GDB_BURST instructions. */

if (sleep == 0 && g->burst_count++ < GDB_BURST)
return 0;
}
// this also sleeps for a bit
return gdb_network_handler(g, sleep);
}

Expand Down

0 comments on commit 7003af0

Please sign in to comment.