From patchwork Fri Apr 11 17:36:38 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Burgess X-Patchwork-Id: 512 Return-Path: X-Original-To: siddhesh@wilcox.dreamhost.com Delivered-To: siddhesh@wilcox.dreamhost.com Received: from homiemail-mx21.g.dreamhost.com (peon2454.g.dreamhost.com [208.113.200.127]) by wilcox.dreamhost.com (Postfix) with ESMTP id E0219360060 for ; Fri, 11 Apr 2014 10:36:46 -0700 (PDT) Received: by homiemail-mx21.g.dreamhost.com (Postfix, from userid 14314964) id 7CE9B113EB26; Fri, 11 Apr 2014 10:36:46 -0700 (PDT) X-Original-To: gdb@patchwork.siddhesh.in Delivered-To: x14314964@homiemail-mx21.g.dreamhost.com Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by homiemail-mx21.g.dreamhost.com (Postfix) with ESMTPS id 3E6BF1197603 for ; Fri, 11 Apr 2014 10:36:46 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:message-id:date:from:mime-version:to:subject :content-type:content-transfer-encoding; q=dns; s=default; b=RQN IkSTRjOkPwoM6QXSj2QzF+RxZdadWfYdfhD/4fxqfJZIAY2beemoJIHZgDnwzQsx Uz5JlaJcYJkLWrvp63wlSRe3iJaN991w4+pir2Y4jRI8C6qnj4WywoJylPVIq8U+ w+V6+pTJdzdMOa048FLwHgp8+EWgGfdCT1bEar1E= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:message-id:date:from:mime-version:to:subject :content-type:content-transfer-encoding; s=default; bh=Si2gJvBxr IbPhsEjKpXEBCSdidE=; b=c5GUaqCw5YfsgNLd8a015hlV3MqqtznLygBE+t+Nd MbTlrrHlgu4GiaME5dM/JVbGexvfMUmSztQ+1/L+Tyh5zB/8G6J0zp8JWFSxTyIJ Pl5k5LRC+aTC8iP9pCtpYB0pZZFQ+bWd7mNrDI7eJOR7VuYTr3E4b5guT290nzS9 TE= Received: (qmail 26182 invoked by alias); 11 Apr 2014 17:36:44 -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 26165 invoked by uid 89); 11 Apr 2014 17:36:43 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.9 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mail-gw3-out.broadcom.com Received: from mail-gw3-out.broadcom.com (HELO mail-gw3-out.broadcom.com) (216.31.210.64) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 11 Apr 2014 17:36:42 +0000 Received: from irvexchcas08.broadcom.com (HELO IRVEXCHCAS08.corp.ad.broadcom.com) ([10.9.208.57]) by mail-gw3-out.broadcom.com with ESMTP; 11 Apr 2014 10:54:13 -0700 Received: from IRVEXCHSMTP1.corp.ad.broadcom.com (10.9.207.51) by IRVEXCHCAS08.corp.ad.broadcom.com (10.9.208.57) with Microsoft SMTP Server (TLS) id 14.3.174.1; Fri, 11 Apr 2014 10:36:39 -0700 Received: from mail-irva-13.broadcom.com (10.10.10.20) by IRVEXCHSMTP1.corp.ad.broadcom.com (10.9.207.51) with Microsoft SMTP Server id 14.3.174.1; Fri, 11 Apr 2014 10:36:40 -0700 Received: from [10.177.73.80] (unknown [10.177.73.80]) by mail-irva-13.broadcom.com (Postfix) with ESMTP id 756BCEAD4C for ; Fri, 11 Apr 2014 10:36:39 -0700 (PDT) Message-ID: <53482826.6030403@broadcom.com> Date: Fri, 11 Apr 2014 18:36:38 +0100 From: Andrew Burgess User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 MIME-Version: 1.0 To: "gdb-patches@sourceware.org" Subject: [PATCH] gdb.base/memattr.exp regexp improvements X-IsSubscribed: yes X-DH-Original-To: gdb@patchwork.siddhesh.in I hit an issue in the test gdb.base/memattr.exp, on my target the memory regions created were not listed in the order 1, 2, 3, 4, 5, instead, region 1 is placed after region 5. This is just because region 1 is initialised data, and 2->5 are uninitialised, and it just happens that our linker places things in that order. It's possible to see the same errors on x86-64 if the memory regions in the file gdb.base/memattr.c (the test source) are reordered, so, for example, move region 2 to the end of the list. The patch below just improves the regexps used in the test such that the order of the memory regions is no longer important. I don't believe that the order is actually important to the test[1]. OK to apply? Thanks, Andrew [1] We're probably NOT currently testing that the memory regions are in ascending order, but we weren't really testing this before either. gdb/testsuite/ChangeLog: * gdb.base/memattr.exp: Improve regexps to handle memory regions appearing in any order. diff --git a/gdb/testsuite/gdb.base/memattr.exp b/gdb/testsuite/gdb.base/memattr.exp index af7de1f..1e23dae 100644 --- a/gdb/testsuite/gdb.base/memattr.exp +++ b/gdb/testsuite/gdb.base/memattr.exp @@ -110,24 +110,31 @@ set see3 0 set see4 0 set see5 0 +set info_mem_header_pattern \ + "info mem.*Num\[ \t\]+Enb\[ \t\]+Low\[ \t\]+Addr\[ \t\]+High\[ \t\]+Addr\[ \t\]+Attrs\[^\n\r]*.." + gdb_test_multiple "info mem" "info mem(1)" { - -re "1 y \[ \t\]+$hex $hex wo nocache \[^\r\n\]*" { + -re ${info_mem_header_pattern} { + # Discard the header. + exp_continue + } + -re "^1 y \[ \t\]+$hex $hex wo nocache \[^\r\n\]*.." { set see1 1 exp_continue } - -re "2 y \[ \t\]+$hex $hex ro nocache \[^\r\n\]*" { + -re "^2 y \[ \t\]+$hex $hex ro nocache \[^\r\n\]*.." { set see2 1 exp_continue } - -re "3 y \[ \t\]+$hex $hex rw nocache \[^\r\n\]*" { + -re "^3 y \[ \t\]+$hex $hex rw nocache \[^\r\n\]*.." { set see3 1 exp_continue } - -re "4 y \[ \t\]+$hex $hex rw nocache \[^\r\n\]*" { + -re "^4 y \[ \t\]+$hex $hex rw nocache \[^\r\n\]*.." { set see4 1 exp_continue } - -re "5 y \[ \t\]+$hex $hex rw nocache .\[^\r\n\]*" { + -re "^5 y \[ \t\]+$hex $hex rw nocache \[^\r\n\]*.." { set see5 1 exp_continue } @@ -181,23 +188,27 @@ set see4 0 set see5 0 gdb_test_multiple "info mem" "mem 2 and 4 were disabled" { - -re "1 y \[ \t\]+$hex $hex wo nocache \[^\r\n\]*" { + -re ${info_mem_header_pattern} { + # Discard the header. + exp_continue + } + -re "^1 y \[ \t\]+$hex $hex wo nocache \[^\r\n\]*.." { set see1 1 exp_continue } - -re "2 n \[ \t\]+$hex $hex ro nocache \[^\r\n\]*" { + -re "^2 n \[ \t\]+$hex $hex ro nocache \[^\r\n\]*.." { set see2 1 exp_continue } - -re "3 y \[ \t\]+$hex $hex rw nocache \[^\r\n\]*" { + -re "^3 y \[ \t\]+$hex $hex rw nocache \[^\r\n\]*.." { set see3 1 exp_continue } - -re "4 n \[ \t\]+$hex $hex rw nocache \[^\r\n\]*" { + -re "^4 n \[ \t\]+$hex $hex rw nocache \[^\r\n\]*.." { set see4 1 exp_continue } - -re "5 y \[ \t\]+$hex $hex rw nocache .\[^\r\n\]*" { + -re "^5 y \[ \t\]+$hex $hex rw nocache \[^\r\n\]*.." { set see5 1 exp_continue } @@ -219,23 +230,27 @@ set see4 0 set see5 0 gdb_test_multiple "info mem" "mem 2-4 were enabled" { - -re "1 y \[ \t\]+$hex $hex wo nocache \[^\r\n\]*" { + -re ${info_mem_header_pattern} { + # Discard the header. + exp_continue + } + -re "^1 y \[ \t\]+$hex $hex wo nocache \[^\r\n\]*.." { set see1 1 exp_continue } - -re "2 y \[ \t\]+$hex $hex ro nocache \[^\r\n\]*" { + -re "^2 y \[ \t\]+$hex $hex ro nocache \[^\r\n\]*.." { set see2 1 exp_continue } - -re "3 y \[ \t\]+$hex $hex rw nocache \[^\r\n\]*" { + -re "^3 y \[ \t\]+$hex $hex rw nocache \[^\r\n\]*.." { set see3 1 exp_continue } - -re "4 y \[ \t\]+$hex $hex rw nocache \[^\r\n\]*" { + -re "^4 y \[ \t\]+$hex $hex rw nocache \[^\r\n\]*.." { set see4 1 exp_continue } - -re "5 y \[ \t\]+$hex $hex rw nocache .\[^\r\n\]*" { + -re "^5 y \[ \t\]+$hex $hex rw nocache \[^\r\n\]*.." { set see5 1 exp_continue } @@ -257,23 +272,27 @@ set see4 0 set see5 0 gdb_test_multiple "info mem" "mem 1 to 5 were disabled" { - -re "1 n \[ \t\]+$hex $hex wo nocache \[^\r\n\]*" { + -re ${info_mem_header_pattern} { + # Discard the header. + exp_continue + } + -re "^1 n \[ \t\]+$hex $hex wo nocache \[^\r\n\]*.." { set see1 1 exp_continue } - -re "2 n \[ \t\]+$hex $hex ro nocache \[^\r\n\]*" { + -re "^2 n \[ \t\]+$hex $hex ro nocache \[^\r\n\]*.." { set see2 1 exp_continue } - -re "3 n \[ \t\]+$hex $hex rw nocache \[^\r\n\]*" { + -re "^3 n \[ \t\]+$hex $hex rw nocache \[^\r\n\]*.." { set see3 1 exp_continue } - -re "4 n \[ \t\]+$hex $hex rw nocache \[^\r\n\]*" { + -re "^4 n \[ \t\]+$hex $hex rw nocache \[^\r\n\]*.." { set see4 1 exp_continue } - -re "5 n \[ \t\]+$hex $hex rw nocache .\[^\r\n\]*" { + -re "^5 n \[ \t\]+$hex $hex rw nocache \[^\r\n\]*.." { set see5 1 exp_continue } @@ -295,23 +314,27 @@ set see4 0 set see5 0 gdb_test_multiple "info mem" "mem 1 to 5 were enabled" { - -re "1 y \[ \t\]+$hex $hex wo nocache \[^\r\n\]*" { + -re ${info_mem_header_pattern} { + # Discard the header. + exp_continue + } + -re "^1 y \[ \t\]+$hex $hex wo nocache \[^\r\n\]*.." { set see1 1 exp_continue } - -re "2 y \[ \t\]+$hex $hex ro nocache \[^\r\n\]*" { + -re "^2 y \[ \t\]+$hex $hex ro nocache \[^\r\n\]*.." { set see2 1 exp_continue } - -re "3 y \[ \t\]+$hex $hex rw nocache \[^\r\n\]*" { + -re "^3 y \[ \t\]+$hex $hex rw nocache \[^\r\n\]*.." { set see3 1 exp_continue } - -re "4 y \[ \t\]+$hex $hex rw nocache \[^\r\n\]*" { + -re "^4 y \[ \t\]+$hex $hex rw nocache \[^\r\n\]*.." { set see4 1 exp_continue } - -re "5 y \[ \t\]+$hex $hex rw nocache .\[^\r\n\]*" { + -re "^5 y \[ \t\]+$hex $hex rw nocache \[^\r\n\]*.." { set see5 1 exp_continue } @@ -340,23 +363,27 @@ set see5 0 gdb_test_no_output "delete mem 1" "delete mem 1" gdb_test_multiple "info mem" "mem 1 was deleted" { - -re "1 y \[ \t\]+$hex $hex wo nocache \[^\r\n\]*" { + -re ${info_mem_header_pattern} { + # Discard the header. + exp_continue + } + -re "^1 y \[ \t\]+$hex $hex wo nocache \[^\r\n\]*.." { set see1 1 exp_continue } - -re "2 y \[ \t\]+$hex $hex ro nocache \[^\r\n\]*" { + -re "^2 y \[ \t\]+$hex $hex ro nocache \[^\r\n\]*.." { set see2 1 exp_continue } - -re "3 y \[ \t\]+$hex $hex rw nocache \[^\r\n\]*" { + -re "^3 y \[ \t\]+$hex $hex rw nocache \[^\r\n\]*.." { set see3 1 exp_continue } - -re "4 y \[ \t\]+$hex $hex rw nocache \[^\r\n\]*" { + -re "^4 y \[ \t\]+$hex $hex rw nocache \[^\r\n\]*.." { set see4 1 exp_continue } - -re "5 y \[ \t\]+$hex $hex rw nocache .\[^\r\n\]*" { + -re "^5 y \[ \t\]+$hex $hex rw nocache \[^\r\n\]*.." { set see5 1 exp_continue } @@ -377,23 +404,27 @@ set see5 0 gdb_test_no_output "delete mem 2 4" "delete mem 2 4" gdb_test_multiple "info mem" "mem 2 and 4 were deleted" { - -re "1 y \[ \t\]+$hex $hex wo nocache \[^\r\n\]*" { + -re ${info_mem_header_pattern} { + # Discard the header. + exp_continue + } + -re "^1 y \[ \t\]+$hex $hex wo nocache \[^\r\n\]*.." { set see1 1 exp_continue } - -re "2 y \[ \t\]+$hex $hex ro nocache \[^\r\n\]*" { + -re "^2 y \[ \t\]+$hex $hex ro nocache \[^\r\n\]*.." { set see2 1 exp_continue } - -re "3 y \[ \t\]+$hex $hex rw nocache \[^\r\n\]*" { + -re "^3 y \[ \t\]+$hex $hex rw nocache \[^\r\n\]*.." { set see3 1 exp_continue } - -re "4 y \[ \t\]+$hex $hex rw nocache \[^\r\n\]*" { + -re "^4 y \[ \t\]+$hex $hex rw nocache \[^\r\n\]*.." { set see4 1 exp_continue } - -re "5 y \[ \t\]+$hex $hex rw nocache .\[^\r\n\]*" { + -re "^5 y \[ \t\]+$hex $hex rw nocache \[^\r\n\]*.." { set see5 1 exp_continue } @@ -416,23 +447,27 @@ gdb_test "delete mem 2-4" \ "No memory region number 2.*No memory region number 4." \ "delete mem 2-4" gdb_test_multiple "info mem" "mem 2-4 were deleted" { - -re "1 y \[ \t\]+$hex $hex wo nocache \[^\r\n\]*" { + -re ${info_mem_header_pattern} { + # Discard the header. + exp_continue + } + -re "^1 y \[ \t\]+$hex $hex wo nocache \[^\r\n\]*.." { set see1 1 exp_continue } - -re "2 y \[ \t\]+$hex $hex ro nocache \[^\r\n\]*" { + -re "^2 y \[ \t\]+$hex $hex ro nocache \[^\r\n\]*.." { set see2 1 exp_continue } - -re "3 y \[ \t\]+$hex $hex rw nocache \[^\r\n\]*" { + -re "^3 y \[ \t\]+$hex $hex rw nocache \[^\r\n\]*.." { set see3 1 exp_continue } - -re "4 y \[ \t\]+$hex $hex rw nocache \[^\r\n\]*" { + -re "^4 y \[ \t\]+$hex $hex rw nocache \[^\r\n\]*.." { set see4 1 exp_continue } - -re "5 y \[ \t\]+$hex $hex rw nocache .\[^\r\n\]*" { + -re "^5 y \[ \t\]+$hex $hex rw nocache \[^\r\n\]*.." { set see5 1 exp_continue }