From patchwork Wed Nov 4 07:09:47 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fei Jie X-Patchwork-Id: 9551 Received: (qmail 21471 invoked by alias); 4 Nov 2015 07:10:25 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 21376 invoked by uid 89); 4 Nov 2015 07:10:24 -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:22 +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:08 +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 tA479i0n002306 for ; Wed, 4 Nov 2015 15:09:44 +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:19 +0800 From: Fei Jie To: Subject: [PATCH 3/3] Add testcases for list function Date: Wed, 4 Nov 2015 15:09:47 +0800 Message-ID: <1446620987-4140-4-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 X-IsSubscribed: yes add testcases to list.exp, test list under more conditions --- gdb/testsuite/gdb.base/list.exp | 48 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/gdb/testsuite/gdb.base/list.exp b/gdb/testsuite/gdb.base/list.exp index 2aea9a3..cf06cd5 100644 --- a/gdb/testsuite/gdb.base/list.exp +++ b/gdb/testsuite/gdb.base/list.exp @@ -624,4 +624,52 @@ test_list "list -" 10 2 "7-8" "5-6" # the current line. test_list "list -" 10 1 "7" "6" +#Get main address +set main_addr "" +gdb_test_multiple "print/x &main" "getting main's address" { + -re "$decimal = \($hex\)\r\n$gdb_prompt $" { + set main_addr $expect_out(1,string) + } +} +send_gdb "set listsize 10\n" +#Test list with line number +gdb_test "list 12" \ + "7\\s+x = 0.*16\\s+foo \\(x\\+\\+\\);" + +#Test list with + +gdb_test "list +" \ + "17\\s+foo \\(x\\+\\+\\).*26\\s+foo \\(x\\+\\+\\);" + +#Test list with '+' line number +gdb_test "list +1" \ + "23\\s+foo \\(x\\+\\+\\).*32\\s+foo \\(x\\+\\+\\);" + +#Test list with starting line number and ',' +gdb_test "list 20," \ + "20\\s+foo \\(x\\+\\+\\).*29\\s+foo \\(x\\+\\+\\);" + +#Test list with ',' and ending line number +gdb_test "list ,25" \ + "16\\s+foo \\(x\\+\\+\\).*25\\s+foo \\(x\\+\\+\\);" + +#Test list with address +gdb_test "list *$main_addr" \ + "$main_addr is in main.*list0\.c.*" + +#Test list with '-' max line number +gdb_test "list -43" \ + "1\\s+#include \"list0.h\".*10\\s+foo \\(x\\+\\+\\);" + +#Test list with starting line num and out-of-ranged ending line +gdb_test " list 1,48" \ + "1\\s+#include \"list0.h\".*43\\s+\\} \\/\\* last line \\*\\/" + +#Test list with ',' and out-of-ranged ending line +gdb_test "list ,44" \ + ".*43\\s+\\} \\/\\* last line \\*\\/" + +#Test list with ',' and out-of-ranged ending line(which is 10 more than max line number) +gdb_test "list ,53" \ + "Line number 44 out of range.*" + remote_exec build "rm -f list0.h"