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 3B2683858C3A for ; Fri, 29 Dec 2023 09:27:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3B2683858C3A 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 3B2683858C3A 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=1703842055; cv=none; b=caRyg5reRMWOWseGdiHctV+1TjUCIoLmMYzuS/3m6jGewxGOesxgYluTQIVjG8Q6rKAWNvuViXizvCvwhPLZCFrMpldXzqEA9oJPtjQudtBB+lFfX5c11e3sQDI+IJy7NByODntw8ZSQAAN9ErpkkOGh1h6Zl3B6BKFejo1GJ5w= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1703842055; c=relaxed/simple; bh=ykxPctitxAmYKqcInLyhD9CNF7My8XIiNTPn6CoYIE4=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=W7nI0J62pOYQTNp98M+F2k/fjPbx05egtYYzAHepbN8WA3vVFumH0tt7EvvlKJ8WyuzP02HgOL10Y5KByP0nggvYhEA8MfX/gTmqde9Dxb2bpdXbq4TYoolzt16+CBFMuA8HoO+RTwZ5VoAxwcXx1LyNbi7iu6Zo4+ifPBWiQE8= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1703842044; 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=MTJUxuPDjhY4CVDo6QODqWwKaaO38zn/1al+WVpkX0o=; b=RHHSmqyo/Zl3f8j8rePR0wLZ5frcJtgyuXCMYBSK8SKDjhVFS62GzKLMBnRGzS4ZJGJiVC GLTDvivIuGssPi6FnJp+9RpHrFOFbvlx7UQEW8C3UTkO53j1MMTmlgD49NUPYpRVsR0rWv Q2NGyp7HPEGciRzqwyx76n7mgF7ZOQQ= 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-593-zBNd6F1AOz-idi3kvZFuhg-1; Fri, 29 Dec 2023 04:27:23 -0500 X-MC-Unique: zBNd6F1AOz-idi3kvZFuhg-1 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-40d31116cffso52425765e9.2 for ; Fri, 29 Dec 2023 01:27:23 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703842041; x=1704446841; 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=MTJUxuPDjhY4CVDo6QODqWwKaaO38zn/1al+WVpkX0o=; b=f1rom8FGFFi5LD5+gN/JP2gDbBbkDtmzdM/pi/HW5ZGkFjUGnB0B+qjyoi+n7xxs6Z deMcRqOFVztCELK173s/7gd6q24vpdkMtQ770PtdiI9tqKipYYuCIMeDaV+6Opva4v5O 5JD88LX9g/P4yiFX27IDUKY9Kl+1sELih6gO6QEEFbIbjZCiC6xzZhqjU8H2aDTFJOsy /K1GaqDqsyIowwQuPqW73P2glHJYxQJA+I8rDKtQt0dEYXkWT0zAAx+ix9gAXruAgEuU urnEhb2Yl5iPsp8h6MfIHRR3kG0JRcJX3rCCjVVBpSwxcAe8gVJbtk8zuxHcePuUtLj/ J+jw== X-Gm-Message-State: AOJu0Yy2lkOqN7crFD+PaFxOqGzXVvOqHYv/lbNXICtfPTjyGSOk83jF NDGQ/ktpyeB2/OQqLn+10RXCudwE+CtW74yMvZkLzE4sBbhoIqR0Uq3H24fO84vYvH46JZ0oFFH bZf/RETVI7M2SFb3woK8ds/pM/YgYuqKUHzw+eNN9cDj/LnaBgD5t3iQR3WSzrgDZ5KoRdb6CuD aknYSZdGY8Bw3c/A== X-Received: by 2002:a05:600c:5409:b0:40c:2b29:1bbe with SMTP id he9-20020a05600c540900b0040c2b291bbemr6822105wmb.54.1703842041815; Fri, 29 Dec 2023 01:27:21 -0800 (PST) X-Google-Smtp-Source: AGHT+IFQeB1jTtY0BAVd8gpUmnOovlncnL7lZT5iAf2GNryz/6hDb9OlJp3KQXI9fsqExlItlUXEXQ== X-Received: by 2002:a05:600c:5409:b0:40c:2b29:1bbe with SMTP id he9-20020a05600c540900b0040c2b291bbemr6822099wmb.54.1703842041575; Fri, 29 Dec 2023 01:27:21 -0800 (PST) Received: from localhost ([2a00:23c7:c696:e701:85a5:8a0c:1403:2dc]) by smtp.gmail.com with ESMTPSA id i2-20020a05600c354200b0040d5ac00dc6sm11444261wmq.8.2023.12.29.01.27.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Dec 2023 01:27:20 -0800 (PST) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: Andrew Burgess Subject: [PATCHv8 05/14] gdb: build dprintf commands just once in code_breakpoint constructor Date: Fri, 29 Dec 2023 09:27:00 +0000 Message-Id: <803fe6c7cf5922b972f68a9feedc3decba96cd38.1703841366.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=-13.3 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: I noticed in code_breakpoint::code_breakpoint that we are calling update_dprintf_command_list once for each breakpoint location, when we really only need to call this once per breakpoint -- the data updated by this function, the breakpoint command list -- is per breakpoint, not per breakpoint location. Calling update_dprintf_command_list multiple times is just wasted effort, there's no per location error checking, we don't even pass the current location to the function. This commit moves the update_dprintf_command_list call outside of the per-location loop. There should be no user visible changes after this commit. --- gdb/breakpoint.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 69a6f926b4e..7951b7c5801 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -8707,15 +8707,15 @@ code_breakpoint::code_breakpoint (struct gdbarch *gdbarch_, /* Do not set breakpoint locations conditions yet. As locations are inserted, they get sorted based on their addresses. Let the list stabilize to have reliable location numbers. */ - - /* Dynamic printf requires and uses additional arguments on the - command line, otherwise it's an error. */ - if (type == bp_dprintf) - update_dprintf_command_list (this); - else if (extra_string != nullptr) - error (_("Garbage '%s' at end of command"), extra_string.get ()); } + /* Dynamic printf requires and uses additional arguments on the + command line, otherwise it's an error. */ + if (type == bp_dprintf) + update_dprintf_command_list (this); + else if (extra_string != nullptr) + error (_("Garbage '%s' at end of command"), extra_string.get ()); + /* The order of the locations is now stable. Set the location condition using the location's number. */ int loc_num = 1; -- 2.25.4