Skip to contentSkip to conversation

gdbstub: Fix client Ctrl-C handling

PATCH In review Nicholas Piggin 8 participants 13 messages Jul 11, 2023 – Aug 10, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gdbstub: Fix client Ctrl-C handling

The gdb remote protocol has a special interrupt character (0x03) that is transmitted outside the regular packet processing, and represents a Ctrl-C pressed in the client. Despite not being a regular packet, it does expect a regular stop response if the stub successfully stops the running program.

See: https://sourceware.org/gdb/onlinedocs/gdb/Interrupts.html

Inhibiting the stop reply packet can lead to gdb client hang. So permit a stop response when receiving a character from gdb that stops the vm. Additionally, add a warning if that was not a 0x03 character, because the gdb session is likely to end up getting confused if this happens.

Cc Matheus Tavares Bernardino <[email protected]>
Cc Alex Bennée <[email protected]>
Cc Taylor Simpson <[email protected]>
Fixes 758370052fb ("gdbstub: only send stop-reply packets when allowed to")

---
Hey Fred, I'm not sure if this is the gdb hang you were seeing, but it is the one I could reproduce. Could be worth checking there are no more corner case hangs after this.

Thanks,
Nick

 gdbstub/gdbstub.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
gdbstub/gdbstub.c +11 -2
index 6911b73c07..ce8b42eb15 100644
@@ -2051,8 +2051,17 @@ void gdb_read_byte(uint8_t ch)
             return;
     }
     if (runstate_is_running()) {
-        /* when the CPU is running, we cannot do anything except stop
-           it when receiving a char */
+        /*
+         * When the CPU is running, we cannot do anything except stop
+         * it when receiving a char. This is expected on a Ctrl-C in the
+         * gdb client. Because we are in all-stop mode, gdb sends a
+         * 0x03 byte which is not a usual packet, so we handle it specially
+         * here, but it does expect a stop reply.
+         */
+        if (ch != 0x03) {
+            warn_report("gdbstub: client sent packet while target running\n");
+        }
+        gdbserver_state.allow_stop_reply = true;
         vm_stop(RUN_STATE_PAUSED);
     } else
 #endif
Signature · 1 line
2.40.1
#1 lore raw
Quoted 16 lines

Nicholas Piggin <[email protected]> wrote:

gdbstub/gdbstub.c +4 -2
index 6911b73c07..ce8b42eb15 100644
@@ -2051,8 +2051,17 @@ void gdb_read_byte(uint8_t ch)
             return;
     }
     if (runstate_is_running()) {
-        /* when the CPU is running, we cannot do anything except stop
-           it when receiving a char */
+        /*
+         * When the CPU is running, we cannot do anything except stop
+         * it when receiving a char. This is expected on a Ctrl-C in the
+         * gdb client. Because we are in all-stop mode, gdb sends a

gdbstub/gdbstub.c void gdb_read_byte(uint8_t ch) · line 2067

Quoted 10 lines
gdbstub/gdbstub.c +7 -0
+         * 0x03 byte which is not a usual packet, so we handle it specially
+         * here, but it does expect a stop reply.
+         */
+        if (ch != 0x03) {
+            warn_report("gdbstub: client sent packet while target running\n");
+        }
+        gdbserver_state.allow_stop_reply = true;
         vm_stop(RUN_STATE_PAUSED);
     } else
 #endif

Makes sense to me, but shouldn't we send the stop-reply packet only for Ctrl+C/0x03?

#2 lore raw
Quoted 21 lines · Matheus Tavares Bernardino
Quoted 21 lines

Nicholas Piggin <[email protected]> wrote:

gdbstub/gdbstub.c +9 -2
index 6911b73c07..ce8b42eb15 100644
@@ -2051,8 +2051,17 @@ void gdb_read_byte(uint8_t ch)
             return;
     }
     if (runstate_is_running()) {
-        /* when the CPU is running, we cannot do anything except stop
-           it when receiving a char */
+        /*
+         * When the CPU is running, we cannot do anything except stop
+         * it when receiving a char. This is expected on a Ctrl-C in the
+         * gdb client. Because we are in all-stop mode, gdb sends a
+         * 0x03 byte which is not a usual packet, so we handle it specially
+         * here, but it does expect a stop reply.
+         */
+        if (ch != 0x03) {
+            warn_report("gdbstub: client sent packet while target running\n");
Quoted 8 lines

gdbstub/gdbstub.c void gdb_read_byte(uint8_t ch) · line 2067

Quoted 5 lines
gdbstub/gdbstub.c +2 -0
+        }
+        gdbserver_state.allow_stop_reply = true;
         vm_stop(RUN_STATE_PAUSED);
     } else
 #endif

