From: Pedro Alves <pedro@palves.net>
To: Simon Marchi <simon.marchi@efficios.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH v2 3/4] gdb, gdbserver, gdbsupport: include early header files with `-include`
Date: Tue, 26 Mar 2024 11:57:56 +0000 [thread overview]
Message-ID: <dda84ef1-aa7a-4d38-9a7c-3ea4d2fb3125@palves.net> (raw)
In-Reply-To: <20240323021648.154109-4-simon.marchi@efficios.com>
On 2024-03-23 02:14, Simon Marchi wrote:
> With this change, clangd picks up the -include option from the compile
> command, and is able to analyze the header file correctly, as it sees
> all that stuff included or defined but that -include option. That works
but that -> by that
> - There is one problem for gdbserver's Makefile: we do not want to
> include server.h when building `gdbreplay.o`. So we can't simply put
> the `-include` in `INTERNAL_CFLAGS`. I added the `-include` option
> to the `COMPILE` and `IPAGENT_COMPILE` variables, and added a special
> rule to compile `gdbreplay.o`.
>
...
> diff --git a/gdbserver/Makefile.in b/gdbserver/Makefile.in
> index 45073abca493..4d29491a8721 100644
> --- a/gdbserver/Makefile.in
> +++ b/gdbserver/Makefile.in
> @@ -69,9 +69,11 @@ COMPILE.pre = $(CXX) $(CXX_DIALECT)
> COMPILE.post = -c -o $@
> POSTCOMPILE = @true
>
> +INCLUDE_SERVER_H = -include $(srcdir)/server.h
> +
...
> +# Rule for gdbreplay.o. This is the same as COMPILE, without INCLUDE_SERVER_H.
> +
> +gdbreplay.o: gdbreplay.cc
> + $(ECHO_CXX) $(COMPILE.pre) $(INTERNAL_CFLAGS) $(CXXFLAGS) $(COMPILE.post) $<
It would seem better to make gdbreplay include common-defs.h with -include, to me. Any
reason not to do that?
next prev parent reply other threads:[~2024-03-26 11:58 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-23 2:14 [PATCH v2 0/4] Include early include " Simon Marchi
2024-03-23 2:14 ` [PATCH v2 1/4] gdb, gdbserver, gdbsupport: reformat some Makefile variables, one entry per line Simon Marchi
2024-03-23 2:14 ` [PATCH v2 2/4] {gdb, gdbserver}/Makefile.in: remove unnecessary intermediary variables Simon Marchi
2024-03-23 2:14 ` [PATCH v2 3/4] gdb, gdbserver, gdbsupport: include early header files with `-include` Simon Marchi
2024-03-26 11:57 ` Pedro Alves [this message]
2024-03-26 14:39 ` Simon Marchi
2024-03-26 15:31 ` Pedro Alves
2024-03-26 15:49 ` Simon Marchi
2024-03-23 2:14 ` [PATCH v2 4/4] gdb, gdbserver, gdbsupport: remove includes of early headers Simon Marchi
2024-03-26 11:59 ` Pedro Alves
2024-03-26 14:58 ` Simon Marchi
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=dda84ef1-aa7a-4d38-9a7c-3ea4d2fb3125@palves.net \
--to=pedro@palves.net \
--cc=gdb-patches@sourceware.org \
--cc=simon.marchi@efficios.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