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 DDE70385840B for ; Sun, 31 Mar 2024 10:32:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DDE70385840B 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 DDE70385840B Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1711881125; cv=none; b=ko1Q8o7CiQbX6xrh3mPdOVwpkwVjzL1mRo+KrMceVqcZAYNIhAU6OBnDlnNRfXmh4BRvhGj8F7cUbNFMa3Bhk3Ad+d06NkbHpyU+exXH2I+7apnJsG3IEm1Ma9hh0CbpxCv+u0nAWfHEzIHM6FPo+pEW7rnl+29r2h4AJdvJxaE= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1711881125; c=relaxed/simple; bh=plJUM8qJCRyQO8xoRx1Ajn6GPHo0QIBf9gUWMvnXxJ4=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=MfGrJSbbZ7lddeQxxOC85OJrrIUHpbCObeSXiwGa6TTexDZ9t6TNN7DXiHYucMGqet9d/rcJFi0SkU1TMAHwSf6uV1+wlKE0hgoflxZJJgYmav/74X3qd6VKkZWMnAYOc2wiNSbLDJhMjQfB2EEkk6VvY13lqyM2rWFJaFGgRRI= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1711881122; 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=BYBFNwgI5KGHkz38Qdzb6cpsZju1p299EIG7ju6gFm0=; b=fCrA3R8JJjnH0QHc0rY8JOjnqw/GZg1OUdPl7zlI3AGiQtQAip5Hkja9wrwSr1oSi5YWnL IgT2txRLmYN5AKPqA/cLJE8nifRlKnPiycViqXFLNa6Mhmeh9ExdqJFFOOB15+rh8XJC/B UNVU0yTJDbT3hnyt1tJT2AauXXGVvf0= Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-654-G8MxHYyYP4yN8NvUwTThVg-1; Sun, 31 Mar 2024 06:32:00 -0400 X-MC-Unique: G8MxHYyYP4yN8NvUwTThVg-1 Received: by mail-ej1-f70.google.com with SMTP id a640c23a62f3a-a462e4d8c44so166864166b.1 for ; Sun, 31 Mar 2024 03:32:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711881119; x=1712485919; 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=BYBFNwgI5KGHkz38Qdzb6cpsZju1p299EIG7ju6gFm0=; b=X0tmqW4nkEuF3o0xavdRQ22DsEx5VhYUVlRxZHrVrKG+4Bdvl8j2xnae/hmOQVBda+ XS1JbbJIrkKWJ7X0s96koAYwcZ5DoEmm+Ei1RyJOpjBA7C5wzs4d9Eu4EWZ1vHIYGps1 nx4CjzayLKRxT9orFXCaHwj16I6H/dd/Io+B2BNggmBongLw2yp2hHzAtO/iwh8Lb6Jp U8WjfRCtHps4PhTj67AcKjB/I/F+Bt4R6CzxQmBpn+ybI384fxgvdKFAOjyz6PkXC2KA Zkee+fXDgJcVnZaiOHcicM5bqvNnPLGv4eNBWcx6Wa6S+/QVq1rhBr+aRlxPDhaCEY2N NbKw== X-Gm-Message-State: AOJu0YzgAXjlF54rNJW/DW4UgoWtcQLffF70q+CM4sVljxwQn0sLeO1i p0piCkKTxLoHm+NbHXg1ZpHMUMCMY6Yqag6RIbqjDkOkhE3v2Cl4ylOabZCuyogFjrxXatgYzfZ ybNlKaculp9l2LC5yp+PnB94vpDpaFzt65DmR16ROshsJwPkyu/R1OcSoBcXoe36QZyUWQgLlXb SuI0/Srt8QOsXAwHA+w6GjzR4JFXbmy8aJ+YTtp8cpy5c= X-Received: by 2002:a17:906:e203:b0:a46:22a3:479f with SMTP id gf3-20020a170906e20300b00a4622a3479fmr5501897ejb.21.1711881118652; Sun, 31 Mar 2024 03:31:58 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFn19sOE0Xl27A6d7m2g1IkQyAxfz+m0L5NbJEk/j5MXw+6LXtYdkB0KidZUMtVycgVHSO35g== X-Received: by 2002:a17:906:e203:b0:a46:22a3:479f with SMTP id gf3-20020a170906e20300b00a4622a3479fmr5501883ejb.21.1711881118131; Sun, 31 Mar 2024 03:31:58 -0700 (PDT) Received: from localhost (185.223.159.143.dyn.plus.net. [143.159.223.185]) by smtp.gmail.com with ESMTPSA id cd1-20020a170906b34100b00a4a396ba54asm4100890ejb.93.2024.03.31.03.31.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 31 Mar 2024 03:31:57 -0700 (PDT) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: Andrew Burgess Subject: [PATCHv10 2/9] gdb: remove breakpoint_re_set_one Date: Sun, 31 Mar 2024 11:31:46 +0100 Message-Id: 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.9 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 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 fef7f9a82a4..93645f534f2 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -13211,17 +13211,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. */ @@ -13233,12 +13222,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 @@ -13255,7 +13243,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