From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10673 invoked by alias); 16 Feb 2013 04:02:16 -0000 Received: (qmail 10633 invoked by uid 22791); 16 Feb 2013 04:02:14 -0000 X-SWARE-Spam-Status: No, hits=-4.5 required=5.0 tests=AWL,BAYES_00,FROM_12LTRDOM,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL X-Spam-Check-By: sourceware.org Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 16 Feb 2013 04:02:09 +0000 Received: from svr-orw-fem-01.mgc.mentorg.com ([147.34.98.93]) by relay1.mentorg.com with esmtp id 1U6YyW-0004eM-Ei from Yao_Qi@mentor.com for gdb-patches@sourceware.org; Fri, 15 Feb 2013 20:02:08 -0800 Received: from SVR-ORW-FEM-03.mgc.mentorg.com ([147.34.97.39]) by svr-orw-fem-01.mgc.mentorg.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Fri, 15 Feb 2013 20:02:07 -0800 Received: from qiyao.dyndns.org.dyndns.org (147.34.91.1) by svr-orw-fem-03.mgc.mentorg.com (147.34.97.39) with Microsoft SMTP Server id 14.1.289.1; Fri, 15 Feb 2013 20:02:04 -0800 From: Yao Qi To: Subject: [PATCH 5/5] MI notification on trace stop: triggered by remote Date: Sat, 16 Feb 2013 04:02:00 -0000 Message-ID: <1360987214-16592-6-git-send-email-yao@codesourcery.com> In-Reply-To: <1360987214-16592-1-git-send-email-yao@codesourcery.com> References: <1358838232-13319-1-git-send-email-yao@codesourcery.com> <1360987214-16592-1-git-send-email-yao@codesourcery.com> MIME-Version: 1.0 Content-Type: text/plain X-IsSubscribed: yes 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 X-SW-Source: 2013-02/txt/msg00425.txt.bz2 As a result of previous patch, GDB has a Trace rsp notification. In this patch, GDB starts to use Trace notification, and emits MI notification '=trace-stopped' to front-end. A test case is added to see if MI trace-stopped notification is emitted when trace buffer is full. gdb: * remote-notif-trace.c: Include "observer.h". (remote_notif_trace_status_parse): Call observer_notify_trace_changed. gdb/testsuite: * gdb.trace/mi-trace-changed.exp (test_trace_buffer_full): New. --- gdb/remote-notif-trace.c | 11 ++++ gdb/testsuite/gdb.trace/mi-trace-changed.exp | 75 ++++++++++++++++++++++++++ 2 files changed, 86 insertions(+), 0 deletions(-) diff --git a/gdb/remote-notif-trace.c b/gdb/remote-notif-trace.c index a0cfa26..8c1e8a8 100644 --- a/gdb/remote-notif-trace.c +++ b/gdb/remote-notif-trace.c @@ -22,6 +22,7 @@ #include "remote.h" #include "tracepoint.h" #include "remote-notif.h" +#include "observer.h" static void remote_notif_trace_status_parse (struct notif_client *self, char *buf, @@ -31,6 +32,16 @@ remote_notif_trace_status_parse (struct notif_client *self, char *buf, gdb_assert (buf[0] == 'T'); parse_trace_status (buf + 1, ts); + + /* When the tracing is stopped, there is no changes anymore in + the trace, so the remote stub can't send another notification. + We don't have to worry about notifying 'trace_changed' observer + with argument 1 twice. + The remote stub can't request tracing start and the remote stub + may send multiple trace notifications on various status changes, + we don't notify 'trace_changed' observer with argument 0. */ + if (!ts->running) + observer_notify_trace_changed (0); } static void diff --git a/gdb/testsuite/gdb.trace/mi-trace-changed.exp b/gdb/testsuite/gdb.trace/mi-trace-changed.exp index fbd6fe7..9d6cfff 100644 --- a/gdb/testsuite/gdb.trace/mi-trace-changed.exp +++ b/gdb/testsuite/gdb.trace/mi-trace-changed.exp @@ -71,4 +71,79 @@ proc test_normal_tstart_stop { } { test_normal_tstart_stop +# Verify that MI notification '=trace-stopped' is emitted when trace +# buffer is full. + +proc test_trace_buffer_full { } { + with_test_prefix "tracebuffer full" { + global mi_gdb_prompt + + if [mi_gdb_start] { + return + } + mi_run_to_main + + mi_gdb_test "-break-insert -a func2" {.*\^done,bkpt=.*} \ + "insert tracepoint on func2" + + send_gdb "actions\n" + gdb_expect { + -re "End with" { + } + } + + send_gdb "collect buf\nend\n" + set test "define actions" + gdb_expect { + -re ".*${mi_gdb_prompt}$" { + pass $test + } + timeout { + fail "$test (timeout)" + } + } + + # No =trace-started notification. + mi_gdb_test "-trace-start" "-trace-start\r\n=breakpoint-modified\[^\n\]+\r\n\\^done" \ + "start trace without notification" + mi_gdb_test "-break-insert end" {.*\^done,bkpt=.*} \ + "insert breakpoint on end" + + mi_send_resuming_command "exec-continue" \ + "continuing execution to end" + + set test "trace-stopped triggered by bufferfull" + gdb_expect { + # We don't set stop-notes. + -re "=trace-stopped\\\\n" { + pass "$test" + } + timeout { + fail "$test (timeout)" + } + } + + global async + # In sync mode, eat all the output. Don't have to do so in + # async mode. + if {!$async} { + gdb_expect { + -re ".*${mi_gdb_prompt}$" { + } + } + } + # GDB has got the rsp notifcation from remote stub that trace + # is stopped. + mi_gdb_test "tstop" ".*Trace is not running.*" \ + "tstop on stopped" + + mi_gdb_test "-trace-status" ".*\\^done.*stop-reason=\"overflow\".*" \ + "trace-status" + + mi_gdb_exit + } +} + +test_trace_buffer_full + return 0 -- 1.7.7.6