Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Simon Marchi <simark@simark.ca>
To: "Kévin Le Gouguec" <legouguec@adacore.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH v3 1/2] gdb: Introduce ada-tasks.h for functions defined in ada-tasks.c
Date: Mon, 9 Nov 2026 10:02:03 -0500	[thread overview]
Message-ID: <bee9c3a2-4b3e-4efe-94ae-038eea25f1b5@simark.ca> (raw)
In-Reply-To: <87bj7ys6wy.fsf@adacore.com>

On 11/9/26 4:14 AM, Kévin Le Gouguec wrote:
> Simon Marchi <simark@simark.ca> writes:
> 
>> On 11/6/26 11:51 AM, Kévin Le Gouguec wrote:
>>> Also move the documentation for these functions to the new header, instead
>>> of at the top of their definition, to align with our current practice.
>>>
>>> I tried to honor our guideline that .c files should not rely on indirect
>>> inclusion, hence I only removed #include "ada-lang.h" directives in .c files
>>> that, as far as I could tell, only rely on symbols declared in ada-tasks.h.
>>
>> Tom can perhaps more formally approve, but I like this patch.
> 
> (Thanks for taking a look!)
> 
>> I check that by opening the file in my VSCode+clangd, if there is any
>> error reported it means something is missing.
> 
> Thanks for mentioning; decided to give clangd a try and after some
> .clangd fiddling¹, 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²; I'm
> assuming I'm missing more compilation flags, and wondering how best to
> get an "authoritative" list & keep it up-to-date.
> 
> (Searched gdb-patches because I'm sure you've mentioned your clangd
> setup before, but could not find my answers)
> 
> (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 😀)
> 
> 
> ¹ Current state of affairs:
> 
>     If:
>       PathMatch: gdb.*/.*.[ch]
>     CompileFlags:
>       Add:
>         - -I/ABSOLUTE/PATH/TO/binutils-gdb/include
>         - -I/ABSOLUTE/PATH/TO/binutils-gdb/gdb
>         - -I/ABSOLUTE/PATH/TO/binutils-gdb/gnulib/import
>         - -I/ABSOLUTE/PATH/TO/binutils-gdb
>         - -I/ABSOLUTE/PATH/TO/binutils-gdb/bfd
>         - -include
>         - /ABSOLUTE/PATH/TO/binutils-gdb/gdbsupport/common-defs.h

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="ccache clang" CXX="ccache clang++" --enable-targets=all --with-python=python3 --with-guile --enable-sim --disable-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.

> Curious if the file can be kept "relocatable", i.e. free of absolute
> paths.  From the doc & open GH issues, unsure whether compilation
> commands are relative to the project root, or if some placeholder exists
> that will be expanded to the project root.

I don't think it's worth maintaining something like that.  There are
also some include paths that point into the actual build you are using,
so that would be quite complicated.

> ² E.g. all members of gdb/ada-tasks.c:struct ada_tasks_pspace_data are
> flagged with
> 
>> 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.

Simon

  reply	other threads:[~2026-11-09 15:02 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-12 17:10 [PATCH] Fix Ada tasking for baremetal targets using Ravenscar threads Kévin Le Gouguec via Gdb-patches
2023-01-12 18:19 ` Simon Marchi via Gdb-patches
2023-01-13 12:32   ` Kévin Le Gouguec via Gdb-patches
2023-01-13 16:29     ` Simon Marchi via Gdb-patches
2023-01-13 17:16       ` Kévin Le Gouguec via Gdb-patches
2023-01-27 16:53         ` [PATCH v2 0/3] " Kévin Le Gouguec via Gdb-patches
2023-01-27 16:53           ` [PATCH v2 1/3] gdb: Introduce ada-tasks.h for functions defined in ada-tasks.c Kévin Le Gouguec via Gdb-patches
2023-01-27 16:53           ` [PATCH v2 2/3] gdb/ada-tasks: Make the ada_tasks_pspace_data getter public Kévin Le Gouguec via Gdb-patches
2023-01-27 16:53           ` [PATCH v2 3/3] gdb: Fix Ada tasking for baremetal targets using Ravenscar threads Kévin Le Gouguec via Gdb-patches
2026-11-06 16:51           ` [PATCH v3 0/2] " Kévin Le Gouguec
2026-11-06 16:51             ` [PATCH v3 1/2] gdb: Introduce ada-tasks.h for functions defined in ada-tasks.c Kévin Le Gouguec
2026-11-06 19:43               ` Simon Marchi
2026-11-09  9:14                 ` Kévin Le Gouguec
2026-11-09 15:02                   ` Simon Marchi [this message]
2026-11-09 17:07                     ` Kévin Le Gouguec
2026-11-06 16:51             ` [PATCH v3 2/2] gdb: Fix CPU ID offset for Ravenscar Threads Kévin Le Gouguec
2026-11-13 16:40             ` [PATCH v4 0/2] Fix Ada tasking for baremetal targets using Ravenscar threads Kévin Le Gouguec
2026-11-13 16:40               ` [PATCH v4 1/2] gdb: Introduce ada-tasks.h for functions defined in ada-tasks.c Kévin Le Gouguec
2026-11-13 16:40               ` [PATCH v4 2/2] gdb: Fix CPU ID offset for Ravenscar Threads Kévin Le Gouguec

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bee9c3a2-4b3e-4efe-94ae-038eea25f1b5@simark.ca \
    --to=simark@simark.ca \
    --cc=gdb-patches@sourceware.org \
    --cc=legouguec@adacore.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox