From patchwork Fri Jul 20 04:10:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 28497 Received: (qmail 3511 invoked by alias); 20 Jul 2018 04:11:21 -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 3419 invoked by uid 89); 20 Jul 2018 04:11:21 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.4 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=leaders, meet X-HELO: gateway32.websitewelcome.com Received: from gateway32.websitewelcome.com (HELO gateway32.websitewelcome.com) (192.185.145.18) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 20 Jul 2018 04:11:19 +0000 Received: from cm15.websitewelcome.com (cm15.websitewelcome.com [100.42.49.9]) by gateway32.websitewelcome.com (Postfix) with ESMTP id 6D92B43619E for ; Thu, 19 Jul 2018 23:11:17 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id gMkxfOm08bXuJgMl5fWEak; Thu, 19 Jul 2018 23:11:17 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:MIME-Version :Content-Type:Content-Transfer-Encoding:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=3DtWCBnjiy/OObaAGvjyB9qCXL3VdhbwInqp2Zfb9lo=; b=kfNRHh2rLTs5xaw4C6cN/Aj96b 6lUXyguEKCpJ7JrMIquY7DuPf3UnabLTnyGJODcdMq4cyNrEMO24sW5QM7ypyLYGW1+lOmiKKRj/Y bCsrWYCHfA74XLMf2FCN3+qEf; Received: from 75-166-85-72.hlrn.qwest.net ([75.166.85.72]:39218 helo=bapiya.Home) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.91) (envelope-from ) id 1fgMkx-003loR-Hf; Thu, 19 Jul 2018 23:11:03 -0500 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [RFA] Fix crash with -D_GLIBCXX_DEBUG Date: Thu, 19 Jul 2018 22:10:56 -0600 Message-Id: <20180720041056.2831-1-tom@tromey.com> I noticed a buildbot failure where gdb crashed in info-os.exp, when compiled with -D_GLIBCXX_DEBUG: (gdb) info os procgroups /usr/include/c++/7/bits/stl_algo.h:4834: Error: comparison doesn't meet irreflexive requirements, assert(!(a < a)). Objects involved in the operation: iterator::value_type "< operator type" { type = pid_pgid_entry; } The bug here is that pid_pgid_entry::operator< violates the C++ irreflexivity rule; that is, that an object cannot be less than itself. Tested locally by re-running info-os.exp. gdb/ChangeLog 2018-07-19 Tom Tromey * nat/linux-osdata.c (pid_pgid_entry::operator<): Fix irreflexivity violation. --- gdb/ChangeLog | 5 +++++ gdb/nat/linux-osdata.c | 8 +++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/gdb/nat/linux-osdata.c b/gdb/nat/linux-osdata.c index 25e895df190..2323dcc878b 100644 --- a/gdb/nat/linux-osdata.c +++ b/gdb/nat/linux-osdata.c @@ -415,9 +415,11 @@ struct pid_pgid_entry /* Process group leaders always come first... */ if (this->is_leader ()) - return true; - - if (other.is_leader ()) + { + if (!other.is_leader ()) + return true; + } + else if (other.is_leader ()) return false; /* ...else sort by PID. */