From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15894 invoked by alias); 16 Aug 2012 10:03:16 -0000 Received: (qmail 15876 invoked by uid 22791); 16 Aug 2012 10:03:13 -0000 X-SWARE-Spam-Status: No, hits=-4.7 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-vb0-f41.google.com (HELO mail-vb0-f41.google.com) (209.85.212.41) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 16 Aug 2012 10:03:00 +0000 Received: by vbkv13 with SMTP id v13so2580260vbk.0 for ; Thu, 16 Aug 2012 03:02:59 -0700 (PDT) MIME-Version: 1.0 Received: by 10.220.149.130 with SMTP id t2mr317954vcv.8.1345111379396; Thu, 16 Aug 2012 03:02:59 -0700 (PDT) Received: by 10.220.3.76 with HTTP; Thu, 16 Aug 2012 03:02:59 -0700 (PDT) In-Reply-To: <1450628.xUgDUToN8c@qiyao.dyndns.org> References: <1591920.sFon8Oz8ME@qiyao.dyndns.org> <1450628.xUgDUToN8c@qiyao.dyndns.org> Date: Thu, 16 Aug 2012 10:03:00 -0000 Message-ID: Subject: Re: [PATCH] Fix memory-region overlapping checking From: Wei-cheng Wang To: Yao Qi Cc: 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/msg00451.txt.bz2 Hi Yao, Thanks for your correction. I wasn't aware of that rule and wondered what the message is used for. After I reviewed the cases, I think the cases should be altered a little. When testing against 0x30-0x0, 0x50-0x70 is no different than 0x40-0x50, so I remove it and add various boundary cases. Below is the altered one based on your fix. -- Wei-cheng 2012-08-08 Wei-cheng Wang Yao Qi * gdb.base/memattr.exp: Add cases for overlapping checking. diff --git INDEX:/gdb/testsuite/gdb.base/memattr.exp --- INDEX:/gdb/testsuite/gdb.base/memattr.exp +++ WORKDIR:/gdb/testsuite/gdb.base/memattr.exp @@ -448,3 +448,45 @@ 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"