Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] Fix a bug in cmd_qtbuffer.
@ 2013-02-25  3:12 Yao Qi
  2013-02-26 11:23 ` Pedro Alves
  0 siblings, 1 reply; 3+ messages in thread
From: Yao Qi @ 2013-02-25  3:12 UTC (permalink / raw)
  To: gdb-patches

Hi,
When playing with packet "qTBuffer", I find a bug in cmd_qtbuffer.  We
don't have to set '\0' to OWN_BUF, because convert_int_to_ascii did
that.  On the other hand, it is incorrect to set '\0' to own_buf[num]
because convert_int_to_ascii writes 2 * num of bytes to OWN_BUF, it
is correct to set '\0' to own_buf[2 * num].  This patch fixes the bug
I found when using "qTBuffer".

Regression tested on x86_64-linux.  OK?

gdb/gdbserver:

2013-02-25  Yao Qi  <yao@codesourcery.com>

	* tracepoint.c (cmd_qtbuffer): Don't set '\0' in OWN_BUF.
---
 gdb/gdbserver/tracepoint.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/gdb/gdbserver/tracepoint.c b/gdb/gdbserver/tracepoint.c
index 95c55ad..ba681c4 100644
--- a/gdb/gdbserver/tracepoint.c
+++ b/gdb/gdbserver/tracepoint.c
@@ -4002,7 +4002,6 @@ cmd_qtbuffer (char *own_buf)
     num = (PBUFSIZ - 16) / 2;
 
   convert_int_to_ascii (tbp, own_buf, num);
-  own_buf[num] = '\0';
 }
 
 static void
-- 
1.7.7.6


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Fix a bug in cmd_qtbuffer.
  2013-02-25  3:12 [PATCH] Fix a bug in cmd_qtbuffer Yao Qi
@ 2013-02-26 11:23 ` Pedro Alves
  2013-02-26 14:14   ` Yao Qi
  0 siblings, 1 reply; 3+ messages in thread
From: Pedro Alves @ 2013-02-26 11:23 UTC (permalink / raw)
  To: Yao Qi; +Cc: gdb-patches

On 02/25/2013 03:11 AM, Yao Qi wrote:
> Hi,
> When playing with packet "qTBuffer", I find a bug in cmd_qtbuffer.  We
> don't have to set '\0' to OWN_BUF, because convert_int_to_ascii did
> that.  On the other hand, it is incorrect to set '\0' to own_buf[num]
> because convert_int_to_ascii writes 2 * num of bytes to OWN_BUF, it
> is correct to set '\0' to own_buf[2 * num].  This patch fixes the bug
> I found when using "qTBuffer".
> 
> Regression tested on x86_64-linux.  OK?

OK, thanks.

-- 
Pedro Alves


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Fix a bug in cmd_qtbuffer.
  2013-02-26 11:23 ` Pedro Alves
@ 2013-02-26 14:14   ` Yao Qi
  0 siblings, 0 replies; 3+ messages in thread
From: Yao Qi @ 2013-02-26 14:14 UTC (permalink / raw)
  To: gdb-patches

On 02/26/2013 07:23 PM, Pedro Alves wrote:
> On 02/25/2013 03:11 AM, Yao Qi wrote:
>> Hi,
>> When playing with packet "qTBuffer", I find a bug in cmd_qtbuffer.  We
>> don't have to set '\0' to OWN_BUF, because convert_int_to_ascii did
>> that.  On the other hand, it is incorrect to set '\0' to own_buf[num]
>> because convert_int_to_ascii writes 2 * num of bytes to OWN_BUF, it
>> is correct to set '\0' to own_buf[2 * num].  This patch fixes the bug
>> I found when using "qTBuffer".
>>
>> Regression tested on x86_64-linux.  OK?
>
> OK, thanks.
>

Thanks for the review.  Committed.

-- 
Yao (齐尧)


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-02-26 14:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-25  3:12 [PATCH] Fix a bug in cmd_qtbuffer Yao Qi
2013-02-26 11:23 ` Pedro Alves
2013-02-26 14:14   ` Yao Qi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox