From patchwork Tue Mar 5 15:21:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Burgess X-Patchwork-Id: 86800 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C07D8385843A for ; Tue, 5 Mar 2024 15:22:27 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org 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 33C85385840F for ; Tue, 5 Mar 2024 15:21:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 33C85385840F 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 33C85385840F 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=1709652116; cv=none; b=mO4dYYMXltHYRce249QCnbXhemh/utTRfRJlRHPc2FCVrt+Da08xt6taH3BiluPAu+oPcqoJi8xeJcPpWetz0rbRYuECAl5o0jwkLZ9Q6ffb409xjCyW8TYh06v879E2J1tKBWpgPzGq6JByBrDn1yIbh0s0gmVa0kQ6YwTXVHE= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1709652116; c=relaxed/simple; bh=yuhcXQP9AtwyM/hIi373kXx2Hx1X14UH4K0Xe473pn0=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=Y5PsU+OYZTl3YBRyNmXPYpLQI29GzXSSI8nV7oYhr1uSSR+g/3+aqj+TtJiUEdI0Bcuwu4jwXwjck6JdOGmz1TFz0L0Vm16Ifmo95uInopFpmQcGn4NF3OQITwYBpTfOwmH12s68RTewhHTd7mEp9bkmsyfK4WqbPoAcvcaQDHo= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1709652114; 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=oQHVR4ubD3OO3vRECMaqWaU7vhOWT4J89Fy2R2N4E3k=; b=LeZSz0N+5ipV2uOR8VgSj2Jd0veB2Xy+1Aa6cqztQBiKH+sCivCQqiry+6gXkgUNqlNrYO 86fajBQGuCOQPgh+CQHZVvwGfKaPApzHeGbxFDgTc9ZUcb282HeECTVymWmvZyst8R9ZO0 9avAzg7KpVvNvG19j5vXSBkFKXcXQss= Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-190-d4WwdVuzMdGSEfGSS8UOhg-1; Tue, 05 Mar 2024 10:21:53 -0500 X-MC-Unique: d4WwdVuzMdGSEfGSS8UOhg-1 Received: by mail-ed1-f69.google.com with SMTP id 4fb4d7f45d1cf-558aafe9bf2so6196602a12.1 for ; Tue, 05 Mar 2024 07:21:53 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709652111; x=1710256911; 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=oQHVR4ubD3OO3vRECMaqWaU7vhOWT4J89Fy2R2N4E3k=; b=vW2C+AzyJYHQ2vVTe9Vql2mTyqpfHADsvj/Rkl6RQG7Wnnv0QsyE7S1VQob8lmhkhU dIQUMtIqzDw/rdq8eG6kTFrQbA6MqqrLbVolS5hMlDRXG2l8IaHY+rII+iU4GgnOlENI NYir63O94Px7TlD31OeyLeUF/HU1iu1SFXFS9YJt60J6BH8zuE9P3f/xgB+TDbsCNymv CZ0IFbg05YN8agSqFx4ir9Fdu/figdeZQbBzUe5IBX6T7QKwSTdAVQHXu/viHcTZ6cAm 1ppHi/F5FJQIdgs6Yh7eNd86YuvzM+2nAoxb0re/L+RXCV8XfU0VLXuiLBFCBJOWDg8k hIcA== X-Gm-Message-State: AOJu0YxrzDfgETQvPWc5qZXerCe5BX67TPjAveqZ4dNYA2UETtRrrV0R fdH47n8JanDkcpwSHW4N/kXNXU6JjwxpPSX5TukozINDDR3Aqb9WHl5/L/6sH87kRan34qkdCUP w21mCtbqqo75RequO4wt6REqmsDULzBEHMtnQiUfpkQaw9BZeG/J2EbGa+UjqicfcbFx79gtYxi YN/KJq7Kw8v168i2Gm3KRInpX7cuRxKsnttSgWVeNO2YU= X-Received: by 2002:a05:6402:2027:b0:565:e4b7:e784 with SMTP id ay7-20020a056402202700b00565e4b7e784mr7105050edb.40.1709652111275; Tue, 05 Mar 2024 07:21:51 -0800 (PST) X-Google-Smtp-Source: AGHT+IGEgdoO44XUsSpp1dcVz0n/XuIwlxolWCTSemX6EbbD7WIqAGkZt7IUe53VPVB83u4NyLLI1Q== X-Received: by 2002:a05:6402:2027:b0:565:e4b7:e784 with SMTP id ay7-20020a056402202700b00565e4b7e784mr7105027edb.40.1709652110659; Tue, 05 Mar 2024 07:21:50 -0800 (PST) Received: from localhost (185.223.159.143.dyn.plus.net. [143.159.223.185]) by smtp.gmail.com with ESMTPSA id r18-20020aa7cb92000000b005653c441a20sm5915992edt.34.2024.03.05.07.21.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Mar 2024 07:21:50 -0800 (PST) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: Andrew Burgess Subject: [PATCHv9 01/14] gdb: create_breakpoint: add asserts and additional comments Date: Tue, 5 Mar 2024 15:21:32 +0000 Message-Id: <73a9f42622184c6916d8fb37acc2a0131fee5fb7.1709651994.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 X-Spam-Status: No, score=-12.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 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: , Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org 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 102bd7fad41..7ade82663f9 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -9219,6 +9219,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 226e4d06993..2e2fe1d32e5 100644 --- a/gdb/breakpoint.h +++ b/gdb/breakpoint.h @@ -1610,6 +1610,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.