From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 796 invoked by alias); 28 Feb 2013 13:17:07 -0000 Received: (qmail 741 invoked by uid 22791); 28 Feb 2013 13:17:05 -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_XP 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; Thu, 28 Feb 2013 13:16:58 +0000 Received: from svr-orw-fem-01.mgc.mentorg.com ([147.34.98.93]) by relay1.mentorg.com with esmtp id 1UB3M1-0007m5-Eb from Yao_Qi@mentor.com for gdb-patches@sourceware.org; Thu, 28 Feb 2013 05:16:57 -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); Thu, 28 Feb 2013 05:16:57 -0800 Received: from qiyao.dyndns.org.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; Thu, 28 Feb 2013 05:16:56 -0800 From: Yao Qi To: Subject: [PATCH 2/4] Test case of conditional dprintf Date: Thu, 28 Feb 2013 13:17:00 -0000 Message-ID: <1362057362-25324-2-git-send-email-yao@codesourcery.com> In-Reply-To: <1362057362-25324-1-git-send-email-yao@codesourcery.com> References: <1361192891-29341-1-git-send-email-yao@codesourcery.com> <1362057362-25324-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/msg00735.txt.bz2 This is to test that dprintf works well with condition. Since print stuff in dprintf is implemented as commands, so there should be no FAIL without patch 1/5 applied. Note that this case is similar to PR 15179 - Dprintf interrupts execution when condition is false but I am still unable to reproduce this PR. dprintf-cond.exp can easily extended to reproduce PR 15180 in next step. gdb/testsuite: 2013-02-28 Yao Qi * gdb.base/dprintf-cond.exp: New. --- gdb/testsuite/gdb.base/dprintf-cond.exp | 75 +++++++++++++++++++++++++++++++ 1 files changed, 75 insertions(+), 0 deletions(-) create mode 100644 gdb/testsuite/gdb.base/dprintf-cond.exp diff --git a/gdb/testsuite/gdb.base/dprintf-cond.exp b/gdb/testsuite/gdb.base/dprintf-cond.exp new file mode 100644 index 0000000..b692124 --- /dev/null +++ b/gdb/testsuite/gdb.base/dprintf-cond.exp @@ -0,0 +1,75 @@ +# Copyright 2013 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 . + +standard_testfile pr15075.c + +set executable $testfile +set expfile $testfile.exp + +set dp_location [gdb_get_line_number "set dprintf here"] +set bp_location [expr $dp_location + 1] + +if [prepare_for_testing $expfile $executable $srcfile {debug}] { + untested "failed to prepare for trace tests" + return -1 +} + +proc test_dprintf { style } { with_test_prefix "$style" { + + global executable + global dp_location bp_location + + # Start with a fresh gdb. + clean_restart ${executable} + if ![runto_main] { + fail "Can't run to main" + return -1 + } + + gdb_test_no_output "set dprintf-style ${style}" \ + "Set dprintf style" + gdb_test "dprintf $dp_location, \"false, %d\\n\", x" \ + "Dprintf 2 at .*" "dprintf 1" + gdb_test "cond 2 x == 5" + + gdb_test "dprintf $dp_location, \"true, %d\\n\", x" \ + "Dprintf 3 at .*" "dprintf 2" + gdb_test "cond 3 x > 5" + + gdb_test "break $bp_location" "Breakpoint .*" + + gdb_test "continue" "true, 6\\r\\n\\r\\n.*" "continue" + + # Test program stops on the right breakpoint. + gdb_test "p x" ".* = 7" + + # Test the hit count of dprintf breakpoints. + gdb_test_sequence "info breakpoints" "dprintf info" { + "\[\r\n\]Num Type Disp Enb Address +What" + "\[\r\n\]1 breakpoint" + "\[\r\n\]2 dprintf" + "\[\r\n\]\tstop only if x == 5" + "\[\r\n\]" + "\[\r\n\]3 dprintf" + "\[\r\n\]\tstop only if x > 5" + "\[\r\n\]\tbreakpoint already hit 1 time" + "\[\r\n\]" + } +}} + +test_dprintf "gdb" + +if ![target_info exists gdb,noinferiorio] { + test_dprintf "call" +} -- 1.7.7.6