From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id fWAXHOWHHGUd6SMAWB0awg (envelope-from ) for ; Tue, 03 Oct 2023 17:30:13 -0400 Authentication-Results: simark.ca; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=y646hm+q; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 5F87B1E0C3; Tue, 3 Oct 2023 17:30:13 -0400 (EDT) Received: from server2.sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 4DCCC1E0C2 for ; Tue, 3 Oct 2023 17:30:11 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D14AF385C6DB for ; Tue, 3 Oct 2023 21:30:10 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D14AF385C6DB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1696368610; bh=ECnPUIAIPYsis186DxA+6qacz30dj39/tvyX8/sPyfs=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=y646hm+qMjPkE3BLXWZvHskw1x+g+CtzNGCtT6wgIOQTwcqiS3j7VgMfDHHh7locy qSz2PncNi1lAawIWyToooO+i6+H5Im+Rtovl53Tu4KzZqZcGd1507+YLn3dogHhQSS fxN2dHMWKhndmK+sGaTXAirQeCxUej9sBW2Ts/FI= 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 AF6933858C74 for ; Tue, 3 Oct 2023 21:29:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org AF6933858C74 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-382-m5VdE0LgMa-1oZz25yMjsg-1; Tue, 03 Oct 2023 17:29:50 -0400 X-MC-Unique: m5VdE0LgMa-1oZz25yMjsg-1 Received: by mail-ej1-f70.google.com with SMTP id a640c23a62f3a-9a9d7a801a3so125968566b.2 for ; Tue, 03 Oct 2023 14:29:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696368588; x=1696973388; 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=ECnPUIAIPYsis186DxA+6qacz30dj39/tvyX8/sPyfs=; b=IjTNd1FX0UIe3Z6ItUcrYgdZO5YwQv8Q5r2IlyGOONLNp0YP5t1CMpjQix5WRXGvLE qk809zTitNgEphTmgAyYTzbSjW5/FZq38DKkOkPhTqfZqNTlUi47phO5JFqNNsKOjJ6A W0os82BkiWQpIbWahzbJR4EXHHQlpgbUFPMiTWyQyks+eUxKKWpu1suWBj8Myo/8LDYz Z2aMcvlRL2T6FyM6EYyLX5tUSuM7D9fm7JggxZW5m/7KWHJ/3h/Gt2Id0y0131Jf5+nq lR8cvZl4TZI1/4suL2Ncf9Yk3x8QYOXDDt0hQzlwT2+oDJ67eUfBF2AjCWV0lj7jCnti XiIA== X-Gm-Message-State: AOJu0YwlHokn8NCzaWEpqtLDPoJwUYIbbcYXDOU3H3Bs/toagivecYz+ B66GTKZRTAEwUw9b38UmZlPpuFO4aFuK0ZSDr1Cr9FC8N5jLBDzWoBALuLhcbR8RHUtwfTBa5pt AHFB8DwSZZW0vfwbi2Xmq+h6VeRZyXvpl1+bIh5V8cKcGjrczQIOvPYxV6D39rooggm1Wi93Y2S lEkWQrNQ== X-Received: by 2002:a17:906:5352:b0:99b:4ed4:5527 with SMTP id j18-20020a170906535200b0099b4ed45527mr347340ejo.25.1696368588798; Tue, 03 Oct 2023 14:29:48 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFGI2IZPOJc19gbuj9o5hzq2A+mmAmd8CSsjcrBupMuZc9qY9nNgc9he2uhWGzqp83zVwnOEg== X-Received: by 2002:a17:906:5352:b0:99b:4ed4:5527 with SMTP id j18-20020a170906535200b0099b4ed45527mr347324ejo.25.1696368588503; Tue, 03 Oct 2023 14:29:48 -0700 (PDT) Received: from localhost ([31.111.84.209]) by smtp.gmail.com with ESMTPSA id jw21-20020a17090776b500b009786c8249d6sm1674875ejc.175.2023.10.03.14.29.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 14:29:47 -0700 (PDT) To: gdb-patches@sourceware.org Cc: Andrew Burgess , Lancelot SIX Subject: [PATCHv5 01/10] gdb: create_breakpoint: add asserts and additional comments Date: Tue, 3 Oct 2023 22:29:34 +0100 Message-Id: <1397b91e6fbb01f410fb859045f0ec8ad300f384.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 X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Andrew Burgess via Gdb-patches Reply-To: Andrew Burgess Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" This commit extends the asserts on create_breakpoint (in the header file), and adds some additional assertions into the definition. The new assert confirms that when the thread and inferior information is going to be parsed from the extra_string, then the thread and inferior arguments should be -1. That is, the caller of create_breakpoint should not try to create a thread/inferior specific breakpoint by *both* specifying thread/inferior *and* asking to parse the extra_string, it's one or the other. There should be no user visible changes after this commit. --- gdb/breakpoint.c | 6 ++++++ gdb/breakpoint.h | 16 ++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index f378edf865e..c3641439911 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -9232,6 +9232,12 @@ create_breakpoint (struct gdbarch *gdbarch, gdb_assert (inferior == -1 || inferior > 0); gdb_assert (thread == -1 || inferior == -1); + /* If PARSE_EXTRA is true then the thread and inferior details will be + parsed from the EXTRA_STRING, the THREAD and INFERIOR arguments + should be -1. */ + gdb_assert (!parse_extra || thread == -1); + gdb_assert (!parse_extra || inferior == -1); + gdb_assert (ops != NULL); /* If extra_string isn't useful, set it to NULL. */ diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h index e75efc90495..07370b83a24 100644 --- a/gdb/breakpoint.h +++ b/gdb/breakpoint.h @@ -1600,6 +1600,22 @@ enum breakpoint_create_flags the FORCE_CONDITION parameter is ignored and the corresponding argument is parsed from EXTRA_STRING. + The THREAD should be a global thread number, the created breakpoint will + only apply for that thread. If the breakpoint should apply for all + threads then pass -1. However, if PARSE_EXTRA is non-zero then the + THREAD parameter is ignored and an optional thread number will be parsed + from EXTRA_STRING. + + The INFERIOR should be a global inferior number, the created breakpoint + will only apply for that inferior. If the breakpoint should apply for + all inferiors then pass -1. However, if PARSE_EXTRA is non-zero then + the INFERIOR parameter is ignored and an optional inferior number will + be parsed from EXTRA_STRING. + + At most one of THREAD and INFERIOR should be set to a value other than + -1; breakpoints can be thread specific, or inferior specific, but not + both. + If INTERNAL is non-zero, the breakpoint number will be allocated from the internal breakpoint count. -- 2.25.4