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 105013858C53 for ; Sun, 31 Mar 2024 10:26:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 105013858C53 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 105013858C53 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=1711880811; cv=none; b=B5LVpjmG8+vRMOafjZPF9khjJwYDOPRf0aWRYYNMF/NeJiojLcIdb6MV0JDsiGB9jbBU35+iNw0dw3TTudO8HZ+aS5ZhNoaIO+TTh0ax6V7IcX9S/SgkvnCbbQmPRake5bXy+IVB3Eq7LDyfAtFuGOgHfNeg4l0/wC62P4FtRqk= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1711880811; c=relaxed/simple; bh=j66ioKA1X+U4RGiNnDF7bVVG6BSAFbEVgkWsHJlmz9w=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=BnXw+54BzrMCeOOuo9NTZEMjoNPEwSw1RFuEG12drsh6d+06lYSkbUsKuqbqr9pxPSCQDAp1QC4wofMKdqhJiOIK2Ed/ekRp3iuu+ClaQtoZEG0eBoKGUJTkdIju4s26yZdUx+/ptcXZkGt+Xi1Gc1BdEC5H+l1njbf72ac+iCI= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1711880809; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=eA5+R/vHcdes1+GFuib+KfxXbPaKnXNUnzr1wDlOP38=; b=LdjO5pPFaVRACgaiDJK8z59Aqo5ydPAKRT0+7Gzbmwd63pUphf9jVHcAFoq7v/aP2uGSIX 3+nbY3oBUqfdi7rztmWMVUCUG77JFZiYvxwab+N8ZKm0yTNe7ijkp8bljMDuQOlzp6jBcn hMYRyLbEMCBP7Xhz8YGAg8bC2Xk34LY= Received: from mail-ej1-f69.google.com (mail-ej1-f69.google.com [209.85.218.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-64-N56k4vVQO5Sfq9T9sHZwSA-1; Sun, 31 Mar 2024 06:26:48 -0400 X-MC-Unique: N56k4vVQO5Sfq9T9sHZwSA-1 Received: by mail-ej1-f69.google.com with SMTP id a640c23a62f3a-a4e53b37d9fso59180766b.3 for ; Sun, 31 Mar 2024 03:26:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711880806; x=1712485606; h=mime-version:message-id:date:references:in-reply-to:subject:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=eA5+R/vHcdes1+GFuib+KfxXbPaKnXNUnzr1wDlOP38=; b=m4SWdPeykjFlEpOIWLCV3HV6VKdWtoZ8oRpfBEAxSVBTv/FXMW2IndOT+SOmUaGUyd 4Zs4jrR15PPyWIuRWwnF/Dd+RwAj9IMigux2zeFkl8eLjCaRJKwKQGiIKYuespZEOKBN SLIc5F0l3a2CKW1Jqg3e5OE6RPgbgFiF913E8EVq4OTasz2V4TpElxTTaPomC3hFnV4Q h6GTC1ug5ikOBtA5IwenF/AP132CrE/S4t4lVVqiV1M8aD8GRonDUcDW1WsG7vNuMWRf zzJncOzhCOEbmFwSCZHRi19/ZeFgaq1897ndAoH8uIuKFVR6lAchD7MTxglxnLtRGml7 bRiA== X-Gm-Message-State: AOJu0Yyj7trvqB6/BMJ/B+rX8Oxc8kaMNx+PSWBzYTAZI9Y6stv0ig9e ZaEAifYNLnh6EybgjtzO61M8P2Fkd/Vii74lpl81W9eqDoW1Gq5hi3TET08qusGnm7tFPeZjM3m AEi/LQDKYRI0Nd4VEawzpPRalZMDWJUbzEbhflR/ERB0SwOcX53bK7//w4u9vxzppCzc7DLw6aY KS6Va8RmY1pP5HnmXBcuetvx3PSqW/LeEvCp0t6oe4uOY= X-Received: by 2002:a50:8a99:0:b0:56c:5a49:733 with SMTP id j25-20020a508a99000000b0056c5a490733mr3809162edj.10.1711880805876; Sun, 31 Mar 2024 03:26:45 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH/o0vyGIjIoOKBDuL2DRmeRfACfecp9+HFLuH8tndAeuwjJRc5KmFkt6n2kMBC1M/bvLLR2g== X-Received: by 2002:a50:8a99:0:b0:56c:5a49:733 with SMTP id j25-20020a508a99000000b0056c5a490733mr3809147edj.10.1711880805005; Sun, 31 Mar 2024 03:26:45 -0700 (PDT) Received: from localhost (185.223.159.143.dyn.plus.net. [143.159.223.185]) by smtp.gmail.com with ESMTPSA id f25-20020a056402161900b0056bc0c44f02sm4167302edv.96.2024.03.31.03.26.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 31 Mar 2024 03:26:44 -0700 (PDT) From: Andrew Burgess To: gdb-patches@sourceware.org Subject: Re: [PATCHv9 01/14] gdb: create_breakpoint: add asserts and additional comments In-Reply-To: <73a9f42622184c6916d8fb37acc2a0131fee5fb7.1709651994.git.aburgess@redhat.com> References: <73a9f42622184c6916d8fb37acc2a0131fee5fb7.1709651994.git.aburgess@redhat.com> Date: Sun, 31 Mar 2024 11:26:43 +0100 Message-ID: <87h6gm4rz0.fsf@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-12.0 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 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: Andrew Burgess writes: > 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. I've gone ahead and committed this patch. Thanks, Andrew > --- > 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. > > -- > 2.25.4