From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qv1-xf42.google.com (mail-qv1-xf42.google.com [IPv6:2607:f8b0:4864:20::f42]) by sourceware.org (Postfix) with ESMTPS id EA32A385BF83 for ; Wed, 1 Apr 2020 01:38:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org EA32A385BF83 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=juliacomputing.com Authentication-Results: sourceware.org; spf=none smtp.mailfrom=keno@juliacomputing.com Received: by mail-qv1-xf42.google.com with SMTP id v38so12046396qvf.6 for ; Tue, 31 Mar 2020 18:38:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=juliacomputing-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:subject:message-id:mime-version:content-disposition :user-agent; bh=kdnCqS695ArtrDxV+ym/3Ey2K7HnQfoYHj/Q5WLDedQ=; b=BMup3S0eo/Ji/gLVbS3SnfKj3/kO3BeCG8xmhM3DbsENPYPkOrujG5zjP/l6nb3S0s t4szG32Q3VvqL8zAGZ980W5lB9/rpYAMr9bgRa1A0+kBEXZCgmKMcFvciadoeSgDj/Cf YoA3ZtXFvcJVORu5EvOFNbUfRIeR4HHznbMehkRgMv3TYvcTsFk/3nYUGckgcZM8vitD ACzwZxbYudWzaVmrov29gI1VYmEZ+ahmPaZbxV6fwxJYDq+jK4jq59hlas5U876rcGkN e8J7Jre/bQbvNFgI4+zfAHsKsjjsB//28IFtH3NqELmIwe8sbxVwzjBFXmGs5W96hPkm DXJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:subject:message-id:mime-version :content-disposition:user-agent; bh=kdnCqS695ArtrDxV+ym/3Ey2K7HnQfoYHj/Q5WLDedQ=; b=eMXtX8KzRk4EbpXxcxBUxLUmAULicMQ2xOC74kJYJLQpJ/wYEF4h5twbt5KWpNq98e fcKjFLHhD3FLAPQd9MGgVbbPYREh6nQm9wS/SDydTKerM1b0S6tPXwpCxjWfXd84AojW wxBe9aqLU2crEosteMvFAcQ3liu2DHHlh3f65bROloCEwvtkEMmR6SmY8nDHHJPcCsCt ZiXdt+cwTLH+fB6ze4ZmQ9Wk3xnsaAVbFoYSgyFPyOq7oU5VCZbEXyB+XJH1qFEyLfVx qx+L3GdTR8vJ2KIZqe6GMGaiSAbdh0NqmO7e5cW3JFcLganN89RuyfBOTK8VIT4gfeMe bfgw== X-Gm-Message-State: ANhLgQ2+zcFo+ftVowvsE6gd3SR64J36n/SHTt/lcowZi2lQrXAx+dSS jWpGzWQBvhvluVN5HNoex+cKqjLagFt66w== X-Google-Smtp-Source: ADFU+vvSi6eWbPue/dGKoGFFnfP6A8Bh1tsAJxjseS3WSzk3lqsFkWD2Faa7GOiywqSI/xlrENvscA== X-Received: by 2002:a0c:e7c7:: with SMTP id c7mr19253344qvo.188.1585705096310; Tue, 31 Mar 2020 18:38:16 -0700 (PDT) Received: from juliacomputing.com (c-76-24-28-244.hsd1.ma.comcast.net. [76.24.28.244]) by smtp.gmail.com with ESMTPSA id q75sm524394qke.12.2020.03.31.18.38.15 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 31 Mar 2020 18:38:15 -0700 (PDT) Date: Tue, 31 Mar 2020 21:38:13 -0400 From: Keno Fischer To: gdb-patches@sourceware.org Subject: [PATCH] breakpoint: Make sure location types match before swapping Message-ID: <20200401013813.GA27550@juliacomputing.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.9.4 (2018-02-28) X-Spam-Status: No, score=-26.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Apr 2020 01:38:18 -0000 This patch fixes PR gdb/25741 "GDB tries to set breakpoint using Z0, but remove it using z1". In particular, what occurs in that case is that a hardware breakpoint is hit, after which GDB removes it and establishes a single step breakpoint at the same location. Afterwards, rather than simply removing this breakpoint and re-enabling the hardware breakpoint, GDB simply swaps the activation, without informing the server, leading to an inconsistency in GDB's view of the world and the server's view of the world. To remidy this situation, this patch adds a check that ensures two breakpoint locations have the same type before they are considered equal and thus eligible for silent swapping. gdb/ChangeLog: * breakpoint.c (breakpoint_locations_match): Fix PR gdb/25741 Signed-off-by: Keno Fischer --- gdb/breakpoint.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index e49025461b..582dae1946 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -6838,7 +6838,7 @@ breakpoint_locations_match (struct bp_location *loc1, /* We compare bp_location.length in order to cover ranged breakpoints. */ return (breakpoint_address_match (loc1->pspace->aspace, loc1->address, loc2->pspace->aspace, loc2->address) - && loc1->length == loc2->length); + && loc1->length == loc2->length && loc1->loc_type == loc2->loc_type); } static void -- 2.24.0