From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19705 invoked by alias); 3 Aug 2012 10:54:21 -0000 Received: (qmail 19697 invoked by uid 22791); 3 Aug 2012 10:54:20 -0000 X-SWARE-Spam-Status: No, hits=-4.3 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL,TW_XF X-Spam-Check-By: sourceware.org Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 03 Aug 2012 10:54:07 +0000 Received: from svr-orw-fem-01.mgc.mentorg.com ([147.34.98.93]) by relay1.mentorg.com with esmtp id 1SxFWA-00027a-7D from Yao_Qi@mentor.com ; Fri, 03 Aug 2012 03:54:06 -0700 Received: from SVR-ORW-FEM-05.mgc.mentorg.com ([147.34.97.43]) by svr-orw-fem-01.mgc.mentorg.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Fri, 3 Aug 2012 03:54:06 -0700 Received: from qiyao.dyndns.org (147.34.91.1) by svr-orw-fem-05.mgc.mentorg.com (147.34.97.43) with Microsoft SMTP Server id 14.1.289.1; Fri, 3 Aug 2012 03:54:05 -0700 From: Yao Qi To: CC: Wei-cheng Wang Subject: Re: [PATCH] Fix memory-region overlapping checking Date: Fri, 03 Aug 2012 10:54:00 -0000 Message-ID: <3535463.LDgPnkid6y@qiyao.dyndns.org> User-Agent: KMail/4.8.3 (Linux/3.3.7-1.fc16.i686; KDE/4.8.3; i686; ; ) In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" X-IsSubscribed: yes 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/msg00097.txt.bz2 Given the example you posted, > Let me correct my previous example. It should be > (gdb) mem 0x50 0x80 ro > (gdb) mem 0xffffff00 0 ro > (gdb) mem 0x100 0x200 ro > overlapping memory region >=20 It is a bug. On Thursday, August 02, 2012 02:10:40 PM Wei-cheng Wang wrote: > Wei-cheng >=20 > 2012-08-02 Wei-cheng Wang >=20 > * memattr.c (create_mem_region): Fix memory-region overlapping > checking in special case. >=20 > 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, >=20 > if ((lo >=3D n->lo && (lo < n->hi || n->hi =3D=3D 0)) > || (hi > n->lo && (hi <=3D n->hi || n->hi =3D=3D 0)) > - || (lo <=3D n->lo && (hi >=3D n->hi || hi =3D=3D 0))) > + || (lo <=3D n->lo && ((hi >=3D n->hi && n->hi !=3D 0) || hi =3D= =3D 0))) > { > printf_unfiltered (_("overlapping memory region\n")); > return; I read your patch, and draw some charts on paper to show the relationship o= f=20 these four variables here for overlapping. This line is to check the overlapping like, lo n->lo n->hi hi However, without your fix, the following case is treated as overlapping by= =20 mistake, lo hi n->lo n->hi (0) Your patch looks correct to me, however I am not the people to approve it. This line of code was written in 2002, so a 10-year-old bug is fixed! :) --=20 Yao (=E9=BD=90=E5=B0=A7)