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 EA0EA3857C5A for ; Wed, 23 Aug 2023 15:59:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org EA0EA3857C5A 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=1692806365; 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=upMgO8aOh5Nem0FTQNzprZobEb3OlafBNHPj5KFpX+c=; b=MT13Q2pUoEEvrO4IdIcLvQqF768F1J1Nlzuw+WZOC8kmFzmUwGM9VPElev2c582RCVtGWO JhQ+X6V8eYpImb/TzMefs53McyRlC2/H0PbAiyN5ZC+N3enytIk8/a1sD26jjbL+uKUpMC DR+7ZHvXrA39x6QR2TjVOy1k6d8GiQw= 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-180-FOeUg9XuNfSAr3VeUwcGbA-1; Wed, 23 Aug 2023 11:59:24 -0400 X-MC-Unique: FOeUg9XuNfSAr3VeUwcGbA-1 Received: by mail-ej1-f70.google.com with SMTP id a640c23a62f3a-99beea69484so399165766b.0 for ; Wed, 23 Aug 2023 08:59:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692806362; x=1693411162; 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=upMgO8aOh5Nem0FTQNzprZobEb3OlafBNHPj5KFpX+c=; b=dZLvmHuBsqNXmMgzu3SzUcGrxjohFsCWuBduXKb0fjkYi074UjypfjOQoD29FntFYN ptr6xt2DY1NLDjZJsuIo2dOXr/HcoAS7ZuNImQ2SiEqEv1pMlO7jM4Dzix2iLevz70Ay 12T7sGlSL4C4keIwM4wCwMAtnfOrA4/FEXBQE7cCqdLZJ93Xy/W9RTJ25YwKyQPVbmld Gf2XkjFfXX6S52NW3Pkc9CYs6cnAujlwlWG3e0li0DVXpRu5FyWtU0Vwa7jM/wyP470M KMlB+eJGpmXX8v9aTuCaaw+J6ldqJd9smNV6NxC2c0d3QUd1BrxeqrhKpzBZZ8IFe+nS bGDQ== X-Gm-Message-State: AOJu0YxK/+piclgi9igujryc1Hz12prL/VAlwvh1xyABJ1xeL1Ur+72N jSr8EtISUIcF7zz80aDIrjMqFxHyTaqkaKuiQNpchsqcO0h5klzXJfu64kB6yybBbmT6zMVYL6C OthEo+ys8zt3v6ecaipDOhaTWEsHmOzfyEwGLlZS7yKgJwFJGxxFTAC/X8ZQvB9l9ww/KzEeJ7t qTqtDOOw== X-Received: by 2002:a17:907:2718:b0:9a1:cdf1:ba3 with SMTP id w24-20020a170907271800b009a1cdf10ba3mr2154272ejk.27.1692806362495; Wed, 23 Aug 2023 08:59:22 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHBXZmXjzKBf0348O+hTXIp2PflRFgwZ1pQBOWaI6v76zMRQhZIDGHcu06bkSGhtX0Jm0WzTw== X-Received: by 2002:a17:907:2718:b0:9a1:cdf1:ba3 with SMTP id w24-20020a170907271800b009a1cdf10ba3mr2154258ejk.27.1692806362160; Wed, 23 Aug 2023 08:59:22 -0700 (PDT) Received: from localhost ([31.111.84.232]) by smtp.gmail.com with ESMTPSA id d16-20020a17090648d000b0098d2d219649sm9994349ejt.174.2023.08.23.08.59.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Aug 2023 08:59:20 -0700 (PDT) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: Andrew Burgess Subject: [PATCHv4 01/10] gdb: create_breakpoint: add asserts and additional comments Date: Wed, 23 Aug 2023 16:59:06 +0100 Message-Id: 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.8 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: 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 c429af455ff..490aa3f7de7 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -9233,6 +9233,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 1a73d08a887..24ceac2a6ce 100644 --- a/gdb/breakpoint.h +++ b/gdb/breakpoint.h @@ -1597,6 +1597,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