Makes sense to me, but shouldn't we send the stop-reply packet only for Ctrl+C/0x03?

Good question.

I think if we get a character here that's not a 3, we're already in trouble, and we eat it so even worse. Since we only send a stop packet back when the vm stops, then if we don't send one now we might never send it. At least if we send one then the client might have some chance to get back to a sane state. And this does at least take us back to behaviour before the stop filtering patch.

Could go further and only stop the machine if it was a 3, or send a stop packet even if we were stopped, etc. but all that get further from a minimal fix.

Thanks,
Nick

#11 lore raw
In reply to Nicholas Piggin
Quoted 6 lines · Nicholas Piggin

The gdb remote protocol has a special interrupt character (0x03) that is transmitted outside the regular packet processing, and represents a Ctrl-C pressed in the client. Despite not being a regular packet, it does expect a regular stop response if the stub successfully stops the running program.

Quoted 8 lines

See: https://sourceware.org/gdb/onlinedocs/gdb/Interrupts.html

Inhibiting the stop reply packet can lead to gdb client hang. So permit a stop response when receiving a character from gdb that stops the vm. Additionally, add a warning if that was not a 0x03 character, because the gdb session is likely to end up getting confused if this happens.

Oh, I should note that this doesn't apply to any stable branches I'm sorry. Will be more careful with the tag...

Thanks,
Nick

#12 lore raw
Quoted 14 lines · Nicholas Piggin
Quoted 13 lines · Nicholas Piggin

The gdb remote protocol has a special interrupt character (0x03) that is transmitted outside the regular packet processing, and represents a Ctrl-C pressed in the client. Despite not being a regular packet, it does expect a regular stop response if the stub successfully stops the running program.

See: https://sourceware.org/gdb/onlinedocs/gdb/Interrupts.html

Inhibiting the stop reply packet can lead to gdb client hang. So permit a stop response when receiving a character from gdb that stops the vm. Additionally, add a warning if that was not a 0x03 character, because the gdb session is likely to end up getting confused if this happens.

Quoted 4 lines
Quoted 1 line

Oh, I should note that this doesn't apply to any stable branches I'm sorry. Will be more careful with the tag...

That's entirely Okay, since the Fixes: tag helps to determine if it fits or not, and 758370052fb is v8.0.0-803-g758370052f. It's worse to miss something important :)

Thank you!

/mjt

#3 lore raw
In reply to Nicholas Piggin
Quoted 41 lines · Nicholas Piggin
Quoted 21 lines · Matheus Tavares Bernardino
Quoted 21 lines

Nicholas Piggin <[email protected]> wrote:

gdbstub/gdbstub.c +9 -2
index 6911b73c07..ce8b42eb15 100644
@@ -2051,8 +2051,17 @@ void gdb_read_byte(uint8_t ch)
             return;
     }
     if (runstate_is_running()) {
-        /* when the CPU is running, we cannot do anything except stop
-           it when receiving a char */
+        /*
+         * When the CPU is running, we cannot do anything except stop
+         * it when receiving a char. This is expected on a Ctrl-C in the
+         * gdb client. Because we are in all-stop mode, gdb sends a
+         * 0x03 byte which is not a usual packet, so we handle it specially
+         * here, but it does expect a stop reply.
+         */
+        if (ch != 0x03) {
+            warn_report("gdbstub: client sent packet while target running\n");
Quoted 8 lines

gdbstub/gdbstub.c void gdb_read_byte(uint8_t ch) · line 2067

Quoted 5 lines
gdbstub/gdbstub.c +2 -0
+        }
+        gdbserver_state.allow_stop_reply = true;
         vm_stop(RUN_STATE_PAUSED);
     } else
 #endif

Makes sense to me, but shouldn't we send the stop-reply packet only for Ctrl+C/0x03?

Good question.

I think if we get a character here that's not a 3, we're already in trouble, and we eat it so even worse. Since we only send a stop packet back when the vm stops, then if we don't send one now we might never send it. At least if we send one then the client might have some chance to get back to a sane state. And this does at least take us back to behaviour before the stop filtering patch.

Quoted 3 lines

Could go further and only stop the machine if it was a 3, or send a stop packet even if we were stopped, etc. but all that get further from a minimal fix.

