Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Keno Fischer <keno@juliacomputing.com>
To: gdb-patches@sourceware.org
Subject: [PATCH] breakpoint: Make sure location types match before swapping
Date: Tue, 31 Mar 2020 21:38:13 -0400	[thread overview]
Message-ID: <20200401013813.GA27550@juliacomputing.com> (raw)

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 <keno@juliacomputing.com>
---
 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



             reply	other threads:[~2020-04-01  1:38 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-01  1:38 Keno Fischer [this message]
2020-04-14  7:01 ` Keno Fischer
2020-04-14 15:04   ` Simon Marchi
2020-04-14 16:00     ` Andrew Burgess
2020-04-14 16:26       ` Keno Fischer
2020-04-14 19:17       ` Pedro Alves
2020-04-15 20:46         ` Andrew Burgess
2020-04-17 12:28         ` Andrew Burgess
2020-04-17 17:22           ` Pedro Alves
2020-04-19 18:21           ` Pedro Alves
2020-04-19 18:49             ` [PATCH] Stop considering hw and sw breakpoints duplicates (Re: [PATCH] breakpoint: Make sure location types match before swapping) Pedro Alves
2020-04-20  9:02               ` Andrew Burgess
2020-04-21 16:24               ` Christian Biesinger
2020-04-21 18:31                 ` Pedro Alves
2020-05-02 20:13               ` [PATCH v2] Stop considering hw and sw breakpoint locations duplicates (PR gdb/25741) Pedro Alves
2020-05-17 18:25                 ` Pedro Alves
2020-05-17 18:50                   ` Keno Fischer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200401013813.GA27550@juliacomputing.com \
    --to=keno@juliacomputing.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox