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.133.124]) by sourceware.org (Postfix) with ESMTPS id 8F3D8385C6F6 for ; Tue, 3 Oct 2023 21:30:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8F3D8385C6F6 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1696368607; 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=SyPPSCuKAe7bITTV0WJDayV1l4hjeiAHwN3U2vLFQ5w=; b=ir+7UiG1ryiYsH9bgudc/A7gHZSVEmu+cf1etu/HUsLMHKt5Rw1twTG2vVjm1930Vxdr/j TtEVIS6NtWxu56ugw4S42g1ignvF5DCX/kFxIKsbIzSQhaRpFprjySaQCOVa2wgVctmXVj NmtwaqjpnQjOSHIz26OoUbGapIIamQA= Received: from mail-ej1-f71.google.com (mail-ej1-f71.google.com [209.85.218.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-54-iNajHTyTNV-495RyPNveRw-1; Tue, 03 Oct 2023 17:30:05 -0400 X-MC-Unique: iNajHTyTNV-495RyPNveRw-1 Received: by mail-ej1-f71.google.com with SMTP id a640c23a62f3a-9b2cf504e3aso127272666b.2 for ; Tue, 03 Oct 2023 14:30:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696368604; x=1696973404; 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=SyPPSCuKAe7bITTV0WJDayV1l4hjeiAHwN3U2vLFQ5w=; b=X7CwXxP8gd4kd0Gj7WNriVgkj9Lqr384UC8CyLRu5TfuzlIloAB0G8J9VTN3BZriU4 3kJkonHYgd3dU+pyHYqzCmL5muFSjebWy/xVj9yYfdpMaidMCGXllfhABshOq9/nzvwU ci+lvsgT4klCekYs2cOWO1xZUSCkgmTeIm95BUxPV+CuQDtmOVMBZHyl9dqdKSGO4czK SkCCL6GIMtVALvRYIpg+4n4wPFMgGODbkl7zYmnCDTqLe1Q8yfx0djlIuRJVaYcFbP+4 Cb32coQbbZvVJH1uCoiqHJM8Xapz4lKvNTTHCHVvyeFyI5rXrOAqJMdmKMTDwyj4jB0Y 12AA== X-Gm-Message-State: AOJu0YwSsvBo9rq2Dmy7I4ygEo3dKBbXdrXp/QRngT3Aw2kn+vFX6iTx vtpuxeLLo153wLcBuHkEhUzS4ydvn70p0Zmik4qfqbBvg30XwMYEQHRC7bjXl69MlN9iWqkIr4I KHAxQvf6xiZccc36AdCQKHxyVsELZcp9po5xcMnRKg5lvcmX7uwpLPcIylGHcGEMWhDFzsbCaGM sRJL6+7g== X-Received: by 2002:a17:906:2098:b0:9ae:6196:a412 with SMTP id 24-20020a170906209800b009ae6196a412mr327100ejq.69.1696368604221; Tue, 03 Oct 2023 14:30:04 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFqglwaUFmUCP+JyojtLNbLTarhJSv8GDMiz385l+f8Jmjj2SJNIwWTsvpBhHrPBqyLkFERTA== X-Received: by 2002:a17:906:2098:b0:9ae:6196:a412 with SMTP id 24-20020a170906209800b009ae6196a412mr327085ejq.69.1696368603905; Tue, 03 Oct 2023 14:30:03 -0700 (PDT) Received: from localhost ([31.111.84.209]) by smtp.gmail.com with ESMTPSA id a11-20020a170906368b00b0099b8234a9fesm1649515ejc.1.2023.10.03.14.30.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 14:30:03 -0700 (PDT) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: Andrew Burgess , Lancelot SIX Subject: [PATCHv5 08/10] gdb: remove breakpoint_re_set_one Date: Tue, 3 Oct 2023 22:29:41 +0100 Message-Id: <299d1131cc2a53bc09b2d902db26e0016881a538.1696368409.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.6 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_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP 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 0a88f89898f..fcd0dfd9c20 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -13018,17 +13018,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. */ @@ -13040,12 +13029,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 @@ -13062,7 +13050,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