This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: Is "QTBuffer:size" a packet, or "QTBuffer:" plus an argument?
On 02/17/2012 07:49 AM, Yao Qi wrote:
> On 02/16/2012 01:22 AM, Pedro Alves wrote:
>> One question this raises is, is the right response to
>> QTBuffer:size:ffffffff, "E01", or an empty reply, indicating packet
>> not supported? IOW, are QTBuffer:size and QTBuffer:circular two
>> different packets, or a single QTBuffer: packet with different
>> arguments? This makes a difference if GDB is to gracefully detect
>> when the target side doesn't support QTBuffer:foo.
>
> IMO, "QTBuffer" is the packet, and "size" is an argument.
> I hope the right response to QTBuffer:size:ffffffff is an empty reply, means
> remote stubs don't support QTBuffer:size. Reply "E01" means remote stub
> supports QTBuffer:size, but unable to meet this request, due to some
> reasons, limited memory, for example.
Thing is empty reply implies it's a different packet, so we can't
have both. I also think the right answer is empty reply. I realized
we also consider the qXfer:$obj:read different packets, so there's
precedent for thinking of `:' as part of the packet. BTW, the packet
is documented as:
@item QTBuffer:circular:@var{value}
This packet directs the target to use a circular trace buffer if
@var{value} is 1, or a linear buffer if the value is 0.
So I don't think anything needs to change there.
So here's the patch I propose to check in.
2012-02-20 Pedro Alves <palves@redhat.com>
* tracepoint.c (cmd_bigqtbuffer): Rename as ...
(cmd_bigqtbuffer_circular): ... this. Only handle
'QTBuffer:circular:'.
(handle_tracepoint_general_set): Adjust.
---
gdb/gdbserver/tracepoint.c | 24 +++++++++---------------
1 files changed, 9 insertions(+), 15 deletions(-)
diff --git a/gdb/gdbserver/tracepoint.c b/gdb/gdbserver/tracepoint.c
index 5c565fe..cd58c2d 100644
--- a/gdb/gdbserver/tracepoint.c
+++ b/gdb/gdbserver/tracepoint.c
@@ -3794,24 +3794,18 @@ cmd_qtbuffer (char *own_buf)
}
static void
-cmd_bigqtbuffer (char *own_buf)
+cmd_bigqtbuffer_circular (char *own_buf)
{
ULONGEST val;
char *packet = own_buf;
- packet += strlen ("QTBuffer:");
+ packet += strlen ("QTBuffer:circular:");
- if (strncmp ("circular:", packet, strlen ("circular:")) == 0)
- {
- packet += strlen ("circular:");
- unpack_varlen_hex (packet, &val);
- circular_trace_buffer = val;
- trace_debug ("Trace buffer is now %s",
- circular_trace_buffer ? "circular" : "linear");
- write_ok (own_buf);
- }
- else
- write_enn (own_buf);
+ unpack_varlen_hex (packet, &val);
+ circular_trace_buffer = val;
+ trace_debug ("Trace buffer is now %s",
+ circular_trace_buffer ? "circular" : "linear");
+ write_ok (own_buf);
}
static void
@@ -3930,9 +3924,9 @@ handle_tracepoint_general_set (char *packet)
cmd_qtframe (packet);
return 1;
}
- else if (strncmp ("QTBuffer:", packet, strlen ("QTBuffer:")) == 0)
+ else if (strncmp ("QTBuffer:circular:", packet, strlen ("QTBuffer:circular:")) == 0)
{
- cmd_bigqtbuffer (packet);
+ cmd_bigqtbuffer_circular (packet);
return 1;
}
else if (strncmp ("QTNotes:", packet, strlen ("QTNotes:")) == 0)