I was taking a look at -rc1 and it looks like this hasn't made it in. Is it something we want to propose including?

As a user of qemu I'd vote for it to go in.

Cheers,

Joel

#4 lore raw
Quoted 42 lines · Joel Stanley
Quoted 41 lines · Nicholas Piggin
Quoted 21 lines · Matheus Tavares Bernardino
Quoted 21 lines

Nicholas Piggin <[email protected]> wrote:

gdbstub/gdbstub.c +9 -2
index 6911b73c07..ce8b42eb15 100644
@@ -2051,8 +2051,17 @@ void gdb_read_byte(uint8_t ch)
             return;
     }
     if (runstate_is_running()) {
-        /* when the CPU is running, we cannot do anything except stop
-           it when receiving a char */
+        /*
+         * When the CPU is running, we cannot do anything except stop
+         * it when receiving a char. This is expected on a Ctrl-C in the
+         * gdb client. Because we are in all-stop mode, gdb sends a
+         * 0x03 byte which is not a usual packet, so we handle it specially
+         * here, but it does expect a stop reply.
+         */
+        if (ch != 0x03) {
+            warn_report("gdbstub: client sent packet while target running\n");
Quoted 8 lines

gdbstub/gdbstub.c void gdb_read_byte(uint8_t ch) · line 2067

Quoted 5 lines
gdbstub/gdbstub.c +2 -0
+        }
+        gdbserver_state.allow_stop_reply = true;
         vm_stop(RUN_STATE_PAUSED);
     } else
 #endif

Makes sense to me, but shouldn't we send the stop-reply packet only for Ctrl+C/0x03?

Good question.

I think if we get a character here that's not a 3, we're already in trouble, and we eat it so even worse. Since we only send a stop packet back when the vm stops, then if we don't send one now we might never send it. At least if we send one then the client might have some chance to get back to a sane state. And this does at least take us back to behaviour before the stop filtering patch.

Quoted 8 lines
Quoted 3 lines

Could go further and only stop the machine if it was a 3, or send a stop packet even if we were stopped, etc. but all that get further from a minimal fix.

I was taking a look at -rc1 and it looks like this hasn't made it in. Is it something we want to propose including?

As a user of qemu I'd vote for it to go in.

I think it should, gdb is hardly usable without it.

Thanks,
Nick

Tested-by
#5 lore raw
Quoted 48 lines · Nicholas Piggin
Quoted 46 lines · Joel Stanley
Quoted 44 lines · Nicholas Piggin
Quoted 21 lines · Matheus Tavares Bernardino
Quoted 21 lines

Nicholas Piggin <[email protected]> wrote:

gdbstub/gdbstub.c +9 -2
index 6911b73c07..ce8b42eb15 100644
@@ -2051,8 +2051,17 @@ void gdb_read_byte(uint8_t ch)
             return;
     }
     if (runstate_is_running()) {
-        /* when the CPU is running, we cannot do anything except stop
-           it when receiving a char */
+        /*
+         * When the CPU is running, we cannot do anything except stop
+         * it when receiving a char. This is expected on a Ctrl-C in the
+         * gdb client. Because we are in all-stop mode, gdb sends a
+         * 0x03 byte which is not a usual packet, so we handle it specially
+         * here, but it does expect a stop reply.
+         */
+        if (ch != 0x03) {
+            warn_report("gdbstub: client sent packet while target running\n");
Quoted 8 lines

gdbstub/gdbstub.c void gdb_read_byte(uint8_t ch) · line 2067

Quoted 5 lines
gdbstub/gdbstub.c +2 -0
+        }
+        gdbserver_state.allow_stop_reply = true;
         vm_stop(RUN_STATE_PAUSED);
     } else
 #endif

Makes sense to me, but shouldn't we send the stop-reply packet only for Ctrl+C/0x03?

Good question.

I think if we get a character here that's not a 3, we're already in trouble, and we eat it so even worse. Since we only send a stop packet back when the vm stops, then if we don't send one now we might never send it. At least if we send one then the client might have some chance to get back to a sane state. And this does at least take us back to behaviour before the stop filtering patch.

Could go further and only stop the machine if it was a 3, or send a stop packet even if we were stopped, etc. but all that get further from a minimal fix.

Quoted 6 lines
Quoted 4 lines

I was taking a look at -rc1 and it looks like this hasn't made it in. Is it something we want to propose including?

As a user of qemu I'd vote for it to go in.

