From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28805 invoked by alias); 24 Aug 2012 11:47:37 -0000 Received: (qmail 28795 invoked by uid 22791); 24 Aug 2012 11:47:37 -0000 X-SWARE-Spam-Status: No, hits=-4.8 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,KHOP_RCVD_TRUST,KHOP_THREADED,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE X-Spam-Check-By: sourceware.org Received: from mail-vc0-f169.google.com (HELO mail-vc0-f169.google.com) (209.85.220.169) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 24 Aug 2012 11:47:14 +0000 Received: by vcbfl10 with SMTP id fl10so2309653vcb.0 for ; Fri, 24 Aug 2012 04:47:14 -0700 (PDT) MIME-Version: 1.0 Received: by 10.58.89.168 with SMTP id bp8mr4796651veb.20.1345808834097; Fri, 24 Aug 2012 04:47:14 -0700 (PDT) Received: by 10.220.3.76 with HTTP; Fri, 24 Aug 2012 04:47:13 -0700 (PDT) In-Reply-To: <503762F6.3080804@redhat.com> References: <1591920.sFon8Oz8ME@qiyao.dyndns.org> <1450628.xUgDUToN8c@qiyao.dyndns.org> <503762F6.3080804@redhat.com> Date: Fri, 24 Aug 2012 11:47:00 -0000 Message-ID: Subject: Re: [PATCH] Fix memory-region overlapping checking From: Wei-cheng Wang To: Pedro Alves Cc: Yao Qi , gdb-patches@sourceware.org Content-Type: text/plain; charset=UTF-8 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: 2012-08/txt/msg00714.txt.bz2 Hi Pedro Alves, The line number in my previous mail was wrong (s/45/58/), so it cannot be fully applied. Please try this again. Sorry for the inconvenience Wei-cheng --- 2012-08-08 Wei-cheng Wang Yao Qi * gdb.base/memattr.exp: Add cases for overlapping checking. diff --git a/gdb/testsuite/gdb.base/memattr.exp b/gdb/testsuite/gdb.base/memattr.exp index 4065808..024204d 100644 --- a/gdb/testsuite/gdb.base/memattr.exp +++ b/gdb/testsuite/gdb.base/memattr.exp @@ -448,3 +448,58 @@ gdb_test_multiple "info mem" "mem 2-4 were deleted" { gdb_test "delete mem 8" "No memory region number 8." \ "delete non-existant region" + +# +# Test overlapping checking +# +# lo' hi' +# |---------| +# 10 20 30 40 50 60 70 80 +# |----| FAIL +# |--| FAIL +# |---| FAIL +# |--| FAIL +# |----| FAIL +# |---------| FAIL +# |-------------| FAIL +# |----------------- FAIL +# |------------ FAIL +# |--- FAIL +# |----| PASS +# |----| PASS + +proc delete_memory {} { + global gdb_prompt + + gdb_test_multiple "delete mem" "delete mem" { + -re "Delete all memory regions.*y or n.*$" { + send_gdb "y\n"; + exp_continue + } + -re "$gdb_prompt $" { } + } +} + +# Test normal case (upper != 0) +delete_memory +gdb_test_no_output "mem 0x30 0x60 ro" +gdb_test "mem 0x20 0x40 ro" "overlapping memory region" "mem 0x20 0x40 1" +gdb_test "mem 0x30 0x40 ro" "overlapping memory region" "mem 0x30 0x40 1" +gdb_test "mem 0x40 0x50 ro" "overlapping memory region" "mem 0x40 0x50 1" +gdb_test "mem 0x50 0x60 ro" "overlapping memory region" "mem 0x50 0x60 1" +gdb_test "mem 0x30 0x60 ro" "overlapping memory region" "mem 0x30 0x60 1" +gdb_test "mem 0x50 0x70 ro" "overlapping memory region" "mem 0x50 0x70 1" +gdb_test "mem 0x20 0x0 ro" "overlapping memory region" "mem 0x20 0x0 1" +gdb_test "mem 0x30 0x0 ro" "overlapping memory region" "mem 0x30 0x0 1" +gdb_test_no_output "mem 0x10 0x30 ro" "mem 0x10 0x30 1" +gdb_test_no_output "mem 0x60 0x80 ro" "mem 0x60 0x80 1" +gdb_test_no_output "mem 0x80 0x0 ro" "mem 0x80 0x0 1" + +# Test special case (upper == 0) +delete_memory +gdb_test_no_output "mem 0x30 0x0 ro" +gdb_test "mem 0x20 0x40 ro" "overlapping memory region" "mem 0x20 0x40 2" +gdb_test "mem 0x30 0x40 ro" "overlapping memory region" "mem 0x30 0x40 2" +gdb_test "mem 0x20 0x0 ro" "overlapping memory region" "mem 0x20 0x0 2" +gdb_test "mem 0x30 0x0 ro" "overlapping memory region" "mem 0x30 0x0 2" +gdb_test_no_output "mem 0x10 0x30 ro" "mem 0x10 0x30 2"