From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 42D5D398CC05 for ; Wed, 5 Jun 2024 13:32:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 42D5D398CC05 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 42D5D398CC05 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1717594379; cv=none; b=hfnzzfec0c0HHDFq7xuom+edyStQtN/yMSAxgVlH6Ltd81Ll9lBHZfuC2tqbzXFKf2g0LM0eKBnbssan4A7PzIp9Jrp2i9qNcqUga5s4iNmoXJyhZVpjazQ5UlHHCGqX0Cl+l8iFz004gVKZF9nrPpVnGTzjfr8Xw319G2qjBLc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1717594379; c=relaxed/simple; bh=BlVqXzn6W8PqxUqA+H297UcQcg4m8gn+wr7Z2JHVvkw=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=iFrrEnntDWw5e0Pek2qEBgfcaEClVOYV1+MYCoOoszChvJGVlPg5zOTsruMqrtvPOzuMgg+Z88WYjrGyiWxiqkjVrv3pspfmZJQbGdmdDQovKCQc11z4WOjQKmRSCouwIpJs9ItDtvQyhOx3hr7nX5d5ZeT6KoR9HnullJLoFIQ= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1717594374; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/hgY6gcUPsvmDkuEWbS4eCT9Rhu1VHIjqkzXzPRa9RY=; b=M8e2llrxBe2pPmV6u2UopPCBNzhOeswiyDntNCcWJcvaepMbmQdOy3r3HqulcaN/2aPQ9Q mU0XgI9BUVsLqZH7UibL/h8OnJOsbX/AYWvtniAdIDuTYo1AEtSqrtuAsrDMHmGXvbpidV Y10eSgc6MJLT/QK87wyA3G8Jr9I2aig= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-677-mEcmOfFENXmrJvwec7ubSg-1; Wed, 05 Jun 2024 09:32:53 -0400 X-MC-Unique: mEcmOfFENXmrJvwec7ubSg-1 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-42129c0b821so18189355e9.0 for ; Wed, 05 Jun 2024 06:32:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717594370; x=1718199170; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/hgY6gcUPsvmDkuEWbS4eCT9Rhu1VHIjqkzXzPRa9RY=; b=mZ4DE1QpdOD/U1xZA0qxlO/ZZFWeWBU2q2ye2rebRE7yGdXSpiD2wISdVLqhipiQYk ukhSsfmYwtVE/G4zL38QIRO3LHmt05/xsUmI+jluzkFt37G/90zKnvSjCFpCBxbUIidS Pxjhrz/pi30AWsbsXKR1CbsSDdPmy2hvPav1Mo0Tbbr4D9c9fVhpVVe7uuvfbWjhhqjJ r3KeFUfdI2SNnP/fRZcKNiA7V/SJrH2fCc0kJ76cJHcdohNWkD7hAY2A+/MLKJS8uPEo 1MgYDkGBPXr+yra4+97BqqACn1JGrle/TtqyXTd1qmIKykYWoCaCIzM5MuqjFK02HQJQ 5F1w== X-Gm-Message-State: AOJu0Yzht6EizY1poVuZFMEfH1MrFa1mmZPJZYS5jGqLY0JfsrUXe/S0 eRDwV+/+dKmTglK5/dXp1ycqcpgJ8ngnKAfbCvObnnM79PQWPkS08uhqq24s46dwWdUX3kFW3QS 10smYwmUi1bWz9tKgOYjBvAZTJaOplJQJbGt1cEb06MQRdirt4ZrYc2dYcIiqrZs+I1ikR+hypC wuMASg5tJ8pR127RutSrtQsAku6EySHKEZlMh52O4HuFQ= X-Received: by 2002:a05:600c:b85:b0:421:2edb:d207 with SMTP id 5b1f17b1804b1-4215632eb27mr21900535e9.28.1717594369636; Wed, 05 Jun 2024 06:32:49 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGY5N+PVlp+/qCGq+NDFyAhq+MQ3AjLKU5j+KRk3J/B7SGzs2q3mj5ziBGn8Co/ZhU3gbCMMw== X-Received: by 2002:a05:600c:b85:b0:421:2edb:d207 with SMTP id 5b1f17b1804b1-4215632eb27mr21900355e9.28.1717594369274; Wed, 05 Jun 2024 06:32:49 -0700 (PDT) Received: from localhost ([31.111.84.186]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-421580fe3bfsm22546905e9.8.2024.06.05.06.32.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 06:32:47 -0700 (PDT) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: Andrew Burgess Subject: [PATCHv11 2/9] gdb: remove breakpoint_re_set_one Date: Wed, 5 Jun 2024 14:32:36 +0100 Message-Id: <77b94ef7885499f6a9e94f91bc10331246e6d4d9.1717594119.git.aburgess@redhat.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: References: MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-Spam-Status: No, score=-11.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: During a later patch I wanted to reset a single breakpoint, so I called breakpoint_re_set_one. However, this is not the right thing to do. If we look at breakpoint_re_set then we see that there's a whole bunch of state that needs to be preserved prior to calling breakpoint_re_set_one, and after calling breakpoint_re_set_one we still need to call update_global_location_list. I could just update the comment on breakpoint_re_set_one to make it clearer how the function should be used -- or more likely to warn that the function should only be used as a helper from breakpoint_re_set. However, breakpoint_re_set_one is only 3 lines long. So I figure it might actually be easier to just fold breakpoint_re_set_one into breakpoint_re_set, then there's no risk of accidentally calling breakpoint_re_set_one when we shouldn't. There should be no user visible changes after this commit. --- gdb/breakpoint.c | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 058902551bb..6f9750e19fa 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -13215,17 +13215,6 @@ create_sals_from_location_spec_default (location_spec *locspec, parse_breakpoint_sals (locspec, canonical); } -/* Reset a breakpoint. */ - -static void -breakpoint_re_set_one (breakpoint *b) -{ - input_radix = b->input_radix; - set_language (b->language); - - b->re_set (); -} - /* Re-set breakpoint locations for the current program space. Locations bound to other program spaces are left untouched. */ @@ -13237,12 +13226,11 @@ breakpoint_re_set (void) scoped_restore save_input_radix = make_scoped_restore (&input_radix); scoped_restore_current_pspace_and_thread restore_pspace_thread; - /* breakpoint_re_set_one sets the current_language to the language - of the breakpoint it is resetting (see prepare_re_set_context) - before re-evaluating the breakpoint's location. This change can - unfortunately get undone by accident if the language_mode is set - to auto, and we either switch frames, or more likely in this context, - we select the current frame. + /* To ::re_set each breakpoint we set the current_language to the + language of the breakpoint before re-evaluating the breakpoint's + location. This change can unfortunately get undone by accident if + the language_mode is set to auto, and we either switch frames, or + more likely in this context, we select the current frame. We prevent this by temporarily turning the language_mode to language_mode_manual. We restore it once all breakpoints @@ -13259,7 +13247,9 @@ breakpoint_re_set (void) { try { - breakpoint_re_set_one (&b); + input_radix = b.input_radix; + set_language (b.language); + b.re_set (); } catch (const gdb_exception &ex) { -- 2.25.4