From patchwork Mon Oct 30 16:11:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Burgess X-Patchwork-Id: 78768 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 558A438319E7 for ; Mon, 30 Oct 2023 16:11:59 +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 91C543858438 for ; Mon, 30 Oct 2023 16:11:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 91C543858438 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 91C543858438 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=1698682283; cv=none; b=E9BUg35l9MSddc7IZm93eSw1kacCofqjOwbY+HqSn8PwuXnHp12EHdCbywbhM4XQXW02aR+OInIUpgK+uzbEGpiFLvqLXlfeI4EEK/4N3nP5W0aGfAi3tTXvbFr4XGNs04JuMUNJpr+j8cUs9UTpXV5r/l9SJOIAhAYKCeeBAy0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698682283; c=relaxed/simple; bh=LzsP3gY+yro9Zzs57CKvtu/cBeVJuQkMxVrJr2cGhdA=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=jOzNtuCGUYAQ71PO9KhYUpgOjTXJutDTu/7F9JwRUGtSxS+0wbPcUON6A17An9hs8b0Yf+qmPhVUUjYJ+pbtMBLZE1Umh8Aoey/q1phyqgAMShPYNtqXg+DANJCbGrDkfY6ffXdsQ38Oi2K2qWKuON8x104k3JJTinyrDvuwWCs= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1698682282; 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=3Dbc8tal1kK4IzL549qRqSk93bF/XxpdO9t6+wy1Cas=; b=Cf9iLVItwReKz6u/c1aPrXi5BJZKNJre0mkUZyuwDdzVzDocu37QxZLLX77oZwTGmbsJGa Kmdszu4/lgjUSsm/6tIeHx1ecGeMKwZSAZlI4YdZMp2eYjH0fgPzevDSWJFY5KVqvnu9kI ixX1DMzZlQrMUbbrLg4BrItmXbcpv5A= Received: from mail-ej1-f71.google.com (mail-ej1-f71.google.com [209.85.218.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-302-IjQHPp-pP4GmZA5l2hUEgQ-1; Mon, 30 Oct 2023 12:11:20 -0400 X-MC-Unique: IjQHPp-pP4GmZA5l2hUEgQ-1 Received: by mail-ej1-f71.google.com with SMTP id a640c23a62f3a-9c7f0a33afbso323043366b.3 for ; Mon, 30 Oct 2023 09:11:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698682279; x=1699287079; 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=3Dbc8tal1kK4IzL549qRqSk93bF/XxpdO9t6+wy1Cas=; b=DD6gAdx13Vklm2+n0ApAmfOi6/IAzq5qnfDmslb5xuonU1uP18wGBCqO/YZs1MJ6k4 uOPo0M97N87QSEOHArcCBPHJX8AnZwjAEkiYIBjruuOBV+uW+NY1rfGWRgk9uHSOhJXe 9E1Hj8sFQd8I9AMf3fp2zbeyEK5iirkWW2cT5Wayebyrdg5ArVRRikE4qZCNXyl4+kkH 4avxJeDSQk/okMJ41lf4rSFPmm1aF+k8VIzfa9TJsTRfXNnzzP3G06ju9s19sDlPJOPi cp0sz8y0Qu9osIO8bX+fZMsH38PPWYgAgGOsuD27GlAh+MJMLDhP+OXipCmtIHH1UAU6 7ALg== X-Gm-Message-State: AOJu0YxJ+yGBc+wV09rK/u3ivokb+JicHUfLbn06jScFWGRkJEJ9hUQD FPIVSjKrdLvmCU5T7kAcR7XQ570HL0HlRigjdmFSKtQB/BOsD1hRu1T7BbJMzep/8VNRrgXTK6R 9QSd4fGQ251rmhk/RcL57fbFyyhsIrhs+wNmX7pBXZNYTp3/yS2D8nTlfWI4YQvWwLV7oHmOXYp Tziq92Sg== X-Received: by 2002:a17:907:6222:b0:9bf:65b0:1122 with SMTP id ms34-20020a170907622200b009bf65b01122mr5827406ejc.69.1698682279187; Mon, 30 Oct 2023 09:11:19 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEXplQMjPrX7kCNU+j1nsgyDqx7XvgyluUOs5oe2BxlJiewB/0m9Z15hUsMokBQktX+GEOKVw== X-Received: by 2002:a17:907:6222:b0:9bf:65b0:1122 with SMTP id ms34-20020a170907622200b009bf65b01122mr5827391ejc.69.1698682278773; Mon, 30 Oct 2023 09:11:18 -0700 (PDT) Received: from localhost ([31.111.84.209]) by smtp.gmail.com with ESMTPSA id n13-20020a170906088d00b009ade1a4f795sm6120816eje.168.2023.10.30.09.11.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Oct 2023 09:11:18 -0700 (PDT) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: Andrew Burgess Subject: [PATCHv6 01/10] gdb: create_breakpoint: add asserts and additional comments Date: Mon, 30 Oct 2023 16:11:05 +0000 Message-Id: <55c5841baa0a64f5b41cf6acbabff62afacc7a14.1698682161.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=-11.9 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 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 828c99cabc0..bf496f5e222 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -9229,6 +9229,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.