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 AF6933858C74 for ; Tue, 3 Oct 2023 21:29:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org AF6933858C74 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=1696368591; 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=ECnPUIAIPYsis186DxA+6qacz30dj39/tvyX8/sPyfs=; b=bKqAM9UrlQkop4A8Byz+Y+G3722L84mNQZcndpMW/lVKEKLYiTvDcEHmnNbvMNJris6Ikv h6nU4Fzf7XEIBoUPbRzPTNX/2RkGZxMKNAgpUNZn9HGLeKpdo4ROURY674D2y3HtOnZ7wT DZ2fmxM+p2Kna+UhSm7sOfjFGqheqEs= 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) From: Andrew Burgess 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 List-Id: 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