From patchwork Fri Dec 29 09:26:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Burgess X-Patchwork-Id: 82981 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 A49B03858431 for ; Fri, 29 Dec 2023 09:29:07 +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 C69DB3858C60 for ; Fri, 29 Dec 2023 09:27:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C69DB3858C60 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 C69DB3858C60 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=1703842040; cv=none; b=nnvsJ4dLvI2wGAVtxxetIUVgKNa8jWffG1VUIplx9e997l/ITAzey+3pUj0ZdzXkWNBrRvOixplLFZu41m6XwhqNE6HgpfIGcdq3uKjyseyhyiKXxXr9tcEtIegAkeUgSR1eCrYfLWgoFt5dXnAzi27Xc1nmssPflSmeCVukiQ8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1703842040; c=relaxed/simple; bh=JarNcrPeM1Tkt/tStYSjbfWA36l30qIQafhxHD0gMq0=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=p+dNGGwRm/huARl+TdxhQBlsQlqVnKMwPI06MAVh0qrQfJmP/nhRKP4zGtQvprjp9rmLr463cZdwoaPggG3PRstEGK0nCBDtGXraL60yHsMeDSxHu3Z+N5+NAIhT9RTMDyB98TOjRWzibSVmGIcls7z+1ZuZ3hqMCAJOMTgzr5E= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1703842037; 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=OY+Gf73Bo8Au8S3+XeFwRU9yDuMeCepiH9ZTcz/mlws=; b=Kg/y2JHE+Wp0ucGZeRJK3l9cXB8xGV9Owse7+PORmxWkTH1QXSpaNL0sRYI3/sZ9nJXeeq fvuBZHPtgDa5LEohhmtbjAMebAqt4tmcOdnKw6ocQnA3wVpraNhOyJkvYy+yFl0U9HgUPu iha3Qda/KL6uSq45ykdFp2OEPjdhKd4= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-384-KKhjnkBlNd6EroGS8MrDdg-1; Fri, 29 Dec 2023 04:27:16 -0500 X-MC-Unique: KKhjnkBlNd6EroGS8MrDdg-1 Received: by mail-wr1-f69.google.com with SMTP id ffacd0b85a97d-336992b0f37so4086987f8f.0 for ; Fri, 29 Dec 2023 01:27:15 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703842034; x=1704446834; 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=OY+Gf73Bo8Au8S3+XeFwRU9yDuMeCepiH9ZTcz/mlws=; b=qu5Khbb9co+eZGmUpBF0WfDFI7pDx1V2VHMbGIOTCTgOkBCDCAAWqT708kvX606UWF c4BiOR1qXsaB22f4fDgr+iMmhLlsy3xn4FQJUjn+2IcikTwX5XN48CjtOTIO1o2Ndqmf /d44gZAHHWA8G4NlPJaby3nsQFdZrLz2GHJkLQThY/iTkhZFGxy8+KtvbWo7aRCUNi96 BF7on/1VkVFifDdWBHMQp4rz9nmuDf0B1nPkmOs5t1yKPpudqV+6cBUbt/l8/LzmIloO zCiq4LGJfyicFBO3CEfrK44Dxsy+m05lHX3l+qn3JaHNTcOdryoDOiRIOc4/X0SAo80+ iJZg== X-Gm-Message-State: AOJu0Yx5GPvBt34ls1bIGYw5xTCCbHnakbH7wV3VXctZMaebsOw6Nqka 964uYclMkqXnJRoYBbkeynIDpel4f3o03/fohky8Dgm1otAWJGAdUmbwhTQOa/KyPHvScv90Zky o4XDJY2d++kDnSBiF0dgijUY0L47rRDGiuJpO4SBJa/gp3B9Zi1pjy40pw2p3Cv9cznsTwHNAE1 HJ69sVVIeZ8N5nfA== X-Received: by 2002:a05:6000:71b:b0:337:1333:1f9a with SMTP id bs27-20020a056000071b00b0033713331f9amr1311461wrb.54.1703842033799; Fri, 29 Dec 2023 01:27:13 -0800 (PST) X-Google-Smtp-Source: AGHT+IFljIpKWl9q3Z9QBkZBhqxu3yTr09HtZCyMZypDu2yOSOTt8Oz14KXpnCRPtb6AJDkCmzG/Ng== X-Received: by 2002:a05:6000:71b:b0:337:1333:1f9a with SMTP id bs27-20020a056000071b00b0033713331f9amr1311453wrb.54.1703842033545; Fri, 29 Dec 2023 01:27:13 -0800 (PST) Received: from localhost ([2a00:23c7:c696:e701:85a5:8a0c:1403:2dc]) by smtp.gmail.com with ESMTPSA id z10-20020a5d4d0a000000b00336a2566aa2sm14379526wrt.61.2023.12.29.01.27.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Dec 2023 01:27:12 -0800 (PST) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: Andrew Burgess Subject: [PATCHv8 01/14] gdb: create_breakpoint: add asserts and additional comments Date: Fri, 29 Dec 2023 09:26:56 +0000 Message-Id: <11033e5072c97c5b8257f74ae657d5d9f1e7e676.1703841366.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.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, 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 bd7f74671ce..c16530c5400 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 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.