From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23814 invoked by alias); 28 Mar 2013 19:12:01 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 23768 invoked by uid 89); 28 Mar 2013 19:11:54 -0000 X-Spam-SWARE-Status: No, score=-7.6 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,RCVD_IN_DNSWL_HI,RCVD_IN_HOSTKARMA_W,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.1 Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Thu, 28 Mar 2013 19:11:51 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r2SJBoEU013506 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 28 Mar 2013 15:11:50 -0400 Received: from brno.lan (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r2SJBmOb010107 for ; Thu, 28 Mar 2013 15:11:49 -0400 Subject: [PATCH] Stop sending qTStatus if the target doesn't recognize it; add packet configuration command. To: gdb-patches@sourceware.org From: Pedro Alves Date: Thu, 28 Mar 2013 21:41:00 -0000 Message-ID: <20130328191148.15126.83790.stgit@brno.lan> User-Agent: StGit/0.16 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-SW-Source: 2013-03/txt/msg01072.txt.bz2 GDB currently sends a qTStatus even if the target previously replied an empty packet to a previous qTStatus. If the target doesn't recognize the packet, there's no point in trying again. The machinery we have in place is packet_ok, which has the nice side effect of forcing one to install a configuration command/knob for the packet in question, which is often handy when you need to debug things, and/or emulate a target that doesn't support the packet, or even, it can be used as workaround for the old broken kgdb's that return error to qTSTatus instead of an empty packet. This needs a NEWS and docs review. gdb/ 2013-03-28 Pedro Alves * NEWS (New options): New section. (New options): Mention set/show remote trace-status-packet. * remote.c (PACKET_qTStatus): New enumeration value. (remote_get_trace_status): Skip sending qTStatus if the packet is disabled. Use packet_ok. (_initialize_remote): Register a configuration command for qTStatus packet. gdb/doc/ 2013-03-28 Pedro Alves * gdb.texinfo (Remote Configuration) : Add entry for "trace-status". --- gdb/doc/gdb.texinfo | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gdb/NEWS b/gdb/NEWS index 77a27f7..56b68d8 100644 --- a/gdb/NEWS +++ b/gdb/NEWS @@ -10,6 +10,12 @@ maint set|show per-command time maint set|show per-command symtab Enable display of per-command gdb resource usage. +* New options + +set remote trace-status-packet +show remote trace-status-packet + Set/show the use of remote protocol qTStatus packet. + * The command 'tsave' can now support new option '-ctf' to save trace buffer in Common Trace Format. diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index 38ce259..05ac6c0 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -18446,6 +18446,10 @@ are: @tab @code{qAttached} @tab Querying remote process attach state. +@item @code{trace-status} +@tab @code{qTStatus} +@tab @code{tstatus} + @item @code{traceframe-info} @tab @code{qXfer:traceframe-info:read} @tab Traceframe info diff --git a/gdb/remote.c b/gdb/remote.c index 8659953..b8a7a1a 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -1256,6 +1256,7 @@ enum { PACKET_qGetTIBAddr, PACKET_qGetTLSAddr, PACKET_qSupported, + PACKET_qTStatus, PACKET_QPassSignals, PACKET_QProgramSignals, PACKET_qSearch_memory, @@ -10689,6 +10690,10 @@ remote_get_trace_status (struct trace_status *ts) /* FIXME we need to get register block size some other way. */ extern int trace_regblock_size; volatile struct gdb_exception ex; + enum packet_result result; + + if (remote_protocol_packets[PACKET_qTStatus].support == PACKET_DISABLE) + return -1; trace_regblock_size = get_remote_arch_state ()->sizeof_g_packet; @@ -10707,8 +10712,10 @@ remote_get_trace_status (struct trace_status *ts) throw_exception (ex); } + result = packet_ok (p, &remote_protocol_packets[PACKET_qTStatus]); + /* If the remote target doesn't do tracing, flag it. */ - if (*p == '\0') + if (result == PACKET_UNKNOWN) return -1; /* We're working with a live target. */ @@ -11876,6 +11883,9 @@ Show the maximum size of the address (in bits) in a memory packet."), NULL, add_packet_config_cmd (&remote_protocol_packets[PACKET_qSearch_memory], "qSearch:memory", "search-memory", 0); + add_packet_config_cmd (&remote_protocol_packets[PACKET_qTStatus], + "qTStatus", "trace-status", 0); + add_packet_config_cmd (&remote_protocol_packets[PACKET_vFile_open], "vFile:open", "hostio-open", 0);