I think it should, gdb is hardly usable without it.

I think I hit this issue when debugging u-boot in the aspeed arm machines. Your patch fixed things:

Alex, Philippe, can we get this queued for 8.1?

Cheers,

Joel

#6 lore raw
Quoted 55 lines · Joel Stanley
Quoted 53 lines · Nicholas Piggin
Quoted 50 lines · Joel Stanley
Quoted 41 lines · Nicholas Piggin
Quoted 21 lines · Matheus Tavares Bernardino
Quoted 21 lines

Nicholas Piggin <[email protected]> wrote:

gdbstub/gdbstub.c +9 -2
index 6911b73c07..ce8b42eb15 100644
@@ -2051,8 +2051,17 @@ void gdb_read_byte(uint8_t ch)
             return;
     }
     if (runstate_is_running()) {
-        /* when the CPU is running, we cannot do anything except stop
-           it when receiving a char */
+        /*
+         * When the CPU is running, we cannot do anything except stop
+         * it when receiving a char. This is expected on a Ctrl-C in the
+         * gdb client. Because we are in all-stop mode, gdb sends a
+         * 0x03 byte which is not a usual packet, so we handle it specially
+         * here, but it does expect a stop reply.
+         */
+        if (ch != 0x03) {
+            warn_report("gdbstub: client sent packet while target running\n");
Quoted 8 lines

gdbstub/gdbstub.c void gdb_read_byte(uint8_t ch) · line 2067

Quoted 5 lines
gdbstub/gdbstub.c +2 -0
+        }
+        gdbserver_state.allow_stop_reply = true;
         vm_stop(RUN_STATE_PAUSED);
     } else
 #endif

Makes sense to me, but shouldn't we send the stop-reply packet only for Ctrl+C/0x03?

Good question.

I think if we get a character here that's not a 3, we're already in trouble, and we eat it so even worse. Since we only send a stop packet back when the vm stops, then if we don't send one now we might never send it. At least if we send one then the client might have some chance to get back to a sane state. And this does at least take us back to behaviour before the stop filtering patch.

Quoted 3 lines

Could go further and only stop the machine if it was a 3, or send a stop packet even if we were stopped, etc. but all that get further from a minimal fix.

I was taking a look at -rc1 and it looks like this hasn't made it in. Is it something we want to propose including?

As a user of qemu I'd vote for it to go in.

Quoted 8 lines
Quoted 1 line

I think it should, gdb is hardly usable without it.

I think I hit this issue when debugging u-boot in the aspeed arm machines. Your patch fixed things:

Alex, Philippe, can we get this queued for 8.1?

I'm doing a pullreq today anyway, so I can grab it.

thanks
-- PMM

#8 lore raw
In reply to Nicholas Piggin

Hi, Nick.

Quoted 33 lines

Nicholas Piggin <[email protected]> wrote:

Quoted 21 lines · Matheus Tavares Bernardino
Quoted 21 lines

Nicholas Piggin <[email protected]> wrote:

gdbstub/gdbstub.c +9 -2
index 6911b73c07..ce8b42eb15 100644
@@ -2051,8 +2051,17 @@ void gdb_read_byte(uint8_t ch)
             return;
     }
     if (runstate_is_running()) {
-        /* when the CPU is running, we cannot do anything except stop
-           it when receiving a char */
+        /*
+         * When the CPU is running, we cannot do anything except stop
+         * it when receiving a char. This is expected on a Ctrl-C in the
+         * gdb client. Because we are in all-stop mode, gdb sends a
+         * 0x03 byte which is not a usual packet, so we handle it specially
+         * here, but it does expect a stop reply.
+         */
+        if (ch != 0x03) {
+            warn_report("gdbstub: client sent packet while target running\n");
Quoted 8 lines

gdbstub/gdbstub.c void gdb_read_byte(uint8_t ch) · line 2067

Quoted 5 lines
gdbstub/gdbstub.c +2 -0
+        }
+        gdbserver_state.allow_stop_reply = true;
         vm_stop(RUN_STATE_PAUSED);
     } else
 #endif

Makes sense to me, but shouldn't we send the stop-reply packet only for Ctrl+C/0x03?

Quoted 7 lines

Good question.

I think if we get a character here that's not a 3, we're already in trouble, and we eat it so even worse. Since we only send a stop packet back when the vm stops, then if we don't send one now we might never send it. At least if we send one then the client might have some chance to get back to a sane state.

