From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21139 invoked by alias); 4 Nov 2015 07:10:22 -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 20989 invoked by uid 89); 4 Nov 2015 07:10:21 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=2.0 required=5.0 tests=AWL,BAYES_50,KAM_LAZY_DOMAIN_SECURITY,T_RP_MATCHES_RCVD autolearn=no version=3.3.2 X-HELO: heian.cn.fujitsu.com Received: from cn.fujitsu.com (HELO heian.cn.fujitsu.com) (59.151.112.132) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 04 Nov 2015 07:10:21 +0000 Received: from unknown (HELO edo.cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 04 Nov 2015 15:10:06 +0800 Received: from G08CNEXCHPEKD02.g08.fujitsu.local (localhost.localdomain [127.0.0.1]) by edo.cn.fujitsu.com (8.14.3/8.13.1) with ESMTP id tA479gew002302 for ; Wed, 4 Nov 2015 15:09:42 +0800 Received: from localhost.localdomain (10.167.226.91) by G08CNEXCHPEKD02.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server (TLS) id 14.3.181.6; Wed, 4 Nov 2015 15:10:16 +0800 From: Fei Jie To: Subject: [PATCH 2/3] Add testcases for display function Date: Wed, 04 Nov 2015 07:10:00 -0000 Message-ID: <1446620987-4140-3-git-send-email-feij.fnst@cn.fujitsu.com> In-Reply-To: <1446620987-4140-1-git-send-email-feij.fnst@cn.fujitsu.com> References: <1446620987-4140-1-git-send-email-feij.fnst@cn.fujitsu.com> MIME-Version: 1.0 Content-Type: text/plain X-IsSubscribed: yes X-SW-Source: 2015-11/txt/msg00133.txt.bz2 add testcases to test display under different conditions --- gdb/testsuite/gdb.base/display.c | 5 +++++ gdb/testsuite/gdb.base/testdisplay.exp | 35 ++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 gdb/testsuite/gdb.base/testdisplay.exp diff --git a/gdb/testsuite/gdb.base/display.c b/gdb/testsuite/gdb.base/display.c index cd833e2..6db289c 100644 --- a/gdb/testsuite/gdb.base/display.c +++ b/gdb/testsuite/gdb.base/display.c @@ -4,6 +4,11 @@ #define LOOP 10 int sum = 0; +int int_array[2]={0,1}; +struct { + char name; + int age; +} human; /* Call to force a variable onto the stack so we can see its address. */ void force_mem (int *arg) { } diff --git a/gdb/testsuite/gdb.base/testdisplay.exp b/gdb/testsuite/gdb.base/testdisplay.exp new file mode 100644 index 0000000..984465e2 --- /dev/null +++ b/gdb/testsuite/gdb.base/testdisplay.exp @@ -0,0 +1,35 @@ +set srcfile display.c + +if { [prepare_for_testing testdisplay.exp "testdisplay" display.c {debug nowarnings}] } { + untest testdisplay.exp + return -1 +} + +set bp_location [gdb_get_line_number "set breakpoint 1 here"] +send_gdb "break $bp_location\n" +send_gdb "run\n" + +#Test disp(display) +gdb_test "display f" "1: f = 3.1415" +gdb_test "display/x f" "2: /x f = 0x3" +gdb_test "display/d f" "3: /d f = 3" +gdb_test "display/u f" "4: /u f = 3" +gdb_test "display/o f" "5: /o f = 03" +gdb_test "display/t f" "6: /t f = 11" +gdb_test "display/a f" "7: /a f = 0x3" +gdb_test "display/c f" "8: /c f = 3\ \'\\\\003\'" +gdb_test "display/f f" "9: /f f = 3.1415" + +gdb_test "display int_array" \ + "10: int_array = \\{0, 1\\}" +gdb_test "display human" \ + "11: human = {name = 0 '\\\\000', age = 0}" + +#Test disable/enable display +gdb_test "disable display 999" \ + "No display number 999\." +gdb_test_no_output "disable display 9" +gdb_test_no_output "enable display 9" + +gdb_exit +return 0 -- 1.8.3.1