From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 0W+yFwT+8WpNwDoAWB0awg (envelope-from ) for ; Mon, 09 Nov 2026 12:08:20 -0500 Authentication-Results: simark.ca; dkim=pass (2048-bit key; secure) header.d=adacore.com header.i=@adacore.com header.a=rsa-sha256 header.s=google header.b=HkIqWx6t; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 535F11E0DC; Mon, 09 Nov 2026 12:08:20 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-2.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED, RCVD_IN_VALIDITY_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_BLOCKED autolearn=unavailable autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [38.145.34.32]) (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 BD86D1E023 for ; Mon, 09 Nov 2026 12:08:19 -0500 (EST) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 806A84BA23FB for ; Mon, 9 Nov 2026 17:08:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 806A84BA23FB Authentication-Results: sourceware.org; dkim=pass (2048-bit key, secure) header.d=adacore.com header.i=@adacore.com header.a=rsa-sha256 header.s=google header.b=HkIqWx6t Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) by sourceware.org (Postfix) with ESMTPS id 0C9D04BA23E7 for ; Mon, 9 Nov 2026 17:07:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0C9D04BA23E7 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 0C9D04BA23E7 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::330 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1794244074; cv=none; b=H9uLdnf0mQLHDWVwSphSSm6dUTo/hFkYsmdl7obGZ1lD/hCMYb/WeX6Ke6VIrwudsQYFEi53Ji9N6mSkjz7CHlh+7WAaBG4JjngPV+oAhmz+PnGPKIRRbZ7sw749DriH4GZ8G8wz0iW3o1N/2M3mgJKpqODI17mz4BP4iDMkuzs= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1794244074; c=relaxed/simple; bh=TXiu8ZBkbw9WV2MQzclK0U5QeRkaSoo8DyKYO1ZBhYg=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=QNpaBxWv87Gp9SZs1+zqMwUyKw+v9Xf5ULVmEzDKNcz8oP4KxXtuhLzwgJp+udRVpGewYyt3bciobX8mpY3eXTlQWbQYnng8uvcO+zbCYOmEvsbW/my0t2Uk8v9JsSOdc+ihqn2ij5Gk4b6+lPPcPx2QW9Veczj6XQr+yH+681A= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (2048-bit key, secure) header.d=adacore.com header.i=@adacore.com header.a=rsa-sha256 header.s=google header.b=HkIqWx6t DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0C9D04BA23E7 Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-49d05d51553so8419905e9.2 for ; Mon, 09 Nov 2026 09:07:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1794244073; x=1794848873; darn=sourceware.org; h=content-type:mime-version:user-agent:message-id:date:references :in-reply-to:subject:cc:to:from:from:to:cc:subject:date:message-id :reply-to:content-type; bh=4fWhkMjw6dJWxduXoN5JGTFpMM53nlKCa8qRnMXbb8Q=; b=HkIqWx6tgnfCr6zHfreiDsAosAKRtTJ8/+9wI59EsyJuUgHWAEkHS7Epa0+4ivtf1c WvO0Rk5a5UBr1H1RhCNtiTyj6cf+vcvYzD65r3bsdJQZ6aysNFucGPH810wx+blEH32X iznGQkZLRnUPJkeMqgiwLQKsxQnVQgBWSVLU8SoIPOrDi/q09dp2uuTWU9bqH3MVcK/E FE8JUSioP2k6qRrH9ZBtnVXl9mZ7DxOD/NuWhUS9Bo7cjhQla/IFu8KWEdKIOdfSfzk5 OaHwU63Hvhy47/+mmxh8+MnChBOeOkaDTeOuNArz1evtXXnUAH3SVBM4v+4gw4qh63rc eetw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1794244073; x=1794848873; h=content-type:mime-version:user-agent:message-id:date:references :in-reply-to:subject:cc:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to:content-type; bh=4fWhkMjw6dJWxduXoN5JGTFpMM53nlKCa8qRnMXbb8Q=; b=B2zxHGz7spznwZKogNfMF7Sq3CEH1BJ1/Hyz9u1/0LKhRu/1JB6b8FLd4yxI0lUWXh jugyeVXi/VKmc8vhEyoKqLyM92hM0OyWwUzFQX+ImPPQqBijPW4kyf8WPfo2RJ0Iy5/s sc2iNa1TIUOSgmoTDKQTICWU4U3XozPgkZGZ7Wpf3h1daVigl5i+2pExJui6GK9pp2yP MQr31oyZwb08yorPbmaf4poKPVQ581JVyRdY6LDZyBfyCkec7nTsXeg76cnG3KFY2x9l 9/XXVgPxYoFf4R/Lt4AvJRe7xpZQhDvh+byTECjv51DFYmOWWyBR6myQVURvyxBuDjZ0 VsUA== X-Gm-Message-State: APuU4Z9SggoSvcHWQahDnt34pSaaCTO2jhLAekJU90UbebSEB6OhYpsX utjGM3o+FmfXSMqdJbNIFBgBokA5u5nucLRyTpUvBGU03sqHHFFXtYs7Znaqjp+V/r9GZ7vq8op rayhAwQ== X-Gm-Gg: AYBFou2OrZcB4WPy3BSZsHrjDSVp7Vq6/QLJfxdRF7tdXQY5pGtwBkSXtqBeUQH+LUe VRX7NuLh+4VhcUUnjXlIAI9e5jdUQGjX7ZQLnIt547WWZRjNhEFzxi0pe87GAV6BovEmZdA9E48 V9PTqjkff2h5kKfe1YFwWUNKQYGOFvH8gAvoUiLv7fg0FFVZrJ99S4ZJAH3upkwerhnPLhbaPGe FSIJeK21uRqKdPDVvattgKsUaH8fUDQTwpV8cdZFufiyWxFbJBS1uNJgmo6pazZlC58FXoxmzxC Lwkb9gfk1rw83rZSkPVG32uLDTufi5IF3L5XxAQCElGXvYjQM90Vhrn7DyNMLSsKbhHm2HwkVIj FPO5KhBw9z3dPalEhE+ZJZmaa4t78mcMuNJ6zkgZgu96G3RCNR7gwI4fyrR5zfaPJBRnwmfM6+5 nCOXN7DA1qnWe6wac/I6tOTtuOMsaa19tm+cEvPKcmbjc8/lOwfcCUBH0eX/Ped6e5tv/vhX/g0 /IttDgSY5ZiASN4kW9mUWCP5U5p0h8lMCA5eUTIqHKBgv8zYx/NrM6PW0+ib3V96XnMdoD6+OJN bfS7JzLdmk40veqvfR4YUY3/HfQlq3HHR/tTh5v7Og== X-Received: by 2002:a05:600c:46d1:b0:4a1:7d9b:d4ae with SMTP id 5b1f17b1804b1-4b960d9c486mr97614135e9.5.1794244072899; Mon, 09 Nov 2026 09:07:52 -0800 (PST) Received: from legouguec-Precision-7550 ([2.57.72.67]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4ba01d89f22sm4169645e9.3.2026.11.09.09.07.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Nov 2026 09:07:52 -0800 (PST) From: =?utf-8?Q?K=C3=A9vin_Le_Gouguec?= To: Simon Marchi Cc: gdb-patches@sourceware.org Subject: Re: [PATCH v3 1/2] gdb: Introduce ada-tasks.h for functions defined in ada-tasks.c In-Reply-To: References: <20230127165337.1832937-1-legouguec@adacore.com> <7561007673151647213c12316b34961b5ee9f657.1793983731.git.legouguec@adacore.com> <87bj7ys6wy.fsf@adacore.com> Date: Mon, 09 Nov 2026 18:07:51 +0100 Message-ID: <8733tarl08.fsf@adacore.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" 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 --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Simon Marchi writes: >>> I check that by opening the file in my VSCode+clangd, if there is any >>> error reported it means something is missing. >>=20 >> Thanks for mentioning; decided to give clangd a try and after some >> .clangd fiddling=C2=B9, I do get a warning-free ada-tasks.h with your >> amendments. I'm curious whether & how you configure it tho, since I get >> more spurious-looking diagnoses if I venture into other files=C2=B2; I'm >> assuming I'm missing more compilation flags, and wondering how best to >> get an "authoritative" list & keep it up-to-date. >>=20 >> (Searched gdb-patches because I'm sure you've mentioned your clangd >> setup before, but could not find my answers) >>=20 >> (FWIW, I think that's the first language server I try with Eglot that >> defaults to enabling inlay hints & semantic tokens. Thanks for the >> hearty fruit salad =F0=9F=98=80) >>=20 >>=20 >> =C2=B9 Current state of affairs: >>=20 >> > > I would not try to do it by hand, use a generated compile_commands.json > isntead. Do a clang build somewhere (if you don't have one already), > you can start with this and adjust to your liking: > > $ ../path/to/configure CC=3D"ccache clang" CXX=3D"ccache clang++" --e= nable-targets=3Dall --with-python=3Dpython3 --with-guile --enable-sim --dis= able-werror > > Then build with "bear" to generate compile_commands.json: > > $ bear -- make -j $(nproc) > > If the build fails in a middle and you have to tweak something, do a > "make clean" and start over, because bear by default replaces the entire > compile_commands.json, so you could be missing what was previously > successfully compiled (or you could use "bear -a" I guess, but I prefer > starting from scratch). > > The reason I am using a clang build for this is that if you build with > gcc, then compile_commands.json will contain some flags unknown to > clang, and at least a long time ago clangd would warn about them. Maybe > that improved in the recent years. > > You can disable the directories you don't care about (e.g. "--disable-ld"= ). > > Then, make a symlink from your source dir to the compile_commands.json: > > $ cd path/to/source > $ ln -s path/to/clang/build/compile_commands.json > > Now, clangd should be mostly error-free when opening anything. Thanks for the recipe; worked flawlessly AFAICT. IOW, after 1. 'apt install bear ccache clang clangd' 2. your recipe, (more-or-less; see attached) 3. M-x eglot, Most LSP functions I cared to test before reporting seemed to work. "Friendship ended with 'make TAGS', .dir-locals.el & tags-table-list; now 'bear -- make', compile_commands.json, clangd & Eglot are my best friends", as the meme goes. (Tho I really need to 'M-x customize-group eglot-semantic-fontification'; the current colors feel like nyan-mode got sick of the mode-line and broke containment) >> =C2=B2 E.g. all members of gdb/ada-tasks.c:struct ada_tasks_pspace_data = are >> flagged with >>=20 >>> clang [expected_semi_decl_list]: Expected ';' at end of declaration list > > It's not expected, let's see if that goes away once you have a > compile_commands.json. The error did go away. Reviewing compile_commands.json, the missing piece might have been just '-x c++': if I scrap compile_commands.json, restore my handcrafted .clangd and add that switch, those specific errors on struct ada_tasks_pspace_data do go away. Tho there's still a dozen more errors, so I'll keep compile_commands.json for now. Again, thanks for taking the time to describe your setup, that's going to help me with much more than just include hygiene. (And as for the series, will submit v4 momentarily) --=-=-= Content-Type: text/x-sh Content-Disposition: attachment; filename=clangd.sh #!/bin/bash set -eux test -e .git || { echo >&2 "Re-run from the repository root directory." exit 1 } SRCDIR=${PWD} CLANGDIR=${PWD}.clangd declare -a CFGFLAGS=( CC='ccache clang' CXX='ccache clang++' --enable-targets=all --with-python=python3 --disable-{binutils,gas,gprof,gprofng,ld,libctf,nls,plugins,sim} --disable-werror ) mkdir -p "${CLANGDIR}" ( cd "${CLANGDIR}" "${SRCDIR}"/configure "${CFGFLAGS[@]}" bear -- make -j$(nproc --all) ) ln -fsv "${CLANGDIR}"/compile_commands.json "${SRCDIR}" --=-=-=--