I just noticed now (as I was integrating the latest upstream patches with our downstream qemu-system-hexagon) that this causes the gdbstub-untimely-packet tcg test to fail.

My first thought was that, if 0x3 is the only valid case where we will read a char when the cpu is running, perhaps not issuing the stop-reply isn't that bad as GDB would ignore it anyways. E.g. from a set debug remote 1 output:

  Sending packet: $qSupported:multiprocess+;swbreak+;hwbreak+;qRelocInsn+;
                   fork-events+;vfork-events+;exec-events+;vContSupported+;
		   QThreadEvents+;no-resumed+;
		   xmlRegisters=i386#6a...

Packet instead of Ack, ignoring it

So, perhaps, we could do:

gdbstub/gdbstub.c +2 -1
index f123b40ce7..8af066301a 100644
@@ -2055,8 +2055,9 @@ void gdb_read_byte(uint8_t ch)
          */
         if (ch != 0x03) {
             warn_report("gdbstub: client sent packet while target running\n");
+        } else {
+            gdbserver_state.allow_stop_reply = true;
         }
-        gdbserver_state.allow_stop_reply = true;
         vm_stop(RUN_STATE_PAUSED);
     } else
 #endif

-- >8 --

Alternatively, since GDB ignores the packet anyways, should we just let this be and refactor/remove the test?

#7 lore raw
In reply to Peter Maydell
Quoted 15 lines · Peter Maydell
Quoted 14 lines · Joel Stanley
Quoted 11 lines · Nicholas Piggin
Quoted 7 lines · Joel Stanley

On Wed, 12 Jul 2023 at 02:12, Nicholas Piggin <[email protected]> wrote:

I was taking a look at -rc1 and it looks like this hasn't made it in. Is it something we want to propose including?

As a user of qemu I'd vote for it to go in.

I think it should, gdb is hardly usable without it.

Quoted 8 lines
Quoted 6 lines

I think I hit this issue when debugging u-boot in the aspeed arm machines. Your patch fixed things:

Alex, Philippe, can we get this queued for 8.1?

I'm doing a pullreq today anyway, so I can grab it.

Thank you Peter!

#9 lore raw
In reply to Matheus Tavares Bernardino
Quoted 77 lines · Matheus Tavares Bernardino

Hi, Nick.

Quoted 33 lines

Nicholas Piggin <[email protected]> wrote:

Quoted 21 lines · Matheus Tavares Bernardino
Quoted 21 lines

Nicholas Piggin <[email protected]> wrote:

gdbstub/gdbstub.c +9 -2
index 6911b73c07..ce8b42eb15 100644
@@ -2051,8 +2051,17 @@ void gdb_read_byte(uint8_t ch)
              return;
      }
      if (runstate_is_running()) {
-        /* when the CPU is running, we cannot do anything except stop
-           it when receiving a char */
+        /*
+         * When the CPU is running, we cannot do anything except stop
+         * it when receiving a char. This is expected on a Ctrl-C in the
+         * gdb client. Because we are in all-stop mode, gdb sends a
+         * 0x03 byte which is not a usual packet, so we handle it specially
+         * here, but it does expect a stop reply.
+         */
+        if (ch != 0x03) {
+            warn_report("gdbstub: client sent packet while target running\n");
Quoted 8 lines

gdbstub/gdbstub.c void gdb_read_byte(uint8_t ch) · line 2063

Quoted 5 lines
gdbstub/gdbstub.c +2 -0
+        }
+        gdbserver_state.allow_stop_reply = true;
          vm_stop(RUN_STATE_PAUSED);
      } else
  #endif

Makes sense to me, but shouldn't we send the stop-reply packet only for Ctrl+C/0x03?

Quoted 7 lines

Good question.

I think if we get a character here that's not a 3, we're already in trouble, and we eat it so even worse. Since we only send a stop packet back when the vm stops, then if we don't send one now we might never send it. At least if we send one then the client might have some chance to get back to a sane state.

I just noticed now (as I was integrating the latest upstream patches with our downstream qemu-system-hexagon) that this causes the gdbstub-untimely-packet tcg test to fail.

My first thought was that, if 0x3 is the only valid case where we will read a char when the cpu is running, perhaps not issuing the stop-reply isn't that bad as GDB would ignore it anyways. E.g. from a set debug remote 1 output:

   Sending packet: $qSupported:multiprocess+;swbreak+;hwbreak+;qRelocInsn+;
                    fork-events+;vfork-events+;exec-events+;vContSupported+;
		   QThreadEvents+;no-resumed+;
		   xmlRegisters=i386#6a...
   Packet instead of Ack, ignoring it

