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 CEA88385841F for ; Wed, 13 Dec 2023 22:38:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CEA88385841F 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 CEA88385841F 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=1702507125; cv=none; b=iQuz0v3GWYDsnLIGWlEBNc3963vH83XoiRvYlhIq67HWXCeimOq7SQVTqDg0gvuxty6lkSzWhfeIoYFTtA55YLYRmY16r70nuG3HQJd8QvNpuhuR9U0vOt7N52mAAG7XW/yZwrdA2GtxUmFELm7J1gbPGwK3HEmU0w06uPsdQ+Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702507125; c=relaxed/simple; bh=3qUvTUM83UVBHdHDZk5gd8rsk5O2OIPUNb1XU8KNCxI=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=mIkJJ7EYxe3t2IULqRixPFxXg0xPze2SYIwveecgmjvOqW3dUGCiDlk8sbLR9ulRjccMPGOGtgnjrC3OT/2b0N72FIRVmP7F54KMjYFkEQV4VL8ZvRqd+w/YEw3Id9WK7Jc7B7dDfw3XlxxBhocs3aKBHS3QA9i0IOcbjAN8zWk= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1702507123; 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=fqAfwjwJ+tsP656fC86maCm7HCrj5VMhl4yax3LeuWQ=; b=ivYDf7F+v7KoKHXkpZXsZBOy/0iDu8PtWygnU/QwCK5a3IyVs0NIijE3IKkiRSCssswt5c q9ohB94o/YgzR4gGScOuS7l9biLTP4yhuMKRdojDSIPf1xtP59v0nlDvcN90qX656Dnyrs 2FseFlaaZh4XgT6d0oxnpc2ptTlh+9o= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-610-dJU5OVzUNuKROxwFQXfbHw-1; Wed, 13 Dec 2023 17:38:42 -0500 X-MC-Unique: dJU5OVzUNuKROxwFQXfbHw-1 Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-40c421f2686so28169475e9.1 for ; Wed, 13 Dec 2023 14:38:41 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702507120; x=1703111920; 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=fqAfwjwJ+tsP656fC86maCm7HCrj5VMhl4yax3LeuWQ=; b=X5SZVejZGaRUgmpctRqGYiGUvgfbzOMXXm0CgjmN2galaMaZ/R7jmgWiP/Aa3kI8i2 tKrN3jMjFmZJecE5hVMo7rKFibavIEfjzhlTjWblCDB+cZDYMyVNRr2SgYI/UeTkT0MV k5wawFDKOIbbYIIomgUjxouoHHPbsQNRsyy6DyXi84nD/USv6az7KW7IDgbFxAtZsk9S 03IZuWpZFA0G6GRe38/8dna2B36JEfqJT8fRGApHypP439tUbxdbQMn2zgYxk0+1lOAA QO0SmXmtUyMEhj8m9fNf29QoK9/Ol5JS2BoMOWpEvRPyeXrZ3xHiuAHzUf7EsC9c4Wwb kb0Q== X-Gm-Message-State: AOJu0YydibSOM72KcI2ttJNEnLUB2FIs0ikL3uU/9tTFeoSoJY5GWALH e4+R6qbjlvgidlrTKUZzmNSGZvS54pC0ddlxlzxnPmDntvAHV9CNTURmQuBLdsMj218hF/h16iv FAXG/om+6+oXf9xn0/8g8VJvrOf8q2YdKSqjMPdFPO+UEKpqdzb9wGD1VzL7ExBR6yOtHMtFr+c n+f+jAhw== X-Received: by 2002:a05:600c:1686:b0:40c:2c5f:b91b with SMTP id k6-20020a05600c168600b0040c2c5fb91bmr2191261wmn.172.1702507120373; Wed, 13 Dec 2023 14:38:40 -0800 (PST) X-Google-Smtp-Source: AGHT+IHsU47ZbAa4PQEU0tc8pjSKKw408qLp9eHudLmJU8X0Jff7VsTMH1CZ0AMgTv6nzwl05jazbQ== X-Received: by 2002:a05:600c:1686:b0:40c:2c5f:b91b with SMTP id k6-20020a05600c168600b0040c2c5fb91bmr2191257wmn.172.1702507120000; Wed, 13 Dec 2023 14:38:40 -0800 (PST) Received: from localhost (105.226.159.143.dyn.plus.net. [143.159.226.105]) by smtp.gmail.com with ESMTPSA id s13-20020a05600c384d00b004030e8ff964sm24419052wmr.34.2023.12.13.14.38.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 14:38:38 -0800 (PST) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: Andrew Burgess Subject: [PATCHv7 01/11] gdb: create_breakpoint: add asserts and additional comments Date: Wed, 13 Dec 2023 22:38:25 +0000 Message-Id: <11e05c2edeefd119a41a89fd94ebd2836c14715e.1702507015.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.7 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,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: 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 699919e32b3..c0d6991c96d 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -9228,6 +9228,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 feb798224c0..4abf6d0762c 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