From 1b2dd117a7172be2cbc4140e0e36ef4de3e8ef5a Mon Sep 17 00:00:00 2001 From: Neil Spring Date: Sun, 1 Apr 2018 15:42:41 -0400 Subject: [PATCH] use READ_SREG_INTO rather than g->avr->data[R_SREG] to get current sreg status for export to gdb --- simavr/sim/sim_gdb.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/simavr/sim/sim_gdb.c b/simavr/sim/sim_gdb.c index a0b7c22..c706b2a 100644 --- a/simavr/sim/sim_gdb.c +++ b/simavr/sim/sim_gdb.c @@ -199,9 +199,12 @@ gdb_send_quick_status( uint8_t signal ) { char cmd[64]; + uint8_t sreg; + + READ_SREG_INTO(g->avr, sreg); sprintf(cmd, "T%02x20:%02x;21:%02x%02x;22:%02x%02x%02x00;", - signal ? signal : 5, g->avr->data[R_SREG], + signal ? signal : 5, sreg, g->avr->data[R_SPL], g->avr->data[R_SPH], g->avr->pc & 0xff, (g->avr->pc>>8)&0xff, (g->avr->pc>>16)&0xff); gdb_send_reply(g, cmd); @@ -577,8 +580,11 @@ avr_gdb_handle_watchpoints( if (kind & type) { /* Send gdb reply (see GDB user manual appendix E.3). */ char cmd[78]; + uint8_t sreg; + + READ_SREG_INTO(g->avr, sreg); sprintf(cmd, "T%02x20:%02x;21:%02x%02x;22:%02x%02x%02x00;%s:%06x;", - 5, g->avr->data[R_SREG], + 5, sreg, g->avr->data[R_SPL], g->avr->data[R_SPH], g->avr->pc & 0xff, (g->avr->pc>>8)&0xff, (g->avr->pc>>16)&0xff, kind & AVR_GDB_WATCH_ACCESS ? "awatch" : -- 2.39.5