From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2529 invoked by alias); 24 Jan 2014 09:43:24 -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 2463 invoked by uid 89); 24 Jan 2014 09:43:24 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.6 required=5.0 tests=AWL,BAYES_00,FROM_12LTRDOM autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 24 Jan 2014 09:43:23 +0000 Received: from svr-orw-exc-10.mgc.mentorg.com ([147.34.98.58]) by relay1.mentorg.com with esmtp id 1W6dIF-0005vs-Ms from Yao_Qi@mentor.com for gdb-patches@sourceware.org; Fri, 24 Jan 2014 01:43:19 -0800 Received: from SVR-ORW-FEM-04.mgc.mentorg.com ([147.34.97.41]) by SVR-ORW-EXC-10.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675); Fri, 24 Jan 2014 01:43:19 -0800 Received: from qiyao.dyndns.org.dyndns.org (147.34.91.1) by svr-orw-fem-04.mgc.mentorg.com (147.34.97.41) with Microsoft SMTP Server id 14.2.247.3; Fri, 24 Jan 2014 01:43:18 -0800 From: Yao Qi To: Subject: [PATCH 5/5] New test case mi-trace-changed.exp Date: Fri, 24 Jan 2014 09:43:00 -0000 Message-ID: <1390556465-28796-6-git-send-email-yao@codesourcery.com> In-Reply-To: <1390556465-28796-1-git-send-email-yao@codesourcery.com> References: <1390556465-28796-1-git-send-email-yao@codesourcery.com> MIME-Version: 1.0 Content-Type: text/plain X-IsSubscribed: yes X-SW-Source: 2014-01/txt/msg00923.txt.bz2 This test case tests the MI notifications are triggered by either CLI commands or remote target. gdb/testsuite: * gdb.trace/mi-trace-changed.exp: New test case. --- gdb/testsuite/gdb.trace/mi-trace-changed.exp | 149 ++++++++++++++++++++++++++ 1 files changed, 149 insertions(+), 0 deletions(-) create mode 100644 gdb/testsuite/gdb.trace/mi-trace-changed.exp diff --git a/gdb/testsuite/gdb.trace/mi-trace-changed.exp b/gdb/testsuite/gdb.trace/mi-trace-changed.exp new file mode 100644 index 0000000..eec1e1e --- /dev/null +++ b/gdb/testsuite/gdb.trace/mi-trace-changed.exp @@ -0,0 +1,149 @@ +# Copyright 2014 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +load_lib mi-support.exp +load_lib trace-support.exp + +standard_testfile status-stop.c + +if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \ + executable {debug nowarnings}] != "" } { + untested mi-record-changed.exp + return -1 +} + +clean_restart $testfile + +if ![runto_main] { + fail "Can't run to main to check for trace support" + return -1 +} + +if ![gdb_target_supports_trace] { + unsupported "target does not support trace" + return -1; +} + +gdb_exit + +# Verify that MI notification '=trace-started' and '=trace-stopped' are +# emitted for normal 'tstart' and 'tstart' command. + +proc test_normal_tstart_stop { } { + with_test_prefix "tstart_tstop" { + global decimal hex + + if [mi_gdb_start] { + return + } + mi_run_to_main + + mi_gdb_test "-break-insert -a main" {.*\^done,bkpt=.*} \ + "insert tracepoint on main" + + # 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 "-trace-stop" \ + "-trace-stop\r\n\\^done,stop-reason=\"request\".*" \ + "stop trace without notification" + + mi_gdb_test "tstart" \ + ".*=trace-started.*\\^done" "start trace notification" + mi_gdb_test "tstop" ".*=trace-stopped\\\\n\r\n\\^done" \ + "stop trace notification" + + mi_gdb_exit + } +} + +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