From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20940 invoked by alias); 4 Nov 2015 07:10:21 -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 20910 invoked by uid 89); 4 Nov 2015 07:10:19 -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:19 +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:03 +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 tA479doe002299 for ; Wed, 4 Nov 2015 15:09:39 +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:14 +0800 From: Fei Jie To: Subject: [PATCH 1/3] Add testcases for examine function Date: Wed, 04 Nov 2015 07:10:00 -0000 Message-ID: <1446620987-4140-2-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/msg00132.txt.bz2 use examine to display the content of main function's address in different formats and examine address that can not be accessed --- gdb/testsuite/gdb.base/testexamine.exp | 42 ++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 gdb/testsuite/gdb.base/testexamine.exp diff --git a/gdb/testsuite/gdb.base/testexamine.exp b/gdb/testsuite/gdb.base/testexamine.exp new file mode 100644 index 0000000..16d916d --- /dev/null +++ b/gdb/testsuite/gdb.base/testexamine.exp @@ -0,0 +1,42 @@ +if {[prepare_for_testing testprint.exp testprint display.c \ + {debug nowarnings}]} { + untested testprint.exp + return -1 +} + +if ![runto_main] then { + fail "Can not run to main." +} + +#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) + } +} + +#Test x(examine) +gdb_test "x" \ + "Argument required.*" +gdb_test "x/x $main_addr" \ + ".*
.*0xe5894855" +gdb_test "x/d $main_addr" \ + ".*
.*-443987883" +gdb_test "x/u $main_addr" \ + ".*
.*3850979413" +gdb_test "x/o $main_addr" \ + ".*
.*034542244125" +gdb_test "x/t $main_addr" \ + ".*
.*11100101100010010100100001010101" +gdb_test "x/a $main_addr" \ + ".*
.*0xb8e5894855" +gdb_test "x/c $main_addr" \ + ".*
.*85\ \'U\'" +gdb_test "x/f $main_addr" \ + ".*
.*3.923498621684153e-312" +gdb_test "x 0x000000000000" \ + "Cannot access memory at address 0x0" + +gdb_exit +return 0 -- 1.8.3.1