Commit 1b2dd117a7172be2cbc4140e0e36ef4de3e8ef5a
authorNeil Spring <nspring@cs.umd.edu>
Sun, 1 Apr 2018 19:42:41 +0000 (15:42 -0400)
committerMichel Pollet <github.com@pollet.net>
Tue, 3 Apr 2018 07:39:31 +0000 (08:39 +0100)
simavr/sim/sim_gdb.c

index a0b7c2206a672277d7681fd9598e9f85eeff35a0..c706b2a01d5af7b9dda0ca2d124894fc33aaca6a 100644 (file)
@@ -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" :