From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23512 invoked by alias); 2 Aug 2012 06:11:01 -0000 Received: (qmail 23503 invoked by uid 22791); 2 Aug 2012 06:10:59 -0000 X-SWARE-Spam-Status: No, hits=-2.6 required=5.0 tests=AWL,BAYES_05,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,KHOP_RCVD_TRUST,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE,TW_XF 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, 02 Aug 2012 06:10:41 +0000 Received: by vbkv13 with SMTP id v13so8816617vbk.0 for ; Wed, 01 Aug 2012 23:10:40 -0700 (PDT) MIME-Version: 1.0 Received: by 10.58.91.148 with SMTP id ce20mr8127615veb.16.1343887840790; Wed, 01 Aug 2012 23:10:40 -0700 (PDT) Received: by 10.220.106.204 with HTTP; Wed, 1 Aug 2012 23:10:40 -0700 (PDT) Date: Thu, 02 Aug 2012 06:11:00 -0000 Message-ID: Subject: [PATCH] Fix memory-region overlapping checking From: Wei-cheng Wang To: 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/msg00051.txt.bz2 Hi, After adding a memory-region with as max CORE_ADDR+1, no more memory-region can be added. It always complains about "overlapping" For example, (gdb) mem 0x50 0x80 ro (gdb) mem 0xffffff00 0x100000000 ro (gdb) info mem Using user-defined memory regions. Num Enb Low Addr High Addr Attrs 1 y 0x00000050 0x00000080 ro nocache 2 y 0xffffff00 0x100000000 ro nocache (gdb) mem 0x100 0x200 ro overlapping memory region When checking whether the new memory-region includes a previous one, it should take care special case, where hi == 0 means max CORE_ADDR+1. Wei-cheng 2012-08-02 Wei-cheng Wang * memattr.c (create_mem_region): Fix memory-region overlapping checking in special case. diff --git a/gdb/memattr.c b/gdb/memattr.c --- a/gdb/memattr.c +++ b/gdb/memattr.c @@ -207,7 +207,7 @@ create_mem_region (CORE_ADDR lo, CORE_ADDR hi, if ((lo >= n->lo && (lo < n->hi || n->hi == 0)) || (hi > n->lo && (hi <= n->hi || n->hi == 0)) - || (lo <= n->lo && (hi >= n->hi || hi == 0))) + || (lo <= n->lo && ((hi >= n->hi && n->hi != 0) || hi == 0))) { printf_unfiltered (_("overlapping memory region\n")); return;