Patchwork Close Gdb stub connection in gdb_exit

login
register
mail settings
Submitter Fabien Chouteau
Date Jan. 4, 2011, 10:27 a.m.
Message ID <a8ac13b48a00dbb6e633204fbee460f2396f95a1.1294136554.git.chouteau@adacore.com>
Download mbox | patch
Permalink /patch/77446/
State New
Headers show

Comments

Fabien Chouteau - Jan. 4, 2011, 10:27 a.m.
On Windows, this is required to flush the remaining data in the IO stream,
otherwise Gdb do not receive the last packet.

Signed-off-by: Fabien Chouteau <chouteau@adacore.com>
---
 gdbstub.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
Fabien Chouteau - Jan. 13, 2011, 9:24 a.m.
On 01/04/2011 11:27 AM, Fabien Chouteau wrote:
> On Windows, this is required to flush the remaining data in the IO stream,
> otherwise Gdb do not receive the last packet.
>
> Signed-off-by: Fabien Chouteau<chouteau@adacore.com>
> ---
>   gdbstub.c |    4 ++++
>   1 files changed, 4 insertions(+), 0 deletions(-)
>
> diff --git a/gdbstub.c b/gdbstub.c
> index 0aa081b..dac3ce6 100644
> --- a/gdbstub.c
> +++ b/gdbstub.c
> @@ -2391,6 +2391,10 @@ void gdb_exit(CPUState *env, int code)
>
>     snprintf(buf, sizeof(buf), "W%02x", (uint8_t)code);
>     put_packet(s, buf);
> +
> +  if (s->chr) {
> +      qemu_chr_close(s->chr);
> +  }
>   }
>
>   #ifdef CONFIG_USER_ONLY

Any comment on this patch?
Edgar Iglesias - Jan. 13, 2011, 11:01 a.m.
On Thu, Jan 13, 2011 at 10:24:50AM +0100, Fabien Chouteau wrote:
> On 01/04/2011 11:27 AM, Fabien Chouteau wrote:
> > On Windows, this is required to flush the remaining data in the IO stream,
> > otherwise Gdb do not receive the last packet.
> >
> > Signed-off-by: Fabien Chouteau<chouteau@adacore.com>
> > ---
> >   gdbstub.c |    4 ++++
> >   1 files changed, 4 insertions(+), 0 deletions(-)
> >
> > diff --git a/gdbstub.c b/gdbstub.c
> > index 0aa081b..dac3ce6 100644
> > --- a/gdbstub.c
> > +++ b/gdbstub.c
> > @@ -2391,6 +2391,10 @@ void gdb_exit(CPUState *env, int code)
> >
> >     snprintf(buf, sizeof(buf), "W%02x", (uint8_t)code);
> >     put_packet(s, buf);
> > +
> > +  if (s->chr) {
> > +      qemu_chr_close(s->chr);
> > +  }
> >   }
> >
> >   #ifdef CONFIG_USER_ONLY
> 
> Any comment on this patch?

Yes, sorry for the delays. This patch breaks the linux-user build.

Cheers
Fabien Chouteau - Jan. 13, 2011, 11:44 a.m.
On 01/13/2011 12:01 PM, Edgar E. Iglesias wrote:
> On Thu, Jan 13, 2011 at 10:24:50AM +0100, Fabien Chouteau wrote:
>> On 01/04/2011 11:27 AM, Fabien Chouteau wrote:
>>> On Windows, this is required to flush the remaining data in the IO stream,
>>> otherwise Gdb do not receive the last packet.
>>>
>>> Signed-off-by: Fabien Chouteau<chouteau@adacore.com>
>>> ---
>>>    gdbstub.c |    4 ++++
>>>    1 files changed, 4 insertions(+), 0 deletions(-)
>>>
>>> diff --git a/gdbstub.c b/gdbstub.c
>>> index 0aa081b..dac3ce6 100644
>>> --- a/gdbstub.c
>>> +++ b/gdbstub.c
>>> @@ -2391,6 +2391,10 @@ void gdb_exit(CPUState *env, int code)
>>>
>>>      snprintf(buf, sizeof(buf), "W%02x", (uint8_t)code);
>>>      put_packet(s, buf);
>>> +
>>> +  if (s->chr) {
>>> +      qemu_chr_close(s->chr);
>>> +  }
>>>    }
>>>
>>>    #ifdef CONFIG_USER_ONLY
>>
>> Any comment on this patch?
>
> Yes, sorry for the delays. This patch breaks the linux-user build.

thanks,
I'll send new version in a minute.

Patch

diff --git a/gdbstub.c b/gdbstub.c
index 0aa081b..dac3ce6 100644
--- a/gdbstub.c
+++ b/gdbstub.c
@@ -2391,6 +2391,10 @@  void gdb_exit(CPUState *env, int code)
 
   snprintf(buf, sizeof(buf), "W%02x", (uint8_t)code);
   put_packet(s, buf);
+
+  if (s->chr) {
+      qemu_chr_close(s->chr);
+  }
 }
 
 #ifdef CONFIG_USER_ONLY