From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 563iHIa3+2c4ZzIAWB0awg (envelope-from ) for ; Sun, 13 Apr 2025 09:09:26 -0400 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=el58BVXw; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 66A801E0C3; Sun, 13 Apr 2025 09:09:26 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-6.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=4.0.1 Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id F3CDA1E05C for ; Sun, 13 Apr 2025 09:09:25 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 71EDD3858C56 for ; Sun, 13 Apr 2025 13:09:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 71EDD3858C56 Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=el58BVXw Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTP id 5FB923858D29 for ; Sun, 13 Apr 2025 13:08:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5FB923858D29 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine 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 5FB923858D29 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=1744549733; cv=none; b=N1iGgAkkmlsSN2EYotolnmCcVLFq5ey02eqQAL0ZsqHO4su7gvvGKzTjN0xPE4UelWG8oT2KeaoW6MpWU9o4K0Ar3Orgl0wnvKT4Bvqc7oQ8XKJyuFxGndWQe+0kX85xZsV4iknTIcbcOJr4R0X2JShyyHMlrG5+SBqDnwze9c4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1744549733; c=relaxed/simple; bh=/530GOWFb9ZoyFpB2LmZLNM5sxo2qFoq1LuSgdSATbg=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=rnOfvc2HOsSkzpwTtwLHpEhO/5WF0BQtD2JPZuaJmvbHqFMvUcAYFh4zSjC4UeooEtGNBF6fJFpZdZnhQudKrhz/GSFyncf0zrzgv66qa16bH8zRHsop2/sV67bOZDH/lSWMKXd9CeYfjbmUqJrYxdVtKchQxQt9HvgN525y8tI= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5FB923858D29 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1744549733; 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; bh=ULu1svW2oDoMZPMzXBKYe2vrYBdBn99U9Rne+zyJ1DU=; b=el58BVXwvNQ0dDKY/YkCI4gPlD+INJxOJi/Hz4o1CtN2R9RI+p/O3SBUoK1w3VcL2SBCQy 4yU7gNzMlkzX6Da+ZYKZtfcwhcI1DeIS6K7e0HV/lg8G+/HIts5NmXQ6g/uE54N9sKcY4f kk6bY/SQTRzslgZYGbNWQ4iXWKa+wlY= 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-678-2njdB3g6NCuLdsMGt-lx8g-1; Sun, 13 Apr 2025 09:08:50 -0400 X-MC-Unique: 2njdB3g6NCuLdsMGt-lx8g-1 X-Mimecast-MFC-AGG-ID: 2njdB3g6NCuLdsMGt-lx8g_1744549729 Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-43cf172ffe1so29733645e9.3 for ; Sun, 13 Apr 2025 06:08:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1744549728; x=1745154528; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=ULu1svW2oDoMZPMzXBKYe2vrYBdBn99U9Rne+zyJ1DU=; b=NZ9XjvmU41oETBGiw7UX5T93U0JlUIvleraZ9KxD2vxUaguoAQdu0hJ7Cyn3hcxrxv ZvNrzms+1+yhCkmGK7WDZTaZFbPbU4m1H5LqjTGweuj6wW6GJUj/4cBkacHnNrog9Jjp DtEY7izgvLKPXMQUPZjk4JZjWVikemSCNvpvwoOr/z9xTEjsJJw2Z6ccggJwdESARZWv Mi5L/FWETiKjLmVZG5j244XJgHkL2h+O3iNCudg2sD5FJB1k25dj6rqsk8mVxdatvT7B be4AdV7tuiexvuE0SNU8E2Ld05d+L86/8kj/HdZtHAMA7X5l5/WdwnyKYs/xV8eapJZp 7K5g== X-Gm-Message-State: AOJu0Yxzli9s4G7vsd2RNe++toIFaExLdWwO9RbcUoSP39UhKh0xZ2Fo L4iX0OlVWp+27jjcXsRS0zYFFX7jGYaRmyrylJkDRgSpijC5CPUSgB2RVKOozfKBmNtP7DNaYBX t5LWdnzc4XYQy9Kflqjx6i+XkuZi08ZCkh+ejj9oO39mf9wLqEd/M8zX0b8yNKEMNhQBMTKo3tN 9SCYh9P/maJzYs9C5r4zWWE64xSXHPWrHPF3yGEtkN7q8= X-Gm-Gg: ASbGncsAz1nxXgOcErq2q+AV3IrprRYzkhiyRjCbw3o69TuP44cffVrIYGPLESd4xor tI9rKRpXw0YepCk4waPsUfAH2rMQC7t/jrZyuR2WLXyf3ocxheG9nNpb7xuce1g7X4qMZkZjqbF VqZW6V31Wo3X2RjzSfX4mxU1XL/MoPrVoRJkKcoGo/I1O4I0m4/y05d8D8h2+mGemQPaqAUNcSK V5AfLOmadlbKJ3i43P/f7MNdW/jyqf21zgGF5mjxRiSwKeQajDiSenYq5M1zhzRyuN2nzUqEQ7R 9H0xfCgTQt7MXcS7a+P1tezNZUtSHW2auxHk X-Received: by 2002:a05:600c:458b:b0:43c:fc0c:7f33 with SMTP id 5b1f17b1804b1-43f3a925f6amr78995725e9.2.1744549728066; Sun, 13 Apr 2025 06:08:48 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEnL32yHb+vuo+v5ba8empn9l/pYkUIk0WlHQ+ghJGpbX3DVY34qeuWd8IxNIV/YAPBtnBaPQ== X-Received: by 2002:a05:600c:458b:b0:43c:fc0c:7f33 with SMTP id 5b1f17b1804b1-43f3a925f6amr78995515e9.2.1744549727495; Sun, 13 Apr 2025 06:08:47 -0700 (PDT) Received: from localhost (30.226.159.143.dyn.plus.net. [143.159.226.30]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-39eae96c03dsm7724892f8f.24.2025.04.13.06.08.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 13 Apr 2025 06:08:47 -0700 (PDT) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: Andrew Burgess Subject: [PATCH] gdb: add an assert to cmd_list_element constructor Date: Sun, 13 Apr 2025 14:08:45 +0100 Message-ID: <423dd71ea44c518a22cfaf09b8dd5e9932cbf922.1744549721.git.aburgess@redhat.com> X-Mailer: git-send-email 2.47.1 MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: y9qXNQuqOaEuEyY1T8CvGNub0lkjqfwrBBRPC7pDiw0_1744549729 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit content-type: text/plain; charset="US-ASCII"; x-default=true 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~public-inbox=simark.ca@sourceware.org The cmd_list_element::doc variable must be non-nullptr, otherwise, in `help_cmd` (cli/cli-decode.c), we will trigger an assert when we run one of these lines: gdb_puts (c->doc, stream); or, gdb_puts (alias->doc, stream); as gdb_puts requires that the first argument (the doc string) be non-nullptr. Better, I think, to assert when the cmd_list_element is created, rather than catching an assert later when 'help CMD' is used. I only ran into this case when messing with the Python API command creation code, I accidentally created a command with a nullptr doc string, and only found out when I ran 'help CMD' and got an assertion. Built and tested on x86-64 GNU/Linux with an all-targets build; I don't see any regressions, so (I hope) there are no commands that currently violate this assertion. --- gdb/cli/cli-decode.h | 1 + 1 file changed, 1 insertion(+) diff --git a/gdb/cli/cli-decode.h b/gdb/cli/cli-decode.h index 217afbc8ca7..673cf6518d3 100644 --- a/gdb/cli/cli-decode.h +++ b/gdb/cli/cli-decode.h @@ -62,6 +62,7 @@ struct cmd_list_element type (not_set_cmd), doc (doc_) { + gdb_assert (doc != nullptr); memset (&function, 0, sizeof (function)); } base-commit: 33d5188ab101bf414c9950ba914a128d08166105 -- 2.47.1