So, perhaps, we could do:

gdbstub/gdbstub.c +2 -2
index f123b40ce7..8af066301a 100644
@@ -2055,8 +2055,9 @@ void gdb_read_byte(uint8_t ch)
           */
          if (ch != 0x03) {
              warn_report("gdbstub: client sent packet while target running\n");
+        } else {
+            gdbserver_state.allow_stop_reply = true;
          }
-        gdbserver_state.allow_stop_reply = true;
          vm_stop(RUN_STATE_PAUSED);
      } else
  #endif
-- >8 --
Quoted 2 lines

Alternatively, since GDB ignores the packet anyways, should we just let this be and refactor/remove the test?

Ping, Alex and Nick.

I can confirm that Matheus' patch fixes the problem I am seeing. But I'm also open to removing the test.

r~

#10 lore raw
In reply to Matheus Tavares Bernardino
Quoted 65 lines · Matheus Tavares Bernardino

Hi, Nick.

Quoted 33 lines

Nicholas Piggin <[email protected]> wrote:

Quoted 21 lines · Matheus Tavares Bernardino
Quoted 21 lines

Nicholas Piggin <[email protected]> wrote:

gdbstub/gdbstub.c +9 -2
index 6911b73c07..ce8b42eb15 100644
@@ -2051,8 +2051,17 @@ void gdb_read_byte(uint8_t ch)
             return;
     }
     if (runstate_is_running()) {
-        /* when the CPU is running, we cannot do anything except stop
-           it when receiving a char */
+        /*
+         * When the CPU is running, we cannot do anything except stop
+         * it when receiving a char. This is expected on a Ctrl-C in the
+         * gdb client. Because we are in all-stop mode, gdb sends a
+         * 0x03 byte which is not a usual packet, so we handle it specially
+         * here, but it does expect a stop reply.
+         */
+        if (ch != 0x03) {
+            warn_report("gdbstub: client sent packet while target running\n");
Quoted 8 lines

gdbstub/gdbstub.c void gdb_read_byte(uint8_t ch) · line 2063

Quoted 5 lines
gdbstub/gdbstub.c +2 -0
+        }
+        gdbserver_state.allow_stop_reply = true;
         vm_stop(RUN_STATE_PAUSED);
     } else
 #endif

Makes sense to me, but shouldn't we send the stop-reply packet only for Ctrl+C/0x03?

Quoted 7 lines

Good question.

I think if we get a character here that's not a 3, we're already in trouble, and we eat it so even worse. Since we only send a stop packet back when the vm stops, then if we don't send one now we might never send it. At least if we send one then the client might have some chance to get back to a sane state.

I just noticed now (as I was integrating the latest upstream patches with our downstream qemu-system-hexagon) that this causes the gdbstub-untimely-packet tcg test to fail.

My first thought was that, if 0x3 is the only valid case where we will read a char when the cpu is running, perhaps not issuing the stop-reply isn't that bad as GDB would ignore it anyways. E.g. from a set debug remote 1 output:

  Sending packet: $qSupported:multiprocess+;swbreak+;hwbreak+;qRelocInsn+;
                   fork-events+;vfork-events+;exec-events+;vContSupported+;
		   QThreadEvents+;no-resumed+;
		   xmlRegisters=i386#6a...

Packet instead of Ack, ignoring it

So, perhaps, we could do:

gdbstub/gdbstub.c +0 -0
index f123b40ce7..8af066301a 100644

gdbstub/gdbstub.c void gdb_read_byte(uint8_t ch) · line 2058

Quoted 4 lines
gdbstub/gdbstub.c +0 -0
@@ -2055,8 +2055,9 @@ void gdb_read_byte(uint8_t ch)
          */
         if (ch != 0x03) {
             warn_report("gdbstub: client sent packet while target
 running\n");

This warning seems to be triggering either way, investigating now.

Quoted 11 lines
gdbstub/gdbstub.c +2 -1
+        } else {
+            gdbserver_state.allow_stop_reply = true;
         }
-        gdbserver_state.allow_stop_reply = true;
         vm_stop(RUN_STATE_PAUSED);
     } else

#endif
-- >8 --

Alternatively, since GDB ignores the packet anyways, should we just let this be and refactor/remove the test?

Signature · 2 lines
Alex Bennée
Virtualisation Tech Lead @ Linaro