From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28662 invoked by alias); 25 Feb 2013 03:10:10 -0000 Received: (qmail 28614 invoked by uid 22791); 25 Feb 2013 03:10:04 -0000 X-SWARE-Spam-Status: No, hits=-4.5 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL,TW_EG,TW_TD 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; Mon, 25 Feb 2013 03:09:59 +0000 Received: from svr-orw-fem-01.mgc.mentorg.com ([147.34.98.93]) by relay1.mentorg.com with esmtp id 1U9oRy-0000Uz-Tx from Yao_Qi@mentor.com for gdb-patches@sourceware.org; Sun, 24 Feb 2013 19:09:58 -0800 Received: from SVR-ORW-FEM-05.mgc.mentorg.com ([147.34.97.43]) by svr-orw-fem-01.mgc.mentorg.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Sun, 24 Feb 2013 19:09:58 -0800 Received: from qiyao.dyndns.org (147.34.91.1) by svr-orw-fem-05.mgc.mentorg.com (147.34.97.43) with Microsoft SMTP Server id 14.1.289.1; Sun, 24 Feb 2013 19:09:57 -0800 Message-ID: <512AD5CA.50606@codesourcery.com> Date: Mon, 25 Feb 2013 03:10:00 -0000 From: Yao Qi User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-Version: 1.0 To: Subject: Re: [PATCH 1/2] Check trace data from trace file References: <1361761061-9625-1-git-send-email-yao@codesourcery.com> In-Reply-To: <1361761061-9625-1-git-send-email-yao@codesourcery.com> Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit 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/msg00613.txt.bz2 Here is the same patch with spaces ignored. It is easier to read. Note that I modified a matched pattern "PC register is not available" for tfile target, as the regcache is not available when switch to tfind mode (no regcache has been read out of 'R' block yet). diff --git a/gdb/testsuite/gdb.trace/report.exp b/gdb/testsuite/gdb.trace/report.exp index e8aa597..6139485 100644 --- a/gdb/testsuite/gdb.trace/report.exp +++ b/gdb/testsuite/gdb.trace/report.exp @@ -181,20 +181,36 @@ gdb_test "continue" \ gdb_test "tstop" ".*" "" +gdb_tfind_test "9.1: init: make sure not debugging any trace frame" \ + "none" "-1" + +# 9.3 help tdump + +gdb_test "help tdump" "Print everything collected at the current.*" \ + "9.3: help tdump" + +# Check the collected trace data from different sources, such as live +# infeiror and tfile. + +proc use_collected_data { data_source } { with_test_prefix "${data_source}" { + global tdp1 tdp2 tdp3 tdp4 tdp5 tdp6 + global testline1 testline2 testline3 testline4 testline5 testline6 + global pcreg fpreg spreg + global srcfile srcdir subdir + global arg1 arg3 + global decimal hex gdb_prompt # # 9.1 test the tdump command # set timeout 60 -gdb_tfind_test "9.1: init: make sure not debugging any trace frame" "none" "-1" - gdb_tfind_test "9.1: find frame for TP $tdp1" "tracepoint $tdp1" \ "\$tracepoint" "$tdp1" # Nothing was collected at tdp1, so this tdump should be empty. gdb_test "tdump" \ - "Data collected at tracepoint $tdp1, trace frame $decimal:" \ + "Data collected at tracepoint $tdp1, trace frame $decimal:\(\|\\r\\nPC register is not available\)" \ "9.1: tdump, nothing collected" gdb_tfind_test "9.1: find frame for TP $tdp2" "tracepoint $tdp2" \ @@ -243,11 +259,6 @@ gdb_test "tdump" \ # 9.2 test tdump with arguments # [no go, tdump doesn't have any arguments] -# 9.3 help tdump - -gdb_test "help tdump" "Print everything collected at the current.*" \ - "9.3: help tdump" - set linecount1 0 set linecount2 0 set linecount3 0 @@ -385,6 +396,28 @@ gdb_test_multiple "while \$trace_frame != -1\n printf \"TDP #\%d, frame %d: char } } } +} +} + +use_collected_data "live" # Finished! -gdb_tfind_test "finished: make sure not debugging any trace frame" "none" "-1" +gdb_tfind_test "finished: make sure not debugging any trace frame" \ + "none" "-1" + +# Save trace frames to tfile. +gdb_test "tsave report.tf" "Trace data saved to file 'report.tf'.*" + +# Change target to tfile. +set test "change to tfile target" +gdb_test_multiple "target tfile report.tf" "$test" { + -re "A program is being debugged already. Kill it. .y or n. " { + send_gdb "y\n" + exp_continue + } + -re "$gdb_prompt $" { + pass "$test" + } +} +# Test the collected trace frames from tfile. +use_collected_data "tfile"